Skip to contentSkip to conversation

tests/intel/xe_multi_tile: Multi-Tile support in IGT

PATCH In review [email protected] 3 participants 3 messages Feb 15, 2025 – Feb 17, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/intel/xe_multi_tile: Multi-Tile support in IGT

From: Nishit Sharma <[email protected]>

Added functionality to check Multi-Tile available in system or not. Belonging to each Tile%d GT%d gathered. Checked GT%d belongs to which tile%d in multi-tile/single-tile platforms. Added functionality to check if any tile%d not provided by driver or missed. E.g.tile available in platforms in order tile0, tile1...tileX in serial order, If tile1 tile2 tile4...tileX populated than will get Warning tile3 not available.

---
 include/drm-uapi/xe_drm.h   | 169 ++++++++++++--
 lib/igt_sysfs.c             |   3 +-
 lib/xe/xe_query.h           |  50 ++++-
 tests/intel/xe_multi_tile.c | 432 ++++++++++++++++++++++++++++++++++++
 tests/meson.build           |   1 +
 5 files changed, 620 insertions(+), 35 deletions(-)
 create mode 100644 tests/intel/xe_multi_tile.c
include/drm-uapi/xe_drm.h +146 -23
index 56163eb91..8b0869ce2 100644
@@ -3,8 +3,8 @@
  * Copyright © 2023 Intel Corporation
  */
 
-#ifndef _XE_DRM_H_
-#define _XE_DRM_H_
+#ifndef _UAPI_XE_DRM_H_
+#define _UAPI_XE_DRM_H_
 
 #include "drm.h"
 
