Nova DRM skeleton driver
Subsystems (6)
Danilo Krummrich
maintainercover Nova DRM skeleton driver
This patch series adds the nova-drm skeleton driver.
nova-drm is connected to nova-core through the auxiliary bus and implements the DRM parts of the nova driver stack.
For now, it implements the fundamental DRM abstractions, i.e. creates a DRM device and registers it, exposing a three sample IOCTLs.
DRM_IOCTL_NOVA_GETPARAM
- provides the PCI bar size from the bar that maps the GPUs VRAM from nova-core
DRM_IOCTL_NOVA_GEM_CREATE
- creates a new dummy DRM GEM object and returns a handle
DRM_IOCTL_NOVA_GEM_INFO
- provides metadata for the DRM GEM object behinda given handle
I implemented a small userspace test suite [1] that utilizes this interface.
This patch series depends on the auxiliary bus abstractions [2] and the DRM abstractions [3]; the patches from this series are also in [4].
[1] https://gitlab.freedesktop.org/dakr/drm-test
[2] https://web.git.kernel.org/pub/scm/linux/kernel/git/dakr/linux.git/log/?h=rust/auxiliary
[3] https://gitlab.freedesktop.org/drm/misc/kernel/-/tree/topic/rust-drm
[4] https://gitlab.freedesktop.org/drm/nova/-/tree/staging/nova-drm
Danilo Krummrich (2):
gpu: nova-core: register auxiliary device for nova-drm
drm: nova-drm: add initial driver skeleton
MAINTAINERS | 12 ++++ drivers/gpu/drm/Kconfig | 2 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/nova/Kconfig | 14 ++++ drivers/gpu/drm/nova/Makefile | 3 + drivers/gpu/drm/nova/driver.rs | 70 ++++++++++++++++++++ drivers/gpu/drm/nova/file.rs | 68 +++++++++++++++++++ drivers/gpu/drm/nova/gem.rs | 49 ++++++++++++++ drivers/gpu/drm/nova/nova.rs | 17 +++++ drivers/gpu/nova-core/Kconfig | 1 + drivers/gpu/nova-core/driver.rs | 9 ++- drivers/gpu/nova-core/nova_core.rs | 2 + include/uapi/drm/nova_drm.h | 101 +++++++++++++++++++++++++++++ rust/uapi/uapi_helper.h | 1 + 14 files changed, 349 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/nova/Kconfig create mode 100644 drivers/gpu/drm/nova/Makefile create mode 100644 drivers/gpu/drm/nova/driver.rs create mode 100644 drivers/gpu/drm/nova/file.rs create mode 100644 drivers/gpu/drm/nova/gem.rs create mode 100644 drivers/gpu/drm/nova/nova.rs create mode 100644 include/uapi/drm/nova_drm.h
Signature · 1 line
2.49.0
Danilo Krummrich
maintainerPATCH 1/2 gpu: nova-core: register auxiliary device for nova-drm
Register an auxiliary device for nova-drm.
For now always use zero for the auxiliary device' ID; we don't use it yet anyways. However, once it lands, we should switch to XArray.
--- drivers/gpu/nova-core/Kconfig | 1 + drivers/gpu/nova-core/driver.rs | 9 ++++++++- drivers/gpu/nova-core/nova_core.rs | 2 ++ 3 files changed, 11 insertions(+), 1 deletion(-)
drivers/gpu/nova-core/Kconfig +1 -0
@@ -1,5 +1,6 @@ config NOVA_CORE tristate "Nova Core GPU driver" + depends on AUXILIARY_BUS depends on PCI depends on RUST depends on RUST_FW_LOADER_ABSTRACTIONS
drivers/gpu/nova-core/driver.rs +8 -1
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0 -use kernel::{bindings, c_str, device::Core , pci, prelude::*}; +use kernel::{auxiliary, bindings, c_str, device::Core , pci, prelude::*};use crate ::gpu::Gpu ;
@@ -8,6 +8,7 @@pub (crate )struct NovaCore {#[pin] pub (crate ) gpu:Gpu , + _reg: auxiliary::Registration , }const BAR0_SIZE :usize =8 ;
@@ -38,6 +39,12 @@ fn probe(pdev: &pci::Device<Core>, _info: &Self::IdInfo) -> Result<Pin<KBox<Selflet this =KBox ::pin_init (try_pin_init! (Self { gpu <-Gpu ::new (pdev, bar)?, + _reg: auxiliary::Registration ::new ( + pdev.as_ref (), +c_str! ("nova-drm" ), +0 ,// TODO: Once it lands, use XArray, for now we don't use the ID. +crate ::MODULE_NAME + )?, }),GFP_KERNEL , )?;
drivers/gpu/nova-core/nova_core.rs +2 -0
@@ -8,6 +8,8 @@mod regs;mod util; +pub (crate )const MODULE_NAME : &kernel::str::CStr = <LocalModule as kernel::ModuleMetadata >::NAME ; + kernel::module_pci_driver! {type : driver::NovaCore , name:"NovaCore" ,
Signature · 1 line
2.49.0
Danilo Krummrich
maintainerPATCH 2/2 drm: nova-drm: add initial driver skeleton
In reply to Danilo KrummrichAdd the initial nova-drm driver skeleton.
nova-drm is connected to nova-core through the auxiliary bus and implements the DRM parts of the nova driver stack.
For now, it implements the fundamental DRM abstractions, i.e. creates a DRM device and registers it, exposing a three sample IOCTLs.
DRM_IOCTL_NOVA_GETPARAM
- provides the PCI bar size from the bar that maps the GPUs VRAM from nova-core
DRM_IOCTL_NOVA_GEM_CREATE
- creates a new dummy DRM GEM object and returns a handle
DRM_IOCTL_NOVA_GEM_INFO
- provides metadata for the DRM GEM object behind a given handle
I implemented a small userspace test suite [1] that utilizes this interface.
--- MAINTAINERS | 12 ++++ drivers/gpu/drm/Kconfig | 2 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/nova/Kconfig | 14 +++++ drivers/gpu/drm/nova/Makefile | 3 + drivers/gpu/drm/nova/driver.rs | 70 +++++++++++++++++++++++ drivers/gpu/drm/nova/file.rs | 68 ++++++++++++++++++++++ drivers/gpu/drm/nova/gem.rs | 49 ++++++++++++++++ drivers/gpu/drm/nova/nova.rs | 17 ++++++ include/uapi/drm/nova_drm.h | 101 +++++++++++++++++++++++++++++++++ rust/uapi/uapi_helper.h | 1 + 11 files changed, 338 insertions(+) create mode 100644 drivers/gpu/drm/nova/Kconfig create mode 100644 drivers/gpu/drm/nova/Makefile create mode 100644 drivers/gpu/drm/nova/driver.rs create mode 100644 drivers/gpu/drm/nova/file.rs create mode 100644 drivers/gpu/drm/nova/gem.rs create mode 100644 drivers/gpu/drm/nova/nova.rs create mode 100644 include/uapi/drm/nova_drm.h
MAINTAINERS +12 -0
@@ -7465,6 +7465,18 @@ T: git https://gitlab.freedesktop.org/drm/nova.git nova-next F: Documentation/gpu/nova/ F: drivers/gpu/nova-core/ +DRM DRIVER FOR NVIDIA GPUS [RUST] +M: Danilo Krummrich <[email protected]> +L: [email protected] +S: Supported +Q: https://patchwork.freedesktop.org/project/nouveau/ +B: https://gitlab.freedesktop.org/drm/nova/-/issues +C: irc://irc.oftc.net/nouveau +T: git https://gitlab.freedesktop.org/drm/nova.git nova-next +F: Documentation/gpu/nova/ +F: drivers/gpu/drm/nova/ +F: include/uapi/drm/nova_drm.h + DRM DRIVER FOR OLIMEX LCD-OLINUXINO PANELS M: Stefan Mavrodiev <[email protected]> S: Maintained
drivers/gpu/drm/Kconfig +2 -0
@@ -336,6 +336,8 @@ source "drivers/gpu/drm/amd/amdgpu/Kconfig" source "drivers/gpu/drm/nouveau/Kconfig" +source "drivers/gpu/drm/nova/Kconfig" + source "drivers/gpu/drm/i915/Kconfig" source "drivers/gpu/drm/xe/Kconfig"
drivers/gpu/drm/Makefile +1 -0
@@ -176,6 +176,7 @@ obj-$(CONFIG_DRM_VMWGFX)+= vmwgfx/ obj-$(CONFIG_DRM_VGEM) += vgem/ obj-$(CONFIG_DRM_VKMS) += vkms/ obj-$(CONFIG_DRM_NOUVEAU) +=nouveau/ +obj-$(CONFIG_DRM_NOVA) += nova/ obj-$(CONFIG_DRM_EXYNOS) +=exynos/ obj-$(CONFIG_DRM_ROCKCHIP) +=rockchip/ obj-$(CONFIG_DRM_GMA500) += gma500/
drivers/gpu/drm/nova/Kconfig new file +14 -0
@@ -0,0 +1,14 @@ +config DRM_NOVA + tristate "Nova DRM driver" + depends on AUXILIARY_BUS + depends on DRM + depends on PCI + depends on RUST + default n + help + Choose this if you want to build the Nova DRM driver for Nvidia + GSP-based GPUs. + + This driver is work in progress and may not be functional. + + If M is selected, the module will be called nova.
drivers/gpu/drm/nova/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0 + +obj-$(CONFIG_DRM_NOVA) += nova.o
drivers/gpu/drm/nova/driver.rs new file +70 -0
70 lines not on this page · raw message
drivers/gpu/drm/nova/file.rs new file +68 -0
68 lines not on this page · raw message
drivers/gpu/drm/nova/gem.rs new file +49 -0
49 lines not on this page · raw message
drivers/gpu/drm/nova/nova.rs new file +17 -0
@@ -0,0 +1,17 @@ +// SPDX-License-Identifier: GPL-2.0 + +//! Nova DRM Driver + +mod driver; +mod file; +mod gem; + +use crate ::driver::NovaDriver ; + +kernel::module_auxiliary_driver! { +type :NovaDriver , + name:"Nova" , + author:"Danilo Krummrich" , + description:"Nova GPU driver" , + license:"GPL v2" , +}
include/uapi/drm/nova_drm.h new file +101 -0
101 lines not on this page · raw message
rust/uapi/uapi_helper.h +1 -0
@@ -8,6 +8,7 @@#include <uapi/asm-generic/ioctl.h> #include <uapi/drm/drm.h> +#include <uapi/drm/nova_drm.h> #include <uapi/linux/mdio.h> #include <uapi/linux/mii.h> #include <uapi/linux/ethtool.h>
Signature · 1 line
2.49.0
Re: [PATCH 2/2] drm: nova-drm: add initial driver skeleton
Quoted 7 lines · Danilo Krummrich
Add the initial nova-drm driver skeleton.
nova-drm is connected to nova-core through the auxiliary bus and implements the DRM parts of the nova driver stack.
[ ... ]
Thanks!
Maxime