Skip to contentSkip to conversation

Add SSIF BMC driver

PATCH Superseded Quan Nguyen 4 participants 13 messages Jul 14, 2021 – Nov 30, 2021

Subsystems (6)

v5 of 10 Superseded Latest is v10 →

lore
Share & tools
lore
#0 lore raw

v5 cover Add SSIF BMC driver

This series add support the SSIF BMC driver which is to perform in-band IPMI communication with their host in management (BMC) side.

SSIF BMC driver in this series is tested with Aspeed AST2500.

v5:
+ Correct the patches order to fix the bisect issue found by kernel build robot

v4:
+ Fix recursive spinlock [Graeme]
+ Send response with Completion code 0xFF when aborting [Quan]
+ Fix warning with dt_binding_check [Rob]
+ Change aspeed-ssif-bmc.yaml to ssif-bmc.yaml [Quan]
+ Added bounding check on SMBus writes and the whole request [Dan]
+ Moved buffer to end of struct ssif_bmc_ctx to avoid context
corruption if somehow buffer is written past the end [Dan]
+ Return -EINVAL if userspace buffer too small, dont
silence truncate [Corey, Joel]
+ Not necessary to check NONBLOCK in lock [Corey]
+ Enforce one user at a time [Joel]
+ Reject write with invalid response length from userspace [Corey]
+ Add state machines for better ssif bmc state handling [Quan]
+ Drop ssif_bmc_aspeed.c and make ssif_bmc.c is generic
SSIF BMC driver [Quan]
+ Change compatible string "aspeed,ast2500-ssif-bmc" to
"ampere,ssif-bmc" [Quan]
+ Toggle Slave enable in i2c-aspeed to turn on/off slave mode [Ryan]
+ Added slave_enable() to struct i2c_algorithm to control
slave mode and to address the recursive spinlock [Graeme, Ryan]
+ Abort current request with invalid SMBus write or

    invalid command                                               [Quan]
  + Abort all request if there is pending response                [Quan]
  + Changed validate_pec() to validate_request()                  [Quan]
  + Add unsupported_smbus_cmd() to handle unknown SMBus command   [Quan]
  + Print internal state string for ease investigating issue      [Quan]
  + Move to READY state on SLAVE_STOP event                       [Quan]
  + Change initilize_transfer() to process_smbus_cmd()            [Quan]
  + Introduce functions for each slave event                      [Quan]

v3:
+ Switched binding doc to use DT schema format [Rob]
+ Splited into generic ssif_bmc and aspeed-specific [Corey, Joel]
+ Removed redundant license info [Joel]
+ Switched to use traditional if-else [Joel]
+ Removed unused ssif_bmc_ioctl() [Joel]
+ Made handle_request()/complete_response() to return void [Joel]
+ Refactored send_ssif_bmc_response()/receive_ssif_bmc_request() [Corey]
+ Remove mutex [Corey]
+ Use spin_lock/unlock_irqsave/restore in callback [Corey]
+ Removed the unnecessary memset [Corey]
+ Switch to use dev_err() [Corey]
+ Combine mask/unmask two interrupts together [Corey]
+ Fixed unhandled Tx done with NAK [Quan]
+ Late ack'ed Tx done w/wo Ack irq [Quan]
+ Use aspeed-specific exported aspeed_set_slave_busy() when slave busy to fix the deadlock [Graeme, Philipp, Quan]
+ Clean buffer for last multipart read [Quan]
+ Handle unknown incoming command [Quan]

v2:
+ Fixed compiling error with COMPILE_TEST for arc

Quan Nguyen (3):
i2c: aspeed: Add slave_enable() to toggle slave mode
ipmi: ssif_bmc: Add SSIF BMC driver
bindings: ipmi: Add binding for SSIF BMC driver

 .../devicetree/bindings/ipmi/ssif-bmc.yaml    |  38 +
 drivers/char/ipmi/Kconfig                     |  11 +
 drivers/char/ipmi/Makefile                    |   1 +
 drivers/char/ipmi/ssif_bmc.c                  | 781 ++++++++++++++++++
 drivers/char/ipmi/ssif_bmc.h                  | 106 +++
 drivers/i2c/busses/i2c-aspeed.c               |  20 +
 include/linux/i2c.h                           |   2 +
 7 files changed, 959 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/ipmi/ssif-bmc.yaml
 create mode 100644 drivers/char/ipmi/ssif_bmc.c
 create mode 100644 drivers/char/ipmi/ssif_bmc.h
