Skip to contentSkip to conversation

KCS driver for LPC MCTP binding

PATCH New Andrew Jeffery 1 participant 5 messages Mar 27, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover KCS driver for LPC MCTP binding

Hello,

This is a series that cleans up a driver that we (IBM) have been using internally for some time to expose the KCS device required by the astlpc binding found in libmctp[1]. The driver is generally terrible, and the userspace interface will no-longer be needed once I get to implementing socket-based MCTP support (which we should have roughly around the same time as practical nuclear fusion*).

We would like to apply this to the OpenBMC tree whilst _not_ upstreaming it on the basis that its userspace API will become obsolete in the future and the effort isn't worth the hassle, but we still need the functionality until we get socket support. Several IBM system configurations make use of the driver as is, and it serves to demonstrate the purpose of the astlpc binding in libmctp.

I've marked the series WIP because of the above reasons, not as indicator to not apply it. However, please don't stare at the code too hard in case it breaks you.

Andrew

[1] https://github.com/openbmc/libmctp/blob/master/astlpc.c

* Not serious, but it feels this way.

Andrew Geissler (1):
ARM: dts: tacoma: Add KCS node for LPC MCTP

Andrew Jeffery (2):
misc: Add ASPEED KCS driver for MCTP purposes
ARM: dts: witherspoon: Add KCS node for LPC MCTP

Eddie James (1):
ARM: dts: rainier: Add KCS node for LPC MCTP

 arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts  |   8 +
 arch/arm/boot/dts/aspeed-bmc-opp-tacoma.dts   |   8 +
 .../boot/dts/aspeed-bmc-opp-witherspoon.dts   |   8 +
 drivers/misc/Kconfig                          |   7 +
 drivers/misc/Makefile                         |   1 +
 drivers/misc/mctp-lpc.c                       | 443 ++++++++++++++++++
 6 files changed, 475 insertions(+)
 create mode 100644 drivers/misc/mctp-lpc.c
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/4 misc: Add ASPEED KCS driver for MCTP purposes

IBM have developed a vendor-defined MCTP binding that utilises LPC IO and FW interfaces to exchange MCTP messages. A KCS device in the IO space is used to send single-byte control messages initialising the MCTP channel and exchanging ownership of data buffers.

This driver exposes the KCS message stream to userspace, allowing an MCTP-capable application to manipulate the data exposed via the FW space.

---
 drivers/misc/Kconfig    |   7 +
 drivers/misc/Makefile   |   1 +
 drivers/misc/mctp-lpc.c | 443 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 451 insertions(+)
 create mode 100644 drivers/misc/mctp-lpc.c
drivers/misc/Kconfig +7 -0
index 06a2b753cc7c..c90a9cacc19f 100644
@@ -454,6 +454,13 @@ config XILINX_SDFEC
 
 	  If unsure, say N.
 
+config MCTP_LPC
+	tristate "MCTP LPC binding implementation for ASPEED BMCs"
+	depends on REGMAP
+	help
+	  Implements the MCTP LPC binding via KCS LPC IO cycles for control and
+          LPC FWH cycles for data
+
 config MISC_RTSX
 	tristate
 	default MISC_RTSX_PCI || MISC_RTSX_USB
drivers/misc/Makefile +1 -0
index b9e6d4c3e906..9ef78d42be9d 100644
@@ -59,3 +59,4 @@ obj-$(CONFIG_HABANA_AI)		+= habanalabs/
 obj-$(CONFIG_XILINX_SDFEC)	+= xilinx_sdfec.o
 obj-$(CONFIG_NPCM7XX_LPC_BPC)	+= npcm7xx-lpc-bpc.o
 obj-$(CONFIG_NPCM7XX_PCI_MBOX)	+= npcm7xx-pci-mbox.o
+obj-$(CONFIG_MCTP_LPC)		+= mctp-lpc.o
drivers/misc/mctp-lpc.c new file +443 -0

443 lines not on this page · raw message

Signature · 1 line
2.20.1
#2 lore raw

PATCH 2/4 ARM: dts: witherspoon: Add KCS node for LPC MCTP

In reply to Andrew Jeffery

The compatible is terrible, but we need a way to describe how we want to drive the hardware, and it's not in a fashion that's integrated into IPMI.

---
 arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +8 -0
index da9e379b10bb..fcfc65dd8cae 100644
@@ -325,6 +325,14 @@
 	flash = <&spi1>;
 };
 
+&lpc_host {
+	kcs4: kcs4@0 {
+		compatible = "openbmc,mctp-lpc";
+		interrupts = <8>;
+		status = "okay";
+	};
+};
+
 &mac0 {
 	status = "okay";
 	pinctrl-names = "default";
Signature · 1 line
2.20.1
#3 lore raw

PATCH 3/4 ARM: dts: tacoma: Add KCS node for LPC MCTP

In reply to Andrew Jeffery

From: Andrew Geissler <[email protected]>

---
 arch/arm/boot/dts/aspeed-bmc-opp-tacoma.dts | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm/boot/dts/aspeed-bmc-opp-tacoma.dts +8 -0
index 194a48220e2f..969289ea6699 100644
@@ -810,3 +810,11 @@
 	/* 1G DRAM with 8M VRAM which is reserved at the top. */
 	memory = <0xbf800000 0x00800000>;
 };
+
+&lpc_host {
+       kcs4: kcs4@0 {
+               compatible = "openbmc,mctp-lpc";
+               interrupts = <GIC_SPI 141 IRQ_TYPE_LEVEL_HIGH>;
+               status = "okay";
+       };
+};
Signature · 1 line
2.20.1
#4 lore raw

PATCH 4/4 ARM: dts: rainier: Add KCS node for LPC MCTP

In reply to Andrew Jeffery

From: Eddie James <[email protected]>

---
 arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts +8 -0
index f4cad70d8edc..7ed6bbb759b2 100644
@@ -588,6 +588,14 @@
 	memory-region = <&flash_memory>;
 };
 
+&lpc_host {
+	kcs4: kcs4@0 {
+		compatible = "openbmc,mctp-lpc";
+		interrupts = <GIC_SPI 141 IRQ_TYPE_LEVEL_HIGH>;
+		status = "okay";
+	};
+};
+
 &mac2 {
 	status = "okay";
 	pinctrl-names = "default";
Signature · 1 line
2.20.1