Skip to contentSkip to conversation

uAPI Alignment - take 2

PATCH In review Francois Dugast 3 participants 60 messages Nov 9, 2023 – Nov 10, 2023 Library code Page 1 of 2

lore
Share & tools
lore
#0 lore raw

v3 cover uAPI Alignment - take 2

This is the second take of uAPI updates that would lead to breakage in the compatibility, which it is not acceptable after we are merged upstream. So, let's break it before it is too late, and start upstreaming a good, reliable and clean uapi.

v2: Rebase, drop "RFC", more uAPI fixes and cleanup, align to kernel

    series: https://patchwork.freedesktop.org/series/125955/

v3: Align to kernel series https://patchwork.freedesktop.org/series/126203/

Francois Dugast (24):
drm-uapi/xe: Add check for access counter granularity drm-uapi/xe: Add documentation for query
drm-uapi/xe: Extend drm_xe_vm_bind_op
drm-uapi/xe: Add uAPI to query micro-controler firmware version drm-uapi/xe: Document DRM_XE_DEVICE_QUERY_HWCONFIG drm-uapi/xe: Extend uAPI to query HuC micro-controler firmware version drm-uapi/xe: Remove useless XE_QUERY_CONFIG_NUM_PARAM drm-uapi/xe: Add missing DRM_ prefix in uAPI constants drm-uapi/xe: Add _FLAG to uAPI constants usable for flags drm-uapi/xe: Make constant comments visible in kernel doc drm-uapi/xe: Change rsvd to pad in struct drm_xe_class_instance drm-uapi/xe: Remove unused inaccessible memory region drm-uapi/xe: Remove unused QUERY_CONFIG_MEM_REGION_COUNT drm-uapi/xe: Remove unused QUERY_CONFIG_GT_COUNT drm-uapi/xe: Replace BO with GEM in documentation drm-uapi/xe: Drop interrupt pmu event
drm-uapi/xe: Reject bo creation of unaligned size drm-uapi/xe: Align with xe_exec ioctl reorder
drm-uapi/xe: Document the memory_region bitmask drm-uapi/xe: Align on a common way to return arrays (memory regions) drm-uapi/xe: Align on a common way to return arrays (gt) drm-uapi/xe: Align on a common way to return arrays (engines) drm-uapi/xe: Add block diagram of a device
drm-uapi/xe: Add examples of user space code

Rodrigo Vivi (33):
drm-uapi/xe: Remove GT_TYPE_REMOTE.
drm-uapi/xe: Kill VM_MADVISE IOCTL and the atomic tests drm/xe_query: Remove backward compatibility of vram_visible_size.
xe_ioctl: Converge bo_create to the most used version
xe_ioctl: Rename *xe_bo_create_flags to simply xe_bo_create
xe_query: Add missing include.
xe_query: Kill visible_vram_if_possible
drm-uapi/xe: Separate bo_create placement from flags drm-uapi/xe: Rename *_mem_regions mask.
drm-uapi/xe: Rename query's mem_usage to mem_regions
xe: s/hw_engine/engine
drm-uapi/xe: Align with drm_xe_query_engine_info
lib: Fix 'otherwise' typos
xe: Rename 'hwe' to 'eci'
drm-uapi/xe: Split xe_sync types from flags
drm-uapi/xe: s/FLAGS_HAS_VRAM/FLAG_HAS_VRAM
drm-uapi/xe: Differentiate WAIT_OP from WAIT_MASK
xe: Build all_memory_regions_mask out of memory_regions query info
xe: Be more specific on the VRAM selection
xe: Do not stash vram_size
xe: Also be specific on VRAM selection when inspecting its sizes lib/xe: Get current available size and sync with the 'any gt'. tests/intel/xe_query: Fix test_query_engines
drm-uapi/xe: Move memory_region masks from GT to engine
xe: Get near_mem_region directly from engine_info. drm-uapi/xe: Be more specific about vm_bind prefetch region drm-uapi/xe: Convert tile_mask to a pt_placement_hint drm-uapi/xe: Exec queue documentation and variable renaming drm-uapi/xe: Refactor engine information
drm-uapi/xe: Crystal Reference Clock updates
drm-uapi/xe: Add Tile ID information to the GT info query lib/xe/xe_query: Fix improper handling of GT vs Tile drm-uapi/xe: Remove bogus engine list from the wait_user_fence IOCTL

 benchmarks/gem_wsim.c                    |  154 +--
 include/drm-uapi/xe_drm.h                | 1348 ++++++++++++++--------
 lib/drmtest.c                            |    2 +-
 lib/igt_draw.c                           |    9 +-
 lib/igt_dummyload.h                      |    2 +-
 lib/igt_fb.c                             |   13 +-
 lib/intel_allocator.c                    |    2 +-
 lib/intel_batchbuffer.c                  |   35 +-
 lib/intel_blt.c                          |    6 +-
 lib/intel_bufops.c                       |    2 +-
 lib/intel_compute.c                      |    8 +-
 lib/intel_ctx.c                          |    5 +-
 lib/xe/xe_ioctl.c                        |  122 +-
 lib/xe/xe_ioctl.h                        |   14 +-
 lib/xe/xe_query.c                        |  365 +++---
 lib/xe/xe_query.h                        |   68 +-
 lib/xe/xe_spin.c                         |   37 +-
 lib/xe/xe_spin.h                         |    2 +-
 lib/xe/xe_util.c                         |   24 +-
 lib/xe/xe_util.h                         |    4 +-
 tests/intel-ci/xe-fast-feedback.testlist |    2 +-
 tests/intel/api_intel_allocator.c        |    4 +-
 tests/intel/kms_big_fb.c                 |   24 +-
 tests/intel/kms_ccs.c                    |    5 +-
 tests/intel/kms_psr.c                    |    2 +-
 tests/intel/xe_access_counter.c          |    8 +-
 tests/intel/xe_ccs.c                     |   20 +-
 tests/intel/xe_copy_basic.c              |   14 +-
 tests/intel/xe_create.c                  |   25 +-
 tests/intel/xe_debugfs.c                 |   14 +-
 tests/intel/xe_dma_buf_sync.c            |   36 +-
 tests/intel/xe_drm_fdinfo.c              |   41 +-
 tests/intel/xe_evict.c                   |  113 +-
 tests/intel/xe_evict_ccs.c               |   19 +-
 tests/intel/xe_exec_balancer.c           |  189 +--
 tests/intel/xe_exec_basic.c              |   62 +-
 tests/intel/xe_exec_compute_mode.c       |   48 +-
 tests/intel/xe_exec_fault_mode.c         |  235 +---
 tests/intel/xe_exec_reset.c              |  227 ++--
 tests/intel/xe_exec_store.c              |  106 +-
 tests/intel/xe_exec_threads.c            |  189 +--
 tests/intel/xe_exercise_blt.c            |   10 +-
 tests/intel/xe_guc_pc.c                  |   33 +-
 tests/intel/xe_huc_copy.c                |   17 +-
 tests/intel/xe_intel_bb.c                |    7 +-
 tests/intel/xe_mmap.c                    |   71 +-
 tests/intel/xe_noexec_ping_pong.c        |   15 +-
 tests/intel/xe_perf_pmu.c                |   85 +-
 tests/intel/xe_pm.c                      |   79 +-
 tests/intel/xe_pm_residency.c            |   31 +-
 tests/intel/xe_prime_self_import.c       |   63 +-
 tests/intel/xe_query.c                   |  222 ++--
 tests/intel/xe_spin_batch.c              |   63 +-
 tests/intel/xe_sysfs_tile.c              |    2 +-
 tests/intel/xe_vm.c                      |  367 +++---
 tests/intel/xe_waitfence.c               |   26 +-
 tests/kms_addfb_basic.c                  |    2 +-
 tests/kms_getfb.c                        |    2 +-
 tests/kms_plane.c                        |    2 +-
 59 files changed, 2598 insertions(+), 2104 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH v3 1/57 drm-uapi/xe: Add check for access counter granularity

Align with commit ("drm/xe/xe_exec_queue: Add check for access counter granularity")

---
 include/drm-uapi/xe_drm.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
include/drm-uapi/xe_drm.h +14 -0
index 6ff1106e4..66658d76c 100644
@@ -731,6 +731,20 @@ struct drm_xe_vm_bind {
 	__u64 reserved[2];
 };
 
+/* For use with XE_EXEC_QUEUE_SET_PROPERTY_ACC_GRANULARITY */
+
+/* Monitor 128KB contiguous region with 4K sub-granularity */
+#define XE_ACC_GRANULARITY_128K 0
+
+/* Monitor 2MB contiguous region with 64KB sub-granularity */
+#define XE_ACC_GRANULARITY_2M 1
+
+/* Monitor 16MB contiguous region with 512KB sub-granularity */
+#define XE_ACC_GRANULARITY_16M 2
+
+/* Monitor 64MB contiguous region with 2M sub-granularity */
+#define XE_ACC_GRANULARITY_64M 3
+
 /**
  * struct drm_xe_exec_queue_set_property - exec queue set property
  *
Signature · 1 line
2.34.1
#2 lore raw

PATCH v3 2/57 drm-uapi/xe: Add documentation for query

In reply to Francois Dugast

Align with commit ("drm/xe/uapi: Add documentation for query")

---
 include/drm-uapi/xe_drm.h | 41 ++++++++++++++++++++++++++++++++++++---
 1 file changed, 38 insertions(+), 3 deletions(-)
include/drm-uapi/xe_drm.h +38 -3
index 66658d76c..2b710ed3b 100644
@@ -321,14 +321,43 @@ struct drm_xe_query_config {
 	/** @pad: MBZ */
 	__u32 pad;
 
+	/*
+	 * Device ID (lower 16 bits) and the device revision (next
+	 * 8 bits)
+	 */
 #define XE_QUERY_CONFIG_REV_AND_DEVICE_ID	0
+	/*
+	 * Flags describing the device configuration, see list below
+	 */
 #define XE_QUERY_CONFIG_FLAGS			1
+	/*
+	 * Flag is set if the device has usable VRAM
+	 */
 	#define XE_QUERY_CONFIG_FLAGS_HAS_VRAM		(0x1 << 0)
+	/*
+	 * Minimal memory alignment required by this device,
+	 * typically SZ_4K or SZ_64K
+	 */
 #define XE_QUERY_CONFIG_MIN_ALIGNMENT		2
+	/*
+	 * Maximum bits of a virtual address
+	 */
 #define XE_QUERY_CONFIG_VA_BITS			3
+	/*
+	 * Total number of GTs for the entire device
+	 */
 #define XE_QUERY_CONFIG_GT_COUNT		4
+	/*
+	 * Total number of accessible memory regions
+	 */
 #define XE_QUERY_CONFIG_MEM_REGION_COUNT	5
+	/*
+	 * Value of the highest available exec queue priority
+	 */
 #define XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY	6
+	/*
+	 * Number of elements in the info array
+	 */
 #define XE_QUERY_CONFIG_NUM_PARAM		(XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY + 1)
 	/** @info: array of elements containing the config info */
 	__u64 info[];
@@ -440,9 +469,15 @@ struct drm_xe_query_topology_mask {
 /**
  * struct drm_xe_device_query - main structure to query device information
  *
- * If size is set to 0, the driver fills it with the required size for the
- * requested type of data to query. If size is equal to the required size,
- * the queried information is copied into data.
+ * The user selects the type of data to query among DRM_XE_DEVICE_QUERY_*
+ * and sets the value in the query member. This determines the type of
+ * the structure provided by the driver in data, among struct drm_xe_query_*.
+ *
+ * If size is set to 0, the driver fills it with the required size for
+ * the requested type of data to query. If size is equal to the required
+ * size, the queried information is copied into data. If size is set to
+ * a value different from 0 and different from the required size, the
+ * IOCTL call returns -EINVAL.
  *
  * For example the following code snippet allows retrieving and printing
  * information about the device engines with DRM_XE_DEVICE_QUERY_ENGINES:
Signature · 1 line
2.34.1
#3 lore raw

PATCH v3 3/57 drm-uapi/xe: Extend drm_xe_vm_bind_op

In reply to Francois Dugast

Align with commit ("drm/xe/uapi: Extend drm_xe_vm_bind_op")

---
 include/drm-uapi/xe_drm.h | 3 +++
 1 file changed, 3 insertions(+)
include/drm-uapi/xe_drm.h +3 -0
index 2b710ed3b..52aef5ea9 100644
@@ -656,6 +656,9 @@ struct drm_xe_vm_destroy {
 };
 
 struct drm_xe_vm_bind_op {
+	/** @extensions: Pointer to the first extension struct, if any */
+	__u64 extensions;
+
 	/**
 	 * @obj: GEM object to operate on, MBZ for MAP_USERPTR, MBZ for UNMAP
 	 */
Signature · 1 line
2.34.1
#4 lore raw

PATCH v3 4/57 drm-uapi/xe: Add uAPI to query micro-controler firmware version

In reply to Francois Dugast

Align with commit ("drm/xe/uapi: Add uAPI to query micro-controler firmware version ")

---
 include/drm-uapi/xe_drm.h | 43 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
include/drm-uapi/xe_drm.h +43 -0
index 52aef5ea9..d3ce6aa1d 100644
@@ -466,6 +466,48 @@ struct drm_xe_query_topology_mask {
 	__u8 mask[];
 };
 
+/**
+ * struct drm_xe_query_uc_fw_version - query a micro-controller firmware version
+ *
+ * Given a uc_type this will return the major, minor, patch and branch version
+ * of the micro-controller firmware.
+ *
+ * The @uc_type can be:
+ *  - %DRM_XE_QUERY_UC_TYPE_GUC_SUBMISSION - This is the GuC Submission Version,
+ * a.k.a 'VF version'. It is not the actual GuC blob version. A running GuC can
+ * support multiple VF APIs with different Submission Versions. This version is
+ * negotiated by the VF KMD with GuC during VF initialization. In most of the
+ * current available GuC blobs, this is a 1-1 relationship where the Submission
+ * version could be inferred from the running version and vice-versa. However,
+ * the submission version is the most useful information for the user space
+ * perspective and needs.
+ *  - %DRM_XE_QUERY_TYPE_HUC - The actual HuC blob that is currently running
+ * in the platform. It returns 0 when HuC is not currently loaded.
+ */
+struct drm_xe_query_uc_fw_version {
+	/** @uc_type: The micro-controller type to query firmware version */
+#define DRM_XE_QUERY_UC_TYPE_GUC_SUBMISSION	0
+	__u16 uc_type;
+
+	/** @reserved: Reserved */
+	__u16 reserved;
+
+	/** @major_ver: major uc fw version */
+	__u32 major_ver;
+	/** @minor_ver: minor uc fw version */
+	__u32 minor_ver;
+	/** @patch_ver: patch uc fw version */
+	__u32 patch_ver;
+	/** @branch_ver: branch uc fw version */
+	__u32 branch_ver;
+
+	/** @pad2: MBZ */
+	__u32 pad2;
+
+	/** @reserved2: Reserved */
+	__u64 reserved2;
+};
+
 /**
  * struct drm_xe_device_query - main structure to query device information
  *
@@ -518,6 +560,7 @@ struct drm_xe_device_query {
 #define DRM_XE_DEVICE_QUERY_HWCONFIG		4
 #define DRM_XE_DEVICE_QUERY_GT_TOPOLOGY		5
 #define DRM_XE_DEVICE_QUERY_ENGINE_CYCLES	6
+#define DRM_XE_DEVICE_QUERY_UC_FW_VERSION	7
 	/** @query: The type of data to query */
 	__u32 query;
 
Signature · 1 line
2.34.1
#5 lore raw

PATCH v3 5/57 drm-uapi/xe: Document DRM_XE_DEVICE_QUERY_HWCONFIG

In reply to Francois Dugast

Align with commit ("Document DRM_XE_DEVICE_QUERY_HWCONFIG")

---
 include/drm-uapi/xe_drm.h | 5 +++++
 1 file changed, 5 insertions(+)
include/drm-uapi/xe_drm.h +5 -0
index d3ce6aa1d..e6878b688 100644
@@ -557,6 +557,11 @@ struct drm_xe_device_query {
 #define DRM_XE_DEVICE_QUERY_MEM_USAGE		1
 #define DRM_XE_DEVICE_QUERY_CONFIG		2
 #define DRM_XE_DEVICE_QUERY_GT_LIST		3
+	/*
+	 * Query type to retrieve the hardware configuration of the device
+	 * such as information on slices, memory, caches, and so on. It is
+	 * provided as a table of attributes (key / value).
+	 */
 #define DRM_XE_DEVICE_QUERY_HWCONFIG		4
 #define DRM_XE_DEVICE_QUERY_GT_TOPOLOGY		5
 #define DRM_XE_DEVICE_QUERY_ENGINE_CYCLES	6
Signature · 1 line
2.34.1
#6 lore raw

PATCH v3 6/57 drm-uapi/xe: Extend uAPI to query HuC micro-controler firmware version

In reply to Francois Dugast

Align with commit ("drm/xe/uapi: Extend uAPI to query HuC micro-controler firmware version")

---
 include/drm-uapi/xe_drm.h | 1 +
 1 file changed, 1 insertion(+)
include/drm-uapi/xe_drm.h +1 -0
index e6878b688..8b98db8b1 100644
@@ -487,6 +487,7 @@ struct drm_xe_query_topology_mask {
 struct drm_xe_query_uc_fw_version {
 	/** @uc_type: The micro-controller type to query firmware version */
 #define DRM_XE_QUERY_UC_TYPE_GUC_SUBMISSION	0
+#define DRM_XE_QUERY_UC_TYPE_HUC		1
 	__u16 uc_type;
 
 	/** @reserved: Reserved */
Signature · 1 line
2.34.1
#7 lore raw

PATCH v3 7/57 drm-uapi/xe: Remove useless XE_QUERY_CONFIG_NUM_PARAM

In reply to Francois Dugast

Align with commit ("drm/xe/uapi: Remove useless XE_QUERY_CONFIG_NUM_PARAM")

---
 include/drm-uapi/xe_drm.h | 4 ----
 1 file changed, 4 deletions(-)
include/drm-uapi/xe_drm.h +0 -4
index 8b98db8b1..dc22884bd 100644
@@ -355,10 +355,6 @@ struct drm_xe_query_config {
 	 * Value of the highest available exec queue priority
 	 */
 #define XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY	6
-	/*
-	 * Number of elements in the info array
-	 */
-#define XE_QUERY_CONFIG_NUM_PARAM		(XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY + 1)
 	/** @info: array of elements containing the config info */
 	__u64 info[];
 };
Signature · 1 line
2.34.1
#8 lore raw

PATCH v3 8/57 drm-uapi/xe: Add missing DRM_ prefix in uAPI constants

In reply to Francois Dugast

Align with commit ("drm/xe/uapi: Add missing DRM_ prefix in uAPI constants")

---
 include/drm-uapi/xe_drm.h        | 136 +++++++++++++++----------------
 lib/intel_batchbuffer.c          |   8 +-
 lib/intel_blt.c                  |   2 +-
 lib/xe/xe_ioctl.c                |  22 ++---
 lib/xe/xe_query.c                |  14 ++--
 lib/xe/xe_query.h                |   4 +-
 lib/xe/xe_util.c                 |  10 +--
 lib/xe/xe_util.h                 |   4 +-
 tests/intel/xe_access_counter.c  |   4 +-
 tests/intel/xe_ccs.c             |   4 +-
 tests/intel/xe_copy_basic.c      |   4 +-
 tests/intel/xe_debugfs.c         |  14 ++--
 tests/intel/xe_exec_basic.c      |   8 +-
 tests/intel/xe_exec_fault_mode.c |   4 +-
 tests/intel/xe_exec_reset.c      |  20 ++---
 tests/intel/xe_exec_threads.c    |   4 +-
 tests/intel/xe_exercise_blt.c    |   4 +-
 tests/intel/xe_perf_pmu.c        |   8 +-
 tests/intel/xe_pm.c              |   2 +-
 tests/intel/xe_query.c           |  48 +++++------
 tests/intel/xe_vm.c              |  10 +--
 21 files changed, 167 insertions(+), 167 deletions(-)
include/drm-uapi/xe_drm.h +68 -68
index dc22884bd..8d0abf31c 100644
@@ -19,12 +19,12 @@ extern "C" {
 /**
  * DOC: uevent generated by xe on it's pci node.
  *
- * XE_RESET_FAILED_UEVENT - Event is generated when attempt to reset gt
+ * DRM_XE_RESET_FAILED_UEVENT - Event is generated when attempt to reset gt
  * fails. The value supplied with the event is always "NEEDS_RESET".
  * Additional information supplied is tile id and gt id of the gt unit for
  * which reset has failed.
  */
-#define XE_RESET_FAILED_UEVENT "DEVICE_STATUS"
+#define DRM_XE_RESET_FAILED_UEVENT "DEVICE_STATUS"
 
 /**
  * struct xe_user_extension - Base class for defining a chain of extensions
@@ -103,8 +103,8 @@ struct xe_user_extension {
 #define DRM_XE_VM_CREATE		0x03
 #define DRM_XE_VM_DESTROY		0x04
 #define DRM_XE_VM_BIND			0x05
-#define DRM_XE_EXEC_QUEUE_CREATE		0x06
-#define DRM_XE_EXEC_QUEUE_DESTROY		0x07
+#define DRM_XE_EXEC_QUEUE_CREATE	0x06
+#define DRM_XE_EXEC_QUEUE_DESTROY	0x07
 #define DRM_XE_EXEC			0x08
 #define DRM_XE_EXEC_QUEUE_SET_PROPERTY	0x09
 #define DRM_XE_WAIT_USER_FENCE		0x0a
@@ -150,14 +150,14 @@ struct drm_xe_engine_class_instance {
  * enum drm_xe_memory_class - Supported memory classes.
  */
 enum drm_xe_memory_class {
-	/** @XE_MEM_REGION_CLASS_SYSMEM: Represents system memory. */
-	XE_MEM_REGION_CLASS_SYSMEM = 0,
+	/** @DRM_XE_MEM_REGION_CLASS_SYSMEM: Represents system memory. */
+	DRM_XE_MEM_REGION_CLASS_SYSMEM = 0,
 	/**
-	 * @XE_MEM_REGION_CLASS_VRAM: On discrete platforms, this
+	 * @DRM_XE_MEM_REGION_CLASS_VRAM: On discrete platforms, this
 	 * represents the memory that is local to the device, which we
 	 * call VRAM. Not valid on integrated platforms.
 	 */
-	XE_MEM_REGION_CLASS_VRAM
+	DRM_XE_MEM_REGION_CLASS_VRAM
 };
 
 /**
@@ -217,7 +217,7 @@ struct drm_xe_query_mem_region {
 	 * always equal the @total_size, since all of it will be CPU
 	 * accessible.
 	 *
-	 * Note this is only tracked for XE_MEM_REGION_CLASS_VRAM
+	 * Note this is only tracked for DRM_XE_MEM_REGION_CLASS_VRAM
 	 * regions (for other types the value here will always equal
 	 * zero).
 	 */
@@ -229,7 +229,7 @@ struct drm_xe_query_mem_region {
 	 * Requires CAP_PERFMON or CAP_SYS_ADMIN to get reliable
 	 * accounting. Without this the value here will always equal
 	 * zero.  Note this is only currently tracked for
-	 * XE_MEM_REGION_CLASS_VRAM regions (for other types the value
+	 * DRM_XE_MEM_REGION_CLASS_VRAM regions (for other types the value
 	 * here will always be zero).
 	 */
 	__u64 cpu_visible_used;
@@ -325,36 +325,36 @@ struct drm_xe_query_config {
 	 * Device ID (lower 16 bits) and the device revision (next
 	 * 8 bits)
 	 */
-#define XE_QUERY_CONFIG_REV_AND_DEVICE_ID	0
+#define DRM_XE_QUERY_CONFIG_REV_AND_DEVICE_ID		0
 	/*
 	 * Flags describing the device configuration, see list below
 	 */
-#define XE_QUERY_CONFIG_FLAGS			1
+#define DRM_XE_QUERY_CONFIG_FLAGS			1
 	/*
 	 * Flag is set if the device has usable VRAM
 	 */
-	#define XE_QUERY_CONFIG_FLAGS_HAS_VRAM		(0x1 << 0)
+	#define DRM_XE_QUERY_CONFIG_FLAGS_HAS_VRAM	(0x1 << 0)
 	/*
 	 * Minimal memory alignment required by this device,
 	 * typically SZ_4K or SZ_64K
 	 */
-#define XE_QUERY_CONFIG_MIN_ALIGNMENT		2
+#define DRM_XE_QUERY_CONFIG_MIN_ALIGNMENT		2
 	/*
 	 * Maximum bits of a virtual address
 	 */
-#define XE_QUERY_CONFIG_VA_BITS			3
+#define DRM_XE_QUERY_CONFIG_VA_BITS			3
 	/*
 	 * Total number of GTs for the entire device
 	 */
-#define XE_QUERY_CONFIG_GT_COUNT		4
+#define DRM_XE_QUERY_CONFIG_GT_COUNT			4
 	/*
 	 * Total number of accessible memory regions
 	 */
-#define XE_QUERY_CONFIG_MEM_REGION_COUNT	5
+#define DRM_XE_QUERY_CONFIG_MEM_REGION_COUNT		5
 	/*
 	 * Value of the highest available exec queue priority
 	 */
-#define XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY	6
+#define DRM_XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY	6
 	/** @info: array of elements containing the config info */
 	__u64 info[];
 };
@@ -368,9 +368,9 @@ struct drm_xe_query_config {
  * implementing graphics and/or media operations.
  */
 struct drm_xe_query_gt {
-#define XE_QUERY_GT_TYPE_MAIN		0
-#define XE_QUERY_GT_TYPE_REMOTE		1
-#define XE_QUERY_GT_TYPE_MEDIA		2
+#define DRM_XE_QUERY_GT_TYPE_MAIN		0
+#define DRM_XE_QUERY_GT_TYPE_REMOTE		1
+#define DRM_XE_QUERY_GT_TYPE_MEDIA		2
 	/** @type: GT type: Main, Remote, or Media */
 	__u16 type;
 	/** @gt_id: Unique ID of this GT within the PCI Device */
@@ -435,7 +435,7 @@ struct drm_xe_query_topology_mask {
 	 *   DSS_GEOMETRY    ff ff ff ff 00 00 00 00
 	 * means 32 DSS are available for geometry.
 	 */
-#define XE_TOPO_DSS_GEOMETRY	(1 << 0)
+#define DRM_XE_TOPO_DSS_GEOMETRY	(1 << 0)
 	/*
 	 * To query the mask of Dual Sub Slices (DSS) available for compute
 	 * operations. For example a query response containing the following
@@ -443,7 +443,7 @@ struct drm_xe_query_topology_mask {
 	 *   DSS_COMPUTE    ff ff ff ff 00 00 00 00
 	 * means 32 DSS are available for compute.
 	 */
-#define XE_TOPO_DSS_COMPUTE	(1 << 1)
+#define DRM_XE_TOPO_DSS_COMPUTE		(1 << 1)
 	/*
 	 * To query the mask of Execution Units (EU) available per Dual Sub
 	 * Slices (DSS). For example a query response containing the following
@@ -451,7 +451,7 @@ struct drm_xe_query_topology_mask {
 	 *   EU_PER_DSS    ff ff 00 00 00 00 00 00
 	 * means each DSS has 16 EU.
 	 */
-#define XE_TOPO_EU_PER_DSS	(1 << 2)
+#define DRM_XE_TOPO_EU_PER_DSS		(1 << 2)
 	/** @type: type of mask */
 	__u16 type;
 
@@ -587,8 +587,8 @@ struct drm_xe_gem_create {
 	 */
 	__u64 size;
 
-#define XE_GEM_CREATE_FLAG_DEFER_BACKING	(0x1 << 24)
-#define XE_GEM_CREATE_FLAG_SCANOUT		(0x1 << 25)
+#define DRM_XE_GEM_CREATE_FLAG_DEFER_BACKING		(0x1 << 24)
+#define DRM_XE_GEM_CREATE_FLAG_SCANOUT			(0x1 << 25)
 /*
  * When using VRAM as a possible placement, ensure that the corresponding VRAM
  * allocation will always use the CPU accessible part of VRAM. This is important
@@ -604,7 +604,7 @@ struct drm_xe_gem_create {
  * display surfaces, therefore the kernel requires setting this flag for such
  * objects, otherwise an error is thrown on small-bar systems.
  */
-#define XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM	(0x1 << 26)
+#define DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM	(0x1 << 26)
 	/**
 	 * @flags: Flags, currently a mask of memory instances of where BO can
 	 * be placed
@@ -671,14 +671,14 @@ struct drm_xe_ext_set_property {
 };
 
 struct drm_xe_vm_create {
-#define XE_VM_EXTENSION_SET_PROPERTY	0
+#define DRM_XE_VM_EXTENSION_SET_PROPERTY	0
 	/** @extensions: Pointer to the first extension struct, if any */
 	__u64 extensions;
 
-#define DRM_XE_VM_CREATE_SCRATCH_PAGE	(0x1 << 0)
-#define DRM_XE_VM_CREATE_COMPUTE_MODE	(0x1 << 1)
-#define DRM_XE_VM_CREATE_ASYNC_DEFAULT	(0x1 << 2)
-#define DRM_XE_VM_CREATE_FAULT_MODE	(0x1 << 3)
+#define DRM_XE_VM_CREATE_SCRATCH_PAGE		(0x1 << 0)
+#define DRM_XE_VM_CREATE_COMPUTE_MODE		(0x1 << 1)
+#define DRM_XE_VM_CREATE_ASYNC_DEFAULT		(0x1 << 2)
+#define DRM_XE_VM_CREATE_FAULT_MODE		(0x1 << 3)
 	/** @flags: Flags */
 	__u32 flags;
 
@@ -737,29 +737,29 @@ struct drm_xe_vm_bind_op {
 	 */
 	__u64 tile_mask;
 
-#define XE_VM_BIND_OP_MAP		0x0
-#define XE_VM_BIND_OP_UNMAP		0x1
-#define XE_VM_BIND_OP_MAP_USERPTR	0x2
-#define XE_VM_BIND_OP_UNMAP_ALL		0x3
-#define XE_VM_BIND_OP_PREFETCH		0x4
+#define DRM_XE_VM_BIND_OP_MAP		0x0
+#define DRM_XE_VM_BIND_OP_UNMAP		0x1
+#define DRM_XE_VM_BIND_OP_MAP_USERPTR	0x2
+#define DRM_XE_VM_BIND_OP_UNMAP_ALL	0x3
+#define DRM_XE_VM_BIND_OP_PREFETCH	0x4
 	/** @op: Bind operation to perform */
 	__u32 op;
 
-#define XE_VM_BIND_FLAG_READONLY	(0x1 << 0)
-#define XE_VM_BIND_FLAG_ASYNC		(0x1 << 1)
+#define DRM_XE_VM_BIND_FLAG_READONLY	(0x1 << 0)
+#define DRM_XE_VM_BIND_FLAG_ASYNC	(0x1 << 1)
 	/*
 	 * Valid on a faulting VM only, do the MAP operation immediately rather
 	 * than deferring the MAP to the page fault handler.
 	 */
-#define XE_VM_BIND_FLAG_IMMEDIATE	(0x1 << 2)
+#define DRM_XE_VM_BIND_FLAG_IMMEDIATE	(0x1 << 2)
 	/*
 	 * When the NULL flag is set, the page tables are setup with a special
 	 * bit which indicates writes are dropped and all reads return zero.  In
-	 * the future, the NULL flags will only be valid for XE_VM_BIND_OP_MAP
+	 * the future, the NULL flags will only be valid for DRM_XE_VM_BIND_OP_MAP
 	 * operations, the BO handle MBZ, and the BO offset MBZ. This flag is
 	 * intended to implement VK sparse bindings.
 	 */
-#define XE_VM_BIND_FLAG_NULL		(0x1 << 3)
+#define DRM_XE_VM_BIND_FLAG_NULL	(0x1 << 3)
 	/** @flags: Bind flags */
 	__u32 flags;
 
@@ -840,14 +840,14 @@ struct drm_xe_exec_queue_set_property {
 	/** @exec_queue_id: Exec queue ID */
 	__u32 exec_queue_id;
 
-#define XE_EXEC_QUEUE_SET_PROPERTY_PRIORITY		0
-#define XE_EXEC_QUEUE_SET_PROPERTY_TIMESLICE		1
-#define XE_EXEC_QUEUE_SET_PROPERTY_PREEMPTION_TIMEOUT	2
-#define XE_EXEC_QUEUE_SET_PROPERTY_PERSISTENCE		3
-#define XE_EXEC_QUEUE_SET_PROPERTY_JOB_TIMEOUT		4
-#define XE_EXEC_QUEUE_SET_PROPERTY_ACC_TRIGGER		5
-#define XE_EXEC_QUEUE_SET_PROPERTY_ACC_NOTIFY		6
-#define XE_EXEC_QUEUE_SET_PROPERTY_ACC_GRANULARITY	7
+#define DRM_XE_EXEC_QUEUE_SET_PROPERTY_PRIORITY			0
+#define DRM_XE_EXEC_QUEUE_SET_PROPERTY_TIMESLICE		1
+#define DRM_XE_EXEC_QUEUE_SET_PROPERTY_PREEMPTION_TIMEOUT	2
+#define DRM_XE_EXEC_QUEUE_SET_PROPERTY_PERSISTENCE		3
+#define DRM_XE_EXEC_QUEUE_SET_PROPERTY_JOB_TIMEOUT		4
+#define DRM_XE_EXEC_QUEUE_SET_PROPERTY_ACC_TRIGGER		5
+#define DRM_XE_EXEC_QUEUE_SET_PROPERTY_ACC_NOTIFY		6
+#define DRM_XE_EXEC_QUEUE_SET_PROPERTY_ACC_GRANULARITY		7
 	/** @property: property to set */
 	__u32 property;
 
@@ -859,7 +859,7 @@ struct drm_xe_exec_queue_set_property {
 };
 
 struct drm_xe_exec_queue_create {
-#define XE_EXEC_QUEUE_EXTENSION_SET_PROPERTY               0
+#define DRM_XE_EXEC_QUEUE_EXTENSION_SET_PROPERTY               0
 	/** @extensions: Pointer to the first extension struct, if any */
 	__u64 extensions;
 
@@ -898,7 +898,7 @@ struct drm_xe_exec_queue_get_property {
 	/** @exec_queue_id: Exec queue ID */
 	__u32 exec_queue_id;
 
-#define XE_EXEC_QUEUE_GET_PROPERTY_BAN			0
+#define DRM_XE_EXEC_QUEUE_GET_PROPERTY_BAN	0
 	/** @property: property to get */
 	__u32 property;
 
@@ -1087,8 +1087,8 @@ struct drm_xe_vm_madvise {
 	 * For DRM_XE_VM_MADVISE_PREFERRED_MEM_CLASS usage, see enum
 	 * drm_xe_memory_class.
 	 */
-#define DRM_XE_VM_MADVISE_PREFERRED_MEM_CLASS	0
-#define DRM_XE_VM_MADVISE_PREFERRED_GT		1
+#define DRM_XE_VM_MADVISE_PREFERRED_MEM_CLASS		0
+#define DRM_XE_VM_MADVISE_PREFERRED_GT			1
 	/*
 	 * In this case lower 32 bits are mem class, upper 32 are GT.
 	 * Combination provides a single IOCTL plus migrate VMA to preferred
@@ -1099,25 +1099,25 @@ struct drm_xe_vm_madvise {
 	 * The CPU will do atomic memory operations to this VMA. Must be set on
 	 * some devices for atomics to behave correctly.
 	 */
-#define DRM_XE_VM_MADVISE_CPU_ATOMIC		3
+#define DRM_XE_VM_MADVISE_CPU_ATOMIC			3
 	/*
 	 * The device will do atomic memory operations to this VMA. Must be set
 	 * on some devices for atomics to behave correctly.
 	 */
-#define DRM_XE_VM_MADVISE_DEVICE_ATOMIC		4
+#define DRM_XE_VM_MADVISE_DEVICE_ATOMIC			4
 	/*
 	 * Priority WRT to eviction (moving from preferred memory location due
 	 * to memory pressure). The lower the priority, the more likely to be
 	 * evicted.
 	 */
-#define DRM_XE_VM_MADVISE_PRIORITY		5
-#define		DRM_XE_VMA_PRIORITY_LOW		0
+#define DRM_XE_VM_MADVISE_PRIORITY			5
+#define		DRM_XE_VMA_PRIORITY_LOW			0
 		/* Default */
-#define		DRM_XE_VMA_PRIORITY_NORMAL	1
+#define		DRM_XE_VMA_PRIORITY_NORMAL		1
 		/* Must be user with elevated privileges */
-#define		DRM_XE_VMA_PRIORITY_HIGH	2
+#define		DRM_XE_VMA_PRIORITY_HIGH		2
 	/* Pin the VMA in memory, must be user with elevated privileges */
-#define DRM_XE_VM_MADVISE_PIN			6
+#define DRM_XE_VM_MADVISE_PIN				6
 	/** @property: property to set */
 	__u32 property;
 
@@ -1138,7 +1138,7 @@ struct drm_xe_vm_madvise {
  * in 'struct perf_event_attr' as part of perf_event_open syscall to read a
  * particular event.
  *
- * For example to open the XE_PMU_INTERRUPTS(0):
+ * For example to open the DRM_XE_PMU_INTERRUPTS(0):
  *
  * .. code-block:: C
  *
@@ -1152,7 +1152,7 @@ struct drm_xe_vm_madvise {
  *	attr.read_format = PERF_FORMAT_TOTAL_TIME_ENABLED;
  *	attr.use_clockid = 1;
  *	attr.clockid = CLOCK_MONOTONIC;
- *	attr.config = XE_PMU_INTERRUPTS(0);
+ *	attr.config = DRM_XE_PMU_INTERRUPTS(0);
  *
  *	fd = syscall(__NR_perf_event_open, &attr, -1, cpu, -1, 0);
  */
@@ -1165,11 +1165,11 @@ struct drm_xe_vm_madvise {
 #define ___XE_PMU_OTHER(gt, x) \
 	(((__u64)(x)) | ((__u64)(gt) << __XE_PMU_GT_SHIFT))
 
-#define XE_PMU_INTERRUPTS(gt)			___XE_PMU_OTHER(gt, 0)
-#define XE_PMU_RENDER_GROUP_BUSY(gt)		___XE_PMU_OTHER(gt, 1)
-#define XE_PMU_COPY_GROUP_BUSY(gt)		___XE_PMU_OTHER(gt, 2)
-#define XE_PMU_MEDIA_GROUP_BUSY(gt)		___XE_PMU_OTHER(gt, 3)
-#define XE_PMU_ANY_ENGINE_GROUP_BUSY(gt)	___XE_PMU_OTHER(gt, 4)
+#define DRM_XE_PMU_INTERRUPTS(gt)		___XE_PMU_OTHER(gt, 0)
+#define DRM_XE_PMU_RENDER_GROUP_BUSY(gt)	___XE_PMU_OTHER(gt, 1)
+#define DRM_XE_PMU_COPY_GROUP_BUSY(gt)		___XE_PMU_OTHER(gt, 2)
+#define DRM_XE_PMU_MEDIA_GROUP_BUSY(gt)		___XE_PMU_OTHER(gt, 3)
+#define DRM_XE_PMU_ANY_ENGINE_GROUP_BUSY(gt)	___XE_PMU_OTHER(gt, 4)
 
 #if defined(__cplusplus)
 }
lib/intel_batchbuffer.c +4 -4
index c32d04302..eb47ede50 100644
@@ -1286,7 +1286,7 @@ static struct drm_xe_vm_bind_op *xe_alloc_bind_ops(struct intel_bb *ibb,
 {
 	struct drm_i915_gem_exec_object2 **objects = ibb->objects;
 	struct drm_xe_vm_bind_op *bind_ops, *ops;
-	bool set_obj = (op & 0xffff) == XE_VM_BIND_OP_MAP;
+	bool set_obj = (op & 0xffff) == DRM_XE_VM_BIND_OP_MAP;
 
 	bind_ops = calloc(ibb->num_objects, sizeof(*bind_ops));
 	igt_assert(bind_ops);
@@ -1325,8 +1325,8 @@ static void __unbind_xe_objects(struct intel_bb *ibb)
 
 	if (ibb->num_objects > 1) {
 		struct drm_xe_vm_bind_op *bind_ops;
-		uint32_t op = XE_VM_BIND_OP_UNMAP;
-		uint32_t flags = XE_VM_BIND_FLAG_ASYNC;
+		uint32_t op = DRM_XE_VM_BIND_OP_UNMAP;
+		uint32_t flags = DRM_XE_VM_BIND_FLAG_ASYNC;
 
 		bind_ops = xe_alloc_bind_ops(ibb, op, flags, 0);
 		xe_vm_bind_array(ibb->fd, ibb->vm_id, 0, bind_ops,
@@ -2357,7 +2357,7 @@ __xe_bb_exec(struct intel_bb *ibb, uint64_t flags, bool sync)
 
 	syncs[0].handle = syncobj_create(ibb->fd, 0);
 	if (ibb->num_objects > 1) {
-		bind_ops = xe_alloc_bind_ops(ibb, XE_VM_BIND_OP_MAP, XE_VM_BIND_FLAG_ASYNC, 0);
+		bind_ops = xe_alloc_bind_ops(ibb, DRM_XE_VM_BIND_OP_MAP, DRM_XE_VM_BIND_FLAG_ASYNC, 0);
 		xe_vm_bind_array(ibb->fd, ibb->vm_id, 0, bind_ops,
 				 ibb->num_objects, syncs, 1);
 		free(bind_ops);
lib/intel_blt.c +1 -1
index 5b682c2b6..2edcd72f3 100644
@@ -1804,7 +1804,7 @@ blt_create_object(const struct blt_copy_data *blt, uint32_t region,
 		uint64_t flags = region;
 
 		if (create_mapping && region != system_memory(blt->fd))
-			flags |= XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM;
+			flags |= DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM;
 
 		size = ALIGN(size, xe_get_default_alignment(blt->fd));
 		handle = xe_bo_create_flags(blt->fd, 0, size, flags);
lib/xe/xe_ioctl.c +11 -11
index 895e3bd4e..21a85225f 100644
@@ -67,7 +67,7 @@ void xe_vm_unbind_all_async(int fd, uint32_t vm, uint32_t exec_queue,
 			    uint32_t num_syncs)
 {
 	__xe_vm_bind_assert(fd, vm, exec_queue, bo, 0, 0, 0,
-			    XE_VM_BIND_OP_UNMAP_ALL, XE_VM_BIND_FLAG_ASYNC,
+			    DRM_XE_VM_BIND_OP_UNMAP_ALL, DRM_XE_VM_BIND_FLAG_ASYNC,
 			    sync, num_syncs, 0, 0);
 }
 
@@ -130,7 +130,7 @@ void xe_vm_bind(int fd, uint32_t vm, uint32_t bo, uint64_t offset,
 		struct drm_xe_sync *sync, uint32_t num_syncs)
 {
 	__xe_vm_bind_assert(fd, vm, 0, bo, offset, addr, size,
-			    XE_VM_BIND_OP_MAP, 0, sync, num_syncs, 0, 0);
+			    DRM_XE_VM_BIND_OP_MAP, 0, sync, num_syncs, 0, 0);
 }
 
 void xe_vm_unbind(int fd, uint32_t vm, uint64_t offset,
@@ -138,7 +138,7 @@ void xe_vm_unbind(int fd, uint32_t vm, uint64_t offset,
 		  struct drm_xe_sync *sync, uint32_t num_syncs)
 {
 	__xe_vm_bind_assert(fd, vm, 0, 0, offset, addr, size,
-			    XE_VM_BIND_OP_UNMAP, 0, sync, num_syncs, 0, 0);
+			    DRM_XE_VM_BIND_OP_UNMAP, 0, sync, num_syncs, 0, 0);
 }
 
 void xe_vm_prefetch_async(int fd, uint32_t vm, uint32_t exec_queue, uint64_t offset,
@@ -147,7 +147,7 @@ void xe_vm_prefetch_async(int fd, uint32_t vm, uint32_t exec_queue, uint64_t off
 			  uint32_t region)
 {
 	__xe_vm_bind_assert(fd, vm, exec_queue, 0, offset, addr, size,
-			    XE_VM_BIND_OP_PREFETCH, XE_VM_BIND_FLAG_ASYNC,
+			    DRM_XE_VM_BIND_OP_PREFETCH, DRM_XE_VM_BIND_FLAG_ASYNC,
 			    sync, num_syncs, region, 0);
 }
 
@@ -156,7 +156,7 @@ void xe_vm_bind_async(int fd, uint32_t vm, uint32_t exec_queue, uint32_t bo,
 		      struct drm_xe_sync *sync, uint32_t num_syncs)
 {
 	__xe_vm_bind_assert(fd, vm, exec_queue, bo, offset, addr, size,
-			    XE_VM_BIND_OP_MAP, XE_VM_BIND_FLAG_ASYNC, sync,
+			    DRM_XE_VM_BIND_OP_MAP, DRM_XE_VM_BIND_FLAG_ASYNC, sync,
 			    num_syncs, 0, 0);
 }
 
@@ -166,7 +166,7 @@ void xe_vm_bind_async_flags(int fd, uint32_t vm, uint32_t exec_queue, uint32_t b
 			    uint32_t flags)
 {
 	__xe_vm_bind_assert(fd, vm, exec_queue, bo, offset, addr, size,
-			    XE_VM_BIND_OP_MAP, XE_VM_BIND_FLAG_ASYNC | flags,
+			    DRM_XE_VM_BIND_OP_MAP, DRM_XE_VM_BIND_FLAG_ASYNC | flags,
 			    sync, num_syncs, 0, 0);
 }
 
@@ -175,7 +175,7 @@ void xe_vm_bind_userptr_async(int fd, uint32_t vm, uint32_t exec_queue,
 			      struct drm_xe_sync *sync, uint32_t num_syncs)
 {
 	__xe_vm_bind_assert(fd, vm, exec_queue, 0, userptr, addr, size,
-			    XE_VM_BIND_OP_MAP_USERPTR, XE_VM_BIND_FLAG_ASYNC,
+			    DRM_XE_VM_BIND_OP_MAP_USERPTR, DRM_XE_VM_BIND_FLAG_ASYNC,
 			    sync, num_syncs, 0, 0);
 }
 
@@ -185,7 +185,7 @@ void xe_vm_bind_userptr_async_flags(int fd, uint32_t vm, uint32_t exec_queue,
 				    uint32_t num_syncs, uint32_t flags)
 {
 	__xe_vm_bind_assert(fd, vm, exec_queue, 0, userptr, addr, size,
-			    XE_VM_BIND_OP_MAP_USERPTR, XE_VM_BIND_FLAG_ASYNC |
+			    DRM_XE_VM_BIND_OP_MAP_USERPTR, DRM_XE_VM_BIND_FLAG_ASYNC |
 			    flags, sync, num_syncs, 0, 0);
 }
 
@@ -194,7 +194,7 @@ void xe_vm_unbind_async(int fd, uint32_t vm, uint32_t exec_queue,
 			struct drm_xe_sync *sync, uint32_t num_syncs)
 {
 	__xe_vm_bind_assert(fd, vm, exec_queue, 0, offset, addr, size,
-			    XE_VM_BIND_OP_UNMAP, XE_VM_BIND_FLAG_ASYNC, sync,
+			    DRM_XE_VM_BIND_OP_UNMAP, DRM_XE_VM_BIND_FLAG_ASYNC, sync,
 			    num_syncs, 0, 0);
 }
 
@@ -208,13 +208,13 @@ static void __xe_vm_bind_sync(int fd, uint32_t vm, uint32_t bo, uint64_t offset,
 void xe_vm_bind_sync(int fd, uint32_t vm, uint32_t bo, uint64_t offset,
 		     uint64_t addr, uint64_t size)
 {
-	__xe_vm_bind_sync(fd, vm, bo, offset, addr, size, XE_VM_BIND_OP_MAP);
+	__xe_vm_bind_sync(fd, vm, bo, offset, addr, size, DRM_XE_VM_BIND_OP_MAP);
 }
 
 void xe_vm_unbind_sync(int fd, uint32_t vm, uint64_t offset,
 		       uint64_t addr, uint64_t size)
 {
-	__xe_vm_bind_sync(fd, vm, 0, offset, addr, size, XE_VM_BIND_OP_UNMAP);
+	__xe_vm_bind_sync(fd, vm, 0, offset, addr, size, DRM_XE_VM_BIND_OP_UNMAP);
 }
 
 void xe_vm_destroy(int fd, uint32_t vm)
lib/xe/xe_query.c +7 -7
index 986a3a0c1..0fa21465b 100644
@@ -249,9 +249,9 @@ struct xe_device *xe_device_get(int fd)
 
 	xe_dev->fd = fd;
 	xe_dev->config = xe_query_config_new(fd);
-	xe_dev->number_gt = xe_dev->config->info[XE_QUERY_CONFIG_GT_COUNT];
-	xe_dev->va_bits = xe_dev->config->info[XE_QUERY_CONFIG_VA_BITS];
-	xe_dev->dev_id = xe_dev->config->info[XE_QUERY_CONFIG_REV_AND_DEVICE_ID] & 0xffff;
+	xe_dev->number_gt = xe_dev->config->info[DRM_XE_QUERY_CONFIG_GT_COUNT];
+	xe_dev->va_bits = xe_dev->config->info[DRM_XE_QUERY_CONFIG_VA_BITS];
+	xe_dev->dev_id = xe_dev->config->info[DRM_XE_QUERY_CONFIG_REV_AND_DEVICE_ID] & 0xffff;
 	xe_dev->gt_list = xe_query_gt_list_new(fd);
 	xe_dev->memory_regions = __memory_regions(xe_dev->gt_list);
 	xe_dev->hw_engines = xe_query_engines_new(fd, &xe_dev->number_hw_engines);
@@ -415,7 +415,7 @@ static uint64_t __xe_visible_vram_size(int fd, int gt)
  * @gt: gt id
  *
  * Returns vram memory bitmask for xe device @fd and @gt id, with
- * XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM also set, to ensure that CPU access is
+ * DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM also set, to ensure that CPU access is
  * possible.
  */
 uint64_t visible_vram_memory(int fd, int gt)
@@ -425,7 +425,7 @@ uint64_t visible_vram_memory(int fd, int gt)
 	 * has landed.
 	 */
 	if (__xe_visible_vram_size(fd, gt))
-		return vram_memory(fd, gt) | XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM;
+		return vram_memory(fd, gt) | DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM;
 	else
 		return vram_memory(fd, gt); /* older kernel */
 }
@@ -450,7 +450,7 @@ uint64_t vram_if_possible(int fd, int gt)
  *
  * Returns vram memory bitmask for xe device @fd and @gt id or system memory if
  * there's no vram memory available for @gt. Also attaches the
- * XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM to ensure that CPU access is possible
+ * DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM to ensure that CPU access is possible
  * when using vram.
  */
 uint64_t visible_vram_if_possible(int fd, int gt)
@@ -464,7 +464,7 @@ uint64_t visible_vram_if_possible(int fd, int gt)
 	 * has landed.
 	 */
 	if (__xe_visible_vram_size(fd, gt))
-		return vram ? vram | XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM : system_memory;
+		return vram ? vram | DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM : system_memory;
 	else
 		return vram ? vram : system_memory; /* older kernel */
 }
lib/xe/xe_query.h +2 -2
index 7c0849bc1..c63b97044 100644
@@ -74,8 +74,8 @@ struct xe_device {
 	for (uint64_t __i = 0; __i < igt_fls(__memreg); __i++) \
 		for_if(__r = (__memreg & (1ull << __i)))
 
-#define XE_IS_CLASS_SYSMEM(__region) ((__region)->mem_class == XE_MEM_REGION_CLASS_SYSMEM)
-#define XE_IS_CLASS_VRAM(__region) ((__region)->mem_class == XE_MEM_REGION_CLASS_VRAM)
+#define XE_IS_CLASS_SYSMEM(__region) ((__region)->mem_class == DRM_XE_MEM_REGION_CLASS_SYSMEM)
+#define XE_IS_CLASS_VRAM(__region) ((__region)->mem_class == DRM_XE_MEM_REGION_CLASS_VRAM)
 
 unsigned int xe_number_gt(int fd);
 uint64_t all_memory_regions(int fd);
lib/xe/xe_util.c +5 -5
index 5fa4d4610..780125f92 100644
@@ -134,12 +134,12 @@ static struct drm_xe_vm_bind_op *xe_alloc_bind_ops(struct igt_list_head *obj_lis
 		ops = &bind_ops[i];
 
 		if (obj->bind_op == XE_OBJECT_BIND) {
-			op = XE_VM_BIND_OP_MAP;
-			flags = XE_VM_BIND_FLAG_ASYNC;
+			op = DRM_XE_VM_BIND_OP_MAP;
+			flags = DRM_XE_VM_BIND_FLAG_ASYNC;
 			ops->obj = obj->handle;
 		} else {
-			op = XE_VM_BIND_OP_UNMAP;
-			flags = XE_VM_BIND_FLAG_ASYNC;
+			op = DRM_XE_VM_BIND_OP_UNMAP;
+			flags = DRM_XE_VM_BIND_FLAG_ASYNC;
 		}
 
 		ops->op = op;
@@ -211,7 +211,7 @@ void xe_bind_unbind_async(int xe, uint32_t vm, uint32_t bind_engine,
 		  tabsyncs[0].handle, tabsyncs[1].handle);
 
 	if (num_binds == 1) {
-		if ((bind_ops[0].op & 0xffff) == XE_VM_BIND_OP_MAP)
+		if ((bind_ops[0].op & 0xffff) == DRM_XE_VM_BIND_OP_MAP)
 			xe_vm_bind_async(xe, vm, bind_engine, bind_ops[0].obj, 0,
 					 bind_ops[0].addr, bind_ops[0].range,
 					 syncs, num_syncs);
lib/xe/xe_util.h +2 -2
index e97d236b8..21b312071 100644
@@ -13,9 +13,9 @@
 #include <xe_drm.h>
 
 #define XE_IS_SYSMEM_MEMORY_REGION(fd, region) \
-	(xe_region_class(fd, region) == XE_MEM_REGION_CLASS_SYSMEM)
+	(xe_region_class(fd, region) == DRM_XE_MEM_REGION_CLASS_SYSMEM)
 #define XE_IS_VRAM_MEMORY_REGION(fd, region) \
-	(xe_region_class(fd, region) == XE_MEM_REGION_CLASS_VRAM)
+	(xe_region_class(fd, region) == DRM_XE_MEM_REGION_CLASS_VRAM)
 
 struct igt_collection *
 __xe_get_memory_region_set(int xe, uint32_t *mem_regions_type, int num_regions);
tests/intel/xe_access_counter.c +2 -2
index b738ebc86..8966bfc9c 100644
@@ -47,8 +47,8 @@ igt_main
 
 		struct drm_xe_ext_set_property ext = {
 			.base.next_extension = 0,
-			.base.name = XE_EXEC_QUEUE_EXTENSION_SET_PROPERTY,
-			.property = XE_EXEC_QUEUE_SET_PROPERTY_ACC_GRANULARITY,
+			.base.name = DRM_XE_EXEC_QUEUE_EXTENSION_SET_PROPERTY,
+			.property = DRM_XE_EXEC_QUEUE_SET_PROPERTY_ACC_GRANULARITY,
 			.value = SIZE_64M + 1,
 		};
 
tests/intel/xe_ccs.c +2 -2
index 876c239e4..bb844b641 100644
@@ -634,8 +634,8 @@ igt_main_args("bf:pst:W:H:", NULL, help_str, opt_handler, NULL)
 		xe_device_get(xe);
 
 		set = xe_get_memory_region_set(xe,
-					       XE_MEM_REGION_CLASS_SYSMEM,
-					       XE_MEM_REGION_CLASS_VRAM);
+					       DRM_XE_MEM_REGION_CLASS_SYSMEM,
+					       DRM_XE_MEM_REGION_CLASS_VRAM);
 	}
 
 	igt_describe("Check block-copy uncompressed blit");
tests/intel/xe_copy_basic.c +2 -2
index fe78ac50f..1dafbb276 100644
@@ -164,8 +164,8 @@ igt_main
 		fd = drm_open_driver(DRIVER_XE);
 		xe_device_get(fd);
 		set = xe_get_memory_region_set(fd,
-					       XE_MEM_REGION_CLASS_SYSMEM,
-					       XE_MEM_REGION_CLASS_VRAM);
+					       DRM_XE_MEM_REGION_CLASS_SYSMEM,
+					       DRM_XE_MEM_REGION_CLASS_VRAM);
 	}
 
 	for (int i = 0; i < ARRAY_SIZE(size); i++) {
tests/intel/xe_debugfs.c +7 -7
index e5bbb364c..9ffc6f6d8 100644
@@ -91,20 +91,20 @@ test_base(int fd, struct drm_xe_query_config *config)
 
 	igt_assert(config);
 	sprintf(reference, "devid 0x%llx",
-			config->info[XE_QUERY_CONFIG_REV_AND_DEVICE_ID] & 0xffff);
+			config->info[DRM_XE_QUERY_CONFIG_REV_AND_DEVICE_ID] & 0xffff);
 	igt_assert(igt_debugfs_search(fd, "info", reference));
 
 	sprintf(reference, "revid %lld",
-			config->info[XE_QUERY_CONFIG_REV_AND_DEVICE_ID] >> 16);
+			config->info[DRM_XE_QUERY_CONFIG_REV_AND_DEVICE_ID] >> 16);
 	igt_assert(igt_debugfs_search(fd, "info", reference));
 
-	sprintf(reference, "is_dgfx %s", config->info[XE_QUERY_CONFIG_FLAGS] &
-		XE_QUERY_CONFIG_FLAGS_HAS_VRAM ? "yes" : "no");
+	sprintf(reference, "is_dgfx %s", config->info[DRM_XE_QUERY_CONFIG_FLAGS] &
+		DRM_XE_QUERY_CONFIG_FLAGS_HAS_VRAM ? "yes" : "no");
 
 	igt_assert(igt_debugfs_search(fd, "info", reference));
 
 	if (!AT_LEAST_GEN(devid, 20)) {
-		switch (config->info[XE_QUERY_CONFIG_VA_BITS]) {
+		switch (config->info[DRM_XE_QUERY_CONFIG_VA_BITS]) {
 		case 48:
 			val = 3;
 			break;
@@ -121,13 +121,13 @@ test_base(int fd, struct drm_xe_query_config *config)
 	igt_assert(igt_debugfs_search(fd, "info", reference));
 
 	igt_assert(igt_debugfs_exists(fd, "gt0", O_RDONLY));
-	if (config->info[XE_QUERY_CONFIG_GT_COUNT] > 1)
+	if (config->info[DRM_XE_QUERY_CONFIG_GT_COUNT] > 1)
 		igt_assert(igt_debugfs_exists(fd, "gt1", O_RDONLY));
 
 	igt_assert(igt_debugfs_exists(fd, "gtt_mm", O_RDONLY));
 	igt_debugfs_dump(fd, "gtt_mm");
 
-	if (config->info[XE_QUERY_CONFIG_FLAGS] & XE_QUERY_CONFIG_FLAGS_HAS_VRAM) {
+	if (config->info[DRM_XE_QUERY_CONFIG_FLAGS] & DRM_XE_QUERY_CONFIG_FLAGS_HAS_VRAM) {
 		igt_assert(igt_debugfs_exists(fd, "vram0_mm", O_RDONLY));
 		igt_debugfs_dump(fd, "vram0_mm");
 	}
tests/intel/xe_exec_basic.c +4 -4
index 8dbce524d..232ddde8e 100644
@@ -138,7 +138,7 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 
 		bo_flags = visible_vram_if_possible(fd, eci->gt_id);
 		if (flags & DEFER_ALLOC)
-			bo_flags |= XE_GEM_CREATE_FLAG_DEFER_BACKING;
+			bo_flags |= DRM_XE_GEM_CREATE_FLAG_DEFER_BACKING;
 
 		bo = xe_bo_create_flags(fd, n_vm == 1 ? vm[0] : 0,
 					bo_size, bo_flags);
@@ -172,9 +172,9 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 		if (flags & SPARSE)
 			__xe_vm_bind_assert(fd, vm[i], bind_exec_queues[i],
 					    0, 0, sparse_addr[i], bo_size,
-					    XE_VM_BIND_OP_MAP,
-					    XE_VM_BIND_FLAG_ASYNC |
-					    XE_VM_BIND_FLAG_NULL, sync,
+					    DRM_XE_VM_BIND_OP_MAP,
+					    DRM_XE_VM_BIND_FLAG_ASYNC |
+					    DRM_XE_VM_BIND_FLAG_NULL, sync,
 					    1, 0, 0);
 	}
 
tests/intel/xe_exec_fault_mode.c +2 -2
index 92d8690a1..92359d1a7 100644
@@ -175,12 +175,12 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 		if (bo)
 			xe_vm_bind_async_flags(fd, vm, bind_exec_queues[0], bo, 0,
 					       addr, bo_size, sync, 1,
-					       XE_VM_BIND_FLAG_IMMEDIATE);
+					       DRM_XE_VM_BIND_FLAG_IMMEDIATE);
 		else
 			xe_vm_bind_userptr_async_flags(fd, vm, bind_exec_queues[0],
 						       to_user_pointer(data),
 						       addr, bo_size, sync, 1,
-						       XE_VM_BIND_FLAG_IMMEDIATE);
+						       DRM_XE_VM_BIND_FLAG_IMMEDIATE);
 	} else {
 		if (bo)
 			xe_vm_bind_async(fd, vm, bind_exec_queues[0], bo, 0, addr,
tests/intel/xe_exec_reset.c +10 -10
index 44248776b..39647b736 100644
@@ -187,14 +187,14 @@ test_balancer(int fd, int gt, int class, int n_exec_queues, int n_execs,
 	for (i = 0; i < n_exec_queues; i++) {
 		struct drm_xe_ext_set_property job_timeout = {
 			.base.next_extension = 0,
-			.base.name = XE_EXEC_QUEUE_EXTENSION_SET_PROPERTY,
-			.property = XE_EXEC_QUEUE_SET_PROPERTY_JOB_TIMEOUT,
+			.base.name = DRM_XE_EXEC_QUEUE_EXTENSION_SET_PROPERTY,
+			.property = DRM_XE_EXEC_QUEUE_SET_PROPERTY_JOB_TIMEOUT,
 			.value = 50,
 		};
 		struct drm_xe_ext_set_property preempt_timeout = {
 			.base.next_extension = 0,
-			.base.name = XE_EXEC_QUEUE_EXTENSION_SET_PROPERTY,
-			.property = XE_EXEC_QUEUE_SET_PROPERTY_PREEMPTION_TIMEOUT,
+			.base.name = DRM_XE_EXEC_QUEUE_EXTENSION_SET_PROPERTY,
+			.property = DRM_XE_EXEC_QUEUE_SET_PROPERTY_PREEMPTION_TIMEOUT,
 			.value = 1000,
 		};
 		struct drm_xe_exec_queue_create create = {
@@ -374,14 +374,14 @@ test_legacy_mode(int fd, struct drm_xe_engine_class_instance *eci,
 	for (i = 0; i < n_exec_queues; i++) {
 		struct drm_xe_ext_set_property job_timeout = {
 			.base.next_extension = 0,
-			.base.name = XE_EXEC_QUEUE_EXTENSION_SET_PROPERTY,
-			.property = XE_EXEC_QUEUE_SET_PROPERTY_JOB_TIMEOUT,
+			.base.name = DRM_XE_EXEC_QUEUE_EXTENSION_SET_PROPERTY,
+			.property = DRM_XE_EXEC_QUEUE_SET_PROPERTY_JOB_TIMEOUT,
 			.value = 50,
 		};
 		struct drm_xe_ext_set_property preempt_timeout = {
 			.base.next_extension = 0,
-			.base.name = XE_EXEC_QUEUE_EXTENSION_SET_PROPERTY,
-			.property = XE_EXEC_QUEUE_SET_PROPERTY_PREEMPTION_TIMEOUT,
+			.base.name = DRM_XE_EXEC_QUEUE_EXTENSION_SET_PROPERTY,
+			.property = DRM_XE_EXEC_QUEUE_SET_PROPERTY_PREEMPTION_TIMEOUT,
 			.value = 1000,
 		};
 		uint64_t ext = 0;
@@ -542,8 +542,8 @@ test_compute_mode(int fd, struct drm_xe_engine_class_instance *eci,
 	for (i = 0; i < n_exec_queues; i++) {
 		struct drm_xe_ext_set_property preempt_timeout = {
 			.base.next_extension = 0,
-			.base.name = XE_EXEC_QUEUE_EXTENSION_SET_PROPERTY,
-			.property = XE_EXEC_QUEUE_SET_PROPERTY_PREEMPTION_TIMEOUT,
+			.base.name = DRM_XE_EXEC_QUEUE_EXTENSION_SET_PROPERTY,
+			.property = DRM_XE_EXEC_QUEUE_SET_PROPERTY_PREEMPTION_TIMEOUT,
 			.value = 1000,
 		};
 		uint64_t ext = 0;
tests/intel/xe_exec_threads.c +2 -2
index a0c96d08d..b814dcdf5 100644
@@ -520,8 +520,8 @@ test_legacy_mode(int fd, uint32_t vm, uint64_t addr, uint64_t userptr,
 	for (i = 0; i < n_exec_queues; i++) {
 		struct drm_xe_ext_set_property preempt_timeout = {
 			.base.next_extension = 0,
-			.base.name = XE_EXEC_QUEUE_EXTENSION_SET_PROPERTY,
-			.property = XE_EXEC_QUEUE_SET_PROPERTY_PREEMPTION_TIMEOUT,
+			.base.name = DRM_XE_EXEC_QUEUE_EXTENSION_SET_PROPERTY,
+			.property = DRM_XE_EXEC_QUEUE_SET_PROPERTY_PREEMPTION_TIMEOUT,
 			.value = 1000,
 		};
 		uint64_t ext = to_user_pointer(&preempt_timeout);
tests/intel/xe_exercise_blt.c +2 -2
index 2f349b16d..df774130f 100644
@@ -358,8 +358,8 @@ igt_main_args("b:pst:W:H:", NULL, help_str, opt_handler, NULL)
 		xe_device_get(xe);
 
 		set = xe_get_memory_region_set(xe,
-					       XE_MEM_REGION_CLASS_SYSMEM,
-					       XE_MEM_REGION_CLASS_VRAM);
+					       DRM_XE_MEM_REGION_CLASS_SYSMEM,
+					       DRM_XE_MEM_REGION_CLASS_VRAM);
 	}
 
 	igt_describe("Check fast-copy blit");
tests/intel/xe_perf_pmu.c +4 -4
index 0b25a859f..a0dd30e50 100644
@@ -51,15 +51,15 @@ static uint64_t engine_group_get_config(int gt, int class)
 
 	switch (class) {
 	case DRM_XE_ENGINE_CLASS_COPY:
-		config = XE_PMU_COPY_GROUP_BUSY(gt);
+		config = DRM_XE_PMU_COPY_GROUP_BUSY(gt);
 		break;
 	case DRM_XE_ENGINE_CLASS_RENDER:
 	case DRM_XE_ENGINE_CLASS_COMPUTE:
-		config = XE_PMU_RENDER_GROUP_BUSY(gt);
+		config = DRM_XE_PMU_RENDER_GROUP_BUSY(gt);
 		break;
 	case DRM_XE_ENGINE_CLASS_VIDEO_DECODE:
 	case DRM_XE_ENGINE_CLASS_VIDEO_ENHANCE:
-		config = XE_PMU_MEDIA_GROUP_BUSY(gt);
+		config = DRM_XE_PMU_MEDIA_GROUP_BUSY(gt);
 		break;
 	}
 
@@ -112,7 +112,7 @@ static void test_any_engine_busyness(int fd, struct drm_xe_engine_class_instance
 	sync[0].handle = syncobj_create(fd, 0);
 	xe_vm_bind_async(fd, vm, 0, bo, 0, addr, bo_size, sync, 1);
 
-	pmu_fd = open_pmu(fd, XE_PMU_ANY_ENGINE_GROUP_BUSY(eci->gt_id));
+	pmu_fd = open_pmu(fd, DRM_XE_PMU_ANY_ENGINE_GROUP_BUSY(eci->gt_id));
 	idle = pmu_read(pmu_fd);
 	igt_assert(!idle);
 
tests/intel/xe_pm.c +1 -1
index b2976ec84..d07ed4535 100644
@@ -400,7 +400,7 @@ static void test_vram_d3cold_threshold(device_t device, int sysfs_fd)
 	igt_assert_eq(igt_ioctl(device.fd_xe, DRM_IOCTL_XE_DEVICE_QUERY, &query), 0);
 
 	for (i = 0; i < mem_usage->num_regions; i++) {
-		if (mem_usage->regions[i].mem_class == XE_MEM_REGION_CLASS_VRAM) {
+		if (mem_usage->regions[i].mem_class == DRM_XE_MEM_REGION_CLASS_VRAM) {
 			vram_used_mb +=  (mem_usage->regions[i].used / (1024 * 1024));
 			vram_total_mb += (mem_usage->regions[i].total_size / (1024 * 1024));
 		}
tests/intel/xe_query.c +24 -24

69 lines not on this page · raw message

tests/intel/xe_vm.c +5 -5
index eeb49122a..c1de18e65 100644
@@ -356,7 +356,7 @@ static void userptr_invalid(int fd)
 	vm = xe_vm_create(fd, 0, 0);
 	munmap(data, size);
 	ret = __xe_vm_bind(fd, vm, 0, 0, to_user_pointer(data), 0x40000,
-			   size, XE_VM_BIND_OP_MAP_USERPTR, 0, NULL, 0, 0, 0);
+			   size, DRM_XE_VM_BIND_OP_MAP_USERPTR, 0, NULL, 0, 0, 0);
 	igt_assert(ret == -EFAULT);
 
 	xe_vm_destroy(fd, vm);
@@ -792,8 +792,8 @@ test_bind_array(int fd, struct drm_xe_engine_class_instance *eci, int n_execs,
 		bind_ops[i].range = bo_size;
 		bind_ops[i].addr = addr;
 		bind_ops[i].tile_mask = 0x1 << eci->gt_id;
-		bind_ops[i].op = XE_VM_BIND_OP_MAP;
-		bind_ops[i].flags = XE_VM_BIND_FLAG_ASYNC;
+		bind_ops[i].op = DRM_XE_VM_BIND_OP_MAP;
+		bind_ops[i].flags = DRM_XE_VM_BIND_FLAG_ASYNC;
 		bind_ops[i].region = 0;
 		bind_ops[i].reserved[0] = 0;
 		bind_ops[i].reserved[1] = 0;
@@ -837,8 +837,8 @@ test_bind_array(int fd, struct drm_xe_engine_class_instance *eci, int n_execs,
 
 	for (i = 0; i < n_execs; ++i) {
 		bind_ops[i].obj = 0;
-		bind_ops[i].op = XE_VM_BIND_OP_UNMAP;
-		bind_ops[i].flags = XE_VM_BIND_FLAG_ASYNC;
+		bind_ops[i].op = DRM_XE_VM_BIND_OP_UNMAP;
+		bind_ops[i].flags = DRM_XE_VM_BIND_FLAG_ASYNC;
 	}
 
 	syncobj_reset(fd, &sync[0].handle, 1);
Signature · 1 line
2.34.1
#9 lore raw

PATCH v3 9/57 drm-uapi/xe: Add _FLAG to uAPI constants usable for flags

In reply to Francois Dugast

Align with commit ("drm/xe/uapi: Add _FLAG to uAPI constants usable for flags")

---
 benchmarks/gem_wsim.c              |  12 +--
 include/drm-uapi/xe_drm.h          |  30 +++----
 lib/igt_fb.c                       |   2 +-
 lib/intel_batchbuffer.c            |  12 +--
 lib/intel_compute.c                |   6 +-
 lib/intel_ctx.c                    |   4 +-
 lib/xe/xe_ioctl.c                  |   6 +-
 lib/xe/xe_query.c                  |   4 +-
 lib/xe/xe_spin.c                   |   4 +-
 lib/xe/xe_util.c                   |   4 +-
 tests/intel/xe_ccs.c               |   4 +-
 tests/intel/xe_copy_basic.c        |   2 +-
 tests/intel/xe_create.c            |   6 +-
 tests/intel/xe_dma_buf_sync.c      |   4 +-
 tests/intel/xe_drm_fdinfo.c        |  18 ++---
 tests/intel/xe_evict.c             |  24 +++---
 tests/intel/xe_evict_ccs.c         |   2 +-
 tests/intel/xe_exec_balancer.c     |  34 ++++----
 tests/intel/xe_exec_basic.c        |  16 ++--
 tests/intel/xe_exec_compute_mode.c |   6 +-
 tests/intel/xe_exec_fault_mode.c   |  14 ++--
 tests/intel/xe_exec_reset.c        |  42 +++++-----
 tests/intel/xe_exec_store.c        |  26 +++---
 tests/intel/xe_exec_threads.c      |  44 +++++-----
 tests/intel/xe_exercise_blt.c      |   2 +-
 tests/intel/xe_guc_pc.c            |  12 +--
 tests/intel/xe_huc_copy.c          |   4 +-
 tests/intel/xe_intel_bb.c          |   2 +-
 tests/intel/xe_noexec_ping_pong.c  |   2 +-
 tests/intel/xe_perf_pmu.c          |  24 +++---
 tests/intel/xe_pm.c                |  12 +--
 tests/intel/xe_pm_residency.c      |   2 +-
 tests/intel/xe_spin_batch.c        |   2 +-
 tests/intel/xe_vm.c                | 126 ++++++++++++++---------------
 tests/intel/xe_waitfence.c         |   4 +-
 35 files changed, 259 insertions(+), 259 deletions(-)
benchmarks/gem_wsim.c +6 -6
index 28b809520..df4850086 100644
@@ -1772,21 +1772,21 @@ xe_alloc_step_batch(struct workload *wrk, struct w_step *w)
 	i = 0;
 	/* out fence */
 	w->xe.syncs[i].handle = syncobj_create(fd, 0);
-	w->xe.syncs[i++].flags = DRM_XE_SYNC_SYNCOBJ | DRM_XE_SYNC_SIGNAL;
+	w->xe.syncs[i++].flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL;
 	/* in fence(s) */
 	for_each_dep(dep, w->data_deps) {
 		int dep_idx = w->idx + dep->target;
 
 		igt_assert(wrk->steps[dep_idx].xe.syncs && wrk->steps[dep_idx].xe.syncs[0].handle);
 		w->xe.syncs[i].handle = wrk->steps[dep_idx].xe.syncs[0].handle;
-		w->xe.syncs[i++].flags = DRM_XE_SYNC_SYNCOBJ;
+		w->xe.syncs[i++].flags = DRM_XE_SYNC_FLAG_SYNCOBJ;
 	}
 	for_each_dep(dep, w->fence_deps) {
 		int dep_idx = w->idx + dep->target;
 
 		igt_assert(wrk->steps[dep_idx].xe.syncs && wrk->steps[dep_idx].xe.syncs[0].handle);
 		w->xe.syncs[i].handle = wrk->steps[dep_idx].xe.syncs[0].handle;
-		w->xe.syncs[i++].flags = DRM_XE_SYNC_SYNCOBJ;
+		w->xe.syncs[i++].flags = DRM_XE_SYNC_FLAG_SYNCOBJ;
 	}
 	w->xe.exec.syncs = to_user_pointer(w->xe.syncs);
 }
@@ -2024,8 +2024,8 @@ static void xe_vm_create_(struct xe_vm *vm)
 	uint32_t flags = 0;
 
 	if (vm->compute_mode)
-		flags |= DRM_XE_VM_CREATE_ASYNC_DEFAULT |
-			 DRM_XE_VM_CREATE_COMPUTE_MODE;
+		flags |= DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT |
+			 DRM_XE_VM_CREATE_FLAG_COMPUTE_MODE;
 
 	vm->id = xe_vm_create(fd, flags, 0);
 }
@@ -2363,7 +2363,7 @@ static int xe_prepare_contexts(unsigned int id, struct workload *wrk)
 		if (w->type == SW_FENCE) {
 			w->xe.syncs = calloc(1, sizeof(struct drm_xe_sync));
 			w->xe.syncs[0].handle = syncobj_create(fd, 0);
-			w->xe.syncs[0].flags = DRM_XE_SYNC_SYNCOBJ;
+			w->xe.syncs[0].flags = DRM_XE_SYNC_FLAG_SYNCOBJ;
 		}
 
 	return 0;
include/drm-uapi/xe_drm.h +15 -15
index 8d0abf31c..01a276376 100644
@@ -675,10 +675,10 @@ struct drm_xe_vm_create {
 	/** @extensions: Pointer to the first extension struct, if any */
 	__u64 extensions;
 
-#define DRM_XE_VM_CREATE_SCRATCH_PAGE		(0x1 << 0)
-#define DRM_XE_VM_CREATE_COMPUTE_MODE		(0x1 << 1)
-#define DRM_XE_VM_CREATE_ASYNC_DEFAULT		(0x1 << 2)
-#define DRM_XE_VM_CREATE_FAULT_MODE		(0x1 << 3)
+#define DRM_XE_VM_CREATE_FLAG_SCRATCH_PAGE	(0x1 << 0)
+#define DRM_XE_VM_CREATE_FLAG_COMPUTE_MODE	(0x1 << 1)
+#define DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT	(0x1 << 2)
+#define DRM_XE_VM_CREATE_FLAG_FAULT_MODE	(0x1 << 3)
 	/** @flags: Flags */
 	__u32 flags;
 
@@ -924,11 +924,11 @@ struct drm_xe_sync {
 	/** @extensions: Pointer to the first extension struct, if any */
 	__u64 extensions;
 
-#define DRM_XE_SYNC_SYNCOBJ		0x0
-#define DRM_XE_SYNC_TIMELINE_SYNCOBJ	0x1
-#define DRM_XE_SYNC_DMA_BUF		0x2
-#define DRM_XE_SYNC_USER_FENCE		0x3
-#define DRM_XE_SYNC_SIGNAL		0x10
+#define DRM_XE_SYNC_FLAG_SYNCOBJ		0x0
+#define DRM_XE_SYNC_FLAG_TIMELINE_SYNCOBJ	0x1
+#define DRM_XE_SYNC_FLAG_DMA_BUF		0x2
+#define DRM_XE_SYNC_FLAG_USER_FENCE		0x3
+#define DRM_XE_SYNC_FLAG_SIGNAL		0x10
 	__u32 flags;
 
 	/** @pad: MBZ */
@@ -1014,8 +1014,8 @@ struct drm_xe_wait_user_fence {
 	/** @op: wait operation (type of comparison) */
 	__u16 op;
 
-#define DRM_XE_UFENCE_WAIT_SOFT_OP	(1 << 0)	/* e.g. Wait on VM bind */
-#define DRM_XE_UFENCE_WAIT_ABSTIME	(1 << 1)
+#define DRM_XE_UFENCE_WAIT_FLAG_SOFT_OP	(1 << 0)	/* e.g. Wait on VM bind */
+#define DRM_XE_UFENCE_WAIT_FLAG_ABSTIME	(1 << 1)
 	/** @flags: wait flags */
 	__u16 flags;
 
@@ -1033,10 +1033,10 @@ struct drm_xe_wait_user_fence {
 	__u64 mask;
 	/**
 	 * @timeout: how long to wait before bailing, value in nanoseconds.
-	 * Without DRM_XE_UFENCE_WAIT_ABSTIME flag set (relative timeout)
+	 * Without DRM_XE_UFENCE_WAIT_FLAG_ABSTIME flag set (relative timeout)
 	 * it contains timeout expressed in nanoseconds to wait (fence will
 	 * expire at now() + timeout).
-	 * When DRM_XE_UFENCE_WAIT_ABSTIME flat is set (absolute timeout) wait
+	 * When DRM_XE_UFENCE_WAIT_FLAG_ABSTIME flat is set (absolute timeout) wait
 	 * will end at timeout (uses system MONOTONIC_CLOCK).
 	 * Passing negative timeout leads to neverending wait.
 	 *
@@ -1049,13 +1049,13 @@ struct drm_xe_wait_user_fence {
 
 	/**
 	 * @num_engines: number of engine instances to wait on, must be zero
-	 * when DRM_XE_UFENCE_WAIT_SOFT_OP set
+	 * when DRM_XE_UFENCE_WAIT_FLAG_SOFT_OP set
 	 */
 	__u64 num_engines;
 
 	/**
 	 * @instances: user pointer to array of drm_xe_engine_class_instance to
-	 * wait on, must be NULL when DRM_XE_UFENCE_WAIT_SOFT_OP set
+	 * wait on, must be NULL when DRM_XE_UFENCE_WAIT_FLAG_SOFT_OP set
 	 */
 	__u64 instances;
 
lib/igt_fb.c +1 -1
index e531a041e..e70d2e3ce 100644
@@ -2892,7 +2892,7 @@ static void blitcopy(const struct igt_fb *dst_fb,
 							  &bb_size,
 							  mem_region) == 0);
 	} else if (is_xe) {
-		vm = xe_vm_create(dst_fb->fd, DRM_XE_VM_CREATE_ASYNC_DEFAULT, 0);
+		vm = xe_vm_create(dst_fb->fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
 		exec_queue = xe_exec_queue_create(dst_fb->fd, vm, &inst, 0);
 		xe_ctx = intel_ctx_xe(dst_fb->fd, vm, exec_queue, 0, 0, 0);
 		mem_region = vram_if_possible(dst_fb->fd, 0);
lib/intel_batchbuffer.c +6 -6
index eb47ede50..b59c490db 100644
@@ -953,7 +953,7 @@ __intel_bb_create(int fd, uint32_t ctx, uint32_t vm, const intel_ctx_cfg_t *cfg,
 
 		if (!vm) {
 			igt_assert_f(!ctx, "No vm provided for engine");
-			vm = xe_vm_create(fd, DRM_XE_VM_CREATE_ASYNC_DEFAULT, 0);
+			vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
 		}
 
 		ibb->uses_full_ppgtt = true;
@@ -1315,8 +1315,8 @@ static struct drm_xe_vm_bind_op *xe_alloc_bind_ops(struct intel_bb *ibb,
 static void __unbind_xe_objects(struct intel_bb *ibb)
 {
 	struct drm_xe_sync syncs[2] = {
-		{ .flags = DRM_XE_SYNC_SYNCOBJ },
-		{ .flags = DRM_XE_SYNC_SYNCOBJ | DRM_XE_SYNC_SIGNAL, },
+		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ },
+		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
 	};
 	int ret;
 
@@ -2302,8 +2302,8 @@ __xe_bb_exec(struct intel_bb *ibb, uint64_t flags, bool sync)
 	uint32_t engine = flags & (I915_EXEC_BSD_MASK | I915_EXEC_RING_MASK);
 	uint32_t engine_id;
 	struct drm_xe_sync syncs[2] = {
-		{ .flags = DRM_XE_SYNC_SYNCOBJ | DRM_XE_SYNC_SIGNAL, },
-		{ .flags = DRM_XE_SYNC_SYNCOBJ | DRM_XE_SYNC_SIGNAL, },
+		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
+		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
 	};
 	struct drm_xe_vm_bind_op *bind_ops;
 	void *map;
@@ -2371,7 +2371,7 @@ __xe_bb_exec(struct intel_bb *ibb, uint64_t flags, bool sync)
 	}
 	ibb->xe_bound = true;
 
-	syncs[0].flags &= ~DRM_XE_SYNC_SIGNAL;
+	syncs[0].flags &= ~DRM_XE_SYNC_FLAG_SIGNAL;
 	ibb->engine_syncobj = syncobj_create(ibb->fd, 0);
 	syncs[1].handle = ibb->engine_syncobj;
 
lib/intel_compute.c +3 -3
index 7f1ea90e7..7cb0f001c 100644
@@ -80,7 +80,7 @@ static void bo_execenv_create(int fd, struct bo_execenv *execenv)
 		else
 			engine_class = DRM_XE_ENGINE_CLASS_COMPUTE;
 
-		execenv->vm = xe_vm_create(fd, DRM_XE_VM_CREATE_ASYNC_DEFAULT, 0);
+		execenv->vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
 		execenv->exec_queue = xe_exec_queue_create_class(fd, execenv->vm,
 								 engine_class);
 	}
@@ -106,7 +106,7 @@ static void bo_execenv_bind(struct bo_execenv *execenv,
 		uint64_t alignment = xe_get_default_alignment(fd);
 		struct drm_xe_sync sync = { 0 };
 
-		sync.flags = DRM_XE_SYNC_SYNCOBJ | DRM_XE_SYNC_SIGNAL;
+		sync.flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL;
 		sync.handle = syncobj_create(fd, 0);
 
 		for (int i = 0; i < entries; i++) {
@@ -162,7 +162,7 @@ static void bo_execenv_unbind(struct bo_execenv *execenv,
 		uint32_t vm = execenv->vm;
 		struct drm_xe_sync sync = { 0 };
 
-		sync.flags = DRM_XE_SYNC_SYNCOBJ | DRM_XE_SYNC_SIGNAL;
+		sync.flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL;
 		sync.handle = syncobj_create(fd, 0);
 
 		for (int i = 0; i < entries; i++) {
lib/intel_ctx.c +2 -2
index f927b7df8..f82564572 100644
@@ -423,8 +423,8 @@ intel_ctx_t *intel_ctx_xe(int fd, uint32_t vm, uint32_t exec_queue,
 int __intel_ctx_xe_exec(const intel_ctx_t *ctx, uint64_t ahnd, uint64_t bb_offset)
 {
 	struct drm_xe_sync syncs[2] = {
-		{ .flags = DRM_XE_SYNC_SYNCOBJ, },
-		{ .flags = DRM_XE_SYNC_SYNCOBJ | DRM_XE_SYNC_SIGNAL, },
+		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ, },
+		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
 	};
 	struct drm_xe_exec exec = {
 		.exec_queue_id = ctx->exec_queue,
lib/xe/xe_ioctl.c +3 -3
index 21a85225f..06c3cb782 100644
@@ -399,7 +399,7 @@ void xe_exec_sync(int fd, uint32_t exec_queue, uint64_t addr,
 void xe_exec_wait(int fd, uint32_t exec_queue, uint64_t addr)
 {
 	struct drm_xe_sync sync = {
-		.flags = DRM_XE_SYNC_SYNCOBJ | DRM_XE_SYNC_SIGNAL,
+		.flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL,
 		.handle = syncobj_create(fd, 0),
 	};
 
@@ -416,7 +416,7 @@ int64_t xe_wait_ufence(int fd, uint64_t *addr, uint64_t value,
 	struct drm_xe_wait_user_fence wait = {
 		.addr = to_user_pointer(addr),
 		.op = DRM_XE_UFENCE_WAIT_EQ,
-		.flags = !eci ? DRM_XE_UFENCE_WAIT_SOFT_OP : 0,
+		.flags = !eci ? DRM_XE_UFENCE_WAIT_FLAG_SOFT_OP : 0,
 		.value = value,
 		.mask = DRM_XE_UFENCE_WAIT_U64,
 		.timeout = timeout,
@@ -448,7 +448,7 @@ int64_t xe_wait_ufence_abstime(int fd, uint64_t *addr, uint64_t value,
 	struct drm_xe_wait_user_fence wait = {
 		.addr = to_user_pointer(addr),
 		.op = DRM_XE_UFENCE_WAIT_EQ,
-		.flags = !eci ? DRM_XE_UFENCE_WAIT_SOFT_OP | DRM_XE_UFENCE_WAIT_ABSTIME : 0,
+		.flags = !eci ? DRM_XE_UFENCE_WAIT_FLAG_SOFT_OP | DRM_XE_UFENCE_WAIT_FLAG_ABSTIME : 0,
 		.value = value,
 		.mask = DRM_XE_UFENCE_WAIT_U64,
 		.timeout = timeout,
lib/xe/xe_query.c +2 -2
index 0fa21465b..9f1ab0cd9 100644
@@ -316,8 +316,8 @@ bool xe_supports_faults(int fd)
 	bool supports_faults;
 
 	struct drm_xe_vm_create create = {
-		.flags = DRM_XE_VM_CREATE_ASYNC_DEFAULT |
-			 DRM_XE_VM_CREATE_FAULT_MODE,
+		.flags = DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT |
+			 DRM_XE_VM_CREATE_FLAG_FAULT_MODE,
 	};
 
 	supports_faults = !igt_ioctl(fd, DRM_IOCTL_XE_VM_CREATE, &create);
lib/xe/xe_spin.c +2 -2
index b05b38829..cfc663acc 100644
@@ -191,7 +191,7 @@ xe_spin_create(int fd, const struct igt_spin_factory *opt)
 	struct igt_spin *spin;
 	struct xe_spin *xe_spin;
 	struct drm_xe_sync sync = {
-		.flags = DRM_XE_SYNC_SYNCOBJ | DRM_XE_SYNC_SIGNAL,
+		.flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL,
 	};
 	struct drm_xe_exec exec = {
 		.num_batch_buffer = 1,
@@ -288,7 +288,7 @@ void xe_cork_init(int fd, struct drm_xe_engine_class_instance *hwe,
 	uint32_t vm, bo, exec_queue, syncobj;
 	struct xe_spin *spin;
 	struct drm_xe_sync sync = {
-		.flags = DRM_XE_SYNC_SYNCOBJ | DRM_XE_SYNC_SIGNAL,
+		.flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL,
 	};
 	struct drm_xe_exec exec = {
 		.num_batch_buffer = 1,
lib/xe/xe_util.c +2 -2
index 780125f92..2635edf72 100644
@@ -179,8 +179,8 @@ void xe_bind_unbind_async(int xe, uint32_t vm, uint32_t bind_engine,
 {
 	struct drm_xe_vm_bind_op *bind_ops;
 	struct drm_xe_sync tabsyncs[2] = {
-		{ .flags = DRM_XE_SYNC_SYNCOBJ, .handle = sync_in },
-		{ .flags = DRM_XE_SYNC_SYNCOBJ | DRM_XE_SYNC_SIGNAL, .handle = sync_out },
+		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ, .handle = sync_in },
+		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, .handle = sync_out },
 	};
 	struct drm_xe_sync *syncs;
 	uint32_t num_binds = 0;
tests/intel/xe_ccs.c +2 -2
index bb844b641..465f67e23 100644
@@ -343,7 +343,7 @@ static void block_copy(int xe,
 		uint32_t vm, exec_queue;
 
 		if (config->new_ctx) {
-			vm = xe_vm_create(xe, DRM_XE_VM_CREATE_ASYNC_DEFAULT, 0);
+			vm = xe_vm_create(xe, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
 			exec_queue = xe_exec_queue_create(xe, vm, &inst, 0);
 			surf_ctx = intel_ctx_xe(xe, vm, exec_queue, 0, 0, 0);
 			surf_ahnd = intel_allocator_open(xe, surf_ctx->vm,
@@ -550,7 +550,7 @@ static void block_copy_test(int xe,
 				      copyfns[copy_function].suffix) {
 				uint32_t sync_bind, sync_out;
 
-				vm = xe_vm_create(xe, DRM_XE_VM_CREATE_ASYNC_DEFAULT, 0);
+				vm = xe_vm_create(xe, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
 				exec_queue = xe_exec_queue_create(xe, vm, &inst, 0);
 				sync_bind = syncobj_create(xe, 0);
 				sync_out = syncobj_create(xe, 0);
tests/intel/xe_copy_basic.c +1 -1
index 1dafbb276..191c29155 100644
@@ -134,7 +134,7 @@ static void copy_test(int fd, uint32_t size, enum blt_cmd_type cmd, uint32_t reg
 
 	src_handle = xe_bo_create_flags(fd, 0, bo_size, region);
 	dst_handle = xe_bo_create_flags(fd, 0, bo_size, region);
-	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_ASYNC_DEFAULT, 0);
+	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
 	exec_queue = xe_exec_queue_create(fd, vm, &inst, 0);
 	ctx = intel_ctx_xe(fd, vm, exec_queue, 0, 0, 0);
 
tests/intel/xe_create.c +3 -3
index d99bd51cf..4242e1a67 100644
@@ -54,7 +54,7 @@ static void create_invalid_size(int fd)
 	uint32_t handle;
 	int ret;
 
-	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_ASYNC_DEFAULT, 0);
+	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
 
 	xe_for_each_mem_region(fd, memreg, region) {
 		memregion = xe_mem_region(fd, region);
@@ -140,7 +140,7 @@ static void create_execqueues(int fd, enum exec_queue_destroy ed)
 
 	fd = drm_reopen_driver(fd);
 	num_engines = xe_number_hw_engines(fd);
-	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_ASYNC_DEFAULT, 0);
+	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
 
 	exec_queues_per_process = max_t(uint32_t, 1, MAXEXECQUEUES / nproc);
 	igt_debug("nproc: %u, exec_queues per process: %u\n", nproc, exec_queues_per_process);
@@ -199,7 +199,7 @@ static void create_massive_size(int fd)
 	uint32_t handle;
 	int ret;
 
-	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_ASYNC_DEFAULT, 0);
+	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
 
 	xe_for_each_mem_region(fd, memreg, region) {
 		ret = __create_bo(fd, vm, -1ULL << 32, region, &handle);
tests/intel/xe_dma_buf_sync.c +2 -2
index 5c401b6dd..0d835dddb 100644
@@ -144,8 +144,8 @@ test_export_dma_buf(struct drm_xe_engine_class_instance *hwe0,
 		uint64_t sdi_addr = addr + sdi_offset;
 		uint64_t spin_offset = (char *)&data[i]->spin - (char *)data[i];
 		struct drm_xe_sync sync[2] = {
-			{ .flags = DRM_XE_SYNC_SYNCOBJ, },
-			{ .flags = DRM_XE_SYNC_SYNCOBJ | DRM_XE_SYNC_SIGNAL, },
+			{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ, },
+			{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
 		};
 		struct drm_xe_exec exec = {
 			.num_batch_buffer = 1,
tests/intel/xe_drm_fdinfo.c +9 -9
index 64168ed19..4ef30cf49 100644
@@ -48,8 +48,8 @@ static void test_active(int fd, struct drm_xe_engine_class_instance *eci)
 	uint32_t vm;
 	uint64_t addr = 0x1a0000;
 	struct drm_xe_sync sync[2] = {
-		{ .flags = DRM_XE_SYNC_SYNCOBJ | DRM_XE_SYNC_SIGNAL, },
-		{ .flags = DRM_XE_SYNC_SYNCOBJ | DRM_XE_SYNC_SIGNAL, },
+		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
+		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
 	};
 	struct drm_xe_exec exec = {
 		.num_batch_buffer = 1,
@@ -71,7 +71,7 @@ static void test_active(int fd, struct drm_xe_engine_class_instance *eci)
 	struct xe_spin_opts spin_opts = { .preempt = true };
 	int i, b, ret;
 
-	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_ASYNC_DEFAULT, 0);
+	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
 	bo_size = sizeof(*data) * N_EXEC_QUEUES;
 	bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd),
 			xe_get_default_alignment(fd));
@@ -110,20 +110,20 @@ static void test_active(int fd, struct drm_xe_engine_class_instance *eci)
 				xe_spin_init(&data[i].spin, &spin_opts);
 				exec.exec_queue_id = exec_queues[e];
 				exec.address = spin_opts.addr;
-				sync[0].flags &= ~DRM_XE_SYNC_SIGNAL;
-				sync[1].flags |= DRM_XE_SYNC_SIGNAL;
+				sync[0].flags &= ~DRM_XE_SYNC_FLAG_SIGNAL;
+				sync[1].flags |= DRM_XE_SYNC_FLAG_SIGNAL;
 				sync[1].handle = syncobjs[e];
 				xe_exec(fd, &exec);
 				xe_spin_wait_started(&data[i].spin);
 
 				addr += bo_size;
-				sync[1].flags &= ~DRM_XE_SYNC_SIGNAL;
+				sync[1].flags &= ~DRM_XE_SYNC_FLAG_SIGNAL;
 				sync[1].handle = syncobjs[e];
 				xe_vm_bind_async(fd, vm, bind_exec_queues[e], bo, 0, addr,
 						 bo_size, sync + 1, 1);
 				addr += bo_size;
 			} else {
-				sync[0].flags |= DRM_XE_SYNC_SIGNAL;
+				sync[0].flags |= DRM_XE_SYNC_FLAG_SIGNAL;
 				xe_vm_bind_async(fd, vm, bind_exec_queues[e], bo, 0, addr,
 						 bo_size, sync, 1);
 			}
@@ -149,7 +149,7 @@ static void test_active(int fd, struct drm_xe_engine_class_instance *eci)
 
 		syncobj_destroy(fd, sync[0].handle);
 		sync[0].handle = syncobj_create(fd, 0);
-		sync[0].flags |= DRM_XE_SYNC_SIGNAL;
+		sync[0].flags |= DRM_XE_SYNC_FLAG_SIGNAL;
 		xe_vm_unbind_all_async(fd, vm, 0, bo, sync, 1);
 		igt_assert(syncobj_wait(fd, &sync[0].handle, 1, INT64_MAX, 0, NULL));
 
@@ -221,7 +221,7 @@ static void test_total_resident(int xe)
 	uint64_t addr = 0x1a0000;
 	int ret;
 
-	vm = xe_vm_create(xe, DRM_XE_VM_CREATE_SCRATCH_PAGE, 0);
+	vm = xe_vm_create(xe, DRM_XE_VM_CREATE_FLAG_SCRATCH_PAGE, 0);
 
 	xe_for_each_mem_region(xe, memreg, region) {
 		uint64_t pre_size;
tests/intel/xe_evict.c +12 -12
index 5d8463270..6d953e58b 100644
@@ -38,8 +38,8 @@ test_evict(int fd, struct drm_xe_engine_class_instance *eci,
 	uint32_t bind_exec_queues[3] = { 0, 0, 0 };
 	uint64_t addr = 0x100000000, base_addr = 0x100000000;
 	struct drm_xe_sync sync[2] = {
-		{ .flags = DRM_XE_SYNC_SYNCOBJ | DRM_XE_SYNC_SIGNAL, },
-		{ .flags = DRM_XE_SYNC_SYNCOBJ | DRM_XE_SYNC_SIGNAL, },
+		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
+		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
 	};
 	struct drm_xe_exec exec = {
 		.num_batch_buffer = 1,
@@ -63,12 +63,12 @@ test_evict(int fd, struct drm_xe_engine_class_instance *eci,
 
 	fd = drm_open_driver(DRIVER_XE);
 
-	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_ASYNC_DEFAULT, 0);
+	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
 	if (flags & BIND_EXEC_QUEUE)
 		bind_exec_queues[0] = xe_bind_exec_queue_create(fd, vm, 0, true);
 	if (flags & MULTI_VM) {
-		vm2 = xe_vm_create(fd, DRM_XE_VM_CREATE_ASYNC_DEFAULT, 0);
-		vm3 = xe_vm_create(fd, DRM_XE_VM_CREATE_ASYNC_DEFAULT, 0);
+		vm2 = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
+		vm3 = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
 		if (flags & BIND_EXEC_QUEUE) {
 			bind_exec_queues[1] = xe_bind_exec_queue_create(fd, vm2,
 									0, true);
@@ -121,7 +121,7 @@ test_evict(int fd, struct drm_xe_engine_class_instance *eci,
 				 ALIGN(sizeof(*data) * n_execs, 0x1000));
 
 		if (i < n_execs / 2) {
-			sync[0].flags |= DRM_XE_SYNC_SIGNAL;
+			sync[0].flags |= DRM_XE_SYNC_FLAG_SIGNAL;
 			sync[0].handle = syncobj_create(fd, 0);
 			if (flags & MULTI_VM) {
 				xe_vm_bind_async(fd, vm3, bind_exec_queues[2], __bo,
@@ -149,7 +149,7 @@ test_evict(int fd, struct drm_xe_engine_class_instance *eci,
 		data[i].batch[b++] = MI_BATCH_BUFFER_END;
 		igt_assert(b <= ARRAY_SIZE(data[i].batch));
 
-		sync[0].flags &= ~DRM_XE_SYNC_SIGNAL;
+		sync[0].flags &= ~DRM_XE_SYNC_FLAG_SIGNAL;
 		if (i >= n_exec_queues)
 			syncobj_reset(fd, &syncobjs[e], 1);
 		sync[1].handle = syncobjs[e];
@@ -216,7 +216,7 @@ test_evict_cm(int fd, struct drm_xe_engine_class_instance *eci,
 	uint64_t addr = 0x100000000, base_addr = 0x100000000;
 #define USER_FENCE_VALUE	0xdeadbeefdeadbeefull
 	struct drm_xe_sync sync[1] = {
-		{ .flags = DRM_XE_SYNC_USER_FENCE | DRM_XE_SYNC_SIGNAL,
+		{ .flags = DRM_XE_SYNC_FLAG_USER_FENCE | DRM_XE_SYNC_FLAG_SIGNAL,
 		  .timeline_value = USER_FENCE_VALUE },
 	};
 	struct drm_xe_exec exec = {
@@ -242,13 +242,13 @@ test_evict_cm(int fd, struct drm_xe_engine_class_instance *eci,
 
 	fd = drm_open_driver(DRIVER_XE);
 
-	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_ASYNC_DEFAULT |
-			  DRM_XE_VM_CREATE_COMPUTE_MODE, 0);
+	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT |
+			  DRM_XE_VM_CREATE_FLAG_COMPUTE_MODE, 0);
 	if (flags & BIND_EXEC_QUEUE)
 		bind_exec_queues[0] = xe_bind_exec_queue_create(fd, vm, 0, true);
 	if (flags & MULTI_VM) {
-		vm2 = xe_vm_create(fd, DRM_XE_VM_CREATE_ASYNC_DEFAULT |
-				   DRM_XE_VM_CREATE_COMPUTE_MODE, 0);
+		vm2 = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT |
+				   DRM_XE_VM_CREATE_FLAG_COMPUTE_MODE, 0);
 		if (flags & BIND_EXEC_QUEUE)
 			bind_exec_queues[1] = xe_bind_exec_queue_create(fd, vm2,
 									0, true);
tests/intel/xe_evict_ccs.c +1 -1
index 4f2876ecb..1f5c795ef 100644
@@ -226,7 +226,7 @@ static void evict_single(int fd, int child, const struct config *config)
 	uint32_t kb_left = config->mb_per_proc * SZ_1K;
 	uint32_t min_alloc_kb = config->param->min_size_kb;
 	uint32_t max_alloc_kb = config->param->max_size_kb;
-	uint32_t vm = xe_vm_create(fd, DRM_XE_VM_CREATE_ASYNC_DEFAULT, 0);
+	uint32_t vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
 	uint64_t ahnd = intel_allocator_open(fd, vm, INTEL_ALLOCATOR_RELOC);
 	uint8_t uc_mocs = intel_get_uc_mocs_index(fd);
 	struct object *obj, *tmp;
tests/intel/xe_exec_balancer.c +17 -17
index 3ca3de881..8a0165b8c 100644
@@ -37,8 +37,8 @@ static void test_all_active(int fd, int gt, int class)
 	uint32_t vm;
 	uint64_t addr = 0x1a0000;
 	struct drm_xe_sync sync[2] = {
-		{ .flags = DRM_XE_SYNC_SYNCOBJ | DRM_XE_SYNC_SIGNAL, },
-		{ .flags = DRM_XE_SYNC_SYNCOBJ | DRM_XE_SYNC_SIGNAL, },
+		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
+		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
 	};
 	struct drm_xe_exec exec = {
 		.num_batch_buffer = 1,
@@ -66,7 +66,7 @@ static void test_all_active(int fd, int gt, int class)
 	if (num_placements < 2)
 		return;
 
-	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_ASYNC_DEFAULT, 0);
+	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
 	bo_size = sizeof(*data) * num_placements;
 	bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd), xe_get_default_alignment(fd));
 
@@ -93,8 +93,8 @@ static void test_all_active(int fd, int gt, int class)
 	for (i = 0; i < num_placements; i++) {
 		spin_opts.addr = addr + (char *)&data[i].spin - (char *)data;
 		xe_spin_init(&data[i].spin, &spin_opts);
-		sync[0].flags &= ~DRM_XE_SYNC_SIGNAL;
-		sync[1].flags |= DRM_XE_SYNC_SIGNAL;
+		sync[0].flags &= ~DRM_XE_SYNC_FLAG_SIGNAL;
+		sync[1].flags |= DRM_XE_SYNC_FLAG_SIGNAL;
 		sync[1].handle = syncobjs[i];
 
 		exec.exec_queue_id = exec_queues[i];
@@ -110,7 +110,7 @@ static void test_all_active(int fd, int gt, int class)
 	}
 	igt_assert(syncobj_wait(fd, &sync[0].handle, 1, INT64_MAX, 0, NULL));
 
-	sync[0].flags |= DRM_XE_SYNC_SIGNAL;
+	sync[0].flags |= DRM_XE_SYNC_FLAG_SIGNAL;
 	xe_vm_unbind_async(fd, vm, 0, 0, addr, bo_size, sync, 1);
 	igt_assert(syncobj_wait(fd, &sync[0].handle, 1, INT64_MAX, 0, NULL));
 
@@ -176,8 +176,8 @@ test_exec(int fd, int gt, int class, int n_exec_queues, int n_execs,
 	uint32_t vm;
 	uint64_t addr = 0x1a0000;
 	struct drm_xe_sync sync[2] = {
-		{ .flags = DRM_XE_SYNC_SYNCOBJ | DRM_XE_SYNC_SIGNAL, },
-		{ .flags = DRM_XE_SYNC_SYNCOBJ | DRM_XE_SYNC_SIGNAL, },
+		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
+		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
 	};
 	struct drm_xe_exec exec = {
 		.num_syncs = 2,
@@ -207,7 +207,7 @@ test_exec(int fd, int gt, int class, int n_exec_queues, int n_execs,
 	if (num_placements < 2)
 		return;
 
-	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_ASYNC_DEFAULT, 0);
+	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
 	bo_size = sizeof(*data) * n_execs;
 	bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd), xe_get_default_alignment(fd));
 
@@ -269,8 +269,8 @@ test_exec(int fd, int gt, int class, int n_exec_queues, int n_execs,
 		data[i].batch[b++] = MI_BATCH_BUFFER_END;
 		igt_assert(b <= ARRAY_SIZE(data[i].batch));
 
-		sync[0].flags &= ~DRM_XE_SYNC_SIGNAL;
-		sync[1].flags |= DRM_XE_SYNC_SIGNAL;
+		sync[0].flags &= ~DRM_XE_SYNC_FLAG_SIGNAL;
+		sync[1].flags |= DRM_XE_SYNC_FLAG_SIGNAL;
 		sync[1].handle = syncobjs[e];
 
 		exec.exec_queue_id = exec_queues[e];
@@ -281,11 +281,11 @@ test_exec(int fd, int gt, int class, int n_exec_queues, int n_execs,
 		xe_exec(fd, &exec);
 
 		if (flags & REBIND && i + 1 != n_execs) {
-			sync[1].flags &= ~DRM_XE_SYNC_SIGNAL;
+			sync[1].flags &= ~DRM_XE_SYNC_FLAG_SIGNAL;
 			xe_vm_unbind_async(fd, vm, 0, 0, addr, bo_size,
 					   sync + 1, 1);
 
-			sync[0].flags |= DRM_XE_SYNC_SIGNAL;
+			sync[0].flags |= DRM_XE_SYNC_FLAG_SIGNAL;
 			addr += bo_size;
 			if (bo)
 				xe_vm_bind_async(fd, vm, 0, bo, 0, addr,
@@ -329,7 +329,7 @@ test_exec(int fd, int gt, int class, int n_exec_queues, int n_execs,
 					NULL));
 	igt_assert(syncobj_wait(fd, &sync[0].handle, 1, INT64_MAX, 0, NULL));
 
-	sync[0].flags |= DRM_XE_SYNC_SIGNAL;
+	sync[0].flags |= DRM_XE_SYNC_FLAG_SIGNAL;
 	xe_vm_unbind_async(fd, vm, 0, 0, addr, bo_size, sync, 1);
 	igt_assert(syncobj_wait(fd, &sync[0].handle, 1, INT64_MAX, 0, NULL));
 
@@ -399,7 +399,7 @@ test_cm(int fd, int gt, int class, int n_exec_queues, int n_execs,
 	uint64_t addr = 0x1a0000;
 #define USER_FENCE_VALUE	0xdeadbeefdeadbeefull
 	struct drm_xe_sync sync[1] = {
-		{ .flags = DRM_XE_SYNC_USER_FENCE | DRM_XE_SYNC_SIGNAL,
+		{ .flags = DRM_XE_SYNC_FLAG_USER_FENCE | DRM_XE_SYNC_FLAG_SIGNAL,
 	          .timeline_value = USER_FENCE_VALUE },
 	};
 	struct drm_xe_exec exec = {
@@ -433,8 +433,8 @@ test_cm(int fd, int gt, int class, int n_exec_queues, int n_execs,
 	if (num_placements < 2)
 		return;
 
-	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_ASYNC_DEFAULT |
-			  DRM_XE_VM_CREATE_COMPUTE_MODE, 0);
+	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT |
+			  DRM_XE_VM_CREATE_FLAG_COMPUTE_MODE, 0);
 	bo_size = sizeof(*data) * n_execs;
 	bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd),
 			xe_get_default_alignment(fd));
tests/intel/xe_exec_basic.c +8 -8
index 232ddde8e..a401f0165 100644
@@ -81,8 +81,8 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 	  int n_exec_queues, int n_execs, int n_vm, unsigned int flags)
 {
 	struct drm_xe_sync sync[2] = {
-		{ .flags = DRM_XE_SYNC_SYNCOBJ | DRM_XE_SYNC_SIGNAL, },
-		{ .flags = DRM_XE_SYNC_SYNCOBJ | DRM_XE_SYNC_SIGNAL, },
+		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
+		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
 	};
 	struct drm_xe_exec exec = {
 		.num_batch_buffer = 1,
@@ -109,7 +109,7 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 	igt_assert(n_vm <= MAX_N_EXEC_QUEUES);
 
 	for (i = 0; i < n_vm; ++i)
-		vm[i] = xe_vm_create(fd, DRM_XE_VM_CREATE_ASYNC_DEFAULT, 0);
+		vm[i] = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
 	bo_size = sizeof(*data) * n_execs;
 	bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd),
 			xe_get_default_alignment(fd));
@@ -199,9 +199,9 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 		data[i].batch[b++] = MI_BATCH_BUFFER_END;
 		igt_assert(b <= ARRAY_SIZE(data[i].batch));
 
-		sync[0].flags &= ~DRM_XE_SYNC_SIGNAL;
+		sync[0].flags &= ~DRM_XE_SYNC_FLAG_SIGNAL;
 		sync[0].handle = bind_syncobjs[cur_vm];
-		sync[1].flags |= DRM_XE_SYNC_SIGNAL;
+		sync[1].flags |= DRM_XE_SYNC_FLAG_SIGNAL;
 		sync[1].handle = syncobjs[e];
 
 		exec.exec_queue_id = exec_queues[e];
@@ -213,11 +213,11 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 		if (flags & REBIND && i + 1 != n_execs) {
 			uint32_t __vm = vm[cur_vm];
 
-			sync[1].flags &= ~DRM_XE_SYNC_SIGNAL;
+			sync[1].flags &= ~DRM_XE_SYNC_FLAG_SIGNAL;
 			xe_vm_unbind_async(fd, __vm, bind_exec_queues[e], 0,
 					   __addr, bo_size, sync + 1, 1);
 
-			sync[0].flags |= DRM_XE_SYNC_SIGNAL;
+			sync[0].flags |= DRM_XE_SYNC_FLAG_SIGNAL;
 			addr[i % n_vm] += bo_size;
 			__addr = addr[i % n_vm];
 			if (bo)
@@ -266,7 +266,7 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 		igt_assert(syncobj_wait(fd, &bind_syncobjs[i], 1, INT64_MAX, 0,
 					NULL));
 
-	sync[0].flags |= DRM_XE_SYNC_SIGNAL;
+	sync[0].flags |= DRM_XE_SYNC_FLAG_SIGNAL;
 	for (i = 0; i < n_vm; ++i) {
 		syncobj_reset(fd, &sync[0].handle, 1);
 		xe_vm_unbind_async(fd, vm[i], bind_exec_queues[i], 0, addr[i],
tests/intel/xe_exec_compute_mode.c +3 -3
index b0a677dca..20d3fc6e8 100644
@@ -88,7 +88,7 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 	uint64_t addr = 0x1a0000;
 #define USER_FENCE_VALUE	0xdeadbeefdeadbeefull
 	struct drm_xe_sync sync[1] = {
-		{ .flags = DRM_XE_SYNC_USER_FENCE | DRM_XE_SYNC_SIGNAL,
+		{ .flags = DRM_XE_SYNC_FLAG_USER_FENCE | DRM_XE_SYNC_FLAG_SIGNAL,
 	          .timeline_value = USER_FENCE_VALUE },
 	};
 	struct drm_xe_exec exec = {
@@ -113,8 +113,8 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 
 	igt_assert(n_exec_queues <= MAX_N_EXECQUEUES);
 
-	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_ASYNC_DEFAULT |
-			  DRM_XE_VM_CREATE_COMPUTE_MODE, 0);
+	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT |
+			  DRM_XE_VM_CREATE_FLAG_COMPUTE_MODE, 0);
 	bo_size = sizeof(*data) * n_execs;
 	bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd),
 			xe_get_default_alignment(fd));
tests/intel/xe_exec_fault_mode.c +7 -7
index 92359d1a7..b66f31419 100644
@@ -8,7 +8,7 @@
  * Category: Hardware building block
  * Sub-category: execbuf
  * Functionality: fault mode
- * GPU requirements: GPU needs support for DRM_XE_VM_CREATE_FAULT_MODE
+ * GPU requirements: GPU needs support for DRM_XE_VM_CREATE_FLAG_FAULT_MODE
  */
 
 #include <fcntl.h>
@@ -107,7 +107,7 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 	uint64_t addr = 0x1a0000;
 #define USER_FENCE_VALUE	0xdeadbeefdeadbeefull
 	struct drm_xe_sync sync[1] = {
-		{ .flags = DRM_XE_SYNC_USER_FENCE | DRM_XE_SYNC_SIGNAL,
+		{ .flags = DRM_XE_SYNC_FLAG_USER_FENCE | DRM_XE_SYNC_FLAG_SIGNAL,
 	          .timeline_value = USER_FENCE_VALUE },
 	};
 	struct drm_xe_exec exec = {
@@ -131,8 +131,8 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 
 	igt_assert(n_exec_queues <= MAX_N_EXEC_QUEUES);
 
-	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_ASYNC_DEFAULT |
-			  DRM_XE_VM_CREATE_FAULT_MODE, 0);
+	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT |
+			  DRM_XE_VM_CREATE_FLAG_FAULT_MODE, 0);
 	bo_size = sizeof(*data) * n_execs;
 	bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd),
 			xe_get_default_alignment(fd));
@@ -347,7 +347,7 @@ test_atomic(int fd, struct drm_xe_engine_class_instance *eci,
 	uint64_t addr = 0x1a0000, addr_wait;
 #define USER_FENCE_VALUE	0xdeadbeefdeadbeefull
 	struct drm_xe_sync sync[1] = {
-		{ .flags = DRM_XE_SYNC_USER_FENCE | DRM_XE_SYNC_SIGNAL,
+		{ .flags = DRM_XE_SYNC_FLAG_USER_FENCE | DRM_XE_SYNC_FLAG_SIGNAL,
 	          .timeline_value = USER_FENCE_VALUE },
 	};
 	struct drm_xe_exec exec = {
@@ -375,8 +375,8 @@ test_atomic(int fd, struct drm_xe_engine_class_instance *eci,
 	uint32_t *ptr;
 	int i, b, wait_idx = 0;
 
-	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_ASYNC_DEFAULT |
-			  DRM_XE_VM_CREATE_FAULT_MODE, 0);
+	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT |
+			  DRM_XE_VM_CREATE_FLAG_FAULT_MODE, 0);
 	bo_size = sizeof(*data) * n_atomic;
 	bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd),
 			xe_get_default_alignment(fd));
tests/intel/xe_exec_reset.c +21 -21

126 lines not on this page · raw message

tests/intel/xe_exec_store.c +13 -13
index 4ca76b43a..9c14bfd14 100644
@@ -55,7 +55,7 @@ static void store_dword_batch(struct data *data, uint64_t addr, int value)
 static void store(int fd)
 {
 	struct drm_xe_sync sync = {
-		.flags = DRM_XE_SYNC_SYNCOBJ | DRM_XE_SYNC_SIGNAL,
+		.flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL,
 	};
 	struct drm_xe_exec exec = {
 		.num_batch_buffer = 1,
@@ -75,7 +75,7 @@ static void store(int fd)
 	syncobj = syncobj_create(fd, 0);
 	sync.handle = syncobj;
 
-	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_ASYNC_DEFAULT, 0);
+	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
 	bo_size = sizeof(*data);
 	bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd),
 			xe_get_default_alignment(fd));
@@ -91,7 +91,7 @@ static void store(int fd)
 	exec_queue = xe_exec_queue_create(fd, vm, hw_engine, 0);
 	exec.exec_queue_id = exec_queue;
 	exec.address = data->addr;
-	sync.flags &= DRM_XE_SYNC_SIGNAL;
+	sync.flags &= DRM_XE_SYNC_FLAG_SIGNAL;
 	xe_exec(fd, &exec);
 
 	igt_assert(syncobj_wait(fd, &syncobj, 1, INT64_MAX, 0, NULL));
@@ -121,8 +121,8 @@ static void store_cachelines(int fd, struct drm_xe_engine_class_instance *eci,
 			     unsigned int flags)
 {
 	struct drm_xe_sync sync[2] = {
-		{ .flags = DRM_XE_SYNC_SYNCOBJ | DRM_XE_SYNC_SIGNAL, },
-		{ .flags = DRM_XE_SYNC_SYNCOBJ | DRM_XE_SYNC_SIGNAL, }
+		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
+		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, }
 	};
 
 	struct drm_xe_exec exec = {
@@ -143,7 +143,7 @@ static void store_cachelines(int fd, struct drm_xe_engine_class_instance *eci,
 	size_t bo_size = 4096;
 
 	bo_size = ALIGN(bo_size, xe_get_default_alignment(fd));
-	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_ASYNC_DEFAULT, 0);
+	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
 	ahnd = intel_allocator_open(fd, 0, INTEL_ALLOCATOR_SIMPLE);
 	exec_queues = xe_exec_queue_create(fd, vm, eci, 0);
 	syncobjs = syncobj_create(fd, 0);
@@ -173,8 +173,8 @@ static void store_cachelines(int fd, struct drm_xe_engine_class_instance *eci,
 		batch_map[b++] = value[n];
 	}
 	batch_map[b++] = MI_BATCH_BUFFER_END;
-	sync[0].flags &= DRM_XE_SYNC_SIGNAL;
-	sync[1].flags |= DRM_XE_SYNC_SIGNAL;
+	sync[0].flags &= DRM_XE_SYNC_FLAG_SIGNAL;
+	sync[1].flags |= DRM_XE_SYNC_FLAG_SIGNAL;
 	sync[1].handle = syncobjs;
 	exec.exec_queue_id = exec_queues;
 	xe_exec(fd, &exec);
@@ -210,8 +210,8 @@ static void store_cachelines(int fd, struct drm_xe_engine_class_instance *eci,
 static void store_all(int fd, int gt, int class)
 {
 	struct drm_xe_sync sync[2] = {
-		{ .flags = DRM_XE_SYNC_SYNCOBJ | DRM_XE_SYNC_SIGNAL, },
-		{ .flags = DRM_XE_SYNC_SYNCOBJ | DRM_XE_SYNC_SIGNAL, }
+		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
+		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, }
 	};
 	struct drm_xe_exec exec = {
 		.num_batch_buffer = 1,
@@ -230,7 +230,7 @@ static void store_all(int fd, int gt, int class)
 	struct drm_xe_engine_class_instance *hwe;
 	int i, num_placements = 0;
 
-	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_ASYNC_DEFAULT, 0);
+	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
 	bo_size = sizeof(*data);
 	bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd),
 			xe_get_default_alignment(fd));
@@ -267,8 +267,8 @@ static void store_all(int fd, int gt, int class)
 	for (i = 0; i < num_placements; i++) {
 
 		store_dword_batch(data, addr, i);
-		sync[0].flags &= ~DRM_XE_SYNC_SIGNAL;
-		sync[1].flags |= DRM_XE_SYNC_SIGNAL;
+		sync[0].flags &= ~DRM_XE_SYNC_FLAG_SIGNAL;
+		sync[1].flags |= DRM_XE_SYNC_FLAG_SIGNAL;
 		sync[1].handle = syncobjs[i];
 
 		exec.exec_queue_id = exec_queues[i];
tests/intel/xe_exec_threads.c +22 -22

136 lines not on this page · raw message

tests/intel/xe_exercise_blt.c +1 -1
index df774130f..fd310138d 100644
@@ -280,7 +280,7 @@ static void fast_copy_test(int xe,
 			region1 = igt_collection_get_value(regions, 0);
 			region2 = igt_collection_get_value(regions, 1);
 
-			vm = xe_vm_create(xe, DRM_XE_VM_CREATE_ASYNC_DEFAULT, 0);
+			vm = xe_vm_create(xe, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
 			exec_queue = xe_exec_queue_create(xe, vm, &inst, 0);
 			ctx = intel_ctx_xe(xe, vm, exec_queue, 0, 0, 0);
 
tests/intel/xe_guc_pc.c +6 -6
index 3f2c4ae23..fa2f20cca 100644
@@ -37,8 +37,8 @@ static void exec_basic(int fd, struct drm_xe_engine_class_instance *eci,
 	uint32_t vm;
 	uint64_t addr = 0x1a0000;
 	struct drm_xe_sync sync[2] = {
-		{ .flags = DRM_XE_SYNC_SYNCOBJ | DRM_XE_SYNC_SIGNAL, },
-		{ .flags = DRM_XE_SYNC_SYNCOBJ | DRM_XE_SYNC_SIGNAL, },
+		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
+		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
 	};
 	struct drm_xe_exec exec = {
 		.num_batch_buffer = 1,
@@ -60,7 +60,7 @@ static void exec_basic(int fd, struct drm_xe_engine_class_instance *eci,
 	igt_assert(n_exec_queues <= MAX_N_EXEC_QUEUES);
 	igt_assert(n_execs > 0);
 
-	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_ASYNC_DEFAULT, 0);
+	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
 	bo_size = sizeof(*data) * n_execs;
 	bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd),
 			xe_get_default_alignment(fd));
@@ -95,8 +95,8 @@ static void exec_basic(int fd, struct drm_xe_engine_class_instance *eci,
 		data[i].batch[b++] = MI_BATCH_BUFFER_END;
 		igt_assert(b <= ARRAY_SIZE(data[i].batch));
 
-		sync[0].flags &= ~DRM_XE_SYNC_SIGNAL;
-		sync[1].flags |= DRM_XE_SYNC_SIGNAL;
+		sync[0].flags &= ~DRM_XE_SYNC_FLAG_SIGNAL;
+		sync[1].flags |= DRM_XE_SYNC_FLAG_SIGNAL;
 		sync[1].handle = syncobjs[e];
 
 		exec.exec_queue_id = exec_queues[e];
@@ -114,7 +114,7 @@ static void exec_basic(int fd, struct drm_xe_engine_class_instance *eci,
 
 	igt_assert(syncobj_wait(fd, &sync[0].handle, 1, INT64_MAX, 0, NULL));
 
-	sync[0].flags |= DRM_XE_SYNC_SIGNAL;
+	sync[0].flags |= DRM_XE_SYNC_FLAG_SIGNAL;
 	xe_vm_unbind_async(fd, vm, bind_exec_queues[0], 0, addr,
 			   bo_size, sync, 1);
 	igt_assert(syncobj_wait(fd, &sync[0].handle, 1, INT64_MAX, 0, NULL));
tests/intel/xe_huc_copy.c +2 -2
index 4f5ce2212..eda9e5216 100644
@@ -118,7 +118,7 @@ __test_huc_copy(int fd, uint32_t vm, struct drm_xe_engine_class_instance *hwe)
 	};
 
 	exec_queue = xe_exec_queue_create(fd, vm, hwe, 0);
-	sync.flags = DRM_XE_SYNC_SYNCOBJ | DRM_XE_SYNC_SIGNAL;
+	sync.flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL;
 	sync.handle = syncobj_create(fd, 0);
 
 	for(int i = 0; i < BO_DICT_ENTRIES; i++) {
@@ -156,7 +156,7 @@ test_huc_copy(int fd)
 	uint32_t vm;
 	uint32_t tested_gts = 0;
 
-	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_ASYNC_DEFAULT, 0);
+	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
 
 	xe_for_each_hw_engine(fd, hwe) {
 		if (hwe->engine_class == DRM_XE_ENGINE_CLASS_VIDEO_DECODE &&
tests/intel/xe_intel_bb.c +1 -1
index 26e4dcc85..d66996cd5 100644
@@ -191,7 +191,7 @@ static void simple_bb(struct buf_ops *bops, bool new_context)
 	intel_bb_reset(ibb, true);
 
 	if (new_context) {
-		vm = xe_vm_create(xe, DRM_XE_VM_CREATE_ASYNC_DEFAULT, 0);
+		vm = xe_vm_create(xe, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
 		ctx = xe_exec_queue_create(xe, vm, xe_hw_engine(xe, 0), 0);
 		intel_bb_destroy(ibb);
 		ibb = intel_bb_create_with_context(xe, ctx, vm, NULL, PAGE_SIZE);
tests/intel/xe_noexec_ping_pong.c +1 -1
index 88b22ed11..9c2a70ff3 100644
@@ -64,7 +64,7 @@ static void test_ping_pong(int fd, struct drm_xe_engine_class_instance *eci)
 	 * stats.
 	 */
 	for (i = 0; i < NUM_VMS; ++i) {
-		vm[i] = xe_vm_create(fd, DRM_XE_VM_CREATE_COMPUTE_MODE, 0);
+		vm[i] = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_COMPUTE_MODE, 0);
 		for (j = 0; j < NUM_BOS; ++j) {
 			igt_debug("Creating bo size %lu for vm %u\n",
 				  (unsigned long) bo_size,
tests/intel/xe_perf_pmu.c +12 -12
index a0dd30e50..e9d05cf2b 100644
@@ -81,8 +81,8 @@ static void test_any_engine_busyness(int fd, struct drm_xe_engine_class_instance
 	uint32_t vm;
 	uint64_t addr = 0x1a0000;
 	struct drm_xe_sync sync[2] = {
-		{ .flags = DRM_XE_SYNC_SYNCOBJ | DRM_XE_SYNC_SIGNAL, },
-		{ .flags = DRM_XE_SYNC_SYNCOBJ | DRM_XE_SYNC_SIGNAL, },
+		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
+		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
 	};
 	struct drm_xe_exec exec = {
 		.num_batch_buffer = 1,
@@ -98,7 +98,7 @@ static void test_any_engine_busyness(int fd, struct drm_xe_engine_class_instance
 	uint32_t pmu_fd;
 	uint64_t count, idle;
 
-	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_ASYNC_DEFAULT, 0);
+	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
 	bo_size = sizeof(*spin);
 	bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd),
 			xe_get_default_alignment(fd));
@@ -118,8 +118,8 @@ static void test_any_engine_busyness(int fd, struct drm_xe_engine_class_instance
 
 	xe_spin_init(spin, &spin_opts);
 
-	sync[0].flags &= ~DRM_XE_SYNC_SIGNAL;
-	sync[1].flags |= DRM_XE_SYNC_SIGNAL;
+	sync[0].flags &= ~DRM_XE_SYNC_FLAG_SIGNAL;
+	sync[1].flags |= DRM_XE_SYNC_FLAG_SIGNAL;
 	sync[1].handle = syncobj;
 
 	exec.exec_queue_id = exec_queue;
@@ -135,7 +135,7 @@ static void test_any_engine_busyness(int fd, struct drm_xe_engine_class_instance
 	igt_assert(syncobj_wait(fd, &syncobj, 1, INT64_MAX, 0, NULL));
 	igt_assert(syncobj_wait(fd, &sync[0].handle, 1, INT64_MAX, 0, NULL));
 
-	sync[0].flags |= DRM_XE_SYNC_SIGNAL;
+	sync[0].flags |= DRM_XE_SYNC_FLAG_SIGNAL;
 	xe_vm_unbind_async(fd, vm, 0, 0, addr, bo_size, sync, 1);
 	igt_assert(syncobj_wait(fd, &sync[0].handle, 1, INT64_MAX, 0, NULL));
 
@@ -185,8 +185,8 @@ static void test_engine_group_busyness(int fd, int gt, int class, const char *na
 	uint32_t vm;
 	uint64_t addr = 0x1a0000;
 	struct drm_xe_sync sync[2] = {
-		{ .flags = DRM_XE_SYNC_SYNCOBJ | DRM_XE_SYNC_SIGNAL, },
-		{ .flags = DRM_XE_SYNC_SYNCOBJ | DRM_XE_SYNC_SIGNAL, },
+		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
+		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
 	};
 	struct drm_xe_exec exec = {
 		.num_batch_buffer = 1,
@@ -219,7 +219,7 @@ static void test_engine_group_busyness(int fd, int gt, int class, const char *na
 	igt_skip_on_f(!num_placements, "Engine class:%d gt:%d not enabled on this platform\n",
 		      class, gt);
 
-	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_ASYNC_DEFAULT, 0);
+	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
 	bo_size = sizeof(*data) * num_placements;
 	bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd), xe_get_default_alignment(fd));
 
@@ -250,8 +250,8 @@ static void test_engine_group_busyness(int fd, int gt, int class, const char *na
 	for (i = 0; i < num_placements; i++) {
 		spin_opts.addr = addr + (char *)&data[i].spin - (char *)data;
 		xe_spin_init(&data[i].spin, &spin_opts);
-		sync[0].flags &= ~DRM_XE_SYNC_SIGNAL;
-		sync[1].flags |= DRM_XE_SYNC_SIGNAL;
+		sync[0].flags &= ~DRM_XE_SYNC_FLAG_SIGNAL;
+		sync[1].flags |= DRM_XE_SYNC_FLAG_SIGNAL;
 		sync[1].handle = syncobjs[i];
 
 		exec.exec_queue_id = exec_queues[i];
@@ -268,7 +268,7 @@ static void test_engine_group_busyness(int fd, int gt, int class, const char *na
 
 	igt_assert(syncobj_wait(fd, &sync[0].handle, 1, INT64_MAX, 0, NULL));
 
-	sync[0].flags |= DRM_XE_SYNC_SIGNAL;
+	sync[0].flags |= DRM_XE_SYNC_FLAG_SIGNAL;
 	xe_vm_unbind_async(fd, vm, 0, 0, addr, bo_size, sync, 1);
 	igt_assert(syncobj_wait(fd, &sync[0].handle, 1, INT64_MAX, 0, NULL));
 
tests/intel/xe_pm.c +6 -6
index d07ed4535..18afb68b0 100644
@@ -231,8 +231,8 @@ test_exec(device_t device, struct drm_xe_engine_class_instance *eci,
 	uint32_t vm;
 	uint64_t addr = 0x1a0000;
 	struct drm_xe_sync sync[2] = {
-		{ .flags = DRM_XE_SYNC_SYNCOBJ | DRM_XE_SYNC_SIGNAL, },
-		{ .flags = DRM_XE_SYNC_SYNCOBJ | DRM_XE_SYNC_SIGNAL, },
+		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
+		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
 	};
 	struct drm_xe_exec exec = {
 		.num_batch_buffer = 1,
@@ -259,7 +259,7 @@ test_exec(device_t device, struct drm_xe_engine_class_instance *eci,
 	if (check_rpm)
 		igt_assert(in_d3(device, d_state));
 
-	vm = xe_vm_create(device.fd_xe, DRM_XE_VM_CREATE_ASYNC_DEFAULT, 0);
+	vm = xe_vm_create(device.fd_xe, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
 
 	if (check_rpm)
 		igt_assert(out_of_d3(device, d_state));
@@ -304,8 +304,8 @@ test_exec(device_t device, struct drm_xe_engine_class_instance *eci,
 		data[i].batch[b++] = MI_BATCH_BUFFER_END;
 		igt_assert(b <= ARRAY_SIZE(data[i].batch));
 
-		sync[0].flags &= ~DRM_XE_SYNC_SIGNAL;
-		sync[1].flags |= DRM_XE_SYNC_SIGNAL;
+		sync[0].flags &= ~DRM_XE_SYNC_FLAG_SIGNAL;
+		sync[1].flags |= DRM_XE_SYNC_FLAG_SIGNAL;
 		sync[1].handle = syncobjs[e];
 
 		exec.exec_queue_id = exec_queues[e];
@@ -331,7 +331,7 @@ test_exec(device_t device, struct drm_xe_engine_class_instance *eci,
 	if (check_rpm && runtime_usage_available(device.pci_xe))
 		rpm_usage = igt_pm_get_runtime_usage(device.pci_xe);
 
-	sync[0].flags |= DRM_XE_SYNC_SIGNAL;
+	sync[0].flags |= DRM_XE_SYNC_FLAG_SIGNAL;
 	xe_vm_unbind_async(device.fd_xe, vm, bind_exec_queues[0], 0, addr,
 			   bo_size, sync, 1);
 	igt_assert(syncobj_wait(device.fd_xe, &sync[0].handle, 1, INT64_MAX, 0,
tests/intel/xe_pm_residency.c +1 -1
index 8e9197fae..c87eeef3c 100644
@@ -87,7 +87,7 @@ static void exec_load(int fd, struct drm_xe_engine_class_instance *hwe, unsigned
 	} *data;
 
 	struct drm_xe_sync sync = {
-		.flags = DRM_XE_SYNC_SYNCOBJ | DRM_XE_SYNC_SIGNAL,
+		.flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL,
 	};
 
 	struct drm_xe_exec exec = {
tests/intel/xe_spin_batch.c +1 -1
index eb5d6aba8..6ab604d9b 100644
@@ -145,7 +145,7 @@ static void xe_spin_fixed_duration(int fd)
 {
 	struct drm_xe_sync sync = {
 		.handle = syncobj_create(fd, 0),
-		.flags = DRM_XE_SYNC_SYNCOBJ | DRM_XE_SYNC_SIGNAL,
+		.flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL,
 	};
 	struct drm_xe_exec exec = {
 		.num_batch_buffer = 1,
tests/intel/xe_vm.c +63 -63

388 lines not on this page · raw message

tests/intel/xe_waitfence.c +2 -2
index e0116f181..05060f329 100644
@@ -30,7 +30,7 @@ static void do_bind(int fd, uint32_t vm, uint32_t bo, uint64_t offset,
 		    uint64_t addr, uint64_t size, uint64_t val)
 {
 	struct drm_xe_sync sync[1] = {};
-	sync[0].flags = DRM_XE_SYNC_USER_FENCE | DRM_XE_SYNC_SIGNAL;
+	sync[0].flags = DRM_XE_SYNC_FLAG_USER_FENCE | DRM_XE_SYNC_FLAG_SIGNAL;
 
 	sync[0].addr = to_user_pointer(&wait_fence);
 	sync[0].timeline_value = val;
@@ -63,7 +63,7 @@ waitfence(int fd, enum waittype wt)
 	uint32_t bo_7;
 	int64_t timeout;
 
-	uint32_t vm = xe_vm_create(fd, DRM_XE_VM_CREATE_ASYNC_DEFAULT, 0);
+	uint32_t vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
 	bo_1 = xe_bo_create_flags(fd, vm, 0x40000, MY_FLAG);
 	do_bind(fd, vm, bo_1, 0, 0x200000, 0x40000, 1);
 	bo_2 = xe_bo_create_flags(fd, vm, 0x40000, MY_FLAG);
Signature · 1 line
2.34.1
#10 lore raw

PATCH v3 10/57 drm-uapi/xe: Make constant comments visible in kernel doc

In reply to Francois Dugast

Align with commit ("drm/xe/uapi: Make constant comments visible in kernel doc")

---
 include/drm-uapi/xe_drm.h | 264 ++++++++++++++++++++++----------------
 1 file changed, 150 insertions(+), 114 deletions(-)
include/drm-uapi/xe_drm.h +150 -114
index 01a276376..e0308aa52 100644
@@ -126,23 +126,40 @@ struct xe_user_extension {
 #define DRM_IOCTL_XE_WAIT_USER_FENCE		DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_WAIT_USER_FENCE, struct drm_xe_wait_user_fence)
 #define DRM_IOCTL_XE_VM_MADVISE			 DRM_IOW(DRM_COMMAND_BASE + DRM_XE_VM_MADVISE, struct drm_xe_vm_madvise)
 
-/** struct drm_xe_engine_class_instance - instance of an engine class */
+/**
+ * struct drm_xe_engine_class_instance - instance of an engine class
+ *
+ * The @engine_class can be:
+ *  - %DRM_XE_ENGINE_CLASS_RENDER
+ *  - %DRM_XE_ENGINE_CLASS_COPY
+ *  - %DRM_XE_ENGINE_CLASS_VIDEO_DECODE
+ *  - %DRM_XE_ENGINE_CLASS_VIDEO_ENHANCE
+ *  - %DRM_XE_ENGINE_CLASS_COMPUTE
+ *  - %DRM_XE_ENGINE_CLASS_VM_BIND_ASYNC - Kernel only class (not actual
+ *    hardware engine class) used for creating ordered queues of
+ *    asynchronous VM bind operations.
+ *  - %DRM_XE_ENGINE_CLASS_VM_BIND_SYNC - Kernel only class (not actual
+ *    synchronous VM bind operations.
+ *
+ */
 struct drm_xe_engine_class_instance {
 #define DRM_XE_ENGINE_CLASS_RENDER		0
 #define DRM_XE_ENGINE_CLASS_COPY		1
 #define DRM_XE_ENGINE_CLASS_VIDEO_DECODE	2
 #define DRM_XE_ENGINE_CLASS_VIDEO_ENHANCE	3
 #define DRM_XE_ENGINE_CLASS_COMPUTE		4
-	/*
-	 * Kernel only classes (not actual hardware engine class). Used for
-	 * creating ordered queues of VM bind operations.
-	 */
 #define DRM_XE_ENGINE_CLASS_VM_BIND_ASYNC	5
 #define DRM_XE_ENGINE_CLASS_VM_BIND_SYNC	6
+	/**
+	 * @engine_class: Class of this instance among possible
+	 * DRM_XE_ENGINE_CLASS_*
+	 */
 	__u16 engine_class;
-
+	/** @engine_instance: Engine instance */
 	__u16 engine_instance;
+	/** @gt_id: GT ID the instance is associated with */
 	__u16 gt_id;
+	/** @rsvd: Reserved */
 	__u16 rsvd;
 };
 
@@ -313,6 +330,24 @@ struct drm_xe_query_mem_usage {
  * If a query is made with a struct drm_xe_device_query where .query
  * is equal to DRM_XE_DEVICE_QUERY_CONFIG, then the reply uses
  * struct drm_xe_query_config in .data.
+ *
+ * The index in @info can be:
+ *  - %DRM_XE_QUERY_CONFIG_REV_AND_DEVICE_ID - Device ID (lower 16 bits)
+ *    and the device revision (next 8 bits)
+ *  - %DRM_XE_QUERY_CONFIG_FLAGS - Flags describing the device
+ *    configuration, see list below
+ *
+ *    - %DRM_XE_QUERY_CONFIG_FLAGS_HAS_VRAM - Flag is set if the device
+ *      has usable VRAM
+ *  - %DRM_XE_QUERY_CONFIG_MIN_ALIGNMENT - Minimal memory alignment
+ *    required by this device, typically SZ_4K or SZ_64K
+ *  - %DRM_XE_QUERY_CONFIG_VA_BITS - Maximum bits of a virtual address
+ *  - %DRM_XE_QUERY_CONFIG_GT_COUNT - Total number of GTs for the entire
+ *    device
+ *  - %DRM_XE_QUERY_CONFIG_MEM_REGION_COUNT - Total number of accessible
+ *    memory regions
+ *  - %DRM_XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY - Value of the highest
+ *    available exec queue priority
  */
 struct drm_xe_query_config {
 	/** @num_params: number of parameters returned in info */
@@ -321,39 +356,13 @@ struct drm_xe_query_config {
 	/** @pad: MBZ */
 	__u32 pad;
 
-	/*
-	 * Device ID (lower 16 bits) and the device revision (next
-	 * 8 bits)
-	 */
 #define DRM_XE_QUERY_CONFIG_REV_AND_DEVICE_ID		0
-	/*
-	 * Flags describing the device configuration, see list below
-	 */
 #define DRM_XE_QUERY_CONFIG_FLAGS			1
-	/*
-	 * Flag is set if the device has usable VRAM
-	 */
 	#define DRM_XE_QUERY_CONFIG_FLAGS_HAS_VRAM	(0x1 << 0)
-	/*
-	 * Minimal memory alignment required by this device,
-	 * typically SZ_4K or SZ_64K
-	 */
 #define DRM_XE_QUERY_CONFIG_MIN_ALIGNMENT		2
-	/*
-	 * Maximum bits of a virtual address
-	 */
 #define DRM_XE_QUERY_CONFIG_VA_BITS			3
-	/*
-	 * Total number of GTs for the entire device
-	 */
 #define DRM_XE_QUERY_CONFIG_GT_COUNT			4
-	/*
-	 * Total number of accessible memory regions
-	 */
 #define DRM_XE_QUERY_CONFIG_MEM_REGION_COUNT		5
-	/*
-	 * Value of the highest available exec queue priority
-	 */
 #define DRM_XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY	6
 	/** @info: array of elements containing the config info */
 	__u64 info[];
@@ -366,6 +375,7 @@ struct drm_xe_query_config {
  * existing GT individual descriptions.
  * Graphics Technology (GT) is a subset of a GPU/tile that is responsible for
  * implementing graphics and/or media operations.
+ *
  */
 struct drm_xe_query_gt {
 #define DRM_XE_QUERY_GT_TYPE_MAIN		0
@@ -423,34 +433,31 @@ struct drm_xe_query_gt_list {
  * If a query is made with a struct drm_xe_device_query where .query
  * is equal to DRM_XE_DEVICE_QUERY_GT_TOPOLOGY, then the reply uses
  * struct drm_xe_query_topology_mask in .data.
+ *
+ * The @type can be:
+ *  - %DRM_XE_TOPO_DSS_GEOMETRY - To query the mask of Dual Sub Slices
+ *    (DSS) available for geometry operations. For example a query response
+ *    containing the following in mask:
+ *    ``DSS_GEOMETRY    ff ff ff ff 00 00 00 00``
+ *    means 32 DSS are available for geometry.
+ *  - %DRM_XE_TOPO_DSS_COMPUTE - To query the mask of Dual Sub Slices
+ *    (DSS) available for compute operations. For example a query response
+ *    containing the following in mask:
+ *    ``DSS_COMPUTE    ff ff ff ff 00 00 00 00``
+ *    means 32 DSS are available for compute.
+ *  - %DRM_XE_TOPO_EU_PER_DSS - To query the mask of Execution Units (EU)
+ *    available per Dual Sub Slices (DSS). For example a query response
+ *    containing the following in mask:
+ *    ``EU_PER_DSS    ff ff 00 00 00 00 00 00``
+ *    means each DSS has 16 EU.
+ *
  */
 struct drm_xe_query_topology_mask {
 	/** @gt_id: GT ID the mask is associated with */
 	__u16 gt_id;
 
-	/*
-	 * To query the mask of Dual Sub Slices (DSS) available for geometry
-	 * operations. For example a query response containing the following
-	 * in mask:
-	 *   DSS_GEOMETRY    ff ff ff ff 00 00 00 00
-	 * means 32 DSS are available for geometry.
-	 */
 #define DRM_XE_TOPO_DSS_GEOMETRY	(1 << 0)
-	/*
-	 * To query the mask of Dual Sub Slices (DSS) available for compute
-	 * operations. For example a query response containing the following
-	 * in mask:
-	 *   DSS_COMPUTE    ff ff ff ff 00 00 00 00
-	 * means 32 DSS are available for compute.
-	 */
 #define DRM_XE_TOPO_DSS_COMPUTE		(1 << 1)
-	/*
-	 * To query the mask of Execution Units (EU) available per Dual Sub
-	 * Slices (DSS). For example a query response containing the following
-	 * in mask:
-	 *   EU_PER_DSS    ff ff 00 00 00 00 00 00
-	 * means each DSS has 16 EU.
-	 */
 #define DRM_XE_TOPO_EU_PER_DSS		(1 << 2)
 	/** @type: type of mask */
 	__u16 type;
@@ -512,6 +519,19 @@ struct drm_xe_query_uc_fw_version {
  * and sets the value in the query member. This determines the type of
  * the structure provided by the driver in data, among struct drm_xe_query_*.
  *
+ * The @query can be:
+ *  - %DRM_XE_DEVICE_QUERY_ENGINES
+ *  - %DRM_XE_DEVICE_QUERY_MEM_USAGE
+ *  - %DRM_XE_DEVICE_QUERY_CONFIG
+ *  - %DRM_XE_DEVICE_QUERY_GT_LIST - Query type to retrieve the hardware
+ *    configuration of the device such as information on slices, memory,
+ *    caches, and so on. It is provided as a table of key / value
+ *    attributes.
+ *  - %DRM_XE_DEVICE_QUERY_HWCONFIG
+ *  - %DRM_XE_DEVICE_QUERY_GT_TOPOLOGY
+ *  - %DRM_XE_DEVICE_QUERY_ENGINE_CYCLES
+ *  - %DRM_XE_DEVICE_QUERY_UC_FW_VERSION
+ *
  * If size is set to 0, the driver fills it with the required size for
  * the requested type of data to query. If size is equal to the required
  * size, the queried information is copied into data. If size is set to
@@ -554,11 +574,6 @@ struct drm_xe_device_query {
 #define DRM_XE_DEVICE_QUERY_MEM_USAGE		1
 #define DRM_XE_DEVICE_QUERY_CONFIG		2
 #define DRM_XE_DEVICE_QUERY_GT_LIST		3
-	/*
-	 * Query type to retrieve the hardware configuration of the device
-	 * such as information on slices, memory, caches, and so on. It is
-	 * provided as a table of attributes (key / value).
-	 */
 #define DRM_XE_DEVICE_QUERY_HWCONFIG		4
 #define DRM_XE_DEVICE_QUERY_GT_TOPOLOGY		5
 #define DRM_XE_DEVICE_QUERY_ENGINE_CYCLES	6
@@ -576,6 +591,29 @@ struct drm_xe_device_query {
 	__u64 reserved[2];
 };
 
+/**
+ * struct drm_xe_gem_create - structure for gem creation
+ *
+ * The @flags can be:
+ *  - %DRM_XE_GEM_CREATE_FLAG_DEFER_BACKING
+ *  - %DRM_XE_GEM_CREATE_FLAG_SCANOUT
+ *  - %DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM - When using VRAM as a
+ *    possible placement, ensure that the corresponding VRAM allocation
+ *    will always use the CPU accessible part of VRAM. This is important
+ *    for small-bar systems (on full-bar systems this gets turned into a
+ *    noop).
+ *    Note1: System memory can be used as an extra placement if the kernel
+ *    should spill the allocation to system memory, if space can't be made
+ *    available in the CPU accessible part of VRAM (giving the same
+ *    behaviour as the i915 interface, see
+ *    I915_GEM_CREATE_EXT_FLAG_NEEDS_CPU_ACCESS).
+ *    Note2: For clear-color CCS surfaces the kernel needs to read the
+ *    clear-color value stored in the buffer, and on discrete platforms we
+ *    need to use VRAM for display surfaces, therefore the kernel requires
+ *    setting this flag for such objects, otherwise an error is thrown on
+ *    small-bar systems.
+ *
+ */
 struct drm_xe_gem_create {
 	/** @extensions: Pointer to the first extension struct, if any */
 	__u64 extensions;
@@ -589,21 +627,6 @@ struct drm_xe_gem_create {
 
 #define DRM_XE_GEM_CREATE_FLAG_DEFER_BACKING		(0x1 << 24)
 #define DRM_XE_GEM_CREATE_FLAG_SCANOUT			(0x1 << 25)
-/*
- * When using VRAM as a possible placement, ensure that the corresponding VRAM
- * allocation will always use the CPU accessible part of VRAM. This is important
- * for small-bar systems (on full-bar systems this gets turned into a noop).
- *
- * Note: System memory can be used as an extra placement if the kernel should
- * spill the allocation to system memory, if space can't be made available in
- * the CPU accessible part of VRAM (giving the same behaviour as the i915
- * interface, see I915_GEM_CREATE_EXT_FLAG_NEEDS_CPU_ACCESS).
- *
- * Note: For clear-color CCS surfaces the kernel needs to read the clear-color
- * value stored in the buffer, and on discrete platforms we need to use VRAM for
- * display surfaces, therefore the kernel requires setting this flag for such
- * objects, otherwise an error is thrown on small-bar systems.
- */
 #define DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM	(0x1 << 26)
 	/**
 	 * @flags: Flags, currently a mask of memory instances of where BO can
@@ -700,6 +723,30 @@ struct drm_xe_vm_destroy {
 	__u64 reserved[2];
 };
 
+/**
+ * struct drm_xe_vm_bind_op - run bind operations
+ *
+ * The @op can be:
+ *  - %DRM_XE_VM_BIND_OP_MAP
+ *  - %DRM_XE_VM_BIND_OP_UNMAP
+ *  - %DRM_XE_VM_BIND_OP_MAP_USERPTR
+ *  - %DRM_XE_VM_BIND_OP_UNMAP_ALL
+ *  - %DRM_XE_VM_BIND_OP_PREFETCH
+ *
+ * and the @flags can be:
+ *  - %DRM_XE_VM_BIND_FLAG_READONLY
+ *  - %DRM_XE_VM_BIND_FLAG_ASYNC
+ *  - %DRM_XE_VM_BIND_FLAG_IMMEDIATE - Valid on a faulting VM only, do the
+ *    MAP operation immediately rather than deferring the MAP to the page
+ *    fault handler.
+ *  - %DRM_XE_VM_BIND_FLAG_NULL - When the NULL flag is set, the page
+ *    tables are setup with a special bit which indicates writes are
+ *    dropped and all reads return zero. In the future, the NULL flags
+ *    will only be valid for DRM_XE_VM_BIND_OP_MAP operations, the BO
+ *    handle MBZ, and the BO offset MBZ. This flag is intended to
+ *    implement VK sparse bindings.
+ *
+ */
 struct drm_xe_vm_bind_op {
 	/** @extensions: Pointer to the first extension struct, if any */
 	__u64 extensions;
@@ -747,23 +794,12 @@ struct drm_xe_vm_bind_op {
 
 #define DRM_XE_VM_BIND_FLAG_READONLY	(0x1 << 0)
 #define DRM_XE_VM_BIND_FLAG_ASYNC	(0x1 << 1)
-	/*
-	 * Valid on a faulting VM only, do the MAP operation immediately rather
-	 * than deferring the MAP to the page fault handler.
-	 */
 #define DRM_XE_VM_BIND_FLAG_IMMEDIATE	(0x1 << 2)
-	/*
-	 * When the NULL flag is set, the page tables are setup with a special
-	 * bit which indicates writes are dropped and all reads return zero.  In
-	 * the future, the NULL flags will only be valid for DRM_XE_VM_BIND_OP_MAP
-	 * operations, the BO handle MBZ, and the BO offset MBZ. This flag is
-	 * intended to implement VK sparse bindings.
-	 */
 #define DRM_XE_VM_BIND_FLAG_NULL	(0x1 << 3)
 	/** @flags: Bind flags */
 	__u32 flags;
 
-	/** @mem_region: Memory region to prefetch VMA to, instance not a mask */
+	/** @region: Memory region to prefetch VMA to, instance not a mask */
 	__u32 region;
 
 	/** @reserved: Reserved */
@@ -1063,6 +1099,35 @@ struct drm_xe_wait_user_fence {
 	__u64 reserved[2];
 };
 
+/**
+ * struct drm_xe_vm_madvise - give advice about use of memory
+ *
+ * The @property can be:
+ *  - %DRM_XE_VM_MADVISE_PREFERRED_MEM_CLASS - Setting the preferred
+ *    location will trigger a migrate of the VMA backing store to new
+ *    location if the backing store is already allocated.
+ *    For DRM_XE_VM_MADVISE_PREFERRED_MEM_CLASS usage, see enum
+ *    drm_xe_memory_class.
+ *  - %DRM_XE_VM_MADVISE_PREFERRED_GT
+ *  - %DRM_XE_VM_MADVISE_PREFERRED_MEM_CLASS_GT - In this case lower 32 bits
+ *    are mem class, upper 32 are GT. Combination provides a single IOCTL
+ *    plus migrate VMA to preferred location.
+ *  - %DRM_XE_VM_MADVISE_CPU_ATOMIC - The CPU will do atomic memory
+ *    operations to this VMA. Must be set on some devices for atomics to
+ *    behave correctly.
+ *  - %DRM_XE_VM_MADVISE_DEVICE_ATOMIC - The device will do atomic memory
+ *    operations to this VMA. Must be set on some devices for atomics to
+ *    behave correctly.
+ *  - %DRM_XE_VM_MADVISE_PRIORITY - Priority WRT to eviction (moving from
+ *    preferred memory location due to memory pressure). The lower the
+ *    priority, the more likely to be evicted.
+ *
+ *    - %DRM_XE_VMA_PRIORITY_LOW
+ *    - %DRM_XE_VMA_PRIORITY_NORMAL - Default
+ *    - %DRM_XE_VMA_PRIORITY_HIGH - Must be user with elevated privileges
+ *  - %DRM_XE_VM_MADVISE_PIN - Pin the VMA in memory, must be user with
+ *    elevated privileges
+ */
 struct drm_xe_vm_madvise {
 	/** @extensions: Pointer to the first extension struct, if any */
 	__u64 extensions;
@@ -1079,44 +1144,15 @@ struct drm_xe_vm_madvise {
 	/** @addr: Address of the VMA to operation on */
 	__u64 addr;
 
-	/*
-	 * Setting the preferred location will trigger a migrate of the VMA
-	 * backing store to new location if the backing store is already
-	 * allocated.
-	 *
-	 * For DRM_XE_VM_MADVISE_PREFERRED_MEM_CLASS usage, see enum
-	 * drm_xe_memory_class.
-	 */
 #define DRM_XE_VM_MADVISE_PREFERRED_MEM_CLASS		0
 #define DRM_XE_VM_MADVISE_PREFERRED_GT			1
-	/*
-	 * In this case lower 32 bits are mem class, upper 32 are GT.
-	 * Combination provides a single IOCTL plus migrate VMA to preferred
-	 * location.
-	 */
 #define DRM_XE_VM_MADVISE_PREFERRED_MEM_CLASS_GT	2
-	/*
-	 * The CPU will do atomic memory operations to this VMA. Must be set on
-	 * some devices for atomics to behave correctly.
-	 */
 #define DRM_XE_VM_MADVISE_CPU_ATOMIC			3
-	/*
-	 * The device will do atomic memory operations to this VMA. Must be set
-	 * on some devices for atomics to behave correctly.
-	 */
 #define DRM_XE_VM_MADVISE_DEVICE_ATOMIC			4
-	/*
-	 * Priority WRT to eviction (moving from preferred memory location due
-	 * to memory pressure). The lower the priority, the more likely to be
-	 * evicted.
-	 */
 #define DRM_XE_VM_MADVISE_PRIORITY			5
 #define		DRM_XE_VMA_PRIORITY_LOW			0
-		/* Default */
 #define		DRM_XE_VMA_PRIORITY_NORMAL		1
-		/* Must be user with elevated privileges */
 #define		DRM_XE_VMA_PRIORITY_HIGH		2
-	/* Pin the VMA in memory, must be user with elevated privileges */
 #define DRM_XE_VM_MADVISE_PIN				6
 	/** @property: property to set */
 	__u32 property;
Signature · 1 line
2.34.1
#11 lore raw

PATCH v3 11/57 drm-uapi/xe: Change rsvd to pad in struct drm_xe_class_instance

In reply to Francois Dugast

Align with commit ("drm/xe/uapi: Change rsvd to pad in struct drm_xe_class_instance")

---
 include/drm-uapi/xe_drm.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/drm-uapi/xe_drm.h +2 -2
index e0308aa52..96236e95c 100644
@@ -159,8 +159,8 @@ struct drm_xe_engine_class_instance {
 	__u16 engine_instance;
 	/** @gt_id: GT ID the instance is associated with */
 	__u16 gt_id;
-	/** @rsvd: Reserved */
-	__u16 rsvd;
+	/** @pad: MBZ */
+	__u16 pad;
 };
 
 /**
Signature · 1 line
2.34.1
#12 lore raw

PATCH v3 12/57 drm-uapi/xe: Remove GT_TYPE_REMOTE.

In reply to Francois Dugast

From: Rodrigo Vivi <[email protected]>

Align with commit ("drm/xe/uapi: Remove GT_TYPE_REMOTE")

Cc Francois Dugast <[email protected]>
---
 include/drm-uapi/xe_drm.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
include/drm-uapi/xe_drm.h +2 -3
index 96236e95c..aa2b5d8f0 100644
@@ -379,9 +379,8 @@ struct drm_xe_query_config {
  */
 struct drm_xe_query_gt {
 #define DRM_XE_QUERY_GT_TYPE_MAIN		0
-#define DRM_XE_QUERY_GT_TYPE_REMOTE		1
-#define DRM_XE_QUERY_GT_TYPE_MEDIA		2
-	/** @type: GT type: Main, Remote, or Media */
+#define DRM_XE_QUERY_GT_TYPE_MEDIA		1
+	/** @type: GT type: Main or Media */
 	__u16 type;
 	/** @gt_id: Unique ID of this GT within the PCI Device */
 	__u16 gt_id;
Signature · 1 line
2.34.1
#13 lore raw

PATCH v3 13/57 drm-uapi/xe: Kill VM_MADVISE IOCTL and the atomic tests

In reply to Francois Dugast

From: Rodrigo Vivi <[email protected]>

Align with commit ("drm/xe/uapi: Kill VM_MADVISE IOCTL").

Cc Francois Dugast <[email protected]>
---
 include/drm-uapi/xe_drm.h        |  92 ++--------------
 lib/xe/xe_ioctl.c                |  14 ---
 lib/xe/xe_ioctl.h                |   2 -
 tests/intel/xe_exec_fault_mode.c | 174 ++-----------------------------
 4 files changed, 20 insertions(+), 262 deletions(-)
include/drm-uapi/xe_drm.h +11 -81
index aa2b5d8f0..129ee5610 100644
@@ -103,28 +103,26 @@ struct xe_user_extension {
 #define DRM_XE_VM_CREATE		0x03
 #define DRM_XE_VM_DESTROY		0x04
 #define DRM_XE_VM_BIND			0x05
-#define DRM_XE_EXEC_QUEUE_CREATE	0x06
-#define DRM_XE_EXEC_QUEUE_DESTROY	0x07
-#define DRM_XE_EXEC			0x08
+#define DRM_XE_EXEC			0x06
+#define DRM_XE_EXEC_QUEUE_CREATE	0x07
+#define DRM_XE_EXEC_QUEUE_DESTROY	0x08
 #define DRM_XE_EXEC_QUEUE_SET_PROPERTY	0x09
-#define DRM_XE_WAIT_USER_FENCE		0x0a
-#define DRM_XE_VM_MADVISE		0x0b
-#define DRM_XE_EXEC_QUEUE_GET_PROPERTY	0x0c
-
+#define DRM_XE_EXEC_QUEUE_GET_PROPERTY	0x0a
+#define DRM_XE_WAIT_USER_FENCE		0x0b
 /* Must be kept compact -- no holes */
+
 #define DRM_IOCTL_XE_DEVICE_QUERY		DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_DEVICE_QUERY, struct drm_xe_device_query)
 #define DRM_IOCTL_XE_GEM_CREATE			DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_GEM_CREATE, struct drm_xe_gem_create)
 #define DRM_IOCTL_XE_GEM_MMAP_OFFSET		DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_GEM_MMAP_OFFSET, struct drm_xe_gem_mmap_offset)
 #define DRM_IOCTL_XE_VM_CREATE			DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_VM_CREATE, struct drm_xe_vm_create)
-#define DRM_IOCTL_XE_VM_DESTROY			 DRM_IOW(DRM_COMMAND_BASE + DRM_XE_VM_DESTROY, struct drm_xe_vm_destroy)
-#define DRM_IOCTL_XE_VM_BIND			 DRM_IOW(DRM_COMMAND_BASE + DRM_XE_VM_BIND, struct drm_xe_vm_bind)
+#define DRM_IOCTL_XE_VM_DESTROY			DRM_IOW(DRM_COMMAND_BASE + DRM_XE_VM_DESTROY, struct drm_xe_vm_destroy)
+#define DRM_IOCTL_XE_VM_BIND			DRM_IOW(DRM_COMMAND_BASE + DRM_XE_VM_BIND, struct drm_xe_vm_bind)
+#define DRM_IOCTL_XE_EXEC			DRM_IOW(DRM_COMMAND_BASE + DRM_XE_EXEC, struct drm_xe_exec)
 #define DRM_IOCTL_XE_EXEC_QUEUE_CREATE		DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_EXEC_QUEUE_CREATE, struct drm_xe_exec_queue_create)
+#define DRM_IOCTL_XE_EXEC_QUEUE_DESTROY		DRM_IOW(DRM_COMMAND_BASE + DRM_XE_EXEC_QUEUE_DESTROY, struct drm_xe_exec_queue_destroy)
+#define DRM_IOCTL_XE_EXEC_QUEUE_SET_PROPERTY	DRM_IOW(DRM_COMMAND_BASE + DRM_XE_EXEC_QUEUE_SET_PROPERTY, struct drm_xe_exec_queue_set_property)
 #define DRM_IOCTL_XE_EXEC_QUEUE_GET_PROPERTY	DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_EXEC_QUEUE_GET_PROPERTY, struct drm_xe_exec_queue_get_property)
-#define DRM_IOCTL_XE_EXEC_QUEUE_DESTROY		 DRM_IOW(DRM_COMMAND_BASE + DRM_XE_EXEC_QUEUE_DESTROY, struct drm_xe_exec_queue_destroy)
-#define DRM_IOCTL_XE_EXEC			 DRM_IOW(DRM_COMMAND_BASE + DRM_XE_EXEC, struct drm_xe_exec)
-#define DRM_IOCTL_XE_EXEC_QUEUE_SET_PROPERTY	 DRM_IOW(DRM_COMMAND_BASE + DRM_XE_EXEC_QUEUE_SET_PROPERTY, struct drm_xe_exec_queue_set_property)
 #define DRM_IOCTL_XE_WAIT_USER_FENCE		DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_WAIT_USER_FENCE, struct drm_xe_wait_user_fence)
-#define DRM_IOCTL_XE_VM_MADVISE			 DRM_IOW(DRM_COMMAND_BASE + DRM_XE_VM_MADVISE, struct drm_xe_vm_madvise)
 
 /**
  * struct drm_xe_engine_class_instance - instance of an engine class
@@ -1098,74 +1096,6 @@ struct drm_xe_wait_user_fence {
 	__u64 reserved[2];
 };
 
-/**
- * struct drm_xe_vm_madvise - give advice about use of memory
- *
- * The @property can be:
- *  - %DRM_XE_VM_MADVISE_PREFERRED_MEM_CLASS - Setting the preferred
- *    location will trigger a migrate of the VMA backing store to new
- *    location if the backing store is already allocated.
- *    For DRM_XE_VM_MADVISE_PREFERRED_MEM_CLASS usage, see enum
- *    drm_xe_memory_class.
- *  - %DRM_XE_VM_MADVISE_PREFERRED_GT
- *  - %DRM_XE_VM_MADVISE_PREFERRED_MEM_CLASS_GT - In this case lower 32 bits
- *    are mem class, upper 32 are GT. Combination provides a single IOCTL
- *    plus migrate VMA to preferred location.
- *  - %DRM_XE_VM_MADVISE_CPU_ATOMIC - The CPU will do atomic memory
- *    operations to this VMA. Must be set on some devices for atomics to
- *    behave correctly.
- *  - %DRM_XE_VM_MADVISE_DEVICE_ATOMIC - The device will do atomic memory
- *    operations to this VMA. Must be set on some devices for atomics to
- *    behave correctly.
- *  - %DRM_XE_VM_MADVISE_PRIORITY - Priority WRT to eviction (moving from
- *    preferred memory location due to memory pressure). The lower the
- *    priority, the more likely to be evicted.
- *
- *    - %DRM_XE_VMA_PRIORITY_LOW
- *    - %DRM_XE_VMA_PRIORITY_NORMAL - Default
- *    - %DRM_XE_VMA_PRIORITY_HIGH - Must be user with elevated privileges
- *  - %DRM_XE_VM_MADVISE_PIN - Pin the VMA in memory, must be user with
- *    elevated privileges
- */
-struct drm_xe_vm_madvise {
-	/** @extensions: Pointer to the first extension struct, if any */
-	__u64 extensions;
-
-	/** @vm_id: The ID VM in which the VMA exists */
-	__u32 vm_id;
-
-	/** @pad: MBZ */
-	__u32 pad;
-
-	/** @range: Number of bytes in the VMA */
-	__u64 range;
-
-	/** @addr: Address of the VMA to operation on */
-	__u64 addr;
-
-#define DRM_XE_VM_MADVISE_PREFERRED_MEM_CLASS		0
-#define DRM_XE_VM_MADVISE_PREFERRED_GT			1
-#define DRM_XE_VM_MADVISE_PREFERRED_MEM_CLASS_GT	2
-#define DRM_XE_VM_MADVISE_CPU_ATOMIC			3
-#define DRM_XE_VM_MADVISE_DEVICE_ATOMIC			4
-#define DRM_XE_VM_MADVISE_PRIORITY			5
-#define		DRM_XE_VMA_PRIORITY_LOW			0
-#define		DRM_XE_VMA_PRIORITY_NORMAL		1
-#define		DRM_XE_VMA_PRIORITY_HIGH		2
-#define DRM_XE_VM_MADVISE_PIN				6
-	/** @property: property to set */
-	__u32 property;
-
-	/** @pad2: MBZ */
-	__u32 pad2;
-
-	/** @value: property value */
-	__u64 value;
-
-	/** @reserved: Reserved */
-	__u64 reserved[2];
-};
-
 /**
  * DOC: XE PMU event config IDs
  *
lib/xe/xe_ioctl.c +0 -14
index 06c3cb782..db41d5ba5 100644
@@ -475,17 +475,3 @@ void xe_force_gt_reset(int fd, int gt)
 		 minor(st.st_rdev), gt);
 	system(reset_string);
 }
-
-void xe_vm_madvise(int fd, uint32_t vm, uint64_t addr, uint64_t size,
-		   uint32_t property, uint32_t value)
-{
-	struct drm_xe_vm_madvise madvise = {
-		.vm_id = vm,
-		.range = size,
-		.addr = addr,
-		.property = property,
-		.value = value,
-	};
-
-	igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_VM_MADVISE, &madvise), 0);
-}
lib/xe/xe_ioctl.h +0 -2
index a8dbcf376..d9c97bf22 100644
@@ -90,7 +90,5 @@ int64_t xe_wait_ufence_abstime(int fd, uint64_t *addr, uint64_t value,
 			       struct drm_xe_engine_class_instance *eci,
 			       int64_t timeout);
 void xe_force_gt_reset(int fd, int gt);
-void xe_vm_madvise(int fd, uint32_t vm, uint64_t addr, uint64_t size,
-		   uint32_t property, uint32_t value);
 
 #endif /* XE_IOCTL_H */
tests/intel/xe_exec_fault_mode.c +9 -165

192 lines not on this page · raw message

Signature · 1 line
2.34.1
#14 lore raw

PATCH v3 14/57 drm/xe_query: Remove backward compatibility of vram_visible_size.

In reply to Francois Dugast

From: Rodrigo Vivi <[email protected]>

We are breaking the uapi compatibility at this time, so this is useless anyway.

---
 lib/xe/xe_query.c | 42 +++++++-----------------------------------
 1 file changed, 7 insertions(+), 35 deletions(-)
lib/xe/xe_query.c +7 -35
index 9f1ab0cd9..3afbd0c63 100644
@@ -399,16 +399,6 @@ uint64_t vram_memory(int fd, int gt)
 	return xe_has_vram(fd) ? native_region_for_gt(xe_dev->gt_list, gt) : 0;
 }
 
-static uint64_t __xe_visible_vram_size(int fd, int gt)
-{
-	struct xe_device *xe_dev;
-
-	xe_dev = find_in_cache(fd);
-	igt_assert(xe_dev);
-
-	return xe_dev->visible_vram_size[gt];
-}
-
 /**
  * visible_vram_memory:
  * @fd: xe device fd
@@ -420,14 +410,7 @@ static uint64_t __xe_visible_vram_size(int fd, int gt)
  */
 uint64_t visible_vram_memory(int fd, int gt)
 {
-	/*
-	 * TODO: Keep it backwards compat for now. Fixup once the kernel side
-	 * has landed.
-	 */
-	if (__xe_visible_vram_size(fd, gt))
-		return vram_memory(fd, gt) | DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM;
-	else
-		return vram_memory(fd, gt); /* older kernel */
+	return vram_memory(fd, gt) | DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM;
 }
 
 /**
@@ -459,14 +442,7 @@ uint64_t visible_vram_if_possible(int fd, int gt)
 	uint64_t system_memory = regions & 0x1;
 	uint64_t vram = regions & (0x2 << gt);
 
-	/*
-	 * TODO: Keep it backwards compat for now. Fixup once the kernel side
-	 * has landed.
-	 */
-	if (__xe_visible_vram_size(fd, gt))
-		return vram ? vram | DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM : system_memory;
-	else
-		return vram ? vram : system_memory; /* older kernel */
+	return vram ? vram | DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM : system_memory;
 }
 
 /**
@@ -618,18 +594,14 @@ uint64_t xe_vram_size(int fd, int gt)
  */
 uint64_t xe_visible_vram_size(int fd, int gt)
 {
-	uint64_t visible_size;
+	struct xe_device *xe_dev;
 
-	/*
-	 * TODO: Keep it backwards compat for now. Fixup once the kernel side
-	 * has landed.
-	 */
-	visible_size = __xe_visible_vram_size(fd, gt);
-	if (!visible_size) /* older kernel */
-		visible_size = xe_vram_size(fd, gt);
+	xe_dev = find_in_cache(fd);
+	igt_assert(xe_dev);
 
-	return visible_size;
+	return xe_dev->visible_vram_size[gt];
 }
+
 /**
  * xe_vram_available:
  * @fd: xe device fd
Signature · 1 line
2.34.1
#15 lore raw

PATCH v3 15/57 xe_ioctl: Converge bo_create to the most used version

In reply to Francois Dugast

From: Rodrigo Vivi <[email protected]>

Let's unify the call instead of having 2 separated options for the same goal.

---
 lib/xe/xe_ioctl.c           | 15 ---------------
 lib/xe/xe_ioctl.h           |  1 -
 tests/intel/xe_perf_pmu.c   |  4 ++--
 tests/intel/xe_spin_batch.c |  2 +-
 tests/intel/xe_vm.c         |  9 +++++----
 5 files changed, 8 insertions(+), 23 deletions(-)
lib/xe/xe_ioctl.c +0 -15
index db41d5ba5..2edf8a7cf 100644
@@ -253,21 +253,6 @@ uint32_t xe_bo_create_flags(int fd, uint32_t vm, uint64_t size, uint32_t flags)
 	return handle;
 }
 
-uint32_t xe_bo_create(int fd, int gt, uint32_t vm, uint64_t size)
-{
-	struct drm_xe_gem_create create = {
-		.vm_id = vm,
-		.size = size,
-		.flags = vram_if_possible(fd, gt),
-	};
-	int err;
-
-	err = igt_ioctl(fd, DRM_IOCTL_XE_GEM_CREATE, &create);
-	igt_assert_eq(err, 0);
-
-	return create.handle;
-}
-
 uint32_t xe_bind_exec_queue_create(int fd, uint32_t vm, uint64_t ext, bool async)
 {
 	struct drm_xe_engine_class_instance instance = {
lib/xe/xe_ioctl.h +0 -1
index d9c97bf22..993ba8158 100644
@@ -67,7 +67,6 @@ void xe_vm_destroy(int fd, uint32_t vm);
 uint32_t __xe_bo_create_flags(int fd, uint32_t vm, uint64_t size, uint32_t flags,
 			      uint32_t *handle);
 uint32_t xe_bo_create_flags(int fd, uint32_t vm, uint64_t size, uint32_t flags);
-uint32_t xe_bo_create(int fd, int gt, uint32_t vm, uint64_t size);
 uint32_t xe_exec_queue_create(int fd, uint32_t vm,
 			  struct drm_xe_engine_class_instance *instance,
 			  uint64_t ext);
tests/intel/xe_perf_pmu.c +2 -2
index e9d05cf2b..2c549f778 100644
@@ -103,7 +103,7 @@ static void test_any_engine_busyness(int fd, struct drm_xe_engine_class_instance
 	bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd),
 			xe_get_default_alignment(fd));
 
-	bo = xe_bo_create(fd, eci->gt_id, vm, bo_size);
+	bo = xe_bo_create_flags(fd, vm, bo_size, vram_if_possible(fd, 0));
 	spin = xe_bo_map(fd, bo, bo_size);
 
 	exec_queue = xe_exec_queue_create(fd, vm, eci, 0);
@@ -223,7 +223,7 @@ static void test_engine_group_busyness(int fd, int gt, int class, const char *na
 	bo_size = sizeof(*data) * num_placements;
 	bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd), xe_get_default_alignment(fd));
 
-	bo = xe_bo_create(fd, gt, vm, bo_size);
+	bo = xe_bo_create_flags(fd, vm, bo_size, vram_if_possible(fd, 0));
 	data = xe_bo_map(fd, bo, bo_size);
 
 	for (i = 0; i < num_placements; i++) {
tests/intel/xe_spin_batch.c +1 -1
index 6ab604d9b..261fde9af 100644
@@ -169,7 +169,7 @@ static void xe_spin_fixed_duration(int fd)
 	exec_queue = xe_exec_queue_create_class(fd, vm, DRM_XE_ENGINE_CLASS_COPY);
 	ahnd = intel_allocator_open(fd, 0, INTEL_ALLOCATOR_RELOC);
 	bo_size = ALIGN(sizeof(*spin) + xe_cs_prefetch_size(fd), xe_get_default_alignment(fd));
-	bo = xe_bo_create(fd, 0, vm, bo_size);
+	bo = xe_bo_create_flags(fd, vm, bo_size, vram_if_possible(fd, 0));
 	spin = xe_bo_map(fd, bo, bo_size);
 	spin_addr = intel_allocator_alloc_with_strategy(ahnd, bo, bo_size, 0,
 							ALLOC_STRATEGY_LOW_TO_HIGH);
tests/intel/xe_vm.c +5 -4
index 48834f2de..3a34fde67 100644
@@ -267,7 +267,7 @@ static void test_partial_unbinds(int fd)
 {
 	uint32_t vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
 	size_t bo_size = 3 * xe_get_default_alignment(fd);
-	uint32_t bo = xe_bo_create(fd, 0, vm, bo_size);
+	uint32_t bo = xe_bo_create_flags(fd, vm, bo_size, vram_if_possible(fd, 0));
 	uint64_t unbind_size = bo_size / 3;
 	uint64_t addr = 0x1a0000;
 
@@ -316,7 +316,7 @@ static void unbind_all(int fd, int n_vmas)
 	};
 
 	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
-	bo = xe_bo_create(fd, 0, vm, bo_size);
+	bo = xe_bo_create_flags(fd, vm, bo_size, vram_if_possible(fd, 0));
 
 	for (i = 0; i < n_vmas; ++i)
 		xe_vm_bind_async(fd, vm, 0, bo, 0, addr + i * bo_size,
@@ -362,6 +362,7 @@ static void userptr_invalid(int fd)
 	xe_vm_destroy(fd, vm);
 }
 
+
 /**
  * SUBTEST: shared-%s-page
  * Description: Test shared arg[1] page
@@ -1572,9 +1573,9 @@ test_mmap_style_bind(int fd, struct drm_xe_engine_class_instance *eci,
 		igt_assert(map0 != MAP_FAILED);
 		igt_assert(map1 != MAP_FAILED);
 	} else {
-		bo0 = xe_bo_create(fd, eci->gt_id, vm, bo_size);
+		bo0 = xe_bo_create_flags(fd, vm, bo_size, vram_if_possible(fd, eci->gt_id));
 		map0 = xe_bo_map(fd, bo0, bo_size);
-		bo1 = xe_bo_create(fd, eci->gt_id, vm, bo_size);
+		bo1 = xe_bo_create_flags(fd, vm, bo_size, vram_if_possible(fd, eci->gt_id));
 		map1 = xe_bo_map(fd, bo1, bo_size);
 	}
 	memset(map0, 0, bo_size);
Signature · 1 line
2.34.1
#16 lore raw

PATCH v3 16/57 xe_ioctl: Rename *xe_bo_create_flags to simply xe_bo_create

In reply to Francois Dugast

From: Rodrigo Vivi <[email protected]>

Now that we have only one variant we can unify to the simplest version.

---
 benchmarks/gem_wsim.c              |  2 +-
 lib/igt_draw.c                     |  6 ++---
 lib/igt_fb.c                       |  6 ++---
 lib/intel_batchbuffer.c            |  6 ++---
 lib/intel_blt.c                    |  2 +-
 lib/intel_bufops.c                 |  2 +-
 lib/xe/xe_ioctl.c                  |  8 +++---
 lib/xe/xe_ioctl.h                  |  6 ++---
 lib/xe/xe_spin.c                   |  8 +++---
 tests/intel/api_intel_allocator.c  |  4 +--
 tests/intel/kms_big_fb.c           | 22 ++++++++--------
 tests/intel/kms_ccs.c              |  4 +--
 tests/intel/xe_ccs.c               | 12 ++++-----
 tests/intel/xe_copy_basic.c        |  8 +++---
 tests/intel/xe_dma_buf_sync.c      |  4 +--
 tests/intel/xe_drm_fdinfo.c        |  6 ++---
 tests/intel/xe_evict.c             | 40 +++++++++++++++---------------
 tests/intel/xe_evict_ccs.c         |  6 ++---
 tests/intel/xe_exec_balancer.c     |  6 ++---
 tests/intel/xe_exec_basic.c        |  3 +--
 tests/intel/xe_exec_compute_mode.c |  4 +--
 tests/intel/xe_exec_fault_mode.c   | 10 ++++----
 tests/intel/xe_exec_reset.c        | 16 ++++++------
 tests/intel/xe_exec_store.c        | 12 ++++-----
 tests/intel/xe_exec_threads.c      | 12 ++++-----
 tests/intel/xe_exercise_blt.c      |  4 +--
 tests/intel/xe_guc_pc.c            |  4 +--
 tests/intel/xe_intel_bb.c          |  2 +-
 tests/intel/xe_mmap.c              | 32 ++++++++++++------------
 tests/intel/xe_noexec_ping_pong.c  |  4 +--
 tests/intel/xe_perf_pmu.c          |  4 +--
 tests/intel/xe_pm.c                |  6 ++---
 tests/intel/xe_pm_residency.c      |  4 +--
 tests/intel/xe_prime_self_import.c | 28 ++++++++++-----------
 tests/intel/xe_spin_batch.c        |  2 +-
 tests/intel/xe_vm.c                | 35 +++++++++++++-------------
 tests/intel/xe_waitfence.c         | 14 +++++------
 tests/kms_addfb_basic.c            |  2 +-
 tests/kms_getfb.c                  |  2 +-
 39 files changed, 178 insertions(+), 180 deletions(-)
benchmarks/gem_wsim.c +1 -1
index df4850086..d6d3deb5f 100644
@@ -1734,7 +1734,7 @@ xe_alloc_step_batch(struct workload *wrk, struct w_step *w)
 	struct dep_entry *dep;
 	int i;
 
-	w->bb_handle = xe_bo_create_flags(fd, vm->id, PAGE_SIZE,
+	w->bb_handle = xe_bo_create(fd, vm->id, PAGE_SIZE,
 				visible_vram_if_possible(fd, eq->hwe_list[0].gt_id));
 	w->xe.data = xe_bo_map(fd, w->bb_handle, PAGE_SIZE);
 	w->xe.exec.address =
lib/igt_draw.c +3 -3
index 9a7664a37..5935eb058 100644
@@ -795,9 +795,9 @@ static void draw_rect_render(int fd, struct cmd_data *cmd_data,
 	if (is_i915_device(fd))
 		tmp.handle = gem_create(fd, tmp.size);
 	else
-		tmp.handle = xe_bo_create_flags(fd, 0,
-						ALIGN(tmp.size, xe_get_default_alignment(fd)),
-						visible_vram_if_possible(fd, 0));
+		tmp.handle = xe_bo_create(fd, 0,
+					  ALIGN(tmp.size, xe_get_default_alignment(fd)),
+					  visible_vram_if_possible(fd, 0));
 
 	tmp.stride = rect->w * pixel_size;
 	tmp.bpp = buf->bpp;
lib/igt_fb.c +3 -3
index e70d2e3ce..f96dca7a4 100644
@@ -1205,8 +1205,8 @@ static int create_bo_for_fb(struct igt_fb *fb, bool prefer_sysmem)
 			/* If we can't use fences, we won't use ggtt detiling later. */
 			igt_assert(err == 0 || err == -EOPNOTSUPP);
 		} else if (is_xe_device(fd)) {
-			fb->gem_handle = xe_bo_create_flags(fd, 0, fb->size,
-							visible_vram_if_possible(fd, 0));
+			fb->gem_handle = xe_bo_create(fd, 0, fb->size,
+						      visible_vram_if_possible(fd, 0));
 		} else if (is_vc4_device(fd)) {
 			fb->gem_handle = igt_vc4_create_bo(fd, fb->size);
 
@@ -2903,7 +2903,7 @@ static void blitcopy(const struct igt_fb *dst_fb,
 
 		bb_size = ALIGN(bb_size + xe_cs_prefetch_size(dst_fb->fd),
 				xe_get_default_alignment(dst_fb->fd));
-		xe_bb = xe_bo_create_flags(dst_fb->fd, 0, bb_size, mem_region);
+		xe_bb = xe_bo_create(dst_fb->fd, 0, bb_size, mem_region);
 	}
 
 	for (int i = 0; i < dst_fb->num_planes - dst_cc; i++) {
lib/intel_batchbuffer.c +3 -3
index b59c490db..47e8af84f 100644
@@ -945,7 +945,7 @@ __intel_bb_create(int fd, uint32_t ctx, uint32_t vm, const intel_ctx_cfg_t *cfg,
 
 		ibb->alignment = xe_get_default_alignment(fd);
 		size = ALIGN(size, ibb->alignment);
-		ibb->handle = xe_bo_create_flags(fd, 0, size, visible_vram_if_possible(fd, 0));
+		ibb->handle = xe_bo_create(fd, 0, size, visible_vram_if_possible(fd, 0));
 
 		/* Limit to 48-bit due to MI_* address limitation */
 		ibb->gtt_size = 1ull << min_t(uint32_t, xe_va_bits(fd), 48);
@@ -1403,8 +1403,8 @@ void intel_bb_reset(struct intel_bb *ibb, bool purge_objects_cache)
 	if (ibb->driver == INTEL_DRIVER_I915)
 		ibb->handle = gem_create(ibb->fd, ibb->size);
 	else
-		ibb->handle = xe_bo_create_flags(ibb->fd, 0, ibb->size,
-						 visible_vram_if_possible(ibb->fd, 0));
+		ibb->handle = xe_bo_create(ibb->fd, 0, ibb->size,
+					   visible_vram_if_possible(ibb->fd, 0));
 
 	/* Reacquire offset for RELOC and SIMPLE */
 	if (ibb->allocator_type == INTEL_ALLOCATOR_SIMPLE ||
lib/intel_blt.c +1 -1
index 2edcd72f3..36830fb3e 100644
@@ -1807,7 +1807,7 @@ blt_create_object(const struct blt_copy_data *blt, uint32_t region,
 			flags |= DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM;
 
 		size = ALIGN(size, xe_get_default_alignment(blt->fd));
-		handle = xe_bo_create_flags(blt->fd, 0, size, flags);
+		handle = xe_bo_create(blt->fd, 0, size, flags);
 	} else {
 		igt_assert(__gem_create_in_memory_regions(blt->fd, &handle,
 							  &size, region) == 0);
lib/intel_bufops.c +1 -1
index 2c91adb88..6f3a77f47 100644
@@ -920,7 +920,7 @@ static void __intel_buf_init(struct buf_ops *bops,
 				igt_assert_eq(__gem_create(bops->fd, &size, &buf->handle), 0);
 		} else {
 			size = ALIGN(size, xe_get_default_alignment(bops->fd));
-			buf->handle = xe_bo_create_flags(bops->fd, 0, size, region);
+			buf->handle = xe_bo_create(bops->fd, 0, size, region);
 		}
 	}
 
lib/xe/xe_ioctl.c +4 -4
index 2edf8a7cf..aafd77966 100644
@@ -226,8 +226,8 @@ void xe_vm_destroy(int fd, uint32_t vm)
 	igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_VM_DESTROY, &destroy), 0);
 }
 
-uint32_t __xe_bo_create_flags(int fd, uint32_t vm, uint64_t size, uint32_t flags,
-			      uint32_t *handle)
+uint32_t __xe_bo_create(int fd, uint32_t vm, uint64_t size, uint32_t flags,
+			uint32_t *handle)
 {
 	struct drm_xe_gem_create create = {
 		.vm_id = vm,
@@ -244,11 +244,11 @@ uint32_t __xe_bo_create_flags(int fd, uint32_t vm, uint64_t size, uint32_t flags
 	return 0;
 }
 
-uint32_t xe_bo_create_flags(int fd, uint32_t vm, uint64_t size, uint32_t flags)
+uint32_t xe_bo_create(int fd, uint32_t vm, uint64_t size, uint32_t flags)
 {
 	uint32_t handle;
 
-	igt_assert_eq(__xe_bo_create_flags(fd, vm, size, flags, &handle), 0);
+	igt_assert_eq(__xe_bo_create(fd, vm, size, flags, &handle), 0);
 
 	return handle;
 }
lib/xe/xe_ioctl.h +3 -3
index 993ba8158..294e9bc13 100644
@@ -64,9 +64,9 @@ void xe_vm_unbind_all_async(int fd, uint32_t vm, uint32_t exec_queue,
 			    uint32_t bo, struct drm_xe_sync *sync,
 			    uint32_t num_syncs);
 void xe_vm_destroy(int fd, uint32_t vm);
-uint32_t __xe_bo_create_flags(int fd, uint32_t vm, uint64_t size, uint32_t flags,
-			      uint32_t *handle);
-uint32_t xe_bo_create_flags(int fd, uint32_t vm, uint64_t size, uint32_t flags);
+uint32_t __xe_bo_create(int fd, uint32_t vm, uint64_t size, uint32_t flags,
+			uint32_t *handle);
+uint32_t xe_bo_create(int fd, uint32_t vm, uint64_t size, uint32_t flags);
 uint32_t xe_exec_queue_create(int fd, uint32_t vm,
 			  struct drm_xe_engine_class_instance *instance,
 			  uint64_t ext);
lib/xe/xe_spin.c +4 -4
index cfc663acc..828938434 100644
@@ -219,8 +219,8 @@ xe_spin_create(int fd, const struct igt_spin_factory *opt)
 			spin->engine = xe_exec_queue_create_class(fd, spin->vm, DRM_XE_ENGINE_CLASS_COPY);
 	}
 
-	spin->handle = xe_bo_create_flags(fd, spin->vm, bo_size,
-					  visible_vram_if_possible(fd, 0));
+	spin->handle = xe_bo_create(fd, spin->vm, bo_size,
+				    visible_vram_if_possible(fd, 0));
 	xe_spin = xe_bo_map(fd, spin->handle, bo_size);
 	addr = intel_allocator_alloc_with_strategy(ahnd, spin->handle, bo_size, 0, ALLOC_STRATEGY_LOW_TO_HIGH);
 	xe_vm_bind_sync(fd, spin->vm, spin->handle, 0, addr, bo_size);
@@ -298,8 +298,8 @@ void xe_cork_init(int fd, struct drm_xe_engine_class_instance *hwe,
 
 	vm = xe_vm_create(fd, 0, 0);
 
-	bo = xe_bo_create_flags(fd, vm, bo_size,
-				visible_vram_if_possible(fd, hwe->gt_id));
+	bo = xe_bo_create(fd, vm, bo_size,
+			  visible_vram_if_possible(fd, hwe->gt_id));
 	spin = xe_bo_map(fd, bo, 0x1000);
 
 	xe_vm_bind_sync(fd, vm, bo, 0, addr, bo_size);
tests/intel/api_intel_allocator.c +2 -2
index f3fcf8a34..158fd86a1 100644
@@ -468,8 +468,8 @@ static void __simple_allocs(int fd)
 
 		size = (rand() % 4 + 1) * 0x1000;
 		if (is_xe)
-			handles[i] = xe_bo_create_flags(fd, 0, size,
-							system_memory(fd));
+			handles[i] = xe_bo_create(fd, 0, size,
+						  system_memory(fd));
 		else
 			handles[i] = gem_create(fd, size);
 
tests/intel/kms_big_fb.c +11 -11
index 2c7b24fca..9c2b8dc79 100644
@@ -777,10 +777,10 @@ test_size_overflow(data_t *data)
 	if (is_i915_device(data->drm_fd))
 		bo = gem_buffer_create_fb_obj(data->drm_fd, (1ULL << 32) - 4096);
 	else
-		bo = xe_bo_create_flags(data->drm_fd, 0,
-					ALIGN(((1ULL << 32) - 4096),
-					      xe_get_default_alignment(data->drm_fd)),
-					vram_if_possible(data->drm_fd, 0));
+		bo = xe_bo_create(data->drm_fd, 0,
+				  ALIGN(((1ULL << 32) - 4096),
+					xe_get_default_alignment(data->drm_fd)),
+				  vram_if_possible(data->drm_fd, 0));
 	igt_require(bo);
 
 	ret = __kms_addfb(data->drm_fd, bo,
@@ -837,10 +837,10 @@ test_size_offset_overflow(data_t *data)
 	if (is_i915_device(data->drm_fd))
 		bo = gem_buffer_create_fb_obj(data->drm_fd, (1ULL << 32) - 4096);
 	else
-		bo = xe_bo_create_flags(data->drm_fd, 0,
-					ALIGN(((1ULL << 32) - 4096),
-					      xe_get_default_alignment(data->drm_fd)),
-					vram_if_possible(data->drm_fd, 0));
+		bo = xe_bo_create(data->drm_fd, 0,
+				  ALIGN(((1ULL << 32) - 4096),
+					xe_get_default_alignment(data->drm_fd)),
+				  vram_if_possible(data->drm_fd, 0));
 	igt_require(bo);
 
 	offsets[0] = 0;
@@ -926,9 +926,9 @@ test_addfb(data_t *data)
 	if (is_i915_device(data->drm_fd))
 		bo = gem_buffer_create_fb_obj(data->drm_fd, size);
 	else
-		bo = xe_bo_create_flags(data->drm_fd, 0,
-					ALIGN(size, xe_get_default_alignment(data->drm_fd)),
-					vram_if_possible(data->drm_fd, 0));
+		bo = xe_bo_create(data->drm_fd, 0,
+				  ALIGN(size, xe_get_default_alignment(data->drm_fd)),
+				  vram_if_possible(data->drm_fd, 0));
 	igt_require(bo);
 
 	if (is_i915_device(data->drm_fd) && intel_display_ver(data->devid) < 4)
tests/intel/kms_ccs.c +2 -2
index 93e837b84..337afc00c 100644
@@ -434,8 +434,8 @@ static void test_bad_ccs_plane(data_t *data, int width, int height, int ccs_plan
 	if (data->flags & TEST_BAD_CCS_HANDLE) {
 		bad_ccs_bo = is_i915_device(data->drm_fd) ?
 				gem_create(data->drm_fd, fb.size) :
-				xe_bo_create_flags(data->drm_fd, 0, fb.size,
-						   visible_vram_if_possible(data->drm_fd, 0));
+				xe_bo_create(data->drm_fd, 0, fb.size,
+					     visible_vram_if_possible(data->drm_fd, 0));
 		f.handles[ccs_plane] = bad_ccs_bo;
 	}
 
tests/intel/xe_ccs.c +6 -6
index 465f67e23..ceecba416 100644
@@ -102,8 +102,8 @@ static void surf_copy(int xe,
 
 	igt_assert(mid->compression);
 	ccscopy = (uint32_t *) malloc(ccssize);
-	ccs = xe_bo_create_flags(xe, 0, ccssize, sysmem);
-	ccs2 = xe_bo_create_flags(xe, 0, ccssize, sysmem);
+	ccs = xe_bo_create(xe, 0, ccssize, sysmem);
+	ccs2 = xe_bo_create(xe, 0, ccssize, sysmem);
 
 	blt_ctrl_surf_copy_init(xe, &surf);
 	surf.print_bb = param.print_bb;
@@ -111,7 +111,7 @@ static void surf_copy(int xe,
 				 uc_mocs, BLT_INDIRECT_ACCESS);
 	blt_set_ctrl_surf_object(&surf.dst, ccs, sysmem, ccssize, uc_mocs, DIRECT_ACCESS);
 	bb_size = xe_get_default_alignment(xe);
-	bb1 = xe_bo_create_flags(xe, 0, bb_size, sysmem);
+	bb1 = xe_bo_create(xe, 0, bb_size, sysmem);
 	blt_set_batch(&surf.bb, bb1, bb_size, sysmem);
 	blt_ctrl_surf_copy(xe, ctx, NULL, ahnd, &surf);
 	intel_ctx_xe_sync(ctx, true);
@@ -166,7 +166,7 @@ static void surf_copy(int xe,
 	blt_set_copy_object(&blt.dst, dst);
 	blt_set_object_ext(&ext.src, mid->compression_type, mid->x2, mid->y2, SURFACE_TYPE_2D);
 	blt_set_object_ext(&ext.dst, 0, dst->x2, dst->y2, SURFACE_TYPE_2D);
-	bb2 = xe_bo_create_flags(xe, 0, bb_size, sysmem);
+	bb2 = xe_bo_create(xe, 0, bb_size, sysmem);
 	blt_set_batch(&blt.bb, bb2, bb_size, sysmem);
 	blt_block_copy(xe, ctx, NULL, ahnd, &blt, &ext);
 	intel_ctx_xe_sync(ctx, true);
@@ -297,7 +297,7 @@ static void block_copy(int xe,
 	uint8_t uc_mocs = intel_get_uc_mocs_index(xe);
 	int result;
 
-	bb = xe_bo_create_flags(xe, 0, bb_size, region1);
+	bb = xe_bo_create(xe, 0, bb_size, region1);
 
 	if (!blt_uses_extended_block_copy(xe))
 		pext = NULL;
@@ -418,7 +418,7 @@ static void block_multicopy(int xe,
 	uint8_t uc_mocs = intel_get_uc_mocs_index(xe);
 	int result;
 
-	bb = xe_bo_create_flags(xe, 0, bb_size, region1);
+	bb = xe_bo_create(xe, 0, bb_size, region1);
 
 	if (!blt_uses_extended_block_copy(xe))
 		pext3 = NULL;
tests/intel/xe_copy_basic.c +4 -4
index 191c29155..715f7d3b5 100644
@@ -52,7 +52,7 @@ mem_copy(int fd, uint32_t src_handle, uint32_t dst_handle, const intel_ctx_t *ct
 	uint32_t bb;
 	int result;
 
-	bb = xe_bo_create_flags(fd, 0, bb_size, region);
+	bb = xe_bo_create(fd, 0, bb_size, region);
 
 	blt_mem_init(fd, &mem);
 	blt_set_mem_object(&mem.src, src_handle, size, 0, width, height,
@@ -102,7 +102,7 @@ mem_set(int fd, uint32_t dst_handle, const intel_ctx_t *ctx, uint32_t size,
 	uint32_t bb;
 	uint8_t *result;
 
-	bb = xe_bo_create_flags(fd, 0, bb_size, region);
+	bb = xe_bo_create(fd, 0, bb_size, region);
 	blt_mem_init(fd, &mem);
 	blt_set_mem_object(&mem.dst, dst_handle, size, 0, width, height, region,
 			   dst_mocs, M_LINEAR, COMPRESSION_DISABLED);
@@ -132,8 +132,8 @@ static void copy_test(int fd, uint32_t size, enum blt_cmd_type cmd, uint32_t reg
 	uint32_t bo_size = ALIGN(size, xe_get_default_alignment(fd));
 	intel_ctx_t *ctx;
 
-	src_handle = xe_bo_create_flags(fd, 0, bo_size, region);
-	dst_handle = xe_bo_create_flags(fd, 0, bo_size, region);
+	src_handle = xe_bo_create(fd, 0, bo_size, region);
+	dst_handle = xe_bo_create(fd, 0, bo_size, region);
 	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
 	exec_queue = xe_exec_queue_create(fd, vm, &inst, 0);
 	ctx = intel_ctx_xe(fd, vm, exec_queue, 0, 0, 0);
tests/intel/xe_dma_buf_sync.c +2 -2
index 0d835dddb..ac9d9d767 100644
@@ -119,8 +119,8 @@ test_export_dma_buf(struct drm_xe_engine_class_instance *hwe0,
 	bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd[0]),
 			xe_get_default_alignment(fd[0]));
 	for (i = 0; i < n_bo; ++i) {
-		bo[i] = xe_bo_create_flags(fd[0], 0, bo_size,
-					   visible_vram_if_possible(fd[0], hwe0->gt_id));
+		bo[i] = xe_bo_create(fd[0], 0, bo_size,
+				     visible_vram_if_possible(fd[0], hwe0->gt_id));
 		dma_buf_fd[i] = prime_handle_to_fd(fd[0], bo[i]);
 		import_bo[i] = prime_fd_to_handle(fd[1], dma_buf_fd[i]);
 
tests/intel/xe_drm_fdinfo.c +3 -3
index 4ef30cf49..8f737a533 100644
@@ -85,7 +85,7 @@ static void test_active(int fd, struct drm_xe_engine_class_instance *eci)
 		igt_assert_f(ret != 0, "failed with err:%d\n", errno);
 		pre_size = info.region_mem[memregion->instance + 1].active;
 
-		bo = xe_bo_create_flags(fd, vm, bo_size, region);
+		bo = xe_bo_create(fd, vm, bo_size, region);
 		data = xe_bo_map(fd, bo, bo_size);
 
 		for (i = 0; i < N_EXEC_QUEUES; i++) {
@@ -185,7 +185,7 @@ static void test_shared(int xe)
 		igt_assert_f(ret != 0, "failed with err:%d\n", errno);
 		pre_size = info.region_mem[memregion->instance + 1].shared;
 
-		bo = xe_bo_create_flags(xe, 0, BO_SIZE, region);
+		bo = xe_bo_create(xe, 0, BO_SIZE, region);
 
 		flink.handle = bo;
 		ret = igt_ioctl(xe, DRM_IOCTL_GEM_FLINK, &flink);
@@ -232,7 +232,7 @@ static void test_total_resident(int xe)
 		igt_assert_f(ret != 0, "failed with err:%d\n", errno);
 		pre_size = info.region_mem[memregion->instance + 1].shared;
 
-		handle = xe_bo_create_flags(xe, vm, BO_SIZE, region);
+		handle = xe_bo_create(xe, vm, BO_SIZE, region);
 		xe_vm_bind_sync(xe, vm, handle, 0, addr, BO_SIZE);
 
 		ret = igt_parse_drm_fdinfo(xe, &info, NULL, 0, NULL, 0);
tests/intel/xe_evict.c +20 -20
index 6d953e58b..a9d501d5f 100644
@@ -99,18 +99,18 @@ test_evict(int fd, struct drm_xe_engine_class_instance *eci,
                                 i < n_execs / 8 ? 0 : vm;
 
 			if (flags & MULTI_VM) {
-				__bo = bo[i] = xe_bo_create_flags(fd, 0,
-								  bo_size,
-								  visible_vram_memory(fd, eci->gt_id));
+				__bo = bo[i] = xe_bo_create(fd, 0,
+							    bo_size,
+							    visible_vram_memory(fd, eci->gt_id));
 			} else if (flags & THREADED) {
-				__bo = bo[i] = xe_bo_create_flags(fd, vm,
-								  bo_size,
-								  visible_vram_memory(fd, eci->gt_id));
+				__bo = bo[i] = xe_bo_create(fd, vm,
+							    bo_size,
+							    visible_vram_memory(fd, eci->gt_id));
 			} else {
-				__bo = bo[i] = xe_bo_create_flags(fd, _vm,
-								  bo_size,
-								  visible_vram_memory(fd, eci->gt_id) |
-								  system_memory(fd));
+				__bo = bo[i] = xe_bo_create(fd, _vm,
+							    bo_size,
+							    visible_vram_memory(fd, eci->gt_id) |
+							    system_memory(fd));
 			}
 		} else {
 			__bo = bo[i % (n_execs / 2)];
@@ -275,18 +275,18 @@ test_evict_cm(int fd, struct drm_xe_engine_class_instance *eci,
                                 i < n_execs / 8 ? 0 : vm;
 
 			if (flags & MULTI_VM) {
-				__bo = bo[i] = xe_bo_create_flags(fd, 0,
-								  bo_size,
-								  visible_vram_memory(fd, eci->gt_id));
+				__bo = bo[i] = xe_bo_create(fd, 0,
+							    bo_size,
+							    visible_vram_memory(fd, eci->gt_id));
 			} else if (flags & THREADED) {
-				__bo = bo[i] = xe_bo_create_flags(fd, vm,
-								  bo_size,
-								  visible_vram_memory(fd, eci->gt_id));
+				__bo = bo[i] = xe_bo_create(fd, vm,
+							    bo_size,
+							    visible_vram_memory(fd, eci->gt_id));
 			} else {
-				__bo = bo[i] = xe_bo_create_flags(fd, _vm,
-								  bo_size,
-								  visible_vram_memory(fd, eci->gt_id) |
-								  system_memory(fd));
+				__bo = bo[i] = xe_bo_create(fd, _vm,
+							    bo_size,
+							    visible_vram_memory(fd, eci->gt_id) |
+							    system_memory(fd));
 			}
 		} else {
 			__bo = bo[i % (n_execs / 2)];
tests/intel/xe_evict_ccs.c +3 -3
index 1f5c795ef..1dc12eedd 100644
@@ -82,7 +82,7 @@ static void copy_obj(struct blt_copy_data *blt,
 	w = src_obj->x2;
 	h = src_obj->y2;
 
-	bb = xe_bo_create_flags(fd, 0, bb_size, visible_vram_memory(fd, 0));
+	bb = xe_bo_create(fd, 0, bb_size, visible_vram_memory(fd, 0));
 
 	blt->color_depth = CD_32bit;
 	blt->print_bb = params.print_bb;
@@ -274,8 +274,8 @@ static void evict_single(int fd, int child, const struct config *config)
 		}
 
 		if (config->flags & TEST_SIMPLE) {
-			big_obj = xe_bo_create_flags(fd, vm, kb_left * SZ_1K,
-						     vram_memory(fd, 0));
+			big_obj = xe_bo_create(fd, vm, kb_left * SZ_1K,
+					       vram_memory(fd, 0));
 			break;
 		}
 
tests/intel/xe_exec_balancer.c +3 -3
index 8a0165b8c..da34e117d 100644
@@ -70,7 +70,7 @@ static void test_all_active(int fd, int gt, int class)
 	bo_size = sizeof(*data) * num_placements;
 	bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd), xe_get_default_alignment(fd));
 
-	bo = xe_bo_create_flags(fd, vm, bo_size, visible_vram_if_possible(fd, gt));
+	bo = xe_bo_create(fd, vm, bo_size, visible_vram_if_possible(fd, gt));
 	data = xe_bo_map(fd, bo, bo_size);
 
 	for (i = 0; i < num_placements; i++) {
@@ -224,7 +224,7 @@ test_exec(int fd, int gt, int class, int n_exec_queues, int n_execs,
 		}
 		memset(data, 0, bo_size);
 	} else {
-		bo = xe_bo_create_flags(fd, vm, bo_size, visible_vram_if_possible(fd, gt));
+		bo = xe_bo_create(fd, vm, bo_size, visible_vram_if_possible(fd, gt));
 		data = xe_bo_map(fd, bo, bo_size);
 	}
 
@@ -452,7 +452,7 @@ test_cm(int fd, int gt, int class, int n_exec_queues, int n_execs,
 			igt_assert(data);
 		}
 	} else {
-		bo = xe_bo_create_flags(fd, vm, bo_size, visible_vram_if_possible(fd, gt));
+		bo = xe_bo_create(fd, vm, bo_size, visible_vram_if_possible(fd, gt));
 		data = xe_bo_map(fd, bo, bo_size);
 	}
 	memset(data, 0, bo_size);
tests/intel/xe_exec_basic.c +1 -2
index a401f0165..841696b68 100644
@@ -140,8 +140,7 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 		if (flags & DEFER_ALLOC)
 			bo_flags |= DRM_XE_GEM_CREATE_FLAG_DEFER_BACKING;
 
-		bo = xe_bo_create_flags(fd, n_vm == 1 ? vm[0] : 0,
-					bo_size, bo_flags);
+		bo = xe_bo_create(fd, n_vm == 1 ? vm[0] : 0, bo_size, bo_flags);
 		if (!(flags & DEFER_BIND))
 			data = xe_bo_map(fd, bo, bo_size);
 	}
tests/intel/xe_exec_compute_mode.c +2 -2
index 20d3fc6e8..beb962f79 100644
@@ -141,8 +141,8 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 			igt_assert(data);
 		}
 	} else {
-		bo = xe_bo_create_flags(fd, flags & VM_FOR_BO ? vm : 0,
-					bo_size, visible_vram_if_possible(fd, eci->gt_id));
+		bo = xe_bo_create(fd, flags & VM_FOR_BO ? vm : 0,
+				  bo_size, visible_vram_if_possible(fd, eci->gt_id));
 		data = xe_bo_map(fd, bo, bo_size);
 	}
 	memset(data, 0, bo_size);
tests/intel/xe_exec_fault_mode.c +5 -5
index 92d552f97..903ad430d 100644
@@ -151,12 +151,12 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 		}
 	} else {
 		if (flags & PREFETCH)
-			bo = xe_bo_create_flags(fd, 0, bo_size,
-						all_memory_regions(fd) |
-						visible_vram_if_possible(fd, 0));
+			bo = xe_bo_create(fd, 0, bo_size,
+					  all_memory_regions(fd) |
+					  visible_vram_if_possible(fd, 0));
 		else
-			bo = xe_bo_create_flags(fd, 0, bo_size,
-						visible_vram_if_possible(fd, eci->gt_id));
+			bo = xe_bo_create(fd, 0, bo_size,
+					  visible_vram_if_possible(fd, eci->gt_id));
 		data = xe_bo_map(fd, bo, bo_size);
 	}
 	memset(data, 0, bo_size);
tests/intel/xe_exec_reset.c +8 -8
index 195e62911..704690e83 100644
@@ -50,8 +50,8 @@ static void test_spin(int fd, struct drm_xe_engine_class_instance *eci)
 	bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd),
 			xe_get_default_alignment(fd));
 
-	bo = xe_bo_create_flags(fd, vm, bo_size,
-				visible_vram_if_possible(fd, eci->gt_id));
+	bo = xe_bo_create(fd, vm, bo_size,
+			  visible_vram_if_possible(fd, eci->gt_id));
 	spin = xe_bo_map(fd, bo, bo_size);
 
 	exec_queue = xe_exec_queue_create(fd, vm, eci, 0);
@@ -181,7 +181,7 @@ test_balancer(int fd, int gt, int class, int n_exec_queues, int n_execs,
 	bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd),
 			xe_get_default_alignment(fd));
 
-	bo = xe_bo_create_flags(fd, vm, bo_size, visible_vram_if_possible(fd, gt));
+	bo = xe_bo_create(fd, vm, bo_size, visible_vram_if_possible(fd, gt));
 	data = xe_bo_map(fd, bo, bo_size);
 
 	for (i = 0; i < n_exec_queues; i++) {
@@ -367,8 +367,8 @@ test_legacy_mode(int fd, struct drm_xe_engine_class_instance *eci,
 	bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd),
 			xe_get_default_alignment(fd));
 
-	bo = xe_bo_create_flags(fd, vm, bo_size,
-				visible_vram_if_possible(fd, eci->gt_id));
+	bo = xe_bo_create(fd, vm, bo_size,
+			  visible_vram_if_possible(fd, eci->gt_id));
 	data = xe_bo_map(fd, bo, bo_size);
 
 	for (i = 0; i < n_exec_queues; i++) {
@@ -534,8 +534,8 @@ test_compute_mode(int fd, struct drm_xe_engine_class_instance *eci,
 	bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd),
 			xe_get_default_alignment(fd));
 
-	bo = xe_bo_create_flags(fd, vm, bo_size,
-				visible_vram_if_possible(fd, eci->gt_id));
+	bo = xe_bo_create(fd, vm, bo_size,
+			  visible_vram_if_possible(fd, eci->gt_id));
 	data = xe_bo_map(fd, bo, bo_size);
 	memset(data, 0, bo_size);
 
@@ -661,7 +661,7 @@ static void submit_jobs(struct gt_thread_data *t)
 	uint32_t bo;
 	uint32_t *data;
 
-	bo = xe_bo_create_flags(fd, vm, bo_size, visible_vram_if_possible(fd, 0));
+	bo = xe_bo_create(fd, vm, bo_size, visible_vram_if_possible(fd, 0));
 	data = xe_bo_map(fd, bo, bo_size);
 	data[0] = MI_BATCH_BUFFER_END;
 
tests/intel/xe_exec_store.c +6 -6
index 9c14bfd14..bcc4de8d0 100644
@@ -81,8 +81,8 @@ static void store(int fd)
 			xe_get_default_alignment(fd));
 
 	hw_engine = xe_hw_engine(fd, 1);
-	bo = xe_bo_create_flags(fd, vm, bo_size,
-				visible_vram_if_possible(fd, hw_engine->gt_id));
+	bo = xe_bo_create(fd, vm, bo_size,
+			  visible_vram_if_possible(fd, hw_engine->gt_id));
 
 	xe_vm_bind_async(fd, vm, hw_engine->gt_id, bo, 0, addr, bo_size, &sync, 1);
 	data = xe_bo_map(fd, bo, bo_size);
@@ -150,8 +150,8 @@ static void store_cachelines(int fd, struct drm_xe_engine_class_instance *eci,
 	sync[0].handle = syncobj_create(fd, 0);
 
 	for (i = 0; i < count; i++) {
-		bo[i] = xe_bo_create_flags(fd, vm, bo_size,
-					       visible_vram_if_possible(fd, eci->gt_id));
+		bo[i] = xe_bo_create(fd, vm, bo_size,
+				     visible_vram_if_possible(fd, eci->gt_id));
 		bo_map[i] = xe_bo_map(fd, bo[i], bo_size);
 		dst_offset[i] = intel_allocator_alloc_with_strategy(ahnd, bo[i],
 								    bo_size, 0,
@@ -235,8 +235,8 @@ static void store_all(int fd, int gt, int class)
 	bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd),
 			xe_get_default_alignment(fd));
 
-	bo = xe_bo_create_flags(fd, vm, bo_size,
-				visible_vram_if_possible(fd, 0));
+	bo = xe_bo_create(fd, vm, bo_size,
+			  visible_vram_if_possible(fd, 0));
 	data = xe_bo_map(fd, bo, bo_size);
 
 	xe_for_each_hw_engine(fd, hwe) {
tests/intel/xe_exec_threads.c +6 -6
index bb979b18c..a9b0c0b09 100644
@@ -106,8 +106,8 @@ test_balancer(int fd, int gt, uint32_t vm, uint64_t addr, uint64_t userptr,
 			igt_assert(data);
 		}
 	} else {
-		bo = xe_bo_create_flags(fd, vm, bo_size,
-					visible_vram_if_possible(fd, gt));
+		bo = xe_bo_create(fd, vm, bo_size,
+				  visible_vram_if_possible(fd, gt));
 		data = xe_bo_map(fd, bo, bo_size);
 	}
 	memset(data, 0, bo_size);
@@ -307,8 +307,8 @@ test_compute_mode(int fd, uint32_t vm, uint64_t addr, uint64_t userptr,
 			igt_assert(data);
 		}
 	} else {
-		bo = xe_bo_create_flags(fd, 0, bo_size,
-					visible_vram_if_possible(fd, eci->gt_id));
+		bo = xe_bo_create(fd, 0, bo_size,
+				  visible_vram_if_possible(fd, eci->gt_id));
 		data = xe_bo_map(fd, bo, bo_size);
 	}
 	memset(data, 0, bo_size);
@@ -510,8 +510,8 @@ test_legacy_mode(int fd, uint32_t vm, uint64_t addr, uint64_t userptr,
 			igt_assert(data);
 		}
 	} else {
-		bo = xe_bo_create_flags(fd, vm, bo_size,
-					visible_vram_if_possible(fd, eci->gt_id));
+		bo = xe_bo_create(fd, vm, bo_size,
+				  visible_vram_if_possible(fd, eci->gt_id));
 		data = xe_bo_map(fd, bo, bo_size);
 	}
 	memset(data, 0, bo_size);
tests/intel/xe_exercise_blt.c +2 -2
index fd310138d..9c69be3ef 100644
@@ -125,7 +125,7 @@ static void fast_copy_emit(int xe, const intel_ctx_t *ctx,
 	uint32_t bb, width = param.width, height = param.height;
 	int result;
 
-	bb = xe_bo_create_flags(xe, 0, bb_size, region1);
+	bb = xe_bo_create(xe, 0, bb_size, region1);
 
 	blt_copy_init(xe, &bltinit);
 	src = blt_create_object(&bltinit, region1, width, height, bpp, 0,
@@ -184,7 +184,7 @@ static void fast_copy(int xe, const intel_ctx_t *ctx,
 	uint32_t width = param.width, height = param.height;
 	int result;
 
-	bb = xe_bo_create_flags(xe, 0, bb_size, region1);
+	bb = xe_bo_create(xe, 0, bb_size, region1);
 
 	blt_copy_init(xe, &blt);
 	src = blt_create_object(&blt, region1, width, height, bpp, 0,
tests/intel/xe_guc_pc.c +2 -2
index fa2f20cca..1e29d8905 100644
@@ -65,8 +65,8 @@ static void exec_basic(int fd, struct drm_xe_engine_class_instance *eci,
 	bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd),
 			xe_get_default_alignment(fd));
 
-	bo = xe_bo_create_flags(fd, vm, bo_size,
-				visible_vram_if_possible(fd, eci->gt_id));
+	bo = xe_bo_create(fd, vm, bo_size,
+			  visible_vram_if_possible(fd, eci->gt_id));
 	data = xe_bo_map(fd, bo, bo_size);
 
 	for (i = 0; i < n_exec_queues; i++) {
tests/intel/xe_intel_bb.c +1 -1
index d66996cd5..a3a315297 100644
@@ -396,7 +396,7 @@ static void create_in_region(struct buf_ops *bops, uint64_t region)
 		intel_bb_set_debug(ibb, true);
 
 	size = xe_min_page_size(xe, system_memory(xe));
-	handle = xe_bo_create_flags(xe, 0, size, system_memory(xe));
+	handle = xe_bo_create(xe, 0, size, system_memory(xe));
 	intel_buf_init_full(bops, handle, &buf,
 			    width/4, height, 32, 0,
 			    I915_TILING_NONE, 0,
tests/intel/xe_mmap.c +16 -16
index 7e7e43c00..a805eabda 100644
@@ -52,7 +52,7 @@ test_mmap(int fd, uint32_t flags)
 
 	igt_require_f(flags, "Device doesn't support such memory region\n");
 
-	bo = xe_bo_create_flags(fd, 0, 4096, flags);
+	bo = xe_bo_create(fd, 0, 4096, flags);
 
 	map = xe_bo_map(fd, bo, 4096);
 	strcpy(map, "Write some data to the BO!");
@@ -72,8 +72,8 @@ static void test_bad_flags(int fd)
 {
 	uint64_t size = xe_get_default_alignment(fd);
 	struct drm_xe_gem_mmap_offset mmo = {
-		.handle = xe_bo_create_flags(fd, 0, size,
-					     visible_vram_if_possible(fd, 0)),
+		.handle = xe_bo_create(fd, 0, size,
+				       visible_vram_if_possible(fd, 0)),
 		.flags = -1u,
 	};
 
@@ -92,8 +92,8 @@ static void test_bad_extensions(int fd)
 	uint64_t size = xe_get_default_alignment(fd);
 	struct xe_user_extension ext;
 	struct drm_xe_gem_mmap_offset mmo = {
-		.handle = xe_bo_create_flags(fd, 0, size,
-					     visible_vram_if_possible(fd, 0)),
+		.handle = xe_bo_create(fd, 0, size,
+				       visible_vram_if_possible(fd, 0)),
 	};
 
 	mmo.extensions = to_user_pointer(&ext);
@@ -113,8 +113,8 @@ static void test_bad_object(int fd)
 {
 	uint64_t size = xe_get_default_alignment(fd);
 	struct drm_xe_gem_mmap_offset mmo = {
-		.handle = xe_bo_create_flags(fd, 0, size,
-					     visible_vram_if_possible(fd, 0)),
+		.handle = xe_bo_create(fd, 0, size,
+				       visible_vram_if_possible(fd, 0)),
 	};
 
 	mmo.handle = 0xdeadbeef;
@@ -159,13 +159,13 @@ static void test_small_bar(int fd)
 	uint32_t *map;
 
 	/* 2BIG invalid case */
-	igt_assert_neq(__xe_bo_create_flags(fd, 0, visible_size + 4096,
-					    visible_vram_memory(fd, 0), &bo),
+	igt_assert_neq(__xe_bo_create(fd, 0, visible_size + 4096,
+				      visible_vram_memory(fd, 0), &bo),
 		       0);
 
 	/* Normal operation */
-	bo = xe_bo_create_flags(fd, 0, visible_size / 4,
-				visible_vram_memory(fd, 0));
+	bo = xe_bo_create(fd, 0, visible_size / 4,
+			  visible_vram_memory(fd, 0));
 	mmo = xe_bo_mmap_offset(fd, bo);
 	map = mmap(NULL, 4096, PROT_WRITE, MAP_SHARED, fd, mmo);
 	igt_assert(map != MAP_FAILED);
@@ -176,9 +176,9 @@ static void test_small_bar(int fd)
 	gem_close(fd, bo);
 
 	/* Normal operation with system memory spilling */
-	bo = xe_bo_create_flags(fd, 0, visible_size,
-				visible_vram_memory(fd, 0) |
-				system_memory(fd));
+	bo = xe_bo_create(fd, 0, visible_size,
+			  visible_vram_memory(fd, 0) |
+			  system_memory(fd));
 	mmo = xe_bo_mmap_offset(fd, bo);
 	map = mmap(NULL, 4096, PROT_WRITE, MAP_SHARED, fd, mmo);
 	igt_assert(map != MAP_FAILED);
@@ -189,8 +189,8 @@ static void test_small_bar(int fd)
 	gem_close(fd, bo);
 
 	/* Bogus operation with SIGBUS */
-	bo = xe_bo_create_flags(fd, 0, visible_size + 4096,
-				vram_memory(fd, 0));
+	bo = xe_bo_create(fd, 0, visible_size + 4096,
+			  vram_memory(fd, 0));
 	mmo = xe_bo_mmap_offset(fd, bo);
 	map = mmap(NULL, 4096, PROT_WRITE, MAP_SHARED, fd, mmo);
 	igt_assert(map != MAP_FAILED);
tests/intel/xe_noexec_ping_pong.c +2 -2
index 9c2a70ff3..88ef39783 100644
@@ -70,8 +70,8 @@ static void test_ping_pong(int fd, struct drm_xe_engine_class_instance *eci)
 				  (unsigned long) bo_size,
 				  (unsigned int) vm[i]);
 
-			bo[i][j] = xe_bo_create_flags(fd, vm[i], bo_size,
-						      vram_memory(fd, 0));
+			bo[i][j] = xe_bo_create(fd, vm[i], bo_size,
+						vram_memory(fd, 0));
 			xe_vm_bind(fd, vm[i], bo[i][j], 0, 0x40000 + j*bo_size,
 				   bo_size, NULL, 0);
 		}
tests/intel/xe_perf_pmu.c +2 -2
index 2c549f778..406bd4b8d 100644
@@ -103,7 +103,7 @@ static void test_any_engine_busyness(int fd, struct drm_xe_engine_class_instance
 	bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd),
 			xe_get_default_alignment(fd));
 
-	bo = xe_bo_create_flags(fd, vm, bo_size, vram_if_possible(fd, 0));
+	bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, 0));
 	spin = xe_bo_map(fd, bo, bo_size);
 
 	exec_queue = xe_exec_queue_create(fd, vm, eci, 0);
@@ -223,7 +223,7 @@ static void test_engine_group_busyness(int fd, int gt, int class, const char *na
 	bo_size = sizeof(*data) * num_placements;
 	bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd), xe_get_default_alignment(fd));
 
-	bo = xe_bo_create_flags(fd, vm, bo_size, vram_if_possible(fd, 0));
+	bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, 0));
 	data = xe_bo_map(fd, bo, bo_size);
 
 	for (i = 0; i < num_placements; i++) {
tests/intel/xe_pm.c +3 -3
index 18afb68b0..d72e921cf 100644
@@ -271,8 +271,8 @@ test_exec(device_t device, struct drm_xe_engine_class_instance *eci,
 	if (check_rpm && runtime_usage_available(device.pci_xe))
 		rpm_usage = igt_pm_get_runtime_usage(device.pci_xe);
 
-	bo = xe_bo_create_flags(device.fd_xe, vm, bo_size,
-				visible_vram_if_possible(device.fd_xe, eci->gt_id));
+	bo = xe_bo_create(device.fd_xe, vm, bo_size,
+			  visible_vram_if_possible(device.fd_xe, eci->gt_id));
 	data = xe_bo_map(device.fd_xe, bo, bo_size);
 
 	for (i = 0; i < n_exec_queues; i++) {
@@ -409,7 +409,7 @@ static void test_vram_d3cold_threshold(device_t device, int sysfs_fd)
 	threshold = vram_used_mb + (SIZE / 1024 /1024);
 	igt_require(threshold < vram_total_mb);
 
-	bo = xe_bo_create_flags(device.fd_xe, 0, SIZE, flags);
+	bo = xe_bo_create(device.fd_xe, 0, SIZE, flags);
 	map = xe_bo_map(device.fd_xe, bo, SIZE);
 	memset(map, 0, SIZE);
 	munmap(map, SIZE);
tests/intel/xe_pm_residency.c +2 -2
index c87eeef3c..cc133f5fb 100644
@@ -100,8 +100,8 @@ static void exec_load(int fd, struct drm_xe_engine_class_instance *hwe, unsigned
 	exec_queue = xe_exec_queue_create(fd, vm, hwe, 0);
 	bo_size = xe_get_default_alignment(fd);
 
-	bo = xe_bo_create_flags(fd, vm, bo_size,
-				visible_vram_if_possible(fd, hwe->gt_id));
+	bo = xe_bo_create(fd, vm, bo_size,
+			  visible_vram_if_possible(fd, hwe->gt_id));
 	data = xe_bo_map(fd, bo, bo_size);
 	syncobj = syncobj_create(fd, 0);
 
tests/intel/xe_prime_self_import.c +14 -14
index 536230f9f..378368eaa 100644
@@ -105,7 +105,7 @@ static void test_with_fd_dup(void)
 	fd1 = drm_open_driver(DRIVER_XE);
 	fd2 = drm_open_driver(DRIVER_XE);
 
-	handle = xe_bo_create_flags(fd1, 0, bo_size, visible_vram_if_possible(fd1, 0));
+	handle = xe_bo_create(fd1, 0, bo_size, visible_vram_if_possible(fd1, 0));
 
 	dma_buf_fd1 = prime_handle_to_fd(fd1, handle);
 	gem_close(fd1, handle);
@@ -138,8 +138,8 @@ static void test_with_two_bos(void)
 	fd1 = drm_open_driver(DRIVER_XE);
 	fd2 = drm_open_driver(DRIVER_XE);
 
-	handle1 = xe_bo_create_flags(fd1, 0, bo_size, visible_vram_if_possible(fd1, 0));
-	handle2 = xe_bo_create_flags(fd1, 0, bo_size, visible_vram_if_possible(fd1, 0));
+	handle1 = xe_bo_create(fd1, 0, bo_size, visible_vram_if_possible(fd1, 0));
+	handle2 = xe_bo_create(fd1, 0, bo_size, visible_vram_if_possible(fd1, 0));
 
 	dma_buf_fd = prime_handle_to_fd(fd1, handle1);
 	handle_import = prime_fd_to_handle(fd2, dma_buf_fd);
@@ -174,8 +174,8 @@ static void test_with_one_bo_two_files(void)
 	fd1 = drm_open_driver(DRIVER_XE);
 	fd2 = drm_open_driver(DRIVER_XE);
 
-	handle_orig = xe_bo_create_flags(fd1, 0, bo_size,
-					 visible_vram_if_possible(fd1, 0));
+	handle_orig = xe_bo_create(fd1, 0, bo_size,
+				   visible_vram_if_possible(fd1, 0));
 	dma_buf_fd1 = prime_handle_to_fd(fd1, handle_orig);
 
 	flink_name = gem_flink(fd1, handle_orig);
@@ -207,7 +207,7 @@ static void test_with_one_bo(void)
 	fd1 = drm_open_driver(DRIVER_XE);
 	fd2 = drm_open_driver(DRIVER_XE);
 
-	handle = xe_bo_create_flags(fd1, 0, bo_size, visible_vram_if_possible(fd1, 0));
+	handle = xe_bo_create(fd1, 0, bo_size, visible_vram_if_possible(fd1, 0));
 
 	dma_buf_fd = prime_handle_to_fd(fd1, handle);
 	handle_import1 = prime_fd_to_handle(fd2, dma_buf_fd);
@@ -293,8 +293,8 @@ static void *thread_fn_reimport_vs_close(void *p)
 
 	fds[0] = drm_open_driver(DRIVER_XE);
 
-	handle = xe_bo_create_flags(fds[0], 0, bo_size,
-				    visible_vram_if_possible(fds[0], 0));
+	handle = xe_bo_create(fds[0], 0, bo_size,
+			      visible_vram_if_possible(fds[0], 0));
 
 	fds[1] = prime_handle_to_fd(fds[0], handle);
 	pthread_barrier_init(&g_barrier, NULL, num_threads);
@@ -336,8 +336,8 @@ static void *thread_fn_export_vs_close(void *p)
 
 	igt_until_timeout(g_time_out) {
 		/* We want to race gem close against prime export on handle one.*/
-		handle = xe_bo_create_flags(fd, 0, bo_size,
-					    visible_vram_if_possible(fd, 0));
+		handle = xe_bo_create(fd, 0, bo_size,
+				      visible_vram_if_possible(fd, 0));
 		if (handle != 1)
 			gem_close(fd, handle);
 
@@ -433,8 +433,8 @@ static void test_llseek_size(void)
 	for (i = 0; i < 10; i++) {
 		int bufsz = xe_get_default_alignment(fd) << i;
 
-		handle = xe_bo_create_flags(fd, 0, bufsz,
-					    visible_vram_if_possible(fd, 0));
+		handle = xe_bo_create(fd, 0, bufsz,
+				      visible_vram_if_possible(fd, 0));
 		dma_buf_fd = prime_handle_to_fd(fd, handle);
 
 		gem_close(fd, handle);
@@ -462,8 +462,8 @@ static void test_llseek_bad(void)
 
 	fd = drm_open_driver(DRIVER_XE);
 
-	handle = xe_bo_create_flags(fd, 0, bo_size,
-				    visible_vram_if_possible(fd, 0));
+	handle = xe_bo_create(fd, 0, bo_size,
+			      visible_vram_if_possible(fd, 0));
 	dma_buf_fd = prime_handle_to_fd(fd, handle);
 
 	gem_close(fd, handle);
tests/intel/xe_spin_batch.c +1 -1
index 261fde9af..c1b161f9c 100644
@@ -169,7 +169,7 @@ static void xe_spin_fixed_duration(int fd)
 	exec_queue = xe_exec_queue_create_class(fd, vm, DRM_XE_ENGINE_CLASS_COPY);
 	ahnd = intel_allocator_open(fd, 0, INTEL_ALLOCATOR_RELOC);
 	bo_size = ALIGN(sizeof(*spin) + xe_cs_prefetch_size(fd), xe_get_default_alignment(fd));
-	bo = xe_bo_create_flags(fd, vm, bo_size, vram_if_possible(fd, 0));
+	bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, 0));
 	spin = xe_bo_map(fd, bo, bo_size);
 	spin_addr = intel_allocator_alloc_with_strategy(ahnd, bo, bo_size, 0,
 							ALLOC_STRATEGY_LOW_TO_HIGH);
tests/intel/xe_vm.c +17 -18
index 3a34fde67..0b9a0f9d6 100644
@@ -51,8 +51,8 @@ write_dwords(int fd, uint32_t vm, int n_dwords, uint64_t *addrs)
 	batch_size = (n_dwords * 4 + 1) * sizeof(uint32_t);
 	batch_size = ALIGN(batch_size + xe_cs_prefetch_size(fd),
 			   xe_get_default_alignment(fd));
-	batch_bo = xe_bo_create_flags(fd, vm, batch_size,
-				      visible_vram_if_possible(fd, 0));
+	batch_bo = xe_bo_create(fd, vm, batch_size,
+				visible_vram_if_possible(fd, 0));
 	batch_map = xe_bo_map(fd, batch_bo, batch_size);
 
 	for (i = 0; i < n_dwords; i++) {
@@ -116,7 +116,7 @@ __test_bind_one_bo(int fd, uint32_t vm, int n_addrs, uint64_t *addrs)
 		vms = malloc(sizeof(*vms) * n_addrs);
 		igt_assert(vms);
 	}
-	bo = xe_bo_create_flags(fd, vm, bo_size, visible_vram_if_possible(fd, 0));
+	bo = xe_bo_create(fd, vm, bo_size, visible_vram_if_possible(fd, 0));
 	map = xe_bo_map(fd, bo, bo_size);
 	memset(map, 0, bo_size);
 
@@ -267,7 +267,7 @@ static void test_partial_unbinds(int fd)
 {
 	uint32_t vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
 	size_t bo_size = 3 * xe_get_default_alignment(fd);
-	uint32_t bo = xe_bo_create_flags(fd, vm, bo_size, vram_if_possible(fd, 0));
+	uint32_t bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, 0));
 	uint64_t unbind_size = bo_size / 3;
 	uint64_t addr = 0x1a0000;
 
@@ -316,7 +316,7 @@ static void unbind_all(int fd, int n_vmas)
 	};
 
 	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
-	bo = xe_bo_create_flags(fd, vm, bo_size, vram_if_possible(fd, 0));
+	bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, 0));
 
 	for (i = 0; i < n_vmas; ++i)
 		xe_vm_bind_async(fd, vm, 0, bo, 0, addr + i * bo_size,
@@ -362,7 +362,6 @@ static void userptr_invalid(int fd)
 	xe_vm_destroy(fd, vm);
 }
 
-
 /**
  * SUBTEST: shared-%s-page
  * Description: Test shared arg[1] page
@@ -419,8 +418,8 @@ shared_pte_page(int fd, struct drm_xe_engine_class_instance *eci, int n_bo,
 			xe_get_default_alignment(fd));
 
 	for (i = 0; i < n_bo; ++i) {
-		bo[i] = xe_bo_create_flags(fd, vm, bo_size,
-					   visible_vram_if_possible(fd, eci->gt_id));
+		bo[i] = xe_bo_create(fd, vm, bo_size,
+				     visible_vram_if_possible(fd, eci->gt_id));
 		data[i] = xe_bo_map(fd, bo[i], bo_size);
 	}
 
@@ -598,8 +597,8 @@ test_bind_execqueues_independent(int fd, struct drm_xe_engine_class_instance *ec
 	bo_size = sizeof(*data) * N_EXEC_QUEUES;
 	bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd),
 			xe_get_default_alignment(fd));
-	bo = xe_bo_create_flags(fd, vm, bo_size,
-				visible_vram_if_possible(fd, eci->gt_id));
+	bo = xe_bo_create(fd, vm, bo_size,
+			  visible_vram_if_possible(fd, eci->gt_id));
 	data = xe_bo_map(fd, bo, bo_size);
 
 	for (i = 0; i < N_EXEC_QUEUES; i++) {
@@ -779,8 +778,8 @@ test_bind_array(int fd, struct drm_xe_engine_class_instance *eci, int n_execs,
 	bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd),
 			xe_get_default_alignment(fd));
 
-	bo = xe_bo_create_flags(fd, vm, bo_size,
-				visible_vram_if_possible(fd, eci->gt_id));
+	bo = xe_bo_create(fd, vm, bo_size,
+			  visible_vram_if_possible(fd, eci->gt_id));
 	data = xe_bo_map(fd, bo, bo_size);
 
 	if (flags & BIND_ARRAY_BIND_EXEC_QUEUE_FLAG)
@@ -977,8 +976,8 @@ test_large_binds(int fd, struct drm_xe_engine_class_instance *eci,
 		igt_skip_on(xe_visible_vram_size(fd, 0) && bo_size >
 			    xe_visible_vram_size(fd, 0));
 
-		bo = xe_bo_create_flags(fd, vm, bo_size,
-					visible_vram_if_possible(fd, eci->gt_id));
+		bo = xe_bo_create(fd, vm, bo_size,
+				  visible_vram_if_possible(fd, eci->gt_id));
 		map = xe_bo_map(fd, bo, bo_size);
 	}
 
@@ -1269,8 +1268,8 @@ test_munmap_style_unbind(int fd, struct drm_xe_engine_class_instance *eci,
 			    MAP_ANONYMOUS, -1, 0);
 		igt_assert(map != MAP_FAILED);
 	} else {
-		bo = xe_bo_create_flags(fd, vm, bo_size,
-					visible_vram_if_possible(fd, eci->gt_id));
+		bo = xe_bo_create(fd, vm, bo_size,
+				  visible_vram_if_possible(fd, eci->gt_id));
 		map = xe_bo_map(fd, bo, bo_size);
 	}
 	memset(map, 0, bo_size);
@@ -1573,9 +1572,9 @@ test_mmap_style_bind(int fd, struct drm_xe_engine_class_instance *eci,
 		igt_assert(map0 != MAP_FAILED);
 		igt_assert(map1 != MAP_FAILED);
 	} else {
-		bo0 = xe_bo_create_flags(fd, vm, bo_size, vram_if_possible(fd, eci->gt_id));
+		bo0 = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, eci->gt_id));
 		map0 = xe_bo_map(fd, bo0, bo_size);
-		bo1 = xe_bo_create_flags(fd, vm, bo_size, vram_if_possible(fd, eci->gt_id));
+		bo1 = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, eci->gt_id));
 		map1 = xe_bo_map(fd, bo1, bo_size);
 	}
 	memset(map0, 0, bo_size);
tests/intel/xe_waitfence.c +7 -7
index 05060f329..913afcdb5 100644
@@ -64,19 +64,19 @@ waitfence(int fd, enum waittype wt)
 	int64_t timeout;
 
 	uint32_t vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
-	bo_1 = xe_bo_create_flags(fd, vm, 0x40000, MY_FLAG);
+	bo_1 = xe_bo_create(fd, vm, 0x40000, MY_FLAG);
 	do_bind(fd, vm, bo_1, 0, 0x200000, 0x40000, 1);
-	bo_2 = xe_bo_create_flags(fd, vm, 0x40000, MY_FLAG);
+	bo_2 = xe_bo_create(fd, vm, 0x40000, MY_FLAG);
 	do_bind(fd, vm, bo_2, 0, 0xc0000000, 0x40000, 2);
-	bo_3 = xe_bo_create_flags(fd, vm, 0x40000, MY_FLAG);
+	bo_3 = xe_bo_create(fd, vm, 0x40000, MY_FLAG);
 	do_bind(fd, vm, bo_3, 0, 0x180000000, 0x40000, 3);
-	bo_4 = xe_bo_create_flags(fd, vm, 0x10000, MY_FLAG);
+	bo_4 = xe_bo_create(fd, vm, 0x10000, MY_FLAG);
 	do_bind(fd, vm, bo_4, 0, 0x140000000, 0x10000, 4);
-	bo_5 = xe_bo_create_flags(fd, vm, 0x100000, MY_FLAG);
+	bo_5 = xe_bo_create(fd, vm, 0x100000, MY_FLAG);
 	do_bind(fd, vm, bo_5, 0, 0x100000000, 0x100000, 5);
-	bo_6 = xe_bo_create_flags(fd, vm, 0x1c0000, MY_FLAG);
+	bo_6 = xe_bo_create(fd, vm, 0x1c0000, MY_FLAG);
 	do_bind(fd, vm, bo_6, 0, 0xc0040000, 0x1c0000, 6);
-	bo_7 = xe_bo_create_flags(fd, vm, 0x10000, MY_FLAG);
+	bo_7 = xe_bo_create(fd, vm, 0x10000, MY_FLAG);
 	do_bind(fd, vm, bo_7, 0, 0xeffff0000, 0x10000, 7);
 
 	if (wt == RELTIME) {
tests/kms_addfb_basic.c +1 -1
index fc16b8814..4f293c2ee 100644
@@ -199,7 +199,7 @@ static void invalid_tests(int fd)
 			handle = gem_create_in_memory_regions(fd, size, REGION_SMEM);
 		} else {
 			igt_require(xe_has_vram(fd));
-			handle = xe_bo_create_flags(fd, 0, size, system_memory(fd));
+			handle = xe_bo_create(fd, 0, size, system_memory(fd));
 		}
 
 		f.handles[0] = handle;
tests/kms_getfb.c +1 -1
index 059f66d99..1f9e813d8 100644
@@ -149,7 +149,7 @@ static void get_ccs_fb(int fd, struct drm_mode_fb_cmd2 *ret)
 	if (is_i915_device(fd))
 		add.handles[0] = gem_buffer_create_fb_obj(fd, size);
 	else
-		add.handles[0] = xe_bo_create_flags(fd, 0, size, vram_if_possible(fd, 0));
+		add.handles[0] = xe_bo_create(fd, 0, size, vram_if_possible(fd, 0));
 	igt_require(add.handles[0] != 0);
 
 	if (!HAS_FLATCCS(devid))
Signature · 1 line
2.34.1
#17 lore raw

PATCH v3 17/57 xe_query: Add missing include.

In reply to Francois Dugast

From: Rodrigo Vivi <[email protected]>

When trying to use xe_for_each_mem_region from a caller that is not importing the igt_aux.h, the following build issue will occur:

../lib/xe/xe_query.h:76:38: error: implicit declaration of function ‘igt_fls’ [-Werror=implicit-function-declaration]
76 | for (uint64_t __i = 0; __i < igt_fls(__memreg); __i++) \

So, to avoid a dependency chain, let's include from the file that is using the helper.

---
 lib/xe/xe_query.h | 2 ++
 1 file changed, 2 insertions(+)
lib/xe/xe_query.h +2 -0
index c63b97044..938c8b411 100644
@@ -11,6 +11,8 @@
 
 #include <stdint.h>
 #include <xe_drm.h>
+
+#include "igt_aux.h"
 #include "igt_list.h"
 #include "igt_sizes.h"
 
Signature · 1 line
2.34.1
#18 lore raw

PATCH v3 18/57 xe_query: Kill visible_vram_if_possible

In reply to Francois Dugast

From: Rodrigo Vivi <[email protected]>

Let the caller set the flag and the xe_bo_query clear if not needed.

Although the current helper makes the code cleaner, the goal is to split the flags into placement and flags as two different arguments on xe_bo_create. So, the flag decision cannot be hidden under the helper.

---
 benchmarks/gem_wsim.c              |  3 ++-
 lib/igt_draw.c                     |  3 ++-
 lib/igt_fb.c                       |  3 ++-
 lib/intel_batchbuffer.c            |  6 ++++--
 lib/xe/xe_ioctl.c                  | 19 +++++++++++++++++++
 lib/xe/xe_query.c                  | 19 -------------------
 lib/xe/xe_query.h                  |  1 -
 lib/xe/xe_spin.c                   |  7 ++++---
 tests/intel/kms_ccs.c              |  3 ++-
 tests/intel/xe_dma_buf_sync.c      |  3 ++-
 tests/intel/xe_exec_balancer.c     |  9 ++++++---
 tests/intel/xe_exec_basic.c        |  2 +-
 tests/intel/xe_exec_compute_mode.c |  3 ++-
 tests/intel/xe_exec_fault_mode.c   |  6 ++++--
 tests/intel/xe_exec_reset.c        | 14 +++++++++-----
 tests/intel/xe_exec_store.c        |  9 ++++++---
 tests/intel/xe_exec_threads.c      |  9 ++++++---
 tests/intel/xe_guc_pc.c            |  3 ++-
 tests/intel/xe_mmap.c              |  9 ++++++---
 tests/intel/xe_pm.c                |  3 ++-
 tests/intel/xe_pm_residency.c      |  3 ++-
 tests/intel/xe_prime_self_import.c | 27 ++++++++++++++++++---------
 tests/intel/xe_vm.c                | 21 ++++++++++++++-------
 23 files changed, 115 insertions(+), 70 deletions(-)
benchmarks/gem_wsim.c +2 -1
index d6d3deb5f..966d9b465 100644
@@ -1735,7 +1735,8 @@ xe_alloc_step_batch(struct workload *wrk, struct w_step *w)
 	int i;
 
 	w->bb_handle = xe_bo_create(fd, vm->id, PAGE_SIZE,
-				visible_vram_if_possible(fd, eq->hwe_list[0].gt_id));
+				    vram_if_possible(fd, eq->hwe_list[0].gt_id) |
+				    DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	w->xe.data = xe_bo_map(fd, w->bb_handle, PAGE_SIZE);
 	w->xe.exec.address =
 		intel_allocator_alloc_with_strategy(vm->ahnd, w->bb_handle, PAGE_SIZE,
lib/igt_draw.c +2 -1
index 5935eb058..b16afd799 100644
@@ -797,7 +797,8 @@ static void draw_rect_render(int fd, struct cmd_data *cmd_data,
 	else
 		tmp.handle = xe_bo_create(fd, 0,
 					  ALIGN(tmp.size, xe_get_default_alignment(fd)),
-					  visible_vram_if_possible(fd, 0));
+					  vram_if_possible(fd, 0) |
+					  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 
 	tmp.stride = rect->w * pixel_size;
 	tmp.bpp = buf->bpp;
lib/igt_fb.c +2 -1
index f96dca7a4..0a6aa27c8 100644
@@ -1206,7 +1206,8 @@ static int create_bo_for_fb(struct igt_fb *fb, bool prefer_sysmem)
 			igt_assert(err == 0 || err == -EOPNOTSUPP);
 		} else if (is_xe_device(fd)) {
 			fb->gem_handle = xe_bo_create(fd, 0, fb->size,
-						      visible_vram_if_possible(fd, 0));
+						      vram_if_possible(fd, 0)
+						      | DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		} else if (is_vc4_device(fd)) {
 			fb->gem_handle = igt_vc4_create_bo(fd, fb->size);
 
lib/intel_batchbuffer.c +4 -2
index 47e8af84f..4fc1868b8 100644
@@ -945,7 +945,8 @@ __intel_bb_create(int fd, uint32_t ctx, uint32_t vm, const intel_ctx_cfg_t *cfg,
 
 		ibb->alignment = xe_get_default_alignment(fd);
 		size = ALIGN(size, ibb->alignment);
-		ibb->handle = xe_bo_create(fd, 0, size, visible_vram_if_possible(fd, 0));
+		ibb->handle = xe_bo_create(fd, 0, size, vram_if_possible(fd, 0) |
+					   DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 
 		/* Limit to 48-bit due to MI_* address limitation */
 		ibb->gtt_size = 1ull << min_t(uint32_t, xe_va_bits(fd), 48);
@@ -1404,7 +1405,8 @@ void intel_bb_reset(struct intel_bb *ibb, bool purge_objects_cache)
 		ibb->handle = gem_create(ibb->fd, ibb->size);
 	else
 		ibb->handle = xe_bo_create(ibb->fd, 0, ibb->size,
-					   visible_vram_if_possible(ibb->fd, 0));
+					   vram_if_possible(ibb->fd, 0) |
+					   DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 
 	/* Reacquire offset for RELOC and SIMPLE */
 	if (ibb->allocator_type == INTEL_ALLOCATOR_SIMPLE ||
lib/xe/xe_ioctl.c +19 -0
index aafd77966..4e21e4c84 100644
@@ -226,6 +226,18 @@ void xe_vm_destroy(int fd, uint32_t vm)
 	igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_VM_DESTROY, &destroy), 0);
 }
 
+static bool vram_selected(int fd, uint32_t selected_regions)
+{
+	uint64_t regions = all_memory_regions(fd) & selected_regions;
+	uint64_t region;
+
+	xe_for_each_mem_region(fd, regions, region)
+		if (xe_mem_region(fd, region)->mem_class == DRM_XE_MEM_REGION_CLASS_VRAM)
+			return true;
+
+	return false;
+}
+
 uint32_t __xe_bo_create(int fd, uint32_t vm, uint64_t size, uint32_t flags,
 			uint32_t *handle)
 {
@@ -236,6 +248,13 @@ uint32_t __xe_bo_create(int fd, uint32_t vm, uint64_t size, uint32_t flags,
 	};
 	int err;
 
+	/*
+	 * In case vram_if_possible returned system_memory,
+	 *  visible VRAM cannot be requested through flags
+	 */
+	if (!vram_selected(fd, flags))
+		create.flags &= ~DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM;
+
 	err = igt_ioctl(fd, DRM_IOCTL_XE_GEM_CREATE, &create);
 	if (err)
 		return err;
lib/xe/xe_query.c +0 -19
index 3afbd0c63..7b9611b62 100644
@@ -426,25 +426,6 @@ uint64_t vram_if_possible(int fd, int gt)
 	return vram_memory(fd, gt) ?: system_memory(fd);
 }
 
-/**
- * visible_vram_if_possible:
- * @fd: xe device fd
- * @gt: gt id
- *
- * Returns vram memory bitmask for xe device @fd and @gt id or system memory if
- * there's no vram memory available for @gt. Also attaches the
- * DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM to ensure that CPU access is possible
- * when using vram.
- */
-uint64_t visible_vram_if_possible(int fd, int gt)
-{
-	uint64_t regions = all_memory_regions(fd);
-	uint64_t system_memory = regions & 0x1;
-	uint64_t vram = regions & (0x2 << gt);
-
-	return vram ? vram | DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM : system_memory;
-}
-
 /**
  * xe_hw_engines:
  * @fd: xe device fd
lib/xe/xe_query.h +0 -1
index 938c8b411..6910198b2 100644
@@ -85,7 +85,6 @@ uint64_t system_memory(int fd);
 uint64_t vram_memory(int fd, int gt);
 uint64_t visible_vram_memory(int fd, int gt);
 uint64_t vram_if_possible(int fd, int gt);
-uint64_t visible_vram_if_possible(int fd, int gt);
 struct drm_xe_engine_class_instance *xe_hw_engines(int fd);
 struct drm_xe_engine_class_instance *xe_hw_engine(int fd, int idx);
 struct drm_xe_query_mem_region *xe_mem_region(int fd, uint64_t region);
lib/xe/xe_spin.c +4 -3
index 828938434..270b58bf5 100644
@@ -220,7 +220,8 @@ xe_spin_create(int fd, const struct igt_spin_factory *opt)
 	}
 
 	spin->handle = xe_bo_create(fd, spin->vm, bo_size,
-				    visible_vram_if_possible(fd, 0));
+				    vram_if_possible(fd, 0) |
+				    DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	xe_spin = xe_bo_map(fd, spin->handle, bo_size);
 	addr = intel_allocator_alloc_with_strategy(ahnd, spin->handle, bo_size, 0, ALLOC_STRATEGY_LOW_TO_HIGH);
 	xe_vm_bind_sync(fd, spin->vm, spin->handle, 0, addr, bo_size);
@@ -298,8 +299,8 @@ void xe_cork_init(int fd, struct drm_xe_engine_class_instance *hwe,
 
 	vm = xe_vm_create(fd, 0, 0);
 
-	bo = xe_bo_create(fd, vm, bo_size,
-			  visible_vram_if_possible(fd, hwe->gt_id));
+	bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, hwe->gt_id) |
+			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	spin = xe_bo_map(fd, bo, 0x1000);
 
 	xe_vm_bind_sync(fd, vm, bo, 0, addr, bo_size);
tests/intel/kms_ccs.c +2 -1
index 337afc00c..5ae28615f 100644
@@ -435,7 +435,8 @@ static void test_bad_ccs_plane(data_t *data, int width, int height, int ccs_plan
 		bad_ccs_bo = is_i915_device(data->drm_fd) ?
 				gem_create(data->drm_fd, fb.size) :
 				xe_bo_create(data->drm_fd, 0, fb.size,
-					     visible_vram_if_possible(data->drm_fd, 0));
+					     vram_if_possible(data->drm_fd, 0) |
+					     DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		f.handles[ccs_plane] = bad_ccs_bo;
 	}
 
tests/intel/xe_dma_buf_sync.c +2 -1
index ac9d9d767..9318647af 100644
@@ -120,7 +120,8 @@ test_export_dma_buf(struct drm_xe_engine_class_instance *hwe0,
 			xe_get_default_alignment(fd[0]));
 	for (i = 0; i < n_bo; ++i) {
 		bo[i] = xe_bo_create(fd[0], 0, bo_size,
-				     visible_vram_if_possible(fd[0], hwe0->gt_id));
+				     vram_if_possible(fd[0], hwe0->gt_id) |
+				     DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		dma_buf_fd[i] = prime_handle_to_fd(fd[0], bo[i]);
 		import_bo[i] = prime_fd_to_handle(fd[1], dma_buf_fd[i]);
 
tests/intel/xe_exec_balancer.c +6 -3
index da34e117d..388bb6185 100644
@@ -70,7 +70,8 @@ static void test_all_active(int fd, int gt, int class)
 	bo_size = sizeof(*data) * num_placements;
 	bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd), xe_get_default_alignment(fd));
 
-	bo = xe_bo_create(fd, vm, bo_size, visible_vram_if_possible(fd, gt));
+	bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, gt) |
+			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(fd, bo, bo_size);
 
 	for (i = 0; i < num_placements; i++) {
@@ -224,7 +225,8 @@ test_exec(int fd, int gt, int class, int n_exec_queues, int n_execs,
 		}
 		memset(data, 0, bo_size);
 	} else {
-		bo = xe_bo_create(fd, vm, bo_size, visible_vram_if_possible(fd, gt));
+		bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, gt) |
+				  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		data = xe_bo_map(fd, bo, bo_size);
 	}
 
@@ -452,7 +454,8 @@ test_cm(int fd, int gt, int class, int n_exec_queues, int n_execs,
 			igt_assert(data);
 		}
 	} else {
-		bo = xe_bo_create(fd, vm, bo_size, visible_vram_if_possible(fd, gt));
+		bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, gt) |
+				  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		data = xe_bo_map(fd, bo, bo_size);
 	}
 	memset(data, 0, bo_size);
tests/intel/xe_exec_basic.c +1 -1
index 841696b68..ca287b2e5 100644
@@ -136,7 +136,7 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 	} else {
 		uint32_t bo_flags;
 
-		bo_flags = visible_vram_if_possible(fd, eci->gt_id);
+		bo_flags = vram_if_possible(fd, eci->gt_id) | DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM;
 		if (flags & DEFER_ALLOC)
 			bo_flags |= DRM_XE_GEM_CREATE_FLAG_DEFER_BACKING;
 
tests/intel/xe_exec_compute_mode.c +2 -1
index beb962f79..07a27fd29 100644
@@ -142,7 +142,8 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 		}
 	} else {
 		bo = xe_bo_create(fd, flags & VM_FOR_BO ? vm : 0,
-				  bo_size, visible_vram_if_possible(fd, eci->gt_id));
+				  bo_size, vram_if_possible(fd, eci->gt_id) |
+				  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		data = xe_bo_map(fd, bo, bo_size);
 	}
 	memset(data, 0, bo_size);
tests/intel/xe_exec_fault_mode.c +4 -2
index 903ad430d..bfd61c4ea 100644
@@ -153,10 +153,12 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 		if (flags & PREFETCH)
 			bo = xe_bo_create(fd, 0, bo_size,
 					  all_memory_regions(fd) |
-					  visible_vram_if_possible(fd, 0));
+					  vram_if_possible(fd, 0) |
+					  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		else
 			bo = xe_bo_create(fd, 0, bo_size,
-					  visible_vram_if_possible(fd, eci->gt_id));
+					  vram_if_possible(fd, eci->gt_id) |
+					  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		data = xe_bo_map(fd, bo, bo_size);
 	}
 	memset(data, 0, bo_size);
tests/intel/xe_exec_reset.c +9 -5
index 704690e83..3affb19ae 100644
@@ -51,7 +51,8 @@ static void test_spin(int fd, struct drm_xe_engine_class_instance *eci)
 			xe_get_default_alignment(fd));
 
 	bo = xe_bo_create(fd, vm, bo_size,
-			  visible_vram_if_possible(fd, eci->gt_id));
+			  vram_if_possible(fd, eci->gt_id) |
+			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	spin = xe_bo_map(fd, bo, bo_size);
 
 	exec_queue = xe_exec_queue_create(fd, vm, eci, 0);
@@ -181,7 +182,8 @@ test_balancer(int fd, int gt, int class, int n_exec_queues, int n_execs,
 	bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd),
 			xe_get_default_alignment(fd));
 
-	bo = xe_bo_create(fd, vm, bo_size, visible_vram_if_possible(fd, gt));
+	bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, gt) |
+			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(fd, bo, bo_size);
 
 	for (i = 0; i < n_exec_queues; i++) {
@@ -368,7 +370,7 @@ test_legacy_mode(int fd, struct drm_xe_engine_class_instance *eci,
 			xe_get_default_alignment(fd));
 
 	bo = xe_bo_create(fd, vm, bo_size,
-			  visible_vram_if_possible(fd, eci->gt_id));
+			  vram_if_possible(fd, eci->gt_id) | DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(fd, bo, bo_size);
 
 	for (i = 0; i < n_exec_queues; i++) {
@@ -535,7 +537,8 @@ test_compute_mode(int fd, struct drm_xe_engine_class_instance *eci,
 			xe_get_default_alignment(fd));
 
 	bo = xe_bo_create(fd, vm, bo_size,
-			  visible_vram_if_possible(fd, eci->gt_id));
+			  vram_if_possible(fd, eci->gt_id) |
+			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(fd, bo, bo_size);
 	memset(data, 0, bo_size);
 
@@ -661,7 +664,8 @@ static void submit_jobs(struct gt_thread_data *t)
 	uint32_t bo;
 	uint32_t *data;
 
-	bo = xe_bo_create(fd, vm, bo_size, visible_vram_if_possible(fd, 0));
+	bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, 0) |
+			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(fd, bo, bo_size);
 	data[0] = MI_BATCH_BUFFER_END;
 
tests/intel/xe_exec_store.c +6 -3
index bcc4de8d0..884183202 100644
@@ -82,7 +82,8 @@ static void store(int fd)
 
 	hw_engine = xe_hw_engine(fd, 1);
 	bo = xe_bo_create(fd, vm, bo_size,
-			  visible_vram_if_possible(fd, hw_engine->gt_id));
+			  vram_if_possible(fd, hw_engine->gt_id) |
+			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 
 	xe_vm_bind_async(fd, vm, hw_engine->gt_id, bo, 0, addr, bo_size, &sync, 1);
 	data = xe_bo_map(fd, bo, bo_size);
@@ -151,7 +152,8 @@ static void store_cachelines(int fd, struct drm_xe_engine_class_instance *eci,
 
 	for (i = 0; i < count; i++) {
 		bo[i] = xe_bo_create(fd, vm, bo_size,
-				     visible_vram_if_possible(fd, eci->gt_id));
+				     vram_if_possible(fd, eci->gt_id) |
+				     DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		bo_map[i] = xe_bo_map(fd, bo[i], bo_size);
 		dst_offset[i] = intel_allocator_alloc_with_strategy(ahnd, bo[i],
 								    bo_size, 0,
@@ -236,7 +238,8 @@ static void store_all(int fd, int gt, int class)
 			xe_get_default_alignment(fd));
 
 	bo = xe_bo_create(fd, vm, bo_size,
-			  visible_vram_if_possible(fd, 0));
+			  vram_if_possible(fd, 0) |
+			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(fd, bo, bo_size);
 
 	xe_for_each_hw_engine(fd, hwe) {
tests/intel/xe_exec_threads.c +6 -3
index a9b0c0b09..ebc41dadd 100644
@@ -107,7 +107,8 @@ test_balancer(int fd, int gt, uint32_t vm, uint64_t addr, uint64_t userptr,
 		}
 	} else {
 		bo = xe_bo_create(fd, vm, bo_size,
-				  visible_vram_if_possible(fd, gt));
+				  vram_if_possible(fd, gt) |
+				  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		data = xe_bo_map(fd, bo, bo_size);
 	}
 	memset(data, 0, bo_size);
@@ -308,7 +309,8 @@ test_compute_mode(int fd, uint32_t vm, uint64_t addr, uint64_t userptr,
 		}
 	} else {
 		bo = xe_bo_create(fd, 0, bo_size,
-				  visible_vram_if_possible(fd, eci->gt_id));
+				  vram_if_possible(fd, eci->gt_id) |
+				  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		data = xe_bo_map(fd, bo, bo_size);
 	}
 	memset(data, 0, bo_size);
@@ -511,7 +513,8 @@ test_legacy_mode(int fd, uint32_t vm, uint64_t addr, uint64_t userptr,
 		}
 	} else {
 		bo = xe_bo_create(fd, vm, bo_size,
-				  visible_vram_if_possible(fd, eci->gt_id));
+				  vram_if_possible(fd, eci->gt_id) |
+				  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		data = xe_bo_map(fd, bo, bo_size);
 	}
 	memset(data, 0, bo_size);
tests/intel/xe_guc_pc.c +2 -1
index 1e29d8905..4234475e0 100644
@@ -66,7 +66,8 @@ static void exec_basic(int fd, struct drm_xe_engine_class_instance *eci,
 			xe_get_default_alignment(fd));
 
 	bo = xe_bo_create(fd, vm, bo_size,
-			  visible_vram_if_possible(fd, eci->gt_id));
+			  vram_if_possible(fd, eci->gt_id) |
+			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(fd, bo, bo_size);
 
 	for (i = 0; i < n_exec_queues; i++) {
tests/intel/xe_mmap.c +6 -3
index a805eabda..a4b53ad48 100644
@@ -73,7 +73,8 @@ static void test_bad_flags(int fd)
 	uint64_t size = xe_get_default_alignment(fd);
 	struct drm_xe_gem_mmap_offset mmo = {
 		.handle = xe_bo_create(fd, 0, size,
-				       visible_vram_if_possible(fd, 0)),
+				       vram_if_possible(fd, 0) |
+				       DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM),
 		.flags = -1u,
 	};
 
@@ -93,7 +94,8 @@ static void test_bad_extensions(int fd)
 	struct xe_user_extension ext;
 	struct drm_xe_gem_mmap_offset mmo = {
 		.handle = xe_bo_create(fd, 0, size,
-				       visible_vram_if_possible(fd, 0)),
+				       vram_if_possible(fd, 0) |
+				       DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM),
 	};
 
 	mmo.extensions = to_user_pointer(&ext);
@@ -114,7 +116,8 @@ static void test_bad_object(int fd)
 	uint64_t size = xe_get_default_alignment(fd);
 	struct drm_xe_gem_mmap_offset mmo = {
 		.handle = xe_bo_create(fd, 0, size,
-				       visible_vram_if_possible(fd, 0)),
+				       vram_if_possible(fd, 0) |
+				       DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM),
 	};
 
 	mmo.handle = 0xdeadbeef;
tests/intel/xe_pm.c +2 -1
index d72e921cf..df85f2c05 100644
@@ -272,7 +272,8 @@ test_exec(device_t device, struct drm_xe_engine_class_instance *eci,
 		rpm_usage = igt_pm_get_runtime_usage(device.pci_xe);
 
 	bo = xe_bo_create(device.fd_xe, vm, bo_size,
-			  visible_vram_if_possible(device.fd_xe, eci->gt_id));
+			  vram_if_possible(device.fd_xe, eci->gt_id) |
+			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(device.fd_xe, bo, bo_size);
 
 	for (i = 0; i < n_exec_queues; i++) {
tests/intel/xe_pm_residency.c +2 -1
index cc133f5fb..40a1693b8 100644
@@ -101,7 +101,8 @@ static void exec_load(int fd, struct drm_xe_engine_class_instance *hwe, unsigned
 	bo_size = xe_get_default_alignment(fd);
 
 	bo = xe_bo_create(fd, vm, bo_size,
-			  visible_vram_if_possible(fd, hwe->gt_id));
+			  vram_if_possible(fd, hwe->gt_id) |
+			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(fd, bo, bo_size);
 	syncobj = syncobj_create(fd, 0);
 
tests/intel/xe_prime_self_import.c +18 -9
index 378368eaa..2c2f2898c 100644
@@ -105,7 +105,8 @@ static void test_with_fd_dup(void)
 	fd1 = drm_open_driver(DRIVER_XE);
 	fd2 = drm_open_driver(DRIVER_XE);
 
-	handle = xe_bo_create(fd1, 0, bo_size, visible_vram_if_possible(fd1, 0));
+	handle = xe_bo_create(fd1, 0, bo_size, vram_if_possible(fd1, 0) |
+			      DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 
 	dma_buf_fd1 = prime_handle_to_fd(fd1, handle);
 	gem_close(fd1, handle);
@@ -138,8 +139,10 @@ static void test_with_two_bos(void)
 	fd1 = drm_open_driver(DRIVER_XE);
 	fd2 = drm_open_driver(DRIVER_XE);
 
-	handle1 = xe_bo_create(fd1, 0, bo_size, visible_vram_if_possible(fd1, 0));
-	handle2 = xe_bo_create(fd1, 0, bo_size, visible_vram_if_possible(fd1, 0));
+	handle1 = xe_bo_create(fd1, 0, bo_size, vram_if_possible(fd1, 0) |
+			       DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
+	handle2 = xe_bo_create(fd1, 0, bo_size, vram_if_possible(fd1, 0) |
+			       DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 
 	dma_buf_fd = prime_handle_to_fd(fd1, handle1);
 	handle_import = prime_fd_to_handle(fd2, dma_buf_fd);
@@ -175,7 +178,8 @@ static void test_with_one_bo_two_files(void)
 	fd2 = drm_open_driver(DRIVER_XE);
 
 	handle_orig = xe_bo_create(fd1, 0, bo_size,
-				   visible_vram_if_possible(fd1, 0));
+				   vram_if_possible(fd1, 0) |
+				   DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	dma_buf_fd1 = prime_handle_to_fd(fd1, handle_orig);
 
 	flink_name = gem_flink(fd1, handle_orig);
@@ -207,7 +211,8 @@ static void test_with_one_bo(void)
 	fd1 = drm_open_driver(DRIVER_XE);
 	fd2 = drm_open_driver(DRIVER_XE);
 
-	handle = xe_bo_create(fd1, 0, bo_size, visible_vram_if_possible(fd1, 0));
+	handle = xe_bo_create(fd1, 0, bo_size, vram_if_possible(fd1, 0) |
+			      DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 
 	dma_buf_fd = prime_handle_to_fd(fd1, handle);
 	handle_import1 = prime_fd_to_handle(fd2, dma_buf_fd);
@@ -294,7 +299,8 @@ static void *thread_fn_reimport_vs_close(void *p)
 	fds[0] = drm_open_driver(DRIVER_XE);
 
 	handle = xe_bo_create(fds[0], 0, bo_size,
-			      visible_vram_if_possible(fds[0], 0));
+			      vram_if_possible(fds[0], 0) |
+			      DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 
 	fds[1] = prime_handle_to_fd(fds[0], handle);
 	pthread_barrier_init(&g_barrier, NULL, num_threads);
@@ -337,7 +343,8 @@ static void *thread_fn_export_vs_close(void *p)
 	igt_until_timeout(g_time_out) {
 		/* We want to race gem close against prime export on handle one.*/
 		handle = xe_bo_create(fd, 0, bo_size,
-				      visible_vram_if_possible(fd, 0));
+				      vram_if_possible(fd, 0) |
+				      DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		if (handle != 1)
 			gem_close(fd, handle);
 
@@ -434,7 +441,8 @@ static void test_llseek_size(void)
 		int bufsz = xe_get_default_alignment(fd) << i;
 
 		handle = xe_bo_create(fd, 0, bufsz,
-				      visible_vram_if_possible(fd, 0));
+				      vram_if_possible(fd, 0) |
+				      DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		dma_buf_fd = prime_handle_to_fd(fd, handle);
 
 		gem_close(fd, handle);
@@ -463,7 +471,8 @@ static void test_llseek_bad(void)
 	fd = drm_open_driver(DRIVER_XE);
 
 	handle = xe_bo_create(fd, 0, bo_size,
-			      visible_vram_if_possible(fd, 0));
+			      vram_if_possible(fd, 0) |
+			      DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	dma_buf_fd = prime_handle_to_fd(fd, handle);
 
 	gem_close(fd, handle);
tests/intel/xe_vm.c +14 -7
index 0b9a0f9d6..26913e449 100644
@@ -52,7 +52,8 @@ write_dwords(int fd, uint32_t vm, int n_dwords, uint64_t *addrs)
 	batch_size = ALIGN(batch_size + xe_cs_prefetch_size(fd),
 			   xe_get_default_alignment(fd));
 	batch_bo = xe_bo_create(fd, vm, batch_size,
-				visible_vram_if_possible(fd, 0));
+				vram_if_possible(fd, 0) |
+				DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	batch_map = xe_bo_map(fd, batch_bo, batch_size);
 
 	for (i = 0; i < n_dwords; i++) {
@@ -116,7 +117,8 @@ __test_bind_one_bo(int fd, uint32_t vm, int n_addrs, uint64_t *addrs)
 		vms = malloc(sizeof(*vms) * n_addrs);
 		igt_assert(vms);
 	}
-	bo = xe_bo_create(fd, vm, bo_size, visible_vram_if_possible(fd, 0));
+	bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, 0) |
+			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	map = xe_bo_map(fd, bo, bo_size);
 	memset(map, 0, bo_size);
 
@@ -419,7 +421,8 @@ shared_pte_page(int fd, struct drm_xe_engine_class_instance *eci, int n_bo,
 
 	for (i = 0; i < n_bo; ++i) {
 		bo[i] = xe_bo_create(fd, vm, bo_size,
-				     visible_vram_if_possible(fd, eci->gt_id));
+				     vram_if_possible(fd, eci->gt_id) |
+				     DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		data[i] = xe_bo_map(fd, bo[i], bo_size);
 	}
 
@@ -598,7 +601,8 @@ test_bind_execqueues_independent(int fd, struct drm_xe_engine_class_instance *ec
 	bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd),
 			xe_get_default_alignment(fd));
 	bo = xe_bo_create(fd, vm, bo_size,
-			  visible_vram_if_possible(fd, eci->gt_id));
+			  vram_if_possible(fd, eci->gt_id) |
+			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(fd, bo, bo_size);
 
 	for (i = 0; i < N_EXEC_QUEUES; i++) {
@@ -779,7 +783,8 @@ test_bind_array(int fd, struct drm_xe_engine_class_instance *eci, int n_execs,
 			xe_get_default_alignment(fd));
 
 	bo = xe_bo_create(fd, vm, bo_size,
-			  visible_vram_if_possible(fd, eci->gt_id));
+			  vram_if_possible(fd, eci->gt_id) |
+			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(fd, bo, bo_size);
 
 	if (flags & BIND_ARRAY_BIND_EXEC_QUEUE_FLAG)
@@ -977,7 +982,8 @@ test_large_binds(int fd, struct drm_xe_engine_class_instance *eci,
 			    xe_visible_vram_size(fd, 0));
 
 		bo = xe_bo_create(fd, vm, bo_size,
-				  visible_vram_if_possible(fd, eci->gt_id));
+				  vram_if_possible(fd, eci->gt_id) |
+				  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		map = xe_bo_map(fd, bo, bo_size);
 	}
 
@@ -1269,7 +1275,8 @@ test_munmap_style_unbind(int fd, struct drm_xe_engine_class_instance *eci,
 		igt_assert(map != MAP_FAILED);
 	} else {
 		bo = xe_bo_create(fd, vm, bo_size,
-				  visible_vram_if_possible(fd, eci->gt_id));
+				  vram_if_possible(fd, eci->gt_id) |
+				  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		map = xe_bo_map(fd, bo, bo_size);
 	}
 	memset(map, 0, bo_size);
Signature · 1 line
2.34.1
#19 lore raw

PATCH v3 19/57 drm-uapi/xe: Separate bo_create placement from flags

In reply to Francois Dugast

From: Rodrigo Vivi <[email protected]>

Align with kernel commit ("drm/xe/uapi: Separate bo_create placement from flags")

---
 benchmarks/gem_wsim.c              |  2 +-
 include/drm-uapi/xe_drm.h          | 12 +++++-----
 lib/igt_draw.c                     |  2 +-
 lib/igt_fb.c                       |  6 ++---
 lib/intel_batchbuffer.c            |  4 ++--
 lib/intel_blt.c                    |  4 ++--
 lib/intel_bufops.c                 |  2 +-
 lib/xe/xe_ioctl.c                  | 12 +++++-----
 lib/xe/xe_ioctl.h                  |  7 +++---
 lib/xe/xe_query.c                  | 14 ------------
 lib/xe/xe_query.h                  |  1 -
 lib/xe/xe_spin.c                   |  4 ++--
 tests/intel/api_intel_allocator.c  |  2 +-
 tests/intel/kms_big_fb.c           |  6 ++---
 tests/intel/kms_ccs.c              |  2 +-
 tests/intel/xe_ccs.c               | 12 +++++-----
 tests/intel/xe_copy_basic.c        |  8 +++----
 tests/intel/xe_create.c            |  4 ++--
 tests/intel/xe_dma_buf_sync.c      |  2 +-
 tests/intel/xe_drm_fdinfo.c        |  6 ++---
 tests/intel/xe_evict.c             | 22 +++++++++++-------
 tests/intel/xe_evict_ccs.c         |  5 +++--
 tests/intel/xe_exec_balancer.c     |  6 ++---
 tests/intel/xe_exec_basic.c        |  5 +++--
 tests/intel/xe_exec_compute_mode.c |  2 +-
 tests/intel/xe_exec_fault_mode.c   |  4 ++--
 tests/intel/xe_exec_reset.c        | 11 ++++-----
 tests/intel/xe_exec_store.c        |  6 ++---
 tests/intel/xe_exec_threads.c      |  6 ++---
 tests/intel/xe_exercise_blt.c      |  4 ++--
 tests/intel/xe_guc_pc.c            |  2 +-
 tests/intel/xe_intel_bb.c          |  2 +-
 tests/intel/xe_mmap.c              | 36 +++++++++++++++++-------------
 tests/intel/xe_noexec_ping_pong.c  |  2 +-
 tests/intel/xe_perf_pmu.c          |  4 ++--
 tests/intel/xe_pm.c                | 10 ++++-----
 tests/intel/xe_pm_residency.c      |  2 +-
 tests/intel/xe_prime_self_import.c | 18 +++++++--------
 tests/intel/xe_spin_batch.c        |  2 +-
 tests/intel/xe_vm.c                | 22 +++++++++---------
 tests/intel/xe_waitfence.c         | 16 ++++++-------
 tests/kms_addfb_basic.c            |  2 +-
 tests/kms_getfb.c                  |  2 +-
 43 files changed, 151 insertions(+), 152 deletions(-)
benchmarks/gem_wsim.c +1 -1
index 966d9b465..d134b2dea 100644
@@ -1735,7 +1735,7 @@ xe_alloc_step_batch(struct workload *wrk, struct w_step *w)
 	int i;
 
 	w->bb_handle = xe_bo_create(fd, vm->id, PAGE_SIZE,
-				    vram_if_possible(fd, eq->hwe_list[0].gt_id) |
+				    vram_if_possible(fd, eq->hwe_list[0].gt_id),
 				    DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	w->xe.data = xe_bo_map(fd, w->bb_handle, PAGE_SIZE);
 	w->xe.exec.address =
include/drm-uapi/xe_drm.h +6 -6
index 129ee5610..ea9309af7 100644
@@ -622,9 +622,12 @@ struct drm_xe_gem_create {
 	 */
 	__u64 size;
 
-#define DRM_XE_GEM_CREATE_FLAG_DEFER_BACKING		(0x1 << 24)
-#define DRM_XE_GEM_CREATE_FLAG_SCANOUT			(0x1 << 25)
-#define DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM	(0x1 << 26)
+	/** @placement: A mask of memory instances of where BO can be placed. */
+	__u32 placement;
+
+#define DRM_XE_GEM_CREATE_FLAG_DEFER_BACKING		(1 << 0)
+#define DRM_XE_GEM_CREATE_FLAG_SCANOUT			(1 << 1)
+#define DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM	(1 << 2)
 	/**
 	 * @flags: Flags, currently a mask of memory instances of where BO can
 	 * be placed
@@ -648,9 +651,6 @@ struct drm_xe_gem_create {
 	 */
 	__u32 handle;
 
-	/** @pad: MBZ */
-	__u32 pad;
-
 	/** @reserved: Reserved */
 	__u64 reserved[2];
 };
lib/igt_draw.c +1 -1
index b16afd799..1e0ff8707 100644
@@ -797,7 +797,7 @@ static void draw_rect_render(int fd, struct cmd_data *cmd_data,
 	else
 		tmp.handle = xe_bo_create(fd, 0,
 					  ALIGN(tmp.size, xe_get_default_alignment(fd)),
-					  vram_if_possible(fd, 0) |
+					  vram_if_possible(fd, 0),
 					  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 
 	tmp.stride = rect->w * pixel_size;
lib/igt_fb.c +3 -3
index 0a6aa27c8..9c1257801 100644
@@ -1206,8 +1206,8 @@ static int create_bo_for_fb(struct igt_fb *fb, bool prefer_sysmem)
 			igt_assert(err == 0 || err == -EOPNOTSUPP);
 		} else if (is_xe_device(fd)) {
 			fb->gem_handle = xe_bo_create(fd, 0, fb->size,
-						      vram_if_possible(fd, 0)
-						      | DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
+						      vram_if_possible(fd, 0),
+						      DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		} else if (is_vc4_device(fd)) {
 			fb->gem_handle = igt_vc4_create_bo(fd, fb->size);
 
@@ -2904,7 +2904,7 @@ static void blitcopy(const struct igt_fb *dst_fb,
 
 		bb_size = ALIGN(bb_size + xe_cs_prefetch_size(dst_fb->fd),
 				xe_get_default_alignment(dst_fb->fd));
-		xe_bb = xe_bo_create(dst_fb->fd, 0, bb_size, mem_region);
+		xe_bb = xe_bo_create(dst_fb->fd, 0, bb_size, mem_region, 0);
 	}
 
 	for (int i = 0; i < dst_fb->num_planes - dst_cc; i++) {
lib/intel_batchbuffer.c +2 -2
index 4fc1868b8..3f3755180 100644
@@ -945,7 +945,7 @@ __intel_bb_create(int fd, uint32_t ctx, uint32_t vm, const intel_ctx_cfg_t *cfg,
 
 		ibb->alignment = xe_get_default_alignment(fd);
 		size = ALIGN(size, ibb->alignment);
-		ibb->handle = xe_bo_create(fd, 0, size, vram_if_possible(fd, 0) |
+		ibb->handle = xe_bo_create(fd, 0, size, vram_if_possible(fd, 0),
 					   DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 
 		/* Limit to 48-bit due to MI_* address limitation */
@@ -1405,7 +1405,7 @@ void intel_bb_reset(struct intel_bb *ibb, bool purge_objects_cache)
 		ibb->handle = gem_create(ibb->fd, ibb->size);
 	else
 		ibb->handle = xe_bo_create(ibb->fd, 0, ibb->size,
-					   vram_if_possible(ibb->fd, 0) |
+					   vram_if_possible(ibb->fd, 0),
 					   DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 
 	/* Reacquire offset for RELOC and SIMPLE */
lib/intel_blt.c +2 -2
index 36830fb3e..2ab4f69cf 100644
@@ -1801,13 +1801,13 @@ blt_create_object(const struct blt_copy_data *blt, uint32_t region,
 	obj->size = size;
 
 	if (blt->driver == INTEL_DRIVER_XE) {
-		uint64_t flags = region;
+		uint64_t flags = 0;
 
 		if (create_mapping && region != system_memory(blt->fd))
 			flags |= DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM;
 
 		size = ALIGN(size, xe_get_default_alignment(blt->fd));
-		handle = xe_bo_create(blt->fd, 0, size, flags);
+		handle = xe_bo_create(blt->fd, 0, size, region, flags);
 	} else {
 		igt_assert(__gem_create_in_memory_regions(blt->fd, &handle,
 							  &size, region) == 0);
lib/intel_bufops.c +1 -1
index 6f3a77f47..5582481f6 100644
@@ -920,7 +920,7 @@ static void __intel_buf_init(struct buf_ops *bops,
 				igt_assert_eq(__gem_create(bops->fd, &size, &buf->handle), 0);
 		} else {
 			size = ALIGN(size, xe_get_default_alignment(bops->fd));
-			buf->handle = xe_bo_create(bops->fd, 0, size, region);
+			buf->handle = xe_bo_create(bops->fd, 0, size, region, 0);
 		}
 	}
 
lib/xe/xe_ioctl.c +7 -5
index 4e21e4c84..30f35657d 100644
@@ -238,12 +238,13 @@ static bool vram_selected(int fd, uint32_t selected_regions)
 	return false;
 }
 
-uint32_t __xe_bo_create(int fd, uint32_t vm, uint64_t size, uint32_t flags,
-			uint32_t *handle)
+uint32_t __xe_bo_create(int fd, uint32_t vm, uint64_t size, uint32_t placement,
+			uint32_t flags, uint32_t *handle)
 {
 	struct drm_xe_gem_create create = {
 		.vm_id = vm,
 		.size = size,
+		.placement = placement,
 		.flags = flags,
 	};
 	int err;
@@ -252,7 +253,7 @@ uint32_t __xe_bo_create(int fd, uint32_t vm, uint64_t size, uint32_t flags,
 	 * In case vram_if_possible returned system_memory,
 	 *  visible VRAM cannot be requested through flags
 	 */
-	if (!vram_selected(fd, flags))
+	if (!vram_selected(fd, placement))
 		create.flags &= ~DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM;
 
 	err = igt_ioctl(fd, DRM_IOCTL_XE_GEM_CREATE, &create);
@@ -263,11 +264,12 @@ uint32_t __xe_bo_create(int fd, uint32_t vm, uint64_t size, uint32_t flags,
 	return 0;
 }
 
-uint32_t xe_bo_create(int fd, uint32_t vm, uint64_t size, uint32_t flags)
+uint32_t xe_bo_create(int fd, uint32_t vm, uint64_t size, uint32_t placement,
+		      uint32_t flags)
 {
 	uint32_t handle;
 
-	igt_assert_eq(__xe_bo_create(fd, vm, size, flags, &handle), 0);
+	igt_assert_eq(__xe_bo_create(fd, vm, size, placement, flags, &handle), 0);
 
 	return handle;
 }
lib/xe/xe_ioctl.h +4 -3
index 294e9bc13..c19d0464b 100644
@@ -64,9 +64,10 @@ void xe_vm_unbind_all_async(int fd, uint32_t vm, uint32_t exec_queue,
 			    uint32_t bo, struct drm_xe_sync *sync,
 			    uint32_t num_syncs);
 void xe_vm_destroy(int fd, uint32_t vm);
-uint32_t __xe_bo_create(int fd, uint32_t vm, uint64_t size, uint32_t flags,
-			uint32_t *handle);
-uint32_t xe_bo_create(int fd, uint32_t vm, uint64_t size, uint32_t flags);
+uint32_t __xe_bo_create(int fd, uint32_t vm, uint64_t size, uint32_t placement,
+			uint32_t flags, uint32_t *handle);
+uint32_t xe_bo_create(int fd, uint32_t vm, uint64_t size, uint32_t placement,
+		      uint32_t flags);
 uint32_t xe_exec_queue_create(int fd, uint32_t vm,
 			  struct drm_xe_engine_class_instance *instance,
 			  uint64_t ext);
lib/xe/xe_query.c +0 -14
index 7b9611b62..c19988215 100644
@@ -399,20 +399,6 @@ uint64_t vram_memory(int fd, int gt)
 	return xe_has_vram(fd) ? native_region_for_gt(xe_dev->gt_list, gt) : 0;
 }
 
-/**
- * visible_vram_memory:
- * @fd: xe device fd
- * @gt: gt id
- *
- * Returns vram memory bitmask for xe device @fd and @gt id, with
- * DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM also set, to ensure that CPU access is
- * possible.
- */
-uint64_t visible_vram_memory(int fd, int gt)
-{
-	return vram_memory(fd, gt) | DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM;
-}
-
 /**
  * vram_if_possible:
  * @fd: xe device fd
lib/xe/xe_query.h +0 -1
index 6910198b2..eb23a89fb 100644
@@ -83,7 +83,6 @@ unsigned int xe_number_gt(int fd);
 uint64_t all_memory_regions(int fd);
 uint64_t system_memory(int fd);
 uint64_t vram_memory(int fd, int gt);
-uint64_t visible_vram_memory(int fd, int gt);
 uint64_t vram_if_possible(int fd, int gt);
 struct drm_xe_engine_class_instance *xe_hw_engines(int fd);
 struct drm_xe_engine_class_instance *xe_hw_engine(int fd, int idx);
lib/xe/xe_spin.c +2 -2
index 270b58bf5..91bc6664d 100644
@@ -220,7 +220,7 @@ xe_spin_create(int fd, const struct igt_spin_factory *opt)
 	}
 
 	spin->handle = xe_bo_create(fd, spin->vm, bo_size,
-				    vram_if_possible(fd, 0) |
+				    vram_if_possible(fd, 0),
 				    DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	xe_spin = xe_bo_map(fd, spin->handle, bo_size);
 	addr = intel_allocator_alloc_with_strategy(ahnd, spin->handle, bo_size, 0, ALLOC_STRATEGY_LOW_TO_HIGH);
@@ -299,7 +299,7 @@ void xe_cork_init(int fd, struct drm_xe_engine_class_instance *hwe,
 
 	vm = xe_vm_create(fd, 0, 0);
 
-	bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, hwe->gt_id) |
+	bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, hwe->gt_id),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	spin = xe_bo_map(fd, bo, 0x1000);
 
tests/intel/api_intel_allocator.c +1 -1
index 158fd86a1..2d01da7d0 100644
@@ -469,7 +469,7 @@ static void __simple_allocs(int fd)
 		size = (rand() % 4 + 1) * 0x1000;
 		if (is_xe)
 			handles[i] = xe_bo_create(fd, 0, size,
-						  system_memory(fd));
+						  system_memory(fd), 0);
 		else
 			handles[i] = gem_create(fd, size);
 
tests/intel/kms_big_fb.c +3 -3
index 9c2b8dc79..fde73bac0 100644
@@ -780,7 +780,7 @@ test_size_overflow(data_t *data)
 		bo = xe_bo_create(data->drm_fd, 0,
 				  ALIGN(((1ULL << 32) - 4096),
 					xe_get_default_alignment(data->drm_fd)),
-				  vram_if_possible(data->drm_fd, 0));
+				  vram_if_possible(data->drm_fd, 0), 0);
 	igt_require(bo);
 
 	ret = __kms_addfb(data->drm_fd, bo,
@@ -840,7 +840,7 @@ test_size_offset_overflow(data_t *data)
 		bo = xe_bo_create(data->drm_fd, 0,
 				  ALIGN(((1ULL << 32) - 4096),
 					xe_get_default_alignment(data->drm_fd)),
-				  vram_if_possible(data->drm_fd, 0));
+				  vram_if_possible(data->drm_fd, 0), 0);
 	igt_require(bo);
 
 	offsets[0] = 0;
@@ -928,7 +928,7 @@ test_addfb(data_t *data)
 	else
 		bo = xe_bo_create(data->drm_fd, 0,
 				  ALIGN(size, xe_get_default_alignment(data->drm_fd)),
-				  vram_if_possible(data->drm_fd, 0));
+				  vram_if_possible(data->drm_fd, 0), 0);
 	igt_require(bo);
 
 	if (is_i915_device(data->drm_fd) && intel_display_ver(data->devid) < 4)
tests/intel/kms_ccs.c +1 -1
index 5ae28615f..87f29170a 100644
@@ -435,7 +435,7 @@ static void test_bad_ccs_plane(data_t *data, int width, int height, int ccs_plan
 		bad_ccs_bo = is_i915_device(data->drm_fd) ?
 				gem_create(data->drm_fd, fb.size) :
 				xe_bo_create(data->drm_fd, 0, fb.size,
-					     vram_if_possible(data->drm_fd, 0) |
+					     vram_if_possible(data->drm_fd, 0),
 					     DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		f.handles[ccs_plane] = bad_ccs_bo;
 	}
tests/intel/xe_ccs.c +6 -6
index ceecba416..d742d726c 100644
@@ -102,8 +102,8 @@ static void surf_copy(int xe,
 
 	igt_assert(mid->compression);
 	ccscopy = (uint32_t *) malloc(ccssize);
-	ccs = xe_bo_create(xe, 0, ccssize, sysmem);
-	ccs2 = xe_bo_create(xe, 0, ccssize, sysmem);
+	ccs = xe_bo_create(xe, 0, ccssize, sysmem, 0);
+	ccs2 = xe_bo_create(xe, 0, ccssize, sysmem, 0);
 
 	blt_ctrl_surf_copy_init(xe, &surf);
 	surf.print_bb = param.print_bb;
@@ -111,7 +111,7 @@ static void surf_copy(int xe,
 				 uc_mocs, BLT_INDIRECT_ACCESS);
 	blt_set_ctrl_surf_object(&surf.dst, ccs, sysmem, ccssize, uc_mocs, DIRECT_ACCESS);
 	bb_size = xe_get_default_alignment(xe);
-	bb1 = xe_bo_create(xe, 0, bb_size, sysmem);
+	bb1 = xe_bo_create(xe, 0, bb_size, sysmem, 0);
 	blt_set_batch(&surf.bb, bb1, bb_size, sysmem);
 	blt_ctrl_surf_copy(xe, ctx, NULL, ahnd, &surf);
 	intel_ctx_xe_sync(ctx, true);
@@ -166,7 +166,7 @@ static void surf_copy(int xe,
 	blt_set_copy_object(&blt.dst, dst);
 	blt_set_object_ext(&ext.src, mid->compression_type, mid->x2, mid->y2, SURFACE_TYPE_2D);
 	blt_set_object_ext(&ext.dst, 0, dst->x2, dst->y2, SURFACE_TYPE_2D);
-	bb2 = xe_bo_create(xe, 0, bb_size, sysmem);
+	bb2 = xe_bo_create(xe, 0, bb_size, sysmem, 0);
 	blt_set_batch(&blt.bb, bb2, bb_size, sysmem);
 	blt_block_copy(xe, ctx, NULL, ahnd, &blt, &ext);
 	intel_ctx_xe_sync(ctx, true);
@@ -297,7 +297,7 @@ static void block_copy(int xe,
 	uint8_t uc_mocs = intel_get_uc_mocs_index(xe);
 	int result;
 
-	bb = xe_bo_create(xe, 0, bb_size, region1);
+	bb = xe_bo_create(xe, 0, bb_size, region1, 0);
 
 	if (!blt_uses_extended_block_copy(xe))
 		pext = NULL;
@@ -418,7 +418,7 @@ static void block_multicopy(int xe,
 	uint8_t uc_mocs = intel_get_uc_mocs_index(xe);
 	int result;
 
-	bb = xe_bo_create(xe, 0, bb_size, region1);
+	bb = xe_bo_create(xe, 0, bb_size, region1, 0);
 
 	if (!blt_uses_extended_block_copy(xe))
 		pext3 = NULL;
tests/intel/xe_copy_basic.c +4 -4
index 715f7d3b5..a51cc4c0d 100644
@@ -52,7 +52,7 @@ mem_copy(int fd, uint32_t src_handle, uint32_t dst_handle, const intel_ctx_t *ct
 	uint32_t bb;
 	int result;
 
-	bb = xe_bo_create(fd, 0, bb_size, region);
+	bb = xe_bo_create(fd, 0, bb_size, region, 0);
 
 	blt_mem_init(fd, &mem);
 	blt_set_mem_object(&mem.src, src_handle, size, 0, width, height,
@@ -102,7 +102,7 @@ mem_set(int fd, uint32_t dst_handle, const intel_ctx_t *ctx, uint32_t size,
 	uint32_t bb;
 	uint8_t *result;
 
-	bb = xe_bo_create(fd, 0, bb_size, region);
+	bb = xe_bo_create(fd, 0, bb_size, region, 0);
 	blt_mem_init(fd, &mem);
 	blt_set_mem_object(&mem.dst, dst_handle, size, 0, width, height, region,
 			   dst_mocs, M_LINEAR, COMPRESSION_DISABLED);
@@ -132,8 +132,8 @@ static void copy_test(int fd, uint32_t size, enum blt_cmd_type cmd, uint32_t reg
 	uint32_t bo_size = ALIGN(size, xe_get_default_alignment(fd));
 	intel_ctx_t *ctx;
 
-	src_handle = xe_bo_create(fd, 0, bo_size, region);
-	dst_handle = xe_bo_create(fd, 0, bo_size, region);
+	src_handle = xe_bo_create(fd, 0, bo_size, region, 0);
+	dst_handle = xe_bo_create(fd, 0, bo_size, region, 0);
 	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
 	exec_queue = xe_exec_queue_create(fd, vm, &inst, 0);
 	ctx = intel_ctx_xe(fd, vm, exec_queue, 0, 0, 0);
tests/intel/xe_create.c +2 -2
index 4242e1a67..4326b15e8 100644
@@ -18,13 +18,13 @@
 
 #define PAGE_SIZE 0x1000
 
-static int __create_bo(int fd, uint32_t vm, uint64_t size, uint32_t flags,
+static int __create_bo(int fd, uint32_t vm, uint64_t size, uint32_t placement,
 		       uint32_t *handlep)
 {
 	struct drm_xe_gem_create create = {
 		.vm_id = vm,
 		.size = size,
-		.flags = flags,
+		.placement = placement,
 	};
 	int ret = 0;
 
tests/intel/xe_dma_buf_sync.c +1 -1
index 9318647af..aeb4c4995 100644
@@ -120,7 +120,7 @@ test_export_dma_buf(struct drm_xe_engine_class_instance *hwe0,
 			xe_get_default_alignment(fd[0]));
 	for (i = 0; i < n_bo; ++i) {
 		bo[i] = xe_bo_create(fd[0], 0, bo_size,
-				     vram_if_possible(fd[0], hwe0->gt_id) |
+				     vram_if_possible(fd[0], hwe0->gt_id),
 				     DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		dma_buf_fd[i] = prime_handle_to_fd(fd[0], bo[i]);
 		import_bo[i] = prime_fd_to_handle(fd[1], dma_buf_fd[i]);
tests/intel/xe_drm_fdinfo.c +3 -3
index 8f737a533..6bca5a6f1 100644
@@ -85,7 +85,7 @@ static void test_active(int fd, struct drm_xe_engine_class_instance *eci)
 		igt_assert_f(ret != 0, "failed with err:%d\n", errno);
 		pre_size = info.region_mem[memregion->instance + 1].active;
 
-		bo = xe_bo_create(fd, vm, bo_size, region);
+		bo = xe_bo_create(fd, vm, bo_size, region, 0);
 		data = xe_bo_map(fd, bo, bo_size);
 
 		for (i = 0; i < N_EXEC_QUEUES; i++) {
@@ -185,7 +185,7 @@ static void test_shared(int xe)
 		igt_assert_f(ret != 0, "failed with err:%d\n", errno);
 		pre_size = info.region_mem[memregion->instance + 1].shared;
 
-		bo = xe_bo_create(xe, 0, BO_SIZE, region);
+		bo = xe_bo_create(xe, 0, BO_SIZE, region, 0);
 
 		flink.handle = bo;
 		ret = igt_ioctl(xe, DRM_IOCTL_GEM_FLINK, &flink);
@@ -232,7 +232,7 @@ static void test_total_resident(int xe)
 		igt_assert_f(ret != 0, "failed with err:%d\n", errno);
 		pre_size = info.region_mem[memregion->instance + 1].shared;
 
-		handle = xe_bo_create(xe, vm, BO_SIZE, region);
+		handle = xe_bo_create(xe, vm, BO_SIZE, region, 0);
 		xe_vm_bind_sync(xe, vm, handle, 0, addr, BO_SIZE);
 
 		ret = igt_parse_drm_fdinfo(xe, &info, NULL, 0, NULL, 0);
tests/intel/xe_evict.c +14 -8
index a9d501d5f..436a2be02 100644
@@ -101,16 +101,19 @@ test_evict(int fd, struct drm_xe_engine_class_instance *eci,
 			if (flags & MULTI_VM) {
 				__bo = bo[i] = xe_bo_create(fd, 0,
 							    bo_size,
-							    visible_vram_memory(fd, eci->gt_id));
+							    vram_memory(fd, eci->gt_id),
+							    DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 			} else if (flags & THREADED) {
 				__bo = bo[i] = xe_bo_create(fd, vm,
 							    bo_size,
-							    visible_vram_memory(fd, eci->gt_id));
+							    vram_memory(fd, eci->gt_id),
+							    DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 			} else {
 				__bo = bo[i] = xe_bo_create(fd, _vm,
 							    bo_size,
-							    visible_vram_memory(fd, eci->gt_id) |
-							    system_memory(fd));
+							    vram_memory(fd, eci->gt_id) |
+							    system_memory(fd),
+							    DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 			}
 		} else {
 			__bo = bo[i % (n_execs / 2)];
@@ -277,16 +280,19 @@ test_evict_cm(int fd, struct drm_xe_engine_class_instance *eci,
 			if (flags & MULTI_VM) {
 				__bo = bo[i] = xe_bo_create(fd, 0,
 							    bo_size,
-							    visible_vram_memory(fd, eci->gt_id));
+							    vram_memory(fd, eci->gt_id),
+							    DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 			} else if (flags & THREADED) {
 				__bo = bo[i] = xe_bo_create(fd, vm,
 							    bo_size,
-							    visible_vram_memory(fd, eci->gt_id));
+							    vram_memory(fd, eci->gt_id),
+							    DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 			} else {
 				__bo = bo[i] = xe_bo_create(fd, _vm,
 							    bo_size,
-							    visible_vram_memory(fd, eci->gt_id) |
-							    system_memory(fd));
+							    vram_memory(fd, eci->gt_id) |
+							    system_memory(fd),
+							    DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 			}
 		} else {
 			__bo = bo[i % (n_execs / 2)];
tests/intel/xe_evict_ccs.c +3 -2
index 1dc12eedd..4cafbf02e 100644
@@ -82,7 +82,8 @@ static void copy_obj(struct blt_copy_data *blt,
 	w = src_obj->x2;
 	h = src_obj->y2;
 
-	bb = xe_bo_create(fd, 0, bb_size, visible_vram_memory(fd, 0));
+	bb = xe_bo_create(fd, 0, bb_size, vram_memory(fd, 0),
+			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 
 	blt->color_depth = CD_32bit;
 	blt->print_bb = params.print_bb;
@@ -275,7 +276,7 @@ static void evict_single(int fd, int child, const struct config *config)
 
 		if (config->flags & TEST_SIMPLE) {
 			big_obj = xe_bo_create(fd, vm, kb_left * SZ_1K,
-					       vram_memory(fd, 0));
+					       vram_memory(fd, 0), 0);
 			break;
 		}
 
tests/intel/xe_exec_balancer.c +3 -3
index 388bb6185..fa3d7a338 100644
@@ -70,7 +70,7 @@ static void test_all_active(int fd, int gt, int class)
 	bo_size = sizeof(*data) * num_placements;
 	bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd), xe_get_default_alignment(fd));
 
-	bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, gt) |
+	bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, gt),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(fd, bo, bo_size);
 
@@ -225,7 +225,7 @@ test_exec(int fd, int gt, int class, int n_exec_queues, int n_execs,
 		}
 		memset(data, 0, bo_size);
 	} else {
-		bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, gt) |
+		bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, gt),
 				  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		data = xe_bo_map(fd, bo, bo_size);
 	}
@@ -454,7 +454,7 @@ test_cm(int fd, int gt, int class, int n_exec_queues, int n_execs,
 			igt_assert(data);
 		}
 	} else {
-		bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, gt) |
+		bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, gt),
 				  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		data = xe_bo_map(fd, bo, bo_size);
 	}
tests/intel/xe_exec_basic.c +3 -2
index ca287b2e5..23acdd434 100644
@@ -136,11 +136,12 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 	} else {
 		uint32_t bo_flags;
 
-		bo_flags = vram_if_possible(fd, eci->gt_id) | DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM;
+		bo_flags = DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM;
 		if (flags & DEFER_ALLOC)
 			bo_flags |= DRM_XE_GEM_CREATE_FLAG_DEFER_BACKING;
 
-		bo = xe_bo_create(fd, n_vm == 1 ? vm[0] : 0, bo_size, bo_flags);
+		bo = xe_bo_create(fd, n_vm == 1 ? vm[0] : 0, bo_size,
+				  vram_if_possible(fd, eci->gt_id), bo_flags);
 		if (!(flags & DEFER_BIND))
 			data = xe_bo_map(fd, bo, bo_size);
 	}
tests/intel/xe_exec_compute_mode.c +1 -1
index 07a27fd29..98a98256e 100644
@@ -142,7 +142,7 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 		}
 	} else {
 		bo = xe_bo_create(fd, flags & VM_FOR_BO ? vm : 0,
-				  bo_size, vram_if_possible(fd, eci->gt_id) |
+				  bo_size, vram_if_possible(fd, eci->gt_id),
 				  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		data = xe_bo_map(fd, bo, bo_size);
 	}
tests/intel/xe_exec_fault_mode.c +2 -2
index bfd61c4ea..3eb448ef4 100644
@@ -153,11 +153,11 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 		if (flags & PREFETCH)
 			bo = xe_bo_create(fd, 0, bo_size,
 					  all_memory_regions(fd) |
-					  vram_if_possible(fd, 0) |
+					  vram_if_possible(fd, 0),
 					  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		else
 			bo = xe_bo_create(fd, 0, bo_size,
-					  vram_if_possible(fd, eci->gt_id) |
+					  vram_if_possible(fd, eci->gt_id),
 					  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		data = xe_bo_map(fd, bo, bo_size);
 	}
tests/intel/xe_exec_reset.c +6 -5
index 3affb19ae..d8b8e0355 100644
@@ -51,7 +51,7 @@ static void test_spin(int fd, struct drm_xe_engine_class_instance *eci)
 			xe_get_default_alignment(fd));
 
 	bo = xe_bo_create(fd, vm, bo_size,
-			  vram_if_possible(fd, eci->gt_id) |
+			  vram_if_possible(fd, eci->gt_id),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	spin = xe_bo_map(fd, bo, bo_size);
 
@@ -182,7 +182,7 @@ test_balancer(int fd, int gt, int class, int n_exec_queues, int n_execs,
 	bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd),
 			xe_get_default_alignment(fd));
 
-	bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, gt) |
+	bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, gt),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(fd, bo, bo_size);
 
@@ -370,7 +370,8 @@ test_legacy_mode(int fd, struct drm_xe_engine_class_instance *eci,
 			xe_get_default_alignment(fd));
 
 	bo = xe_bo_create(fd, vm, bo_size,
-			  vram_if_possible(fd, eci->gt_id) | DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
+			  vram_if_possible(fd, eci->gt_id),
+			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(fd, bo, bo_size);
 
 	for (i = 0; i < n_exec_queues; i++) {
@@ -537,7 +538,7 @@ test_compute_mode(int fd, struct drm_xe_engine_class_instance *eci,
 			xe_get_default_alignment(fd));
 
 	bo = xe_bo_create(fd, vm, bo_size,
-			  vram_if_possible(fd, eci->gt_id) |
+			  vram_if_possible(fd, eci->gt_id),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(fd, bo, bo_size);
 	memset(data, 0, bo_size);
@@ -664,7 +665,7 @@ static void submit_jobs(struct gt_thread_data *t)
 	uint32_t bo;
 	uint32_t *data;
 
-	bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, 0) |
+	bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, 0),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(fd, bo, bo_size);
 	data[0] = MI_BATCH_BUFFER_END;
tests/intel/xe_exec_store.c +3 -3
index 884183202..9ee5edeb4 100644
@@ -82,7 +82,7 @@ static void store(int fd)
 
 	hw_engine = xe_hw_engine(fd, 1);
 	bo = xe_bo_create(fd, vm, bo_size,
-			  vram_if_possible(fd, hw_engine->gt_id) |
+			  vram_if_possible(fd, hw_engine->gt_id),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 
 	xe_vm_bind_async(fd, vm, hw_engine->gt_id, bo, 0, addr, bo_size, &sync, 1);
@@ -152,7 +152,7 @@ static void store_cachelines(int fd, struct drm_xe_engine_class_instance *eci,
 
 	for (i = 0; i < count; i++) {
 		bo[i] = xe_bo_create(fd, vm, bo_size,
-				     vram_if_possible(fd, eci->gt_id) |
+				     vram_if_possible(fd, eci->gt_id),
 				     DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		bo_map[i] = xe_bo_map(fd, bo[i], bo_size);
 		dst_offset[i] = intel_allocator_alloc_with_strategy(ahnd, bo[i],
@@ -238,7 +238,7 @@ static void store_all(int fd, int gt, int class)
 			xe_get_default_alignment(fd));
 
 	bo = xe_bo_create(fd, vm, bo_size,
-			  vram_if_possible(fd, 0) |
+			  vram_if_possible(fd, 0),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(fd, bo, bo_size);
 
tests/intel/xe_exec_threads.c +3 -3
index ebc41dadd..f37fc612a 100644
@@ -107,7 +107,7 @@ test_balancer(int fd, int gt, uint32_t vm, uint64_t addr, uint64_t userptr,
 		}
 	} else {
 		bo = xe_bo_create(fd, vm, bo_size,
-				  vram_if_possible(fd, gt) |
+				  vram_if_possible(fd, gt),
 				  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		data = xe_bo_map(fd, bo, bo_size);
 	}
@@ -309,7 +309,7 @@ test_compute_mode(int fd, uint32_t vm, uint64_t addr, uint64_t userptr,
 		}
 	} else {
 		bo = xe_bo_create(fd, 0, bo_size,
-				  vram_if_possible(fd, eci->gt_id) |
+				  vram_if_possible(fd, eci->gt_id),
 				  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		data = xe_bo_map(fd, bo, bo_size);
 	}
@@ -513,7 +513,7 @@ test_legacy_mode(int fd, uint32_t vm, uint64_t addr, uint64_t userptr,
 		}
 	} else {
 		bo = xe_bo_create(fd, vm, bo_size,
-				  vram_if_possible(fd, eci->gt_id) |
+				  vram_if_possible(fd, eci->gt_id),
 				  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		data = xe_bo_map(fd, bo, bo_size);
 	}
tests/intel/xe_exercise_blt.c +2 -2
index 9c69be3ef..655e9a3ea 100644
@@ -125,7 +125,7 @@ static void fast_copy_emit(int xe, const intel_ctx_t *ctx,
 	uint32_t bb, width = param.width, height = param.height;
 	int result;
 
-	bb = xe_bo_create(xe, 0, bb_size, region1);
+	bb = xe_bo_create(xe, 0, bb_size, region1, 0);
 
 	blt_copy_init(xe, &bltinit);
 	src = blt_create_object(&bltinit, region1, width, height, bpp, 0,
@@ -184,7 +184,7 @@ static void fast_copy(int xe, const intel_ctx_t *ctx,
 	uint32_t width = param.width, height = param.height;
 	int result;
 
-	bb = xe_bo_create(xe, 0, bb_size, region1);
+	bb = xe_bo_create(xe, 0, bb_size, region1, 0);
 
 	blt_copy_init(xe, &blt);
 	src = blt_create_object(&blt, region1, width, height, bpp, 0,
tests/intel/xe_guc_pc.c +1 -1
index 4234475e0..8d7b677b4 100644
@@ -66,7 +66,7 @@ static void exec_basic(int fd, struct drm_xe_engine_class_instance *eci,
 			xe_get_default_alignment(fd));
 
 	bo = xe_bo_create(fd, vm, bo_size,
-			  vram_if_possible(fd, eci->gt_id) |
+			  vram_if_possible(fd, eci->gt_id),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(fd, bo, bo_size);
 
tests/intel/xe_intel_bb.c +1 -1
index a3a315297..00bd17d4c 100644
@@ -396,7 +396,7 @@ static void create_in_region(struct buf_ops *bops, uint64_t region)
 		intel_bb_set_debug(ibb, true);
 
 	size = xe_min_page_size(xe, system_memory(xe));
-	handle = xe_bo_create(xe, 0, size, system_memory(xe));
+	handle = xe_bo_create(xe, 0, size, system_memory(xe), 0);
 	intel_buf_init_full(bops, handle, &buf,
 			    width/4, height, 32, 0,
 			    I915_TILING_NONE, 0,
tests/intel/xe_mmap.c +20 -16
index a4b53ad48..965644e22 100644
@@ -45,14 +45,14 @@
  * @vram-system:	system vram
  */
 static void
-test_mmap(int fd, uint32_t flags)
+test_mmap(int fd, uint32_t placement, uint32_t flags)
 {
 	uint32_t bo;
 	void *map;
 
-	igt_require_f(flags, "Device doesn't support such memory region\n");
+	igt_require_f(placement, "Device doesn't support such memory region\n");
 
-	bo = xe_bo_create(fd, 0, 4096, flags);
+	bo = xe_bo_create(fd, 0, 4096, placement, flags);
 
 	map = xe_bo_map(fd, bo, 4096);
 	strcpy(map, "Write some data to the BO!");
@@ -73,7 +73,7 @@ static void test_bad_flags(int fd)
 	uint64_t size = xe_get_default_alignment(fd);
 	struct drm_xe_gem_mmap_offset mmo = {
 		.handle = xe_bo_create(fd, 0, size,
-				       vram_if_possible(fd, 0) |
+				       vram_if_possible(fd, 0),
 				       DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM),
 		.flags = -1u,
 	};
@@ -94,7 +94,7 @@ static void test_bad_extensions(int fd)
 	struct xe_user_extension ext;
 	struct drm_xe_gem_mmap_offset mmo = {
 		.handle = xe_bo_create(fd, 0, size,
-				       vram_if_possible(fd, 0) |
+				       vram_if_possible(fd, 0),
 				       DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM),
 	};
 
@@ -116,7 +116,7 @@ static void test_bad_object(int fd)
 	uint64_t size = xe_get_default_alignment(fd);
 	struct drm_xe_gem_mmap_offset mmo = {
 		.handle = xe_bo_create(fd, 0, size,
-				       vram_if_possible(fd, 0) |
+				       vram_if_possible(fd, 0),
 				       DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM),
 	};
 
@@ -163,12 +163,14 @@ static void test_small_bar(int fd)
 
 	/* 2BIG invalid case */
 	igt_assert_neq(__xe_bo_create(fd, 0, visible_size + 4096,
-				      visible_vram_memory(fd, 0), &bo),
+				      vram_memory(fd, 0),
+				      DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM,
+				      &bo),
 		       0);
 
 	/* Normal operation */
-	bo = xe_bo_create(fd, 0, visible_size / 4,
-			  visible_vram_memory(fd, 0));
+	bo = xe_bo_create(fd, 0, visible_size / 4, vram_memory(fd, 0),
+			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	mmo = xe_bo_mmap_offset(fd, bo);
 	map = mmap(NULL, 4096, PROT_WRITE, MAP_SHARED, fd, mmo);
 	igt_assert(map != MAP_FAILED);
@@ -180,8 +182,9 @@ static void test_small_bar(int fd)
 
 	/* Normal operation with system memory spilling */
 	bo = xe_bo_create(fd, 0, visible_size,
-			  visible_vram_memory(fd, 0) |
-			  system_memory(fd));
+			  vram_memory(fd, 0) |
+			  system_memory(fd),
+			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	mmo = xe_bo_mmap_offset(fd, bo);
 	map = mmap(NULL, 4096, PROT_WRITE, MAP_SHARED, fd, mmo);
 	igt_assert(map != MAP_FAILED);
@@ -192,8 +195,7 @@ static void test_small_bar(int fd)
 	gem_close(fd, bo);
 
 	/* Bogus operation with SIGBUS */
-	bo = xe_bo_create(fd, 0, visible_size + 4096,
-			  vram_memory(fd, 0));
+	bo = xe_bo_create(fd, 0, visible_size + 4096, vram_memory(fd, 0), 0);
 	mmo = xe_bo_mmap_offset(fd, bo);
 	map = mmap(NULL, 4096, PROT_WRITE, MAP_SHARED, fd, mmo);
 	igt_assert(map != MAP_FAILED);
@@ -210,13 +212,15 @@ igt_main
 		fd = drm_open_driver(DRIVER_XE);
 
 	igt_subtest("system")
-		test_mmap(fd, system_memory(fd));
+		test_mmap(fd, system_memory(fd), 0);
 
 	igt_subtest("vram")
-		test_mmap(fd, visible_vram_memory(fd, 0));
+		test_mmap(fd, vram_memory(fd, 0),
+			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 
 	igt_subtest("vram-system")
-		test_mmap(fd, visible_vram_memory(fd, 0) | system_memory(fd));
+		test_mmap(fd, vram_memory(fd, 0) | system_memory(fd),
+			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 
 	igt_subtest("bad-flags")
 		test_bad_flags(fd);
tests/intel/xe_noexec_ping_pong.c +1 -1
index 88ef39783..5e3349247 100644
@@ -71,7 +71,7 @@ static void test_ping_pong(int fd, struct drm_xe_engine_class_instance *eci)
 				  (unsigned int) vm[i]);
 
 			bo[i][j] = xe_bo_create(fd, vm[i], bo_size,
-						vram_memory(fd, 0));
+						vram_memory(fd, 0), 0);
 			xe_vm_bind(fd, vm[i], bo[i][j], 0, 0x40000 + j*bo_size,
 				   bo_size, NULL, 0);
 		}
tests/intel/xe_perf_pmu.c +2 -2
index 406bd4b8d..8ef557a46 100644
@@ -103,7 +103,7 @@ static void test_any_engine_busyness(int fd, struct drm_xe_engine_class_instance
 	bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd),
 			xe_get_default_alignment(fd));
 
-	bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, 0));
+	bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, 0), 0);
 	spin = xe_bo_map(fd, bo, bo_size);
 
 	exec_queue = xe_exec_queue_create(fd, vm, eci, 0);
@@ -223,7 +223,7 @@ static void test_engine_group_busyness(int fd, int gt, int class, const char *na
 	bo_size = sizeof(*data) * num_placements;
 	bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd), xe_get_default_alignment(fd));
 
-	bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, 0));
+	bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, 0), 0);
 	data = xe_bo_map(fd, bo, bo_size);
 
 	for (i = 0; i < num_placements; i++) {
tests/intel/xe_pm.c +5 -5
index df85f2c05..4f42a2c3b 100644
@@ -272,7 +272,7 @@ test_exec(device_t device, struct drm_xe_engine_class_instance *eci,
 		rpm_usage = igt_pm_get_runtime_usage(device.pci_xe);
 
 	bo = xe_bo_create(device.fd_xe, vm, bo_size,
-			  vram_if_possible(device.fd_xe, eci->gt_id) |
+			  vram_if_possible(device.fd_xe, eci->gt_id),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(device.fd_xe, bo, bo_size);
 
@@ -381,15 +381,15 @@ static void test_vram_d3cold_threshold(device_t device, int sysfs_fd)
 		.data = 0,
 	};
 	uint64_t vram_used_mb = 0, vram_total_mb = 0, threshold;
-	uint32_t bo, flags;
+	uint32_t bo, placement;
 	int handle, i;
 	bool active;
 	void *map;
 
 	igt_require(xe_has_vram(device.fd_xe));
 
-	flags = vram_memory(device.fd_xe, 0);
-	igt_require_f(flags, "Device doesn't support vram memory region\n");
+	placement = vram_memory(device.fd_xe, 0);
+	igt_require_f(placement, "Device doesn't support vram memory region\n");
 
 	igt_assert_eq(igt_ioctl(device.fd_xe, DRM_IOCTL_XE_DEVICE_QUERY, &query), 0);
 	igt_assert_neq(query.size, 0);
@@ -410,7 +410,7 @@ static void test_vram_d3cold_threshold(device_t device, int sysfs_fd)
 	threshold = vram_used_mb + (SIZE / 1024 /1024);
 	igt_require(threshold < vram_total_mb);
 
-	bo = xe_bo_create(device.fd_xe, 0, SIZE, flags);
+	bo = xe_bo_create(device.fd_xe, 0, SIZE, placement, 0);
 	map = xe_bo_map(device.fd_xe, bo, SIZE);
 	memset(map, 0, SIZE);
 	munmap(map, SIZE);
tests/intel/xe_pm_residency.c +1 -1
index 40a1693b8..6c9a95429 100644
@@ -101,7 +101,7 @@ static void exec_load(int fd, struct drm_xe_engine_class_instance *hwe, unsigned
 	bo_size = xe_get_default_alignment(fd);
 
 	bo = xe_bo_create(fd, vm, bo_size,
-			  vram_if_possible(fd, hwe->gt_id) |
+			  vram_if_possible(fd, hwe->gt_id),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(fd, bo, bo_size);
 	syncobj = syncobj_create(fd, 0);
tests/intel/xe_prime_self_import.c +9 -9
index 2c2f2898c..9a263d326 100644
@@ -105,7 +105,7 @@ static void test_with_fd_dup(void)
 	fd1 = drm_open_driver(DRIVER_XE);
 	fd2 = drm_open_driver(DRIVER_XE);
 
-	handle = xe_bo_create(fd1, 0, bo_size, vram_if_possible(fd1, 0) |
+	handle = xe_bo_create(fd1, 0, bo_size, vram_if_possible(fd1, 0),
 			      DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 
 	dma_buf_fd1 = prime_handle_to_fd(fd1, handle);
@@ -139,9 +139,9 @@ static void test_with_two_bos(void)
 	fd1 = drm_open_driver(DRIVER_XE);
 	fd2 = drm_open_driver(DRIVER_XE);
 
-	handle1 = xe_bo_create(fd1, 0, bo_size, vram_if_possible(fd1, 0) |
+	handle1 = xe_bo_create(fd1, 0, bo_size, vram_if_possible(fd1, 0),
 			       DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
-	handle2 = xe_bo_create(fd1, 0, bo_size, vram_if_possible(fd1, 0) |
+	handle2 = xe_bo_create(fd1, 0, bo_size, vram_if_possible(fd1, 0),
 			       DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 
 	dma_buf_fd = prime_handle_to_fd(fd1, handle1);
@@ -178,7 +178,7 @@ static void test_with_one_bo_two_files(void)
 	fd2 = drm_open_driver(DRIVER_XE);
 
 	handle_orig = xe_bo_create(fd1, 0, bo_size,
-				   vram_if_possible(fd1, 0) |
+				   vram_if_possible(fd1, 0),
 				   DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	dma_buf_fd1 = prime_handle_to_fd(fd1, handle_orig);
 
@@ -211,7 +211,7 @@ static void test_with_one_bo(void)
 	fd1 = drm_open_driver(DRIVER_XE);
 	fd2 = drm_open_driver(DRIVER_XE);
 
-	handle = xe_bo_create(fd1, 0, bo_size, vram_if_possible(fd1, 0) |
+	handle = xe_bo_create(fd1, 0, bo_size, vram_if_possible(fd1, 0),
 			      DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 
 	dma_buf_fd = prime_handle_to_fd(fd1, handle);
@@ -299,7 +299,7 @@ static void *thread_fn_reimport_vs_close(void *p)
 	fds[0] = drm_open_driver(DRIVER_XE);
 
 	handle = xe_bo_create(fds[0], 0, bo_size,
-			      vram_if_possible(fds[0], 0) |
+			      vram_if_possible(fds[0], 0),
 			      DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 
 	fds[1] = prime_handle_to_fd(fds[0], handle);
@@ -343,7 +343,7 @@ static void *thread_fn_export_vs_close(void *p)
 	igt_until_timeout(g_time_out) {
 		/* We want to race gem close against prime export on handle one.*/
 		handle = xe_bo_create(fd, 0, bo_size,
-				      vram_if_possible(fd, 0) |
+				      vram_if_possible(fd, 0),
 				      DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		if (handle != 1)
 			gem_close(fd, handle);
@@ -441,7 +441,7 @@ static void test_llseek_size(void)
 		int bufsz = xe_get_default_alignment(fd) << i;
 
 		handle = xe_bo_create(fd, 0, bufsz,
-				      vram_if_possible(fd, 0) |
+				      vram_if_possible(fd, 0),
 				      DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		dma_buf_fd = prime_handle_to_fd(fd, handle);
 
@@ -471,7 +471,7 @@ static void test_llseek_bad(void)
 	fd = drm_open_driver(DRIVER_XE);
 
 	handle = xe_bo_create(fd, 0, bo_size,
-			      vram_if_possible(fd, 0) |
+			      vram_if_possible(fd, 0),
 			      DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	dma_buf_fd = prime_handle_to_fd(fd, handle);
 
tests/intel/xe_spin_batch.c +1 -1
index c1b161f9c..6abe700da 100644
@@ -169,7 +169,7 @@ static void xe_spin_fixed_duration(int fd)
 	exec_queue = xe_exec_queue_create_class(fd, vm, DRM_XE_ENGINE_CLASS_COPY);
 	ahnd = intel_allocator_open(fd, 0, INTEL_ALLOCATOR_RELOC);
 	bo_size = ALIGN(sizeof(*spin) + xe_cs_prefetch_size(fd), xe_get_default_alignment(fd));
-	bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, 0));
+	bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, 0), 0);
 	spin = xe_bo_map(fd, bo, bo_size);
 	spin_addr = intel_allocator_alloc_with_strategy(ahnd, bo, bo_size, 0,
 							ALLOC_STRATEGY_LOW_TO_HIGH);
tests/intel/xe_vm.c +11 -11
index 26913e449..84b1947e2 100644
@@ -52,7 +52,7 @@ write_dwords(int fd, uint32_t vm, int n_dwords, uint64_t *addrs)
 	batch_size = ALIGN(batch_size + xe_cs_prefetch_size(fd),
 			   xe_get_default_alignment(fd));
 	batch_bo = xe_bo_create(fd, vm, batch_size,
-				vram_if_possible(fd, 0) |
+				vram_if_possible(fd, 0),
 				DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	batch_map = xe_bo_map(fd, batch_bo, batch_size);
 
@@ -117,7 +117,7 @@ __test_bind_one_bo(int fd, uint32_t vm, int n_addrs, uint64_t *addrs)
 		vms = malloc(sizeof(*vms) * n_addrs);
 		igt_assert(vms);
 	}
-	bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, 0) |
+	bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, 0),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	map = xe_bo_map(fd, bo, bo_size);
 	memset(map, 0, bo_size);
@@ -269,7 +269,7 @@ static void test_partial_unbinds(int fd)
 {
 	uint32_t vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
 	size_t bo_size = 3 * xe_get_default_alignment(fd);
-	uint32_t bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, 0));
+	uint32_t bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, 0), 0);
 	uint64_t unbind_size = bo_size / 3;
 	uint64_t addr = 0x1a0000;
 
@@ -318,7 +318,7 @@ static void unbind_all(int fd, int n_vmas)
 	};
 
 	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
-	bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, 0));
+	bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, 0), 0);
 
 	for (i = 0; i < n_vmas; ++i)
 		xe_vm_bind_async(fd, vm, 0, bo, 0, addr + i * bo_size,
@@ -421,7 +421,7 @@ shared_pte_page(int fd, struct drm_xe_engine_class_instance *eci, int n_bo,
 
 	for (i = 0; i < n_bo; ++i) {
 		bo[i] = xe_bo_create(fd, vm, bo_size,
-				     vram_if_possible(fd, eci->gt_id) |
+				     vram_if_possible(fd, eci->gt_id),
 				     DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		data[i] = xe_bo_map(fd, bo[i], bo_size);
 	}
@@ -601,7 +601,7 @@ test_bind_execqueues_independent(int fd, struct drm_xe_engine_class_instance *ec
 	bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd),
 			xe_get_default_alignment(fd));
 	bo = xe_bo_create(fd, vm, bo_size,
-			  vram_if_possible(fd, eci->gt_id) |
+			  vram_if_possible(fd, eci->gt_id),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(fd, bo, bo_size);
 
@@ -783,7 +783,7 @@ test_bind_array(int fd, struct drm_xe_engine_class_instance *eci, int n_execs,
 			xe_get_default_alignment(fd));
 
 	bo = xe_bo_create(fd, vm, bo_size,
-			  vram_if_possible(fd, eci->gt_id) |
+			  vram_if_possible(fd, eci->gt_id),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(fd, bo, bo_size);
 
@@ -982,7 +982,7 @@ test_large_binds(int fd, struct drm_xe_engine_class_instance *eci,
 			    xe_visible_vram_size(fd, 0));
 
 		bo = xe_bo_create(fd, vm, bo_size,
-				  vram_if_possible(fd, eci->gt_id) |
+				  vram_if_possible(fd, eci->gt_id),
 				  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		map = xe_bo_map(fd, bo, bo_size);
 	}
@@ -1275,7 +1275,7 @@ test_munmap_style_unbind(int fd, struct drm_xe_engine_class_instance *eci,
 		igt_assert(map != MAP_FAILED);
 	} else {
 		bo = xe_bo_create(fd, vm, bo_size,
-				  vram_if_possible(fd, eci->gt_id) |
+				  vram_if_possible(fd, eci->gt_id),
 				  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		map = xe_bo_map(fd, bo, bo_size);
 	}
@@ -1579,9 +1579,9 @@ test_mmap_style_bind(int fd, struct drm_xe_engine_class_instance *eci,
 		igt_assert(map0 != MAP_FAILED);
 		igt_assert(map1 != MAP_FAILED);
 	} else {
-		bo0 = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, eci->gt_id));
+		bo0 = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, eci->gt_id), 0);
 		map0 = xe_bo_map(fd, bo0, bo_size);
-		bo1 = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, eci->gt_id));
+		bo1 = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, eci->gt_id), 0);
 		map1 = xe_bo_map(fd, bo1, bo_size);
 	}
 	memset(map0, 0, bo_size);
tests/intel/xe_waitfence.c +7 -9
index 913afcdb5..f57785aa4 100644
@@ -22,8 +22,6 @@
  * Description: Test waitfences functionality
  */
 
-#define MY_FLAG	vram_if_possible(fd, 0)
-
 uint64_t wait_fence = 0;
 
 static void do_bind(int fd, uint32_t vm, uint32_t bo, uint64_t offset,
@@ -64,19 +62,19 @@ waitfence(int fd, enum waittype wt)
 	int64_t timeout;
 
 	uint32_t vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
-	bo_1 = xe_bo_create(fd, vm, 0x40000, MY_FLAG);
+	bo_1 = xe_bo_create(fd, vm, 0x40000, vram_if_possible(fd, 0), 0);
 	do_bind(fd, vm, bo_1, 0, 0x200000, 0x40000, 1);
-	bo_2 = xe_bo_create(fd, vm, 0x40000, MY_FLAG);
+	bo_2 = xe_bo_create(fd, vm, 0x40000, vram_if_possible(fd, 0), 0);
 	do_bind(fd, vm, bo_2, 0, 0xc0000000, 0x40000, 2);
-	bo_3 = xe_bo_create(fd, vm, 0x40000, MY_FLAG);
+	bo_3 = xe_bo_create(fd, vm, 0x40000, vram_if_possible(fd, 0), 0);
 	do_bind(fd, vm, bo_3, 0, 0x180000000, 0x40000, 3);
-	bo_4 = xe_bo_create(fd, vm, 0x10000, MY_FLAG);
+	bo_4 = xe_bo_create(fd, vm, 0x10000, vram_if_possible(fd, 0), 0);
 	do_bind(fd, vm, bo_4, 0, 0x140000000, 0x10000, 4);
-	bo_5 = xe_bo_create(fd, vm, 0x100000, MY_FLAG);
+	bo_5 = xe_bo_create(fd, vm, 0x100000, vram_if_possible(fd, 0), 0);
 	do_bind(fd, vm, bo_5, 0, 0x100000000, 0x100000, 5);
-	bo_6 = xe_bo_create(fd, vm, 0x1c0000, MY_FLAG);
+	bo_6 = xe_bo_create(fd, vm, 0x1c0000, vram_if_possible(fd, 0), 0);
 	do_bind(fd, vm, bo_6, 0, 0xc0040000, 0x1c0000, 6);
-	bo_7 = xe_bo_create(fd, vm, 0x10000, MY_FLAG);
+	bo_7 = xe_bo_create(fd, vm, 0x10000, vram_if_possible(fd, 0), 0);
 	do_bind(fd, vm, bo_7, 0, 0xeffff0000, 0x10000, 7);
 
 	if (wt == RELTIME) {
tests/kms_addfb_basic.c +1 -1
index 4f293c2ee..6814e1b8c 100644
@@ -199,7 +199,7 @@ static void invalid_tests(int fd)
 			handle = gem_create_in_memory_regions(fd, size, REGION_SMEM);
 		} else {
 			igt_require(xe_has_vram(fd));
-			handle = xe_bo_create(fd, 0, size, system_memory(fd));
+			handle = xe_bo_create(fd, 0, size, system_memory(fd), 0);
 		}
 
 		f.handles[0] = handle;
tests/kms_getfb.c +1 -1
index 1f9e813d8..6f8592d3a 100644
@@ -149,7 +149,7 @@ static void get_ccs_fb(int fd, struct drm_mode_fb_cmd2 *ret)
 	if (is_i915_device(fd))
 		add.handles[0] = gem_buffer_create_fb_obj(fd, size);
 	else
-		add.handles[0] = xe_bo_create(fd, 0, size, vram_if_possible(fd, 0));
+		add.handles[0] = xe_bo_create(fd, 0, size, vram_if_possible(fd, 0), 0);
 	igt_require(add.handles[0] != 0);
 
 	if (!HAS_FLATCCS(devid))
Signature · 1 line
2.34.1
#20 lore raw

PATCH v3 20/57 drm-uapi/xe: Remove unused inaccessible memory region

In reply to Francois Dugast

Align with commit ("drm/xe/uapi: Remove unused inaccessible memory region")

---
 include/drm-uapi/xe_drm.h | 5 -----
 tests/intel/xe_query.c    | 2 --
 2 files changed, 7 deletions(-)
include/drm-uapi/xe_drm.h +0 -5
index ea9309af7..5bf557d5a 100644
@@ -396,11 +396,6 @@ struct drm_xe_query_gt {
 	 * they live on a different GPU/Tile.
 	 */
 	__u64 slow_mem_regions;
-	/**
-	 * @inaccessible_mem_regions: Bit mask of instances from
-	 * drm_xe_query_mem_usage that is not accessible by this GT at all.
-	 */
-	__u64 inaccessible_mem_regions;
 	/** @reserved: Reserved */
 	__u64 reserved[8];
 };
tests/intel/xe_query.c +0 -2
index 6f1236a30..6b1be248c 100644
@@ -285,8 +285,6 @@ test_query_gt_list(int fd)
 		       gt_list->gt_list[i].native_mem_regions);
 		igt_info("slow_mem_regions: 0x%016llx\n",
 		       gt_list->gt_list[i].slow_mem_regions);
-		igt_info("inaccessible_mem_regions: 0x%016llx\n",
-		       gt_list->gt_list[i].inaccessible_mem_regions);
 	}
 }
 
Signature · 1 line
2.34.1
#21 lore raw

PATCH v3 21/57 drm-uapi/xe: Remove unused QUERY_CONFIG_MEM_REGION_COUNT

In reply to Francois Dugast

Align with commit ("drm/xe/uapi: Remove unused QUERY_CONFIG_MEM_REGION_COUNT")

---
 include/drm-uapi/xe_drm.h | 5 +----
 tests/intel/xe_query.c    | 2 --
 2 files changed, 1 insertion(+), 6 deletions(-)
include/drm-uapi/xe_drm.h +1 -4
index 5bf557d5a..1ed982935 100644
@@ -342,8 +342,6 @@ struct drm_xe_query_mem_usage {
  *  - %DRM_XE_QUERY_CONFIG_VA_BITS - Maximum bits of a virtual address
  *  - %DRM_XE_QUERY_CONFIG_GT_COUNT - Total number of GTs for the entire
  *    device
- *  - %DRM_XE_QUERY_CONFIG_MEM_REGION_COUNT - Total number of accessible
- *    memory regions
  *  - %DRM_XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY - Value of the highest
  *    available exec queue priority
  */
@@ -360,8 +358,7 @@ struct drm_xe_query_config {
 #define DRM_XE_QUERY_CONFIG_MIN_ALIGNMENT		2
 #define DRM_XE_QUERY_CONFIG_VA_BITS			3
 #define DRM_XE_QUERY_CONFIG_GT_COUNT			4
-#define DRM_XE_QUERY_CONFIG_MEM_REGION_COUNT		5
-#define DRM_XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY	6
+#define DRM_XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY	5
 	/** @info: array of elements containing the config info */
 	__u64 info[];
 };
tests/intel/xe_query.c +0 -2
index 6b1be248c..351e56eb4 100644
@@ -376,8 +376,6 @@ test_query_config(int fd)
 		config->info[DRM_XE_QUERY_CONFIG_VA_BITS]);
 	igt_info("DRM_XE_QUERY_CONFIG_GT_COUNT\t\t%llu\n",
 		config->info[DRM_XE_QUERY_CONFIG_GT_COUNT]);
-	igt_info("DRM_XE_QUERY_CONFIG_MEM_REGION_COUNT\t%llu\n",
-		config->info[DRM_XE_QUERY_CONFIG_MEM_REGION_COUNT]);
 	igt_info("DRM_XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY\t%llu\n",
 		config->info[DRM_XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY]);
 	dump_hex_debug(config, query.size);
Signature · 1 line
2.34.1
#22 lore raw

PATCH v3 22/57 drm-uapi/xe: Remove unused QUERY_CONFIG_GT_COUNT

In reply to Francois Dugast

Align with commit ("drm/xe/uapi: Remove unused QUERY_CONFIG_GT_COUNT")

---
 include/drm-uapi/xe_drm.h |  5 +----
 lib/xe/xe_query.c         | 11 +++++------
 lib/xe/xe_query.h         |  3 ---
 tests/intel/xe_debugfs.c  |  2 --
 tests/intel/xe_query.c    |  2 --
 5 files changed, 6 insertions(+), 17 deletions(-)
include/drm-uapi/xe_drm.h +1 -4
index 1ed982935..a80d1f460 100644
@@ -340,8 +340,6 @@ struct drm_xe_query_mem_usage {
  *  - %DRM_XE_QUERY_CONFIG_MIN_ALIGNMENT - Minimal memory alignment
  *    required by this device, typically SZ_4K or SZ_64K
  *  - %DRM_XE_QUERY_CONFIG_VA_BITS - Maximum bits of a virtual address
- *  - %DRM_XE_QUERY_CONFIG_GT_COUNT - Total number of GTs for the entire
- *    device
  *  - %DRM_XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY - Value of the highest
  *    available exec queue priority
  */
@@ -357,8 +355,7 @@ struct drm_xe_query_config {
 	#define DRM_XE_QUERY_CONFIG_FLAGS_HAS_VRAM	(0x1 << 0)
 #define DRM_XE_QUERY_CONFIG_MIN_ALIGNMENT		2
 #define DRM_XE_QUERY_CONFIG_VA_BITS			3
-#define DRM_XE_QUERY_CONFIG_GT_COUNT			4
-#define DRM_XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY	5
+#define DRM_XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY	4
 	/** @info: array of elements containing the config info */
 	__u64 info[];
 };
lib/xe/xe_query.c +5 -6
index c19988215..9e917cfee 100644
@@ -249,16 +249,15 @@ struct xe_device *xe_device_get(int fd)
 
 	xe_dev->fd = fd;
 	xe_dev->config = xe_query_config_new(fd);
-	xe_dev->number_gt = xe_dev->config->info[DRM_XE_QUERY_CONFIG_GT_COUNT];
 	xe_dev->va_bits = xe_dev->config->info[DRM_XE_QUERY_CONFIG_VA_BITS];
 	xe_dev->dev_id = xe_dev->config->info[DRM_XE_QUERY_CONFIG_REV_AND_DEVICE_ID] & 0xffff;
 	xe_dev->gt_list = xe_query_gt_list_new(fd);
 	xe_dev->memory_regions = __memory_regions(xe_dev->gt_list);
 	xe_dev->hw_engines = xe_query_engines_new(fd, &xe_dev->number_hw_engines);
 	xe_dev->mem_usage = xe_query_mem_usage_new(fd);
-	xe_dev->vram_size = calloc(xe_dev->number_gt, sizeof(*xe_dev->vram_size));
-	xe_dev->visible_vram_size = calloc(xe_dev->number_gt, sizeof(*xe_dev->visible_vram_size));
-	for (int gt = 0; gt < xe_dev->number_gt; gt++) {
+	xe_dev->vram_size = calloc(xe_dev->gt_list->num_gt, sizeof(*xe_dev->vram_size));
+	xe_dev->visible_vram_size = calloc(xe_dev->gt_list->num_gt, sizeof(*xe_dev->visible_vram_size));
+	for (int gt = 0; gt < xe_dev->gt_list->num_gt; gt++) {
 		xe_dev->vram_size[gt] = gt_vram_size(xe_dev->mem_usage,
 						     xe_dev->gt_list, gt);
 		xe_dev->visible_vram_size[gt] =
@@ -358,7 +357,7 @@ _TYPE _NAME(int fd)			\
  *
  * Return number of gt_list for xe device fd.
  */
-xe_dev_FN(xe_number_gt, number_gt, unsigned int);
+xe_dev_FN(xe_number_gt, gt_list->num_gt, unsigned int);
 
 /**
  * all_memory_regions:
@@ -394,7 +393,7 @@ uint64_t vram_memory(int fd, int gt)
 
 	xe_dev = find_in_cache(fd);
 	igt_assert(xe_dev);
-	igt_assert(gt >= 0 && gt < xe_dev->number_gt);
+	igt_assert(gt >= 0 && gt < xe_dev->gt_list->num_gt);
 
 	return xe_has_vram(fd) ? native_region_for_gt(xe_dev->gt_list, gt) : 0;
 }
lib/xe/xe_query.h +0 -3
index eb23a89fb..90ddd795c 100644
@@ -29,9 +29,6 @@ struct xe_device {
 	/** @gt_list: gt info */
 	struct drm_xe_query_gt_list *gt_list;
 
-	/** @number_gt: number of gt */
-	unsigned int number_gt;
-
 	/** @gt_list: bitmask of all memory regions */
 	uint64_t memory_regions;
 
tests/intel/xe_debugfs.c +0 -2
index 9ffc6f6d8..60ddceda7 100644
@@ -121,8 +121,6 @@ test_base(int fd, struct drm_xe_query_config *config)
 	igt_assert(igt_debugfs_search(fd, "info", reference));
 
 	igt_assert(igt_debugfs_exists(fd, "gt0", O_RDONLY));
-	if (config->info[DRM_XE_QUERY_CONFIG_GT_COUNT] > 1)
-		igt_assert(igt_debugfs_exists(fd, "gt1", O_RDONLY));
 
 	igt_assert(igt_debugfs_exists(fd, "gtt_mm", O_RDONLY));
 	igt_debugfs_dump(fd, "gtt_mm");
tests/intel/xe_query.c +0 -2
index 351e56eb4..969ad1c7f 100644
@@ -374,8 +374,6 @@ test_query_config(int fd)
 		config->info[DRM_XE_QUERY_CONFIG_MIN_ALIGNMENT]);
 	igt_info("DRM_XE_QUERY_CONFIG_VA_BITS\t\t\t%llu\n",
 		config->info[DRM_XE_QUERY_CONFIG_VA_BITS]);
-	igt_info("DRM_XE_QUERY_CONFIG_GT_COUNT\t\t%llu\n",
-		config->info[DRM_XE_QUERY_CONFIG_GT_COUNT]);
 	igt_info("DRM_XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY\t%llu\n",
 		config->info[DRM_XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY]);
 	dump_hex_debug(config, query.size);
Signature · 1 line
2.34.1
#23 lore raw

PATCH v3 23/57 drm-uapi/xe: Rename *_mem_regions mask.

In reply to Francois Dugast

From: Rodrigo Vivi <[email protected]>

Align with kernel commit ("drm/xe/uapi: Rename *_mem_regions masks")

---
 include/drm-uapi/xe_drm.h | 17 +++++++++--------
 lib/xe/xe_query.c         |  6 +++---
 tests/intel/xe_query.c    |  8 ++++----
 3 files changed, 16 insertions(+), 15 deletions(-)
include/drm-uapi/xe_drm.h +9 -8
index a80d1f460..e08928fe8 100644
@@ -379,17 +379,18 @@ struct drm_xe_query_gt {
 	/** @clock_freq: A clock frequency for timestamp */
 	__u32 clock_freq;
 	/**
-	 * @native_mem_regions: Bit mask of instances from
-	 * drm_xe_query_mem_usage that lives on the same GPU/Tile and have
-	 * direct access.
+	 * @near_mem_regions: Bit mask of instances from
+	 * drm_xe_query_mem_usage that is near the current engines of this GT.
 	 */
-	__u64 native_mem_regions;
+	__u64 near_mem_regions;
 	/**
-	 * @slow_mem_regions: Bit mask of instances from
-	 * drm_xe_query_mem_usage that this GT can indirectly access, although
-	 * they live on a different GPU/Tile.
+	 * @far_mem_regions: Bit mask of instances from
+	 * drm_xe_query_mem_usage that is far from the engines of this GT.
+	 * In general, it has extra indirections when compared to the
+	 * @near_mem_regions. For a discrete device this could mean system
+	 * memory and memory living in a different Tile.
 	 */
-	__u64 slow_mem_regions;
+	__u64 far_mem_regions;
 	/** @reserved: Reserved */
 	__u64 reserved[8];
 };
lib/xe/xe_query.c +3 -3
index 9e917cfee..00acafb69 100644
@@ -66,8 +66,8 @@ static uint64_t __memory_regions(const struct drm_xe_query_gt_list *gt_list)
 	int i;
 
 	for (i = 0; i < gt_list->num_gt; i++)
-		regions |= gt_list->gt_list[i].native_mem_regions |
-			   gt_list->gt_list[i].slow_mem_regions;
+		regions |= gt_list->gt_list[i].near_mem_regions |
+			   gt_list->gt_list[i].far_mem_regions;
 
 	return regions;
 }
@@ -123,7 +123,7 @@ static uint64_t native_region_for_gt(const struct drm_xe_query_gt_list *gt_list,
 	uint64_t region;
 
 	igt_assert(gt_list->num_gt > gt);
-	region = gt_list->gt_list[gt].native_mem_regions;
+	region = gt_list->gt_list[gt].near_mem_regions;
 	igt_assert(region);
 
 	return region;
tests/intel/xe_query.c +4 -4
index 969ad1c7f..b960ccfa2 100644
@@ -281,10 +281,10 @@ test_query_gt_list(int fd)
 		igt_info("type: %d\n", gt_list->gt_list[i].type);
 		igt_info("gt_id: %d\n", gt_list->gt_list[i].gt_id);
 		igt_info("clock_freq: %u\n", gt_list->gt_list[i].clock_freq);
-		igt_info("native_mem_regions: 0x%016llx\n",
-		       gt_list->gt_list[i].native_mem_regions);
-		igt_info("slow_mem_regions: 0x%016llx\n",
-		       gt_list->gt_list[i].slow_mem_regions);
+		igt_info("near_mem_regions: 0x%016llx\n",
+		       gt_list->gt_list[i].near_mem_regions);
+		igt_info("far_mem_regions: 0x%016llx\n",
+		       gt_list->gt_list[i].far_mem_regions);
 	}
 }
 
Signature · 1 line
2.34.1
#24 lore raw

PATCH v3 24/57 drm-uapi/xe: Rename query's mem_usage to mem_regions

In reply to Francois Dugast

From: Rodrigo Vivi <[email protected]>

Align with kernel's commit ("drm/xe/uapi: Rename query's mem_usage to mem_regions")

---
 include/drm-uapi/xe_drm.h | 16 +++++-----
 lib/xe/xe_query.c         | 66 +++++++++++++++++++--------------------
 lib/xe/xe_query.h         |  4 +--
 tests/intel/xe_pm.c       | 18 +++++------
 tests/intel/xe_query.c    | 58 +++++++++++++++++-----------------
 5 files changed, 81 insertions(+), 81 deletions(-)
include/drm-uapi/xe_drm.h +8 -8
index e08928fe8..0aa63f130 100644
@@ -307,13 +307,13 @@ struct drm_xe_query_engine_cycles {
 };
 
 /**
- * struct drm_xe_query_mem_usage - describe memory regions and usage
+ * struct drm_xe_query_mem_regions - describe memory regions
  *
  * If a query is made with a struct drm_xe_device_query where .query
- * is equal to DRM_XE_DEVICE_QUERY_MEM_USAGE, then the reply uses
- * struct drm_xe_query_mem_usage in .data.
+ * is equal to DRM_XE_DEVICE_QUERY_MEM_REGIONS, then the reply uses
+ * struct drm_xe_query_mem_regions in .data.
  */
-struct drm_xe_query_mem_usage {
+struct drm_xe_query_mem_regions {
 	/** @num_regions: number of memory regions returned in @regions */
 	__u32 num_regions;
 	/** @pad: MBZ */
@@ -380,12 +380,12 @@ struct drm_xe_query_gt {
 	__u32 clock_freq;
 	/**
 	 * @near_mem_regions: Bit mask of instances from
-	 * drm_xe_query_mem_usage that is near the current engines of this GT.
+	 * drm_xe_query_mem_regions that is near the current engines of this GT.
 	 */
 	__u64 near_mem_regions;
 	/**
 	 * @far_mem_regions: Bit mask of instances from
-	 * drm_xe_query_mem_usage that is far from the engines of this GT.
+	 * drm_xe_query_mem_regions that is far from the engines of this GT.
 	 * In general, it has extra indirections when compared to the
 	 * @near_mem_regions. For a discrete device this could mean system
 	 * memory and memory living in a different Tile.
@@ -508,7 +508,7 @@ struct drm_xe_query_uc_fw_version {
  *
  * The @query can be:
  *  - %DRM_XE_DEVICE_QUERY_ENGINES
- *  - %DRM_XE_DEVICE_QUERY_MEM_USAGE
+ *  - %DRM_XE_DEVICE_QUERY_MEM_REGIONS
  *  - %DRM_XE_DEVICE_QUERY_CONFIG
  *  - %DRM_XE_DEVICE_QUERY_GT_LIST - Query type to retrieve the hardware
  *    configuration of the device such as information on slices, memory,
@@ -558,7 +558,7 @@ struct drm_xe_device_query {
 	__u64 extensions;
 
 #define DRM_XE_DEVICE_QUERY_ENGINES		0
-#define DRM_XE_DEVICE_QUERY_MEM_USAGE		1
+#define DRM_XE_DEVICE_QUERY_MEM_REGIONS		1
 #define DRM_XE_DEVICE_QUERY_CONFIG		2
 #define DRM_XE_DEVICE_QUERY_GT_LIST		3
 #define DRM_XE_DEVICE_QUERY_HWCONFIG		4
lib/xe/xe_query.c +33 -33

159 lines not on this page · raw message

lib/xe/xe_query.h +2 -2
index 90ddd795c..be92ec5ed 100644
@@ -38,8 +38,8 @@ struct xe_device {
 	/** @number_hw_engines: length of hardware engines array */
 	unsigned int number_hw_engines;
 
-	/** @mem_usage: regions memory information and usage */
-	struct drm_xe_query_mem_usage *mem_usage;
+	/** @mem_regions: regions memory information and usage */
+	struct drm_xe_query_mem_regions *mem_regions;
 
 	/** @vram_size: array of vram sizes for all gt_list */
 	uint64_t *vram_size;
tests/intel/xe_pm.c +9 -9
index 4f42a2c3b..2e5c61b59 100644
@@ -373,10 +373,10 @@ NULL));
  */
 static void test_vram_d3cold_threshold(device_t device, int sysfs_fd)
 {
-	struct drm_xe_query_mem_usage *mem_usage;
+	struct drm_xe_query_mem_regions *mem_regions;
 	struct drm_xe_device_query query = {
 		.extensions = 0,
-		.query = DRM_XE_DEVICE_QUERY_MEM_USAGE,
+		.query = DRM_XE_DEVICE_QUERY_MEM_REGIONS,
 		.size = 0,
 		.data = 0,
 	};
@@ -394,16 +394,16 @@ static void test_vram_d3cold_threshold(device_t device, int sysfs_fd)
 	igt_assert_eq(igt_ioctl(device.fd_xe, DRM_IOCTL_XE_DEVICE_QUERY, &query), 0);
 	igt_assert_neq(query.size, 0);
 
-	mem_usage = malloc(query.size);
-	igt_assert(mem_usage);
+	mem_regions = malloc(query.size);
+	igt_assert(mem_regions);
 
-	query.data = to_user_pointer(mem_usage);
+	query.data = to_user_pointer(mem_regions);
 	igt_assert_eq(igt_ioctl(device.fd_xe, DRM_IOCTL_XE_DEVICE_QUERY, &query), 0);
 
-	for (i = 0; i < mem_usage->num_regions; i++) {
-		if (mem_usage->regions[i].mem_class == DRM_XE_MEM_REGION_CLASS_VRAM) {
-			vram_used_mb +=  (mem_usage->regions[i].used / (1024 * 1024));
-			vram_total_mb += (mem_usage->regions[i].total_size / (1024 * 1024));
+	for (i = 0; i < mem_regions->num_regions; i++) {
+		if (mem_regions->regions[i].mem_class == DRM_XE_MEM_REGION_CLASS_VRAM) {
+			vram_used_mb +=  (mem_regions->regions[i].used / (1024 * 1024));
+			vram_total_mb += (mem_regions->regions[i].total_size / (1024 * 1024));
 		}
 	}
 
tests/intel/xe_query.c +29 -29

91 lines not on this page · raw message

Signature · 1 line
2.34.1
#25 lore raw

PATCH v3 25/57 xe: s/hw_engine/engine

In reply to Francois Dugast

From: Rodrigo Vivi <[email protected]>

HW engine is redundant after exec_queue name was created.

---
 benchmarks/gem_wsim.c              |  8 ++---
 lib/xe/xe_query.c                  | 36 ++++++++++----------
 lib/xe/xe_query.h                  | 22 ++++++------
 tests/intel/xe_create.c            |  4 +--
 tests/intel/xe_dma_buf_sync.c      |  2 +-
 tests/intel/xe_drm_fdinfo.c        |  2 +-
 tests/intel/xe_evict.c             |  2 +-
 tests/intel/xe_exec_balancer.c     | 28 ++++++++--------
 tests/intel/xe_exec_basic.c        | 12 +++----
 tests/intel/xe_exec_compute_mode.c |  8 ++---
 tests/intel/xe_exec_fault_mode.c   |  8 ++---
 tests/intel/xe_exec_reset.c        | 44 ++++++++++++------------
 tests/intel/xe_exec_store.c        | 18 +++++-----
 tests/intel/xe_exec_threads.c      | 24 ++++++-------
 tests/intel/xe_guc_pc.c            |  4 +--
 tests/intel/xe_huc_copy.c          |  2 +-
 tests/intel/xe_intel_bb.c          |  2 +-
 tests/intel/xe_noexec_ping_pong.c  |  2 +-
 tests/intel/xe_perf_pmu.c          |  6 ++--
 tests/intel/xe_pm.c                | 14 ++++----
 tests/intel/xe_pm_residency.c      |  2 +-
 tests/intel/xe_query.c             |  6 ++--
 tests/intel/xe_spin_batch.c        | 10 +++---
 tests/intel/xe_vm.c                | 54 +++++++++++++++---------------
 24 files changed, 160 insertions(+), 160 deletions(-)
benchmarks/gem_wsim.c +4 -4
index d134b2dea..d451b8733 100644
@@ -542,7 +542,7 @@ static struct intel_engine_data *query_engines(void)
 	if (is_xe) {
 		struct drm_xe_engine_class_instance *hwe;
 
-		xe_for_each_hw_engine(fd, hwe) {
+		xe_for_each_engine(fd, hwe) {
 			engines.engines[engines.nengines].class = hwe->engine_class;
 			engines.engines[engines.nengines].instance = hwe->engine_instance;
 			engines.nengines++;
@@ -669,7 +669,7 @@ xe_get_engine(enum intel_engine_id engine)
 		igt_assert(0);
 	};
 
-	xe_for_each_hw_engine(fd, hwe1) {
+	xe_for_each_engine(fd, hwe1) {
 		if (hwe.engine_class == hwe1->engine_class &&
 		    hwe.engine_instance  == hwe1->engine_instance) {
 			hwe = *hwe1;
@@ -688,8 +688,8 @@ xe_get_default_engine(void)
 	struct drm_xe_engine_class_instance default_hwe, *hwe;
 
 	/* select RCS0 | CCS0 or first available engine */
-	default_hwe = *xe_hw_engine(fd, 0);
-	xe_for_each_hw_engine(fd, hwe) {
+	default_hwe = *xe_engine(fd, 0);
+	xe_for_each_engine(fd, hwe) {
 		if ((hwe->engine_class == DRM_XE_ENGINE_CLASS_RENDER ||
 		     hwe->engine_class == DRM_XE_ENGINE_CLASS_COMPUTE) &&
 		    hwe->engine_instance == 0) {
lib/xe/xe_query.c +18 -18
index 859bfda45..10ceef665 100644
@@ -75,7 +75,7 @@ static uint64_t __memory_regions(const struct drm_xe_query_gt_list *gt_list)
 static struct drm_xe_engine_class_instance *
 xe_query_engines_new(int fd, unsigned int *num_engines)
 {
-	struct drm_xe_engine_class_instance *hw_engines;
+	struct drm_xe_engine_class_instance *engines;
 	struct drm_xe_device_query query = {
 		.extensions = 0,
 		.query = DRM_XE_DEVICE_QUERY_ENGINES,
@@ -86,15 +86,15 @@ xe_query_engines_new(int fd, unsigned int *num_engines)
 	igt_assert(num_engines);
 	igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_DEVICE_QUERY, &query), 0);
 
-	hw_engines = malloc(query.size);
-	igt_assert(hw_engines);
+	engines = malloc(query.size);
+	igt_assert(engines);
 
-	query.data = to_user_pointer(hw_engines);
+	query.data = to_user_pointer(engines);
 	igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_DEVICE_QUERY, &query), 0);
 
-	*num_engines = query.size / sizeof(*hw_engines);
+	*num_engines = query.size / sizeof(*engines);
 
-	return hw_engines;
+	return engines;
 }
 
 static struct drm_xe_query_mem_regions *xe_query_mem_regions_new(int fd)
@@ -221,7 +221,7 @@ static void xe_device_free(struct xe_device *xe_dev)
 {
 	free(xe_dev->config);
 	free(xe_dev->gt_list);
-	free(xe_dev->hw_engines);
+	free(xe_dev->engines);
 	free(xe_dev->mem_regions);
 	free(xe_dev->vram_size);
 	free(xe_dev);
@@ -253,7 +253,7 @@ struct xe_device *xe_device_get(int fd)
 	xe_dev->dev_id = xe_dev->config->info[DRM_XE_QUERY_CONFIG_REV_AND_DEVICE_ID] & 0xffff;
 	xe_dev->gt_list = xe_query_gt_list_new(fd);
 	xe_dev->memory_regions = __memory_regions(xe_dev->gt_list);
-	xe_dev->hw_engines = xe_query_engines_new(fd, &xe_dev->number_hw_engines);
+	xe_dev->engines = xe_query_engines_new(fd, &xe_dev->number_engines);
 	xe_dev->mem_regions = xe_query_mem_regions_new(fd);
 	xe_dev->vram_size = calloc(xe_dev->gt_list->num_gt, sizeof(*xe_dev->vram_size));
 	xe_dev->visible_vram_size = calloc(xe_dev->gt_list->num_gt, sizeof(*xe_dev->visible_vram_size));
@@ -412,29 +412,29 @@ uint64_t vram_if_possible(int fd, int gt)
 }
 
 /**
- * xe_hw_engines:
+ * xe_engines:
  * @fd: xe device fd
  *
  * Returns engines array of xe device @fd.
  */
-xe_dev_FN(xe_hw_engines, hw_engines, struct drm_xe_engine_class_instance *);
+xe_dev_FN(xe_engines, engines, struct drm_xe_engine_class_instance *);
 
 /**
- * xe_hw_engine:
+ * xe_engine:
  * @fd: xe device fd
  * @idx: engine index
  *
  * Returns engine instance of xe device @fd and @idx.
  */
-struct drm_xe_engine_class_instance *xe_hw_engine(int fd, int idx)
+struct drm_xe_engine_class_instance *xe_engine(int fd, int idx)
 {
 	struct xe_device *xe_dev;
 
 	xe_dev = find_in_cache(fd);
 	igt_assert(xe_dev);
-	igt_assert(idx >= 0 && idx < xe_dev->number_hw_engines);
+	igt_assert(idx >= 0 && idx < xe_dev->number_engines);
 
-	return &xe_dev->hw_engines[idx];
+	return &xe_dev->engines[idx];
 }
 
 /**
@@ -519,12 +519,12 @@ uint32_t xe_min_page_size(int fd, uint64_t region)
 xe_dev_FN(xe_config, config, struct drm_xe_query_config *);
 
 /**
- * xe_number_hw_engine:
+ * xe_number_engine:
  * @fd: xe device fd
  *
  * Returns number of hw engines of xe device @fd.
  */
-xe_dev_FN(xe_number_hw_engines, number_hw_engines, unsigned int);
+xe_dev_FN(xe_number_engines, number_engines, unsigned int);
 
 /**
  * xe_has_vram:
@@ -643,8 +643,8 @@ bool xe_has_engine_class(int fd, uint16_t engine_class)
 	xe_dev = find_in_cache(fd);
 	igt_assert(xe_dev);
 
-	for (int i = 0; i < xe_dev->number_hw_engines; i++)
-		if (xe_dev->hw_engines[i].engine_class == engine_class)
+	for (int i = 0; i < xe_dev->number_engines; i++)
+		if (xe_dev->engines[i].engine_class == engine_class)
 			return true;
 
 	return false;
lib/xe/xe_query.h +11 -11
index be92ec5ed..bf9f2b955 100644
@@ -32,11 +32,11 @@ struct xe_device {
 	/** @gt_list: bitmask of all memory regions */
 	uint64_t memory_regions;
 
-	/** @hw_engines: array of hardware engines */
-	struct drm_xe_engine_class_instance *hw_engines;
+	/** @engines: array of hardware engines */
+	struct drm_xe_engine_class_instance *engines;
 
-	/** @number_hw_engines: length of hardware engines array */
-	unsigned int number_hw_engines;
+	/** @number_engines: length of hardware engines array */
+	unsigned int number_engines;
 
 	/** @mem_regions: regions memory information and usage */
 	struct drm_xe_query_mem_regions *mem_regions;
@@ -60,10 +60,10 @@ struct xe_device {
 	uint16_t dev_id;
 };
 
-#define xe_for_each_hw_engine(__fd, __hwe) \
-	for (int __i = 0; __i < xe_number_hw_engines(__fd) && \
-	     (__hwe = xe_hw_engine(__fd, __i)); ++__i)
-#define xe_for_each_hw_engine_class(__class) \
+#define xe_for_each_engine(__fd, __hwe) \
+	for (int __i = 0; __i < xe_number_engines(__fd) && \
+	     (__hwe = xe_engine(__fd, __i)); ++__i)
+#define xe_for_each_engine_class(__class) \
 	for (__class = 0; __class < DRM_XE_ENGINE_CLASS_COMPUTE + 1; \
 	     ++__class)
 #define xe_for_each_gt(__fd, __gt) \
@@ -81,14 +81,14 @@ uint64_t all_memory_regions(int fd);
 uint64_t system_memory(int fd);
 uint64_t vram_memory(int fd, int gt);
 uint64_t vram_if_possible(int fd, int gt);
-struct drm_xe_engine_class_instance *xe_hw_engines(int fd);
-struct drm_xe_engine_class_instance *xe_hw_engine(int fd, int idx);
+struct drm_xe_engine_class_instance *xe_engines(int fd);
+struct drm_xe_engine_class_instance *xe_engine(int fd, int idx);
 struct drm_xe_query_mem_region *xe_mem_region(int fd, uint64_t region);
 const char *xe_region_name(uint64_t region);
 uint16_t xe_region_class(int fd, uint64_t region);
 uint32_t xe_min_page_size(int fd, uint64_t region);
 struct drm_xe_query_config *xe_config(int fd);
-unsigned int xe_number_hw_engines(int fd);
+unsigned int xe_number_engines(int fd);
 bool xe_has_vram(int fd);
 uint64_t xe_vram_size(int fd, int gt);
 uint64_t xe_visible_vram_size(int fd, int gt);
tests/intel/xe_create.c +2 -2
index 4326b15e8..9d71b7463 100644
@@ -139,7 +139,7 @@ static void create_execqueues(int fd, enum exec_queue_destroy ed)
 	int nproc = sysconf(_SC_NPROCESSORS_ONLN), seconds;
 
 	fd = drm_reopen_driver(fd);
-	num_engines = xe_number_hw_engines(fd);
+	num_engines = xe_number_engines(fd);
 	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
 
 	exec_queues_per_process = max_t(uint32_t, 1, MAXEXECQUEUES / nproc);
@@ -156,7 +156,7 @@ static void create_execqueues(int fd, enum exec_queue_destroy ed)
 
 		for (i = 0; i < exec_queues_per_process; i++) {
 			idx = rand() % num_engines;
-			hwe = xe_hw_engine(fd, idx);
+			hwe = xe_engine(fd, idx);
 			err = __xe_exec_queue_create(fd, vm, hwe, 0, &exec_queue);
 			igt_debug("[%2d] Create exec_queue: err=%d, exec_queue=%u [idx = %d]\n",
 				  n, err, exec_queue, i);
tests/intel/xe_dma_buf_sync.c +1 -1
index aeb4c4995..dfa957243 100644
@@ -229,7 +229,7 @@ igt_main
 	igt_fixture {
 		fd = drm_open_driver(DRIVER_XE);
 
-		xe_for_each_hw_engine(fd, hwe)
+		xe_for_each_engine(fd, hwe)
 			if (hwe0 == NULL) {
 				hwe0 = hwe;
 			} else {
tests/intel/xe_drm_fdinfo.c +1 -1
index 6bca5a6f1..d50cc6df1 100644
@@ -313,7 +313,7 @@ igt_main
 
 	igt_describe("Create and compare active memory consumption by client");
 	igt_subtest("drm-active")
-		test_active(xe, xe_hw_engine(xe, 0));
+		test_active(xe, xe_engine(xe, 0));
 
 	igt_fixture {
 		drm_close_driver(xe);
tests/intel/xe_evict.c +1 -1
index 436a2be02..2e2960b9b 100644
@@ -759,7 +759,7 @@ igt_main
 		vram_size = xe_visible_vram_size(fd, 0);
 		igt_assert(vram_size);
 
-		xe_for_each_hw_engine(fd, hwe)
+		xe_for_each_engine(fd, hwe)
 			if (hwe->engine_class != DRM_XE_ENGINE_CLASS_COPY)
 				break;
 	}
tests/intel/xe_exec_balancer.c +14 -14
index fa3d7a338..ea06c23cd 100644
@@ -57,7 +57,7 @@ static void test_all_active(int fd, int gt, int class)
 	struct drm_xe_engine_class_instance eci[MAX_INSTANCE];
 	int i, num_placements = 0;
 
-	xe_for_each_hw_engine(fd, hwe) {
+	xe_for_each_engine(fd, hwe) {
 		if (hwe->engine_class != class || hwe->gt_id != gt)
 			continue;
 
@@ -199,7 +199,7 @@ test_exec(int fd, int gt, int class, int n_exec_queues, int n_execs,
 
 	igt_assert(n_exec_queues <= MAX_N_EXEC_QUEUES);
 
-	xe_for_each_hw_engine(fd, hwe) {
+	xe_for_each_engine(fd, hwe) {
 		if (hwe->engine_class != class || hwe->gt_id != gt)
 			continue;
 
@@ -426,7 +426,7 @@ test_cm(int fd, int gt, int class, int n_exec_queues, int n_execs,
 
 	igt_assert(n_exec_queues <= MAX_N_EXEC_QUEUES);
 
-	xe_for_each_hw_engine(fd, hwe) {
+	xe_for_each_engine(fd, hwe) {
 		if (hwe->engine_class != class || hwe->gt_id != gt)
 			continue;
 
@@ -632,25 +632,25 @@ igt_main
 
 	igt_subtest("virtual-all-active")
 		xe_for_each_gt(fd, gt)
-			xe_for_each_hw_engine_class(class)
+			xe_for_each_engine_class(class)
 				test_all_active(fd, gt, class);
 
 	for (const struct section *s = sections; s->name; s++) {
 		igt_subtest_f("once-%s", s->name)
 			xe_for_each_gt(fd, gt)
-				xe_for_each_hw_engine_class(class)
+				xe_for_each_engine_class(class)
 					test_exec(fd, gt, class, 1, 1,
 						  s->flags);
 
 		igt_subtest_f("twice-%s", s->name)
 			xe_for_each_gt(fd, gt)
-				xe_for_each_hw_engine_class(class)
+				xe_for_each_engine_class(class)
 					test_exec(fd, gt, class, 1, 2,
 						  s->flags);
 
 		igt_subtest_f("many-%s", s->name)
 			xe_for_each_gt(fd, gt)
-				xe_for_each_hw_engine_class(class)
+				xe_for_each_engine_class(class)
 					test_exec(fd, gt, class, 1,
 						  s->flags & (REBIND | INVALIDATE) ?
 						  64 : 1024,
@@ -658,7 +658,7 @@ igt_main
 
 		igt_subtest_f("many-execqueues-%s", s->name)
 			xe_for_each_gt(fd, gt)
-				xe_for_each_hw_engine_class(class)
+				xe_for_each_engine_class(class)
 					test_exec(fd, gt, class, 16,
 						  s->flags & (REBIND | INVALIDATE) ?
 						  64 : 1024,
@@ -666,23 +666,23 @@ igt_main
 
 		igt_subtest_f("no-exec-%s", s->name)
 			xe_for_each_gt(fd, gt)
-				xe_for_each_hw_engine_class(class)
+				xe_for_each_engine_class(class)
 					test_exec(fd, gt, class, 1, 0,
 						  s->flags);
 
 		igt_subtest_f("once-cm-%s", s->name)
 			xe_for_each_gt(fd, gt)
-				xe_for_each_hw_engine_class(class)
+				xe_for_each_engine_class(class)
 					test_cm(fd, gt, class, 1, 1, s->flags);
 
 		igt_subtest_f("twice-cm-%s", s->name)
 			xe_for_each_gt(fd, gt)
-				xe_for_each_hw_engine_class(class)
+				xe_for_each_engine_class(class)
 					test_cm(fd, gt, class, 1, 2, s->flags);
 
 		igt_subtest_f("many-cm-%s", s->name)
 			xe_for_each_gt(fd, gt)
-				xe_for_each_hw_engine_class(class)
+				xe_for_each_engine_class(class)
 					test_cm(fd, gt, class, 1,
 						s->flags & (REBIND | INVALIDATE) ?
 						64 : 1024,
@@ -690,7 +690,7 @@ igt_main
 
 		igt_subtest_f("many-execqueues-cm-%s", s->name)
 			xe_for_each_gt(fd, gt)
-				xe_for_each_hw_engine_class(class)
+				xe_for_each_engine_class(class)
 					test_cm(fd, gt, class, 16,
 						s->flags & (REBIND | INVALIDATE) ?
 						64 : 1024,
@@ -698,7 +698,7 @@ igt_main
 
 		igt_subtest_f("no-exec-cm-%s", s->name)
 			xe_for_each_gt(fd, gt)
-				xe_for_each_hw_engine_class(class)
+				xe_for_each_engine_class(class)
 					test_cm(fd, gt, class, 1, 0, s->flags);
 	}
 
tests/intel/xe_exec_basic.c +6 -6
index 23acdd434..46b9dc2e0 100644
@@ -336,36 +336,36 @@ igt_main
 
 	for (const struct section *s = sections; s->name; s++) {
 		igt_subtest_f("once-%s", s->name)
-			xe_for_each_hw_engine(fd, hwe)
+			xe_for_each_engine(fd, hwe)
 				test_exec(fd, hwe, 1, 1, 1, s->flags);
 
 		igt_subtest_f("twice-%s", s->name)
-			xe_for_each_hw_engine(fd, hwe)
+			xe_for_each_engine(fd, hwe)
 				test_exec(fd, hwe, 1, 2, 1, s->flags);
 
 		igt_subtest_f("many-%s", s->name)
-			xe_for_each_hw_engine(fd, hwe)
+			xe_for_each_engine(fd, hwe)
 				test_exec(fd, hwe, 1,
 					  s->flags & (REBIND | INVALIDATE) ?
 					  64 : 1024, 1,
 					  s->flags);
 
 		igt_subtest_f("many-execqueues-%s", s->name)
-			xe_for_each_hw_engine(fd, hwe)
+			xe_for_each_engine(fd, hwe)
 				test_exec(fd, hwe, 16,
 					  s->flags & (REBIND | INVALIDATE) ?
 					  64 : 1024, 1,
 					  s->flags);
 
 		igt_subtest_f("many-execqueues-many-vm-%s", s->name)
-			xe_for_each_hw_engine(fd, hwe)
+			xe_for_each_engine(fd, hwe)
 				test_exec(fd, hwe, 16,
 					  s->flags & (REBIND | INVALIDATE) ?
 					  64 : 1024, 16,
 					  s->flags);
 
 		igt_subtest_f("no-exec-%s", s->name)
-			xe_for_each_hw_engine(fd, hwe)
+			xe_for_each_engine(fd, hwe)
 				test_exec(fd, hwe, 1, 0, 1, s->flags);
 	}
 
tests/intel/xe_exec_compute_mode.c +4 -4
index 98a98256e..a9f69deef 100644
@@ -321,15 +321,15 @@ igt_main
 
 	for (const struct section *s = sections; s->name; s++) {
 		igt_subtest_f("once-%s", s->name)
-			xe_for_each_hw_engine(fd, hwe)
+			xe_for_each_engine(fd, hwe)
 				test_exec(fd, hwe, 1, 1, s->flags);
 
 		igt_subtest_f("twice-%s", s->name)
-			xe_for_each_hw_engine(fd, hwe)
+			xe_for_each_engine(fd, hwe)
 				test_exec(fd, hwe, 1, 2, s->flags);
 
 		igt_subtest_f("many-%s", s->name)
-			xe_for_each_hw_engine(fd, hwe)
+			xe_for_each_engine(fd, hwe)
 				test_exec(fd, hwe, 1,
 					  s->flags & (REBIND | INVALIDATE) ?
 					  64 : 128,
@@ -339,7 +339,7 @@ igt_main
 			continue;
 
 		igt_subtest_f("many-execqueues-%s", s->name)
-			xe_for_each_hw_engine(fd, hwe)
+			xe_for_each_engine(fd, hwe)
 				test_exec(fd, hwe, 16,
 					  s->flags & (REBIND | INVALIDATE) ?
 					  64 : 128,
tests/intel/xe_exec_fault_mode.c +4 -4
index 3eb448ef4..4c85fce76 100644
@@ -386,22 +386,22 @@ igt_main
 
 	for (const struct section *s = sections; s->name; s++) {
 		igt_subtest_f("once-%s", s->name)
-			xe_for_each_hw_engine(fd, hwe)
+			xe_for_each_engine(fd, hwe)
 				test_exec(fd, hwe, 1, 1, s->flags);
 
 		igt_subtest_f("twice-%s", s->name)
-			xe_for_each_hw_engine(fd, hwe)
+			xe_for_each_engine(fd, hwe)
 				test_exec(fd, hwe, 1, 2, s->flags);
 
 		igt_subtest_f("many-%s", s->name)
-			xe_for_each_hw_engine(fd, hwe)
+			xe_for_each_engine(fd, hwe)
 				test_exec(fd, hwe, 1,
 					  s->flags & (REBIND | INVALIDATE) ?
 					  64 : 128,
 					  s->flags);
 
 		igt_subtest_f("many-execqueues-%s", s->name)
-			xe_for_each_hw_engine(fd, hwe)
+			xe_for_each_engine(fd, hwe)
 				test_exec(fd, hwe, 16,
 					  s->flags & (REBIND | INVALIDATE) ?
 					  64 : 128,
tests/intel/xe_exec_reset.c +22 -22

135 lines not on this page · raw message

tests/intel/xe_exec_store.c +9 -9
index 9ee5edeb4..0b7b3d3e9 100644
@@ -63,7 +63,7 @@ static void store(int fd)
 		.syncs = to_user_pointer(&sync),
 	};
 	struct data *data;
-	struct drm_xe_engine_class_instance *hw_engine;
+	struct drm_xe_engine_class_instance *engine;
 	uint32_t vm;
 	uint32_t exec_queue;
 	uint32_t syncobj;
@@ -80,16 +80,16 @@ static void store(int fd)
 	bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd),
 			xe_get_default_alignment(fd));
 
-	hw_engine = xe_hw_engine(fd, 1);
+	engine = xe_engine(fd, 1);
 	bo = xe_bo_create(fd, vm, bo_size,
-			  vram_if_possible(fd, hw_engine->gt_id),
+			  vram_if_possible(fd, engine->gt_id),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 
-	xe_vm_bind_async(fd, vm, hw_engine->gt_id, bo, 0, addr, bo_size, &sync, 1);
+	xe_vm_bind_async(fd, vm, engine->gt_id, bo, 0, addr, bo_size, &sync, 1);
 	data = xe_bo_map(fd, bo, bo_size);
 	store_dword_batch(data, addr, value);
 
-	exec_queue = xe_exec_queue_create(fd, vm, hw_engine, 0);
+	exec_queue = xe_exec_queue_create(fd, vm, engine, 0);
 	exec.exec_queue_id = exec_queue;
 	exec.address = data->addr;
 	sync.flags &= DRM_XE_SYNC_FLAG_SIGNAL;
@@ -242,7 +242,7 @@ static void store_all(int fd, int gt, int class)
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(fd, bo, bo_size);
 
-	xe_for_each_hw_engine(fd, hwe) {
+	xe_for_each_engine(fd, hwe) {
 		if (hwe->engine_class != class || hwe->gt_id != gt)
 			continue;
 		eci[num_placements++] = *hwe;
@@ -309,16 +309,16 @@ igt_main
 
 	igt_subtest("basic-all") {
 		xe_for_each_gt(fd, gt)
-			xe_for_each_hw_engine_class(class)
+			xe_for_each_engine_class(class)
 				store_all(fd, gt, class);
 	}
 
 	igt_subtest("cachelines")
-		xe_for_each_hw_engine(fd, hwe)
+		xe_for_each_engine(fd, hwe)
 			store_cachelines(fd, hwe, 0);
 
 	igt_subtest("page-sized")
-		xe_for_each_hw_engine(fd, hwe)
+		xe_for_each_engine(fd, hwe)
 			store_cachelines(fd, hwe, PAGES);
 
 	igt_fixture {
tests/intel/xe_exec_threads.c +12 -12
index f37fc612a..8a01b150d 100644
@@ -81,7 +81,7 @@ test_balancer(int fd, int gt, uint32_t vm, uint64_t addr, uint64_t userptr,
 		owns_vm = true;
 	}
 
-	xe_for_each_hw_engine(fd, hwe) {
+	xe_for_each_engine(fd, hwe) {
 		if (hwe->engine_class != class || hwe->gt_id != gt)
 			continue;
 
@@ -969,22 +969,22 @@ static void threads(int fd, int flags)
 	uint64_t userptr = 0x00007000eadbe000;
 	pthread_mutex_t mutex;
 	pthread_cond_t cond;
-	int n_hw_engines = 0, class;
+	int n_engines = 0, class;
 	uint64_t i = 0;
 	uint32_t vm_legacy_mode = 0, vm_compute_mode = 0;
 	bool go = false;
 	int n_threads = 0;
 	int gt;
 
-	xe_for_each_hw_engine(fd, hwe)
-		++n_hw_engines;
+	xe_for_each_engine(fd, hwe)
+		++n_engines;
 
 	if (flags & BALANCER) {
 		xe_for_each_gt(fd, gt)
-			xe_for_each_hw_engine_class(class) {
+			xe_for_each_engine_class(class) {
 				int num_placements = 0;
 
-				xe_for_each_hw_engine(fd, hwe) {
+				xe_for_each_engine(fd, hwe) {
 					if (hwe->engine_class != class ||
 					    hwe->gt_id != gt)
 						continue;
@@ -992,11 +992,11 @@ static void threads(int fd, int flags)
 				}
 
 				if (num_placements > 1)
-					n_hw_engines += 2;
+					n_engines += 2;
 			}
 	}
 
-	threads_data = calloc(n_hw_engines, sizeof(*threads_data));
+	threads_data = calloc(n_engines, sizeof(*threads_data));
 	igt_assert(threads_data);
 
 	pthread_mutex_init(&mutex, 0);
@@ -1012,7 +1012,7 @@ static void threads(int fd, int flags)
 					       0);
 	}
 
-	xe_for_each_hw_engine(fd, hwe) {
+	xe_for_each_engine(fd, hwe) {
 		threads_data[i].mutex = &mutex;
 		threads_data[i].cond = &cond;
 #define ADDRESS_SHIFT	39
@@ -1045,10 +1045,10 @@ static void threads(int fd, int flags)
 
 	if (flags & BALANCER) {
 		xe_for_each_gt(fd, gt)
-			xe_for_each_hw_engine_class(class) {
+			xe_for_each_engine_class(class) {
 				int num_placements = 0;
 
-				xe_for_each_hw_engine(fd, hwe) {
+				xe_for_each_engine(fd, hwe) {
 					if (hwe->engine_class != class ||
 					    hwe->gt_id != gt)
 						continue;
@@ -1123,7 +1123,7 @@ static void threads(int fd, int flags)
 	pthread_cond_broadcast(&cond);
 	pthread_mutex_unlock(&mutex);
 
-	for (i = 0; i < n_hw_engines; ++i)
+	for (i = 0; i < n_engines; ++i)
 		pthread_join(threads_data[i].thread, NULL);
 
 	if (vm_legacy_mode)
tests/intel/xe_guc_pc.c +2 -2
index 8d7b677b4..dd768ecdc 100644
@@ -415,7 +415,7 @@ igt_main
 
 	igt_subtest("freq_fixed_exec") {
 		xe_for_each_gt(fd, gt) {
-			xe_for_each_hw_engine(fd, hwe)
+			xe_for_each_engine(fd, hwe)
 				igt_fork(child, ncpus) {
 					igt_debug("Execution Started\n");
 					exec_basic(fd, hwe, MAX_N_EXEC_QUEUES, 16);
@@ -437,7 +437,7 @@ igt_main
 
 	igt_subtest("freq_range_exec") {
 		xe_for_each_gt(fd, gt) {
-			xe_for_each_hw_engine(fd, hwe)
+			xe_for_each_engine(fd, hwe)
 				igt_fork(child, ncpus) {
 					igt_debug("Execution Started\n");
 					exec_basic(fd, hwe, MAX_N_EXEC_QUEUES, 16);
tests/intel/xe_huc_copy.c +1 -1
index eda9e5216..dbc5afc17 100644
@@ -158,7 +158,7 @@ test_huc_copy(int fd)
 
 	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
 
-	xe_for_each_hw_engine(fd, hwe) {
+	xe_for_each_engine(fd, hwe) {
 		if (hwe->engine_class == DRM_XE_ENGINE_CLASS_VIDEO_DECODE &&
 		    !(tested_gts & BIT(hwe->gt_id))) {
 			tested_gts |= BIT(hwe->gt_id);
tests/intel/xe_intel_bb.c +1 -1
index 00bd17d4c..e7a566f62 100644
@@ -192,7 +192,7 @@ static void simple_bb(struct buf_ops *bops, bool new_context)
 
 	if (new_context) {
 		vm = xe_vm_create(xe, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
-		ctx = xe_exec_queue_create(xe, vm, xe_hw_engine(xe, 0), 0);
+		ctx = xe_exec_queue_create(xe, vm, xe_engine(xe, 0), 0);
 		intel_bb_destroy(ibb);
 		ibb = intel_bb_create_with_context(xe, ctx, vm, NULL, PAGE_SIZE);
 		intel_bb_out(ibb, MI_BATCH_BUFFER_END);
tests/intel/xe_noexec_ping_pong.c +1 -1
index 5e3349247..e27cc4582 100644
@@ -98,7 +98,7 @@ igt_simple_main
 
 	fd = drm_open_driver(DRIVER_XE);
 
-	test_ping_pong(fd, xe_hw_engine(fd, 0));
+	test_ping_pong(fd, xe_engine(fd, 0));
 
 	drm_close_driver(fd);
 }
tests/intel/xe_perf_pmu.c +3 -3
index 8ef557a46..63a8eb9b2 100644
@@ -209,7 +209,7 @@ static void test_engine_group_busyness(int fd, int gt, int class, const char *na
 
 	config = engine_group_get_config(gt, class);
 
-	xe_for_each_hw_engine(fd, hwe) {
+	xe_for_each_engine(fd, hwe) {
 		if (hwe->engine_class != class || hwe->gt_id != gt)
 			continue;
 
@@ -315,13 +315,13 @@ igt_main
 	for (const struct section *s = sections; s->name; s++) {
 		igt_subtest_f("%s", s->name)
 			xe_for_each_gt(fd, gt)
-				xe_for_each_hw_engine_class(class)
+				xe_for_each_engine_class(class)
 					if (class == s->class)
 						test_engine_group_busyness(fd, gt, class, s->name);
 	}
 
 	igt_subtest("any-engine-group-busy")
-		xe_for_each_hw_engine(fd, hwe)
+		xe_for_each_engine(fd, hwe)
 			test_any_engine_busyness(fd, hwe);
 
 	igt_fixture {
tests/intel/xe_pm.c +7 -7
index 2e5c61b59..d78ca31a8 100644
@@ -471,7 +471,7 @@ igt_main
 		igt_device_get_pci_slot_name(device.fd_xe, device.pci_slot_name);
 
 		/* Always perform initial once-basic exec checking for health */
-		xe_for_each_hw_engine(device.fd_xe, hwe)
+		xe_for_each_engine(device.fd_xe, hwe)
 			test_exec(device, hwe, 1, 1, NO_SUSPEND, NO_RPM);
 
 		igt_pm_get_d3cold_allowed(device.pci_slot_name, &d3cold_allowed);
@@ -486,7 +486,7 @@ igt_main
 		}
 
 		igt_subtest_f("%s-basic-exec", s->name) {
-			xe_for_each_hw_engine(device.fd_xe, hwe)
+			xe_for_each_engine(device.fd_xe, hwe)
 				test_exec(device, hwe, 1, 2, s->state,
 					  NO_RPM);
 		}
@@ -494,13 +494,13 @@ igt_main
 		igt_subtest_f("%s-exec-after", s->name) {
 			igt_system_suspend_autoresume(s->state,
 						      SUSPEND_TEST_NONE);
-			xe_for_each_hw_engine(device.fd_xe, hwe)
+			xe_for_each_engine(device.fd_xe, hwe)
 				test_exec(device, hwe, 1, 2, NO_SUSPEND,
 					  NO_RPM);
 		}
 
 		igt_subtest_f("%s-multiple-execs", s->name) {
-			xe_for_each_hw_engine(device.fd_xe, hwe)
+			xe_for_each_engine(device.fd_xe, hwe)
 				test_exec(device, hwe, 16, 32, s->state,
 					  NO_RPM);
 		}
@@ -508,7 +508,7 @@ igt_main
 		for (const struct d_state *d = d_states; d->name; d++) {
 			igt_subtest_f("%s-%s-basic-exec", s->name, d->name) {
 				igt_assert(setup_d3(device, d->state));
-				xe_for_each_hw_engine(device.fd_xe, hwe)
+				xe_for_each_engine(device.fd_xe, hwe)
 					test_exec(device, hwe, 1, 2, s->state,
 						  NO_RPM);
 			}
@@ -523,14 +523,14 @@ igt_main
 
 		igt_subtest_f("%s-basic-exec", d->name) {
 			igt_assert(setup_d3(device, d->state));
-			xe_for_each_hw_engine(device.fd_xe, hwe)
+			xe_for_each_engine(device.fd_xe, hwe)
 				test_exec(device, hwe, 1, 1,
 					  NO_SUSPEND, d->state);
 		}
 
 		igt_subtest_f("%s-multiple-execs", d->name) {
 			igt_assert(setup_d3(device, d->state));
-			xe_for_each_hw_engine(device.fd_xe, hwe)
+			xe_for_each_engine(device.fd_xe, hwe)
 				test_exec(device, hwe, 16, 32,
 					  NO_SUSPEND, d->state);
 		}
tests/intel/xe_pm_residency.c +1 -1
index 6c9a95429..4f590c83c 100644
@@ -346,7 +346,7 @@ igt_main
 	igt_describe("Validate idle residency on exec");
 	igt_subtest("idle-residency-on-exec") {
 		xe_for_each_gt(fd, gt) {
-			xe_for_each_hw_engine(fd, hwe) {
+			xe_for_each_engine(fd, hwe) {
 				if (gt == hwe->gt_id && !hwe->engine_instance)
 					idle_residency_on_exec(fd, hwe);
 			}
tests/intel/xe_query.c +3 -3
index 5860add0b..98fe7386b 100644
@@ -181,7 +181,7 @@ test_query_engines(int fd)
 	struct drm_xe_engine_class_instance *hwe;
 	int i = 0;
 
-	xe_for_each_hw_engine(fd, hwe) {
+	xe_for_each_engine(fd, hwe) {
 		igt_assert(hwe);
 		igt_info("engine %d: %s, engine instance: %d, tile: TILE-%d\n", i++,
 			 xe_engine_class_string(hwe->engine_class), hwe->engine_instance,
@@ -602,7 +602,7 @@ static void test_query_engine_cycles(int fd)
 
 	igt_require(query_engine_cycles_supported(fd));
 
-	xe_for_each_hw_engine(fd, hwe) {
+	xe_for_each_engine(fd, hwe) {
 		igt_assert(hwe);
 		__engine_cycles(fd, hwe);
 	}
@@ -626,7 +626,7 @@ static void test_engine_cycles_invalid(int fd)
 	igt_require(query_engine_cycles_supported(fd));
 
 	/* get one engine */
-	xe_for_each_hw_engine(fd, hwe)
+	xe_for_each_engine(fd, hwe)
 		break;
 
 	/* sanity check engine selection is valid */
tests/intel/xe_spin_batch.c +5 -5
index 6abe700da..2e2a0ed0e 100644
@@ -72,8 +72,8 @@ static void spin_basic_all(int fd)
 
 	vm = xe_vm_create(fd, 0, 0);
 	ahnd = intel_allocator_open(fd, vm, INTEL_ALLOCATOR_RELOC);
-	spin = malloc(sizeof(*spin) * xe_number_hw_engines(fd));
-	xe_for_each_hw_engine(fd, hwe) {
+	spin = malloc(sizeof(*spin) * xe_number_engines(fd));
+	xe_for_each_engine(fd, hwe) {
 		igt_debug("Run on engine: %s:%d\n",
 			  xe_engine_class_string(hwe->engine_class), hwe->engine_instance);
 		spin[i] = igt_spin_new(fd, .ahnd = ahnd, .vm = vm, .hwe = hwe);
@@ -104,7 +104,7 @@ static void spin_all(int fd, int gt, int class)
 
 	ahnd = intel_allocator_open(fd, 0, INTEL_ALLOCATOR_RELOC);
 
-	xe_for_each_hw_engine(fd, hwe) {
+	xe_for_each_engine(fd, hwe) {
 		if (hwe->engine_class != class || hwe->gt_id != gt)
 			continue;
 		eci[num_placements++] = *hwe;
@@ -217,7 +217,7 @@ igt_main
 		spin_basic(fd);
 
 	igt_subtest("spin-batch")
-		xe_for_each_hw_engine(fd, hwe)
+		xe_for_each_engine(fd, hwe)
 			spin(fd, hwe);
 
 	igt_subtest("spin-basic-all")
@@ -225,7 +225,7 @@ igt_main
 
 	igt_subtest("spin-all") {
 		xe_for_each_gt(fd, gt)
-			xe_for_each_hw_engine_class(class)
+			xe_for_each_engine_class(class)
 				spin_all(fd, gt, class);
 	}
 
tests/intel/xe_vm.c +27 -27

189 lines not on this page · raw message

Signature · 1 line
2.34.1
#26 lore raw

PATCH v3 26/57 drm-uapi/xe: Align with drm_xe_query_engine_info

In reply to Francois Dugast

From: Rodrigo Vivi <[email protected]>

Align with kernel commit ("drm/xe: Make DRM_XE_DEVICE_QUERY_ENGINES future proof")

---
 benchmarks/gem_wsim.c             |  2 +-
 include/drm-uapi/xe_drm.h         | 19 +++++++++++++++++++
 lib/xe/xe_query.c                 | 16 ++++++++--------
 lib/xe/xe_query.h                 |  8 ++++----
 tests/intel/xe_create.c           |  7 ++++---
 tests/intel/xe_drm_fdinfo.c       |  5 +++--
 tests/intel/xe_exec_store.c       |  8 ++++----
 tests/intel/xe_intel_bb.c         |  3 ++-
 tests/intel/xe_noexec_ping_pong.c |  5 +++--
 9 files changed, 48 insertions(+), 25 deletions(-)
benchmarks/gem_wsim.c +1 -1
index d451b8733..5d5353c94 100644
@@ -688,7 +688,7 @@ xe_get_default_engine(void)
 	struct drm_xe_engine_class_instance default_hwe, *hwe;
 
 	/* select RCS0 | CCS0 or first available engine */
-	default_hwe = *xe_engine(fd, 0);
+	default_hwe = xe_engine(fd, 0)->instance;
 	xe_for_each_engine(fd, hwe) {
 		if ((hwe->engine_class == DRM_XE_ENGINE_CLASS_RENDER ||
 		     hwe->engine_class == DRM_XE_ENGINE_CLASS_COMPUTE) &&
include/drm-uapi/xe_drm.h +19 -0
index 0aa63f130..c5cd94808 100644
@@ -127,6 +127,10 @@ struct xe_user_extension {
 /**
  * struct drm_xe_engine_class_instance - instance of an engine class
  *
+ * It is returned as part of the @drm_xe_query_engine_info, but it also is
+ * used as the input of engine selection for both @drm_xe_exec_queue_create
+ * and @drm_xe_query_engine_cycles
+ *
  * The @engine_class can be:
  *  - %DRM_XE_ENGINE_CLASS_RENDER
  *  - %DRM_XE_ENGINE_CLASS_COPY
@@ -161,6 +165,21 @@ struct drm_xe_engine_class_instance {
 	__u16 pad;
 };
 
+/**
+ * struct drm_xe_query_engine_info - describe hardware engine
+ *
+ * If a query is made with a struct @drm_xe_device_query where .query
+ * is equal to %DRM_XE_DEVICE_QUERY_ENGINES, then the reply uses an array of
+ * struct @drm_xe_query_engine_info in .data.
+ */
+struct drm_xe_query_engine_info {
+	/** @instance: The @drm_xe_engine_class_instance */
+	struct drm_xe_engine_class_instance instance;
+
+	/** @reserved: Reserved */
+	__u64 reserved[5];
+};
+
 /**
  * enum drm_xe_memory_class - Supported memory classes.
  */
lib/xe/xe_query.c +8 -8
index 10ceef665..de0f8a78f 100644
@@ -72,10 +72,10 @@ static uint64_t __memory_regions(const struct drm_xe_query_gt_list *gt_list)
 	return regions;
 }
 
-static struct drm_xe_engine_class_instance *
-xe_query_engines_new(int fd, unsigned int *num_engines)
+static struct drm_xe_query_engine_info *
+xe_query_engines(int fd, unsigned int *num_engines)
 {
-	struct drm_xe_engine_class_instance *engines;
+	struct drm_xe_query_engine_info *engines;
 	struct drm_xe_device_query query = {
 		.extensions = 0,
 		.query = DRM_XE_DEVICE_QUERY_ENGINES,
@@ -253,7 +253,7 @@ struct xe_device *xe_device_get(int fd)
 	xe_dev->dev_id = xe_dev->config->info[DRM_XE_QUERY_CONFIG_REV_AND_DEVICE_ID] & 0xffff;
 	xe_dev->gt_list = xe_query_gt_list_new(fd);
 	xe_dev->memory_regions = __memory_regions(xe_dev->gt_list);
-	xe_dev->engines = xe_query_engines_new(fd, &xe_dev->number_engines);
+	xe_dev->engines = xe_query_engines(fd, &xe_dev->number_engines);
 	xe_dev->mem_regions = xe_query_mem_regions_new(fd);
 	xe_dev->vram_size = calloc(xe_dev->gt_list->num_gt, sizeof(*xe_dev->vram_size));
 	xe_dev->visible_vram_size = calloc(xe_dev->gt_list->num_gt, sizeof(*xe_dev->visible_vram_size));
@@ -417,16 +417,16 @@ uint64_t vram_if_possible(int fd, int gt)
  *
  * Returns engines array of xe device @fd.
  */
-xe_dev_FN(xe_engines, engines, struct drm_xe_engine_class_instance *);
+xe_dev_FN(xe_engines, engines, struct drm_xe_query_engine_info *);
 
 /**
  * xe_engine:
  * @fd: xe device fd
  * @idx: engine index
  *
- * Returns engine instance of xe device @fd and @idx.
+ * Returns engine info of xe device @fd and @idx.
  */
-struct drm_xe_engine_class_instance *xe_engine(int fd, int idx)
+struct drm_xe_query_engine_info *xe_engine(int fd, int idx)
 {
 	struct xe_device *xe_dev;
 
@@ -644,7 +644,7 @@ bool xe_has_engine_class(int fd, uint16_t engine_class)
 	igt_assert(xe_dev);
 
 	for (int i = 0; i < xe_dev->number_engines; i++)
-		if (xe_dev->engines[i].engine_class == engine_class)
+		if (xe_dev->engines[i].instance.engine_class == engine_class)
 			return true;
 
 	return false;
lib/xe/xe_query.h +4 -4
index bf9f2b955..fede00036 100644
@@ -33,7 +33,7 @@ struct xe_device {
 	uint64_t memory_regions;
 
 	/** @engines: array of hardware engines */
-	struct drm_xe_engine_class_instance *engines;
+	struct drm_xe_query_engine_info *engines;
 
 	/** @number_engines: length of hardware engines array */
 	unsigned int number_engines;
@@ -62,7 +62,7 @@ struct xe_device {
 
 #define xe_for_each_engine(__fd, __hwe) \
 	for (int __i = 0; __i < xe_number_engines(__fd) && \
-	     (__hwe = xe_engine(__fd, __i)); ++__i)
+	     (__hwe = &xe_engine(__fd, __i)->instance); ++__i)
 #define xe_for_each_engine_class(__class) \
 	for (__class = 0; __class < DRM_XE_ENGINE_CLASS_COMPUTE + 1; \
 	     ++__class)
@@ -81,8 +81,8 @@ uint64_t all_memory_regions(int fd);
 uint64_t system_memory(int fd);
 uint64_t vram_memory(int fd, int gt);
 uint64_t vram_if_possible(int fd, int gt);
-struct drm_xe_engine_class_instance *xe_engines(int fd);
-struct drm_xe_engine_class_instance *xe_engine(int fd, int idx);
+struct drm_xe_query_engine_info *xe_engines(int fd);
+struct drm_xe_query_engine_info *xe_engine(int fd, int idx);
 struct drm_xe_query_mem_region *xe_mem_region(int fd, uint64_t region);
 const char *xe_region_name(uint64_t region);
 uint16_t xe_region_class(int fd, uint64_t region);
tests/intel/xe_create.c +4 -3
index 9d71b7463..b04a3443f 100644
@@ -148,7 +148,7 @@ static void create_execqueues(int fd, enum exec_queue_destroy ed)
 	igt_nsec_elapsed(&tv);
 
 	igt_fork(n, nproc) {
-		struct drm_xe_engine_class_instance *hwe;
+		struct drm_xe_query_engine_info *engine;
 		uint32_t exec_queue, exec_queues[exec_queues_per_process];
 		int idx, err, i;
 
@@ -156,8 +156,9 @@ static void create_execqueues(int fd, enum exec_queue_destroy ed)
 
 		for (i = 0; i < exec_queues_per_process; i++) {
 			idx = rand() % num_engines;
-			hwe = xe_engine(fd, idx);
-			err = __xe_exec_queue_create(fd, vm, hwe, 0, &exec_queue);
+			engine = xe_engine(fd, idx);
+			err = __xe_exec_queue_create(fd, vm, &engine->instance,
+						     0, &exec_queue);
 			igt_debug("[%2d] Create exec_queue: err=%d, exec_queue=%u [idx = %d]\n",
 				  n, err, exec_queue, i);
 			if (err)
tests/intel/xe_drm_fdinfo.c +3 -2
index d50cc6df1..cec3e0825 100644
@@ -40,7 +40,7 @@ IGT_TEST_DESCRIPTION("Read and verify drm client memory consumption using fdinfo
 #define BO_SIZE (65536)
 
 /* Subtests */
-static void test_active(int fd, struct drm_xe_engine_class_instance *eci)
+static void test_active(int fd, struct drm_xe_query_engine_info *engine)
 {
 	struct drm_xe_query_mem_region *memregion;
 	uint64_t memreg = all_memory_regions(fd), region;
@@ -89,7 +89,8 @@ static void test_active(int fd, struct drm_xe_engine_class_instance *eci)
 		data = xe_bo_map(fd, bo, bo_size);
 
 		for (i = 0; i < N_EXEC_QUEUES; i++) {
-			exec_queues[i] = xe_exec_queue_create(fd, vm, eci, 0);
+			exec_queues[i] = xe_exec_queue_create(fd, vm,
+							      &engine->instance, 0);
 			bind_exec_queues[i] = xe_bind_exec_queue_create(fd, vm, 0, true);
 			syncobjs[i] = syncobj_create(fd, 0);
 		}
tests/intel/xe_exec_store.c +4 -4
index 0b7b3d3e9..48e843af5 100644
@@ -63,7 +63,7 @@ static void store(int fd)
 		.syncs = to_user_pointer(&sync),
 	};
 	struct data *data;
-	struct drm_xe_engine_class_instance *engine;
+	struct drm_xe_query_engine_info *engine;
 	uint32_t vm;
 	uint32_t exec_queue;
 	uint32_t syncobj;
@@ -82,14 +82,14 @@ static void store(int fd)
 
 	engine = xe_engine(fd, 1);
 	bo = xe_bo_create(fd, vm, bo_size,
-			  vram_if_possible(fd, engine->gt_id),
+			  vram_if_possible(fd, engine->instance.gt_id),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 
-	xe_vm_bind_async(fd, vm, engine->gt_id, bo, 0, addr, bo_size, &sync, 1);
+	xe_vm_bind_async(fd, vm, engine->instance.gt_id, bo, 0, addr, bo_size, &sync, 1);
 	data = xe_bo_map(fd, bo, bo_size);
 	store_dword_batch(data, addr, value);
 
-	exec_queue = xe_exec_queue_create(fd, vm, engine, 0);
+	exec_queue = xe_exec_queue_create(fd, vm, &engine->instance, 0);
 	exec.exec_queue_id = exec_queue;
 	exec.address = data->addr;
 	sync.flags &= DRM_XE_SYNC_FLAG_SIGNAL;
tests/intel/xe_intel_bb.c +2 -1
index e7a566f62..b64812f9d 100644
@@ -192,7 +192,8 @@ static void simple_bb(struct buf_ops *bops, bool new_context)
 
 	if (new_context) {
 		vm = xe_vm_create(xe, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
-		ctx = xe_exec_queue_create(xe, vm, xe_engine(xe, 0), 0);
+		ctx = xe_exec_queue_create(xe, vm, &xe_engine(xe, 0)->instance,
+					   0);
 		intel_bb_destroy(ibb);
 		ibb = intel_bb_create_with_context(xe, ctx, vm, NULL, PAGE_SIZE);
 		intel_bb_out(ibb, MI_BATCH_BUFFER_END);
tests/intel/xe_noexec_ping_pong.c +3 -2
index e27cc4582..585af413d 100644
@@ -43,7 +43,7 @@
   *	there is worked queued on one of the VM's compute exec_queues.
  */
 
-static void test_ping_pong(int fd, struct drm_xe_engine_class_instance *eci)
+static void test_ping_pong(int fd, struct drm_xe_query_engine_info *engine)
 {
 	size_t vram_size = xe_vram_size(fd, 0);
 	size_t align = xe_get_default_alignment(fd);
@@ -75,7 +75,8 @@ static void test_ping_pong(int fd, struct drm_xe_engine_class_instance *eci)
 			xe_vm_bind(fd, vm[i], bo[i][j], 0, 0x40000 + j*bo_size,
 				   bo_size, NULL, 0);
 		}
-		exec_queues[i] = xe_exec_queue_create(fd, vm[i], eci, 0);
+		exec_queues[i] = xe_exec_queue_create(fd, vm[i],
+						      &engine->instance, 0);
 	}
 
 	igt_info("Now sleeping for %ds.\n", SECONDS_TO_WAIT);
Signature · 1 line
2.34.1
#27 lore raw

PATCH v3 27/57 drm-uapi/xe: Replace BO with GEM in documentation

In reply to Francois Dugast

Align with kernel commit ("drm/xe/uapi: Replace BO with GEM in documentation")

---
 include/drm-uapi/xe_drm.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
include/drm-uapi/xe_drm.h +5 -5
index c5cd94808..c35a12861 100644
@@ -631,14 +631,14 @@ struct drm_xe_gem_create {
 	 */
 	__u64 size;
 
-	/** @placement: A mask of memory instances of where BO can be placed. */
+	/** @placement: A mask of memory instances of where GEM can be placed. */
 	__u32 placement;
 
 #define DRM_XE_GEM_CREATE_FLAG_DEFER_BACKING		(1 << 0)
 #define DRM_XE_GEM_CREATE_FLAG_SCANOUT			(1 << 1)
 #define DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM	(1 << 2)
 	/**
-	 * @flags: Flags, currently a mask of memory instances of where BO can
+	 * @flags: Flags, currently a mask of memory instances of where GEM can
 	 * be placed
 	 */
 	__u32 flags;
@@ -646,7 +646,7 @@ struct drm_xe_gem_create {
 	/**
 	 * @vm_id: Attached VM, if any
 	 *
-	 * If a VM is specified, this BO must:
+	 * If a VM is specified, this GEM must:
 	 *
 	 *  1. Only ever be bound to that VM.
 	 *  2. Cannot be exported as a PRIME fd.
@@ -748,8 +748,8 @@ struct drm_xe_vm_destroy {
  *  - %DRM_XE_VM_BIND_FLAG_NULL - When the NULL flag is set, the page
  *    tables are setup with a special bit which indicates writes are
  *    dropped and all reads return zero. In the future, the NULL flags
- *    will only be valid for DRM_XE_VM_BIND_OP_MAP operations, the BO
- *    handle MBZ, and the BO offset MBZ. This flag is intended to
+ *    will only be valid for DRM_XE_VM_BIND_OP_MAP operations, the GEM
+ *    handle MBZ, and the GEM offset MBZ. This flag is intended to
  *    implement VK sparse bindings.
  *
  */
Signature · 1 line
2.34.1
#28 lore raw

PATCH v3 28/57 drm-uapi/xe: Drop interrupt pmu event

In reply to Francois Dugast

Align with kernel commit ("drm/xe/pmu: Drop interrupt pmu event")

---
 include/drm-uapi/xe_drm.h | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
include/drm-uapi/xe_drm.h +6 -7
index c35a12861..bc52971a2 100644
@@ -1112,7 +1112,7 @@ struct drm_xe_wait_user_fence {
  * in 'struct perf_event_attr' as part of perf_event_open syscall to read a
  * particular event.
  *
- * For example to open the DRM_XE_PMU_INTERRUPTS(0):
+ * For example to open the DRM_XE_PMU_RENDER_GROUP_BUSY(0):
  *
  * .. code-block:: C
  *
@@ -1126,7 +1126,7 @@ struct drm_xe_wait_user_fence {
  *	attr.read_format = PERF_FORMAT_TOTAL_TIME_ENABLED;
  *	attr.use_clockid = 1;
  *	attr.clockid = CLOCK_MONOTONIC;
- *	attr.config = DRM_XE_PMU_INTERRUPTS(0);
+ *	attr.config = DRM_XE_PMU_RENDER_GROUP_BUSY(0);
  *
  *	fd = syscall(__NR_perf_event_open, &attr, -1, cpu, -1, 0);
  */
@@ -1139,11 +1139,10 @@ struct drm_xe_wait_user_fence {
 #define ___XE_PMU_OTHER(gt, x) \
 	(((__u64)(x)) | ((__u64)(gt) << __XE_PMU_GT_SHIFT))
 
-#define DRM_XE_PMU_INTERRUPTS(gt)		___XE_PMU_OTHER(gt, 0)
-#define DRM_XE_PMU_RENDER_GROUP_BUSY(gt)	___XE_PMU_OTHER(gt, 1)
-#define DRM_XE_PMU_COPY_GROUP_BUSY(gt)		___XE_PMU_OTHER(gt, 2)
-#define DRM_XE_PMU_MEDIA_GROUP_BUSY(gt)		___XE_PMU_OTHER(gt, 3)
-#define DRM_XE_PMU_ANY_ENGINE_GROUP_BUSY(gt)	___XE_PMU_OTHER(gt, 4)
+#define DRM_XE_PMU_RENDER_GROUP_BUSY(gt)	___XE_PMU_OTHER(gt, 0)
+#define DRM_XE_PMU_COPY_GROUP_BUSY(gt)		___XE_PMU_OTHER(gt, 1)
+#define DRM_XE_PMU_MEDIA_GROUP_BUSY(gt)		___XE_PMU_OTHER(gt, 2)
+#define DRM_XE_PMU_ANY_ENGINE_GROUP_BUSY(gt)	___XE_PMU_OTHER(gt, 3)
 
 #if defined(__cplusplus)
 }
Signature · 1 line
2.34.1
#29 lore raw

PATCH v3 29/57 drm-uapi/xe: Reject bo creation of unaligned size

In reply to Francois Dugast

Align with kernel commit ("drm/xe/uapi: Reject bo creation of unaligned size")

---
 include/drm-uapi/xe_drm.h          | 25 +++++++++++++++++--------
 tests/intel/xe_mmap.c              | 22 ++++++++++++----------
 tests/intel/xe_prime_self_import.c | 26 +++++++++++++++++++++++++-
 tests/intel/xe_vm.c                | 13 ++++++-------
 4 files changed, 60 insertions(+), 26 deletions(-)
include/drm-uapi/xe_drm.h +17 -8
index bc52971a2..a2f66d44e 100644
@@ -219,11 +219,13 @@ struct drm_xe_query_mem_region {
 	 *
 	 * When the kernel allocates memory for this region, the
 	 * underlying pages will be at least @min_page_size in size.
-	 *
-	 * Important note: When userspace allocates a GTT address which
-	 * can point to memory allocated from this region, it must also
-	 * respect this minimum alignment. This is enforced by the
-	 * kernel.
+	 * Buffer objects with an allowable placement in this region must be
+	 * created with a size aligned to this value.
+	 * GPU virtual address mappings of (parts of) buffer objects that
+	 * may be placed in this region must also have their GPU virtual
+	 * address and range aligned to this value.
+	 * Affected IOCTLS will return %-EINVAL if alignment restrictions are
+	 * not met.
 	 */
 	__u32 min_page_size;
 	/**
@@ -372,6 +374,14 @@ struct drm_xe_query_config {
 #define DRM_XE_QUERY_CONFIG_REV_AND_DEVICE_ID		0
 #define DRM_XE_QUERY_CONFIG_FLAGS			1
 	#define DRM_XE_QUERY_CONFIG_FLAGS_HAS_VRAM	(0x1 << 0)
+	/*
+	 * DRM_XE_QUERY_CONFIG_MIN_ALIGNMENT - This returns the
+	 * maximum value of the &min_page_size across all memory regions
+	 * the device implements. User-space code that does not want
+	 * to track @min_page_size per region can use this value for
+	 * a buffer-object size and GPU virtual address and -range
+	 * alignment value that is valid for all regions.
+	 */
 #define DRM_XE_QUERY_CONFIG_MIN_ALIGNMENT		2
 #define DRM_XE_QUERY_CONFIG_VA_BITS			3
 #define DRM_XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY	4
@@ -625,9 +635,8 @@ struct drm_xe_gem_create {
 	__u64 extensions;
 
 	/**
-	 * @size: Requested size for the object
-	 *
-	 * The (page-aligned) allocated size for the object will be returned.
+	 * @size: Size of the object to be created, must match region
+	 * (system or vram) minimum alignment (&min_page_size).
 	 */
 	__u64 size;
 
tests/intel/xe_mmap.c +12 -10
index 965644e22..d6c8d5114 100644
@@ -47,17 +47,18 @@
 static void
 test_mmap(int fd, uint32_t placement, uint32_t flags)
 {
+	size_t bo_size = xe_get_default_alignment(fd);
 	uint32_t bo;
 	void *map;
 
 	igt_require_f(placement, "Device doesn't support such memory region\n");
 
-	bo = xe_bo_create(fd, 0, 4096, placement, flags);
+	bo = xe_bo_create(fd, 0, bo_size, placement, flags);
 
-	map = xe_bo_map(fd, bo, 4096);
+	map = xe_bo_map(fd, bo, bo_size);
 	strcpy(map, "Write some data to the BO!");
 
-	munmap(map, 4096);
+	munmap(map, bo_size);
 
 	gem_close(fd, bo);
 }
@@ -156,13 +157,14 @@ static void trap_sigbus(uint32_t *ptr)
  */
 static void test_small_bar(int fd)
 {
+	size_t page_size = xe_get_default_alignment(fd);
 	uint32_t visible_size = xe_visible_vram_size(fd, 0);
 	uint32_t bo;
 	uint64_t mmo;
 	uint32_t *map;
 
 	/* 2BIG invalid case */
-	igt_assert_neq(__xe_bo_create(fd, 0, visible_size + 4096,
+	igt_assert_neq(__xe_bo_create(fd, 0, visible_size + page_size,
 				      vram_memory(fd, 0),
 				      DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM,
 				      &bo),
@@ -172,12 +174,12 @@ static void test_small_bar(int fd)
 	bo = xe_bo_create(fd, 0, visible_size / 4, vram_memory(fd, 0),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	mmo = xe_bo_mmap_offset(fd, bo);
-	map = mmap(NULL, 4096, PROT_WRITE, MAP_SHARED, fd, mmo);
+	map = mmap(NULL, page_size, PROT_WRITE, MAP_SHARED, fd, mmo);
 	igt_assert(map != MAP_FAILED);
 
 	map[0] = 0xdeadbeaf;
 
-	munmap(map, 4096);
+	munmap(map, page_size);
 	gem_close(fd, bo);
 
 	/* Normal operation with system memory spilling */
@@ -186,18 +188,18 @@ static void test_small_bar(int fd)
 			  system_memory(fd),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	mmo = xe_bo_mmap_offset(fd, bo);
-	map = mmap(NULL, 4096, PROT_WRITE, MAP_SHARED, fd, mmo);
+	map = mmap(NULL, page_size, PROT_WRITE, MAP_SHARED, fd, mmo);
 	igt_assert(map != MAP_FAILED);
 
 	map[0] = 0xdeadbeaf;
 
-	munmap(map, 4096);
+	munmap(map, page_size);
 	gem_close(fd, bo);
 
 	/* Bogus operation with SIGBUS */
-	bo = xe_bo_create(fd, 0, visible_size + 4096, vram_memory(fd, 0), 0);
+	bo = xe_bo_create(fd, 0, visible_size + page_size, vram_memory(fd, 0), 0);
 	mmo = xe_bo_mmap_offset(fd, bo);
-	map = mmap(NULL, 4096, PROT_WRITE, MAP_SHARED, fd, mmo);
+	map = mmap(NULL, page_size, PROT_WRITE, MAP_SHARED, fd, mmo);
 	igt_assert(map != MAP_FAILED);
 
 	trap_sigbus(map);
tests/intel/xe_prime_self_import.c +25 -1
index 9a263d326..504e6a13d 100644
@@ -61,13 +61,19 @@ static int g_time_out = 5;
 static pthread_barrier_t g_barrier;
 static size_t bo_size;
 
+static size_t get_min_bo_size(int fd1, int fd2)
+{
+	return 4 * max(xe_get_default_alignment(fd1),
+		       xe_get_default_alignment(fd2));
+}
+
 static void
 check_bo(int fd1, uint32_t handle1, int fd2, uint32_t handle2)
 {
+	size_t bo_size = get_min_bo_size(fd1, fd2);
 	char *ptr1, *ptr2;
 	int i;
 
-
 	ptr1 = xe_bo_map(fd1, handle1, bo_size);
 	ptr2 = xe_bo_map(fd2, handle2, bo_size);
 
@@ -97,6 +103,7 @@ check_bo(int fd1, uint32_t handle1, int fd2, uint32_t handle2)
 static void test_with_fd_dup(void)
 {
 	int fd1, fd2;
+	size_t bo_size;
 	uint32_t handle, handle_import;
 	int dma_buf_fd1, dma_buf_fd2;
 
@@ -105,6 +112,8 @@ static void test_with_fd_dup(void)
 	fd1 = drm_open_driver(DRIVER_XE);
 	fd2 = drm_open_driver(DRIVER_XE);
 
+	bo_size = get_min_bo_size(fd1, fd2);
+
 	handle = xe_bo_create(fd1, 0, bo_size, vram_if_possible(fd1, 0),
 			      DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 
@@ -131,6 +140,7 @@ static void test_with_fd_dup(void)
 static void test_with_two_bos(void)
 {
 	int fd1, fd2;
+	size_t bo_size;
 	uint32_t handle1, handle2, handle_import;
 	int dma_buf_fd;
 
@@ -139,6 +149,8 @@ static void test_with_two_bos(void)
 	fd1 = drm_open_driver(DRIVER_XE);
 	fd2 = drm_open_driver(DRIVER_XE);
 
+	bo_size = get_min_bo_size(fd1, fd2);
+
 	handle1 = xe_bo_create(fd1, 0, bo_size, vram_if_possible(fd1, 0),
 			       DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	handle2 = xe_bo_create(fd1, 0, bo_size, vram_if_possible(fd1, 0),
@@ -171,12 +183,15 @@ static void test_with_two_bos(void)
 static void test_with_one_bo_two_files(void)
 {
 	int fd1, fd2;
+	size_t bo_size;
 	uint32_t handle_import, handle_open, handle_orig, flink_name;
 	int dma_buf_fd1, dma_buf_fd2;
 
 	fd1 = drm_open_driver(DRIVER_XE);
 	fd2 = drm_open_driver(DRIVER_XE);
 
+	bo_size = get_min_bo_size(fd1, fd2);
+
 	handle_orig = xe_bo_create(fd1, 0, bo_size,
 				   vram_if_possible(fd1, 0),
 				   DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
@@ -205,12 +220,15 @@ static void test_with_one_bo_two_files(void)
 static void test_with_one_bo(void)
 {
 	int fd1, fd2;
+	size_t bo_size;
 	uint32_t handle, handle_import1, handle_import2, handle_selfimport;
 	int dma_buf_fd;
 
 	fd1 = drm_open_driver(DRIVER_XE);
 	fd2 = drm_open_driver(DRIVER_XE);
 
+	bo_size = get_min_bo_size(fd1, fd2);
+
 	handle = xe_bo_create(fd1, 0, bo_size, vram_if_possible(fd1, 0),
 			      DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 
@@ -279,6 +297,7 @@ static void *thread_fn_reimport_vs_close(void *p)
 	pthread_t *threads;
 	int r, i, num_threads;
 	int fds[2];
+	size_t bo_size;
 	int obj_count;
 	void *status;
 	uint32_t handle;
@@ -298,6 +317,8 @@ static void *thread_fn_reimport_vs_close(void *p)
 
 	fds[0] = drm_open_driver(DRIVER_XE);
 
+	bo_size = xe_get_default_alignment(fds[0]);
+
 	handle = xe_bo_create(fds[0], 0, bo_size,
 			      vram_if_possible(fds[0], 0),
 			      DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
@@ -336,6 +357,7 @@ static void *thread_fn_export_vs_close(void *p)
 	struct drm_prime_handle prime_h2f;
 	struct drm_gem_close close_bo;
 	int fd = (uintptr_t)p;
+	size_t bo_size = xe_get_default_alignment(fd);
 	uint32_t handle;
 
 	pthread_barrier_wait(&g_barrier);
@@ -463,6 +485,7 @@ static void test_llseek_size(void)
 static void test_llseek_bad(void)
 {
 	int fd;
+	size_t bo_size;
 	uint32_t handle;
 	int dma_buf_fd;
 
@@ -470,6 +493,7 @@ static void test_llseek_bad(void)
 
 	fd = drm_open_driver(DRIVER_XE);
 
+	bo_size = 4 * xe_get_default_alignment(fd);
 	handle = xe_bo_create(fd, 0, bo_size,
 			      vram_if_possible(fd, 0),
 			      DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
tests/intel/xe_vm.c +6 -7
index 08c38bae1..f53e9edf9 100644
@@ -1307,11 +1307,10 @@ test_munmap_style_unbind(int fd, struct drm_xe_engine_class_instance *eci,
 	if (flags & MAP_FLAG_HAMMER_FIRST_PAGE) {
 		t.fd = fd;
 		t.vm = vm;
-#define PAGE_SIZE	4096
-		t.addr = addr + PAGE_SIZE / 2;
+		t.addr = addr + page_size / 2;
 		t.eci = eci;
 		t.exit = &exit;
-		t.map = map + PAGE_SIZE / 2;
+		t.map = map + page_size / 2;
 		t.barrier = &barrier;
 		pthread_barrier_init(&barrier, NULL, 2);
 		pthread_create(&t.thread, 0, hammer_thread, &t);
@@ -1364,8 +1363,8 @@ test_munmap_style_unbind(int fd, struct drm_xe_engine_class_instance *eci,
 		igt_assert_eq(data->data, 0xc0ffee);
 	}
 	if (flags & MAP_FLAG_HAMMER_FIRST_PAGE) {
-		memset(map, 0, PAGE_SIZE / 2);
-		memset(map + PAGE_SIZE, 0, bo_size - PAGE_SIZE);
+		memset(map, 0, page_size / 2);
+		memset(map + page_size, 0, bo_size - page_size);
 	} else {
 		memset(map, 0, bo_size);
 	}
@@ -1414,8 +1413,8 @@ try_again_after_invalidate:
 		}
 	}
 	if (flags & MAP_FLAG_HAMMER_FIRST_PAGE) {
-		memset(map, 0, PAGE_SIZE / 2);
-		memset(map + PAGE_SIZE, 0, bo_size - PAGE_SIZE);
+		memset(map, 0, page_size / 2);
+		memset(map + page_size, 0, bo_size - page_size);
 	} else {
 		memset(map, 0, bo_size);
 	}
Signature · 1 line
2.34.1
#30 lore raw

PATCH v3 30/57 lib: Fix 'otherwise' typos

In reply to Francois Dugast

From: Rodrigo Vivi <[email protected]>

Found while trying to replace s/hwe/eci.

---
 lib/drmtest.c         | 2 +-
 lib/intel_allocator.c | 2 +-
 lib/xe/xe_spin.c      | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
lib/drmtest.c +1 -1
index e1da66c87..be44d65b9 100644
@@ -407,7 +407,7 @@ static int __open_driver_exact(const char *name, unsigned int chipset)
  *
  * Returns:
  * True if card according to the added filter was found,
- * false othwerwise.
+ * false otherwise.
  */
 static bool __get_card_for_nth_filter(int idx, struct igt_device_card *card)
 {
lib/intel_allocator.c +1 -1
index f0a9b7fb5..3d42388b8 100644
@@ -1406,7 +1406,7 @@ bool intel_allocator_unreserve(uint64_t allocator_handle, uint32_t handle,
  * Note. @size and @offset have to match those used in reservation,
  * i.e. check with the same offset but even smaller size will fail.
  *
- * Returns: true if space is reserved, othwerise false.
+ * Returns: true if space is reserved, otherwise false.
  */
 bool intel_allocator_is_reserved(uint64_t allocator_handle,
 				 uint64_t size, uint64_t offset)
lib/xe/xe_spin.c +1 -1
index 91bc6664d..f7fcb5a48 100644
@@ -150,7 +150,7 @@ void xe_spin_init(struct xe_spin *spin, struct xe_spin_opts *opts)
  * xe_spin_started:
  * @spin: pointer to spinner mapped bo
  *
- * Returns: true if spinner is running, othwerwise false.
+ * Returns: true if spinner is running, otherwise false.
  */
 bool xe_spin_started(struct xe_spin *spin)
 {
Signature · 1 line
2.34.1
#31 lore raw

PATCH v3 31/57 xe: Rename 'hwe' to 'eci'

In reply to Francois Dugast

From: Rodrigo Vivi <[email protected]>

First of all eci aligns better with its struct name. The 'hwe' was there only for legacy reasons.

But also, let's prepare in a way that we can also iterate over the engine_info. So, let's be clear that we are iterating over the engine_instances.

---
 benchmarks/gem_wsim.c              | 108 +++++++++++++-------------
 lib/igt_dummyload.h                |   2 +-
 lib/xe/xe_query.h                  |   4 +-
 lib/xe/xe_spin.c                   |  10 +--
 lib/xe/xe_spin.h                   |   2 +-
 tests/intel/xe_dma_buf_sync.c      |  26 +++----
 tests/intel/xe_evict.c             |  12 +--
 tests/intel/xe_exec_balancer.c     |  36 ++++-----
 tests/intel/xe_exec_basic.c        |  26 +++----
 tests/intel/xe_exec_compute_mode.c |  18 ++---
 tests/intel/xe_exec_fault_mode.c   |  18 ++---
 tests/intel/xe_exec_reset.c        |  70 ++++++++---------
 tests/intel/xe_exec_store.c        |  22 +++---
 tests/intel/xe_exec_threads.c      |  32 ++++----
 tests/intel/xe_guc_pc.c            |  10 +--
 tests/intel/xe_huc_copy.c          |  12 +--
 tests/intel/xe_perf_pmu.c          |  18 ++---
 tests/intel/xe_pm.c                |  30 ++++----
 tests/intel/xe_pm_residency.c      |  24 +++---
 tests/intel/xe_query.c             |  44 +++++------
 tests/intel/xe_spin_batch.c        |  34 ++++----
 tests/intel/xe_vm.c                | 120 ++++++++++++++---------------
 22 files changed, 339 insertions(+), 339 deletions(-)
benchmarks/gem_wsim.c +54 -54
index 5d5353c94..43ae7cb51 100644
@@ -212,8 +212,8 @@ struct xe_vm {
 
 struct xe_exec_queue {
 	uint32_t id;
-	unsigned int nr_hwes;
-	struct drm_xe_engine_class_instance *hwe_list;
+	unsigned int nr_ecis;
+	struct drm_xe_engine_class_instance *eci_list;
 };
 
 struct ctx {
@@ -540,11 +540,11 @@ static struct intel_engine_data *query_engines(void)
 		return &engines;
 
 	if (is_xe) {
-		struct drm_xe_engine_class_instance *hwe;
+		struct drm_xe_engine_class_instance *eci;
 
-		xe_for_each_engine(fd, hwe) {
-			engines.engines[engines.nengines].class = hwe->engine_class;
-			engines.engines[engines.nengines].instance = hwe->engine_instance;
+		xe_for_each_engine_instance(fd, eci) {
+			engines.engines[engines.nengines].class = eci->engine_class;
+			engines.engines[engines.nengines].instance = eci->engine_instance;
 			engines.nengines++;
 		}
 	} else
@@ -645,60 +645,60 @@ get_engine(enum intel_engine_id engine)
 static struct drm_xe_engine_class_instance
 xe_get_engine(enum intel_engine_id engine)
 {
-	struct drm_xe_engine_class_instance hwe = {}, *hwe1;
+	struct drm_xe_engine_class_instance eci = {}, *eci1;
 	bool found_physical = false;
 
 	switch (engine) {
 	case RCS:
-		hwe.engine_class = DRM_XE_ENGINE_CLASS_RENDER;
+		eci.engine_class = DRM_XE_ENGINE_CLASS_RENDER;
 		break;
 	case BCS:
-		hwe.engine_class = DRM_XE_ENGINE_CLASS_COPY;
+		eci.engine_class = DRM_XE_ENGINE_CLASS_COPY;
 		break;
 	case VCS1:
-		hwe.engine_class = DRM_XE_ENGINE_CLASS_VIDEO_DECODE;
+		eci.engine_class = DRM_XE_ENGINE_CLASS_VIDEO_DECODE;
 		break;
 	case VCS2:
-		hwe.engine_class = DRM_XE_ENGINE_CLASS_VIDEO_DECODE;
-		hwe.engine_instance = 1;
+		eci.engine_class = DRM_XE_ENGINE_CLASS_VIDEO_DECODE;
+		eci.engine_instance = 1;
 		break;
 	case VECS:
-		hwe.engine_class = DRM_XE_ENGINE_CLASS_VIDEO_ENHANCE;
+		eci.engine_class = DRM_XE_ENGINE_CLASS_VIDEO_ENHANCE;
 		break;
 	default:
 		igt_assert(0);
 	};
 
-	xe_for_each_engine(fd, hwe1) {
-		if (hwe.engine_class == hwe1->engine_class &&
-		    hwe.engine_instance  == hwe1->engine_instance) {
-			hwe = *hwe1;
+	xe_for_each_engine_instance(fd, eci1) {
+		if (eci.engine_class == eci1->engine_class &&
+		    eci.engine_instance  == eci1->engine_instance) {
+			eci = *eci1;
 			found_physical = true;
 			break;
 		}
 	}
 
 	igt_assert(found_physical);
-	return hwe;
+	return eci;
 }
 
 static struct drm_xe_engine_class_instance
 xe_get_default_engine(void)
 {
-	struct drm_xe_engine_class_instance default_hwe, *hwe;
+	struct drm_xe_engine_class_instance default_eci, *eci;
 
 	/* select RCS0 | CCS0 or first available engine */
-	default_hwe = xe_engine(fd, 0)->instance;
-	xe_for_each_engine(fd, hwe) {
-		if ((hwe->engine_class == DRM_XE_ENGINE_CLASS_RENDER ||
-		     hwe->engine_class == DRM_XE_ENGINE_CLASS_COMPUTE) &&
-		    hwe->engine_instance == 0) {
-			default_hwe = *hwe;
+	default_eci = xe_engine(fd, 0)->instance;
+	xe_for_each_engine_instance(fd, eci) {
+		if ((eci->engine_class == DRM_XE_ENGINE_CLASS_RENDER ||
+		     eci->engine_class == DRM_XE_ENGINE_CLASS_COMPUTE) &&
+		    eci->engine_instance == 0) {
+			default_eci = *eci;
 			break;
 		}
 	}
 
-	return default_hwe;
+	return default_eci;
 }
 
 static int parse_engine_map(struct w_step *step, const char *_str)
@@ -1735,7 +1735,7 @@ xe_alloc_step_batch(struct workload *wrk, struct w_step *w)
 	int i;
 
 	w->bb_handle = xe_bo_create(fd, vm->id, PAGE_SIZE,
-				    vram_if_possible(fd, eq->hwe_list[0].gt_id),
+				    vram_if_possible(fd, eq->eci_list[0].gt_id),
 				    DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	w->xe.data = xe_bo_map(fd, w->bb_handle, PAGE_SIZE);
 	w->xe.exec.address =
@@ -1744,7 +1744,7 @@ xe_alloc_step_batch(struct workload *wrk, struct w_step *w)
 	xe_vm_bind_sync(fd, vm->id, w->bb_handle, 0, w->xe.exec.address, PAGE_SIZE);
 	xe_spin_init_opts(&w->xe.data->spin, .addr = w->xe.exec.address,
 				   .preempt = (w->preempt_us > 0),
-				   .ctx_ticks = duration_to_ctx_ticks(fd, eq->hwe_list[0].gt_id,
+				   .ctx_ticks = duration_to_ctx_ticks(fd, eq->eci_list[0].gt_id,
 								1000LL * get_duration(wrk, w)));
 	w->xe.exec.exec_queue_id = eq->id;
 	w->xe.exec.num_batch_buffer = 1;
@@ -2036,8 +2036,8 @@ static void xe_exec_queue_create_(struct ctx *ctx, struct xe_exec_queue *eq)
 	struct drm_xe_exec_queue_create create = {
 		.vm_id = ctx->xe.vm->id,
 		.width = 1,
-		.num_placements = eq->nr_hwes,
-		.instances = to_user_pointer(eq->hwe_list),
+		.num_placements = eq->nr_ecis,
+		.instances = to_user_pointer(eq->eci_list),
 	};
 
 	igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_EXEC_QUEUE_CREATE, &create), 0);
@@ -2286,25 +2286,25 @@ static int xe_prepare_contexts(unsigned int id, struct workload *wrk)
 			ctx->xe.queue_list = calloc(ctx->xe.nr_queues, sizeof(*ctx->xe.queue_list));
 			igt_assert(ctx->xe.queue_list);
 			eq = &ctx->xe.queue_list[ctx->xe.nr_queues - 1];
-			eq->nr_hwes = ctx->engine_map_count;
-			eq->hwe_list = calloc(eq->nr_hwes, sizeof(*eq->hwe_list));
-			for (i = 0; i < eq->nr_hwes; ++i) {
-				eq->hwe_list[i] = xe_get_engine(ctx->engine_map[i]);
+			eq->nr_ecis = ctx->engine_map_count;
+			eq->eci_list = calloc(eq->nr_ecis, sizeof(*eq->eci_list));
+			for (i = 0; i < eq->nr_ecis; ++i) {
+				eq->eci_list[i] = xe_get_engine(ctx->engine_map[i]);
 
 				/* check no mixing classes and no duplicates */
 				for (int j = 0; j < i; ++j) {
-					if (eq->hwe_list[j].engine_class !=
-					    eq->hwe_list[i].engine_class) {
-						free(eq->hwe_list);
-						eq->nr_hwes = 0;
+					if (eq->eci_list[j].engine_class !=
+					    eq->eci_list[i].engine_class) {
+						free(eq->eci_list);
+						eq->nr_ecis = 0;
 						wsim_err("Mixing of engine class not supported!\n");
 						return 1;
 					}
 
-					if (eq->hwe_list[j].engine_instance ==
-					    eq->hwe_list[i].engine_instance) {
-						free(eq->hwe_list);
-						eq->nr_hwes = 0;
+					if (eq->eci_list[j].engine_instance ==
+					    eq->eci_list[i].engine_instance) {
+						free(eq->eci_list);
+						eq->nr_ecis = 0;
 						wsim_err("Duplicate engine entry!\n");
 						return 1;
 					}
@@ -2313,9 +2313,9 @@ static int xe_prepare_contexts(unsigned int id, struct workload *wrk)
 				if (verbose > 3)
 					printf("%u ctx[%d] %s [%u:%u:%u]\n",
 						id, ctx_idx, ring_str_map[ctx->engine_map[i]],
-						eq->hwe_list[i].engine_class,
-						eq->hwe_list[i].engine_instance,
-						eq->hwe_list[i].gt_id);
+						eq->eci_list[i].engine_class,
+						eq->eci_list[i].engine_instance,
+						eq->eci_list[i].gt_id);
 			}
 
 			xe_exec_queue_create_(ctx, eq);
@@ -2335,22 +2335,22 @@ static int xe_prepare_contexts(unsigned int id, struct workload *wrk)
 			for (i = 0; i < NUM_ENGINES; i++) {
 				if (engine_classes[i]) {
 					eq = &ctx->xe.queue_list[i];
-					eq->nr_hwes = 1;
-					eq->hwe_list = calloc(1, sizeof(*eq->hwe_list));
+					eq->nr_ecis = 1;
+					eq->eci_list = calloc(1, sizeof(*eq->eci_list));
 
 					if (i == DEFAULT)
-						eq->hwe_list[0] = xe_get_default_engine();
+						eq->eci_list[0] = xe_get_default_engine();
 					else if (i == VCS)
-						eq->hwe_list[0] = xe_get_engine(VCS1);
+						eq->eci_list[0] = xe_get_engine(VCS1);
 					else
-						eq->hwe_list[0] = xe_get_engine(i);
+						eq->eci_list[0] = xe_get_engine(i);
 
 					if (verbose > 3)
 						printf("%u ctx[%d] %s [%u:%u:%u]\n",
 							id, ctx_idx, ring_str_map[i],
-							eq->hwe_list[0].engine_class,
-							eq->hwe_list[0].engine_instance,
-							eq->hwe_list[0].gt_id);
+							eq->eci_list[0].engine_class,
+							eq->eci_list[0].engine_instance,
+							eq->eci_list[0].gt_id);
 
 					xe_exec_queue_create_(ctx, eq);
 				}
@@ -2560,7 +2560,7 @@ static void do_xe_exec(struct workload *wrk, struct w_step *w)
 		xe_spin_init_opts(&w->xe.data->spin,
 				  .addr = w->xe.exec.address,
 				  .preempt = (w->preempt_us > 0),
-				  .ctx_ticks = duration_to_ctx_ticks(fd, eq->hwe_list[0].gt_id,
+				  .ctx_ticks = duration_to_ctx_ticks(fd, eq->eci_list[0].gt_id,
 								1000LL * get_duration(wrk, w)));
 	xe_exec(fd, &w->xe.exec);
 }
lib/igt_dummyload.h +1 -1
index b771011af..8b61a4c8d 100644
@@ -55,7 +55,7 @@ typedef struct igt_spin_factory {
 	unsigned int flags;
 	int fence;
 	uint64_t ahnd;
-	struct drm_xe_engine_class_instance *hwe;
+	struct drm_xe_engine_class_instance *eci;
 	uint32_t vm;
 } igt_spin_factory_t;
 
lib/xe/xe_query.h +2 -2
index fede00036..ef90d5b63 100644
@@ -60,9 +60,9 @@ struct xe_device {
 	uint16_t dev_id;
 };
 
-#define xe_for_each_engine(__fd, __hwe) \
+#define xe_for_each_engine_instance(__fd, __eci) \
 	for (int __i = 0; __i < xe_number_engines(__fd) && \
-	     (__hwe = &xe_engine(__fd, __i)->instance); ++__i)
+	     (__eci = &xe_engine(__fd, __i)->instance); ++__i)
 #define xe_for_each_engine_class(__class) \
 	for (__class = 0; __class < DRM_XE_ENGINE_CLASS_COMPUTE + 1; \
 	     ++__class)
lib/xe/xe_spin.c +5 -5
index f7fcb5a48..5fd383e07 100644
@@ -213,8 +213,8 @@ xe_spin_create(int fd, const struct igt_spin_factory *opt)
 		spin->vm = xe_vm_create(fd, 0, 0);
 
 	if (!spin->engine) {
-		if (opt->hwe)
-			spin->engine = xe_exec_queue_create(fd, spin->vm, opt->hwe, 0);
+		if (opt->eci)
+			spin->engine = xe_exec_queue_create(fd, spin->vm, opt->eci, 0);
 		else
 			spin->engine = xe_exec_queue_create_class(fd, spin->vm, DRM_XE_ENGINE_CLASS_COPY);
 	}
@@ -281,7 +281,7 @@ void xe_spin_free(int fd, struct igt_spin *spin)
 	free(spin);
 }
 
-void xe_cork_init(int fd, struct drm_xe_engine_class_instance *hwe,
+void xe_cork_init(int fd, struct drm_xe_engine_class_instance *eci,
 		  struct xe_cork *cork)
 {
 	uint64_t addr = xe_get_default_alignment(fd);
@@ -299,13 +299,13 @@ void xe_cork_init(int fd, struct drm_xe_engine_class_instance *hwe,
 
 	vm = xe_vm_create(fd, 0, 0);
 
-	bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, hwe->gt_id),
+	bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, eci->gt_id),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	spin = xe_bo_map(fd, bo, 0x1000);
 
 	xe_vm_bind_sync(fd, vm, bo, 0, addr, bo_size);
 
-	exec_queue = xe_exec_queue_create(fd, vm, hwe, 0);
+	exec_queue = xe_exec_queue_create(fd, vm, eci, 0);
 	syncobj = syncobj_create(fd, 0);
 
 	xe_spin_init_opts(spin, .addr = addr, .preempt = true);
lib/xe/xe_spin.h +1 -1
index 5c8c45143..b7e327fbd 100644
@@ -62,7 +62,7 @@ struct xe_cork {
 	uint32_t syncobj;
 };
 
-void xe_cork_init(int fd, struct drm_xe_engine_class_instance *hwe,
+void xe_cork_init(int fd, struct drm_xe_engine_class_instance *eci,
 		  struct xe_cork *cork);
 bool xe_cork_started(struct xe_cork *cork);
 void xe_cork_wait_started(struct xe_cork *cork);
tests/intel/xe_dma_buf_sync.c +13 -13
index dfa957243..daa1dc2ca 100644
@@ -87,8 +87,8 @@ static bool sync_file_busy(int sync_file)
  */
 
 static void
-test_export_dma_buf(struct drm_xe_engine_class_instance *hwe0,
-		    struct drm_xe_engine_class_instance *hwe1,
+test_export_dma_buf(struct drm_xe_engine_class_instance *eci0,
+		    struct drm_xe_engine_class_instance *eci1,
 		    int n_bo, int flags)
 {
 	uint64_t addr = 0x1a0000, base_addr = 0x1a0000;
@@ -112,7 +112,7 @@ test_export_dma_buf(struct drm_xe_engine_class_instance *hwe0,
 	for (i = 0; i < N_FD; ++i) {
 		fd[i] = drm_open_driver(DRIVER_XE);
 		vm[i] = xe_vm_create(fd[i], 0, 0);
-		exec_queue[i] = xe_exec_queue_create(fd[i], vm[i], !i ? hwe0 : hwe1, 0);
+		exec_queue[i] = xe_exec_queue_create(fd[i], vm[i], !i ? eci0 : eci1, 0);
 	}
 
 	bo_size = sizeof(*data[0]) * N_FD;
@@ -120,7 +120,7 @@ test_export_dma_buf(struct drm_xe_engine_class_instance *hwe0,
 			xe_get_default_alignment(fd[0]));
 	for (i = 0; i < n_bo; ++i) {
 		bo[i] = xe_bo_create(fd[0], 0, bo_size,
-				     vram_if_possible(fd[0], hwe0->gt_id),
+				     vram_if_possible(fd[0], eci0->gt_id),
 				     DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		dma_buf_fd[i] = prime_handle_to_fd(fd[0], bo[i]);
 		import_bo[i] = prime_fd_to_handle(fd[1], dma_buf_fd[i]);
@@ -223,32 +223,32 @@ test_export_dma_buf(struct drm_xe_engine_class_instance *hwe0,
 
 igt_main
 {
-	struct drm_xe_engine_class_instance *hwe, *hwe0 = NULL, *hwe1;
+	struct drm_xe_engine_class_instance *eci, *eci0 = NULL, *eci1;
 	int fd;
 
 	igt_fixture {
 		fd = drm_open_driver(DRIVER_XE);
 
-		xe_for_each_engine(fd, hwe)
-			if (hwe0 == NULL) {
-				hwe0 = hwe;
+		xe_for_each_engine_instance(fd, eci)
+			if (eci0 == NULL) {
+				eci0 = eci;
 			} else {
-				hwe1 = hwe;
+				eci1 = eci;
 				break;
 			}
 	}
 
 	igt_subtest("export-dma-buf-once")
-		test_export_dma_buf(hwe0, hwe1, 1, 0);
+		test_export_dma_buf(eci0, eci1, 1, 0);
 
 	igt_subtest("export-dma-buf-many")
-		test_export_dma_buf(hwe0, hwe1, 16, 0);
+		test_export_dma_buf(eci0, eci1, 16, 0);
 
 	igt_subtest("export-dma-buf-once-read-sync")
-		test_export_dma_buf(hwe0, hwe1, 1, READ_SYNC);
+		test_export_dma_buf(eci0, eci1, 1, READ_SYNC);
 
 	igt_subtest("export-dma-buf-many-read-sync")
-		test_export_dma_buf(hwe0, hwe1, 16, READ_SYNC);
+		test_export_dma_buf(eci0, eci1, 16, READ_SYNC);
 
 	igt_fixture
 		drm_close_driver(fd);
tests/intel/xe_evict.c +6 -6
index 2e2960b9b..660056f71 100644
@@ -631,7 +631,7 @@ static uint64_t calc_bo_size(uint64_t vram_size, int mul, int div)
  */
 igt_main
 {
-	struct drm_xe_engine_class_instance *hwe;
+	struct drm_xe_engine_class_instance *eci;
 	const struct section {
 		const char *name;
 		int n_exec_queues;
@@ -759,28 +759,28 @@ igt_main
 		vram_size = xe_visible_vram_size(fd, 0);
 		igt_assert(vram_size);
 
-		xe_for_each_engine(fd, hwe)
-			if (hwe->engine_class != DRM_XE_ENGINE_CLASS_COPY)
+		xe_for_each_engine_instance(fd, eci)
+			if (eci->engine_class != DRM_XE_ENGINE_CLASS_COPY)
 				break;
 	}
 
 	for (const struct section *s = sections; s->name; s++) {
 		igt_subtest_f("evict-%s", s->name)
-			test_evict(-1, hwe, s->n_exec_queues, s->n_execs,
+			test_evict(-1, eci, s->n_exec_queues, s->n_execs,
 				   calc_bo_size(vram_size, s->mul, s->div),
 				   s->flags, NULL);
 	}
 
 	for (const struct section_cm *s = sections_cm; s->name; s++) {
 		igt_subtest_f("evict-%s", s->name)
-			test_evict_cm(-1, hwe, s->n_exec_queues, s->n_execs,
+			test_evict_cm(-1, eci, s->n_exec_queues, s->n_execs,
 				      calc_bo_size(vram_size, s->mul, s->div),
 				      s->flags, NULL);
 	}
 
 	for (const struct section_threads *s = sections_threads; s->name; s++) {
 		igt_subtest_f("evict-%s", s->name)
-			threads(-1, hwe, s->n_threads, s->n_exec_queues,
+			threads(-1, eci, s->n_threads, s->n_exec_queues,
 				 s->n_execs,
 				 calc_bo_size(vram_size, s->mul, s->div),
 				 s->flags);
tests/intel/xe_exec_balancer.c +18 -18
index ea06c23cd..f15a40613 100644
@@ -53,15 +53,15 @@ static void test_all_active(int fd, int gt, int class)
 		struct xe_spin spin;
 	} *data;
 	struct xe_spin_opts spin_opts = { .preempt = false };
-	struct drm_xe_engine_class_instance *hwe;
-	struct drm_xe_engine_class_instance eci[MAX_INSTANCE];
+	struct drm_xe_engine_class_instance *eci;
+	struct drm_xe_engine_class_instance eci_list[MAX_INSTANCE];
 	int i, num_placements = 0;
 
-	xe_for_each_engine(fd, hwe) {
-		if (hwe->engine_class != class || hwe->gt_id != gt)
+	xe_for_each_engine_instance(fd, eci) {
+		if (eci->engine_class != class || eci->gt_id != gt)
 			continue;
 
-		eci[num_placements++] = *hwe;
+		eci_list[num_placements++] = *eci;
 	}
 	if (num_placements < 2)
 		return;
@@ -79,7 +79,7 @@ static void test_all_active(int fd, int gt, int class)
 			.vm_id = vm,
 			.width = 1,
 			.num_placements = num_placements,
-			.instances = to_user_pointer(eci),
+			.instances = to_user_pointer(eci_list),
 		};
 
 		igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_EXEC_QUEUE_CREATE,
@@ -193,17 +193,17 @@ test_exec(int fd, int gt, int class, int n_exec_queues, int n_execs,
 		uint64_t pad;
 		uint32_t data;
 	} *data;
-	struct drm_xe_engine_class_instance *hwe;
-	struct drm_xe_engine_class_instance eci[MAX_INSTANCE];
+	struct drm_xe_engine_class_instance *eci;
+	struct drm_xe_engine_class_instance eci_list[MAX_INSTANCE];
 	int i, j, b, num_placements = 0;
 
 	igt_assert(n_exec_queues <= MAX_N_EXEC_QUEUES);
 
-	xe_for_each_engine(fd, hwe) {
-		if (hwe->engine_class != class || hwe->gt_id != gt)
+	xe_for_each_engine_instance(fd, eci) {
+		if (eci->engine_class != class || eci->gt_id != gt)
 			continue;
 
-		eci[num_placements++] = *hwe;
+		eci_list[num_placements++] = *eci;
 	}
 	if (num_placements < 2)
 		return;
@@ -235,7 +235,7 @@ test_exec(int fd, int gt, int class, int n_exec_queues, int n_execs,
 			.vm_id = vm,
 			.width = flags & PARALLEL ? num_placements : 1,
 			.num_placements = flags & PARALLEL ? 1 : num_placements,
-			.instances = to_user_pointer(eci),
+			.instances = to_user_pointer(eci_list),
 		};
 
 		igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_EXEC_QUEUE_CREATE,
@@ -419,18 +419,18 @@ test_cm(int fd, int gt, int class, int n_exec_queues, int n_execs,
 		uint64_t exec_sync;
 		uint32_t data;
 	} *data;
-	struct drm_xe_engine_class_instance *hwe;
-	struct drm_xe_engine_class_instance eci[MAX_INSTANCE];
+	struct drm_xe_engine_class_instance *eci;
+	struct drm_xe_engine_class_instance eci_list[MAX_INSTANCE];
 	int i, j, b, num_placements = 0;
 	int map_fd = -1;
 
 	igt_assert(n_exec_queues <= MAX_N_EXEC_QUEUES);
 
-	xe_for_each_engine(fd, hwe) {
-		if (hwe->engine_class != class || hwe->gt_id != gt)
+	xe_for_each_engine_instance(fd, eci) {
+		if (eci->engine_class != class || eci->gt_id != gt)
 			continue;
 
-		eci[num_placements++] = *hwe;
+		eci_list[num_placements++] = *eci;
 	}
 	if (num_placements < 2)
 		return;
@@ -465,7 +465,7 @@ test_cm(int fd, int gt, int class, int n_exec_queues, int n_execs,
 			.vm_id = vm,
 			.width = flags & PARALLEL ? num_placements : 1,
 			.num_placements = flags & PARALLEL ? 1 : num_placements,
-			.instances = to_user_pointer(eci),
+			.instances = to_user_pointer(eci_list),
 			.extensions = 0,
 		};
 
tests/intel/xe_exec_basic.c +13 -13
index 46b9dc2e0..ae406eb01 100644
@@ -302,7 +302,7 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 
 igt_main
 {
-	struct drm_xe_engine_class_instance *hwe;
+	struct drm_xe_engine_class_instance *eci;
 	const struct section {
 		const char *name;
 		unsigned int flags;
@@ -336,37 +336,37 @@ igt_main
 
 	for (const struct section *s = sections; s->name; s++) {
 		igt_subtest_f("once-%s", s->name)
-			xe_for_each_engine(fd, hwe)
-				test_exec(fd, hwe, 1, 1, 1, s->flags);
+			xe_for_each_engine_instance(fd, eci)
+				test_exec(fd, eci, 1, 1, 1, s->flags);
 
 		igt_subtest_f("twice-%s", s->name)
-			xe_for_each_engine(fd, hwe)
-				test_exec(fd, hwe, 1, 2, 1, s->flags);
+			xe_for_each_engine_instance(fd, eci)
+				test_exec(fd, eci, 1, 2, 1, s->flags);
 
 		igt_subtest_f("many-%s", s->name)
-			xe_for_each_engine(fd, hwe)
-				test_exec(fd, hwe, 1,
+			xe_for_each_engine_instance(fd, eci)
+				test_exec(fd, eci, 1,
 					  s->flags & (REBIND | INVALIDATE) ?
 					  64 : 1024, 1,
 					  s->flags);
 
 		igt_subtest_f("many-execqueues-%s", s->name)
-			xe_for_each_engine(fd, hwe)
-				test_exec(fd, hwe, 16,
+			xe_for_each_engine_instance(fd, eci)
+				test_exec(fd, eci, 16,
 					  s->flags & (REBIND | INVALIDATE) ?
 					  64 : 1024, 1,
 					  s->flags);
 
 		igt_subtest_f("many-execqueues-many-vm-%s", s->name)
-			xe_for_each_engine(fd, hwe)
-				test_exec(fd, hwe, 16,
+			xe_for_each_engine_instance(fd, eci)
+				test_exec(fd, eci, 16,
 					  s->flags & (REBIND | INVALIDATE) ?
 					  64 : 1024, 16,
 					  s->flags);
 
 		igt_subtest_f("no-exec-%s", s->name)
-			xe_for_each_engine(fd, hwe)
-				test_exec(fd, hwe, 1, 0, 1, s->flags);
+			xe_for_each_engine_instance(fd, eci)
+				test_exec(fd, eci, 1, 0, 1, s->flags);
 	}
 
 	igt_fixture
tests/intel/xe_exec_compute_mode.c +9 -9
index a9f69deef..b0b4212be 100644
@@ -291,7 +291,7 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 
 igt_main
 {
-	struct drm_xe_engine_class_instance *hwe;
+	struct drm_xe_engine_class_instance *eci;
 	const struct section {
 		const char *name;
 		unsigned int flags;
@@ -321,16 +321,16 @@ igt_main
 
 	for (const struct section *s = sections; s->name; s++) {
 		igt_subtest_f("once-%s", s->name)
-			xe_for_each_engine(fd, hwe)
-				test_exec(fd, hwe, 1, 1, s->flags);
+			xe_for_each_engine_instance(fd, eci)
+				test_exec(fd, eci, 1, 1, s->flags);
 
 		igt_subtest_f("twice-%s", s->name)
-			xe_for_each_engine(fd, hwe)
-				test_exec(fd, hwe, 1, 2, s->flags);
+			xe_for_each_engine_instance(fd, eci)
+				test_exec(fd, eci, 1, 2, s->flags);
 
 		igt_subtest_f("many-%s", s->name)
-			xe_for_each_engine(fd, hwe)
-				test_exec(fd, hwe, 1,
+			xe_for_each_engine_instance(fd, eci)
+				test_exec(fd, eci, 1,
 					  s->flags & (REBIND | INVALIDATE) ?
 					  64 : 128,
 					  s->flags);
@@ -339,8 +339,8 @@ igt_main
 			continue;
 
 		igt_subtest_f("many-execqueues-%s", s->name)
-			xe_for_each_engine(fd, hwe)
-				test_exec(fd, hwe, 16,
+			xe_for_each_engine_instance(fd, eci)
+				test_exec(fd, eci, 16,
 					  s->flags & (REBIND | INVALIDATE) ?
 					  64 : 128,
 					  s->flags);
tests/intel/xe_exec_fault_mode.c +9 -9
index 4c85fce76..b1c859b10 100644
@@ -321,7 +321,7 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 
 igt_main
 {
-	struct drm_xe_engine_class_instance *hwe;
+	struct drm_xe_engine_class_instance *eci;
 	const struct section {
 		const char *name;
 		unsigned int flags;
@@ -386,23 +386,23 @@ igt_main
 
 	for (const struct section *s = sections; s->name; s++) {
 		igt_subtest_f("once-%s", s->name)
-			xe_for_each_engine(fd, hwe)
-				test_exec(fd, hwe, 1, 1, s->flags);
+			xe_for_each_engine_instance(fd, eci)
+				test_exec(fd, eci, 1, 1, s->flags);
 
 		igt_subtest_f("twice-%s", s->name)
-			xe_for_each_engine(fd, hwe)
-				test_exec(fd, hwe, 1, 2, s->flags);
+			xe_for_each_engine_instance(fd, eci)
+				test_exec(fd, eci, 1, 2, s->flags);
 
 		igt_subtest_f("many-%s", s->name)
-			xe_for_each_engine(fd, hwe)
-				test_exec(fd, hwe, 1,
+			xe_for_each_engine_instance(fd, eci)
+				test_exec(fd, eci, 1,
 					  s->flags & (REBIND | INVALIDATE) ?
 					  64 : 128,
 					  s->flags);
 
 		igt_subtest_f("many-execqueues-%s", s->name)
-			xe_for_each_engine(fd, hwe)
-				test_exec(fd, hwe, 16,
+			xe_for_each_engine_instance(fd, eci)
+				test_exec(fd, eci, 16,
 					  s->flags & (REBIND | INVALIDATE) ?
 					  64 : 128,
 					  s->flags);
tests/intel/xe_exec_reset.c +35 -35

129 lines not on this page · raw message

tests/intel/xe_exec_store.c +11 -11
index 48e843af5..fb2c639c3 100644
@@ -228,8 +228,8 @@ static void store_all(int fd, int gt, int class)
 	size_t bo_size;
 	uint64_t addr = 0x100000;
 	uint32_t bo = 0;
-	struct drm_xe_engine_class_instance eci[MAX_INSTANCE];
-	struct drm_xe_engine_class_instance *hwe;
+	struct drm_xe_engine_class_instance eci_list[MAX_INSTANCE];
+	struct drm_xe_engine_class_instance *eci;
 	int i, num_placements = 0;
 
 	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
@@ -242,10 +242,10 @@ static void store_all(int fd, int gt, int class)
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(fd, bo, bo_size);
 
-	xe_for_each_engine(fd, hwe) {
-		if (hwe->engine_class != class || hwe->gt_id != gt)
+	xe_for_each_engine_instance(fd, eci) {
+		if (eci->engine_class != class || eci->gt_id != gt)
 			continue;
-		eci[num_placements++] = *hwe;
+		eci_list[num_placements++] = *eci;
 	}
 
 	igt_require(num_placements);
@@ -255,7 +255,7 @@ static void store_all(int fd, int gt, int class)
 			.vm_id = vm,
 			.width = 1,
 			.num_placements = num_placements,
-			.instances = to_user_pointer(eci),
+			.instances = to_user_pointer(eci_list),
 		};
 
 		igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_EXEC_QUEUE_CREATE,
@@ -296,7 +296,7 @@ static void store_all(int fd, int gt, int class)
 
 igt_main
 {
-	struct drm_xe_engine_class_instance *hwe;
+	struct drm_xe_engine_class_instance *eci;
 	int fd, class, gt;
 
 	igt_fixture {
@@ -314,12 +314,12 @@ igt_main
 	}
 
 	igt_subtest("cachelines")
-		xe_for_each_engine(fd, hwe)
-			store_cachelines(fd, hwe, 0);
+		xe_for_each_engine_instance(fd, eci)
+			store_cachelines(fd, eci, 0);
 
 	igt_subtest("page-sized")
-		xe_for_each_engine(fd, hwe)
-			store_cachelines(fd, hwe, PAGES);
+		xe_for_each_engine_instance(fd, eci)
+			store_cachelines(fd, eci, PAGES);
 
 	igt_fixture {
 		xe_device_put(fd);
tests/intel/xe_exec_threads.c +16 -16
index 8a01b150d..803413ae7 100644
@@ -64,8 +64,8 @@ test_balancer(int fd, int gt, uint32_t vm, uint64_t addr, uint64_t userptr,
 		uint64_t pad;
 		uint32_t data;
 	} *data;
-	struct drm_xe_engine_class_instance *hwe;
-	struct drm_xe_engine_class_instance eci[MAX_INSTANCE];
+	struct drm_xe_engine_class_instance *eci;
+	struct drm_xe_engine_class_instance eci_list[MAX_INSTANCE];
 	int i, j, b, num_placements = 0;
 	bool owns_vm = false, owns_fd = false;
 
@@ -81,11 +81,11 @@ test_balancer(int fd, int gt, uint32_t vm, uint64_t addr, uint64_t userptr,
 		owns_vm = true;
 	}
 
-	xe_for_each_engine(fd, hwe) {
-		if (hwe->engine_class != class || hwe->gt_id != gt)
+	xe_for_each_engine_instance(fd, eci) {
+		if (eci->engine_class != class || eci->gt_id != gt)
 			continue;
 
-		eci[num_placements++] = *hwe;
+		eci_list[num_placements++] = *eci;
 	}
 	igt_assert(num_placements > 1);
 
@@ -119,7 +119,7 @@ test_balancer(int fd, int gt, uint32_t vm, uint64_t addr, uint64_t userptr,
 			.vm_id = vm,
 			.width = flags & PARALLEL ? num_placements : 1,
 			.num_placements = flags & PARALLEL ? 1 : num_placements,
-			.instances = to_user_pointer(eci),
+			.instances = to_user_pointer(eci_list),
 		};
 
 		igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_EXEC_QUEUE_CREATE,
@@ -964,7 +964,7 @@ static void *thread(void *data)
 static void threads(int fd, int flags)
 {
 	struct thread_data *threads_data;
-	struct drm_xe_engine_class_instance *hwe;
+	struct drm_xe_engine_class_instance *eci;
 	uint64_t addr = 0x1a0000;
 	uint64_t userptr = 0x00007000eadbe000;
 	pthread_mutex_t mutex;
@@ -976,7 +976,7 @@ static void threads(int fd, int flags)
 	int n_threads = 0;
 	int gt;
 
-	xe_for_each_engine(fd, hwe)
+	xe_for_each_engine_instance(fd, eci)
 		++n_engines;
 
 	if (flags & BALANCER) {
@@ -984,9 +984,9 @@ static void threads(int fd, int flags)
 			xe_for_each_engine_class(class) {
 				int num_placements = 0;
 
-				xe_for_each_engine(fd, hwe) {
-					if (hwe->engine_class != class ||
-					    hwe->gt_id != gt)
+				xe_for_each_engine_instance(fd, eci) {
+					if (eci->engine_class != class ||
+					    eci->gt_id != gt)
 						continue;
 					++num_placements;
 				}
@@ -1012,7 +1012,7 @@ static void threads(int fd, int flags)
 					       0);
 	}
 
-	xe_for_each_engine(fd, hwe) {
+	xe_for_each_engine_instance(fd, eci) {
 		threads_data[i].mutex = &mutex;
 		threads_data[i].cond = &cond;
 #define ADDRESS_SHIFT	39
@@ -1024,7 +1024,7 @@ static void threads(int fd, int flags)
 			threads_data[i].fd = fd;
 		threads_data[i].vm_legacy_mode = vm_legacy_mode;
 		threads_data[i].vm_compute_mode = vm_compute_mode;
-		threads_data[i].eci = hwe;
+		threads_data[i].eci = eci;
 #define N_EXEC_QUEUE	16
 		threads_data[i].n_exec_queue = N_EXEC_QUEUE;
 #define N_EXEC		1024
@@ -1048,9 +1048,9 @@ static void threads(int fd, int flags)
 			xe_for_each_engine_class(class) {
 				int num_placements = 0;
 
-				xe_for_each_engine(fd, hwe) {
-					if (hwe->engine_class != class ||
-					    hwe->gt_id != gt)
+				xe_for_each_engine_instance(fd, eci) {
+					if (eci->engine_class != class ||
+					    eci->gt_id != gt)
 						continue;
 					++num_placements;
 				}
tests/intel/xe_guc_pc.c +5 -5
index dd768ecdc..062968050 100644
@@ -385,7 +385,7 @@ static void test_reset(int fd, int gt_id, int cycles)
 
 igt_main
 {
-	struct drm_xe_engine_class_instance *hwe;
+	struct drm_xe_engine_class_instance *eci;
 	int fd;
 	int gt;
 	int ncpus = sysconf(_SC_NPROCESSORS_ONLN);
@@ -415,10 +415,10 @@ igt_main
 
 	igt_subtest("freq_fixed_exec") {
 		xe_for_each_gt(fd, gt) {
-			xe_for_each_engine(fd, hwe)
+			xe_for_each_engine_instance(fd, eci)
 				igt_fork(child, ncpus) {
 					igt_debug("Execution Started\n");
-					exec_basic(fd, hwe, MAX_N_EXEC_QUEUES, 16);
+					exec_basic(fd, eci, MAX_N_EXEC_QUEUES, 16);
 					igt_debug("Execution Finished\n");
 				}
 			/* While exec in threads above, let's check the freq */
@@ -437,10 +437,10 @@ igt_main
 
 	igt_subtest("freq_range_exec") {
 		xe_for_each_gt(fd, gt) {
-			xe_for_each_engine(fd, hwe)
+			xe_for_each_engine_instance(fd, eci)
 				igt_fork(child, ncpus) {
 					igt_debug("Execution Started\n");
-					exec_basic(fd, hwe, MAX_N_EXEC_QUEUES, 16);
+					exec_basic(fd, eci, MAX_N_EXEC_QUEUES, 16);
 					igt_debug("Execution Finished\n");
 				}
 			/* While exec in threads above, let's check the freq */
tests/intel/xe_huc_copy.c +6 -6
index dbc5afc17..5eaf4778a 100644
@@ -152,17 +152,17 @@ __test_huc_copy(int fd, uint32_t vm, struct drm_xe_engine_class_instance *hwe)
 static void
 test_huc_copy(int fd)
 {
-	struct drm_xe_engine_class_instance *hwe;
+	struct drm_xe_engine_class_instance *eci;
 	uint32_t vm;
 	uint32_t tested_gts = 0;
 
 	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
 
-	xe_for_each_engine(fd, hwe) {
-		if (hwe->engine_class == DRM_XE_ENGINE_CLASS_VIDEO_DECODE &&
-		    !(tested_gts & BIT(hwe->gt_id))) {
-			tested_gts |= BIT(hwe->gt_id);
-			__test_huc_copy(fd, vm, hwe);
+	xe_for_each_engine_instance(fd, eci) {
+		if (eci->engine_class == DRM_XE_ENGINE_CLASS_VIDEO_DECODE &&
+		    !(tested_gts & BIT(eci->gt_id))) {
+			tested_gts |= BIT(eci->gt_id);
+			__test_huc_copy(fd, vm, eci);
 		}
 	}
 
tests/intel/xe_perf_pmu.c +9 -9
index 63a8eb9b2..9b7c5d9d3 100644
@@ -202,18 +202,18 @@ static void test_engine_group_busyness(int fd, int gt, int class, const char *na
 		struct xe_spin spin;
 	} *data;
 	struct xe_spin_opts spin_opts = { .addr = addr, .preempt = false };
-	struct drm_xe_engine_class_instance *hwe;
-	struct drm_xe_engine_class_instance eci[MAX_INSTANCE];
+	struct drm_xe_engine_class_instance *eci;
+	struct drm_xe_engine_class_instance eci_list[MAX_INSTANCE];
 	int num_placements = 0;
 	uint64_t config, count, idle;
 
 	config = engine_group_get_config(gt, class);
 
-	xe_for_each_engine(fd, hwe) {
-		if (hwe->engine_class != class || hwe->gt_id != gt)
+	xe_for_each_engine_instance(fd, eci) {
+		if (eci->engine_class != class || eci->gt_id != gt)
 			continue;
 
-		eci[num_placements++] = *hwe;
+		eci_list[num_placements++] = *eci;
 	}
 
 	igt_skip_on_f(!num_placements, "Engine class:%d gt:%d not enabled on this platform\n",
@@ -231,7 +231,7 @@ static void test_engine_group_busyness(int fd, int gt, int class, const char *na
 			.vm_id = vm,
 			.width = 1,
 			.num_placements = num_placements,
-			.instances = to_user_pointer(eci),
+			.instances = to_user_pointer(eci_list),
 		};
 
 		igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_EXEC_QUEUE_CREATE,
@@ -291,7 +291,7 @@ static void test_engine_group_busyness(int fd, int gt, int class, const char *na
 
 igt_main
 {
-	struct drm_xe_engine_class_instance *hwe;
+	struct drm_xe_engine_class_instance *eci;
 	const struct section {
 		const char *name;
 		int class;
@@ -321,8 +321,8 @@ igt_main
 	}
 
 	igt_subtest("any-engine-group-busy")
-		xe_for_each_engine(fd, hwe)
-			test_any_engine_busyness(fd, hwe);
+		xe_for_each_engine_instance(fd, eci)
+			test_any_engine_busyness(fd, eci);
 
 	igt_fixture {
 		xe_device_put(fd);
tests/intel/xe_pm.c +15 -15
index d78ca31a8..690663a79 100644
@@ -440,7 +440,7 @@ static void test_vram_d3cold_threshold(device_t device, int sysfs_fd)
 
 igt_main
 {
-	struct drm_xe_engine_class_instance *hwe;
+	struct drm_xe_engine_class_instance *eci;
 	device_t device;
 	uint32_t d3cold_allowed;
 	int sysfs_fd;
@@ -471,8 +471,8 @@ igt_main
 		igt_device_get_pci_slot_name(device.fd_xe, device.pci_slot_name);
 
 		/* Always perform initial once-basic exec checking for health */
-		xe_for_each_engine(device.fd_xe, hwe)
-			test_exec(device, hwe, 1, 1, NO_SUSPEND, NO_RPM);
+		xe_for_each_engine_instance(device.fd_xe, eci)
+			test_exec(device, eci, 1, 1, NO_SUSPEND, NO_RPM);
 
 		igt_pm_get_d3cold_allowed(device.pci_slot_name, &d3cold_allowed);
 		igt_assert(igt_setup_runtime_pm(device.fd_xe));
@@ -486,30 +486,30 @@ igt_main
 		}
 
 		igt_subtest_f("%s-basic-exec", s->name) {
-			xe_for_each_engine(device.fd_xe, hwe)
-				test_exec(device, hwe, 1, 2, s->state,
+			xe_for_each_engine_instance(device.fd_xe, eci)
+				test_exec(device, eci, 1, 2, s->state,
 					  NO_RPM);
 		}
 
 		igt_subtest_f("%s-exec-after", s->name) {
 			igt_system_suspend_autoresume(s->state,
 						      SUSPEND_TEST_NONE);
-			xe_for_each_engine(device.fd_xe, hwe)
-				test_exec(device, hwe, 1, 2, NO_SUSPEND,
+			xe_for_each_engine_instance(device.fd_xe, eci)
+				test_exec(device, eci, 1, 2, NO_SUSPEND,
 					  NO_RPM);
 		}
 
 		igt_subtest_f("%s-multiple-execs", s->name) {
-			xe_for_each_engine(device.fd_xe, hwe)
-				test_exec(device, hwe, 16, 32, s->state,
+			xe_for_each_engine_instance(device.fd_xe, eci)
+				test_exec(device, eci, 16, 32, s->state,
 					  NO_RPM);
 		}
 
 		for (const struct d_state *d = d_states; d->name; d++) {
 			igt_subtest_f("%s-%s-basic-exec", s->name, d->name) {
 				igt_assert(setup_d3(device, d->state));
-				xe_for_each_engine(device.fd_xe, hwe)
-					test_exec(device, hwe, 1, 2, s->state,
+				xe_for_each_engine_instance(device.fd_xe, eci)
+					test_exec(device, eci, 1, 2, s->state,
 						  NO_RPM);
 			}
 		}
@@ -523,15 +523,15 @@ igt_main
 
 		igt_subtest_f("%s-basic-exec", d->name) {
 			igt_assert(setup_d3(device, d->state));
-			xe_for_each_engine(device.fd_xe, hwe)
-				test_exec(device, hwe, 1, 1,
+			xe_for_each_engine_instance(device.fd_xe, eci)
+				test_exec(device, eci, 1, 1,
 					  NO_SUSPEND, d->state);
 		}
 
 		igt_subtest_f("%s-multiple-execs", d->name) {
 			igt_assert(setup_d3(device, d->state));
-			xe_for_each_engine(device.fd_xe, hwe)
-				test_exec(device, hwe, 16, 32,
+			xe_for_each_engine_instance(device.fd_xe, eci)
+				test_exec(device, eci, 16, 32,
 					  NO_SUSPEND, d->state);
 		}
 	}
tests/intel/xe_pm_residency.c +12 -12
index 4f590c83c..373170d5b 100644
@@ -72,7 +72,7 @@ static void close_fw_handle(int sig)
 		close(fw_handle);
 }
 
-static void exec_load(int fd, struct drm_xe_engine_class_instance *hwe, unsigned long *done)
+static void exec_load(int fd, struct drm_xe_engine_class_instance *eci, unsigned long *done)
 {
 	uint32_t bo = 0;
 	uint32_t exec_queue, syncobj, vm;
@@ -97,11 +97,11 @@ static void exec_load(int fd, struct drm_xe_engine_class_instance *hwe, unsigned
 	};
 
 	vm = xe_vm_create(fd, 0, 0);
-	exec_queue = xe_exec_queue_create(fd, vm, hwe, 0);
+	exec_queue = xe_exec_queue_create(fd, vm, eci, 0);
 	bo_size = xe_get_default_alignment(fd);
 
 	bo = xe_bo_create(fd, vm, bo_size,
-			  vram_if_possible(fd, hwe->gt_id),
+			  vram_if_possible(fd, eci->gt_id),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(fd, bo, bo_size);
 	syncobj = syncobj_create(fd, 0);
@@ -225,7 +225,7 @@ static void test_idle_residency(int fd, int gt, enum test_type flag)
 	assert_within_epsilon(residency_end - residency_start, elapsed_ms, tolerance);
 }
 
-static void idle_residency_on_exec(int fd, struct drm_xe_engine_class_instance *hwe)
+static void idle_residency_on_exec(int fd, struct drm_xe_engine_class_instance *eci)
 {
 	const int tol = 20;
 	unsigned long *done;
@@ -233,18 +233,18 @@ static void idle_residency_on_exec(int fd, struct drm_xe_engine_class_instance *
 	unsigned long elapsed_ms, residency_end, residency_start;
 
 	igt_debug("Running on %s:%d\n",
-		  xe_engine_class_string(hwe->engine_class), hwe->engine_instance);
+		  xe_engine_class_string(eci->engine_class), eci->engine_instance);
 	done = mmap(0, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
 	igt_assert(done != MAP_FAILED);
 	memset(done, 0, 4096);
 
 	igt_fork(child, 1)
-		exec_load(fd, hwe, done);
+		exec_load(fd, eci, done);
 
 	start = READ_ONCE(done[1]);
-	residency_start = read_idle_residency(fd, hwe->gt_id);
+	residency_start = read_idle_residency(fd, eci->gt_id);
 	elapsed_ms = measured_usleep(SLEEP_DURATION * USEC_PER_SEC) / 1000;
-	residency_end = read_idle_residency(fd, hwe->gt_id);
+	residency_end = read_idle_residency(fd, eci->gt_id);
 	end = READ_ONCE(done[1]);
 	*done = 1;
 
@@ -312,7 +312,7 @@ igt_main
 	uint32_t d3cold_allowed;
 	int fd, gt;
 	char pci_slot_name[NAME_MAX];
-	struct drm_xe_engine_class_instance *hwe;
+	struct drm_xe_engine_class_instance *eci;
 
 	igt_fixture {
 		fd = drm_open_driver(DRIVER_XE);
@@ -346,9 +346,9 @@ igt_main
 	igt_describe("Validate idle residency on exec");
 	igt_subtest("idle-residency-on-exec") {
 		xe_for_each_gt(fd, gt) {
-			xe_for_each_engine(fd, hwe) {
-				if (gt == hwe->gt_id && !hwe->engine_instance)
-					idle_residency_on_exec(fd, hwe);
+			xe_for_each_engine_instance(fd, eci) {
+				if (gt == eci->gt_id && !eci->engine_instance)
+					idle_residency_on_exec(fd, eci);
 			}
 		}
 	}
tests/intel/xe_query.c +22 -22

112 lines not on this page · raw message

tests/intel/xe_spin_batch.c +17 -17
index 2e2a0ed0e..9139d3286 100644
@@ -35,10 +35,10 @@ static void spin_basic(int fd)
 
 /**
  * SUBTEST: spin-batch
- * Description: Create vm and engine of hwe class and run the spinner on it.
+ * Description: Create vm and engine of eci class and run the spinner on it.
  */
 
-static void spin(int fd, struct drm_xe_engine_class_instance *hwe)
+static void spin(int fd, struct drm_xe_engine_class_instance *eci)
 {
 	uint64_t ahnd;
 	unsigned int exec_queue;
@@ -46,7 +46,7 @@ static void spin(int fd, struct drm_xe_engine_class_instance *hwe)
 	igt_spin_t *spin;
 
 	vm = xe_vm_create(fd, 0, 0);
-	exec_queue = xe_exec_queue_create(fd, vm, hwe, 0);
+	exec_queue = xe_exec_queue_create(fd, vm, eci, 0);
 	ahnd = intel_allocator_open(fd, 0, INTEL_ALLOCATOR_RELOC);
 
 	spin = igt_spin_new(fd, .ahnd = ahnd, .engine = exec_queue, .vm = vm);
@@ -60,11 +60,11 @@ static void spin(int fd, struct drm_xe_engine_class_instance *hwe)
 
 /**
  * SUBTEST: spin-basic-all
- * Description: Basic test which validates the functionality of spinner on all hwe.
+ * Description: Basic test which validates the functionality of spinner on all eci.
  */
 static void spin_basic_all(int fd)
 {
-	struct drm_xe_engine_class_instance *hwe;
+	struct drm_xe_engine_class_instance *eci;
 	uint64_t ahnd;
 	uint32_t vm;
 	igt_spin_t **spin;
@@ -73,10 +73,10 @@ static void spin_basic_all(int fd)
 	vm = xe_vm_create(fd, 0, 0);
 	ahnd = intel_allocator_open(fd, vm, INTEL_ALLOCATOR_RELOC);
 	spin = malloc(sizeof(*spin) * xe_number_engines(fd));
-	xe_for_each_engine(fd, hwe) {
+	xe_for_each_engine_instance(fd, eci) {
 		igt_debug("Run on engine: %s:%d\n",
-			  xe_engine_class_string(hwe->engine_class), hwe->engine_instance);
-		spin[i] = igt_spin_new(fd, .ahnd = ahnd, .vm = vm, .hwe = hwe);
+			  xe_engine_class_string(eci->engine_class), eci->engine_instance);
+		spin[i] = igt_spin_new(fd, .ahnd = ahnd, .vm = vm, .eci = eci);
 		i++;
 	}
 
@@ -98,16 +98,16 @@ static void spin_all(int fd, int gt, int class)
 	uint64_t ahnd;
 	uint32_t exec_queues[MAX_INSTANCE], vm;
 	int i, num_placements = 0;
-	struct drm_xe_engine_class_instance eci[MAX_INSTANCE];
+	struct drm_xe_engine_class_instance eci_list[MAX_INSTANCE];
 	igt_spin_t *spin[MAX_INSTANCE];
-	struct drm_xe_engine_class_instance *hwe;
+	struct drm_xe_engine_class_instance *eci;
 
 	ahnd = intel_allocator_open(fd, 0, INTEL_ALLOCATOR_RELOC);
 
-	xe_for_each_engine(fd, hwe) {
-		if (hwe->engine_class != class || hwe->gt_id != gt)
+	xe_for_each_engine_instance(fd, eci) {
+		if (eci->engine_class != class || eci->gt_id != gt)
 			continue;
-		eci[num_placements++] = *hwe;
+		eci_list[num_placements++] = *eci;
 	}
 	if (num_placements < 2)
 		return;
@@ -118,7 +118,7 @@ static void spin_all(int fd, int gt, int class)
 			.vm_id = vm,
 			.width = 1,
 			.num_placements = num_placements,
-			.instances = to_user_pointer(eci),
+			.instances = to_user_pointer(eci_list),
 		};
 
 		igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_EXEC_QUEUE_CREATE,
@@ -206,7 +206,7 @@ static void xe_spin_fixed_duration(int fd)
 
 igt_main
 {
-	struct drm_xe_engine_class_instance *hwe;
+	struct drm_xe_engine_class_instance *eci;
 	int fd;
 	int gt, class;
 
@@ -217,8 +217,8 @@ igt_main
 		spin_basic(fd);
 
 	igt_subtest("spin-batch")
-		xe_for_each_engine(fd, hwe)
-			spin(fd, hwe);
+		xe_for_each_engine_instance(fd, eci)
+			spin(fd, eci);
 
 	igt_subtest("spin-basic-all")
 		spin_basic_all(fd);
tests/intel/xe_vm.c +60 -60

261 lines not on this page · raw message

Signature · 1 line
2.34.1
#32 lore raw

PATCH v3 32/57 drm-uapi/xe: Split xe_sync types from flags

In reply to Francois Dugast

From: Rodrigo Vivi <[email protected]>

Align with commit ("drm/xe/uapi: Split xe_sync types from flags")

---
 benchmarks/gem_wsim.c              |   9 +-
 include/drm-uapi/xe_drm.h          | 527 ++++++++++++++++++-----------
 lib/intel_batchbuffer.c            |  11 +-
 lib/intel_compute.c                |   6 +-
 lib/intel_ctx.c                    |   5 +-
 lib/xe/xe_ioctl.c                  |   3 +-
 lib/xe/xe_spin.c                   |   6 +-
 lib/xe/xe_util.c                   |   6 +-
 tests/intel/xe_dma_buf_sync.c      |   5 +-
 tests/intel/xe_drm_fdinfo.c        |   6 +-
 tests/intel/xe_evict.c             |   9 +-
 tests/intel/xe_exec_balancer.c     |  15 +-
 tests/intel/xe_exec_basic.c        |   6 +-
 tests/intel/xe_exec_compute_mode.c |   3 +-
 tests/intel/xe_exec_fault_mode.c   |   3 +-
 tests/intel/xe_exec_reset.c        |  21 +-
 tests/intel/xe_exec_store.c        |  15 +-
 tests/intel/xe_exec_threads.c      |  19 +-
 tests/intel/xe_guc_pc.c            |   6 +-
 tests/intel/xe_huc_copy.c          |   3 +-
 tests/intel/xe_perf_pmu.c          |   8 +-
 tests/intel/xe_pm.c                |   6 +-
 tests/intel/xe_pm_residency.c      |   3 +-
 tests/intel/xe_spin_batch.c        |   3 +-
 tests/intel/xe_vm.c                |  49 ++-
 tests/intel/xe_waitfence.c         |   4 +-
 26 files changed, 473 insertions(+), 284 deletions(-)
benchmarks/gem_wsim.c +5 -4
index 43ae7cb51..d02f72087 100644
@@ -1773,21 +1773,22 @@ xe_alloc_step_batch(struct workload *wrk, struct w_step *w)
 	i = 0;
 	/* out fence */
 	w->xe.syncs[i].handle = syncobj_create(fd, 0);
-	w->xe.syncs[i++].flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL;
+	w->xe.syncs[i++].type = DRM_XE_SYNC_TYPE_SYNCOBJ;
+	w->xe.syncs[i++].flags = DRM_XE_SYNC_FLAG_SIGNAL;
 	/* in fence(s) */
 	for_each_dep(dep, w->data_deps) {
 		int dep_idx = w->idx + dep->target;
 
 		igt_assert(wrk->steps[dep_idx].xe.syncs && wrk->steps[dep_idx].xe.syncs[0].handle);
 		w->xe.syncs[i].handle = wrk->steps[dep_idx].xe.syncs[0].handle;
-		w->xe.syncs[i++].flags = DRM_XE_SYNC_FLAG_SYNCOBJ;
+		w->xe.syncs[i++].type = DRM_XE_SYNC_TYPE_SYNCOBJ;
 	}
 	for_each_dep(dep, w->fence_deps) {
 		int dep_idx = w->idx + dep->target;
 
 		igt_assert(wrk->steps[dep_idx].xe.syncs && wrk->steps[dep_idx].xe.syncs[0].handle);
 		w->xe.syncs[i].handle = wrk->steps[dep_idx].xe.syncs[0].handle;
-		w->xe.syncs[i++].flags = DRM_XE_SYNC_FLAG_SYNCOBJ;
+		w->xe.syncs[i++].type = DRM_XE_SYNC_TYPE_SYNCOBJ;
 	}
 	w->xe.exec.syncs = to_user_pointer(w->xe.syncs);
 }
@@ -2364,7 +2365,7 @@ static int xe_prepare_contexts(unsigned int id, struct workload *wrk)
 		if (w->type == SW_FENCE) {
 			w->xe.syncs = calloc(1, sizeof(struct drm_xe_sync));
 			w->xe.syncs[0].handle = syncobj_create(fd, 0);
-			w->xe.syncs[0].flags = DRM_XE_SYNC_FLAG_SYNCOBJ;
+			w->xe.syncs[0].type = DRM_XE_SYNC_TYPE_SYNCOBJ;
 		}
 
 	return 0;
include/drm-uapi/xe_drm.h +324 -203

685 lines not on this page · raw message

lib/intel_batchbuffer.c +7 -4
index 3f3755180..947726caf 100644
@@ -1316,8 +1316,9 @@ static struct drm_xe_vm_bind_op *xe_alloc_bind_ops(struct intel_bb *ibb,
 static void __unbind_xe_objects(struct intel_bb *ibb)
 {
 	struct drm_xe_sync syncs[2] = {
-		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ },
-		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
+		{ .type = DRM_XE_SYNC_TYPE_SYNCOBJ },
+		{ .type = DRM_XE_SYNC_TYPE_SYNCOBJ,
+		  .flags = DRM_XE_SYNC_FLAG_SIGNAL },
 	};
 	int ret;
 
@@ -2304,8 +2305,10 @@ __xe_bb_exec(struct intel_bb *ibb, uint64_t flags, bool sync)
 	uint32_t engine = flags & (I915_EXEC_BSD_MASK | I915_EXEC_RING_MASK);
 	uint32_t engine_id;
 	struct drm_xe_sync syncs[2] = {
-		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
-		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
+		{ .type = DRM_XE_SYNC_TYPE_SYNCOBJ,
+		  .flags = DRM_XE_SYNC_FLAG_SIGNAL },
+		{ .type = DRM_XE_SYNC_TYPE_SYNCOBJ,
+		  .flags = DRM_XE_SYNC_FLAG_SIGNAL },
 	};
 	struct drm_xe_vm_bind_op *bind_ops;
 	void *map;
lib/intel_compute.c +4 -2
index 7cb0f001c..ad7e8ca4f 100644
@@ -106,7 +106,8 @@ static void bo_execenv_bind(struct bo_execenv *execenv,
 		uint64_t alignment = xe_get_default_alignment(fd);
 		struct drm_xe_sync sync = { 0 };
 
-		sync.flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL;
+		sync.type = DRM_XE_SYNC_TYPE_SYNCOBJ;
+		sync.flags = DRM_XE_SYNC_FLAG_SIGNAL;
 		sync.handle = syncobj_create(fd, 0);
 
 		for (int i = 0; i < entries; i++) {
@@ -162,7 +163,8 @@ static void bo_execenv_unbind(struct bo_execenv *execenv,
 		uint32_t vm = execenv->vm;
 		struct drm_xe_sync sync = { 0 };
 
-		sync.flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL;
+		sync.type = DRM_XE_SYNC_TYPE_SYNCOBJ;
+		sync.flags = DRM_XE_SYNC_FLAG_SIGNAL;
 		sync.handle = syncobj_create(fd, 0);
 
 		for (int i = 0; i < entries; i++) {
lib/intel_ctx.c +3 -2
index f82564572..c249532e5 100644
@@ -423,8 +423,9 @@ intel_ctx_t *intel_ctx_xe(int fd, uint32_t vm, uint32_t exec_queue,
 int __intel_ctx_xe_exec(const intel_ctx_t *ctx, uint64_t ahnd, uint64_t bb_offset)
 {
 	struct drm_xe_sync syncs[2] = {
-		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ, },
-		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
+		{ .type = DRM_XE_SYNC_TYPE_SYNCOBJ },
+		{ .type = DRM_XE_SYNC_TYPE_SYNCOBJ,
+		  .flags = DRM_XE_SYNC_FLAG_SIGNAL },
 	};
 	struct drm_xe_exec exec = {
 		.exec_queue_id = ctx->exec_queue,
lib/xe/xe_ioctl.c +2 -1
index 30f35657d..e928148ee 100644
@@ -405,7 +405,8 @@ void xe_exec_sync(int fd, uint32_t exec_queue, uint64_t addr,
 void xe_exec_wait(int fd, uint32_t exec_queue, uint64_t addr)
 {
 	struct drm_xe_sync sync = {
-		.flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL,
+		.type = DRM_XE_SYNC_TYPE_SYNCOBJ,
+		.flags = DRM_XE_SYNC_FLAG_SIGNAL,
 		.handle = syncobj_create(fd, 0),
 	};
 
lib/xe/xe_spin.c +4 -2
index 5fd383e07..3641811d1 100644
@@ -191,7 +191,8 @@ xe_spin_create(int fd, const struct igt_spin_factory *opt)
 	struct igt_spin *spin;
 	struct xe_spin *xe_spin;
 	struct drm_xe_sync sync = {
-		.flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL,
+		.type = DRM_XE_SYNC_TYPE_SYNCOBJ,
+		.flags = DRM_XE_SYNC_FLAG_SIGNAL,
 	};
 	struct drm_xe_exec exec = {
 		.num_batch_buffer = 1,
@@ -289,7 +290,8 @@ void xe_cork_init(int fd, struct drm_xe_engine_class_instance *eci,
 	uint32_t vm, bo, exec_queue, syncobj;
 	struct xe_spin *spin;
 	struct drm_xe_sync sync = {
-		.flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL,
+		.type = DRM_XE_SYNC_TYPE_SYNCOBJ,
+		.flags = DRM_XE_SYNC_FLAG_SIGNAL,
 	};
 	struct drm_xe_exec exec = {
 		.num_batch_buffer = 1,
lib/xe/xe_util.c +4 -2
index 2635edf72..4dcf84421 100644
@@ -179,8 +179,10 @@ void xe_bind_unbind_async(int xe, uint32_t vm, uint32_t bind_engine,
 {
 	struct drm_xe_vm_bind_op *bind_ops;
 	struct drm_xe_sync tabsyncs[2] = {
-		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ, .handle = sync_in },
-		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, .handle = sync_out },
+		{ .type = DRM_XE_SYNC_TYPE_SYNCOBJ, .handle = sync_in },
+		{ .type = DRM_XE_SYNC_TYPE_SYNCOBJ,
+		  .flags = DRM_XE_SYNC_FLAG_SIGNAL,
+		  .handle = sync_out },
 	};
 	struct drm_xe_sync *syncs;
 	uint32_t num_binds = 0;
tests/intel/xe_dma_buf_sync.c +3 -2
index daa1dc2ca..2298bd84a 100644
@@ -145,8 +145,9 @@ test_export_dma_buf(struct drm_xe_engine_class_instance *eci0,
 		uint64_t sdi_addr = addr + sdi_offset;
 		uint64_t spin_offset = (char *)&data[i]->spin - (char *)data[i];
 		struct drm_xe_sync sync[2] = {
-			{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ, },
-			{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
+			{ .type = DRM_XE_SYNC_TYPE_SYNCOBJ },
+			{ .type = DRM_XE_SYNC_TYPE_SYNCOBJ ,
+			  .flags = DRM_XE_SYNC_FLAG_SIGNAL },
 		};
 		struct drm_xe_exec exec = {
 			.num_batch_buffer = 1,
tests/intel/xe_drm_fdinfo.c +4 -2
index cec3e0825..e085dc307 100644
@@ -48,8 +48,10 @@ static void test_active(int fd, struct drm_xe_query_engine_info *engine)
 	uint32_t vm;
 	uint64_t addr = 0x1a0000;
 	struct drm_xe_sync sync[2] = {
-		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
-		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
+		{ .type = DRM_XE_SYNC_TYPE_SYNCOBJ,
+		  .flags = DRM_XE_SYNC_FLAG_SIGNAL },
+		{ .type = DRM_XE_SYNC_TYPE_SYNCOBJ,
+		  .flags = DRM_XE_SYNC_FLAG_SIGNAL },
 	};
 	struct drm_xe_exec exec = {
 		.num_batch_buffer = 1,
tests/intel/xe_evict.c +6 -3
index 660056f71..e30a03a2a 100644
@@ -38,8 +38,10 @@ test_evict(int fd, struct drm_xe_engine_class_instance *eci,
 	uint32_t bind_exec_queues[3] = { 0, 0, 0 };
 	uint64_t addr = 0x100000000, base_addr = 0x100000000;
 	struct drm_xe_sync sync[2] = {
-		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
-		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
+		{ .type = DRM_XE_SYNC_TYPE_SYNCOBJ,
+		  .flags = DRM_XE_SYNC_FLAG_SIGNAL },
+		{ .type = DRM_XE_SYNC_TYPE_SYNCOBJ,
+		  .flags = DRM_XE_SYNC_FLAG_SIGNAL },
 	};
 	struct drm_xe_exec exec = {
 		.num_batch_buffer = 1,
@@ -219,7 +221,8 @@ test_evict_cm(int fd, struct drm_xe_engine_class_instance *eci,
 	uint64_t addr = 0x100000000, base_addr = 0x100000000;
 #define USER_FENCE_VALUE	0xdeadbeefdeadbeefull
 	struct drm_xe_sync sync[1] = {
-		{ .flags = DRM_XE_SYNC_FLAG_USER_FENCE | DRM_XE_SYNC_FLAG_SIGNAL,
+		{ .type = DRM_XE_SYNC_TYPE_USER_FENCE,
+		  .flags = DRM_XE_SYNC_FLAG_SIGNAL,
 		  .timeline_value = USER_FENCE_VALUE },
 	};
 	struct drm_xe_exec exec = {
tests/intel/xe_exec_balancer.c +10 -5
index f15a40613..7d124fb67 100644
@@ -37,8 +37,10 @@ static void test_all_active(int fd, int gt, int class)
 	uint32_t vm;
 	uint64_t addr = 0x1a0000;
 	struct drm_xe_sync sync[2] = {
-		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
-		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
+		{ .type = DRM_XE_SYNC_TYPE_SYNCOBJ,
+		  .flags = DRM_XE_SYNC_FLAG_SIGNAL },
+		{ .type = DRM_XE_SYNC_TYPE_SYNCOBJ,
+		  .flags = DRM_XE_SYNC_FLAG_SIGNAL },
 	};
 	struct drm_xe_exec exec = {
 		.num_batch_buffer = 1,
@@ -177,8 +179,10 @@ test_exec(int fd, int gt, int class, int n_exec_queues, int n_execs,
 	uint32_t vm;
 	uint64_t addr = 0x1a0000;
 	struct drm_xe_sync sync[2] = {
-		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
-		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
+		{ .type = DRM_XE_SYNC_TYPE_SYNCOBJ,
+		  .flags = DRM_XE_SYNC_FLAG_SIGNAL },
+		{ .type = DRM_XE_SYNC_TYPE_SYNCOBJ,
+		  .flags = DRM_XE_SYNC_FLAG_SIGNAL },
 	};
 	struct drm_xe_exec exec = {
 		.num_syncs = 2,
@@ -401,7 +405,8 @@ test_cm(int fd, int gt, int class, int n_exec_queues, int n_execs,
 	uint64_t addr = 0x1a0000;
 #define USER_FENCE_VALUE	0xdeadbeefdeadbeefull
 	struct drm_xe_sync sync[1] = {
-		{ .flags = DRM_XE_SYNC_FLAG_USER_FENCE | DRM_XE_SYNC_FLAG_SIGNAL,
+		{ .type = DRM_XE_SYNC_TYPE_USER_FENCE,
+		  .flags = DRM_XE_SYNC_FLAG_SIGNAL,
 	          .timeline_value = USER_FENCE_VALUE },
 	};
 	struct drm_xe_exec exec = {
tests/intel/xe_exec_basic.c +4 -2
index ae406eb01..4a2dc1866 100644
@@ -81,8 +81,10 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 	  int n_exec_queues, int n_execs, int n_vm, unsigned int flags)
 {
 	struct drm_xe_sync sync[2] = {
-		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
-		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
+		{ .type = DRM_XE_SYNC_TYPE_SYNCOBJ,
+		  .flags = DRM_XE_SYNC_FLAG_SIGNAL },
+		{ .type = DRM_XE_SYNC_TYPE_SYNCOBJ,
+		  .flags = DRM_XE_SYNC_FLAG_SIGNAL },
 	};
 	struct drm_xe_exec exec = {
 		.num_batch_buffer = 1,
tests/intel/xe_exec_compute_mode.c +2 -1
index b0b4212be..35f9b555d 100644
@@ -88,7 +88,8 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 	uint64_t addr = 0x1a0000;
 #define USER_FENCE_VALUE	0xdeadbeefdeadbeefull
 	struct drm_xe_sync sync[1] = {
-		{ .flags = DRM_XE_SYNC_FLAG_USER_FENCE | DRM_XE_SYNC_FLAG_SIGNAL,
+		{ .type = DRM_XE_SYNC_TYPE_USER_FENCE,
+		  .flags = DRM_XE_SYNC_FLAG_SIGNAL,
 	          .timeline_value = USER_FENCE_VALUE },
 	};
 	struct drm_xe_exec exec = {
tests/intel/xe_exec_fault_mode.c +2 -1
index b1c859b10..14545973b 100644
@@ -107,7 +107,8 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 	uint64_t addr = 0x1a0000;
 #define USER_FENCE_VALUE	0xdeadbeefdeadbeefull
 	struct drm_xe_sync sync[1] = {
-		{ .flags = DRM_XE_SYNC_FLAG_USER_FENCE | DRM_XE_SYNC_FLAG_SIGNAL,
+		{ .type = DRM_XE_SYNC_TYPE_USER_FENCE,
+		  .flags = DRM_XE_SYNC_FLAG_SIGNAL,
 	          .timeline_value = USER_FENCE_VALUE },
 	};
 	struct drm_xe_exec exec = {
tests/intel/xe_exec_reset.c +14 -7
index ddb0b7dba..d85734229 100644
@@ -30,8 +30,10 @@ static void test_spin(int fd, struct drm_xe_engine_class_instance *eci)
 	uint32_t vm;
 	uint64_t addr = 0x1a0000;
 	struct drm_xe_sync sync[2] = {
-		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
-		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
+		{ .type = DRM_XE_SYNC_TYPE_SYNCOBJ,
+		  .flags = DRM_XE_SYNC_FLAG_SIGNAL },
+		{ .type = DRM_XE_SYNC_TYPE_SYNCOBJ,
+		  .flags = DRM_XE_SYNC_FLAG_SIGNAL },
 	};
 	struct drm_xe_exec exec = {
 		.num_batch_buffer = 1,
@@ -141,8 +143,10 @@ test_balancer(int fd, int gt, int class, int n_exec_queues, int n_execs,
 	uint32_t vm;
 	uint64_t addr = 0x1a0000;
 	struct drm_xe_sync sync[2] = {
-		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
-		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
+		{ .type = DRM_XE_SYNC_TYPE_SYNCOBJ,
+		  .flags = DRM_XE_SYNC_FLAG_SIGNAL },
+		{ .type = DRM_XE_SYNC_TYPE_SYNCOBJ,
+		  .flags = DRM_XE_SYNC_FLAG_SIGNAL },
 	};
 	struct drm_xe_exec exec = {
 		.num_syncs = 2,
@@ -338,8 +342,10 @@ test_legacy_mode(int fd, struct drm_xe_engine_class_instance *eci,
 	uint32_t vm;
 	uint64_t addr = 0x1a0000;
 	struct drm_xe_sync sync[2] = {
-		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
-		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
+		{ .type = DRM_XE_SYNC_TYPE_SYNCOBJ,
+		  .flags = DRM_XE_SYNC_FLAG_SIGNAL },
+		{ .type = DRM_XE_SYNC_TYPE_SYNCOBJ,
+		  .flags = DRM_XE_SYNC_FLAG_SIGNAL },
 	};
 	struct drm_xe_exec exec = {
 		.num_batch_buffer = 1,
@@ -504,7 +510,8 @@ test_compute_mode(int fd, struct drm_xe_engine_class_instance *eci,
 	uint64_t addr = 0x1a0000;
 #define USER_FENCE_VALUE	0xdeadbeefdeadbeefull
 	struct drm_xe_sync sync[1] = {
-		{ .flags = DRM_XE_SYNC_FLAG_USER_FENCE | DRM_XE_SYNC_FLAG_SIGNAL,
+		{ .type = DRM_XE_SYNC_TYPE_USER_FENCE,
+		  .flags = DRM_XE_SYNC_FLAG_SIGNAL,
 	          .timeline_value = USER_FENCE_VALUE },
 	};
 	struct drm_xe_exec exec = {
tests/intel/xe_exec_store.c +10 -5
index fb2c639c3..f41926819 100644
@@ -55,7 +55,8 @@ static void store_dword_batch(struct data *data, uint64_t addr, int value)
 static void store(int fd)
 {
 	struct drm_xe_sync sync = {
-		.flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL,
+		.type = DRM_XE_SYNC_TYPE_SYNCOBJ,
+		.flags = DRM_XE_SYNC_FLAG_SIGNAL,
 	};
 	struct drm_xe_exec exec = {
 		.num_batch_buffer = 1,
@@ -122,8 +123,10 @@ static void store_cachelines(int fd, struct drm_xe_engine_class_instance *eci,
 			     unsigned int flags)
 {
 	struct drm_xe_sync sync[2] = {
-		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
-		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, }
+		{ .type = DRM_XE_SYNC_TYPE_SYNCOBJ,
+		  .flags = DRM_XE_SYNC_FLAG_SIGNAL },
+		{ .type = DRM_XE_SYNC_TYPE_SYNCOBJ,
+		  .flags = DRM_XE_SYNC_FLAG_SIGNAL }
 	};
 
 	struct drm_xe_exec exec = {
@@ -212,8 +215,10 @@ static void store_cachelines(int fd, struct drm_xe_engine_class_instance *eci,
 static void store_all(int fd, int gt, int class)
 {
 	struct drm_xe_sync sync[2] = {
-		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
-		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, }
+		{ .type = DRM_XE_SYNC_TYPE_SYNCOBJ,
+		  .flags = DRM_XE_SYNC_FLAG_SIGNAL },
+		{ .type = DRM_XE_SYNC_TYPE_SYNCOBJ,
+		  .flags = DRM_XE_SYNC_FLAG_SIGNAL }
 	};
 	struct drm_xe_exec exec = {
 		.num_batch_buffer = 1,
tests/intel/xe_exec_threads.c +12 -7
index 803413ae7..9060d36e1 100644
@@ -47,8 +47,10 @@ test_balancer(int fd, int gt, uint32_t vm, uint64_t addr, uint64_t userptr,
 	      int class, int n_exec_queues, int n_execs, unsigned int flags)
 {
 	struct drm_xe_sync sync[2] = {
-		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
-		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
+		{ .type = DRM_XE_SYNC_TYPE_SYNCOBJ,
+		  .flags = DRM_XE_SYNC_FLAG_SIGNAL },
+		{ .type = DRM_XE_SYNC_TYPE_SYNCOBJ,
+		  .flags = DRM_XE_SYNC_FLAG_SIGNAL },
 	};
 	struct drm_xe_sync sync_all[MAX_N_EXEC_QUEUES];
 	struct drm_xe_exec exec = {
@@ -126,7 +128,7 @@ test_balancer(int fd, int gt, uint32_t vm, uint64_t addr, uint64_t userptr,
 					&create), 0);
 		exec_queues[i] = create.exec_queue_id;
 		syncobjs[i] = syncobj_create(fd, 0);
-		sync_all[i].flags = DRM_XE_SYNC_FLAG_SYNCOBJ;
+		sync_all[i].type = DRM_XE_SYNC_TYPE_SYNCOBJ;
 		sync_all[i].handle = syncobjs[i];
 	};
 	exec.num_batch_buffer = flags & PARALLEL ? num_placements : 1;
@@ -255,7 +257,8 @@ test_compute_mode(int fd, uint32_t vm, uint64_t addr, uint64_t userptr,
 {
 #define USER_FENCE_VALUE	0xdeadbeefdeadbeefull
 	struct drm_xe_sync sync[1] = {
-		{ .flags = DRM_XE_SYNC_FLAG_USER_FENCE | DRM_XE_SYNC_FLAG_SIGNAL,
+		{ .type = DRM_XE_SYNC_TYPE_USER_FENCE,
+		  .flags = DRM_XE_SYNC_FLAG_SIGNAL,
 	          .timeline_value = USER_FENCE_VALUE },
 	};
 	struct drm_xe_exec exec = {
@@ -459,8 +462,10 @@ test_legacy_mode(int fd, uint32_t vm, uint64_t addr, uint64_t userptr,
 		 int n_execs, unsigned int flags)
 {
 	struct drm_xe_sync sync[2] = {
-		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
-		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
+		{ .type = DRM_XE_SYNC_TYPE_SYNCOBJ,
+		  .flags = DRM_XE_SYNC_FLAG_SIGNAL },
+		{ .type = DRM_XE_SYNC_TYPE_SYNCOBJ,
+		  .flags = DRM_XE_SYNC_FLAG_SIGNAL },
 	};
 	struct drm_xe_sync sync_all[MAX_N_EXEC_QUEUES];
 	struct drm_xe_exec exec = {
@@ -539,7 +544,7 @@ test_legacy_mode(int fd, uint32_t vm, uint64_t addr, uint64_t userptr,
 		else
 			bind_exec_queues[i] = 0;
 		syncobjs[i] = syncobj_create(fd, 0);
-		sync_all[i].flags = DRM_XE_SYNC_FLAG_SYNCOBJ;
+		sync_all[i].type = DRM_XE_SYNC_TYPE_SYNCOBJ;
 		sync_all[i].handle = syncobjs[i];
 	};
 
tests/intel/xe_guc_pc.c +4 -2
index 062968050..210cc4aa4 100644
@@ -37,8 +37,10 @@ static void exec_basic(int fd, struct drm_xe_engine_class_instance *eci,
 	uint32_t vm;
 	uint64_t addr = 0x1a0000;
 	struct drm_xe_sync sync[2] = {
-		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
-		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
+		{ .type = DRM_XE_SYNC_TYPE_SYNCOBJ,
+		  .flags = DRM_XE_SYNC_FLAG_SIGNAL },
+		{ .type = DRM_XE_SYNC_TYPE_SYNCOBJ,
+		  .flags = DRM_XE_SYNC_FLAG_SIGNAL },
 	};
 	struct drm_xe_exec exec = {
 		.num_batch_buffer = 1,
tests/intel/xe_huc_copy.c +2 -1
index 5eaf4778a..6cf38e2c9 100644
@@ -118,7 +118,8 @@ __test_huc_copy(int fd, uint32_t vm, struct drm_xe_engine_class_instance *hwe)
 	};
 
 	exec_queue = xe_exec_queue_create(fd, vm, hwe, 0);
-	sync.flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL;
+	sync.type = DRM_XE_SYNC_TYPE_SYNCOBJ;
+	sync.flags = DRM_XE_SYNC_FLAG_SIGNAL;
 	sync.handle = syncobj_create(fd, 0);
 
 	for(int i = 0; i < BO_DICT_ENTRIES; i++) {
tests/intel/xe_perf_pmu.c +4 -4
index 9b7c5d9d3..e1863b35b 100644
@@ -81,8 +81,8 @@ static void test_any_engine_busyness(int fd, struct drm_xe_engine_class_instance
 	uint32_t vm;
 	uint64_t addr = 0x1a0000;
 	struct drm_xe_sync sync[2] = {
-		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
-		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
+		{ .flags = DRM_XE_SYNC_TYPE_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
+		{ .flags = DRM_XE_SYNC_TYPE_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
 	};
 	struct drm_xe_exec exec = {
 		.num_batch_buffer = 1,
@@ -185,8 +185,8 @@ static void test_engine_group_busyness(int fd, int gt, int class, const char *na
 	uint32_t vm;
 	uint64_t addr = 0x1a0000;
 	struct drm_xe_sync sync[2] = {
-		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
-		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
+		{ .flags = DRM_XE_SYNC_TYPE_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
+		{ .flags = DRM_XE_SYNC_TYPE_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
 	};
 	struct drm_xe_exec exec = {
 		.num_batch_buffer = 1,
tests/intel/xe_pm.c +4 -2
index 690663a79..1288e7b90 100644
@@ -231,8 +231,10 @@ test_exec(device_t device, struct drm_xe_engine_class_instance *eci,
 	uint32_t vm;
 	uint64_t addr = 0x1a0000;
 	struct drm_xe_sync sync[2] = {
-		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
-		{ .flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL, },
+		{ .type = DRM_XE_SYNC_TYPE_SYNCOBJ,
+		  .flags = DRM_XE_SYNC_FLAG_SIGNAL },
+		{ .type = DRM_XE_SYNC_TYPE_SYNCOBJ,
+		  .flags = DRM_XE_SYNC_FLAG_SIGNAL },
 	};
 	struct drm_xe_exec exec = {
 		.num_batch_buffer = 1,
tests/intel/xe_pm_residency.c +2 -1
index 373170d5b..db58107ab 100644
@@ -87,7 +87,8 @@ static void exec_load(int fd, struct drm_xe_engine_class_instance *eci, unsigned
 	} *data;
 
 	struct drm_xe_sync sync = {
-		.flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL,
+		.type = DRM_XE_SYNC_TYPE_SYNCOBJ,
+		.flags = DRM_XE_SYNC_FLAG_SIGNAL,
 	};
 
 	struct drm_xe_exec exec = {
tests/intel/xe_spin_batch.c +2 -1
index 9139d3286..0314a1694 100644
@@ -145,7 +145,8 @@ static void xe_spin_fixed_duration(int fd)
 {
 	struct drm_xe_sync sync = {
 		.handle = syncobj_create(fd, 0),
-		.flags = DRM_XE_SYNC_FLAG_SYNCOBJ | DRM_XE_SYNC_FLAG_SIGNAL,
+		.type = DRM_XE_SYNC_TYPE_SYNCOBJ,
+		.flags = DRM_XE_SYNC_FLAG_SIGNAL,
 	};
 	struct drm_xe_exec exec = {
 		.num_batch_buffer = 1,
tests/intel/xe_vm.c +32 -17

109 lines not on this page · raw message

tests/intel/xe_waitfence.c +3 -1
index f57785aa4..fe033e987 100644
@@ -28,10 +28,12 @@ static void do_bind(int fd, uint32_t vm, uint32_t bo, uint64_t offset,
 		    uint64_t addr, uint64_t size, uint64_t val)
 {
 	struct drm_xe_sync sync[1] = {};
-	sync[0].flags = DRM_XE_SYNC_FLAG_USER_FENCE | DRM_XE_SYNC_FLAG_SIGNAL;
 
+	sync[0].type = DRM_XE_SYNC_TYPE_USER_FENCE;
+	sync[0].flags = DRM_XE_SYNC_FLAG_SIGNAL;
 	sync[0].addr = to_user_pointer(&wait_fence);
 	sync[0].timeline_value = val;
+
 	xe_vm_bind_async(fd, vm, 0, bo, offset, addr, size, sync, 1);
 }
 
Signature · 1 line
2.34.1
#33 lore raw

PATCH v3 33/57 drm-uapi/xe: s/FLAGS_HAS_VRAM/FLAG_HAS_VRAM

In reply to Francois Dugast

From: Rodrigo Vivi <[email protected]>

Align with commit ("drm/xe/uapi: Standardize the FLAG naming and assignment")

---
 include/drm-uapi/xe_drm.h | 20 ++++++++++----------
 tests/intel/xe_debugfs.c  |  4 ++--
 tests/intel/xe_query.c    |  4 ++--
 3 files changed, 14 insertions(+), 14 deletions(-)
include/drm-uapi/xe_drm.h +10 -10
index 8ff76ab31..eb70c3202 100644
@@ -354,7 +354,7 @@ struct drm_xe_query_mem_regions {
  *  - %DRM_XE_QUERY_CONFIG_FLAGS - Flags describing the device
  *    configuration, see list below
  *
- *    - %DRM_XE_QUERY_CONFIG_FLAGS_HAS_VRAM - Flag is set if the device
+ *    - %DRM_XE_QUERY_CONFIG_FLAG_HAS_VRAM - Flag is set if the device
  *      has usable VRAM
  *  - %DRM_XE_QUERY_CONFIG_MIN_ALIGNMENT - Minimal memory alignment
  *    required by this device, typically SZ_4K or SZ_64K
@@ -371,7 +371,7 @@ struct drm_xe_query_config {
 
 #define DRM_XE_QUERY_CONFIG_REV_AND_DEVICE_ID		0
 #define DRM_XE_QUERY_CONFIG_FLAGS			1
-	#define DRM_XE_QUERY_CONFIG_FLAGS_HAS_VRAM	(0x1 << 0)
+	#define DRM_XE_QUERY_CONFIG_FLAG_HAS_VRAM	(1 << 0)
 	/*
 	 * DRM_XE_QUERY_CONFIG_MIN_ALIGNMENT - This returns the
 	 * maximum value of the &min_page_size across all memory regions
@@ -755,10 +755,10 @@ struct drm_xe_vm_create {
 	/** @extensions: Pointer to the first extension struct, if any */
 	__u64 extensions;
 
-#define DRM_XE_VM_CREATE_FLAG_SCRATCH_PAGE	(0x1 << 0)
-#define DRM_XE_VM_CREATE_FLAG_COMPUTE_MODE	(0x1 << 1)
-#define DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT	(0x1 << 2)
-#define DRM_XE_VM_CREATE_FLAG_FAULT_MODE	(0x1 << 3)
+#define DRM_XE_VM_CREATE_FLAG_SCRATCH_PAGE	(1 << 0)
+#define DRM_XE_VM_CREATE_FLAG_COMPUTE_MODE	(1 << 1)
+#define DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT	(1 << 2)
+#define DRM_XE_VM_CREATE_FLAG_FAULT_MODE	(1 << 3)
 	/** @flags: Flags */
 	__u32 flags;
 
@@ -852,10 +852,10 @@ struct drm_xe_vm_bind_op {
 	/** @op: Bind operation to perform */
 	__u32 op;
 
-#define DRM_XE_VM_BIND_FLAG_READONLY	(0x1 << 0)
-#define DRM_XE_VM_BIND_FLAG_ASYNC	(0x1 << 1)
-#define DRM_XE_VM_BIND_FLAG_IMMEDIATE	(0x1 << 2)
-#define DRM_XE_VM_BIND_FLAG_NULL	(0x1 << 3)
+#define DRM_XE_VM_BIND_FLAG_READONLY	(1 << 0)
+#define DRM_XE_VM_BIND_FLAG_ASYNC	(1 << 1)
+#define DRM_XE_VM_BIND_FLAG_IMMEDIATE	(1 << 2)
+#define DRM_XE_VM_BIND_FLAG_NULL	(1 << 3)
 	/** @flags: Bind flags */
 	__u32 flags;
 
tests/intel/xe_debugfs.c +2 -2
index 60ddceda7..4fd5ebc28 100644
@@ -99,7 +99,7 @@ test_base(int fd, struct drm_xe_query_config *config)
 	igt_assert(igt_debugfs_search(fd, "info", reference));
 
 	sprintf(reference, "is_dgfx %s", config->info[DRM_XE_QUERY_CONFIG_FLAGS] &
-		DRM_XE_QUERY_CONFIG_FLAGS_HAS_VRAM ? "yes" : "no");
+		DRM_XE_QUERY_CONFIG_FLAG_HAS_VRAM ? "yes" : "no");
 
 	igt_assert(igt_debugfs_search(fd, "info", reference));
 
@@ -125,7 +125,7 @@ test_base(int fd, struct drm_xe_query_config *config)
 	igt_assert(igt_debugfs_exists(fd, "gtt_mm", O_RDONLY));
 	igt_debugfs_dump(fd, "gtt_mm");
 
-	if (config->info[DRM_XE_QUERY_CONFIG_FLAGS] & DRM_XE_QUERY_CONFIG_FLAGS_HAS_VRAM) {
+	if (config->info[DRM_XE_QUERY_CONFIG_FLAGS] & DRM_XE_QUERY_CONFIG_FLAG_HAS_VRAM) {
 		igt_assert(igt_debugfs_exists(fd, "vram0_mm", O_RDONLY));
 		igt_debugfs_dump(fd, "vram0_mm");
 	}
tests/intel/xe_query.c +2 -2
index e5739ad78..80510146f 100644
@@ -367,9 +367,9 @@ test_query_config(int fd)
 		config->info[DRM_XE_QUERY_CONFIG_REV_AND_DEVICE_ID] & 0xffff);
 	igt_info("DRM_XE_QUERY_CONFIG_FLAGS\t\t\t%#llx\n",
 		config->info[DRM_XE_QUERY_CONFIG_FLAGS]);
-	igt_info("  DRM_XE_QUERY_CONFIG_FLAGS_HAS_VRAM\t%s\n",
+	igt_info("  DRM_XE_QUERY_CONFIG_FLAG_HAS_VRAM\t%s\n",
 		config->info[DRM_XE_QUERY_CONFIG_FLAGS] &
-		DRM_XE_QUERY_CONFIG_FLAGS_HAS_VRAM ? "ON":"OFF");
+		DRM_XE_QUERY_CONFIG_FLAG_HAS_VRAM ? "ON":"OFF");
 	igt_info("DRM_XE_QUERY_CONFIG_MIN_ALIGNMENT\t\t%#llx\n",
 		config->info[DRM_XE_QUERY_CONFIG_MIN_ALIGNMENT]);
 	igt_info("DRM_XE_QUERY_CONFIG_VA_BITS\t\t\t%llu\n",
Signature · 1 line
2.34.1
#34 lore raw

PATCH v3 34/57 drm-uapi/xe: Differentiate WAIT_OP from WAIT_MASK

In reply to Francois Dugast

From: Rodrigo Vivi <[email protected]>

Align with kernel commit ("drm/xe/uapi: Differentiate WAIT_OP from WAIT_MASK")

---
 include/drm-uapi/xe_drm.h | 41 ++++++++++++++++++++-------------------
 lib/xe/xe_ioctl.c         |  8 ++++----
 2 files changed, 25 insertions(+), 24 deletions(-)
include/drm-uapi/xe_drm.h +21 -20
index eb70c3202..e33d2a5ae 100644
@@ -1140,22 +1140,22 @@ struct drm_xe_exec_queue_get_property {
  * Returns to user on user fence completion or timeout.
  *
  * The wait @op can be:
- *  - %DRM_XE_UFENCE_WAIT_EQ
- *  - %DRM_XE_UFENCE_WAIT_NEQ
- *  - %DRM_XE_UFENCE_WAIT_GT
- *  - %DRM_XE_UFENCE_WAIT_GTE
- *  - %DRM_XE_UFENCE_WAIT_LT
- *  - %DRM_XE_UFENCE_WAIT_LTE
+ *  - %DRM_XE_UFENCE_WAIT_OP_EQ
+ *  - %DRM_XE_UFENCE_WAIT_OP_NEQ
+ *  - %DRM_XE_UFENCE_WAIT_OP_GT
+ *  - %DRM_XE_UFENCE_WAIT_OP_GTE
+ *  - %DRM_XE_UFENCE_WAIT_OP_LT
+ *  - %DRM_XE_UFENCE_WAIT_OP_LTE
  *
  * The wait @flags can be:
  *  - %DRM_XE_UFENCE_WAIT_FLAG_SOFT_OP
  *  - %DRM_XE_UFENCE_WAIT_FLAG_ABSTIME
  *
  * The wait @mask can be:
- *  - %DRM_XE_UFENCE_WAIT_U8
- *  - %DRM_XE_UFENCE_WAIT_U16
- *  - %DRM_XE_UFENCE_WAIT_U32
- *  - %DRM_XE_UFENCE_WAIT_U64
+ *  - %DRM_XE_UFENCE_WAIT_MASK_U8
+ *  - %DRM_XE_UFENCE_WAIT_MASK_U16
+ *  - %DRM_XE_UFENCE_WAIT_MASK_U32
+ *  - %DRM_XE_UFENCE_WAIT_MASK_U64
  *
  */
 struct drm_xe_wait_user_fence {
@@ -1167,12 +1167,12 @@ struct drm_xe_wait_user_fence {
 	 */
 	__u64 addr;
 
-#define DRM_XE_UFENCE_WAIT_EQ	0
-#define DRM_XE_UFENCE_WAIT_NEQ	1
-#define DRM_XE_UFENCE_WAIT_GT	2
-#define DRM_XE_UFENCE_WAIT_GTE	3
-#define DRM_XE_UFENCE_WAIT_LT	4
-#define DRM_XE_UFENCE_WAIT_LTE	5
+#define DRM_XE_UFENCE_WAIT_OP_EQ	0x0
+#define DRM_XE_UFENCE_WAIT_OP_NEQ	0x1
+#define DRM_XE_UFENCE_WAIT_OP_GT	0x2
+#define DRM_XE_UFENCE_WAIT_OP_GTE	0x3
+#define DRM_XE_UFENCE_WAIT_OP_LT	0x4
+#define DRM_XE_UFENCE_WAIT_OP_LTE	0x5
 	/** @op: wait operation (type of comparison) */
 	__u16 op;
 
@@ -1187,12 +1187,13 @@ struct drm_xe_wait_user_fence {
 	/** @value: compare value */
 	__u64 value;
 
-#define DRM_XE_UFENCE_WAIT_U8		0xffu
-#define DRM_XE_UFENCE_WAIT_U16		0xffffu
-#define DRM_XE_UFENCE_WAIT_U32		0xffffffffu
-#define DRM_XE_UFENCE_WAIT_U64		0xffffffffffffffffu
+#define DRM_XE_UFENCE_WAIT_MASK_U8	0xffu
+#define DRM_XE_UFENCE_WAIT_MASK_U16	0xffffu
+#define DRM_XE_UFENCE_WAIT_MASK_U32	0xffffffffu
+#define DRM_XE_UFENCE_WAIT_MASK_U64	0xffffffffffffffffu
 	/** @mask: comparison mask */
 	__u64 mask;
+
 	/**
 	 * @timeout: how long to wait before bailing, value in nanoseconds.
 	 * Without DRM_XE_UFENCE_WAIT_FLAG_ABSTIME flag set (relative timeout)
lib/xe/xe_ioctl.c +4 -4
index e928148ee..5d4f2fcd8 100644
@@ -422,10 +422,10 @@ int64_t xe_wait_ufence(int fd, uint64_t *addr, uint64_t value,
 {
 	struct drm_xe_wait_user_fence wait = {
 		.addr = to_user_pointer(addr),
-		.op = DRM_XE_UFENCE_WAIT_EQ,
+		.op = DRM_XE_UFENCE_WAIT_OP_EQ,
 		.flags = !eci ? DRM_XE_UFENCE_WAIT_FLAG_SOFT_OP : 0,
 		.value = value,
-		.mask = DRM_XE_UFENCE_WAIT_U64,
+		.mask = DRM_XE_UFENCE_WAIT_MASK_U64,
 		.timeout = timeout,
 		.num_engines = eci ? 1 :0,
 		.instances = eci ? to_user_pointer(eci) : 0,
@@ -454,10 +454,10 @@ int64_t xe_wait_ufence_abstime(int fd, uint64_t *addr, uint64_t value,
 {
 	struct drm_xe_wait_user_fence wait = {
 		.addr = to_user_pointer(addr),
-		.op = DRM_XE_UFENCE_WAIT_EQ,
+		.op = DRM_XE_UFENCE_WAIT_OP_EQ,
 		.flags = !eci ? DRM_XE_UFENCE_WAIT_FLAG_SOFT_OP | DRM_XE_UFENCE_WAIT_FLAG_ABSTIME : 0,
 		.value = value,
-		.mask = DRM_XE_UFENCE_WAIT_U64,
+		.mask = DRM_XE_UFENCE_WAIT_MASK_U64,
 		.timeout = timeout,
 		.num_engines = eci ? 1 : 0,
 		.instances = eci ? to_user_pointer(eci) : 0,
Signature · 1 line
2.34.1
#35 lore raw

PATCH v3 35/57 drm-uapi/xe: Align with xe_exec ioctl reorder

In reply to Francois Dugast

Align with kernel commit ("drm/xe/uapi: Move xe_exec after xe_exec_queue")

---
 include/drm-uapi/xe_drm.h | 82 +++++++++++++++++++--------------------
 1 file changed, 41 insertions(+), 41 deletions(-)
include/drm-uapi/xe_drm.h +41 -41
index e33d2a5ae..83e5b629a 100644
@@ -62,11 +62,11 @@ extern "C" {
 #define DRM_XE_VM_CREATE		0x03
 #define DRM_XE_VM_DESTROY		0x04
 #define DRM_XE_VM_BIND			0x05
-#define DRM_XE_EXEC			0x06
-#define DRM_XE_EXEC_QUEUE_CREATE	0x07
-#define DRM_XE_EXEC_QUEUE_DESTROY	0x08
-#define DRM_XE_EXEC_QUEUE_SET_PROPERTY	0x09
-#define DRM_XE_EXEC_QUEUE_GET_PROPERTY	0x0a
+#define DRM_XE_EXEC_QUEUE_CREATE	0x06
+#define DRM_XE_EXEC_QUEUE_DESTROY	0x07
+#define DRM_XE_EXEC_QUEUE_SET_PROPERTY	0x08
+#define DRM_XE_EXEC_QUEUE_GET_PROPERTY	0x09
+#define DRM_XE_EXEC			0x0a
 #define DRM_XE_WAIT_USER_FENCE		0x0b
 /* Must be kept compact -- no holes */
 
@@ -76,11 +76,11 @@ extern "C" {
 #define DRM_IOCTL_XE_VM_CREATE			DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_VM_CREATE, struct drm_xe_vm_create)
 #define DRM_IOCTL_XE_VM_DESTROY			DRM_IOW(DRM_COMMAND_BASE + DRM_XE_VM_DESTROY, struct drm_xe_vm_destroy)
 #define DRM_IOCTL_XE_VM_BIND			DRM_IOW(DRM_COMMAND_BASE + DRM_XE_VM_BIND, struct drm_xe_vm_bind)
-#define DRM_IOCTL_XE_EXEC			DRM_IOW(DRM_COMMAND_BASE + DRM_XE_EXEC, struct drm_xe_exec)
 #define DRM_IOCTL_XE_EXEC_QUEUE_CREATE		DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_EXEC_QUEUE_CREATE, struct drm_xe_exec_queue_create)
 #define DRM_IOCTL_XE_EXEC_QUEUE_DESTROY		DRM_IOW(DRM_COMMAND_BASE + DRM_XE_EXEC_QUEUE_DESTROY, struct drm_xe_exec_queue_destroy)
 #define DRM_IOCTL_XE_EXEC_QUEUE_SET_PROPERTY	DRM_IOW(DRM_COMMAND_BASE + DRM_XE_EXEC_QUEUE_SET_PROPERTY, struct drm_xe_exec_queue_set_property)
 #define DRM_IOCTL_XE_EXEC_QUEUE_GET_PROPERTY	DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_EXEC_QUEUE_GET_PROPERTY, struct drm_xe_exec_queue_get_property)
+#define DRM_IOCTL_XE_EXEC			DRM_IOW(DRM_COMMAND_BASE + DRM_XE_EXEC, struct drm_xe_exec)
 #define DRM_IOCTL_XE_WAIT_USER_FENCE		DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_WAIT_USER_FENCE, struct drm_xe_wait_user_fence)
 
 /**
@@ -980,41 +980,6 @@ struct drm_xe_sync {
 	__u64 reserved[2];
 };
 
-/**
- * struct drm_xe_exec - Input of &DRM_IOCTL_XE_EXEC
- */
-struct drm_xe_exec {
-	/** @extensions: Pointer to the first extension struct, if any */
-	__u64 extensions;
-
-	/** @exec_queue_id: Exec queue ID for the batch buffer */
-	__u32 exec_queue_id;
-
-	/** @num_syncs: Amount of struct drm_xe_sync in array. */
-	__u32 num_syncs;
-
-	/** @syncs: Pointer to struct drm_xe_sync array. */
-	__u64 syncs;
-
-	/**
-	 * @address: address of batch buffer if num_batch_buffer == 1 or an
-	 * array of batch buffer addresses
-	 */
-	__u64 address;
-
-	/**
-	 * @num_batch_buffer: number of batch buffer in this exec, must match
-	 * the width of the engine
-	 */
-	__u16 num_batch_buffer;
-
-	/** @pad: MBZ */
-	__u16 pad[3];
-
-	/** @reserved: Reserved */
-	__u64 reserved[2];
-};
-
 /**
  * struct drm_xe_exec_queue_create - Input of &DRM_IOCTL_XE_EXEC_QUEUE_CREATE
  */
@@ -1129,6 +1094,41 @@ struct drm_xe_exec_queue_get_property {
 	__u64 reserved[2];
 };
 
+/**
+ * struct drm_xe_exec - Input of &DRM_IOCTL_XE_EXEC
+ */
+struct drm_xe_exec {
+	/** @extensions: Pointer to the first extension struct, if any */
+	__u64 extensions;
+
+	/** @exec_queue_id: Exec queue ID for the batch buffer */
+	__u32 exec_queue_id;
+
+	/** @num_syncs: Amount of struct drm_xe_sync in array. */
+	__u32 num_syncs;
+
+	/** @syncs: Pointer to struct drm_xe_sync array. */
+	__u64 syncs;
+
+	/**
+	 * @address: address of batch buffer if num_batch_buffer == 1 or an
+	 * array of batch buffer addresses
+	 */
+	__u64 address;
+
+	/**
+	 * @num_batch_buffer: number of batch buffer in this exec, must match
+	 * the width of the engine
+	 */
+	__u16 num_batch_buffer;
+
+	/** @pad: MBZ */
+	__u16 pad[3];
+
+	/** @reserved: Reserved */
+	__u64 reserved[2];
+};
+
 /**
  * struct drm_xe_wait_user_fence - Input of &DRM_IOCTL_XE_WAIT_USER_FENCE
  *
Signature · 1 line
2.34.1
#36 lore raw

PATCH v3 36/57 xe: Build all_memory_regions_mask out of memory_regions query info

In reply to Francois Dugast

From: Rodrigo Vivi <[email protected]>

The memory mask is build out of the instance in the memory_regions. Let's use this information directly instead of having to inspect all the GT's for all the near and far memory, what even results in useless '1-or-1' duplications.

---
 lib/xe/xe_query.c | 12 +++++-------
 lib/xe/xe_query.h |  2 +-
 2 files changed, 6 insertions(+), 8 deletions(-)
lib/xe/xe_query.c +5 -7
index de0f8a78f..ab99fa06c 100644
@@ -60,14 +60,12 @@ static struct drm_xe_query_gt_list *xe_query_gt_list_new(int fd)
 	return gt_list;
 }
 
-static uint64_t __memory_regions(const struct drm_xe_query_gt_list *gt_list)
+static uint64_t __all_memory_regions(struct drm_xe_query_mem_regions *mem_regions)
 {
 	uint64_t regions = 0;
-	int i;
 
-	for (i = 0; i < gt_list->num_gt; i++)
-		regions |= gt_list->gt_list[i].near_mem_regions |
-			   gt_list->gt_list[i].far_mem_regions;
+	for (int i = 0; i < mem_regions->num_regions; i++)
+		regions |= 1 << mem_regions->regions[i].instance;
 
 	return regions;
 }
@@ -252,9 +250,9 @@ struct xe_device *xe_device_get(int fd)
 	xe_dev->va_bits = xe_dev->config->info[DRM_XE_QUERY_CONFIG_VA_BITS];
 	xe_dev->dev_id = xe_dev->config->info[DRM_XE_QUERY_CONFIG_REV_AND_DEVICE_ID] & 0xffff;
 	xe_dev->gt_list = xe_query_gt_list_new(fd);
-	xe_dev->memory_regions = __memory_regions(xe_dev->gt_list);
 	xe_dev->engines = xe_query_engines(fd, &xe_dev->number_engines);
 	xe_dev->mem_regions = xe_query_mem_regions_new(fd);
+	xe_dev->all_memory_regions_mask = __all_memory_regions(xe_dev->mem_regions);
 	xe_dev->vram_size = calloc(xe_dev->gt_list->num_gt, sizeof(*xe_dev->vram_size));
 	xe_dev->visible_vram_size = calloc(xe_dev->gt_list->num_gt, sizeof(*xe_dev->visible_vram_size));
 	for (int gt = 0; gt < xe_dev->gt_list->num_gt; gt++) {
@@ -365,7 +363,7 @@ xe_dev_FN(xe_number_gt, gt_list->num_gt, unsigned int);
  *
  * Returns memory regions bitmask for xe device @fd.
  */
-xe_dev_FN(all_memory_regions, memory_regions, uint64_t);
+xe_dev_FN(all_memory_regions, all_memory_regions_mask, uint64_t);
 
 /**
  * system_memory:
lib/xe/xe_query.h +1 -1
index ef90d5b63..0faa9c284 100644
@@ -30,7 +30,7 @@ struct xe_device {
 	struct drm_xe_query_gt_list *gt_list;
 
 	/** @gt_list: bitmask of all memory regions */
-	uint64_t memory_regions;
+	uint64_t all_memory_regions_mask;
 
 	/** @engines: array of hardware engines */
 	struct drm_xe_query_engine_info *engines;
Signature · 1 line
2.34.1
#37 lore raw

PATCH v3 37/57 xe: Be more specific on the VRAM selection

In reply to Francois Dugast

From: Rodrigo Vivi <[email protected]>

There are 2 main use cases:

1. A specific VRAM near a specific engine inside a GT.
2. Any VRAM in the device, for any kind of device memory access, but that not necessarily need to be near to any specific engine.

Let's split up these 2 cases, instead of randomly selecting the gt0.

Although this might bring some questions if 'any_vram' is the real right choice for some of the cases here, this patch doesn't try to address that. There should be no functional change with this patch applied.

---
 benchmarks/gem_wsim.c              |  2 +-
 lib/igt_draw.c                     |  4 +-
 lib/igt_fb.c                       |  6 +--
 lib/intel_batchbuffer.c            |  4 +-
 lib/xe/xe_query.c                  | 60 +++++++++++++++++++++++-------
 lib/xe/xe_query.h                  |  6 ++-
 lib/xe/xe_spin.c                   |  4 +-
 tests/intel/kms_big_fb.c           |  8 ++--
 tests/intel/kms_ccs.c              |  2 +-
 tests/intel/kms_psr.c              |  2 +-
 tests/intel/xe_dma_buf_sync.c      |  2 +-
 tests/intel/xe_evict.c             | 12 +++---
 tests/intel/xe_evict_ccs.c         |  8 ++--
 tests/intel/xe_exec_balancer.c     |  6 +--
 tests/intel/xe_exec_basic.c        |  2 +-
 tests/intel/xe_exec_compute_mode.c |  2 +-
 tests/intel/xe_exec_fault_mode.c   |  4 +-
 tests/intel/xe_exec_reset.c        | 10 ++---
 tests/intel/xe_exec_store.c        |  6 +--
 tests/intel/xe_exec_threads.c      |  6 +--
 tests/intel/xe_guc_pc.c            |  2 +-
 tests/intel/xe_mmap.c              | 18 ++++-----
 tests/intel/xe_noexec_ping_pong.c  |  2 +-
 tests/intel/xe_perf_pmu.c          |  4 +-
 tests/intel/xe_pm.c                |  4 +-
 tests/intel/xe_pm_residency.c      |  2 +-
 tests/intel/xe_prime_self_import.c | 18 ++++-----
 tests/intel/xe_spin_batch.c        |  2 +-
 tests/intel/xe_vm.c                | 22 +++++------
 tests/intel/xe_waitfence.c         | 14 +++----
 tests/kms_getfb.c                  |  2 +-
 31 files changed, 141 insertions(+), 105 deletions(-)
benchmarks/gem_wsim.c +1 -1
index d02f72087..5ba5f2e2c 100644
@@ -1735,7 +1735,7 @@ xe_alloc_step_batch(struct workload *wrk, struct w_step *w)
 	int i;
 
 	w->bb_handle = xe_bo_create(fd, vm->id, PAGE_SIZE,
-				    vram_if_possible(fd, eq->eci_list[0].gt_id),
+				    vram_near_gt_if_possible(fd, eq->eci_list[0].gt_id),
 				    DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	w->xe.data = xe_bo_map(fd, w->bb_handle, PAGE_SIZE);
 	w->xe.exec.address =
lib/igt_draw.c +2 -2
index 1e0ff8707..87b40312f 100644
@@ -643,7 +643,7 @@ static struct intel_buf *create_buf(int fd, struct buf_ops *bops,
 	struct intel_buf *buf;
 	enum intel_driver driver = buf_ops_get_driver(bops);
 	uint32_t handle, name, width, height;
-	uint64_t region = driver == INTEL_DRIVER_XE ? vram_if_possible(fd, 0) : -1;
+	uint64_t region = driver == INTEL_DRIVER_XE ? any_vram_if_possible(fd) : -1;
 	uint64_t size = from->size;
 
 	width = from->stride / (from->bpp / 8);
@@ -797,7 +797,7 @@ static void draw_rect_render(int fd, struct cmd_data *cmd_data,
 	else
 		tmp.handle = xe_bo_create(fd, 0,
 					  ALIGN(tmp.size, xe_get_default_alignment(fd)),
-					  vram_if_possible(fd, 0),
+					  any_vram_if_possible(fd),
 					  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 
 	tmp.stride = rect->w * pixel_size;
lib/igt_fb.c +3 -3
index 9c1257801..11b92f07b 100644
@@ -1206,7 +1206,7 @@ static int create_bo_for_fb(struct igt_fb *fb, bool prefer_sysmem)
 			igt_assert(err == 0 || err == -EOPNOTSUPP);
 		} else if (is_xe_device(fd)) {
 			fb->gem_handle = xe_bo_create(fd, 0, fb->size,
-						      vram_if_possible(fd, 0),
+						      any_vram_if_possible(fd),
 						      DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		} else if (is_vc4_device(fd)) {
 			fb->gem_handle = igt_vc4_create_bo(fd, fb->size);
@@ -2629,7 +2629,7 @@ igt_fb_create_intel_buf(int fd, struct buf_ops *bops,
 
 	/* For i915 region doesn't matter, for xe does */
 	region = buf_ops_get_driver(bops) == INTEL_DRIVER_XE ?
-				vram_if_possible(fd, 0) : -1;
+				any_vram_if_possible(fd) : -1;
 	buf = intel_buf_create_full(bops, handle,
 				    fb->width, fb->height,
 				    fb->plane_bpp[0], 0,
@@ -2896,7 +2896,7 @@ static void blitcopy(const struct igt_fb *dst_fb,
 		vm = xe_vm_create(dst_fb->fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
 		exec_queue = xe_exec_queue_create(dst_fb->fd, vm, &inst, 0);
 		xe_ctx = intel_ctx_xe(dst_fb->fd, vm, exec_queue, 0, 0, 0);
-		mem_region = vram_if_possible(dst_fb->fd, 0);
+		mem_region = any_vram_if_possible(dst_fb->fd);
 
 		ahnd = intel_allocator_open_full(dst_fb->fd, xe_ctx->vm, 0, 0,
 						 INTEL_ALLOCATOR_SIMPLE,
lib/intel_batchbuffer.c +2 -2
index 947726caf..53d4f8626 100644
@@ -945,7 +945,7 @@ __intel_bb_create(int fd, uint32_t ctx, uint32_t vm, const intel_ctx_cfg_t *cfg,
 
 		ibb->alignment = xe_get_default_alignment(fd);
 		size = ALIGN(size, ibb->alignment);
-		ibb->handle = xe_bo_create(fd, 0, size, vram_if_possible(fd, 0),
+		ibb->handle = xe_bo_create(fd, 0, size, any_vram_if_possible(fd),
 					   DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 
 		/* Limit to 48-bit due to MI_* address limitation */
@@ -1406,7 +1406,7 @@ void intel_bb_reset(struct intel_bb *ibb, bool purge_objects_cache)
 		ibb->handle = gem_create(ibb->fd, ibb->size);
 	else
 		ibb->handle = xe_bo_create(ibb->fd, 0, ibb->size,
-					   vram_if_possible(ibb->fd, 0),
+					   any_vram_if_possible(ibb->fd),
 					   DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 
 	/* Reacquire offset for RELOC and SIMPLE */
lib/xe/xe_query.c +47 -13

109 lines not on this page · raw message

lib/xe/xe_query.h +4 -2
index 0faa9c284..839ab548e 100644
@@ -79,8 +79,10 @@ struct xe_device {
 unsigned int xe_number_gt(int fd);
 uint64_t all_memory_regions(int fd);
 uint64_t system_memory(int fd);
-uint64_t vram_memory(int fd, int gt);
-uint64_t vram_if_possible(int fd, int gt);
+uint64_t any_vram(int fd);
+uint64_t vram_near_gt(int fd, int gt);
+uint64_t any_vram_if_possible(int fd);
+uint64_t vram_near_gt_if_possible(int fd, int gt);
 struct drm_xe_query_engine_info *xe_engines(int fd);
 struct drm_xe_query_engine_info *xe_engine(int fd, int idx);
 struct drm_xe_query_mem_region *xe_mem_region(int fd, uint64_t region);
lib/xe/xe_spin.c +2 -2
index 3641811d1..0aeddb9ac 100644
@@ -221,7 +221,7 @@ xe_spin_create(int fd, const struct igt_spin_factory *opt)
 	}
 
 	spin->handle = xe_bo_create(fd, spin->vm, bo_size,
-				    vram_if_possible(fd, 0),
+				    any_vram_if_possible(fd),
 				    DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	xe_spin = xe_bo_map(fd, spin->handle, bo_size);
 	addr = intel_allocator_alloc_with_strategy(ahnd, spin->handle, bo_size, 0, ALLOC_STRATEGY_LOW_TO_HIGH);
@@ -301,7 +301,7 @@ void xe_cork_init(int fd, struct drm_xe_engine_class_instance *eci,
 
 	vm = xe_vm_create(fd, 0, 0);
 
-	bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, eci->gt_id),
+	bo = xe_bo_create(fd, vm, bo_size, vram_near_gt_if_possible(fd, eci->gt_id),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	spin = xe_bo_map(fd, bo, 0x1000);
 
tests/intel/kms_big_fb.c +4 -4
index fde73bac0..6e860dbe7 100644
@@ -73,7 +73,7 @@ static struct intel_buf *init_buf(data_t *data,
 	enum intel_driver driver = buf_ops_get_driver(data->bops);
 	uint32_t name, handle, tiling, stride, width, height, bpp, size;
 	uint64_t region = driver == INTEL_DRIVER_XE ?
-				vram_if_possible(data->drm_fd, 0) : -1;
+				any_vram_if_possible(data->drm_fd) : -1;
 
 	igt_assert_eq(fb->offsets[0], 0);
 
@@ -780,7 +780,7 @@ test_size_overflow(data_t *data)
 		bo = xe_bo_create(data->drm_fd, 0,
 				  ALIGN(((1ULL << 32) - 4096),
 					xe_get_default_alignment(data->drm_fd)),
-				  vram_if_possible(data->drm_fd, 0), 0);
+				  any_vram_if_possible(data->drm_fd), 0);
 	igt_require(bo);
 
 	ret = __kms_addfb(data->drm_fd, bo,
@@ -840,7 +840,7 @@ test_size_offset_overflow(data_t *data)
 		bo = xe_bo_create(data->drm_fd, 0,
 				  ALIGN(((1ULL << 32) - 4096),
 					xe_get_default_alignment(data->drm_fd)),
-				  vram_if_possible(data->drm_fd, 0), 0);
+				  any_vram_if_possible(data->drm_fd), 0);
 	igt_require(bo);
 
 	offsets[0] = 0;
@@ -928,7 +928,7 @@ test_addfb(data_t *data)
 	else
 		bo = xe_bo_create(data->drm_fd, 0,
 				  ALIGN(size, xe_get_default_alignment(data->drm_fd)),
-				  vram_if_possible(data->drm_fd, 0), 0);
+				  any_vram_if_possible(data->drm_fd), 0);
 	igt_require(bo);
 
 	if (is_i915_device(data->drm_fd) && intel_display_ver(data->devid) < 4)
tests/intel/kms_ccs.c +1 -1
index 87f29170a..1dcfe5f48 100644
@@ -435,7 +435,7 @@ static void test_bad_ccs_plane(data_t *data, int width, int height, int ccs_plan
 		bad_ccs_bo = is_i915_device(data->drm_fd) ?
 				gem_create(data->drm_fd, fb.size) :
 				xe_bo_create(data->drm_fd, 0, fb.size,
-					     vram_if_possible(data->drm_fd, 0),
+					     any_vram_if_possible(data->drm_fd),
 					     DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		f.handles[ccs_plane] = bad_ccs_bo;
 	}
tests/intel/kms_psr.c +1 -1
index ffecc5222..36e3810ca 100644
@@ -339,7 +339,7 @@ static struct intel_buf *create_buf_from_fb(data_t *data,
 	struct intel_buf *buf;
 	enum intel_driver driver = buf_ops_get_driver(data->bops);
 	uint64_t region = (driver == INTEL_DRIVER_XE) ?
-				vram_if_possible(data->drm_fd, 0) : -1;
+				any_vram_if_possible(data->drm_fd) : -1;
 
 	igt_assert_eq(fb->offsets[0], 0);
 
tests/intel/xe_dma_buf_sync.c +1 -1
index 2298bd84a..86441864e 100644
@@ -120,7 +120,7 @@ test_export_dma_buf(struct drm_xe_engine_class_instance *eci0,
 			xe_get_default_alignment(fd[0]));
 	for (i = 0; i < n_bo; ++i) {
 		bo[i] = xe_bo_create(fd[0], 0, bo_size,
-				     vram_if_possible(fd[0], eci0->gt_id),
+				     vram_near_gt_if_possible(fd[0], eci0->gt_id),
 				     DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		dma_buf_fd[i] = prime_handle_to_fd(fd[0], bo[i]);
 		import_bo[i] = prime_fd_to_handle(fd[1], dma_buf_fd[i]);
tests/intel/xe_evict.c +6 -6
index e30a03a2a..536c38bed 100644
@@ -103,17 +103,17 @@ test_evict(int fd, struct drm_xe_engine_class_instance *eci,
 			if (flags & MULTI_VM) {
 				__bo = bo[i] = xe_bo_create(fd, 0,
 							    bo_size,
-							    vram_memory(fd, eci->gt_id),
+							    vram_near_gt(fd, eci->gt_id),
 							    DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 			} else if (flags & THREADED) {
 				__bo = bo[i] = xe_bo_create(fd, vm,
 							    bo_size,
-							    vram_memory(fd, eci->gt_id),
+							    vram_near_gt(fd, eci->gt_id),
 							    DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 			} else {
 				__bo = bo[i] = xe_bo_create(fd, _vm,
 							    bo_size,
-							    vram_memory(fd, eci->gt_id) |
+							    vram_near_gt(fd, eci->gt_id) |
 							    system_memory(fd),
 							    DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 			}
@@ -283,17 +283,17 @@ test_evict_cm(int fd, struct drm_xe_engine_class_instance *eci,
 			if (flags & MULTI_VM) {
 				__bo = bo[i] = xe_bo_create(fd, 0,
 							    bo_size,
-							    vram_memory(fd, eci->gt_id),
+							    vram_near_gt(fd, eci->gt_id),
 							    DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 			} else if (flags & THREADED) {
 				__bo = bo[i] = xe_bo_create(fd, vm,
 							    bo_size,
-							    vram_memory(fd, eci->gt_id),
+							    vram_near_gt(fd, eci->gt_id),
 							    DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 			} else {
 				__bo = bo[i] = xe_bo_create(fd, _vm,
 							    bo_size,
-							    vram_memory(fd, eci->gt_id) |
+							    vram_near_gt(fd, eci->gt_id) |
 							    system_memory(fd),
 							    DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 			}
tests/intel/xe_evict_ccs.c +4 -4
index 4cafbf02e..1876d200c 100644
@@ -82,7 +82,7 @@ static void copy_obj(struct blt_copy_data *blt,
 	w = src_obj->x2;
 	h = src_obj->y2;
 
-	bb = xe_bo_create(fd, 0, bb_size, vram_memory(fd, 0),
+	bb = xe_bo_create(fd, 0, bb_size, any_vram(fd),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 
 	blt->color_depth = CD_32bit;
@@ -91,7 +91,7 @@ static void copy_obj(struct blt_copy_data *blt,
 	blt_set_copy_object(&blt->dst, dst_obj);
 	blt_set_object_ext(&ext.src, 0, w, h, SURFACE_TYPE_2D);
 	blt_set_object_ext(&ext.dst, 0, w, h, SURFACE_TYPE_2D);
-	blt_set_batch(&blt->bb, bb, bb_size, vram_if_possible(fd, 0));
+	blt_set_batch(&blt->bb, bb, bb_size, any_vram_if_possible(fd));
 	blt_block_copy(fd, ctx, NULL, ahnd, blt, &ext);
 	intel_ctx_xe_sync(ctx, true);
 
@@ -149,7 +149,7 @@ static struct object *create_obj(struct blt_copy_data *blt,
 				T_LINEAR, COMPRESSION_DISABLED,
 				COMPRESSION_TYPE_3D, true);
 
-	obj->blt_obj = blt_create_object(blt, vram_memory(fd, 0),
+	obj->blt_obj = blt_create_object(blt, any_vram(fd),
 					 w, h, 32, uc_mocs,
 					 T_LINEAR,
 					 disable_compression ? COMPRESSION_DISABLED :
@@ -276,7 +276,7 @@ static void evict_single(int fd, int child, const struct config *config)
 
 		if (config->flags & TEST_SIMPLE) {
 			big_obj = xe_bo_create(fd, vm, kb_left * SZ_1K,
-					       vram_memory(fd, 0), 0);
+					       any_vram(fd), 0);
 			break;
 		}
 
tests/intel/xe_exec_balancer.c +3 -3
index 7d124fb67..e06414c14 100644
@@ -72,7 +72,7 @@ static void test_all_active(int fd, int gt, int class)
 	bo_size = sizeof(*data) * num_placements;
 	bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd), xe_get_default_alignment(fd));
 
-	bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, gt),
+	bo = xe_bo_create(fd, vm, bo_size, vram_near_gt_if_possible(fd, gt),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(fd, bo, bo_size);
 
@@ -229,7 +229,7 @@ test_exec(int fd, int gt, int class, int n_exec_queues, int n_execs,
 		}
 		memset(data, 0, bo_size);
 	} else {
-		bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, gt),
+		bo = xe_bo_create(fd, vm, bo_size, vram_near_gt_if_possible(fd, gt),
 				  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		data = xe_bo_map(fd, bo, bo_size);
 	}
@@ -459,7 +459,7 @@ test_cm(int fd, int gt, int class, int n_exec_queues, int n_execs,
 			igt_assert(data);
 		}
 	} else {
-		bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, gt),
+		bo = xe_bo_create(fd, vm, bo_size, vram_near_gt_if_possible(fd, gt),
 				  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		data = xe_bo_map(fd, bo, bo_size);
 	}
tests/intel/xe_exec_basic.c +1 -1
index 4a2dc1866..923e8d2db 100644
@@ -143,7 +143,7 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 			bo_flags |= DRM_XE_GEM_CREATE_FLAG_DEFER_BACKING;
 
 		bo = xe_bo_create(fd, n_vm == 1 ? vm[0] : 0, bo_size,
-				  vram_if_possible(fd, eci->gt_id), bo_flags);
+				  vram_near_gt_if_possible(fd, eci->gt_id), bo_flags);
 		if (!(flags & DEFER_BIND))
 			data = xe_bo_map(fd, bo, bo_size);
 	}
tests/intel/xe_exec_compute_mode.c +1 -1
index 35f9b555d..ba0f09104 100644
@@ -143,7 +143,7 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 		}
 	} else {
 		bo = xe_bo_create(fd, flags & VM_FOR_BO ? vm : 0,
-				  bo_size, vram_if_possible(fd, eci->gt_id),
+				  bo_size, vram_near_gt_if_possible(fd, eci->gt_id),
 				  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		data = xe_bo_map(fd, bo, bo_size);
 	}
tests/intel/xe_exec_fault_mode.c +2 -2
index 14545973b..1b2024f38 100644
@@ -154,11 +154,11 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 		if (flags & PREFETCH)
 			bo = xe_bo_create(fd, 0, bo_size,
 					  all_memory_regions(fd) |
-					  vram_if_possible(fd, 0),
+					  any_vram_if_possible(fd),
 					  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		else
 			bo = xe_bo_create(fd, 0, bo_size,
-					  vram_if_possible(fd, eci->gt_id),
+					  vram_near_gt_if_possible(fd, eci->gt_id),
 					  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		data = xe_bo_map(fd, bo, bo_size);
 	}
tests/intel/xe_exec_reset.c +5 -5
index d85734229..72a9d902d 100644
@@ -53,7 +53,7 @@ static void test_spin(int fd, struct drm_xe_engine_class_instance *eci)
 			xe_get_default_alignment(fd));
 
 	bo = xe_bo_create(fd, vm, bo_size,
-			  vram_if_possible(fd, eci->gt_id),
+			  vram_near_gt_if_possible(fd, eci->gt_id),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	spin = xe_bo_map(fd, bo, bo_size);
 
@@ -186,7 +186,7 @@ test_balancer(int fd, int gt, int class, int n_exec_queues, int n_execs,
 	bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd),
 			xe_get_default_alignment(fd));
 
-	bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, gt),
+	bo = xe_bo_create(fd, vm, bo_size, vram_near_gt_if_possible(fd, gt),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(fd, bo, bo_size);
 
@@ -376,7 +376,7 @@ test_legacy_mode(int fd, struct drm_xe_engine_class_instance *eci,
 			xe_get_default_alignment(fd));
 
 	bo = xe_bo_create(fd, vm, bo_size,
-			  vram_if_possible(fd, eci->gt_id),
+			  vram_near_gt_if_possible(fd, eci->gt_id),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(fd, bo, bo_size);
 
@@ -545,7 +545,7 @@ test_compute_mode(int fd, struct drm_xe_engine_class_instance *eci,
 			xe_get_default_alignment(fd));
 
 	bo = xe_bo_create(fd, vm, bo_size,
-			  vram_if_possible(fd, eci->gt_id),
+			  vram_near_gt_if_possible(fd, eci->gt_id),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(fd, bo, bo_size);
 	memset(data, 0, bo_size);
@@ -672,7 +672,7 @@ static void submit_jobs(struct gt_thread_data *t)
 	uint32_t bo;
 	uint32_t *data;
 
-	bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, 0),
+	bo = xe_bo_create(fd, vm, bo_size, any_vram_if_possible(fd),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(fd, bo, bo_size);
 	data[0] = MI_BATCH_BUFFER_END;
tests/intel/xe_exec_store.c +3 -3
index f41926819..bee279014 100644
@@ -83,7 +83,7 @@ static void store(int fd)
 
 	engine = xe_engine(fd, 1);
 	bo = xe_bo_create(fd, vm, bo_size,
-			  vram_if_possible(fd, engine->instance.gt_id),
+			  vram_near_gt_if_possible(fd, engine->instance.gt_id),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 
 	xe_vm_bind_async(fd, vm, engine->instance.gt_id, bo, 0, addr, bo_size, &sync, 1);
@@ -155,7 +155,7 @@ static void store_cachelines(int fd, struct drm_xe_engine_class_instance *eci,
 
 	for (i = 0; i < count; i++) {
 		bo[i] = xe_bo_create(fd, vm, bo_size,
-				     vram_if_possible(fd, eci->gt_id),
+				     vram_near_gt_if_possible(fd, eci->gt_id),
 				     DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		bo_map[i] = xe_bo_map(fd, bo[i], bo_size);
 		dst_offset[i] = intel_allocator_alloc_with_strategy(ahnd, bo[i],
@@ -243,7 +243,7 @@ static void store_all(int fd, int gt, int class)
 			xe_get_default_alignment(fd));
 
 	bo = xe_bo_create(fd, vm, bo_size,
-			  vram_if_possible(fd, 0),
+			  any_vram_if_possible(fd),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(fd, bo, bo_size);
 
tests/intel/xe_exec_threads.c +3 -3
index 9060d36e1..7ad2233dc 100644
@@ -109,7 +109,7 @@ test_balancer(int fd, int gt, uint32_t vm, uint64_t addr, uint64_t userptr,
 		}
 	} else {
 		bo = xe_bo_create(fd, vm, bo_size,
-				  vram_if_possible(fd, gt),
+				  vram_near_gt_if_possible(fd, gt),
 				  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		data = xe_bo_map(fd, bo, bo_size);
 	}
@@ -312,7 +312,7 @@ test_compute_mode(int fd, uint32_t vm, uint64_t addr, uint64_t userptr,
 		}
 	} else {
 		bo = xe_bo_create(fd, 0, bo_size,
-				  vram_if_possible(fd, eci->gt_id),
+				  vram_near_gt_if_possible(fd, eci->gt_id),
 				  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		data = xe_bo_map(fd, bo, bo_size);
 	}
@@ -518,7 +518,7 @@ test_legacy_mode(int fd, uint32_t vm, uint64_t addr, uint64_t userptr,
 		}
 	} else {
 		bo = xe_bo_create(fd, vm, bo_size,
-				  vram_if_possible(fd, eci->gt_id),
+				  vram_near_gt_if_possible(fd, eci->gt_id),
 				  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		data = xe_bo_map(fd, bo, bo_size);
 	}
tests/intel/xe_guc_pc.c +1 -1
index 210cc4aa4..b04a145be 100644
@@ -68,7 +68,7 @@ static void exec_basic(int fd, struct drm_xe_engine_class_instance *eci,
 			xe_get_default_alignment(fd));
 
 	bo = xe_bo_create(fd, vm, bo_size,
-			  vram_if_possible(fd, eci->gt_id),
+			  vram_near_gt_if_possible(fd, eci->gt_id),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(fd, bo, bo_size);
 
tests/intel/xe_mmap.c +9 -9
index d6c8d5114..d7b87f295 100644
@@ -74,7 +74,7 @@ static void test_bad_flags(int fd)
 	uint64_t size = xe_get_default_alignment(fd);
 	struct drm_xe_gem_mmap_offset mmo = {
 		.handle = xe_bo_create(fd, 0, size,
-				       vram_if_possible(fd, 0),
+				       any_vram_if_possible(fd),
 				       DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM),
 		.flags = -1u,
 	};
@@ -95,7 +95,7 @@ static void test_bad_extensions(int fd)
 	struct xe_user_extension ext;
 	struct drm_xe_gem_mmap_offset mmo = {
 		.handle = xe_bo_create(fd, 0, size,
-				       vram_if_possible(fd, 0),
+				       any_vram_if_possible(fd),
 				       DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM),
 	};
 
@@ -117,7 +117,7 @@ static void test_bad_object(int fd)
 	uint64_t size = xe_get_default_alignment(fd);
 	struct drm_xe_gem_mmap_offset mmo = {
 		.handle = xe_bo_create(fd, 0, size,
-				       vram_if_possible(fd, 0),
+				       any_vram_if_possible(fd),
 				       DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM),
 	};
 
@@ -165,13 +165,13 @@ static void test_small_bar(int fd)
 
 	/* 2BIG invalid case */
 	igt_assert_neq(__xe_bo_create(fd, 0, visible_size + page_size,
-				      vram_memory(fd, 0),
+				      any_vram(fd),
 				      DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM,
 				      &bo),
 		       0);
 
 	/* Normal operation */
-	bo = xe_bo_create(fd, 0, visible_size / 4, vram_memory(fd, 0),
+	bo = xe_bo_create(fd, 0, visible_size / 4, any_vram(fd),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	mmo = xe_bo_mmap_offset(fd, bo);
 	map = mmap(NULL, page_size, PROT_WRITE, MAP_SHARED, fd, mmo);
@@ -184,7 +184,7 @@ static void test_small_bar(int fd)
 
 	/* Normal operation with system memory spilling */
 	bo = xe_bo_create(fd, 0, visible_size,
-			  vram_memory(fd, 0) |
+			  any_vram(fd) |
 			  system_memory(fd),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	mmo = xe_bo_mmap_offset(fd, bo);
@@ -197,7 +197,7 @@ static void test_small_bar(int fd)
 	gem_close(fd, bo);
 
 	/* Bogus operation with SIGBUS */
-	bo = xe_bo_create(fd, 0, visible_size + page_size, vram_memory(fd, 0), 0);
+	bo = xe_bo_create(fd, 0, visible_size + page_size, any_vram(fd), 0);
 	mmo = xe_bo_mmap_offset(fd, bo);
 	map = mmap(NULL, page_size, PROT_WRITE, MAP_SHARED, fd, mmo);
 	igt_assert(map != MAP_FAILED);
@@ -217,11 +217,11 @@ igt_main
 		test_mmap(fd, system_memory(fd), 0);
 
 	igt_subtest("vram")
-		test_mmap(fd, vram_memory(fd, 0),
+		test_mmap(fd, any_vram(fd),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 
 	igt_subtest("vram-system")
-		test_mmap(fd, vram_memory(fd, 0) | system_memory(fd),
+		test_mmap(fd, any_vram(fd) | system_memory(fd),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 
 	igt_subtest("bad-flags")
tests/intel/xe_noexec_ping_pong.c +1 -1
index 585af413d..8686206b4 100644
@@ -71,7 +71,7 @@ static void test_ping_pong(int fd, struct drm_xe_query_engine_info *engine)
 				  (unsigned int) vm[i]);
 
 			bo[i][j] = xe_bo_create(fd, vm[i], bo_size,
-						vram_memory(fd, 0), 0);
+						any_vram(fd), 0);
 			xe_vm_bind(fd, vm[i], bo[i][j], 0, 0x40000 + j*bo_size,
 				   bo_size, NULL, 0);
 		}
tests/intel/xe_perf_pmu.c +2 -2
index e1863b35b..c267a464f 100644
@@ -103,7 +103,7 @@ static void test_any_engine_busyness(int fd, struct drm_xe_engine_class_instance
 	bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd),
 			xe_get_default_alignment(fd));
 
-	bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, 0), 0);
+	bo = xe_bo_create(fd, vm, bo_size, any_vram_if_possible(fd), 0);
 	spin = xe_bo_map(fd, bo, bo_size);
 
 	exec_queue = xe_exec_queue_create(fd, vm, eci, 0);
@@ -223,7 +223,7 @@ static void test_engine_group_busyness(int fd, int gt, int class, const char *na
 	bo_size = sizeof(*data) * num_placements;
 	bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd), xe_get_default_alignment(fd));
 
-	bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, 0), 0);
+	bo = xe_bo_create(fd, vm, bo_size, any_vram_if_possible(fd), 0);
 	data = xe_bo_map(fd, bo, bo_size);
 
 	for (i = 0; i < num_placements; i++) {
tests/intel/xe_pm.c +2 -2
index 1288e7b90..e4a410a8a 100644
@@ -274,7 +274,7 @@ test_exec(device_t device, struct drm_xe_engine_class_instance *eci,
 		rpm_usage = igt_pm_get_runtime_usage(device.pci_xe);
 
 	bo = xe_bo_create(device.fd_xe, vm, bo_size,
-			  vram_if_possible(device.fd_xe, eci->gt_id),
+			  vram_near_gt_if_possible(device.fd_xe, eci->gt_id),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(device.fd_xe, bo, bo_size);
 
@@ -390,7 +390,7 @@ static void test_vram_d3cold_threshold(device_t device, int sysfs_fd)
 
 	igt_require(xe_has_vram(device.fd_xe));
 
-	placement = vram_memory(device.fd_xe, 0);
+	placement = any_vram(device.fd_xe);
 	igt_require_f(placement, "Device doesn't support vram memory region\n");
 
 	igt_assert_eq(igt_ioctl(device.fd_xe, DRM_IOCTL_XE_DEVICE_QUERY, &query), 0);
tests/intel/xe_pm_residency.c +1 -1
index db58107ab..b5c304df3 100644
@@ -102,7 +102,7 @@ static void exec_load(int fd, struct drm_xe_engine_class_instance *eci, unsigned
 	bo_size = xe_get_default_alignment(fd);
 
 	bo = xe_bo_create(fd, vm, bo_size,
-			  vram_if_possible(fd, eci->gt_id),
+			  vram_near_gt_if_possible(fd, eci->gt_id),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(fd, bo, bo_size);
 	syncobj = syncobj_create(fd, 0);
tests/intel/xe_prime_self_import.c +9 -9
index 504e6a13d..d608e295a 100644
@@ -114,7 +114,7 @@ static void test_with_fd_dup(void)
 
 	bo_size = get_min_bo_size(fd1, fd2);
 
-	handle = xe_bo_create(fd1, 0, bo_size, vram_if_possible(fd1, 0),
+	handle = xe_bo_create(fd1, 0, bo_size, any_vram_if_possible(fd1),
 			      DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 
 	dma_buf_fd1 = prime_handle_to_fd(fd1, handle);
@@ -151,9 +151,9 @@ static void test_with_two_bos(void)
 
 	bo_size = get_min_bo_size(fd1, fd2);
 
-	handle1 = xe_bo_create(fd1, 0, bo_size, vram_if_possible(fd1, 0),
+	handle1 = xe_bo_create(fd1, 0, bo_size, any_vram_if_possible(fd1),
 			       DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
-	handle2 = xe_bo_create(fd1, 0, bo_size, vram_if_possible(fd1, 0),
+	handle2 = xe_bo_create(fd1, 0, bo_size, any_vram_if_possible(fd1),
 			       DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 
 	dma_buf_fd = prime_handle_to_fd(fd1, handle1);
@@ -193,7 +193,7 @@ static void test_with_one_bo_two_files(void)
 	bo_size = get_min_bo_size(fd1, fd2);
 
 	handle_orig = xe_bo_create(fd1, 0, bo_size,
-				   vram_if_possible(fd1, 0),
+				   any_vram_if_possible(fd1),
 				   DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	dma_buf_fd1 = prime_handle_to_fd(fd1, handle_orig);
 
@@ -229,7 +229,7 @@ static void test_with_one_bo(void)
 
 	bo_size = get_min_bo_size(fd1, fd2);
 
-	handle = xe_bo_create(fd1, 0, bo_size, vram_if_possible(fd1, 0),
+	handle = xe_bo_create(fd1, 0, bo_size, any_vram_if_possible(fd1),
 			      DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 
 	dma_buf_fd = prime_handle_to_fd(fd1, handle);
@@ -320,7 +320,7 @@ static void *thread_fn_reimport_vs_close(void *p)
 	bo_size = xe_get_default_alignment(fds[0]);
 
 	handle = xe_bo_create(fds[0], 0, bo_size,
-			      vram_if_possible(fds[0], 0),
+			      any_vram_if_possible(fds[0]),
 			      DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 
 	fds[1] = prime_handle_to_fd(fds[0], handle);
@@ -365,7 +365,7 @@ static void *thread_fn_export_vs_close(void *p)
 	igt_until_timeout(g_time_out) {
 		/* We want to race gem close against prime export on handle one.*/
 		handle = xe_bo_create(fd, 0, bo_size,
-				      vram_if_possible(fd, 0),
+				      any_vram_if_possible(fd),
 				      DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		if (handle != 1)
 			gem_close(fd, handle);
@@ -463,7 +463,7 @@ static void test_llseek_size(void)
 		int bufsz = xe_get_default_alignment(fd) << i;
 
 		handle = xe_bo_create(fd, 0, bufsz,
-				      vram_if_possible(fd, 0),
+				      any_vram_if_possible(fd),
 				      DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		dma_buf_fd = prime_handle_to_fd(fd, handle);
 
@@ -495,7 +495,7 @@ static void test_llseek_bad(void)
 
 	bo_size = 4 * xe_get_default_alignment(fd);
 	handle = xe_bo_create(fd, 0, bo_size,
-			      vram_if_possible(fd, 0),
+			      any_vram_if_possible(fd),
 			      DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	dma_buf_fd = prime_handle_to_fd(fd, handle);
 
tests/intel/xe_spin_batch.c +1 -1
index 0314a1694..c6f851acc 100644
@@ -170,7 +170,7 @@ static void xe_spin_fixed_duration(int fd)
 	exec_queue = xe_exec_queue_create_class(fd, vm, DRM_XE_ENGINE_CLASS_COPY);
 	ahnd = intel_allocator_open(fd, 0, INTEL_ALLOCATOR_RELOC);
 	bo_size = ALIGN(sizeof(*spin) + xe_cs_prefetch_size(fd), xe_get_default_alignment(fd));
-	bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, 0), 0);
+	bo = xe_bo_create(fd, vm, bo_size, any_vram_if_possible(fd), 0);
 	spin = xe_bo_map(fd, bo, bo_size);
 	spin_addr = intel_allocator_alloc_with_strategy(ahnd, bo, bo_size, 0,
 							ALLOC_STRATEGY_LOW_TO_HIGH);
tests/intel/xe_vm.c +11 -11
index 79dcc23a9..660ff7c4a 100644
@@ -52,7 +52,7 @@ write_dwords(int fd, uint32_t vm, int n_dwords, uint64_t *addrs)
 	batch_size = ALIGN(batch_size + xe_cs_prefetch_size(fd),
 			   xe_get_default_alignment(fd));
 	batch_bo = xe_bo_create(fd, vm, batch_size,
-				vram_if_possible(fd, 0),
+				any_vram_if_possible(fd),
 				DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	batch_map = xe_bo_map(fd, batch_bo, batch_size);
 
@@ -117,7 +117,7 @@ __test_bind_one_bo(int fd, uint32_t vm, int n_addrs, uint64_t *addrs)
 		vms = malloc(sizeof(*vms) * n_addrs);
 		igt_assert(vms);
 	}
-	bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, 0),
+	bo = xe_bo_create(fd, vm, bo_size, any_vram_if_possible(fd),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	map = xe_bo_map(fd, bo, bo_size);
 	memset(map, 0, bo_size);
@@ -269,7 +269,7 @@ static void test_partial_unbinds(int fd)
 {
 	uint32_t vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
 	size_t bo_size = 3 * xe_get_default_alignment(fd);
-	uint32_t bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, 0), 0);
+	uint32_t bo = xe_bo_create(fd, vm, bo_size, any_vram_if_possible(fd), 0);
 	uint64_t unbind_size = bo_size / 3;
 	uint64_t addr = 0x1a0000;
 
@@ -320,7 +320,7 @@ static void unbind_all(int fd, int n_vmas)
 	};
 
 	vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
-	bo = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, 0), 0);
+	bo = xe_bo_create(fd, vm, bo_size, any_vram_if_possible(fd), 0);
 
 	for (i = 0; i < n_vmas; ++i)
 		xe_vm_bind_async(fd, vm, 0, bo, 0, addr + i * bo_size,
@@ -425,7 +425,7 @@ shared_pte_page(int fd, struct drm_xe_engine_class_instance *eci, int n_bo,
 
 	for (i = 0; i < n_bo; ++i) {
 		bo[i] = xe_bo_create(fd, vm, bo_size,
-				     vram_if_possible(fd, eci->gt_id),
+				     vram_near_gt_if_possible(fd, eci->gt_id),
 				     DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		data[i] = xe_bo_map(fd, bo[i], bo_size);
 	}
@@ -607,7 +607,7 @@ test_bind_execqueues_independent(int fd, struct drm_xe_engine_class_instance *ec
 	bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd),
 			xe_get_default_alignment(fd));
 	bo = xe_bo_create(fd, vm, bo_size,
-			  vram_if_possible(fd, eci->gt_id),
+			  vram_near_gt_if_possible(fd, eci->gt_id),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(fd, bo, bo_size);
 
@@ -791,7 +791,7 @@ test_bind_array(int fd, struct drm_xe_engine_class_instance *eci, int n_execs,
 			xe_get_default_alignment(fd));
 
 	bo = xe_bo_create(fd, vm, bo_size,
-			  vram_if_possible(fd, eci->gt_id),
+			  vram_near_gt_if_possible(fd, eci->gt_id),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(fd, bo, bo_size);
 
@@ -992,7 +992,7 @@ test_large_binds(int fd, struct drm_xe_engine_class_instance *eci,
 			    xe_visible_vram_size(fd, 0));
 
 		bo = xe_bo_create(fd, vm, bo_size,
-				  vram_if_possible(fd, eci->gt_id),
+				  vram_near_gt_if_possible(fd, eci->gt_id),
 				  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		map = xe_bo_map(fd, bo, bo_size);
 	}
@@ -1288,7 +1288,7 @@ test_munmap_style_unbind(int fd, struct drm_xe_engine_class_instance *eci,
 		igt_assert(map != MAP_FAILED);
 	} else {
 		bo = xe_bo_create(fd, vm, bo_size,
-				  vram_if_possible(fd, eci->gt_id),
+				  vram_near_gt_if_possible(fd, eci->gt_id),
 				  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		map = xe_bo_map(fd, bo, bo_size);
 	}
@@ -1593,9 +1593,9 @@ test_mmap_style_bind(int fd, struct drm_xe_engine_class_instance *eci,
 		igt_assert(map0 != MAP_FAILED);
 		igt_assert(map1 != MAP_FAILED);
 	} else {
-		bo0 = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, eci->gt_id), 0);
+		bo0 = xe_bo_create(fd, vm, bo_size, vram_near_gt_if_possible(fd, eci->gt_id), 0);
 		map0 = xe_bo_map(fd, bo0, bo_size);
-		bo1 = xe_bo_create(fd, vm, bo_size, vram_if_possible(fd, eci->gt_id), 0);
+		bo1 = xe_bo_create(fd, vm, bo_size, vram_near_gt_if_possible(fd, eci->gt_id), 0);
 		map1 = xe_bo_map(fd, bo1, bo_size);
 	}
 	memset(map0, 0, bo_size);
tests/intel/xe_waitfence.c +7 -7
index fe033e987..0835a1ff1 100644
@@ -64,19 +64,19 @@ waitfence(int fd, enum waittype wt)
 	int64_t timeout;
 
 	uint32_t vm = xe_vm_create(fd, DRM_XE_VM_CREATE_FLAG_ASYNC_DEFAULT, 0);
-	bo_1 = xe_bo_create(fd, vm, 0x40000, vram_if_possible(fd, 0), 0);
+	bo_1 = xe_bo_create(fd, vm, 0x40000, any_vram_if_possible(fd), 0);
 	do_bind(fd, vm, bo_1, 0, 0x200000, 0x40000, 1);
-	bo_2 = xe_bo_create(fd, vm, 0x40000, vram_if_possible(fd, 0), 0);
+	bo_2 = xe_bo_create(fd, vm, 0x40000, any_vram_if_possible(fd), 0);
 	do_bind(fd, vm, bo_2, 0, 0xc0000000, 0x40000, 2);
-	bo_3 = xe_bo_create(fd, vm, 0x40000, vram_if_possible(fd, 0), 0);
+	bo_3 = xe_bo_create(fd, vm, 0x40000, any_vram_if_possible(fd), 0);
 	do_bind(fd, vm, bo_3, 0, 0x180000000, 0x40000, 3);
-	bo_4 = xe_bo_create(fd, vm, 0x10000, vram_if_possible(fd, 0), 0);
+	bo_4 = xe_bo_create(fd, vm, 0x10000, any_vram_if_possible(fd), 0);
 	do_bind(fd, vm, bo_4, 0, 0x140000000, 0x10000, 4);
-	bo_5 = xe_bo_create(fd, vm, 0x100000, vram_if_possible(fd, 0), 0);
+	bo_5 = xe_bo_create(fd, vm, 0x100000, any_vram_if_possible(fd), 0);
 	do_bind(fd, vm, bo_5, 0, 0x100000000, 0x100000, 5);
-	bo_6 = xe_bo_create(fd, vm, 0x1c0000, vram_if_possible(fd, 0), 0);
+	bo_6 = xe_bo_create(fd, vm, 0x1c0000, any_vram_if_possible(fd), 0);
 	do_bind(fd, vm, bo_6, 0, 0xc0040000, 0x1c0000, 6);
-	bo_7 = xe_bo_create(fd, vm, 0x10000, vram_if_possible(fd, 0), 0);
+	bo_7 = xe_bo_create(fd, vm, 0x10000, any_vram_if_possible(fd), 0);
 	do_bind(fd, vm, bo_7, 0, 0xeffff0000, 0x10000, 7);
 
 	if (wt == RELTIME) {
tests/kms_getfb.c +1 -1
index 6f8592d3a..ae3114585 100644
@@ -149,7 +149,7 @@ static void get_ccs_fb(int fd, struct drm_mode_fb_cmd2 *ret)
 	if (is_i915_device(fd))
 		add.handles[0] = gem_buffer_create_fb_obj(fd, size);
 	else
-		add.handles[0] = xe_bo_create(fd, 0, size, vram_if_possible(fd, 0), 0);
+		add.handles[0] = xe_bo_create(fd, 0, size, any_vram_if_possible(fd), 0);
 	igt_require(add.handles[0] != 0);
 
 	if (!HAS_FLATCCS(devid))
Signature · 1 line
2.34.1
#38 lore raw

PATCH v3 38/57 xe: Do not stash vram_size

In reply to Francois Dugast

From: Rodrigo Vivi <[email protected]>

Do not stash extra information. The queries are already stashed, we just need to navigate the structs.

This is a preparation patch to move the memory masks from GT to Engine. So, let's avoid having extra stashed arrays.

---
 lib/xe/xe_query.c | 48 ++++++++++++++---------------------------------
 lib/xe/xe_query.h |  6 ------
 2 files changed, 14 insertions(+), 40 deletions(-)
lib/xe/xe_query.c +14 -34
index 1d2ce38d9..dbb47ad59 100644
@@ -127,28 +127,6 @@ static uint64_t mem_region_near_gt(const struct drm_xe_query_gt_list *gt_list, i
 	return region;
 }
 
-static uint64_t gt_vram_size(const struct drm_xe_query_mem_regions *mem_regions,
-			     const struct drm_xe_query_gt_list *gt_list, int gt)
-{
-	int region_idx = ffs(mem_region_near_gt(gt_list, gt)) - 1;
-
-	if (XE_IS_CLASS_VRAM(&mem_regions->regions[region_idx]))
-		return mem_regions->regions[region_idx].total_size;
-
-	return 0;
-}
-
-static uint64_t gt_visible_vram_size(const struct drm_xe_query_mem_regions *mem_regions,
-				     const struct drm_xe_query_gt_list *gt_list, int gt)
-{
-	int region_idx = ffs(mem_region_near_gt(gt_list, gt)) - 1;
-
-	if (XE_IS_CLASS_VRAM(&mem_regions->regions[region_idx]))
-		return mem_regions->regions[region_idx].cpu_visible_size;
-
-	return 0;
-}
-
 static bool __mem_has_vram(struct drm_xe_query_mem_regions *mem_regions)
 {
 	for (int i = 0; i < mem_regions->num_regions; i++)
@@ -221,7 +199,6 @@ static void xe_device_free(struct xe_device *xe_dev)
 	free(xe_dev->gt_list);
 	free(xe_dev->engines);
 	free(xe_dev->mem_regions);
-	free(xe_dev->vram_size);
 	free(xe_dev);
 }
 
@@ -253,15 +230,6 @@ struct xe_device *xe_device_get(int fd)
 	xe_dev->engines = xe_query_engines(fd, &xe_dev->number_engines);
 	xe_dev->mem_regions = xe_query_mem_regions_new(fd);
 	xe_dev->all_memory_regions_mask = __all_memory_regions(xe_dev->mem_regions);
-	xe_dev->vram_size = calloc(xe_dev->gt_list->num_gt, sizeof(*xe_dev->vram_size));
-	xe_dev->visible_vram_size = calloc(xe_dev->gt_list->num_gt, sizeof(*xe_dev->visible_vram_size));
-	for (int gt = 0; gt < xe_dev->gt_list->num_gt; gt++) {
-		xe_dev->vram_size[gt] = gt_vram_size(xe_dev->mem_regions,
-						     xe_dev->gt_list, gt);
-		xe_dev->visible_vram_size[gt] =
-			gt_visible_vram_size(xe_dev->mem_regions,
-					     xe_dev->gt_list, gt);
-	}
 	xe_dev->default_alignment = __mem_default_alignment(xe_dev->mem_regions);
 	xe_dev->has_vram = __mem_has_vram(xe_dev->mem_regions);
 
@@ -580,7 +548,13 @@ uint64_t xe_vram_size(int fd, int gt)
 	xe_dev = find_in_cache(fd);
 	igt_assert(xe_dev);
 
-	return xe_dev->vram_size[gt];
+	for (int i = 0; i < xe_dev->mem_regions->num_regions; i++)
+		if (XE_IS_CLASS_VRAM(&xe_dev->mem_regions->regions[i]) &&
+		    ((1 << xe_dev->mem_regions->regions[i].instance) &
+		     mem_region_near_gt(xe_dev->gt_list, gt)))
+			return xe_dev->mem_regions->regions[i].total_size;
+
+	return 0;
 }
 
 /**
@@ -597,7 +571,13 @@ uint64_t xe_visible_vram_size(int fd, int gt)
 	xe_dev = find_in_cache(fd);
 	igt_assert(xe_dev);
 
-	return xe_dev->visible_vram_size[gt];
+	for (int i = 0; i < xe_dev->mem_regions->num_regions; i++)
+		if (XE_IS_CLASS_VRAM(&xe_dev->mem_regions->regions[i]) &&
+		    ((1 << xe_dev->mem_regions->regions[i].instance) &
+		     mem_region_near_gt(xe_dev->gt_list, gt)))
+			return xe_dev->mem_regions->regions[i].cpu_visible_size;
+
+	return 0;
 }
 
 /**
lib/xe/xe_query.h +0 -6
index 839ab548e..c0446060d 100644
@@ -41,12 +41,6 @@ struct xe_device {
 	/** @mem_regions: regions memory information and usage */
 	struct drm_xe_query_mem_regions *mem_regions;
 
-	/** @vram_size: array of vram sizes for all gt_list */
-	uint64_t *vram_size;
-
-	/** @visible_vram_size: array of visible vram sizes for all gt_list */
-	uint64_t *visible_vram_size;
-
 	/** @default_alignment: safe alignment regardless region location */
 	uint32_t default_alignment;
 
Signature · 1 line
2.34.1
#39 lore raw

PATCH v3 39/57 xe: Also be specific on VRAM selection when inspecting its sizes

In reply to Francois Dugast

From: Rodrigo Vivi <[email protected]>

The VRAM selection was split, but the size continued to be mixed up. This needs to be also split so the memory_region mask can be moved from GT to the engine info.

This patch is not attempting to close any gap of fix any of the regions selections and it should have absolutely no functional impact.

---
 lib/xe/xe_query.c                 | 37 ++++++++++++++++++++++---------
 lib/xe/xe_query.h                 |  5 +++--
 tests/intel/xe_evict.c            |  2 +-
 tests/intel/xe_evict_ccs.c        |  4 ++--
 tests/intel/xe_mmap.c             |  6 ++---
 tests/intel/xe_noexec_ping_pong.c |  2 +-
 tests/intel/xe_sysfs_tile.c       |  3 ++-
 tests/intel/xe_vm.c               |  4 ++--
 8 files changed, 41 insertions(+), 22 deletions(-)
lib/xe/xe_query.c +27 -10
index dbb47ad59..a1d4aa44c 100644
@@ -535,13 +535,12 @@ xe_dev_FN(xe_number_engines, number_engines, unsigned int);
 xe_dev_FN(xe_has_vram, has_vram, bool);
 
 /**
- * xe_vram_size:
+ * xe_vram_size_any_region:
  * @fd: xe device fd
- * @gt: gt
  *
- * Returns size of vram of xe device @fd.
+ * Returns size of any vram region of this device.
  */
-uint64_t xe_vram_size(int fd, int gt)
+uint64_t xe_vram_size_any_region(int fd)
 {
 	struct xe_device *xe_dev;
 
@@ -549,22 +548,20 @@ uint64_t xe_vram_size(int fd, int gt)
 	igt_assert(xe_dev);
 
 	for (int i = 0; i < xe_dev->mem_regions->num_regions; i++)
-		if (XE_IS_CLASS_VRAM(&xe_dev->mem_regions->regions[i]) &&
-		    ((1 << xe_dev->mem_regions->regions[i].instance) &
-		     mem_region_near_gt(xe_dev->gt_list, gt)))
+		if (XE_IS_CLASS_VRAM(&xe_dev->mem_regions->regions[i]))
 			return xe_dev->mem_regions->regions[i].total_size;
 
 	return 0;
 }
 
 /**
- * xe_visible_vram_size:
+ * xe_vram_size_region_near_gt:
  * @fd: xe device fd
  * @gt: gt
  *
- * Returns size of visible vram of xe device @fd.
+ * Returns size of vram region given a @gt id of this device.
  */
-uint64_t xe_visible_vram_size(int fd, int gt)
+uint64_t xe_vram_size_region_near_gt(int fd, int gt)
 {
 	struct xe_device *xe_dev;
 
@@ -575,6 +572,26 @@ uint64_t xe_visible_vram_size(int fd, int gt)
 		if (XE_IS_CLASS_VRAM(&xe_dev->mem_regions->regions[i]) &&
 		    ((1 << xe_dev->mem_regions->regions[i].instance) &
 		     mem_region_near_gt(xe_dev->gt_list, gt)))
+			return xe_dev->mem_regions->regions[i].total_size;
+
+	return 0;
+}
+
+/**
+ * xe_visible_vram_size_any_region:
+ * @fd: xe device fd
+ *
+ * Returns size of visible size of any vram of this device.
+ */
+uint64_t xe_visible_vram_size_any_region(int fd)
+{
+	struct xe_device *xe_dev;
+
+	xe_dev = find_in_cache(fd);
+	igt_assert(xe_dev);
+
+	for (int i = 0; i < xe_dev->mem_regions->num_regions; i++)
+		if (XE_IS_CLASS_VRAM(&xe_dev->mem_regions->regions[i]))
 			return xe_dev->mem_regions->regions[i].cpu_visible_size;
 
 	return 0;
lib/xe/xe_query.h +3 -2
index c0446060d..f0a3382f2 100644
@@ -86,8 +86,9 @@ uint32_t xe_min_page_size(int fd, uint64_t region);
 struct drm_xe_query_config *xe_config(int fd);
 unsigned int xe_number_engines(int fd);
 bool xe_has_vram(int fd);
-uint64_t xe_vram_size(int fd, int gt);
-uint64_t xe_visible_vram_size(int fd, int gt);
+uint64_t xe_vram_size_any_region(int fd);
+uint64_t xe_vram_size_region_near_gt(int fd, int gt);
+uint64_t xe_visible_vram_size_any_region(int fd);
 uint64_t xe_vram_available(int fd, int gt);
 uint32_t xe_get_default_alignment(int fd);
 uint32_t xe_va_bits(int fd);
tests/intel/xe_evict.c +1 -1
index 536c38bed..1c8d52358 100644
@@ -759,7 +759,7 @@ igt_main
 	igt_fixture {
 		fd = drm_open_driver(DRIVER_XE);
 		igt_require(xe_has_vram(fd));
-		vram_size = xe_visible_vram_size(fd, 0);
+		vram_size = xe_visible_vram_size_any_region(fd);
 		igt_assert(vram_size);
 
 		xe_for_each_engine_instance(fd, eci)
tests/intel/xe_evict_ccs.c +2 -2
index 1876d200c..c72f24181 100644
@@ -325,7 +325,7 @@ static void set_config(int fd, uint32_t flags, const struct param *param,
 
 	config->param = param;
 	config->flags = flags;
-	config->free_mb = xe_visible_vram_size(fd, 0) / SZ_1M;
+	config->free_mb = xe_visible_vram_size_any_region(fd) / SZ_1M;
 	config->total_mb = xe_vram_available(fd, 0) / SZ_1M;
 	config->test_mb = min_t(int, config->free_mb * config->param->vram_percent / 100,
 				config->total_mb * config->param->vram_percent / 100);
@@ -496,7 +496,7 @@ igt_main_args("bdDn:p:s:S:V", NULL, help_str, opt_handler, NULL)
 	igt_fixture {
 		fd = drm_open_driver(DRIVER_XE);
 		igt_require(xe_has_vram(fd));
-		vram_size = xe_visible_vram_size(fd, 0);
+		vram_size = xe_visible_vram_size_any_region(fd);
 		igt_assert(vram_size);
 	}
 
tests/intel/xe_mmap.c +3 -3
index d7b87f295..f41656b3a 100644
@@ -158,7 +158,7 @@ static void trap_sigbus(uint32_t *ptr)
 static void test_small_bar(int fd)
 {
 	size_t page_size = xe_get_default_alignment(fd);
-	uint32_t visible_size = xe_visible_vram_size(fd, 0);
+	uint32_t visible_size = xe_visible_vram_size_any_region(fd);
 	uint32_t bo;
 	uint64_t mmo;
 	uint32_t *map;
@@ -234,8 +234,8 @@ igt_main
 		test_bad_object(fd);
 
 	igt_subtest("small-bar") {
-		igt_require(xe_visible_vram_size(fd, 0));
-		igt_require(xe_visible_vram_size(fd, 0) < xe_vram_size(fd, 0));
+		igt_require(xe_visible_vram_size_any_region(fd));
+		igt_require(xe_visible_vram_size_any_region(fd) < xe_vram_size_any_region(fd));
 		test_small_bar(fd);
 	}
 
tests/intel/xe_noexec_ping_pong.c +1 -1
index 8686206b4..fa9b284ee 100644
@@ -45,7 +45,7 @@
 
 static void test_ping_pong(int fd, struct drm_xe_query_engine_info *engine)
 {
-	size_t vram_size = xe_vram_size(fd, 0);
+	size_t vram_size = xe_vram_size_any_region(fd);
 	size_t align = xe_get_default_alignment(fd);
 	size_t bo_size = vram_size / NUM_VMS / NUM_BOS;
 	uint32_t vm[NUM_VMS];
tests/intel/xe_sysfs_tile.c +2 -1
index ba970cda8..b21fac0cd 100644
@@ -47,7 +47,8 @@ igt_main
 	igt_subtest("physical_vram_size_bytes") {
 		igt_require(xe_has_vram(fd));
 		for_each_sysfs_tile_dirfd(fd, tilefd, tile) {
-			vram_size = xe_vram_size(fd, tile);
+			/* FIXME: Tile and GT mixed misusage */
+			vram_size = xe_vram_size_region_near_gt(fd, tile);
 			test_vram_physical_vram_size_bytes(tilefd, tile, vram_size);
 		}
 	}
tests/intel/xe_vm.c +2 -2
index 660ff7c4a..bd64efad6 100644
@@ -988,8 +988,8 @@ test_large_binds(int fd, struct drm_xe_engine_class_instance *eci,
 		map = aligned_alloc(xe_get_default_alignment(fd), bo_size);
 		igt_assert(map);
 	} else {
-		igt_skip_on(xe_visible_vram_size(fd, 0) && bo_size >
-			    xe_visible_vram_size(fd, 0));
+		igt_skip_on(xe_visible_vram_size_any_region(fd) && bo_size >
+			    xe_visible_vram_size_any_region(fd));
 
 		bo = xe_bo_create(fd, vm, bo_size,
 				  vram_near_gt_if_possible(fd, eci->gt_id),
Signature · 1 line
2.34.1
#40 lore raw

PATCH v3 40/57 lib/xe: Get current available size and sync with the 'any gt'.

In reply to Francois Dugast

From: Rodrigo Vivi <[email protected]>

First of all, get the current available size, not a cached value that we are not sure how old it is.

Also, remove the 'gt' selection number to align with all the other 'any_region' variants.

Then sync all the loops so we guarantee that the region where we are inspecting the sizes are exactly the same where we are allocating the BO: 'any first vram region'.

---
 lib/xe/xe_query.c          | 44 +++++++++++++++++++-------------------
 lib/xe/xe_query.h          |  2 +-
 tests/intel/xe_evict_ccs.c |  2 +-
 3 files changed, 24 insertions(+), 24 deletions(-)
lib/xe/xe_query.c +22 -22
index a1d4aa44c..20d6690f7 100644
@@ -598,37 +598,37 @@ uint64_t xe_visible_vram_size_any_region(int fd)
 }
 
 /**
- * xe_vram_available:
+ * xe_vram_available_any_region:
  * @fd: xe device fd
- * @gt: gt
  *
- * Returns available vram of xe device @fd and @gt.
+ * Returns available vram of any first available region of this device.
+ * It can be used in conjunction with visible_size functions of any
+ * region since the 'any region' selection will end up in the same
+ * region.
  */
-uint64_t xe_vram_available(int fd, int gt)
+uint64_t xe_vram_available_any_region(int fd)
 {
-	struct xe_device *xe_dev;
-	int region_idx;
-	struct drm_xe_query_mem_region *mem_region;
 	struct drm_xe_query_mem_regions *mem_regions;
+	struct drm_xe_device_query query = {
+		.extensions = 0,
+		.query = DRM_XE_DEVICE_QUERY_MEM_REGIONS,
+		.size = 0,
+		.data = 0,
+	};
 
-	xe_dev = find_in_cache(fd);
-	igt_assert(xe_dev);
-
-	region_idx = ffs(mem_region_near_gt(xe_dev->gt_list, gt)) - 1;
-	mem_region = &xe_dev->mem_regions->regions[region_idx];
+	igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_DEVICE_QUERY, &query), 0);
+	igt_assert_neq(query.size, 0);
 
-	if (XE_IS_CLASS_VRAM(mem_region)) {
-		uint64_t available_vram;
+	mem_regions = malloc(query.size);
+	igt_assert(mem_regions);
 
-		mem_regions = xe_query_mem_regions_new(fd);
-		pthread_mutex_lock(&cache.cache_mutex);
-		mem_region->used = mem_regions->regions[region_idx].used;
-		available_vram = mem_region->total_size - mem_region->used;
-		pthread_mutex_unlock(&cache.cache_mutex);
-		free(mem_regions);
+	query.data = to_user_pointer(mem_regions);
+	igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_DEVICE_QUERY, &query), 0);
 
-		return available_vram;
-	}
+	for (int i = 0; i < mem_regions->num_regions; i++)
+		if (XE_IS_CLASS_VRAM(&mem_regions->regions[i]))
+			return mem_regions->regions[i].total_size -
+				mem_regions->regions[i].used;
 
 	return 0;
 }
lib/xe/xe_query.h +1 -1
index f0a3382f2..bec2a7ed6 100644
@@ -89,7 +89,7 @@ bool xe_has_vram(int fd);
 uint64_t xe_vram_size_any_region(int fd);
 uint64_t xe_vram_size_region_near_gt(int fd, int gt);
 uint64_t xe_visible_vram_size_any_region(int fd);
-uint64_t xe_vram_available(int fd, int gt);
+uint64_t xe_vram_available_any_region(int fd);
 uint32_t xe_get_default_alignment(int fd);
 uint32_t xe_va_bits(int fd);
 uint16_t xe_dev_id(int fd);
tests/intel/xe_evict_ccs.c +1 -1
index c72f24181..7ed2bd41d 100644
@@ -326,7 +326,7 @@ static void set_config(int fd, uint32_t flags, const struct param *param,
 	config->param = param;
 	config->flags = flags;
 	config->free_mb = xe_visible_vram_size_any_region(fd) / SZ_1M;
-	config->total_mb = xe_vram_available(fd, 0) / SZ_1M;
+	config->total_mb = xe_vram_available_any_region(fd) / SZ_1M;
 	config->test_mb = min_t(int, config->free_mb * config->param->vram_percent / 100,
 				config->total_mb * config->param->vram_percent / 100);
 
Signature · 1 line
2.34.1
#41 lore raw

PATCH v3 41/57 tests/intel/xe_query: Fix test_query_engines

In reply to Francois Dugast

From: Rodrigo Vivi <[email protected]>

Let's not confuse gt_id with tile_id.

Also, make test_query_engines to really query for the info instead of just printing the info.

---
 tests/intel/xe_query.c | 32 ++++++++++++++++++++++++++------
 1 file changed, 26 insertions(+), 6 deletions(-)
tests/intel/xe_query.c +26 -6
index 80510146f..16097cba7 100644
@@ -172,23 +172,43 @@ const char *get_topo_name(int value)
 
 /**
  * SUBTEST: query-engines
- * Description: Display engine classes available for xe device
+ * Description: Display engines available for xe device
  * Test category: functionality test
  */
 static void
 test_query_engines(int fd)
 {
+	struct drm_xe_query_engine_info *engines;
 	struct drm_xe_engine_class_instance *eci;
-	int i = 0;
+	struct drm_xe_device_query query = {
+		.extensions = 0,
+		.query = DRM_XE_DEVICE_QUERY_ENGINES,
+		.size = 0,
+		.data = 0,
+	};
+	int num_engines, i;
 
-	xe_for_each_engine_instance(fd, eci) {
+	igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_DEVICE_QUERY, &query), 0);
+
+	engines = malloc(query.size);
+	igt_assert(engines);
+
+	query.data = to_user_pointer(engines);
+	igt_assert_eq(igt_ioctl(fd, DRM_IOCTL_XE_DEVICE_QUERY, &query), 0);
+
+	num_engines = query.size / sizeof(*engines);
+
+	for (i = 0; i < num_engines; i++) {
+		eci = &engines[i].instance;
 		igt_assert(eci);
-		igt_info("engine %d: %s, engine instance: %d, tile: TILE-%d\n", i++,
-			 xe_engine_class_string(eci->engine_class), eci->engine_instance,
-								    eci->gt_id);
+		igt_info("engine %d: %s, engine instance: %d, gt: GT-%d\n", i,
+			 xe_engine_class_string(eci->engine_class),
+			 eci->engine_instance,
+			 eci->gt_id);
 	}
 
 	igt_assert(i > 0);
+	free(engines);
 }
 
 /**
Signature · 1 line
2.34.1
#42 lore raw

PATCH v3 42/57 drm-uapi/xe: Move memory_region masks from GT to engine

In reply to Francois Dugast

From: Rodrigo Vivi <[email protected]>

Align with kernel commit ("drm/xe/uapi: Move memory_region masks from GT to engine")

---
 benchmarks/gem_wsim.c              |  2 +-
 include/drm-uapi/xe_drm.h          | 27 ++++++++-------
 lib/xe/xe_query.c                  | 54 +++++++++++++++++++-----------
 lib/xe/xe_query.h                  |  8 +++--
 lib/xe/xe_spin.c                   |  2 +-
 tests/intel/xe_dma_buf_sync.c      |  2 +-
 tests/intel/xe_evict.c             | 12 +++----
 tests/intel/xe_exec_balancer.c     |  6 ++--
 tests/intel/xe_exec_basic.c        |  2 +-
 tests/intel/xe_exec_compute_mode.c |  2 +-
 tests/intel/xe_exec_fault_mode.c   |  2 +-
 tests/intel/xe_exec_reset.c        |  8 ++---
 tests/intel/xe_exec_store.c        |  4 +--
 tests/intel/xe_exec_threads.c      |  6 ++--
 tests/intel/xe_guc_pc.c            |  2 +-
 tests/intel/xe_pm.c                |  2 +-
 tests/intel/xe_pm_residency.c      |  2 +-
 tests/intel/xe_query.c             |  8 ++---
 tests/intel/xe_vm.c                | 14 ++++----
 19 files changed, 93 insertions(+), 72 deletions(-)
benchmarks/gem_wsim.c +1 -1
index 5ba5f2e2c..5154974e3 100644
@@ -1735,7 +1735,7 @@ xe_alloc_step_batch(struct workload *wrk, struct w_step *w)
 	int i;
 
 	w->bb_handle = xe_bo_create(fd, vm->id, PAGE_SIZE,
-				    vram_near_gt_if_possible(fd, eq->eci_list[0].gt_id),
+				    vram_near_eci_if_possible(fd, &eq->eci_list[0]),
 				    DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	w->xe.data = xe_bo_map(fd, w->bb_handle, PAGE_SIZE);
 	w->xe.exec.address =
include/drm-uapi/xe_drm.h +14 -13
index 83e5b629a..be30d506c 100644
@@ -228,6 +228,20 @@ struct drm_xe_query_engine_info {
 	/** @instance: The @drm_xe_engine_class_instance */
 	struct drm_xe_engine_class_instance instance;
 
+	/**
+	 * @near_mem_regions: Bit mask of instances from
+	 * drm_xe_query_mem_regions that is near this engine.
+	 */
+	__u64 near_mem_regions;
+	/**
+	 * @far_mem_regions: Bit mask of instances from
+	 * drm_xe_query_mem_regions that is far from this engine.
+	 * In general, it has extra indirections when compared to the
+	 * @near_mem_regions. For a discrete device this could mean system
+	 * memory and memory living in a different Tile.
+	 */
+	__u64 far_mem_regions;
+
 	/** @reserved: Reserved */
 	__u64 reserved[5];
 };
@@ -404,19 +418,6 @@ struct drm_xe_query_gt {
 	__u16 gt_id;
 	/** @clock_freq: A clock frequency for timestamp */
 	__u32 clock_freq;
-	/**
-	 * @near_mem_regions: Bit mask of instances from
-	 * drm_xe_query_mem_regions that is near the current engines of this GT.
-	 */
-	__u64 near_mem_regions;
-	/**
-	 * @far_mem_regions: Bit mask of instances from
-	 * drm_xe_query_mem_regions that is far from the engines of this GT.
-	 * In general, it has extra indirections when compared to the
-	 * @near_mem_regions. For a discrete device this could mean system
-	 * memory and memory living in a different Tile.
-	 */
-	__u64 far_mem_regions;
 	/** @reserved: Reserved */
 	__u64 reserved[8];
 };
lib/xe/xe_query.c +35 -19

100 lines not on this page · raw message

lib/xe/xe_query.h +6 -2
index bec2a7ed6..3eee75ff4 100644
@@ -54,6 +54,9 @@ struct xe_device {
 	uint16_t dev_id;
 };
 
+#define xe_for_each_engine(__fd, __engine) \
+	for (int __i = 0; __i < xe_number_engines(__fd) && \
+	     (__engine = xe_engine(__fd, __i)); ++__i)
 #define xe_for_each_engine_instance(__fd, __eci) \
 	for (int __i = 0; __i < xe_number_engines(__fd) && \
 	     (__eci = &xe_engine(__fd, __i)->instance); ++__i)
@@ -74,9 +77,9 @@ unsigned int xe_number_gt(int fd);
 uint64_t all_memory_regions(int fd);
 uint64_t system_memory(int fd);
 uint64_t any_vram(int fd);
-uint64_t vram_near_gt(int fd, int gt);
+uint64_t vram_near_eci(int fd, struct drm_xe_engine_class_instance *eci);
 uint64_t any_vram_if_possible(int fd);
-uint64_t vram_near_gt_if_possible(int fd, int gt);
+uint64_t vram_near_eci_if_possible(int fd, struct drm_xe_engine_class_instance *eci);
 struct drm_xe_query_engine_info *xe_engines(int fd);
 struct drm_xe_query_engine_info *xe_engine(int fd, int idx);
 struct drm_xe_query_mem_region *xe_mem_region(int fd, uint64_t region);
@@ -90,6 +93,7 @@ uint64_t xe_vram_size_any_region(int fd);
 uint64_t xe_vram_size_region_near_gt(int fd, int gt);
 uint64_t xe_visible_vram_size_any_region(int fd);
 uint64_t xe_vram_available_any_region(int fd);
+uint64_t xe_visible_vram_size_region_near_gt(int fd, int gt);
 uint32_t xe_get_default_alignment(int fd);
 uint32_t xe_va_bits(int fd);
 uint16_t xe_dev_id(int fd);
lib/xe/xe_spin.c +1 -1
index 0aeddb9ac..506ddc090 100644
@@ -301,7 +301,7 @@ void xe_cork_init(int fd, struct drm_xe_engine_class_instance *eci,
 
 	vm = xe_vm_create(fd, 0, 0);
 
-	bo = xe_bo_create(fd, vm, bo_size, vram_near_gt_if_possible(fd, eci->gt_id),
+	bo = xe_bo_create(fd, vm, bo_size, vram_near_eci_if_possible(fd, eci),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	spin = xe_bo_map(fd, bo, 0x1000);
 
tests/intel/xe_dma_buf_sync.c +1 -1
index 86441864e..9a42f8e35 100644
@@ -120,7 +120,7 @@ test_export_dma_buf(struct drm_xe_engine_class_instance *eci0,
 			xe_get_default_alignment(fd[0]));
 	for (i = 0; i < n_bo; ++i) {
 		bo[i] = xe_bo_create(fd[0], 0, bo_size,
-				     vram_near_gt_if_possible(fd[0], eci0->gt_id),
+				     vram_near_eci_if_possible(fd[0], eci0),
 				     DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		dma_buf_fd[i] = prime_handle_to_fd(fd[0], bo[i]);
 		import_bo[i] = prime_fd_to_handle(fd[1], dma_buf_fd[i]);
tests/intel/xe_evict.c +6 -6
index 1c8d52358..2a667a679 100644
@@ -103,17 +103,17 @@ test_evict(int fd, struct drm_xe_engine_class_instance *eci,
 			if (flags & MULTI_VM) {
 				__bo = bo[i] = xe_bo_create(fd, 0,
 							    bo_size,
-							    vram_near_gt(fd, eci->gt_id),
+							    vram_near_eci(fd, eci),
 							    DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 			} else if (flags & THREADED) {
 				__bo = bo[i] = xe_bo_create(fd, vm,
 							    bo_size,
-							    vram_near_gt(fd, eci->gt_id),
+							    vram_near_eci(fd, eci),
 							    DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 			} else {
 				__bo = bo[i] = xe_bo_create(fd, _vm,
 							    bo_size,
-							    vram_near_gt(fd, eci->gt_id) |
+							    vram_near_eci(fd, eci) |
 							    system_memory(fd),
 							    DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 			}
@@ -283,17 +283,17 @@ test_evict_cm(int fd, struct drm_xe_engine_class_instance *eci,
 			if (flags & MULTI_VM) {
 				__bo = bo[i] = xe_bo_create(fd, 0,
 							    bo_size,
-							    vram_near_gt(fd, eci->gt_id),
+							    vram_near_eci(fd, eci),
 							    DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 			} else if (flags & THREADED) {
 				__bo = bo[i] = xe_bo_create(fd, vm,
 							    bo_size,
-							    vram_near_gt(fd, eci->gt_id),
+							    vram_near_eci(fd, eci),
 							    DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 			} else {
 				__bo = bo[i] = xe_bo_create(fd, _vm,
 							    bo_size,
-							    vram_near_gt(fd, eci->gt_id) |
+							    vram_near_eci(fd, eci) |
 							    system_memory(fd),
 							    DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 			}
tests/intel/xe_exec_balancer.c +3 -3
index e06414c14..22fce66f7 100644
@@ -72,7 +72,7 @@ static void test_all_active(int fd, int gt, int class)
 	bo_size = sizeof(*data) * num_placements;
 	bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd), xe_get_default_alignment(fd));
 
-	bo = xe_bo_create(fd, vm, bo_size, vram_near_gt_if_possible(fd, gt),
+	bo = xe_bo_create(fd, vm, bo_size, vram_near_eci_if_possible(fd, &eci_list[0]),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(fd, bo, bo_size);
 
@@ -229,7 +229,7 @@ test_exec(int fd, int gt, int class, int n_exec_queues, int n_execs,
 		}
 		memset(data, 0, bo_size);
 	} else {
-		bo = xe_bo_create(fd, vm, bo_size, vram_near_gt_if_possible(fd, gt),
+		bo = xe_bo_create(fd, vm, bo_size, vram_near_eci_if_possible(fd, &eci_list[0]),
 				  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		data = xe_bo_map(fd, bo, bo_size);
 	}
@@ -459,7 +459,7 @@ test_cm(int fd, int gt, int class, int n_exec_queues, int n_execs,
 			igt_assert(data);
 		}
 	} else {
-		bo = xe_bo_create(fd, vm, bo_size, vram_near_gt_if_possible(fd, gt),
+		bo = xe_bo_create(fd, vm, bo_size, vram_near_eci_if_possible(fd, &eci_list[0]),
 				  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		data = xe_bo_map(fd, bo, bo_size);
 	}
tests/intel/xe_exec_basic.c +1 -1
index 923e8d2db..5b1fe6469 100644
@@ -143,7 +143,7 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 			bo_flags |= DRM_XE_GEM_CREATE_FLAG_DEFER_BACKING;
 
 		bo = xe_bo_create(fd, n_vm == 1 ? vm[0] : 0, bo_size,
-				  vram_near_gt_if_possible(fd, eci->gt_id), bo_flags);
+				  vram_near_eci_if_possible(fd, eci), bo_flags);
 		if (!(flags & DEFER_BIND))
 			data = xe_bo_map(fd, bo, bo_size);
 	}
tests/intel/xe_exec_compute_mode.c +1 -1
index ba0f09104..91c2319e7 100644
@@ -143,7 +143,7 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 		}
 	} else {
 		bo = xe_bo_create(fd, flags & VM_FOR_BO ? vm : 0,
-				  bo_size, vram_near_gt_if_possible(fd, eci->gt_id),
+				  bo_size, vram_near_eci_if_possible(fd, eci),
 				  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		data = xe_bo_map(fd, bo, bo_size);
 	}
tests/intel/xe_exec_fault_mode.c +1 -1
index 1b2024f38..7f5ad8701 100644
@@ -158,7 +158,7 @@ test_exec(int fd, struct drm_xe_engine_class_instance *eci,
 					  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		else
 			bo = xe_bo_create(fd, 0, bo_size,
-					  vram_near_gt_if_possible(fd, eci->gt_id),
+					  vram_near_eci_if_possible(fd, eci),
 					  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		data = xe_bo_map(fd, bo, bo_size);
 	}
tests/intel/xe_exec_reset.c +4 -4
index 72a9d902d..119356338 100644
@@ -53,7 +53,7 @@ static void test_spin(int fd, struct drm_xe_engine_class_instance *eci)
 			xe_get_default_alignment(fd));
 
 	bo = xe_bo_create(fd, vm, bo_size,
-			  vram_near_gt_if_possible(fd, eci->gt_id),
+			  vram_near_eci_if_possible(fd, eci),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	spin = xe_bo_map(fd, bo, bo_size);
 
@@ -186,7 +186,7 @@ test_balancer(int fd, int gt, int class, int n_exec_queues, int n_execs,
 	bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd),
 			xe_get_default_alignment(fd));
 
-	bo = xe_bo_create(fd, vm, bo_size, vram_near_gt_if_possible(fd, gt),
+	bo = xe_bo_create(fd, vm, bo_size, vram_near_eci_if_possible(fd, &eci_list[0]),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(fd, bo, bo_size);
 
@@ -376,7 +376,7 @@ test_legacy_mode(int fd, struct drm_xe_engine_class_instance *eci,
 			xe_get_default_alignment(fd));
 
 	bo = xe_bo_create(fd, vm, bo_size,
-			  vram_near_gt_if_possible(fd, eci->gt_id),
+			  vram_near_eci_if_possible(fd, eci),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(fd, bo, bo_size);
 
@@ -545,7 +545,7 @@ test_compute_mode(int fd, struct drm_xe_engine_class_instance *eci,
 			xe_get_default_alignment(fd));
 
 	bo = xe_bo_create(fd, vm, bo_size,
-			  vram_near_gt_if_possible(fd, eci->gt_id),
+			  vram_near_eci_if_possible(fd, eci),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(fd, bo, bo_size);
 	memset(data, 0, bo_size);
tests/intel/xe_exec_store.c +2 -2
index bee279014..265cc6601 100644
@@ -83,7 +83,7 @@ static void store(int fd)
 
 	engine = xe_engine(fd, 1);
 	bo = xe_bo_create(fd, vm, bo_size,
-			  vram_near_gt_if_possible(fd, engine->instance.gt_id),
+			  vram_near_eci_if_possible(fd, &engine->instance),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 
 	xe_vm_bind_async(fd, vm, engine->instance.gt_id, bo, 0, addr, bo_size, &sync, 1);
@@ -155,7 +155,7 @@ static void store_cachelines(int fd, struct drm_xe_engine_class_instance *eci,
 
 	for (i = 0; i < count; i++) {
 		bo[i] = xe_bo_create(fd, vm, bo_size,
-				     vram_near_gt_if_possible(fd, eci->gt_id),
+				     vram_near_eci_if_possible(fd, eci),
 				     DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		bo_map[i] = xe_bo_map(fd, bo[i], bo_size);
 		dst_offset[i] = intel_allocator_alloc_with_strategy(ahnd, bo[i],
tests/intel/xe_exec_threads.c +3 -3
index 7ad2233dc..fa8ef8645 100644
@@ -109,7 +109,7 @@ test_balancer(int fd, int gt, uint32_t vm, uint64_t addr, uint64_t userptr,
 		}
 	} else {
 		bo = xe_bo_create(fd, vm, bo_size,
-				  vram_near_gt_if_possible(fd, gt),
+				  vram_near_eci_if_possible(fd, &eci_list[0]),
 				  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		data = xe_bo_map(fd, bo, bo_size);
 	}
@@ -312,7 +312,7 @@ test_compute_mode(int fd, uint32_t vm, uint64_t addr, uint64_t userptr,
 		}
 	} else {
 		bo = xe_bo_create(fd, 0, bo_size,
-				  vram_near_gt_if_possible(fd, eci->gt_id),
+				  vram_near_eci_if_possible(fd, eci),
 				  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		data = xe_bo_map(fd, bo, bo_size);
 	}
@@ -518,7 +518,7 @@ test_legacy_mode(int fd, uint32_t vm, uint64_t addr, uint64_t userptr,
 		}
 	} else {
 		bo = xe_bo_create(fd, vm, bo_size,
-				  vram_near_gt_if_possible(fd, eci->gt_id),
+				  vram_near_eci_if_possible(fd, eci),
 				  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		data = xe_bo_map(fd, bo, bo_size);
 	}
tests/intel/xe_guc_pc.c +1 -1
index b04a145be..a36f6542b 100644
@@ -68,7 +68,7 @@ static void exec_basic(int fd, struct drm_xe_engine_class_instance *eci,
 			xe_get_default_alignment(fd));
 
 	bo = xe_bo_create(fd, vm, bo_size,
-			  vram_near_gt_if_possible(fd, eci->gt_id),
+			  vram_near_eci_if_possible(fd, eci),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(fd, bo, bo_size);
 
tests/intel/xe_pm.c +1 -1
index e4a410a8a..3c0aed4f9 100644
@@ -274,7 +274,7 @@ test_exec(device_t device, struct drm_xe_engine_class_instance *eci,
 		rpm_usage = igt_pm_get_runtime_usage(device.pci_xe);
 
 	bo = xe_bo_create(device.fd_xe, vm, bo_size,
-			  vram_near_gt_if_possible(device.fd_xe, eci->gt_id),
+			  vram_near_eci_if_possible(device.fd_xe, eci),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(device.fd_xe, bo, bo_size);
 
tests/intel/xe_pm_residency.c +1 -1
index b5c304df3..f701696ac 100644
@@ -102,7 +102,7 @@ static void exec_load(int fd, struct drm_xe_engine_class_instance *eci, unsigned
 	bo_size = xe_get_default_alignment(fd);
 
 	bo = xe_bo_create(fd, vm, bo_size,
-			  vram_near_gt_if_possible(fd, eci->gt_id),
+			  vram_near_eci_if_possible(fd, eci),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(fd, bo, bo_size);
 	syncobj = syncobj_create(fd, 0);
tests/intel/xe_query.c +4 -4
index 16097cba7..ea98ace5c 100644
@@ -205,6 +205,10 @@ test_query_engines(int fd)
 			 xe_engine_class_string(eci->engine_class),
 			 eci->engine_instance,
 			 eci->gt_id);
+		igt_info("near_mem_regions: 0x%016llx\n",
+			 engines[i].near_mem_regions);
+		igt_info("far_mem_regions: 0x%016llx\n",
+			 engines[i].far_mem_regions);
 	}
 
 	igt_assert(i > 0);
@@ -301,10 +305,6 @@ test_query_gt_list(int fd)
 		igt_info("type: %d\n", gt_list->gt_list[i].type);
 		igt_info("gt_id: %d\n", gt_list->gt_list[i].gt_id);
 		igt_info("clock_freq: %u\n", gt_list->gt_list[i].clock_freq);
-		igt_info("near_mem_regions: 0x%016llx\n",
-		       gt_list->gt_list[i].near_mem_regions);
-		igt_info("far_mem_regions: 0x%016llx\n",
-		       gt_list->gt_list[i].far_mem_regions);
 	}
 }
 
tests/intel/xe_vm.c +7 -7
index bd64efad6..9f42b7133 100644
@@ -425,7 +425,7 @@ shared_pte_page(int fd, struct drm_xe_engine_class_instance *eci, int n_bo,
 
 	for (i = 0; i < n_bo; ++i) {
 		bo[i] = xe_bo_create(fd, vm, bo_size,
-				     vram_near_gt_if_possible(fd, eci->gt_id),
+				     vram_near_eci_if_possible(fd, eci),
 				     DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		data[i] = xe_bo_map(fd, bo[i], bo_size);
 	}
@@ -607,7 +607,7 @@ test_bind_execqueues_independent(int fd, struct drm_xe_engine_class_instance *ec
 	bo_size = ALIGN(bo_size + xe_cs_prefetch_size(fd),
 			xe_get_default_alignment(fd));
 	bo = xe_bo_create(fd, vm, bo_size,
-			  vram_near_gt_if_possible(fd, eci->gt_id),
+			  vram_near_eci_if_possible(fd, eci),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(fd, bo, bo_size);
 
@@ -791,7 +791,7 @@ test_bind_array(int fd, struct drm_xe_engine_class_instance *eci, int n_execs,
 			xe_get_default_alignment(fd));
 
 	bo = xe_bo_create(fd, vm, bo_size,
-			  vram_near_gt_if_possible(fd, eci->gt_id),
+			  vram_near_eci_if_possible(fd, eci),
 			  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 	data = xe_bo_map(fd, bo, bo_size);
 
@@ -992,7 +992,7 @@ test_large_binds(int fd, struct drm_xe_engine_class_instance *eci,
 			    xe_visible_vram_size_any_region(fd));
 
 		bo = xe_bo_create(fd, vm, bo_size,
-				  vram_near_gt_if_possible(fd, eci->gt_id),
+				  vram_near_eci_if_possible(fd, eci),
 				  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		map = xe_bo_map(fd, bo, bo_size);
 	}
@@ -1288,7 +1288,7 @@ test_munmap_style_unbind(int fd, struct drm_xe_engine_class_instance *eci,
 		igt_assert(map != MAP_FAILED);
 	} else {
 		bo = xe_bo_create(fd, vm, bo_size,
-				  vram_near_gt_if_possible(fd, eci->gt_id),
+				  vram_near_eci_if_possible(fd, eci),
 				  DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM);
 		map = xe_bo_map(fd, bo, bo_size);
 	}
@@ -1593,9 +1593,9 @@ test_mmap_style_bind(int fd, struct drm_xe_engine_class_instance *eci,
 		igt_assert(map0 != MAP_FAILED);
 		igt_assert(map1 != MAP_FAILED);
 	} else {
-		bo0 = xe_bo_create(fd, vm, bo_size, vram_near_gt_if_possible(fd, eci->gt_id), 0);
+		bo0 = xe_bo_create(fd, vm, bo_size, vram_near_eci_if_possible(fd, eci), 0);
 		map0 = xe_bo_map(fd, bo0, bo_size);
-		bo1 = xe_bo_create(fd, vm, bo_size, vram_near_gt_if_possible(fd, eci->gt_id), 0);
+		bo1 = xe_bo_create(fd, vm, bo_size, vram_near_eci_if_possible(fd, eci), 0);
 		map1 = xe_bo_map(fd, bo1, bo_size);
 	}
 	memset(map0, 0, bo_size);
Signature · 1 line
2.34.1