Signature · 1 line
2.28.0
#1 lore raw

PATCH v5 1/3 i2c: aspeed: Add slave_enable() to toggle slave mode

Slave needs time to prepare the response data before Master could enquiry via read transaction. However, there is no mechanism for i2c-aspeed Slave to notify Master that it needs more time to process and this make Master side to time out when trying to get the response.

This commit introduces the slave_enable() callback in struct i2c_algorithm for Slave to temporary stop the Slave mode while working on the response and re-enable the Slave when response data ready.

---
v5:
+ None

v4:
+ First introduced follow Ryan's suggestion [Ryan]
+ Fix recursive spinlock issue in v3 (aspeed_set_slave_busy())
and apply in this patch [Graeme]

 drivers/i2c/busses/i2c-aspeed.c | 20 ++++++++++++++++++++
 include/linux/i2c.h             |  2 ++
 2 files changed, 22 insertions(+)
drivers/i2c/busses/i2c-aspeed.c +20 -0
index 67e8b97c0c95..a6a19dc8a501 100644
@@ -785,6 +785,25 @@ static int aspeed_i2c_unreg_slave(struct i2c_client *client)
 
 	return 0;
 }
+
+static int aspeed_i2c_slave_enable(struct i2c_client *client, bool enable)
+{
+	struct aspeed_i2c_bus *bus = i2c_get_adapdata(client->adapter);
+	u32 func_ctrl_reg_val;
+
+	if (!bus->slave)
+		return -EINVAL;
+
+	/* Toggle slave mode. */
+	func_ctrl_reg_val = readl(bus->base + ASPEED_I2C_FUN_CTRL_REG);
+	if (enable)
+		func_ctrl_reg_val |= ASPEED_I2CD_SLAVE_EN;
+	else
+		func_ctrl_reg_val &= ~ASPEED_I2CD_SLAVE_EN;
+	writel(func_ctrl_reg_val, bus->base + ASPEED_I2C_FUN_CTRL_REG);
+
+	return 0;
+}
 #endif /* CONFIG_I2C_SLAVE */
 
 static const struct i2c_algorithm aspeed_i2c_algo = {
@@ -793,6 +812,7 @@ static const struct i2c_algorithm aspeed_i2c_algo = {
 #if IS_ENABLED(CONFIG_I2C_SLAVE)
 	.reg_slave	= aspeed_i2c_reg_slave,
 	.unreg_slave	= aspeed_i2c_unreg_slave,
+	.slave_enable	= aspeed_i2c_slave_enable,
 #endif /* CONFIG_I2C_SLAVE */
 };
 
include/linux/i2c.h +2 -0
index 3eb60a2e9e61..8c1765aa7e3f 100644
@@ -520,6 +520,7 @@ i2c_register_board_info(int busnum, struct i2c_board_info const *info,
  *   from the ``I2C_FUNC_*`` flags.
  * @reg_slave: Register given client to I2C slave mode of this adapter
  * @unreg_slave: Unregister given client from I2C slave mode of this adapter
+ * @slave_enable: Toggle enable slave mode for given client of this adapter
  *
  * The following structs are for those who like to implement new bus drivers:
  * i2c_algorithm is the interface to a class of hardware solutions which can
@@ -557,6 +558,7 @@ struct i2c_algorithm {
 #if IS_ENABLED(CONFIG_I2C_SLAVE)
 	int (*reg_slave)(struct i2c_client *client);
 	int (*unreg_slave)(struct i2c_client *client);
+	int (*slave_enable)(struct i2c_client *client, bool enable);
 #endif
 };
 
Signature · 1 line
2.28.0
#2 lore raw

Re: [PATCH v5 1/3] i2c: aspeed: Add slave_enable() to toggle slave mode

Hi all,

Quoted 8 lines · Quan Nguyen

Slave needs time to prepare the response data before Master could enquiry via read transaction. However, there is no mechanism for i2c-aspeed Slave to notify Master that it needs more time to process and this make Master side to time out when trying to get the response.

This commit introduces the slave_enable() callback in struct i2c_algorithm for Slave to temporary stop the Slave mode while working on the response and re-enable the Slave when response data ready.

Sorry that I couldn't chime in earlier, but NAK!

Quoted 1 line
 include/linux/i2c.h             |  2 ++

@Corey: Please do not change this file without my ACK. It is not a trivial change but an API extenstion and that should really be acked by the subsystem maintainer, in this case me. I was really surprised to see this in linux-next already.

@all: Plus, I neither like the API (because it doesn't look generic to me but mostly handling one issue needed here) nor do I fully understand the use case. Normally, when a read is requested and the backend needs time to deliver the data, the hardware should stretch the SCL clock until some data register is finally written to. If it doesn't do it for whatever reason, this is a quirky hardware in my book and needs handling in the driver only. So, what is special with this HW? Can't we solve it differently?

All the best,

Wolfram

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linux-aspeed/attachments/20210812/538be065/attachment-0001.sig>

#3 lore raw

Re: [Openipmi-developer] [PATCH v5 1/3] i2c: aspeed: Add slave_enable() to toggle slave mode

Quoted 12 lines · Wolfram Sang

Hi all,

Quoted 8 lines · Quan Nguyen

Slave needs time to prepare the response data before Master could enquiry via read transaction. However, there is no mechanism for i2c-aspeed Slave to notify Master that it needs more time to process and this make Master side to time out when trying to get the response.

This commit introduces the slave_enable() callback in struct i2c_algorithm for Slave to temporary stop the Slave mode while working on the response and re-enable the Slave when response data ready.

Quoted 8 lines

Sorry that I couldn't chime in earlier, but NAK!

Quoted 1 line
 include/linux/i2c.h             |  2 ++

@Corey: Please do not change this file without my ACK. It is not a trivial change but an API extenstion and that should really be acked by the subsystem maintainer, in this case me. I was really surprised to see this in linux-next already.

I am sorry, I'll pull it out.

-corey

Quoted 22 lines

@all: Plus, I neither like the API (because it doesn't look generic to me but mostly handling one issue needed here) nor do I fully understand the use case. Normally, when a read is requested and the backend needs time to deliver the data, the hardware should stretch the SCL clock until some data register is finally written to. If it doesn't do it for whatever reason, this is a quirky hardware in my book and needs handling in the driver only. So, what is special with this HW? Can't we solve it differently?

All the best,

Wolfram

_______________________________________________
Openipmi-developer mailing list
Openipmi-developer at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openipmi-developer

#4 lore raw

Re: [PATCH v5 1/3] i2c: aspeed: Add slave_enable() to toggle slave mode

In reply to Wolfram Sang

Hi,

I still wonder if we can't get the SSIF BMC driver upstream...

Quoted 8 lines

@all: Plus, I neither like the API (because it doesn't look generic to me but mostly handling one issue needed here) nor do I fully understand the use case. Normally, when a read is requested and the backend needs time to deliver the data, the hardware should stretch the SCL clock until some data register is finally written to. If it doesn't do it for whatever reason, this is a quirky hardware in my book and needs handling in the driver only. So, what is special with this HW? Can't we solve it differently?

... for that, it would be great if somebody could answer my questions here :)

Happy hacking,

Wolfram

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linux-aspeed/attachments/20211129/6638444e/attachment.sig>

#5 lore raw

Re: [PATCH v5 1/3] i2c: aspeed: Add slave_enable() to toggle slave mode

Quoted 4 lines · Wolfram Sang

Hi,

I still wonder if we can't get the SSIF BMC driver upstream...

Thanks Wolfram to help bring this up,

This driver was tested with Aspeed ast2500 and we have tried many way to avoid using slave_enable() to toggle slave mode but there is no progress. Our expectation is still to have this driver upstream'ed and I'm thinking about testing this driver on other HW and re-post the driver.

Quoted 9 lines
Quoted 8 lines

@all: Plus, I neither like the API (because it doesn't look generic to me but mostly handling one issue needed here) nor do I fully understand the use case. Normally, when a read is requested and the backend needs time to deliver the data, the hardware should stretch the SCL clock until some data register is finally written to. If it doesn't do it for whatever reason, this is a quirky hardware in my book and needs handling in the driver only. So, what is special with this HW? Can't we solve it differently?

Quoted 3 lines

... for that, it would be great if somebody could answer my questions here :)

I have to admit that you are all right with the above comments. The fact is we still not be able to find any way to solve this differently. We don't own this HW and dont know what happen on this particular issue. The SCL clock stretching on this HW does not work as expected and the slave_enable() is the only solution for now. I hope if someone could help with the issue as well.

Best regards,
- Quan

#6 lore raw

Re: [PATCH v5 1/3] i2c: aspeed: Add slave_enable() to toggle slave mode

Hi,

Quoted 1 line

Thanks Wolfram to help bring this up,

Sure thing! It would be sad to see this work bitrot.

Quoted 2 lines

This driver was tested with Aspeed ast2500 and we have tried many way to avoid using slave_enable() to toggle slave mode but there is no progress.

I see. I also can't help you there. I have neither experience with nor access to this HW.

Quoted 2 lines

Our expectation is still to have this driver upstream'ed and I'm thinking about testing this driver on other HW and re-post the driver.

That sounds like a good plan.

Quoted 6 lines

I have to admit that you are all right with the above comments. The fact is we still not be able to find any way to solve this differently. We don't own this HW and dont know what happen on this particular issue. The SCL clock stretching on this HW does not work as expected and the slave_enable() is the only solution for now. I hope if someone could help with the issue as well.

From this distance, it looks like HW access and a logic analyzer might be helpful in understanding the behaviour. Pity that you don't own the HW.

Good luck nonetheless!

Wolfram

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linux-aspeed/attachments/20211130/a98bc6a6/attachment.sig>

#7 lore raw

PATCH v5 2/3 ipmi: ssif_bmc: Add SSIF BMC driver

In reply to Quan Nguyen

The SMBus system interface (SSIF) IPMI BMC driver can be used to perform in-band IPMI communication with their host in management (BMC) side.

---
v5:
+ None

v4:
+ Send response with Completion code 0xFF when aborting [Quan]
+ Added bounding check on SMBus writes and the whole request [Dan]
+ Moved buffer to end of struct ssif_bmc_ctx to avoid context
corruption if somehow buffer is written past the end [Dan]
+ Return -EINVAL if userspace buffer too small, dont
silence truncate [Corey, Joel]
+ Not necessary to check NONBLOCK in lock [Corey]
+ Enforce one user at a time [Joel]
+ Reject write with invalid response length from userspace [Corey]
+ Add state machines for better ssif bmc state handling [Quan]
+ Drop ssif_bmc_aspeed.c and make ssif_bmc.c is generic
SSIF BMC driver [Quan]
+ Change compatible string "aspeed,ast2500-ssif-bmc" to
"ampere,ssif-bmc" [Quan]
+ Abort current request with invalid SMBus write or

    invalid command                                               [Quan]
  + Abort all request if there is pending response                [Quan]
  + Changed validate_pec() to validate_request()                  [Quan]
  + Add unsupported_smbus_cmd() to handle unknown SMBus command   [Quan]
  + Print internal state string for ease investigating issue      [Quan]
  + Move to READY state on SLAVE_STOP event                       [Quan]
  + Change initilize_transfer() to process_smbus_cmd()            [Quan]
  + Introduce functions for each slave event                      [Quan]

v3:
+ Removed redundant license info [Joel]
+ Switched to use traditional if-else [Joel]
+ Removed unused ssif_bmc_ioctl() [Joel]
+ Made handle_request()/complete_response() to return void [Joel]
+ Refactored send_ssif_bmc_response()/receive_ssif_bmc_request()
[Corey]
+ Removed mutex [Corey]
+ Use spin_lock/unlock_irqsave/restore in callback [Corey]
+ Removed the unnecessary memset [Corey]
+ Switch to use dev_err() [Corey]

v2:
+ Fixed compiling error with COMPILE_TEST for arc

 drivers/char/ipmi/Kconfig    |  11 +
 drivers/char/ipmi/Makefile   |   1 +
 drivers/char/ipmi/ssif_bmc.c | 781 +++++++++++++++++++++++++++++++++++
 drivers/char/ipmi/ssif_bmc.h | 106 +++++
 4 files changed, 899 insertions(+)
 create mode 100644 drivers/char/ipmi/ssif_bmc.c
 create mode 100644 drivers/char/ipmi/ssif_bmc.h
drivers/char/ipmi/Kconfig +11 -0
index 249b31197eea..e09a470ab2da 100644
@@ -160,6 +160,17 @@ config ASPEED_BT_IPMI_BMC
 	  found on Aspeed SOCs (AST2400 and AST2500). The driver
 	  implements the BMC side of the BT interface.
 
+config SSIF_IPMI_BMC
+	tristate "SSIF IPMI BMC driver"
+	select I2C
+	select I2C_SLAVE
+	help
+	  This enables the IPMI SMBus system interface (SSIF) at the
+	  management (BMC) side.
+
+	  The driver implements the BMC side of the SMBus system
+	  interface (SSIF).
+
 config IPMB_DEVICE_INTERFACE
 	tristate 'IPMB Interface handler'
 	depends on I2C
drivers/char/ipmi/Makefile +1 -0
index 84f47d18007f..a93c09dad22a 100644
@@ -29,3 +29,4 @@ obj-$(CONFIG_ASPEED_BT_IPMI_BMC) += bt-bmc.o
 obj-$(CONFIG_ASPEED_KCS_IPMI_BMC) += kcs_bmc_aspeed.o
 obj-$(CONFIG_NPCM7XX_KCS_IPMI_BMC) += kcs_bmc_npcm7xx.o
 obj-$(CONFIG_IPMB_DEVICE_INTERFACE) += ipmb_dev_int.o
+obj-$(CONFIG_SSIF_IPMI_BMC) += ssif_bmc.o
drivers/char/ipmi/ssif_bmc.c new file +781 -0

781 lines not on this page · raw message

drivers/char/ipmi/ssif_bmc.h new file +106 -0

106 lines not on this page · raw message

Signature · 1 line
2.28.0
#8 lore raw

PATCH v5 3/3 bindings: ipmi: Add binding for SSIF BMC driver

In reply to Quan Nguyen

Add device tree binding document for the SSIF BMC driver.

---
v5:
+ None

v4:
+ Fix warning with dt_binding_check [Rob]
+ Change aspeed-ssif-bmc.yaml to ssif-bmc.yaml [Quan]

v3:
+ Switched to use DT schema format [Rob]

v2:
+ None

 .../devicetree/bindings/ipmi/ssif-bmc.yaml    | 38 +++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/ipmi/ssif-bmc.yaml
Documentation/devicetree/bindings/ipmi/ssif-bmc.yaml new file +38 -0
new file mode 100644
index 000000000000..917a577c2f29
@@ -0,0 +1,38 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/ipmi/ssif-bmc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: SSIF IPMI BMC interface
+
+description: SSIF IPMI BMC device bindings
+
+maintainers:
+  - Quan Nguyen <[email protected]>
+
+properties:
+  compatible:
+    enum:
+      - ampere,ssif-bmc
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        ssif-bmc at 10 {
+            compatible = "ampere,ssif-bmc";
+            reg = <0x10>;
+        };
+    };
Signature · 1 line
2.28.0
maintainer Reviewed-by on v5 3/3
#9 lore raw

Re: [PATCH v5 3/3] bindings: ipmi: Add binding for SSIF BMC driver

Quoted 14 lines · Quan Nguyen

Add device tree binding document for the SSIF BMC driver.

---
v5:
+ None

v4:
+ Fix warning with dt_binding_check [Rob]
+ Change aspeed-ssif-bmc.yaml to ssif-bmc.yaml [Quan]

v3:
+ Switched to use DT schema format [Rob]

Quoted 7 lines

v2:
+ None

 .../devicetree/bindings/ipmi/ssif-bmc.yaml    | 38 +++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/ipmi/ssif-bmc.yaml
#10 lore raw

Re: [PATCH v5 3/3] bindings: ipmi: Add binding for SSIF BMC driver

Quoted 18 lines · Rob Herring
Quoted 17 lines · Quan Nguyen

Add device tree binding document for the SSIF BMC driver.

---
v5:
+ None

v4:
+ Fix warning with dt_binding_check [Rob]
+ Change aspeed-ssif-bmc.yaml to ssif-bmc.yaml [Quan]

v3:
+ Switched to use DT schema format [Rob]

v2:
+ None

Quoted 7 lines
Quoted 4 lines
  .../devicetree/bindings/ipmi/ssif-bmc.yaml    | 38 +++++++++++++++++++
  1 file changed, 38 insertions(+)

create mode 100644 Documentation/devicetree/bindings/ipmi/ssif-bmc.yaml

Thanks Rob.

#11 lore raw
In reply to Quan Nguyen
Quoted 4 lines · Quan Nguyen

This series add support the SSIF BMC driver which is to perform in-band IPMI communication with their host in management (BMC) side.

SSIF BMC driver in this series is tested with Aspeed AST2500.

Ok, I have queued this and added Rob's review. Five versions, you had to work for this one :).

Thanks,

-corey

Quoted 80 lines

v5:
+ Correct the patches order to fix the bisect issue found by kernel build robot

v4:
+ Fix recursive spinlock [Graeme]
+ Send response with Completion code 0xFF when aborting [Quan]
+ Fix warning with dt_binding_check [Rob]
+ Change aspeed-ssif-bmc.yaml to ssif-bmc.yaml [Quan]
+ Added bounding check on SMBus writes and the whole request [Dan]
+ Moved buffer to end of struct ssif_bmc_ctx to avoid context
corruption if somehow buffer is written past the end [Dan]
+ Return -EINVAL if userspace buffer too small, dont
silence truncate [Corey, Joel]
+ Not necessary to check NONBLOCK in lock [Corey]
+ Enforce one user at a time [Joel]
+ Reject write with invalid response length from userspace [Corey]
+ Add state machines for better ssif bmc state handling [Quan]
+ Drop ssif_bmc_aspeed.c and make ssif_bmc.c is generic
SSIF BMC driver [Quan]
+ Change compatible string "aspeed,ast2500-ssif-bmc" to
"ampere,ssif-bmc" [Quan]
+ Toggle Slave enable in i2c-aspeed to turn on/off slave mode [Ryan]
+ Added slave_enable() to struct i2c_algorithm to control
slave mode and to address the recursive spinlock [Graeme, Ryan]
+ Abort current request with invalid SMBus write or

    invalid command                                               [Quan]
  + Abort all request if there is pending response                [Quan]
  + Changed validate_pec() to validate_request()                  [Quan]
  + Add unsupported_smbus_cmd() to handle unknown SMBus command   [Quan]
  + Print internal state string for ease investigating issue      [Quan]
  + Move to READY state on SLAVE_STOP event                       [Quan]
  + Change initilize_transfer() to process_smbus_cmd()            [Quan]
  + Introduce functions for each slave event                      [Quan]

v3:
+ Switched binding doc to use DT schema format [Rob]
+ Splited into generic ssif_bmc and aspeed-specific [Corey, Joel]
+ Removed redundant license info [Joel]
+ Switched to use traditional if-else [Joel]
+ Removed unused ssif_bmc_ioctl() [Joel]
+ Made handle_request()/complete_response() to return void [Joel]
+ Refactored send_ssif_bmc_response()/receive_ssif_bmc_request() [Corey]
+ Remove mutex [Corey]
+ Use spin_lock/unlock_irqsave/restore in callback [Corey]
+ Removed the unnecessary memset [Corey]
+ Switch to use dev_err() [Corey]
+ Combine mask/unmask two interrupts together [Corey]
+ Fixed unhandled Tx done with NAK [Quan]
+ Late ack'ed Tx done w/wo Ack irq [Quan]
+ Use aspeed-specific exported aspeed_set_slave_busy() when slave busy to fix the deadlock [Graeme, Philipp, Quan]
+ Clean buffer for last multipart read [Quan]
+ Handle unknown incoming command [Quan]

v2:
+ Fixed compiling error with COMPILE_TEST for arc

Quan Nguyen (3):
i2c: aspeed: Add slave_enable() to toggle slave mode
ipmi: ssif_bmc: Add SSIF BMC driver
bindings: ipmi: Add binding for SSIF BMC driver

 .../devicetree/bindings/ipmi/ssif-bmc.yaml    |  38 +
 drivers/char/ipmi/Kconfig                     |  11 +
 drivers/char/ipmi/Makefile                    |   1 +
 drivers/char/ipmi/ssif_bmc.c                  | 781 ++++++++++++++++++
 drivers/char/ipmi/ssif_bmc.h                  | 106 +++
 drivers/i2c/busses/i2c-aspeed.c               |  20 +
 include/linux/i2c.h                           |   2 +
 7 files changed, 959 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/ipmi/ssif-bmc.yaml
 create mode 100644 drivers/char/ipmi/ssif_bmc.c
 create mode 100644 drivers/char/ipmi/ssif_bmc.h
Signature · 1 line
2.28.0
#12 lore raw
Quoted 4 lines · Corey Minyard
Quoted 3 lines · Quan Nguyen

This series add support the SSIF BMC driver which is to perform in-band IPMI communication with their host in management (BMC) side.

Quoted 9 lines
Quoted 1 line

SSIF BMC driver in this series is tested with Aspeed AST2500.

Ok, I have queued this and added Rob's review. Five versions, you had to work for this one :).

Thanks,

-corey

Thank you very much for your help in these version :)
- Quan

Quoted 80 lines
Quoted 80 lines

v5:
+ Correct the patches order to fix the bisect issue found by kernel build robot

v4:
+ Fix recursive spinlock [Graeme]
+ Send response with Completion code 0xFF when aborting [Quan]
+ Fix warning with dt_binding_check [Rob]
+ Change aspeed-ssif-bmc.yaml to ssif-bmc.yaml [Quan]
+ Added bounding check on SMBus writes and the whole request [Dan]
+ Moved buffer to end of struct ssif_bmc_ctx to avoid context
corruption if somehow buffer is written past the end [Dan]
+ Return -EINVAL if userspace buffer too small, dont
silence truncate [Corey, Joel]
+ Not necessary to check NONBLOCK in lock [Corey]
+ Enforce one user at a time [Joel]
+ Reject write with invalid response length from userspace [Corey]
+ Add state machines for better ssif bmc state handling [Quan]
+ Drop ssif_bmc_aspeed.c and make ssif_bmc.c is generic
SSIF BMC driver [Quan]
+ Change compatible string "aspeed,ast2500-ssif-bmc" to
"ampere,ssif-bmc" [Quan]
+ Toggle Slave enable in i2c-aspeed to turn on/off slave mode [Ryan]
+ Added slave_enable() to struct i2c_algorithm to control
slave mode and to address the recursive spinlock [Graeme, Ryan]
+ Abort current request with invalid SMBus write or

     invalid command                                               [Quan]
   + Abort all request if there is pending response                [Quan]
   + Changed validate_pec() to validate_request()                  [Quan]
   + Add unsupported_smbus_cmd() to handle unknown SMBus command   [Quan]
   + Print internal state string for ease investigating issue      [Quan]
   + Move to READY state on SLAVE_STOP event                       [Quan]
   + Change initilize_transfer() to process_smbus_cmd()            [Quan]
   + Introduce functions for each slave event                      [Quan]

v3:
+ Switched binding doc to use DT schema format [Rob]
+ Splited into generic ssif_bmc and aspeed-specific [Corey, Joel]
+ Removed redundant license info [Joel]
+ Switched to use traditional if-else [Joel]
+ Removed unused ssif_bmc_ioctl() [Joel]
+ Made handle_request()/complete_response() to return void [Joel]
+ Refactored send_ssif_bmc_response()/receive_ssif_bmc_request() [Corey]
+ Remove mutex [Corey]
+ Use spin_lock/unlock_irqsave/restore in callback [Corey]
+ Removed the unnecessary memset [Corey]
+ Switch to use dev_err() [Corey]
+ Combine mask/unmask two interrupts together [Corey]
+ Fixed unhandled Tx done with NAK [Quan]
+ Late ack'ed Tx done w/wo Ack irq [Quan]
+ Use aspeed-specific exported aspeed_set_slave_busy() when slave busy to fix the deadlock [Graeme, Philipp, Quan]
+ Clean buffer for last multipart read [Quan]
+ Handle unknown incoming command [Quan]

v2:
+ Fixed compiling error with COMPILE_TEST for arc

Quan Nguyen (3):
i2c: aspeed: Add slave_enable() to toggle slave mode
ipmi: ssif_bmc: Add SSIF BMC driver
bindings: ipmi: Add binding for SSIF BMC driver

  .../devicetree/bindings/ipmi/ssif-bmc.yaml    |  38 +
  drivers/char/ipmi/Kconfig                     |  11 +
  drivers/char/ipmi/Makefile                    |   1 +
  drivers/char/ipmi/ssif_bmc.c                  | 781 ++++++++++++++++++
  drivers/char/ipmi/ssif_bmc.h                  | 106 +++
  drivers/i2c/busses/i2c-aspeed.c               |  20 +
  include/linux/i2c.h                           |   2 +
  7 files changed, 959 insertions(+)

create mode 100644 Documentation/devicetree/bindings/ipmi/ssif-bmc.yaml create mode 100644 drivers/char/ipmi/ssif_bmc.c
create mode 100644 drivers/char/ipmi/ssif_bmc.h

Signature · 1 line
2.28.0