[PATCH 00/21] drm/nouveau: insert auxiliary device between nvkm and drm
Ben Skeggs
bskeggs at nvidia.com
Thu Jun 13 16:59:52 UTC 2024
This series was originally part of an RFC demonstrating NVKM and the DRM
driver split into separate kernel modules, but it became apparent whilst
working on this series that there's some benefit to making these changes
regardless of a module split, so I'm sending them out separately.
The bulk of the series moves the remaining bus-specific handling (PCI/
platform driver registation, power management, ACPI, etc) out of the DRM
driver and into NVKM.
As NVKM finishes probe() for a PCI or Tegra device, it will now register
a device on the auxiliary bus, which the DRM driver will probe() against
instead of devices from the PCI and platform buses directly.
The result of this is a cleaner integration of support for Tegra GPUs in
a codebase that originally assumed a PCI device everywhere. As the DRM
driver mostly just operates on objects allocated from NVKM, support for
Tegra wasn't *too* bad to integrate, but with NVKM handling some pieces,
and the DRM driver handling others, the driver init paths were somewhat
convoluted.
With the bus-level device handling now entirely living within NVKM, the
DRM driver's init paths for PCI and Tegra GPUs has been unified, which
cleans up the remaining messy bits there.
One unanticipated benefit that comes from utilising the auxiliary bus is
that, on Optimus systems, it's no longer necessary to fully reinitialise
the entire GPU (including time-consuming steps such as booting firmware,
or restoring page tables to VRAM) in order to respond to simple queries
of the underlying PCI device (ie. running lspci).
Now, NVKM will only wake the PCI device itself when asked by the kernel,
and because the remainder of GPU (re)initialisation is tied to clients'
object trees, *and* the DRM device is still asleep, no other steps need
to be taken, greatly reducing resume latency.
A link to a tree containing the patches is below.
[1] https://gitlab.freedesktop.org/bskeggs/nouveau/-/tree/00.02-auxdev
Ben Skeggs (21):
drm/nouveau: fix a couple of KBuild comments
drm/nouveau/nvkm: delay calling subdev ctor()'s until device oneinit()
drm/nouveau/nvkm: add nvkm_client_event()
drm/nouveau/nvif: add nvif_event_stat
drm/nouveau/nvif: add nvif_driver_func for nvkm->drm callbacks
drm/nouveau/nvkm: add init()/exit()
drm/nouveau/nvkm: cleanup in nvkm_device_{pci,tegra}_new() on failure
drm/nouveau/nvkm: move vgaarb code from drm
drm/nouveau/nvkm: move switcheroo init from drm
drm/nouveau/nvif: add runpm supported flag to device impl
drm/nouveau/nvkm: move switcheroo from drm
drm/nouveau/nvkm: prepare pci/tegra probe()/remove() functions
drm/nouveau/nvkm: move pci probe() defer from drm
drm/nouveau/nvkm: move pci probe() fb handoff from drm
drm/nouveau/nvkm: move pci probe() enable/disable handling from drm
drm/nouveau/nvkm: move pci probe() runpm quirk from drm
drm/nouveau/nvkm: move pci pm ops from drm
drm/nouveau/nvkm: add device to auxiliary bus for each nvkm_device
drm/nouveau: wrap pm_runtime_* calls with nouveau_runpm
drm/nouveau: probe() against nvkm-provided auxiliary devices
drm/nouveau/nvkm: s/nouveau/nvkm/ over code moved from drm
drivers/gpu/drm/nouveau/Kbuild | 11 +-
drivers/gpu/drm/nouveau/Kconfig | 1 +
drivers/gpu/drm/nouveau/dispnv04/crtc.c | 4 +-
drivers/gpu/drm/nouveau/dispnv04/disp.h | 2 +-
drivers/gpu/drm/nouveau/dispnv50/disp.c | 40 +-
drivers/gpu/drm/nouveau/dispnv50/head.c | 2 +-
.../gpu/drm/nouveau/include/nvif/driverif.h | 18 +
drivers/gpu/drm/nouveau/include/nvif/event.h | 7 +-
.../drm/nouveau/include/nvkm/core/client.h | 4 +-
.../drm/nouveau/include/nvkm/core/device.h | 12 +
.../drm/nouveau/include/nvkm/core/module.h | 10 +
.../gpu/drm/nouveau/include/nvkm/core/pci.h | 8 +-
.../gpu/drm/nouveau/include/nvkm/core/tegra.h | 5 +-
drivers/gpu/drm/nouveau/nouveau_acpi.c | 352 ---------------
drivers/gpu/drm/nouveau/nouveau_acpi.h | 10 -
drivers/gpu/drm/nouveau/nouveau_chan.c | 2 +-
drivers/gpu/drm/nouveau/nouveau_connector.c | 16 +-
drivers/gpu/drm/nouveau/nouveau_connector.h | 1 +
drivers/gpu/drm/nouveau/nouveau_debugfs.c | 24 +-
drivers/gpu/drm/nouveau/nouveau_display.c | 19 +-
drivers/gpu/drm/nouveau/nouveau_drm.c | 347 ++++-----------
drivers/gpu/drm/nouveau/nouveau_drv.h | 24 +-
drivers/gpu/drm/nouveau/nouveau_fence.c | 2 +-
drivers/gpu/drm/nouveau/nouveau_gem.c | 30 +-
drivers/gpu/drm/nouveau/nouveau_platform.c | 91 ----
drivers/gpu/drm/nouveau/nouveau_runpm.h | 89 ++++
drivers/gpu/drm/nouveau/nouveau_svm.c | 2 +-
drivers/gpu/drm/nouveau/nouveau_vga.c | 98 +----
drivers/gpu/drm/nouveau/nouveau_vga.h | 3 +-
drivers/gpu/drm/nouveau/nvif/event.c | 9 +
drivers/gpu/drm/nouveau/nvkm/Kbuild | 3 +
drivers/gpu/drm/nouveau/nvkm/core/Kbuild | 2 +-
drivers/gpu/drm/nouveau/nvkm/core/client.c | 17 +-
drivers/gpu/drm/nouveau/nvkm/core/driver.c | 14 +-
drivers/gpu/drm/nouveau/nvkm/core/uevent.c | 2 +-
drivers/gpu/drm/nouveau/nvkm/device/acpi.c | 416 +++++++++++++++++-
drivers/gpu/drm/nouveau/nvkm/device/acpi.h | 19 +
drivers/gpu/drm/nouveau/nvkm/device/base.c | 151 +++++--
drivers/gpu/drm/nouveau/nvkm/device/pci.c | 258 +++++++++--
drivers/gpu/drm/nouveau/nvkm/device/priv.h | 3 +-
drivers/gpu/drm/nouveau/nvkm/device/tegra.c | 87 +++-
drivers/gpu/drm/nouveau/nvkm/device/user.c | 2 +
.../gpu/drm/nouveau/nvkm/engine/disp/uconn.c | 6 +-
.../{nouveau_platform.h => nvkm/module.c} | 45 +-
.../gpu/drm/nouveau/nvkm/subdev/pci/base.c | 30 ++
45 files changed, 1246 insertions(+), 1052 deletions(-)
create mode 100644 drivers/gpu/drm/nouveau/include/nvkm/core/module.h
delete mode 100644 drivers/gpu/drm/nouveau/nouveau_platform.c
create mode 100644 drivers/gpu/drm/nouveau/nouveau_runpm.h
rename drivers/gpu/drm/nouveau/{nouveau_platform.h => nvkm/module.c} (60%)
--
2.44.0
More information about the Nouveau
mailing list