@@ -118,6 +118,12 @@ extern "C" {
 #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_OBSERVATION		DRM_IOW(DRM_COMMAND_BASE + DRM_XE_OBSERVATION, struct drm_xe_observation_param)
 
+enum xe_gt_type {
+        XE_GT_TYPE_UNINITIALIZED,
+        XE_GT_TYPE_MAIN,
+        XE_GT_TYPE_MEDIA,
+};
+
 /**
  * DOC: Xe IOCTL Extensions
  *
@@ -227,6 +233,8 @@ struct drm_xe_ext_set_property {
  *  - %DRM_XE_ENGINE_CLASS_VM_BIND - Kernel only classes (not actual
  *    hardware engine class). Used for creating ordered queues of VM
  *    bind operations.
+ *  - %DRM_XE_ENGINE_CLASS_EXT_DECODE - external decoder class
+ *  - %DRM_XE_ENGINE_CLASS_EXT_ENCODE - external encoder class
  */
 struct drm_xe_engine_class_instance {
 #define DRM_XE_ENGINE_CLASS_RENDER		0
@@ -235,6 +243,8 @@ struct drm_xe_engine_class_instance {
 #define DRM_XE_ENGINE_CLASS_VIDEO_ENHANCE	3
 #define DRM_XE_ENGINE_CLASS_COMPUTE		4
 #define DRM_XE_ENGINE_CLASS_VM_BIND		5
+#define DRM_XE_ENGINE_CLASS_EXT_DECODE		6
+#define DRM_XE_ENGINE_CLASS_EXT_ENCODE		7
 	/** @engine_class: engine class id */
 	__u16 engine_class;
 	/** @engine_instance: engine instance id */
@@ -266,8 +276,8 @@ struct drm_xe_engine {
 struct drm_xe_query_engines {
 	/** @num_engines: number of engines returned in @engines */
 	__u32 num_engines;
-	/** @pad: MBZ */
-	__u32 pad;
+	/** @num_ext_engines: num_ext_engines: number of engines returned at the end of @engines */
+	__u32 num_ext_engines;
 	/** @engines: The returned engines for this device */
 	struct drm_xe_engine engines[];
 };
@@ -398,6 +408,7 @@ struct drm_xe_query_mem_regions {
  *  - %DRM_XE_QUERY_CONFIG_VA_BITS - Maximum bits of a virtual address
  *  - %DRM_XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY - Value of the highest
  *    available exec queue priority
+ *  - %DRM_XE_QUERY_CONFIG_CXL_DEV_TYPE - CXL device type, 0 means CXL not supported
  */
 struct drm_xe_query_config {
 	/** @num_params: number of parameters returned in info */
@@ -412,10 +423,96 @@ 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_MAX_EXEC_QUEUE_PRIORITY	4
+#define DRM_XE_QUERY_CONFIG_CXL_DEV_TYPE		5
 	/** @info: array of elements containing the config info */
 	__u64 info[];
 };
 
+/**
+ * struct xe_gt - A "Graphics Technology" unit of the GPU
+ *
+ * A GT ("Graphics Technology") is the subset of a GPU primarily responsible
+ * for implementing the graphics, compute, and/or media IP.
+ *
+ */
+struct xe_gt {
+	/** @tile: Backpointer to GT's tile */
+	struct drm_xe_tile *tile;
+
+	/** @info: GT info */
+	struct {
+		/** @info.type: type of GT */
+		enum xe_gt_type type;
+		/** @info.id: Unique ID of this GT within the PCI Device */
+		__u8 id;
+
+		/**
+		 * @gt_count: Number of GT/s available in tile
+		 * 
+		 * */
+		__u8 gt_count;
+	} info;
+};
+
+/**
+ * struct drm_xe_tile - hardware tile structure
+ *
+ */
+struct drm_xe_tile {
+	/** @xe: Backpointer to tile's PCI device */
+	struct xe_device *xe;
+
+	/** @id: ID of the tile */
+	__u8 id;
+
+	/**
+	 * @vram_id: ID of associated TTM VRAM region
+	 *
+	 * For multi-tile platforms not using unified vram, this is same
+	 * as @id.  Otherwise this is always 0 to denote a single unified
+	 * vram region is in use.
+	 */
+	__u8 vram_id;
+
+	/**
+	 * @mis_tile: Flasg to check if tile ID missing or out of order
+	 *
+	 */
+	__u8 mis_tile:1;
+
+	/**
+	 * @gt_count: Number of GT/s available in tile
+	 *
+	 * */
+	__u8 gt_count;
+
+	/**
+	 * @primary_gt: Primary GT
+	 */
+	struct xe_gt *primary_gt;
+
+	/**
+	 * @media_gt: Media GT
+	 *
+	 * Only present on devices with media version >= 13.
+	 */
+	struct xe_gt *media_gt;
+
+	/**
+	 * @faked_gt: Faked GT
+	 *
+	 * Used for operations requiring GT on devices without GT at all.
+	 * TODO: remove when FSW-10725 is done
+	 */
+	struct xe_gt *faked_gt;
+
+	/**
+	 * @gt_list: List of GT descriptors from driver
+	 *
+	 */
+	struct drm_xe_query_gt_list *gt_list;
+};
+
 /**
  * struct drm_xe_gt - describe an individual GT.
  *
@@ -996,6 +1093,7 @@ struct drm_xe_vm_bind_op {
 #define DRM_XE_VM_BIND_FLAG_IMMEDIATE	(1 << 1)
 #define DRM_XE_VM_BIND_FLAG_NULL	(1 << 2)
 #define DRM_XE_VM_BIND_FLAG_DUMPABLE	(1 << 3)
+/* Bits 16-31 are reserved for prelim flags */
 	/** @flags: Bind flags */
 	__u32 flags;
 
@@ -1110,6 +1208,21 @@ struct drm_xe_exec_queue_create {
 #define DRM_XE_EXEC_QUEUE_EXTENSION_SET_PROPERTY		0
 #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
+/* Monitor 128KB contiguous region with 4K sub-granularity */
+#define     DRM_XE_ACC_GRANULARITY_128K				0
+/* Monitor 2MB contiguous region with 64KB sub-granularity */
+#define     DRM_XE_ACC_GRANULARITY_2M				1
+/* Monitor 16MB contiguous region with 512KB sub-granularity */
+#define     DRM_XE_ACC_GRANULARITY_16M				2
+/* Monitor 64MB contiguous region with 2M sub-granularity */
+#define     DRM_XE_ACC_GRANULARITY_64M				3
+#define DRM_XE_EXEC_QUEUE_EXTENSION_EXT_MEDIA_QUEUE		1
 
 	/** @extensions: Pointer to the first extension struct, if any */
 	__u64 extensions;
@@ -1123,7 +1236,13 @@ struct drm_xe_exec_queue_create {
 	/** @vm_id: VM to use for this exec queue */
 	__u32 vm_id;
 
-	/** @flags: MBZ */
+	/*
+	 * When creating exec queue in MSIX platforms, the user can request a unique MSIX interrupt
+	 * for the irq handler. If there is no available MSIX, -EBUSY will be returned.
+	 */
+#define	DRM_XE_EXEC_QUEUE_CREATE_FLAG_UNIQUE_INTERRUPT_HINT (0x1 << 0)
+
+	/** @flags: create queue flags */
 	__u32 flags;
 
 	/** @exec_queue_id: Returned exec queue ID */
@@ -1254,6 +1373,25 @@ struct drm_xe_sync {
 	__u64 reserved[2];
 };
 
+struct drm_xe_ext_media_queue_create {
+	/** @base: base user extension */
+	struct drm_xe_user_extension base;
+	/** @instance_mask: mask of all external decoders and encoders used by the queue */
+	__u64 instance_mask;
+	/** @csm_addr: control shared memory address */
+	__u64 csm_addr;
+	/** @csm_size: control shared memory size */
+	__u64 csm_size;
+	/** cb_base_addr: command buffer base address */
+	__u64 cb_base_addr;
+	/** cb_size: command buffer size */
+	__u64 cb_size;
+	/** doorbell_handle: doorbell handle */
+	__u64 doorbell_handle;
+	/** @reserved: Reserved */
+	__u64 reserved[2];
+};
+
 /**
  * struct drm_xe_exec - Input of &DRM_IOCTL_XE_EXEC
  *
@@ -1485,7 +1623,6 @@ struct drm_xe_oa_unit {
 	/** @capabilities: OA capabilities bit-mask */
 	__u64 capabilities;
 #define DRM_XE_OA_CAPS_BASE		(1 << 0)
-#define DRM_XE_OA_CAPS_SYNCS		(1 << 1)
 
 	/** @oa_timestamp_freq: OA timestamp freq */
 	__u64 oa_timestamp_freq;
@@ -1635,22 +1772,6 @@ enum drm_xe_oa_property_id {
 	 * to be disabled for the stream exec queue.
 	 */
 	DRM_XE_OA_PROPERTY_NO_PREEMPT,
-
-	/**
-	 * @DRM_XE_OA_PROPERTY_NUM_SYNCS: Number of syncs in the sync array
-	 * specified in @DRM_XE_OA_PROPERTY_SYNCS
-	 */
-	DRM_XE_OA_PROPERTY_NUM_SYNCS,
-
-	/**
-	 * @DRM_XE_OA_PROPERTY_SYNCS: Pointer to struct @drm_xe_sync array
-	 * with array size specified via @DRM_XE_OA_PROPERTY_NUM_SYNCS. OA
-	 * configuration will wait till input fences signal. Output fences
-	 * will signal after the new OA configuration takes effect. For
-	 * @DRM_XE_SYNC_TYPE_USER_FENCE, @addr is a user pointer, similar
-	 * to the VM bind case.
-	 */
-	DRM_XE_OA_PROPERTY_SYNCS,
 };
 
 /**
@@ -1713,8 +1834,10 @@ struct drm_xe_oa_stream_info {
 	__u64 reserved[3];
 };
 
+#include "xe_drm_prelim.h"
+
 #if defined(__cplusplus)
 }
 #endif
 
-#endif /* _XE_DRM_H_ */
+#endif /* _UAPI_XE_DRM_H_ */
lib/igt_sysfs.c +2 -1
index 00d5822fd..37f1716e2 100644
@@ -234,7 +234,8 @@ char *xe_sysfs_gt_path(int xe_device, int gt, char *path, int pathlen)
 
 	if (IS_PONTEVECCHIO(intel_get_drm_devid(xe_device)))
 		snprintf(path, pathlen, "/sys/dev/char/%d:%d/device/tile%d/gt%d",
-			 major(st.st_rdev), minor(st.st_rdev), gt, gt);
+			 major(st.st_rdev), minor(st.st_rdev),
+			 xe_gt_get_tile_id(xe_device, gt), gt);
 	else
 		snprintf(path, pathlen, "/sys/dev/char/%d:%d/device/tile0/gt%d",
 			 major(st.st_rdev), minor(st.st_rdev), gt);
lib/xe/xe_query.h +39 -11

99 lines not on this page · raw message

tests/intel/xe_multi_tile.c new file +432 -0

432 lines not on this page · raw message

tests/meson.build +1 -0
index 2724c7a9a..2cc01aa0c 100644
@@ -292,6 +292,7 @@ intel_xe_progs = [
 	'xe_exec_reset',
 	'xe_exec_sip',
 	'xe_exec_store',
+	'xe_multi_tile',
 	'xe_exec_threads',
 	'xe_exercise_blt',
 	'xe_fault_injection',
Signature · 1 line
2.34.1
#1 lore raw

✗ Fi.CI.BUILD: failure for tests/intel/xe_multi_tile: Multi-Tile support in IGT (rev3)

== Series Details ==

== Series Details ==

Series: tests/intel/xe_multi_tile: Multi-Tile support in IGT (rev3)
URL : https://patchwork.freedesktop.org/series/144187/
State : failure

== Summary ==

Applying: tests/intel/xe_multi_tile: Multi-Tile support in IGT Using index info to reconstruct a base tree...
M include/drm-uapi/xe_drm.h
M lib/igt_sysfs.c
M lib/xe/xe_query.h
M tests/meson.build
Falling back to patching base and 3-way merge...
Auto-merging tests/meson.build
Auto-merging lib/xe/xe_query.h
Auto-merging lib/igt_sysfs.c
Auto-merging include/drm-uapi/xe_drm.h
CONFLICT (content): Merge conflict in include/drm-uapi/xe_drm.h Patch failed at 0001 tests/intel/xe_multi_tile: Multi-Tile support in IGT When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".

#2 lore raw
In reply to [email protected]

Hi nishit.sharma,

Quoted 1 line · On 2025-02-15 at 01:11:55 +0000, [email protected] wrote:

From: Nishit Sharma <[email protected]>

only few nits, first please keep description to 65 columns (or max 80).

Quoted 10 lines

Added functionality to check Multi-Tile available in system or not. Belonging to each Tile%d GT%d gathered. Checked GT%d belongs to which tile%d in multi-tile/single-tile platforms. Added functionality to check if any tile%d not provided by driver or missed. E.g.tile available in platforms in order tile0, tile1...tileX in serial order, If tile1 tile2 tile4...tileX populated than will get Warning tile3 not available.

---
 include/drm-uapi/xe_drm.h   | 169 ++++++++++++--

Change for drm-uapi should go in separate patch, see git log.

Quoted 12 lines
 lib/igt_sysfs.c             |   3 +-
 lib/xe/xe_query.h           |  50 ++++-
 tests/intel/xe_multi_tile.c | 432 ++++++++++++++++++++++++++++++++++++
 tests/meson.build           |   1 +
 5 files changed, 620 insertions(+), 35 deletions(-)
 create mode 100644 tests/intel/xe_multi_tile.c
include/drm-uapi/xe_drm.h +0 -0
index 56163eb91..8b0869ce2 100644

include/drm-uapi/xe_drm.h line 7

Quoted 7 lines
include/drm-uapi/xe_drm.h +2 -2
@@ -3,8 +3,8 @@
  * Copyright © 2023 Intel Corporation
  */
 
-#ifndef _XE_DRM_H_
-#define _XE_DRM_H_
+#ifndef _UAPI_XE_DRM_H_
+#define _UAPI_XE_DRM_H_

This shouldn't change, see README.md about how to bring uapi changes into igt.

Regards,
Kamil

Quoted 7 lines
include/drm-uapi/xe_drm.h +0 -0
 #include "drm.h"
 
@@ -118,6 +118,12 @@ extern "C" {
 #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_OBSERVATION		DRM_IOW(DRM_COMMAND_BASE + DRM_XE_OBSERVATION, struct drm_xe_observation_param)
 

[...cut...]