Devicetree
 help / color / mirror / Atom feed
* [PATCH v4 00/14] New DRM accel driver for Texas Instruments' C7x DSPs
@ 2026-11-29 11:35 Tomeu Vizoso
  2026-11-29 11:35 ` [PATCH v4 01/14] dt-bindings: remoteproc: k3-dsp: Add the L2 auxiliary and DRU regions Tomeu Vizoso
                   ` (13 more replies)
  0 siblings, 14 replies; 22+ messages in thread
From: Tomeu Vizoso @ 2026-11-29 11:35 UTC (permalink / raw)
  To: Nishanth Menon, Andrew F. Davis, Randolph Sapp,
	Jonathan Humphreys, Andrei Aldea, Chirag Shilwant,
	Vignesh Raghavendra, Beleswar Padhi, Tero Kristo, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Oded Gabbay, Jonathan Corbet,
	Sumit Semwal, Christian König, Robert Nelson, David Airlie,
	Simona Vetter, Maarten Lankhorst, Maxime Ripard,
	Thomas Zimmermann, Jani Nikula, Tvrtko Ursulin, Markus Elfring,
	Bjorn Andersson, Mathieu Poirier, Suman Anna, Kees Cook,
	Gustavo A. R. Silva, Shuah Khan, Randy Dunlap, Philipp Stanner
  Cc: linux-arm-kernel, devicetree, linux-kernel, dri-devel, linux-doc,
	linux-media, linaro-mm-sig, Tomeu Vizoso, linux-remoteproc,
	linux-hardening

This series adds a new DRM accel driver that supports the C7x DSPs
inside some Texas Instruments SoCs such as the J722S (the only SoC
currently supported). These can be used as accelerators for various
workloads, including machine learning inference.

This driver attaches to the DSPs through remoteproc and talks to the
firmware running on them through shared memory and a mailbox. The
firmware is the accelerator's command processor: the driver pushes Jobs
onto a per-core Ring in shared memory and rings a mailbox doorbell; the
firmware runs each Job's Kernel in the DSP's user mode on the client's
own page table, writes the Job's sequence number when the Job is done
and rings back.

The kernel driver itself allocates buffers, manages contexts and submits
jobs to the DSP firmware. It also populates the per-client page tables
with io-pgtable-arm.

No carveout holds buffers any more: every buffer is the kernel driver's
and mapped through the DSP's MMU in the client's own page table, which
answers Andrew F. Davis's question on v2. The one reserved region the
driver uses is the first 256 KiB of the IPC pool, where the handshake,
the Ring, the Context table and the Jobs' transfer tables live. A buffer
that a DMA transfer names must be physically contiguous, since the DRU
does not go through the MMU; the client asks for that at creation. Such
a buffer is coherent memory the CPU maps write-combined, as Ethos-U and
vc4 do, from the default CMA pool, which a model's largest buffer can
exceed.

If there is more than one C7x DSP core, the driver will load balance
jobs between them with drm-gpu-scheduler.

The firmware isolates clients by using its MMU to protect their memory
and by running their kernels at a lower privilege level.

Besides executing user-generated DSP kernels, the firmware can also
execute DMA transfers at the request of userspace. These don't go via
the MMU, so are validated by the kernel driver.

The source code for the firmware running on the DSP is available at:
https://gitlab.freedesktop.org/tomeu/thames-firmware/ mostly under the MIT
license. The ABI with the firmware is defined in a shared header with
versioning. This series was tested with the firmware at its tag
thames-v4.

Known limitations of this version:

- Runtime power management is not implemented (system suspend and
  resume are).
- The J722S does not resume from s2idle with TI's shipped
  system-controller firmware, on the EVM or on the BeagleY-AI, with or
  without this driver loaded. The driver's suspend and resume callbacks
  ran on the BeagleY-AI as the freeze and thaw of a hibernation attempt,
  also with Jobs in flight, but never across a real suspend.
- The submit IOCTL waits on no sync object, which a Vulkan driver will
  need.
- The 4D block move is the only DMA transfer type accepted.
- One firmware image serves both cores; a core found running another
  firmware stays offline after the handshake's five seconds, until
  remoteproc stops and starts it.
- The DRU channel stride is stated for the J722S instead of queried.
- The J722S is the only SoC this version runs on.

Two additions were needed in the device tree bindings:

- a second mailbox doorbell, since remoteproc's own serves rpmsg and
  this firmware rings the Ring's; and
- reg entries for the AUX SRAM and the DMA engine's registers, which
  the driver maps into every client's page table.

Everything else is done in userspace, as a Gallium driver (also called
thames) that is part of the Mesa3D project: https://docs.mesa3d.org/teflon.html

Userspace portion of the driver: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39298

Signed-off-by: Tomeu Vizoso <tomeu@tomeuvizoso.net>
---
Changes in v4:
- The firmware requests its own timer from the system controller; the
  timers' power domains are gone from the bindings, the device tree and
  the driver
- A core is attached whenever remoteproc starts it; the probe no longer
  boots cores or defers while remoteproc's auto-boot is pending
- The platform device is created only with an available C7x node
- The capability query carries the kernel driver's own limits and the
  hardware ID
- Contiguous buffers come from the GEM DMA helper, coherent and
  write-combined
- Client buffers are no longer 2 MiB aligned and are mapped in 4 KiB
  pages only (Christian König)
- A buffer unbound while Jobs of its Context may run is kept until they
  end
- A transfer's destination is bounded by the counts the DRU walks
- After a reset the firmware empties the Ring; the kernel no longer
  moves its head
- The uAPI comments state each errno
- The driver depends on 4 KiB host pages
- List the two sub-mailboxes as items (Krzysztof Kozlowski)
- Smaller changes are listed in each patch
- Link to v3: https://patch.msgid.link/20261023-thames-v3-0-3ab40aa17157@tomeuvizoso.net

Changes in v3:
- Shared-memory ring and mailbox doorbell replace rpmsg
- The kernel driver writes the client page tables
- Buffers are bound at userspace-chosen DSP addresses
- Kernels run in the DSP's user mode; faults reported per job
- DRU transfers submitted by userspace, checked and translated by the kernel driver
- System suspend and resume
- Versioned firmware ABI; hardware ID reported and checked against the SoC
- Firmware rewritten bare-metal, MIT
- Link to v2: https://lore.kernel.org/r/20260114-thames-v2-0-e94a6636e050@tomeuvizoso.net

Changes in v2:
- Add thames_accel.h UAPI header (Robert Nelson).
- Link to v1: https://lore.kernel.org/r/20260113-thames-v1-0-99390026937c@tomeuvizoso.net

To: Bjorn Andersson <andersson@kernel.org>
To: Mathieu Poirier <mathieu.poirier@linaro.org>
To: Rob Herring <robh@kernel.org>
To: Krzysztof Kozlowski <krzk+dt@kernel.org>
To: Conor Dooley <conor+dt@kernel.org>
To: Suman Anna <s-anna@ti.com>
To: Tomeu Vizoso <tomeu@tomeuvizoso.net>
To: Oded Gabbay <ogabbay@kernel.org>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: Maxime Ripard <mripard@kernel.org>
To: Thomas Zimmermann <tzimmermann@suse.de>
To: David Airlie <airlied@gmail.com>
To: Simona Vetter <simona@ffwll.ch>
To: Kees Cook <kees@kernel.org>
To: "Gustavo A. R. Silva" <gustavoars@kernel.org>
To: Sumit Semwal <sumit.semwal@linaro.org>
To: Christian König <christian.koenig@amd.com>
To: Jonathan Corbet <corbet@lwn.net>
To: Shuah Khan <skhan@linuxfoundation.org>
To: Randy Dunlap <rdunlap@infradead.org>
To: Nishanth Menon <nm@ti.com>
To: Vignesh Raghavendra <vigneshr@ti.com>
To: Tero Kristo <kristo@kernel.org>
To: Philipp Stanner <phasta@kernel.org>
Cc: linux-remoteproc@vger.kernel.org
Cc: devicetree@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: linux-hardening@vger.kernel.org
Cc: linux-media@vger.kernel.org
Cc: linaro-mm-sig@lists.linaro.org
Cc: linux-doc@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org

---
Tomeu Vizoso (14):
      dt-bindings: remoteproc: k3-dsp: Add the L2 auxiliary and DRU regions
      dt-bindings: remoteproc: k3-dsp: Allow a second sub-mailbox
      accel/thames: Add header with IPC definitions
      accel/thames: Add driver for the C7x DSPs in TI SoCs
      accel/thames: Create a context per client on device open
      accel/thames: Add IOCTLs for BO creation and mapping
      accel/thames: Add support for submitting DMA operations
      accel/thames: Add IOCTLs for job creation and submission
      accel/thames: Recover from faults and timeouts
      accel/thames: Add IOCTL for memory synchronization
      accel/thames: Install memory mappings populated and dirty
      Documentation: accel/thames: Add initial docs
      arm64: dts: ti: k3-j722s: Add the AUX L2 SRAM and DRU regions
      arm64: dts: ti: k3-j722s: Add second submailbox to the C7x cores

 Documentation/accel/index.rst                      |    1 +
 Documentation/accel/thames/index.rst               |   54 +
 .../bindings/remoteproc/ti,k3-dsp-rproc.yaml       |   18 +-
 MAINTAINERS                                        |    9 +
 arch/arm64/boot/dts/ti/k3-j722s-main.dtsi          |   16 +-
 .../boot/dts/ti/k3-j722s-ti-ipc-firmware.dtsi      |   16 +-
 arch/arm64/boot/dts/ti/k3-j722s.dtsi               |    4 +
 drivers/accel/Kconfig                              |    1 +
 drivers/accel/Makefile                             |    3 +-
 drivers/accel/thames/Kconfig                       |   32 +
 drivers/accel/thames/Makefile                      |   12 +
 drivers/accel/thames/thames_abi.h                  |  242 ++++
 drivers/accel/thames/thames_core.c                 |  808 ++++++++++++
 drivers/accel/thames/thames_core.h                 |  120 ++
 drivers/accel/thames/thames_device.h               |  112 ++
 drivers/accel/thames/thames_drv.c                  |  588 +++++++++
 drivers/accel/thames/thames_drv.h                  |   83 ++
 drivers/accel/thames/thames_gem.c                  | 1080 ++++++++++++++++
 drivers/accel/thames/thames_gem.h                  |   74 ++
 drivers/accel/thames/thames_job.c                  | 1333 ++++++++++++++++++++
 drivers/accel/thames/thames_job.h                  |   86 ++
 drivers/accel/thames/thames_trace.h                |   77 ++
 drivers/accel/thames/thames_transfers.c            |  401 ++++++
 drivers/accel/thames/thames_transfers.h            |   52 +
 include/uapi/drm/thames_accel.h                    |  820 ++++++++++++
 25 files changed, 6031 insertions(+), 11 deletions(-)
---
base-commit: 5ce32a0c94a827ff44ee60898c28060714dcff75
change-id: 20260113-thames-334127a2d91d

Best regards,
--  
Tomeu Vizoso <tomeu@tomeuvizoso.net>


^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2026-11-29 12:06 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-29 11:35 [PATCH v4 00/14] New DRM accel driver for Texas Instruments' C7x DSPs Tomeu Vizoso
2026-11-29 11:35 ` [PATCH v4 01/14] dt-bindings: remoteproc: k3-dsp: Add the L2 auxiliary and DRU regions Tomeu Vizoso
2026-11-29 11:35 ` [PATCH v4 02/14] dt-bindings: remoteproc: k3-dsp: Allow a second sub-mailbox Tomeu Vizoso
2026-11-29 11:35 ` [PATCH v4 03/14] accel/thames: Add header with IPC definitions Tomeu Vizoso
2026-11-29 11:35 ` [PATCH v4 04/14] accel/thames: Add driver for the C7x DSPs in TI SoCs Tomeu Vizoso
2026-11-29 11:35 ` [PATCH v4 05/14] accel/thames: Create a context per client on device open Tomeu Vizoso
2026-11-29 11:53   ` sashiko-bot
2026-11-29 11:35 ` [PATCH v4 06/14] accel/thames: Add IOCTLs for BO creation and mapping Tomeu Vizoso
2026-11-29 11:52   ` sashiko-bot
2026-11-29 11:35 ` [PATCH v4 07/14] accel/thames: Add support for submitting DMA operations Tomeu Vizoso
2026-11-29 11:48   ` sashiko-bot
2026-11-29 11:35 ` [PATCH v4 08/14] accel/thames: Add IOCTLs for job creation and submission Tomeu Vizoso
2026-11-29 11:58   ` sashiko-bot
2026-11-29 11:35 ` [PATCH v4 09/14] accel/thames: Recover from faults and timeouts Tomeu Vizoso
2026-11-29 12:00   ` sashiko-bot
2026-11-29 11:35 ` [PATCH v4 10/14] accel/thames: Add IOCTL for memory synchronization Tomeu Vizoso
2026-11-29 11:35 ` [PATCH v4 11/14] accel/thames: Install memory mappings populated and dirty Tomeu Vizoso
2026-11-29 11:56   ` sashiko-bot
2026-11-29 11:35 ` [PATCH v4 12/14] Documentation: accel/thames: Add initial docs Tomeu Vizoso
2026-11-29 11:35 ` [PATCH v4 13/14] arm64: dts: ti: k3-j722s: Add the AUX L2 SRAM and DRU regions Tomeu Vizoso
2026-11-29 11:35 ` [PATCH v4 14/14] arm64: dts: ti: k3-j722s: Add second submailbox to the C7x cores Tomeu Vizoso
2026-11-29 12:06   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox