Re: [PATCH v6 06/11] misc: amd-sbi: Add support for AMD_SBI IOCTL

From: Gupta, Akshay
Date: Wed Mar 26 2025 - 07:46:56 EST



On 3/25/2025 7:07 PM, Arnd Bergmann wrote:
Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.


On Tue, Mar 25, 2025, at 13:35, Gupta, Akshay wrote:
On 3/24/2025 9:10 PM, Arnd Bergmann wrote:

Link for the documentation:
https://www.amd.com/content/dam/amd/en/documents/epyc-technical-docs/programmer-references/57883.zip
<https://www.amd.com/content/dam/amd/en/documents/epyc-technical-docs/programmer-references/57883.zip>
You may refer to section: 5.4.2.2 SB-RMI Mailbox Service
At present, more than 70 mailbox commands ids are supported.
The number is increasing with each platforms.
however, the input and output for all mailbox commands are maintained
as 32 bit, hence, we can use the same structure and differentiate the
functionality.
The large number of mailbox commands is exactly what I'm worried
about. Having 70 well-documented ioctl command numbers is not a problem,
since the numbers are cheap, but having an unfiltered pass-through
inteface between userspace and a PMIC is scary, and it's worse if
future hardware version has additional registers here.
This side band remote management interface(SBRMI) driver runs on the
Baseboard Management controller(BMC) connected to the processor(not on the processor itself)
to provides system monitoring and  control capabilities to the admin using out-of-band interface.

User space application on BMC calling the IOCTL would invoke a mailbox communication between
the BMC and System Management Unit(SMUFW) to addresses the individual command.
SMU would return error code: "Unsupported Command" as per platform support.

+--------------------+
|Processor           |
|Socket              |
|                    |
|SMU RMI             |
+--------------------+
            A
            |
        I2C/I3C
            |
            V
+--------------------+
|Driver <IOCTL> APP  |
|                    |
|                    |
|BMC                 |
+--------------------+

A lot of the values reported through this interface could simply
be sysfs files, some look like they should integrate into existing
kernel subsystems (scheduler, pci, ...) and not be directly
visible to userspace.

Arnd
We have provided integration to the hwmon subsystem for power sensor.