From: Akshay Gupta <akshay.gupta@amd.com>
To: <linux-hwmon@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: <linux@roeck-us.net>, <gregkh@linuxfoundation.org>,
<arnd@arndb.de>, <shyam-sundar.s-k@amd.com>,
<gautham.shenoy@amd.com>, <mario.limonciello@amd.com>,
<naveenkrishna.chatradhi@amd.com>, <anand.umarji@amd.com>,
Akshay Gupta <akshay.gupta@amd.com>
Subject: [PATCH v7 10/10] misc: amd-sbi: Add document for AMD SB IOCTL description
Date: Wed, 2 Apr 2025 05:58:40 +0000 [thread overview]
Message-ID: <20250402055840.1346384-11-akshay.gupta@amd.com> (raw)
In-Reply-To: <20250402055840.1346384-1-akshay.gupta@amd.com>
- This document provides AMD side band IOCTL description defined
for APML and its usage.
Multiple AMD custom protocols defined for side band system
management uses this IOCTL.
User space C-APIs are made available by esmi_oob_library [1],
which is provided by the E-SMS project [2].
Link: https://github.com/amd/esmi_oob_library [1]
Link: https://www.amd.com/en/developer/e-sms.html [2]
Reviewed-by: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
Signed-off-by: Akshay Gupta <akshay.gupta@amd.com>
---
Changes since v6:
- Rebased patch, previously patch 11
Changes since v4:
- Previously patch 9
- Update description as per review comment
- Address the review comments for documentation warning
Changes since v3:
- Address the review comments
Changes since v2:
- update the MACROS name as per feedback
Changes since v1:
- New patch
Documentation/misc-devices/amd-sbi.rst | 87 ++++++++++++++++++++++++++
1 file changed, 87 insertions(+)
create mode 100644 Documentation/misc-devices/amd-sbi.rst
diff --git a/Documentation/misc-devices/amd-sbi.rst b/Documentation/misc-devices/amd-sbi.rst
new file mode 100644
index 000000000000..9fbb01b33032
--- /dev/null
+++ b/Documentation/misc-devices/amd-sbi.rst
@@ -0,0 +1,87 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+=======================
+AMD SIDE BAND interface
+=======================
+
+Some AMD Zen based processors supports system management
+functionality via side-band interface (SBI) called
+Advanced Platform Management Link (APML). APML is an I2C/I3C
+based 2-wire processor target interface. APML is used to
+communicate with the Remote Management Interface
+(SB Remote Management Interface (SB-RMI)
+and SB Temperature Sensor Interface (SB-TSI)).
+
+More details on the interface can be found in chapter
+"5 Advanced Platform Management Link (APML)" of the family/model PPR [1]_.
+
+.. [1] https://www.amd.com/content/dam/amd/en/documents/epyc-technical-docs/programmer-references/55898_B1_pub_0_50.zip
+
+
+SBRMI device
+============
+
+apml_sbrmi driver under the drivers/misc/amd-sbi creates miscdevice
+/dev/sbrmi-* to let user space programs run APML mailbox, CPUID,
+MCAMSR and register xfer commands.
+
+Register sets is common across APML protocols. IOCTL is providing synchronization
+among protocols as transactions may create race condition.
+
+$ ls -al /dev/sbrmi-3c
+crw------- 1 root root 10, 53 Jul 10 11:13 /dev/sbrmi-3c
+
+apml_sbrmi driver registers hwmon sensors for monitoring power_cap_max,
+current power consumption and managing power_cap.
+
+Characteristics of the dev node:
+ * message ids are defined to run differnet xfer protocols:
+ * Mailbox: 0x0 ... 0x999
+ * CPUID: 0x1000
+ * MCA_MSR: 0x1001
+ * Register xfer: 0x1002
+
+Access restrictions:
+ * Only root user is allowed to open the file.
+ * APML Mailbox messages and Register xfer access are read-write,
+ * CPUID and MCA_MSR access is read-only.
+
+Driver IOCTLs
+=============
+
+.. c:macro:: SBRMI_IOCTL_CMD
+.. kernel-doc:: include/uapi/misc/amd-apml.h
+ :doc: SBRMI_IOCTL_CMD
+
+User-space usage
+================
+
+To access side band interface from a C program.
+First, user need to include the headers::
+
+ #include <uapi/misc/amd-apml.h>
+
+Which defines the supported IOCTL and data structure to be passed
+from the user space.
+
+Next thing, open the device file, as follows::
+
+ int file;
+
+ file = open("/dev/sbrmi-*", O_RDWR);
+ if (file < 0) {
+ /* ERROR HANDLING */
+ exit(1);
+ }
+
+The following IOCTL is defined:
+
+``#define SB_BASE_IOCTL_NR 0xF9``
+``#define SBRMI_IOCTL_CMD _IOWR(SB_BASE_IOCTL_NR, 0, struct apml_message)``
+
+
+User space C-APIs are made available by esmi_oob_library, hosted at
+[2]_ which is provided by the E-SMS project [3]_.
+
+.. [2] https://github.com/amd/esmi_oob_library
+.. [3] https://www.amd.com/en/developer/e-sms.html
--
2.25.1
prev parent reply other threads:[~2025-04-02 5:59 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-02 5:58 [PATCH v7 00/10] misc: Move AMD side band interface(SBI) functionality Akshay Gupta
2025-04-02 5:58 ` [PATCH v7 01/10] hwmon/misc: amd-sbi: Move core sbrmi from hwmon to misc Akshay Gupta
2025-04-02 5:58 ` [PATCH v7 02/10] misc: amd-sbi: Move protocol functionality to core file Akshay Gupta
2025-04-02 5:58 ` [PATCH v7 03/10] misc: amd-sbi: Move hwmon device sensor as separate entity Akshay Gupta
2025-04-02 11:03 ` Arnd Bergmann
2025-04-07 11:31 ` Gupta, Akshay
2025-04-02 5:58 ` [PATCH v7 04/10] misc: amd-sbi: Use regmap subsystem Akshay Gupta
2025-04-02 5:58 ` [PATCH v7 05/10] misc: amd-sbi: Optimize the wait condition for mailbox command completion Akshay Gupta
2025-04-02 5:58 ` [PATCH v7 06/10] misc: amd-sbi: Add support for AMD_SBI IOCTL Akshay Gupta
2025-04-02 5:58 ` [PATCH v7 07/10] misc: amd-sbi: Add support for CPUID protocol Akshay Gupta
2025-04-02 12:13 ` Arnd Bergmann
2025-04-02 12:16 ` Greg Kroah-Hartman
2025-04-07 11:31 ` Gupta, Akshay
2025-04-02 5:58 ` [PATCH v7 08/10] misc: amd-sbi: Add support for read MCA register protocol Akshay Gupta
2025-04-02 5:58 ` [PATCH v7 09/10] misc: amd-sbi: Add support for register xfer Akshay Gupta
2025-04-02 5:58 ` Akshay Gupta [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250402055840.1346384-11-akshay.gupta@amd.com \
--to=akshay.gupta@amd.com \
--cc=anand.umarji@amd.com \
--cc=arnd@arndb.de \
--cc=gautham.shenoy@amd.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=mario.limonciello@amd.com \
--cc=naveenkrishna.chatradhi@amd.com \
--cc=shyam-sundar.s-k@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox