New DRM accel driver for Texas Instruments' C7x DSPs
Get series with b4
b4 am [email protected] change-id 20260113-thames-334127a2d91dVersions newest first
- v3 Latest16 patches 4 repliesIn review
- v25 patches 8 repliesSuperseded
- v15 patches 5 repliesSuperseded
Changes in v3 from the cover letter
- 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/[email protected]
Patches in v3 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/16 | dt-bindings: remoteproc: k3-dsp: Add the L2 auxiliary and DRU regionsDocumentation/ | +6 | 0 replies | |
| 2/16 | dt-bindings: remoteproc: k3-dsp: Allow a second sub-mailboxDocumentation/ | +6 | 1 reply | |
| 3/16 | dt-bindings: remoteproc: k3-dsp: Allow referencing the timers' power domainsDocumentation/ | +17 | 1 reply | |
| 4/16 | accel/thames: Add header with IPC definitionsdrivers/ | +238 | 0 replies | |
| 5/16 | accel/thames: Add driver for the C7x DSPs in TI SoCsMAINTAINERS drivers/ drivers/ +8 more | +1402 | 0 replies | |
| 6/16 | accel/thames: Create a context per client on device opendrivers/ drivers/ drivers/ +5 more | +689 | 0 replies | |
| 7/16 | accel/thames: Add IOCTLs for BO creation and mappingdrivers/ drivers/ drivers/ +4 more | +661 | 1 reply | |
| 8/16 | accel/thames: Add support for submitting DMA operationsdrivers/ drivers/ drivers/ +4 more | +563 | 0 replies | |
| 9/16 | accel/thames: Add IOCTLs for job creation and submissiondrivers/ drivers/ drivers/ +8 more | +1381 | 1 reply | |
| 10/16 | accel/thames: Recover from faults and timeoutsdrivers/ drivers/ drivers/ +5 more | +806 | 0 replies | |
| 11/16 | accel/thames: Add IOCTL for memory synchronizationdrivers/ drivers/ drivers/ +1 more | +126 | 0 replies | |
| 12/16 | accel/thames: Install memory mappings populated and dirtydrivers/ | +73 | 0 replies | |
| 13/16 | Documentation: accel/thames: Add initial docsDocumentation/ Documentation/ MAINTAINERS | +49 | 0 replies | |
| 14/16 | arm64: dts: ti: k3-j722s: Add the AUX L2 SRAM and DRU regionsarch/ arch/ | +16 | 0 replies | |
| 15/16 | arm64: dts: ti: k3-j722s: Add second submailbox to the C7x coresarch/ | +14 | 0 replies | |
| 16/16 | arm64: dts: ti: k3-j722s: Reference the power domains of the C7x timersarch/ | +11 | 0 replies |
Reviews trailers per patch
1 of 16 patches has a Reviewed-by or Acked-by.
| Patch | Krzysztof Kozlowski |
|---|---|
| 1/16 | |
| 2/16 | |
| 3/16 | R-b |
| 4/16 | |
| 5/16 | |
| 6/16 | |
| 7/16 | |
| 8/16 | |
| 9/16 | |
| 10/16 | |
| 11/16 | |
| 12/16 | |
| 13/16 | |
| 14/16 | |
| 15/16 | |
| 16/16 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v3 00/16] New DRM accel driver for Texas Instruments' C7x DSPs
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, moves a Fence 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, page-backed 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 and the Context table 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.
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.
Known limitations of this version:
- Runtime power management is not implemented (system suspend and resume are).
- The J722S EVM does not resume from s2idle with TI's shipped system-controller firmware, so the resume path ran only in the driver's own tests; the suspend path ran on the board.
- 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 is left out after the handshake's five seconds.
- The DRU channel stride is stated for the J722S instead of queried.
- The J722S is the only SoC this version runs on.
Three additions were needed in the device tree bindings:
- power domain references for the two SoC timers the DSP firmware drives, which the remoteproc driver does not hold;
- 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
---
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/[email protected]
Changes in v2:
- Add thames_accel.h UAPI header (Robert Nelson).
- Link to v1: https://lore.kernel.org/r/[email protected]
To: Bjorn Andersson <[email protected]>
To: Mathieu Poirier <[email protected]>
To: Rob Herring <[email protected]>
To: Krzysztof Kozlowski <[email protected]>
To: Conor Dooley <[email protected]>
To: Suman Anna <[email protected]>
To: Tomeu Vizoso <[email protected]>
To: Oded Gabbay <[email protected]>
To: Maarten Lankhorst <[email protected]>
To: Maxime Ripard <[email protected]>
To: Thomas Zimmermann <[email protected]>
To: David Airlie <[email protected]>
To: Simona Vetter <[email protected]>
To: Kees Cook <[email protected]>
To: "Gustavo A. R. Silva" <[email protected]>
To: Sumit Semwal <[email protected]>
To: Christian König <[email protected]>
To: Jonathan Corbet <[email protected]>
To: Shuah Khan <[email protected]>
To: Randy Dunlap <[email protected]>
To: Nishanth Menon <[email protected]>
To: Vignesh Raghavendra <[email protected]>
To: Tero Kristo <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
Tomeu Vizoso (16):
dt-bindings: remoteproc: k3-dsp: Add the L2 auxiliary and DRU regions
dt-bindings: remoteproc: k3-dsp: Allow a second sub-mailbox
dt-bindings: remoteproc: k3-dsp: Allow referencing the timers' power domains 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
arm64: dts: ti: k3-j722s: Reference the power domains of the C7x timers
Documentation/accel/index.rst | 1 + Documentation/accel/thames/index.rst | 47 + .../bindings/remoteproc/ti,k3-dsp-rproc.yaml | 33 +- MAINTAINERS | 9 + arch/arm64/boot/dts/ti/k3-j722s-main.dtsi | 16 +- .../boot/dts/ti/k3-j722s-ti-ipc-firmware.dtsi | 27 +- arch/arm64/boot/dts/ti/k3-j722s.dtsi | 4 + drivers/accel/Kconfig | 1 + drivers/accel/Makefile | 3 +- drivers/accel/thames/Kconfig | 27 + drivers/accel/thames/Makefile | 12 + drivers/accel/thames/thames_abi.h | 238 ++++ drivers/accel/thames/thames_core.c | 867 +++++++++++++ drivers/accel/thames/thames_core.h | 120 ++ drivers/accel/thames/thames_device.h | 97 ++ drivers/accel/thames/thames_drv.c | 554 ++++++++ drivers/accel/thames/thames_drv.h | 67 + drivers/accel/thames/thames_gem.c | 1077 ++++++++++++++++ drivers/accel/thames/thames_gem.h | 77 ++ drivers/accel/thames/thames_job.c | 1319 ++++++++++++++++++++ drivers/accel/thames/thames_job.h | 81 ++ drivers/accel/thames/thames_trace.h | 77 ++ drivers/accel/thames/thames_transfers.c | 405 ++++++ drivers/accel/thames/thames_transfers.h | 52 + include/uapi/drm/thames_accel.h | 843 +++++++++++++ 25 files changed, 6043 insertions(+), 11 deletions(-)
---
base-commit: 1ecab8b0bad393750c60cc3819ce9c256595463c
change-id: 20260113-thames-334127a2d91d
Best regards,
Signature · 1 line
Tomeu Vizoso <[email protected]>