[PATCH linux dev-5.10 v3 00/18] ipmi: Allow raw access to KCS devices

Andrew Jeffery andrew at aj.id.au
Mon May 10 16:49:37 AEST 2021

Hi Joel,

This series is (mostly) a backport of v3 I sent upstream:


The patches that aren't on the upstream lists are 17 and 18.

There's no reason that 17 isn't on the upstream lists, and I'll send it shortly
(too many branches lying around).

As for patch 18, it's a more thorough implementation of the hacky driver we
already have in the OpenBMC tree at drivers/misc/mctp-lpc.c. mctp-lpc.c only
worked against KCS channel 4 whereas kcs_bmc_cdev_raw will work with any KCS
channel in the system. We need to switch away from KCS channel 4 on the Aspeed
BMCs due to the way the status bits are initialised in hardware[1].

Both mctp-lpc.c and kcs_bmc_cdev_raw.c will go away in the mid-term once we have
jk's MCTP subsystem merged into net/ and I've implemented the in-kernel LPC
binding against it. In the mean time, kcs_bmc_cdev_raw.c replaces mctp-lpc.c.
Its chardev semantics are a superset of mctp-lpc.c so there is no userspace
impact aside from needing to ship a udev rule to account for the name of the
device node.

I plan to send a follow up series to do the switch-over in the devicetree and
remove mctp-lpc.c (which also removes a hack from the devicetree).

Aside from patch 18 (which is temporary) there should be no userspace-visible
impact from the series. Modulo bugs, this should make it safe to merge now.

I've tested the series on a Rainier system and it can boot the host without
issue. I've also exercised all the insmod/rmmod combinations with the kernel
debug config options listed in Documentation/process/submit-checklist.rst
enabled and found no issues.

Please take a look!


[1] They're initialised in IPMI style, with some bits set to indicate the
channel isn't active. Unfortunately these are the same bits we chose to
represent the channel as active for the LPC MCTP binding.

Andrew Jeffery (18):
  ipmi: kcs_bmc_aspeed: Use of match data to extract KCS properties
  ipmi: kcs_bmc: Make status update atomic
  ipmi: kcs_bmc: Rename {read,write}_{status,data}() functions
  ipmi: kcs_bmc: Split out kcs_bmc_cdev_ipmi
  ipmi: kcs_bmc: Turn the driver data-structures inside-out
  ipmi: kcs_bmc: Split headers into device and client
  ipmi: kcs_bmc: Strip private client data from struct kcs_bmc
  ipmi: kcs_bmc: Decouple the IPMI chardev from the core
  ipmi: kcs_bmc: Allow clients to control KCS IRQ state
  ipmi: kcs_bmc: Don't enforce single-open policy in the kernel
  ipmi: kcs_bmc: Add serio adaptor
  dt-bindings: ipmi: Convert ASPEED KCS binding to schema
  dt-bindings: ipmi: Add optional SerIRQ property to ASPEED KCS devices
  ipmi: kcs_bmc_aspeed: Implement KCS SerIRQ configuration
  ipmi: kcs_bmc_aspeed: Fix IBFIE typo from datasheet
  ipmi: kcs_bmc_aspeed: Optionally apply status address
  ARM: dts: rainier: Enable KCS channel 2
  ipmi: kcs_bmc: Add a "raw" character device interface

 Documentation/ABI/testing/dev-raw-kcs         |  25 +
 .../bindings/ipmi/aspeed,ast2400-kcs-bmc.yaml | 106 +++
 .../bindings/ipmi/aspeed-kcs-bmc.txt          |  33 -
 arch/arm/boot/dts/aspeed-bmc-ibm-rainier.dts  |   5 +
 drivers/char/ipmi/Kconfig                     |  44 ++
 drivers/char/ipmi/Makefile                    |   3 +
 drivers/char/ipmi/kcs_bmc.c                   | 526 ++++-----------
 drivers/char/ipmi/kcs_bmc.h                   |  92 +--
 drivers/char/ipmi/kcs_bmc_aspeed.c            | 637 +++++++++++++-----
 drivers/char/ipmi/kcs_bmc_cdev_ipmi.c         | 568 ++++++++++++++++
 drivers/char/ipmi/kcs_bmc_cdev_raw.c          | 440 ++++++++++++
 drivers/char/ipmi/kcs_bmc_client.h            |  48 ++
 drivers/char/ipmi/kcs_bmc_device.h            |  22 +
 drivers/char/ipmi/kcs_bmc_npcm7xx.c           |  94 ++-
 drivers/char/ipmi/kcs_bmc_serio.c             | 151 +++++
 15 files changed, 2071 insertions(+), 723 deletions(-)
 create mode 100644 Documentation/ABI/testing/dev-raw-kcs
 create mode 100644 Documentation/devicetree/bindings/ipmi/aspeed,ast2400-kcs-bmc.yaml
 delete mode 100644 Documentation/devicetree/bindings/ipmi/aspeed-kcs-bmc.txt
 create mode 100644 drivers/char/ipmi/kcs_bmc_cdev_ipmi.c
 create mode 100644 drivers/char/ipmi/kcs_bmc_cdev_raw.c
 create mode 100644 drivers/char/ipmi/kcs_bmc_client.h
 create mode 100644 drivers/char/ipmi/kcs_bmc_device.h
 create mode 100644 drivers/char/ipmi/kcs_bmc_serio.c


More information about the openbmc mailing list