Commit cf4fd52e authored by Daniel Almeida's avatar Daniel Almeida Committed by Alice Ryhl
Browse files

rust: drm: Introduce the Tyr driver for Arm Mali GPUs



Add a Rust driver for ARM Mali CSF-based GPUs. It is a port of Panthor
and therefore exposes Panthor's uAPI and name to userspace, and the
product of a joint effort between Collabora, Arm and Google engineers.

The aim is to incrementally develop Tyr with the abstractions that are
currently available until it is consider to be in parity with Panthor
feature-wise.

The development of Tyr itself started in January, after a few failed
attempts of converting Panthor piecewise through a mix of Rust and C
code. There is a downstream branch that's much further ahead in terms of
capabilities than this initial patch.

The downstream code is capable of booting the MCU, doing sync VM_BINDS
through the work-in-progress GPUVM abstraction and also doing (trivial)
submits through Asahi's drm_scheduler and dma_fence abstractions. So
basically, most of what one would expect a modern GPU driver to do,
except for power management and some other very important adjacent
pieces. It is not at the point where submits can correctly deal with
dependencies, or at the point where it can rotate access to the GPU
hardware fairly through a software scheduler, but that is simply a
matter of writing more code.

This first patch, however, only implements a subset of the current
features available downstream, as the rest is not implementable without
pulling in even more abstractions. In particular, a lot of things depend
on properly mapping memory on a given VA range, which itself depends on
the GPUVM abstraction that is currently work-in-progress. For this
reason, we still cannot boot the MCU and thus, cannot do much for the
moment.

This constitutes a change in the overall strategy that we have been
using to develop Tyr so far. By submitting small parts of the driver
upstream iteratively, we aim to:

a) evolve together with Nova and rvkms, hopefully reducing regressions
due to upstream changes (that may break us because we were not there, in
the first place)

b) prove any work-in-progress abstractions by having them run on a real
driver and hardware and,

c) provide a reason to work on and review said abstractions by providing
a user, which would be tyr itself.

Despite its limited feature-set, we offer IGT tests. It is only tested
on the rk3588, so any other SoC is probably not going to work at all for
now.

The skeleton is basically taken from Nova and also
rust_platform_driver.rs.

Lastly, the name "Tyr" is inspired by Norse mythology, reflecting ARM's
tradition of naming their GPUs after Nordic mythological figures and
places.

Co-developed-by: default avatarBeata Michalska <beata.michalska@arm.com>
Signed-off-by: default avatarBeata Michalska <beata.michalska@arm.com>
Co-developed-by: default avatarCarsten Haitzler <carsten.haitzler@foss.arm.com>
Signed-off-by: default avatarCarsten Haitzler <carsten.haitzler@foss.arm.com>
Co-developed-by: default avatarRob Herring <robh@kernel.org>
Signed-off-by: default avatarRob Herring <robh@kernel.org>
Link: https://www.collabora.com/news-and-blog/news-and-events/introducing-tyr-a-new-rust-drm-driver.html


Signed-off-by: default avatarDaniel Almeida <daniel.almeida@collabora.com>
Acked-by: default avatarBoris Brezillon <boris.brezillon@collabora.com>
[aliceryhl: minor Kconfig update on apply]
[aliceryhl: s/drm::device::/drm::/]
Link: https://lore.kernel.org/r/20250910-tyr-v3-1-dba3bc2ae623@collabora.com


Co-developed-by: default avatarAlice Ryhl <aliceryhl@google.com>
Signed-off-by: default avatarAlice Ryhl <aliceryhl@google.com>
parent d4dc08c5
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -2086,6 +2086,19 @@ F: Documentation/devicetree/bindings/gpu/arm,mali-valhall-csf.yaml
F:	drivers/gpu/drm/panthor/
F:	include/uapi/drm/panthor_drm.h
ARM MALI TYR DRM DRIVER
M:	Daniel Almeida <daniel.almeida@collabora.com>
M:	Alice Ryhl <aliceryhl@google.com>
L:	dri-devel@lists.freedesktop.org
S:	Supported
W:	https://rust-for-linux.com/tyr-gpu-driver
W	https://drm.pages.freedesktop.org/maintainer-tools/drm-rust.html
B:	https://gitlab.freedesktop.org/panfrost/linux/-/issues
T:	git https://gitlab.freedesktop.org/drm/rust/kernel.git
F:	Documentation/devicetree/bindings/gpu/arm,mali-valhall-csf.yaml
F:	drivers/gpu/drm/tyr/
F:	include/uapi/drm/panthor_drm.h
ARM MALI-DP DRM DRIVER
M:	Liviu Dudau <liviu.dudau@arm.com>
S:	Supported
+2 −0
Original line number Diff line number Diff line
@@ -396,6 +396,8 @@ source "drivers/gpu/drm/sprd/Kconfig"

source "drivers/gpu/drm/imagination/Kconfig"

source "drivers/gpu/drm/tyr/Kconfig"

config DRM_HYPERV
	tristate "DRM Support for Hyper-V synthetic video device"
	depends on DRM && PCI && HYPERV
+1 −0
Original line number Diff line number Diff line
@@ -220,6 +220,7 @@ obj-$(CONFIG_DRM_VBOXVIDEO) += vboxvideo/
obj-$(CONFIG_DRM_LIMA)  += lima/
obj-$(CONFIG_DRM_PANFROST) += panfrost/
obj-$(CONFIG_DRM_PANTHOR) += panthor/
obj-$(CONFIG_DRM_TYR) += tyr/
obj-$(CONFIG_DRM_ASPEED_GFX) += aspeed/
obj-$(CONFIG_DRM_MCDE) += mcde/
obj-$(CONFIG_DRM_TIDSS) += tidss/
+19 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0 or MIT

config DRM_TYR
	tristate "Tyr (Rust DRM support for ARM Mali CSF-based GPUs)"
	depends on DRM=y
	depends on RUST
	depends on ARM || ARM64 || COMPILE_TEST
	depends on !GENERIC_ATOMIC64  # for IOMMU_IO_PGTABLE_LPAE
	default n
	help
	  Rust DRM driver for ARM Mali CSF-based GPUs.

	  This driver is for Mali (or Immortalis) Valhall Gxxx GPUs.

	  Note that the Mali-G68 and Mali-G78, while Valhall architecture, will
	  be supported with the panfrost driver as they are not CSF GPUs.

	  if M is selected, the module will be called tyr. This driver is work
	  in progress and may not be functional.
+3 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0 or MIT

obj-$(CONFIG_DRM_TYR) += tyr.o
Loading