Hi All, This RFC introduces a driver for the Arm Core Local Accelerator (CLA), a CPU-local interface for programming attached accelerators. While the interface is agnostic to the accelerator type, the initial (and currently only) target is a compute engine.
The RFC aims to engage the community and get feedback on some key aspects. This will help plan our approach for eventual upstreaming. The patches implement a bare bones driver to aid discussion. Arm plans to publish the CLA spec in future, but for now I hope the documentation included with patch 1 suffices. Note that the CLA is not part of the Arm Architecture. Patch 1 documents the hardware and driver design, and adds a driver skeleton. Patches 2-4 initialize and probe the device. Patches 5-8 add context management for switching the device between different users. Aspects I'm seeking feedback for: * The general structure of the driver: The current shape addresses the performance requirements we have for the use cases, and is therefore our preferred approach. But there are some unusual aspects due to the HW design. * Driver interaction with architectural support: I've opted to treat the CLA as a device rather than a CPU extension, so it's implemented as a (mostly) self-contained driver. It has some unavoidable coupling to the arch code since it needs to share page tables and ASIDs (arm64_mm_context_[put|get]()). * The location of the driver: although most accelerators will likely be compute ones, CLA is a generic MMIO interface that could handle any kind of accelerator. It's currently implemented as a misc driver. accel is another potential option, but given the current SVA approach, we would not use any of the services (memory-management or otherwise) that accel provides. * User space availability: The kernel driver exposes the capabilities of the hardware to user space. Arm plans to open source a user space driver, but does not yet have any committed date. I'd like to understand if the availability of this component will be a prerequisite for upstream acceptance of the kernel driver; either way, I'm hoping we can at least progress with some discussion in its absence. I'm deliberately constraining the scope to bare-metal support for now. Virtualization is something we are considering (and have prototyped), but plan to post a separate RFC for that as follow-up, once we have agreement on direction for the bare-metal driver. Source, along with some tests, is available at [1]. Patches based on v7.2-rc3. [1] https://gitlab.arm.com/linux-arm/linux-rr/-/tree/features/cla-driver-v1-rfc-tests Thanks, Ryan Jean-Philippe Brucker (5): misc/arm-cla: Add driver skeleton and documentation misc/arm-cla: Add launch operation helpers misc/arm-cla: Probe firmware-described devices misc/arm-cla: Initialize devices on CPU bringup misc/arm-cla: Accelerator context save and restore Ryan Roberts (3): misc/arm-cla: Set up memory translation context misc/arm-cla: Manage domain contexts misc/arm-cla: Add userspace interface Documentation/misc-devices/arm-cla.rst | 206 ++++++++++ drivers/misc/Kconfig | 1 + drivers/misc/Makefile | 1 + drivers/misc/arm-cla/Kconfig | 10 + drivers/misc/arm-cla/Makefile | 13 + drivers/misc/arm-cla/arm-cla-regs.h | 179 +++++++++ drivers/misc/arm-cla/arm-cla.h | 296 +++++++++++++++ drivers/misc/arm-cla/cla-ctx.c | 142 +++++++ drivers/misc/arm-cla/cla-init.c | 503 +++++++++++++++++++++++++ drivers/misc/arm-cla/cla-mtc.c | 139 +++++++ drivers/misc/arm-cla/cla-ops.c | 342 +++++++++++++++++ drivers/misc/arm-cla/cla-regs.c | 263 +++++++++++++ drivers/misc/arm-cla/cla-sched.c | 474 +++++++++++++++++++++++ drivers/misc/arm-cla/cla-topology.c | 187 +++++++++ drivers/misc/arm-cla/cla-user.c | 351 +++++++++++++++++ include/uapi/linux/arm-cla.h | 207 ++++++++++ 16 files changed, 3314 insertions(+) create mode 100644 Documentation/misc-devices/arm-cla.rst create mode 100644 drivers/misc/arm-cla/Kconfig create mode 100644 drivers/misc/arm-cla/Makefile create mode 100644 drivers/misc/arm-cla/arm-cla-regs.h create mode 100644 drivers/misc/arm-cla/arm-cla.h create mode 100644 drivers/misc/arm-cla/cla-ctx.c create mode 100644 drivers/misc/arm-cla/cla-init.c create mode 100644 drivers/misc/arm-cla/cla-mtc.c create mode 100644 drivers/misc/arm-cla/cla-ops.c create mode 100644 drivers/misc/arm-cla/cla-regs.c create mode 100644 drivers/misc/arm-cla/cla-sched.c create mode 100644 drivers/misc/arm-cla/cla-topology.c create mode 100644 drivers/misc/arm-cla/cla-user.c create mode 100644 include/uapi/linux/arm-cla.h -- 2.43.0
