Skip to content

Commit 77613a2

Browse files
committed
drm/xe/uapi: Add DRM_XE_QUERY_CONFIG_FLAG_HAS_CPU_ADDR_MIRROR
Add the DRM_XE_QUERY_CONFIG_FLAG_HAS_CPU_ADDR_MIRROR device query flag, which indicates whether the device supports CPU address mirroring. The intent is for UMDs to use this query to determine if a VM can be set up with CPU address mirroring. This flag is implemented by checking if the device supports GPU faults. v7: - Only report enabled if CONFIG_DRM_GPUSVM is selected (CI) Signed-off-by: Matthew Brost <[email protected]> Reviewed-by: Himal Prasad Ghimiray <[email protected]> Reviewed-by: Thomas Hellström <[email protected]> Reviewed-by: Tejas Upadhyay <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent c73b2cb commit 77613a2

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

drivers/gpu/drm/xe/xe_query.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,11 @@ static int query_config(struct xe_device *xe, struct drm_xe_device_query *query)
338338
config->info[DRM_XE_QUERY_CONFIG_REV_AND_DEVICE_ID] =
339339
xe->info.devid | (xe->info.revid << 16);
340340
if (xe_device_get_root_tile(xe)->mem.vram.usable_size)
341-
config->info[DRM_XE_QUERY_CONFIG_FLAGS] =
341+
config->info[DRM_XE_QUERY_CONFIG_FLAGS] |=
342342
DRM_XE_QUERY_CONFIG_FLAG_HAS_VRAM;
343+
if (xe->info.has_usm && IS_ENABLED(CONFIG_DRM_GPUSVM))
344+
config->info[DRM_XE_QUERY_CONFIG_FLAGS] |=
345+
DRM_XE_QUERY_CONFIG_FLAG_HAS_CPU_ADDR_MIRROR;
343346
config->info[DRM_XE_QUERY_CONFIG_FLAGS] |=
344347
DRM_XE_QUERY_CONFIG_FLAG_HAS_LOW_LATENCY;
345348
config->info[DRM_XE_QUERY_CONFIG_MIN_ALIGNMENT] =

include/uapi/drm/xe_drm.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,8 @@ struct drm_xe_query_mem_regions {
395395
* has usable VRAM
396396
* - %DRM_XE_QUERY_CONFIG_FLAG_HAS_LOW_LATENCY - Flag is set if the device
397397
* has low latency hint support
398+
* - %DRM_XE_QUERY_CONFIG_FLAG_HAS_CPU_ADDR_MIRROR - Flag is set if the
399+
* device has CPU address mirroring support
398400
* - %DRM_XE_QUERY_CONFIG_MIN_ALIGNMENT - Minimal memory alignment
399401
* required by this device, typically SZ_4K or SZ_64K
400402
* - %DRM_XE_QUERY_CONFIG_VA_BITS - Maximum bits of a virtual address
@@ -412,6 +414,7 @@ struct drm_xe_query_config {
412414
#define DRM_XE_QUERY_CONFIG_FLAGS 1
413415
#define DRM_XE_QUERY_CONFIG_FLAG_HAS_VRAM (1 << 0)
414416
#define DRM_XE_QUERY_CONFIG_FLAG_HAS_LOW_LATENCY (1 << 1)
417+
#define DRM_XE_QUERY_CONFIG_FLAG_HAS_CPU_ADDR_MIRROR (1 << 2)
415418
#define DRM_XE_QUERY_CONFIG_MIN_ALIGNMENT 2
416419
#define DRM_XE_QUERY_CONFIG_VA_BITS 3
417420
#define DRM_XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY 4

0 commit comments

Comments
 (0)