With pointers to the other components, how users can make use of it, and how to enlarge the CMA pool when a model's buffers exceed it.
Signed-off-by: Tomeu Vizoso <[email protected]> --- v4: - Describe the attach, the capability query's contents and the CMA pool. - Call the firmware's word the sequence number, as the uAPI's Fence is the dma-fence. --- Documentation/accel/index.rst | 1 + Documentation/accel/thames/index.rst | 54 ++++++++++++++++++++++++++++++++++++ MAINTAINERS | 1 + 3 files changed, 56 insertions(+) diff --git a/Documentation/accel/index.rst b/Documentation/accel/index.rst index cbc7d4c3876a..eb115413db07 100644 --- a/Documentation/accel/index.rst +++ b/Documentation/accel/index.rst @@ -11,3 +11,4 @@ Compute Accelerators amdxdna/index qaic/index rocket/index + thames/index diff --git a/Documentation/accel/thames/index.rst b/Documentation/accel/thames/index.rst new file mode 100644 index 000000000000..7d3c4727b5bc --- /dev/null +++ b/Documentation/accel/thames/index.rst @@ -0,0 +1,54 @@ +.. SPDX-License-Identifier: GPL-2.0-only + +============================================================ + accel/thames Driver for the C7x DSPs from Texas Instruments +============================================================ + +The accel/thames driver supports the C7x DSP cores of the Texas Instruments +J722S as compute accelerators, for workloads such as machine learning +inference. + +Each core runs a firmware that remoteproc (Documentation/staging/remoteproc.rst) +loads; the driver attaches to a core when remoteproc starts it, or at once if it +is running, and resets a core through it after a fault or a timeout. The +firmware's source is at https://gitlab.freedesktop.org/tomeu/thames-firmware/. + +The driver and the firmware of a core share a block of memory reserved in the +device tree. It holds the core's Ring, the queue of submitted Jobs in the order +the core runs them, and the sequence number the firmware writes as each Job +completes. The driver adds an entry to the Ring and rings a mailbox doorbell; +the firmware rings one back when the sequence number moves. + +Each file that opens the device gets a Context: a page table the core switches +to while it runs the Context's Jobs, so the buffers of one client are isolated +from the others'. A buffer is created without a mapping and bound into the +Context at a DSP address the client chooses. + +A Job is created once from a program, its parameters and the transfers the +core's DMA unit performs around it, and is checked then. It can then be +submitted any number of times, in arrays of Jobs that run in order and signal +sync objects when they finish; the call waits on no sync object, the fences of +the listed buffers order the work. The drm-gpu-scheduler spreads the +submissions over the cores. A Job that faults leaves a fault record, which +userspace reads with a query; the capability query returns the kernel driver's +own limits and address ranges, and the hardware ID on which userspace keys the +hardware's sizes and addresses. + +The buffers a Job's transfers read or write are created contiguous, from the +kernel's default CMA pool. A model's largest buffer can exceed the pool's +default size (32 MiB in the arm64 defconfig); the driver then logs an error +with the size asked for, and the pool is enlarged with the ``cma=`` kernel +parameter or ``CONFIG_CMA_SIZE_MBYTES`` +(Documentation/admin-guide/kernel-parameters.txt). + +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 + +The interface is described in ``include/uapi/drm/thames_accel.h``. + +.. kernel-doc:: include/uapi/drm/thames_accel.h + :doc: Terms + +Hardware currently supported: + +* J722S diff --git a/MAINTAINERS b/MAINTAINERS index 065723fa307c..9ef30eaf381b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -8224,6 +8224,7 @@ M: Tomeu Vizoso <[email protected]> L: [email protected] S: Supported T: git https://gitlab.freedesktop.org/drm/misc/kernel.git +F: Documentation/accel/thames/ F: drivers/accel/thames/ F: include/uapi/drm/thames_accel.h -- 2.54.0
