Commit f86ad0ed authored by Matthew Brost's avatar Matthew Brost Committed by Thomas Hellström
Browse files

drm/gpusvm, drm/pagemap: Move migration functionality to drm_pagemap



The migration functionality and track-keeping of per-pagemap VRAM
mapped to the CPU mm is not per GPU_vm, but rather per pagemap.
This is also reflected by the functions not needing the drm_gpusvm
structures. So move to drm_pagemap.

With this, drm_gpusvm shouldn't really access the page zone-device-data
since its meaning is internal to drm_pagemap. Currently it's used to
reject mapping ranges backed by multiple drm_pagemap allocations.
For now, make the zone-device-data a void pointer.

Alter the interface of drm_gpusvm_migrate_to_devmem() to ensure we don't
pass a gpusvm pointer.

Rename CONFIG_DRM_XE_DEVMEM_MIRROR to CONFIG_DRM_XE_PAGEMAP.

Matt is listed as author of this commit since he wrote most of the code,
and it makes sense to retain his git authorship.
Thomas mostly moved the code around.

v3:
- Kerneldoc fixes (CI)
- Don't update documentation about how the drm_pagemap
  migration should be interpreted until upcoming
  patches where the functionality is implemented.
  (Matt Brost)
v4:
- More kerneldoc fixes around timeslice_ms
  (Himal Ghimiray, Matt Brost)
v6:
- Fix an uninitialized pagemap pointer (CI)

Co-developed-by: default avatarThomas Hellström <thomas.hellstrom@linux.intel.com>
Signed-off-by: default avatarThomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: default avatarHimal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Signed-off-by: default avatarMatthew Brost <matthew.brost@intel.com>
Link: https://lore.kernel.org/r/20250619134035.170086-2-thomas.hellstrom@linux.intel.com
parent 5a2f117a
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -73,15 +73,21 @@ Overview of baseline design
.. kernel-doc:: drivers/gpu/drm/drm_gpusvm.c
   :doc: Locking

.. kernel-doc:: drivers/gpu/drm/drm_gpusvm.c
   :doc: Migration

.. kernel-doc:: drivers/gpu/drm/drm_gpusvm.c
   :doc: Partial Unmapping of Ranges

.. kernel-doc:: drivers/gpu/drm/drm_gpusvm.c
   :doc: Examples

Overview of drm_pagemap design
==============================

.. kernel-doc:: drivers/gpu/drm/drm_pagemap.c
   :doc: Overview

.. kernel-doc:: drivers/gpu/drm/drm_pagemap.c
   :doc: Migration

Possible future design features
===============================

+5 −1
Original line number Diff line number Diff line
@@ -104,7 +104,11 @@ obj-$(CONFIG_DRM_PANEL_BACKLIGHT_QUIRKS) += drm_panel_backlight_quirks.o
#
obj-$(CONFIG_DRM_EXEC) += drm_exec.o
obj-$(CONFIG_DRM_GPUVM) += drm_gpuvm.o
obj-$(CONFIG_DRM_GPUSVM) += drm_gpusvm.o

drm_gpusvm_helper-y := \
	drm_gpusvm.o\
	drm_pagemap.o
obj-$(CONFIG_DRM_GPUSVM) += drm_gpusvm_helper.o

obj-$(CONFIG_DRM_BUDDY) += drm_buddy.o

+14 −747

File changed.

Preview size limit exceeded, changes collapsed.

+794 −0

File added.

Preview size limit exceeded, changes collapsed.

+6 −4
Original line number Diff line number Diff line
@@ -87,14 +87,16 @@ config DRM_XE_GPUSVM

	  If in doubut say "Y".

config DRM_XE_DEVMEM_MIRROR
	bool "Enable device memory mirror"
config DRM_XE_PAGEMAP
	bool "Enable device memory pool for SVM"
	depends on DRM_XE_GPUSVM
	select GET_FREE_REGION
	default y
	help
	  Disable this option only if you want to compile out without device
	  memory mirror. Will reduce KMD memory footprint when disabled.
	  Disable this option only if you don't want to expose local device
	  memory for SVM. Will reduce KMD memory footprint when disabled.

	  If in doubut say "Y".

config DRM_XE_FORCE_PROBE
	string "Force probe xe for selected Intel hardware IDs"
Loading