Re: [PATCH v6 06/11] misc: amd-sbi: Add support for AMD_SBI IOCTL
From: Arnd Bergmann
Date: Tue Mar 25 2025 - 09:47:52 EST
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.
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