mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Akshay Gupta <Akshay.Gupta@amd.com>
To: <linux-kernel@vger.kernel.org>, <linux-doc@vger.kernel.org>
Cc: <arnd@arndb.de>, <gregkh@linuxfoundation.org>, <corbet@lwn.net>,
	<skhan@linuxfoundation.org>, <rdunlap@infradead.org>,
	<linux@roeck-us.net>, <naveenkrishna.chatradhi@amd.com>,
	<Anand.Umarji@amd.com>, Akshay Gupta <Akshay.Gupta@amd.com>
Subject: [PATCH v1 0/3] misc: amd-sbi: Add TBAI trace-buffer access over I3C
Date: Wed, 11 Nov 2026 11:10:31 +0530	[thread overview]
Message-ID: <20261111054034.2453874-1-Akshay.Gupta@amd.com> (raw)

The Trace Buffer Acquire Interface (TBAI) in the Thermal Management
(THM) block lets a Board Management Controller (BMC) read
microprocessor (MP) trace data over SB-TSI. The BMC does not program
the trace-buffer destination address space. It selects a look-up
table (LUT) index and an entry offset, and the SoC returns the
payload.

amd-sbi already exposes SB-TSI register transfers on /dev/sbtsi-* for
both I2C and I3C. TBAI is a second protocol on that same I3C target:
a 5-byte request and up to 32 bytes of read data. It is not available
over I2C. This series adds it as a new ioctl and does not change the
existing register-transfer ABI.

Userspace interface:

SBTBAI_IOCTL_CMD is

    _IOWR(SB_BASE_IOCTL_NR, 5, struct apml_tbai_msg)

on the same /dev/sbtsi-* node as SBTSI_IOCTL_REG_XFER_CMD.

- I3C only. On an I2C SB-TSI device the ioctl returns -EOPNOTSUPP.
- Acquire (command 0x31) reads 1 to 32 dwords from a LUT index and a
  16-bit entry offset. One transaction carries at most 8 dwords, so
  the driver splits a larger read and advances the offset between
  chunks.
- Flush (command 0x32) resets the TBAI logic. The acquire fields in
  the request are ignored, and the 4-byte flush status is returned
  in data_out.
- A trace-buffer target error is returned as -EPROTOTYPE. fw_ret_code
  holds the status word (AMD_SBI_TBAI_TBT_ERR*) and data_out is
  cleared. A 1-dword reply equal to one of those status values is
  always reported as an error, because it cannot be told apart from
  trace data.
- A short read returns -EMSGSIZE. The partial buffer is not copied
  back to userspace.
- logging_en and the padding bytes must be zero.
- TBAI and TSI register transfers share the device lock, so the two
  ioctls cannot interleave on the bus.

Series:

1. Name and size the I3C DMA buffers. Register access still uses
   2 transmit bytes and 1 receive byte. Both buffers stay aligned to
   ARCH_DMA_MINALIGN.
2. Add SBTBAI_IOCTL_CMD, the UAPI in include/uapi/misc/amd-apml.h, and
   grow the shared I3C buffers to 5 transmit bytes and 32 receive
   bytes.
3. Document the ioctl in Documentation/misc-devices/amd-sbi.rst.

Testing:

- Built the driver and checked that I3C SB-TSI register reads and
  writes still work after the buffer change.
- On I3C hardware: acquire, flush, short read, and a trace-buffer
  target error.
- On I2C, SBTBAI_IOCTL_CMD returns -EOPNOTSUPP.
- Built the amd-sbi documentation, including the new kernel-doc
  reference, with no new warnings.

Akshay Gupta (1):
  misc: amd-sbi: Add TBAI trace-buffer access over I3C

Prathima (2):
  misc: amd-sbi: use sized DMA-safe I3C tx/rx buffers
  docs: amd-sbi: document TBAI trace-buffer ioctl

 Documentation/misc-devices/amd-sbi.rst |  60 +++++++-
 drivers/misc/amd-sbi/tsi-core.c        | 198 ++++++++++++++++++++++++-
 drivers/misc/amd-sbi/tsi-core.h        |  15 +-
 include/uapi/misc/amd-apml.h           |  78 ++++++++++
 4 files changed, 344 insertions(+), 7 deletions(-)

-- 
2.34.1


             reply	other threads:[~2026-11-11  5:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-11  5:40 Akshay Gupta [this message]
2026-11-11  5:40 ` [PATCH v1 1/3] misc: amd-sbi: use sized DMA-safe I3C tx/rx buffers Akshay Gupta
2026-11-11  5:40 ` [PATCH v1 2/3] misc: amd-sbi: Add TBAI trace-buffer access over I3C Akshay Gupta
2026-11-11  5:40 ` [PATCH v1 3/3] docs: amd-sbi: document TBAI trace-buffer ioctl Akshay Gupta

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=20261111054034.2453874-1-Akshay.Gupta@amd.com \
    --to=akshay.gupta@amd.com \
    --cc=Anand.Umarji@amd.com \
    --cc=arnd@arndb.de \
    --cc=corbet@lwn.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=naveenkrishna.chatradhi@amd.com \
    --cc=rdunlap@infradead.org \
    --cc=skhan@linuxfoundation.org \
    /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

all inboxes | Powered by JetHome®