* [PATCH v2 0/2] ipmi: ssif_bmc: Add GPIO-based alert mechanism
@ 2024-10-22 1:20 Potin Lai
2024-10-22 1:20 ` [PATCH v2 1/2] bindings: ipmi: Add alert GPIO enhancement for SSIF BMC driver Potin Lai
2024-10-22 1:20 ` [PATCH v2 2/2] ipmi: ssif_bmc: add GPIO-based alert mechanism Potin Lai
0 siblings, 2 replies; 9+ messages in thread
From: Potin Lai @ 2024-10-22 1:20 UTC (permalink / raw)
To: Corey Minyard, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Quan Nguyen, Patrick Williams
Cc: openipmi-developer, devicetree, linux-kernel, Cosmo Chou,
Potin Lai, Potin Lai, Cosmo Chou
This patch series introduces a GPIO-based alert mechanism in the SSIF
BMC driver. It allows the BMC to notify the host when a response is
ready, improving communication efficiency between the BMC and host.
Signed-off-by: Potin Lai <potin.lai.pt@gmail.com>
---
Changes in v2:
- Adding gpio.h include in ssif-bmc.yaml examples.
- Link to v1: https://lore.kernel.org/r/20241019-ssif-alert-gpios-v1-0-483eee5f99d3@gmail.com
---
Cosmo Chou (1):
ipmi: ssif_bmc: add GPIO-based alert mechanism
Potin Lai (1):
bindings: ipmi: Add alert GPIO enhancement for SSIF BMC driver
Documentation/devicetree/bindings/ipmi/ssif-bmc.yaml | 8 ++++++++
drivers/char/ipmi/ssif_bmc.c | 15 +++++++++++++++
2 files changed, 23 insertions(+)
---
base-commit: 8e929cb546ee42c9a61d24fae60605e9e3192354
change-id: 20241019-ssif-alert-gpios-1b9960f991b1
Best regards,
--
Potin Lai <potin.lai.pt@gmail.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 1/2] bindings: ipmi: Add alert GPIO enhancement for SSIF BMC driver
2024-10-22 1:20 [PATCH v2 0/2] ipmi: ssif_bmc: Add GPIO-based alert mechanism Potin Lai
@ 2024-10-22 1:20 ` Potin Lai
2024-10-22 5:59 ` Krzysztof Kozlowski
2024-10-22 1:20 ` [PATCH v2 2/2] ipmi: ssif_bmc: add GPIO-based alert mechanism Potin Lai
1 sibling, 1 reply; 9+ messages in thread
From: Potin Lai @ 2024-10-22 1:20 UTC (permalink / raw)
To: Corey Minyard, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Quan Nguyen, Patrick Williams
Cc: openipmi-developer, devicetree, linux-kernel, Cosmo Chou,
Potin Lai, Potin Lai
Introduce the `alert-gpios` property to define an alert pin, enabling
the BMC to notify the host when a response is available.
Signed-off-by: Potin Lai <potin.lai.pt@gmail.com>
---
Documentation/devicetree/bindings/ipmi/ssif-bmc.yaml | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/Documentation/devicetree/bindings/ipmi/ssif-bmc.yaml b/Documentation/devicetree/bindings/ipmi/ssif-bmc.yaml
index 02b662d780bb..7142151a3787 100644
--- a/Documentation/devicetree/bindings/ipmi/ssif-bmc.yaml
+++ b/Documentation/devicetree/bindings/ipmi/ssif-bmc.yaml
@@ -19,6 +19,12 @@ properties:
reg:
maxItems: 1
+ alert-gpios:
+ description:
+ GPIO pin designated for SSIF alert, used by the BMC to notify the
+ host when a response is available.
+ maxItems: 1
+
required:
- compatible
- reg
@@ -27,6 +33,7 @@ additionalProperties: false
examples:
- |
+ #include <dt-bindings/gpio/gpio.h>
i2c {
#address-cells = <1>;
#size-cells = <0>;
@@ -34,5 +41,6 @@ examples:
ssif-bmc@10 {
compatible = "ssif-bmc";
reg = <0x10>;
+ alert-gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
};
};
--
2.31.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 2/2] ipmi: ssif_bmc: add GPIO-based alert mechanism
2024-10-22 1:20 [PATCH v2 0/2] ipmi: ssif_bmc: Add GPIO-based alert mechanism Potin Lai
2024-10-22 1:20 ` [PATCH v2 1/2] bindings: ipmi: Add alert GPIO enhancement for SSIF BMC driver Potin Lai
@ 2024-10-22 1:20 ` Potin Lai
2024-10-24 4:29 ` Quan Nguyen
1 sibling, 1 reply; 9+ messages in thread
From: Potin Lai @ 2024-10-22 1:20 UTC (permalink / raw)
To: Corey Minyard, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Quan Nguyen, Patrick Williams
Cc: openipmi-developer, devicetree, linux-kernel, Cosmo Chou,
Potin Lai, Potin Lai, Cosmo Chou
From: Cosmo Chou <chou.cosmo@gmail.com>
Implement GPIO-based alert mechanism in the SSIF BMC driver to notify
the host when a response is ready.
This improves host-BMC communication efficiency by providing immediate
notification, potentially reducing host polling overhead.
Signed-off-by: Cosmo Chou <chou.cosmo@gmail.com>
---
drivers/char/ipmi/ssif_bmc.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/drivers/char/ipmi/ssif_bmc.c b/drivers/char/ipmi/ssif_bmc.c
index a14fafc583d4..73be166b0042 100644
--- a/drivers/char/ipmi/ssif_bmc.c
+++ b/drivers/char/ipmi/ssif_bmc.c
@@ -17,6 +17,7 @@
#include <linux/spinlock.h>
#include <linux/timer.h>
#include <linux/jiffies.h>
+#include <linux/gpio/consumer.h>
#include <linux/ipmi_ssif_bmc.h>
#define DEVICE_NAME "ipmi-ssif-host"
@@ -102,6 +103,7 @@ struct ssif_bmc_ctx {
struct ssif_part_buffer part_buf;
struct ipmi_ssif_msg response;
struct ipmi_ssif_msg request;
+ struct gpio_desc *alert;
};
static inline struct ssif_bmc_ctx *to_ssif_bmc(struct file *file)
@@ -222,6 +224,9 @@ static ssize_t ssif_bmc_write(struct file *file, const char __user *buf, size_t
/* Clean old request buffer */
memset(&ssif_bmc->request, 0, sizeof(struct ipmi_ssif_msg));
+
+ if (!IS_ERR(ssif_bmc->alert))
+ gpiod_set_value(ssif_bmc->alert, 1);
exit:
spin_unlock_irqrestore(&ssif_bmc->lock, flags);
@@ -584,6 +589,9 @@ static void process_smbus_cmd(struct ssif_bmc_ctx *ssif_bmc, u8 *val)
memset(&ssif_bmc->part_buf.payload[0], 0, MAX_PAYLOAD_PER_TRANSACTION);
if (*val == SSIF_IPMI_SINGLEPART_WRITE || *val == SSIF_IPMI_MULTIPART_WRITE_START) {
+ if (!IS_ERR(ssif_bmc->alert))
+ gpiod_set_value(ssif_bmc->alert, 0);
+
/*
* The response maybe not come in-time, causing host SSIF driver
* to timeout and resend a new request. In such case check for
@@ -640,6 +648,8 @@ static void on_read_requested_event(struct ssif_bmc_ctx *ssif_bmc, u8 *val)
calculate_response_part_pec(&ssif_bmc->part_buf);
ssif_bmc->part_buf.index = 0;
*val = ssif_bmc->part_buf.length;
+ if (!IS_ERR(ssif_bmc->alert))
+ gpiod_set_value(ssif_bmc->alert, 0);
}
static void on_read_processed_event(struct ssif_bmc_ctx *ssif_bmc, u8 *val)
@@ -808,6 +818,11 @@ static int ssif_bmc_probe(struct i2c_client *client)
if (!ssif_bmc)
return -ENOMEM;
+ /* Request GPIO for alerting the host that response is ready */
+ ssif_bmc->alert = devm_gpiod_get(&client->dev, "alert", GPIOD_ASIS);
+ if (!IS_ERR(ssif_bmc->alert))
+ gpiod_direction_output(ssif_bmc->alert, 0);
+
spin_lock_init(&ssif_bmc->lock);
init_waitqueue_head(&ssif_bmc->wait_queue);
--
2.31.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v2 1/2] bindings: ipmi: Add alert GPIO enhancement for SSIF BMC driver
2024-10-22 1:20 ` [PATCH v2 1/2] bindings: ipmi: Add alert GPIO enhancement for SSIF BMC driver Potin Lai
@ 2024-10-22 5:59 ` Krzysztof Kozlowski
0 siblings, 0 replies; 9+ messages in thread
From: Krzysztof Kozlowski @ 2024-10-22 5:59 UTC (permalink / raw)
To: Potin Lai
Cc: Corey Minyard, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Quan Nguyen, Patrick Williams, openipmi-developer, devicetree,
linux-kernel, Cosmo Chou, Potin Lai
On Tue, Oct 22, 2024 at 09:20:46AM +0800, Potin Lai wrote:
> Introduce the `alert-gpios` property to define an alert pin, enabling
> the BMC to notify the host when a response is available.
>
> Signed-off-by: Potin Lai <potin.lai.pt@gmail.com>
> ---
> Documentation/devicetree/bindings/ipmi/ssif-bmc.yaml | 8 ++++++++
> 1 file changed, 8 insertions(+)
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 2/2] ipmi: ssif_bmc: add GPIO-based alert mechanism
2024-10-22 1:20 ` [PATCH v2 2/2] ipmi: ssif_bmc: add GPIO-based alert mechanism Potin Lai
@ 2024-10-24 4:29 ` Quan Nguyen
2024-11-19 1:47 ` Potin Lai
2024-11-19 11:30 ` Corey Minyard
0 siblings, 2 replies; 9+ messages in thread
From: Quan Nguyen @ 2024-10-24 4:29 UTC (permalink / raw)
To: Potin Lai, Corey Minyard, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Patrick Williams
Cc: openipmi-developer, devicetree, linux-kernel, Cosmo Chou,
Potin Lai, Cosmo Chou
On 22/10/2024 08:20, Potin Lai wrote:
> From: Cosmo Chou <chou.cosmo@gmail.com>
>
> Implement GPIO-based alert mechanism in the SSIF BMC driver to notify
> the host when a response is ready.
>
> This improves host-BMC communication efficiency by providing immediate
> notification, potentially reducing host polling overhead.
>
> Signed-off-by: Cosmo Chou <chou.cosmo@gmail.com>
> ---
> drivers/char/ipmi/ssif_bmc.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
Thanks for adding feature to this driver, the code looks good to me.
Reviewed-by: Quan Nguyen <quan@os.amperecomputing.com>
I'm just have a bit of curious on how the ipmi_ssif in host side to work
with this mechanism? Will there be patches for ipmi_ssif to use this
feature followed?
Thanks and Best regards,
- Quan
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 2/2] ipmi: ssif_bmc: add GPIO-based alert mechanism
2024-10-24 4:29 ` Quan Nguyen
@ 2024-11-19 1:47 ` Potin Lai
2024-11-19 11:30 ` Corey Minyard
1 sibling, 0 replies; 9+ messages in thread
From: Potin Lai @ 2024-11-19 1:47 UTC (permalink / raw)
To: Quan Nguyen
Cc: Corey Minyard, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Patrick Williams, openipmi-developer, devicetree, linux-kernel,
Cosmo Chou, Potin Lai, Cosmo Chou
On Thu, Oct 24, 2024 at 12:29 PM Quan Nguyen
<quan@os.amperecomputing.com> wrote:
>
>
>
> On 22/10/2024 08:20, Potin Lai wrote:
> > From: Cosmo Chou <chou.cosmo@gmail.com>
> >
> > Implement GPIO-based alert mechanism in the SSIF BMC driver to notify
> > the host when a response is ready.
> >
> > This improves host-BMC communication efficiency by providing immediate
> > notification, potentially reducing host polling overhead.
> >
> > Signed-off-by: Cosmo Chou <chou.cosmo@gmail.com>
> > ---
> > drivers/char/ipmi/ssif_bmc.c | 15 +++++++++++++++
> > 1 file changed, 15 insertions(+)
> >
>
> Thanks for adding feature to this driver, the code looks good to me.
>
> Reviewed-by: Quan Nguyen <quan@os.amperecomputing.com>
>
> I'm just have a bit of curious on how the ipmi_ssif in host side to work
> with this mechanism? Will there be patches for ipmi_ssif to use this
> feature followed?
>
> Thanks and Best regards,
> - Quan
Hi Quan,
Sorry for the late reply.
This implementation is only tested with our BIOS team, and they are
not using linux driver for ssif feature.
At moment, we don't have plan to add changes in ipmi_ssif.
Thanks,
Potin
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 2/2] ipmi: ssif_bmc: add GPIO-based alert mechanism
2024-10-24 4:29 ` Quan Nguyen
2024-11-19 1:47 ` Potin Lai
@ 2024-11-19 11:30 ` Corey Minyard
2024-11-20 1:58 ` Quan Nguyen
1 sibling, 1 reply; 9+ messages in thread
From: Corey Minyard @ 2024-11-19 11:30 UTC (permalink / raw)
To: Quan Nguyen
Cc: Potin Lai, Corey Minyard, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Patrick Williams, openipmi-developer, devicetree,
linux-kernel, Cosmo Chou, Potin Lai, Cosmo Chou
On Wed, Oct 23, 2024 at 11:30 PM Quan Nguyen
<quan@os.amperecomputing.com> wrote:
>
>
>
> On 22/10/2024 08:20, Potin Lai wrote:
> > From: Cosmo Chou <chou.cosmo@gmail.com>
> >
> > Implement GPIO-based alert mechanism in the SSIF BMC driver to notify
> > the host when a response is ready.
> >
> > This improves host-BMC communication efficiency by providing immediate
> > notification, potentially reducing host polling overhead.
> >
> > Signed-off-by: Cosmo Chou <chou.cosmo@gmail.com>
> > ---
> > drivers/char/ipmi/ssif_bmc.c | 15 +++++++++++++++
> > 1 file changed, 15 insertions(+)
> >
>
> Thanks for adding feature to this driver, the code looks good to me.
>
> Reviewed-by: Quan Nguyen <quan@os.amperecomputing.com>
>
> I'm just have a bit of curious on how the ipmi_ssif in host side to work
> with this mechanism? Will there be patches for ipmi_ssif to use this
> feature followed?
I just saw this. What makes you think alerts are not supported in ipmi_ssif?
-corey
>
> Thanks and Best regards,
> - Quan
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 2/2] ipmi: ssif_bmc: add GPIO-based alert mechanism
2024-11-19 11:30 ` Corey Minyard
@ 2024-11-20 1:58 ` Quan Nguyen
2024-11-20 2:31 ` Corey Minyard
0 siblings, 1 reply; 9+ messages in thread
From: Quan Nguyen @ 2024-11-20 1:58 UTC (permalink / raw)
To: Corey Minyard
Cc: Potin Lai, Corey Minyard, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Patrick Williams, openipmi-developer, devicetree,
linux-kernel, Cosmo Chou, Potin Lai, Cosmo Chou
On 19/11/2024 18:30, Corey Minyard wrote:
> On Wed, Oct 23, 2024 at 11:30 PM Quan Nguyen
> <quan@os.amperecomputing.com> wrote:
>>
>>
>>
>> On 22/10/2024 08:20, Potin Lai wrote:
>>> From: Cosmo Chou <chou.cosmo@gmail.com>
>>>
>>> Implement GPIO-based alert mechanism in the SSIF BMC driver to notify
>>> the host when a response is ready.
>>>
>>> This improves host-BMC communication efficiency by providing immediate
>>> notification, potentially reducing host polling overhead.
>>>
>>> Signed-off-by: Cosmo Chou <chou.cosmo@gmail.com>
>>> ---
>>> drivers/char/ipmi/ssif_bmc.c | 15 +++++++++++++++
>>> 1 file changed, 15 insertions(+)
>>>
>>
>> Thanks for adding feature to this driver, the code looks good to me.
>>
>> Reviewed-by: Quan Nguyen <quan@os.amperecomputing.com>
>>
>> I'm just have a bit of curious on how the ipmi_ssif in host side to work
>> with this mechanism? Will there be patches for ipmi_ssif to use this
>> feature followed?
>
> I just saw this. What makes you think alerts are not supported in ipmi_ssif?
>
Yes, Corey, I see alerts are supported in ipmi_ssif.
My apology about the unclear question, I was just curious about whether
this gpio-based alerts mechanism is confirmed through test with current
ipmi_ssif without any extra patches.
Thanks,
- Quan
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 2/2] ipmi: ssif_bmc: add GPIO-based alert mechanism
2024-11-20 1:58 ` Quan Nguyen
@ 2024-11-20 2:31 ` Corey Minyard
0 siblings, 0 replies; 9+ messages in thread
From: Corey Minyard @ 2024-11-20 2:31 UTC (permalink / raw)
To: Quan Nguyen
Cc: Potin Lai, Corey Minyard, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Patrick Williams, openipmi-developer, devicetree,
linux-kernel, Cosmo Chou, Potin Lai, Cosmo Chou
On Wed, Nov 20, 2024 at 08:58:47AM +0700, Quan Nguyen wrote:
> On 19/11/2024 18:30, Corey Minyard wrote:
> > I just saw this. What makes you think alerts are not supported in ipmi_ssif?
>
> Yes, Corey, I see alerts are supported in ipmi_ssif.
>
> My apology about the unclear question, I was just curious about whether this
> gpio-based alerts mechanism is confirmed through test with current ipmi_ssif
> without any extra patches.
Ah. The way this would work would be that the GPIO is run to an
interrupt on the host processor. Generally all the alerting devices on
the SMBus will "or" into that interrupt somehow.
When the interrupt comes in, the host will issue a request to the SMBus
alert address and each device that has an alert pending will respond
with their address. Because of the wire or of the SMBus, the lowest
address will win.
On Linux, the driver for that particular device will be told that an
alert came in if it has registered for that alert.
The GPIO is just an interrupt, so that should just work. That's not the
hard part. There has to be some device tree work on the host side to
map the interrupt to an SMBus alert for a specific bus. (I think you
can do this with ACPI, too, but I'm not sure.) And the device, of
course, must respond properly to the alert request.
So the GPIO is not something that's unusual. If it generates an
interrupt (and all the other stuff is in place on the host side) it will
work.
-corey
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2024-11-20 2:32 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-22 1:20 [PATCH v2 0/2] ipmi: ssif_bmc: Add GPIO-based alert mechanism Potin Lai
2024-10-22 1:20 ` [PATCH v2 1/2] bindings: ipmi: Add alert GPIO enhancement for SSIF BMC driver Potin Lai
2024-10-22 5:59 ` Krzysztof Kozlowski
2024-10-22 1:20 ` [PATCH v2 2/2] ipmi: ssif_bmc: add GPIO-based alert mechanism Potin Lai
2024-10-24 4:29 ` Quan Nguyen
2024-11-19 1:47 ` Potin Lai
2024-11-19 11:30 ` Corey Minyard
2024-11-20 1:58 ` Quan Nguyen
2024-11-20 2:31 ` Corey Minyard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).