[CI 39/43] drm/xe/svm: Introduce DRM_XE_SVM kernel config
Oak Zeng
oak.zeng at intel.com
Wed Jun 12 02:26:01 UTC 2024
Introduce a DRM_XE_SVM kernel config entry for
xe svm feature. xe svm feature allows share
virtual address space between CPU and GPU program.
v1: Improve commit message (Thomas)
Avoid using #if directive (Thomas)
Cc: Matthew Brost <matthew.brost at intel.com>
Cc: Thomas Hellström <thomas.hellstrom at intel.com>
Cc: Brian Welty <brian.welty at intel.com>
Cc: Himal Prasad Ghimiray <himal.prasad.ghimiray at intel.com>
Signed-off-by: Oak Zeng <oak.zeng at intel.com>
Co-developed-by: Niranjana Vishwanathapura <niranjana.vishwanathapura at intel.com>
Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura at intel.com>
---
drivers/gpu/drm/xe/Kconfig | 21 +++++++++++++++++++++
drivers/gpu/drm/xe/xe_tile.c | 11 ++++++++---
2 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/xe/Kconfig b/drivers/gpu/drm/xe/Kconfig
index 7bbe46a98ff1..27d6145cefa7 100644
--- a/drivers/gpu/drm/xe/Kconfig
+++ b/drivers/gpu/drm/xe/Kconfig
@@ -84,6 +84,27 @@ config DRM_XE_FORCE_PROBE
4571.
Use "!*" to block the probe of the driver for all known devices.
+config DRM_XE_SVM
+ bool "Enable Shared Virtual Memory support in xe"
+ depends on DRM_XE
+ depends on ARCH_ENABLE_MEMORY_HOTPLUG
+ depends on ARCH_ENABLE_MEMORY_HOTREMOVE
+ depends on MEMORY_HOTPLUG
+ depends on MEMORY_HOTREMOVE
+ depends on ARCH_HAS_PTE_DEVMAP
+ depends on SPARSEMEM_VMEMMAP
+ depends on ZONE_DEVICE
+ depends on DEVICE_PRIVATE
+ depends on MMU
+ select HMM_MIRROR
+ select MMU_NOTIFIER
+ default y
+ help
+ Choose this option if you want Shared Virtual Memory (SVM)
+ support in xe. With SVM, virtual address space is shared
+ between CPU and GPU. This means any virtual address such
+ as malloc or mmap returns, variables on stack, or global
+ memory pointers, can be used for GPU transparently.
menu "drm/Xe Debugging"
depends on DRM_XE
diff --git a/drivers/gpu/drm/xe/xe_tile.c b/drivers/gpu/drm/xe/xe_tile.c
index 5daf02f5d0be..bddd9d4f4d59 100644
--- a/drivers/gpu/drm/xe/xe_tile.c
+++ b/drivers/gpu/drm/xe/xe_tile.c
@@ -170,8 +170,13 @@ static void __init_drm_mem_region_ops(struct drm_mem_region_ops *ops)
int xe_tile_init_noalloc(struct xe_tile *tile)
{
int err;
- struct xe_device *xe = tile_to_xe(tile);
- struct drm_device *drm = &xe->drm;
+ struct xe_device __maybe_unused *xe;
+ struct drm_device __maybe_unused *drm;
+
+ if (IS_ENABLED(CONFIG_DRM_XE_SVM)) {
+ xe = tile_to_xe(tile);
+ drm = &xe->drm;
+ }
err = tile_ttm_mgr_init(tile);
if (err)
@@ -185,7 +190,7 @@ int xe_tile_init_noalloc(struct xe_tile *tile)
err = xe_tile_sysfs_init(tile);
- if (xe->info.has_usm) {
+ if (IS_ENABLED(CONFIG_DRM_XE_SVM) && xe->info.has_usm) {
__init_drm_mem_region_ops(&tile->mem.vram.drm_mr.mr_ops);
drm_svm_register_mem_region(drm, &tile->mem.vram.drm_mr);
}
--
2.26.3
More information about the Intel-xe
mailing list