Skip to contentSkip to conversation

Xe OA Consolidated Diffs

PATCH New Ashutosh Dixit 2 participants 3 messages Jun 12, 2024

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

cover Xe OA Consolidated Diffs

Because Xe OA changes between successive revisions are distributed across multiple patches, I am providing a combined diff of all changes in a single patch to help with the code review.

These changes pertain to: https://patchwork.freedesktop.org/series/121084/

Ashutosh Dixit (1):
drm/xe/oa: Combined diff of changes between v16 and v17

 .../gpu/drm/xe/instructions/xe_mi_commands.h  |  2 -
 drivers/gpu/drm/xe/regs/xe_oa_regs.h          |  5 +-
 drivers/gpu/drm/xe/xe_device.c                |  2 -
 drivers/gpu/drm/xe/xe_guc_pc.c                |  8 +-
 drivers/gpu/drm/xe/xe_guc_pc.h                |  2 +-
 drivers/gpu/drm/xe/xe_module.c                |  1 -
 drivers/gpu/drm/xe/xe_oa.c                    | 95 +++++++++++++++----
 drivers/gpu/drm/xe/xe_oa.h                    |  2 +-
 drivers/gpu/drm/xe/xe_oa_types.h              | 23 +++--
 drivers/gpu/drm/xe/xe_perf.c                  | 27 +++++-
 drivers/gpu/drm/xe/xe_perf.h                  |  4 +-
 include/uapi/drm/xe_drm.h                     | 22 ++++-
 12 files changed, 142 insertions(+), 51 deletions(-)
Signature · 1 line
2.41.0
#1 lore raw

PATCH 1/1 drm/xe/oa: Combined diff of changes between v16 and v17

Because Xe OA changes between successive revisions are distributed across multiple patches, provide a combined diff of all changes in a single patch to help with code review.

These changes pertain to: https://patchwork.freedesktop.org/series/121084/

This patch will not compile, it's purpose is to just provide the diff.

In this version:

* Address review comments from Michal Wajdeczko on v16
* Add kernel doc for non-static functions
* Other small fixes

---
 .../gpu/drm/xe/instructions/xe_mi_commands.h  |  2 -
 drivers/gpu/drm/xe/regs/xe_oa_regs.h          |  5 +-
 drivers/gpu/drm/xe/xe_device.c                |  2 -
 drivers/gpu/drm/xe/xe_guc_pc.c                |  8 +-
 drivers/gpu/drm/xe/xe_guc_pc.h                |  2 +-
 drivers/gpu/drm/xe/xe_module.c                |  1 -
 drivers/gpu/drm/xe/xe_oa.c                    | 95 +++++++++++++++----
 drivers/gpu/drm/xe/xe_oa.h                    |  2 +-
 drivers/gpu/drm/xe/xe_oa_types.h              | 23 +++--
 drivers/gpu/drm/xe/xe_perf.c                  | 27 +++++-
 drivers/gpu/drm/xe/xe_perf.h                  |  4 +-
 include/uapi/drm/xe_drm.h                     | 22 ++++-
 12 files changed, 142 insertions(+), 51 deletions(-)
drivers/gpu/drm/xe/instructions/xe_mi_commands.h +0 -2
index 48d4c759c688..ba4db8913098 100644
@@ -45,8 +45,6 @@
 #define   MI_LRI_MMIO_REMAP_EN		REG_BIT(17)
 #define   MI_LRI_NUM_REGS(x)		XE_INSTR_NUM_DW(2 * (x) + 1)
 #define   MI_LRI_FORCE_POSTED		REG_BIT(12)
-#define   IS_MI_LRI_CMD(x)		(REG_FIELD_GET(MI_OPCODE, (x)) == \
-					 REG_FIELD_GET(MI_OPCODE, MI_LOAD_REGISTER_IMM))
 #define   MI_LRI_LEN(x)			(((x) & 0xff) + 1)
 
 #define MI_FLUSH_DW			__MI_INSTR(0x26)
drivers/gpu/drm/xe/regs/xe_oa_regs.h +1 -4
index d9fcb08f500d..1189f5a540a8 100644
@@ -6,9 +6,6 @@
 #ifndef __XE_OA_REGS__
 #define __XE_OA_REGS__
 
-#define REG_EQUAL(reg, xe_reg) ((reg) == (xe_reg.addr))
-#define REG_EQUAL_MCR(reg, xe_reg) ((reg) == (xe_reg.__reg.addr))
-
 #define RPM_CONFIG1			XE_REG(0xd04)
 #define   GT_NOA_ENABLE			REG_BIT(9)
 
@@ -100,4 +97,4 @@
 #define OAM_STATUS(base)			XE_REG((base) + OAM_STATUS_OFFSET)
 #define OAM_MMIO_TRG(base)			XE_REG((base) + OAM_MMIO_TRG_OFFSET)
 
-#endif /* __XE_OA_REGS__ */
+#endif
drivers/gpu/drm/xe/xe_device.c +0 -2
index d29d8689d4ec..4c8ce3f18cb7 100644
@@ -41,7 +41,6 @@
 #include "xe_memirq.h"
 #include "xe_mmio.h"
 #include "xe_module.h"
-#include "xe_oa.h"
 #include "xe_pat.h"
 #include "xe_pcode.h"
 #include "xe_perf.h"
@@ -709,7 +708,6 @@ static void xe_device_remove_display(struct xe_device *xe)
 
 void xe_device_remove(struct xe_device *xe)
 {
-
 	struct xe_gt *gt;
 	u8 id;
 
drivers/gpu/drm/xe/xe_guc_pc.c +4 -4
index ba0e6e7fd5c6..2b45a9cd3ec0 100644
@@ -193,21 +193,21 @@ static int pc_action_set_param(struct xe_guc_pc *pc, u8 id, u32 value)
 
 static int pc_action_unset_param(struct xe_guc_pc *pc, u8 id)
 {
-	struct xe_guc_ct *ct = &pc_to_guc(pc)->ct;
-	int ret;
 	u32 action[] = {
 		GUC_ACTION_HOST2GUC_PC_SLPC_REQUEST,
 		SLPC_EVENT(SLPC_EVENT_PARAMETER_UNSET, 1),
 		id,
 	};
+	struct xe_guc_ct *ct = &pc_to_guc(pc)->ct;
+	int ret;
 
 	if (wait_for_pc_state(pc, SLPC_GLOBAL_STATE_RUNNING))
 		return -EAGAIN;
 
 	ret = xe_guc_ct_send(ct, action, ARRAY_SIZE(action), 0, 0);
 	if (ret)
-		drm_err(&pc_to_xe(pc)->drm, "GuC PC unset param failed: %pe",
-			ERR_PTR(ret));
+		xe_gt_err(pc_to_gt(pc), "GuC PC unset param failed: %pe",
+			  ERR_PTR(ret));
 
 	return ret;
 }
drivers/gpu/drm/xe/xe_guc_pc.h +1 -1
index eb5bba9f0736..8a7b91ce1b3e 100644
@@ -9,7 +9,7 @@
 #include <linux/types.h>
 
 struct xe_guc_pc;
-#include "abi/guc_actions_slpc_abi.h"
+enum slpc_gucrc_mode;
 
 int xe_guc_pc_init(struct xe_guc_pc *pc);
 int xe_guc_pc_start(struct xe_guc_pc *pc);
drivers/gpu/drm/xe/xe_module.c +0 -1
index 4e9f31f11920..893858a2eea0 100644
@@ -10,7 +10,6 @@
 
 #include "xe_drv.h"
 #include "xe_hw_fence.h"
-#include "xe_oa.h"
 #include "xe_pci.h"
 #include "xe_perf.h"
 #include "xe_sched_job.h"
drivers/gpu/drm/xe/xe_oa.c +74 -21

236 lines not on this page · raw message

drivers/gpu/drm/xe/xe_oa.h +1 -1
index d2f50c3accf3..87a38820c317 100644
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: MIT */
 /*
- * Copyright © 2023 Intel Corporation
+ * Copyright © 2023-2024 Intel Corporation
  */
 
 #ifndef _XE_OA_H_
drivers/gpu/drm/xe/xe_oa_types.h +15 -8
index c62811482934..706d45577dae 100644
@@ -1,15 +1,15 @@
 /* SPDX-License-Identifier: MIT */
 /*
- * Copyright © 2023 Intel Corporation
+ * Copyright © 2023-2024 Intel Corporation
  */
 
 #ifndef _XE_OA_TYPES_H_
 #define _XE_OA_TYPES_H_
 
+#include <linux/bitops.h>
 #include <linux/idr.h>
-#include <linux/math.h>
-#include <linux/types.h>
 #include <linux/mutex.h>
+#include <linux/types.h>
 
 #include <drm/xe_drm.h>
 #include "regs/xe_reg_defs.h"
@@ -53,16 +53,25 @@ enum xe_oa_format_name {
 	XE_OA_FORMAT_PEC36u64_G1_32_G2_4,
 	XE_OA_FORMAT_PEC36u64_G1_4_G2_32,
 
-	XE_OA_FORMAT_MAX,
+	__XE_OA_FORMAT_MAX,
 };
 
-/** struct xe_oa_format - Format fields for supported OA formats */
+/**
+ * struct xe_oa_format - Format fields for supported OA formats. OA format
+ * properties are specified in PRM/Bspec 52198 and 60942
+ */
 struct xe_oa_format {
+	/** @counter_select: counter select value (see Bspec 52198/60942) */
 	u32 counter_select;
+	/** @size: record size as written by HW (multiple of 64 byte cachelines) */
 	int size;
+	/** @type: of enum @drm_xe_oa_format_type */
 	int type;
+	/** @header: 32 or 64 bit report headers */
 	enum xe_oa_report_header header;
+	/** @counter_size: counter size value (see Bspec 60942) */
 	u16 counter_size;
+	/** @bc_report: BC report value (see Bspec 60942) */
 	u16 bc_report;
 };
 
@@ -135,10 +144,8 @@ struct xe_oa {
 	/** @oa_formats: tracks all OA formats across platforms */
 	const struct xe_oa_format *oa_formats;
 
-#define FORMAT_MASK_SIZE DIV_ROUND_UP(XE_OA_FORMAT_MAX - 1, BITS_PER_LONG)
-
 	/** @format_mask: tracks valid OA formats for a platform */
-	unsigned long format_mask[FORMAT_MASK_SIZE];
+	unsigned long format_mask[BITS_TO_LONGS(__XE_OA_FORMAT_MAX)];
 
 	/** @oa_unit_ids: tracks oa unit ids assigned across gt's */
 	u16 oa_unit_ids;
drivers/gpu/drm/xe/xe_perf.c +26 -1
index 06739787d0e7..d6cd74cadf34 100644
@@ -1,11 +1,13 @@
 // SPDX-License-Identifier: MIT
 /*
- * Copyright © 2023 Intel Corporation
+ * Copyright © 2023-2024 Intel Corporation
  */
 
 #include <linux/errno.h>
 #include <linux/sysctl.h>
 
+#include <drm/xe_drm.h>
+
 #include "xe_oa.h"
 #include "xe_perf.h"
 
@@ -27,6 +29,17 @@ static int xe_oa_ioctl(struct drm_device *dev, struct drm_xe_perf_param *arg,
 	}
 }
 
+/**
+ * xe_perf_ioctl - The top level perf layer ioctl
+ * @dev: @drm_device
+ * @data: pointer to struct @drm_xe_perf_param
+ * @file: @drm_file
+ *
+ * The function is called for different perf streams types and allows execution
+ * of different operations supported by those perf stream types.
+ *
+ * Return: 0 on success or a negative error code on failure.
+ */
 int xe_perf_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
 {
 	struct drm_xe_perf_param *arg = data;
@@ -55,12 +68,24 @@ static struct ctl_table perf_ctl_table[] = {
 	{}
 };
 
+/**
+ * xe_perf_sysctl_register - Register "perf_stream_paranoid" sysctl
+ *
+ * Normally only superuser/root can access perf counter data. However,
+ * superuser can set perf_stream_paranoid sysctl to 0 to allow non-privileged
+ * users to also access perf data.
+ *
+ * Return: always returns 0
+ */
 int xe_perf_sysctl_register(void)
 {
 	sysctl_header = register_sysctl("dev/xe", perf_ctl_table);
 	return 0;
 }
 
+/**
+ * xe_perf_sysctl_unregister - Unregister "perf_stream_paranoid" sysctl
+ */
 void xe_perf_sysctl_unregister(void)
 {
 	unregister_sysctl_table(sysctl_header);
drivers/gpu/drm/xe/xe_perf.h +2 -2
index 1ff0a07ebab3..53a8377a1bb1 100644
@@ -1,12 +1,12 @@
 /* SPDX-License-Identifier: MIT */
 /*
- * Copyright © 2023 Intel Corporation
+ * Copyright © 2023-2024 Intel Corporation
  */
 
 #ifndef _XE_PERF_H_
 #define _XE_PERF_H_
 
-#include <drm/xe_drm.h>
+#include <linux/types.h>
 
 struct drm_device;
 struct drm_file;
include/uapi/drm/xe_drm.h +18 -4
index 8378e5a51d37..93e00be44b2d 100644
@@ -80,6 +80,7 @@ extern "C" {
  *  - &DRM_IOCTL_XE_EXEC_QUEUE_GET_PROPERTY
  *  - &DRM_IOCTL_XE_EXEC
  *  - &DRM_IOCTL_XE_WAIT_USER_FENCE
+ *  - &DRM_IOCTL_XE_PERF
  */
 
 /*
@@ -1374,10 +1375,12 @@ struct drm_xe_wait_user_fence {
 	__u64 reserved[2];
 };
 
-/** enum drm_xe_perf_type - Perf stream types */
+/**
+ * enum drm_xe_perf_type - Perf stream types
+ */
 enum drm_xe_perf_type {
 	DRM_XE_PERF_TYPE_OA,
-	DRM_XE_PERF_TYPE_MAX,
+	__DRM_XE_PERF_TYPE_MAX, /* non-ABI */
 };
 
 /**
@@ -1435,7 +1438,9 @@ enum drm_xe_perf_ioctls {
 	DRM_XE_PERF_IOCTL_INFO = _IO('i', 0x4),
 };
 
-/** enum drm_xe_oa_unit_type - OA unit types */
+/**
+ * enum drm_xe_oa_unit_type - OA unit types
+ */
 enum drm_xe_oa_unit_type {
 	/**
 	 * @DRM_XE_OA_UNIT_TYPE_OAG: OAG OA unit. OAR/OAC are considered
@@ -1516,13 +1521,22 @@ struct drm_xe_query_oa_units {
 	__u64 oa_units[];
 };
 
-/** enum drm_xe_oa_format_type - OA format types */
+/**
+ * enum drm_xe_oa_format_type - OA format types as specified in PRM/Bspec
+ * 52198/60942
+ */
 enum drm_xe_oa_format_type {
+	/** @DRM_XE_OA_FMT_TYPE_OAG: OAG report format */
 	DRM_XE_OA_FMT_TYPE_OAG,
+	/** @DRM_XE_OA_FMT_TYPE_OAR: OAR report format */
 	DRM_XE_OA_FMT_TYPE_OAR,
+	/** @DRM_XE_OA_FMT_TYPE_OAM: OAM report format */
 	DRM_XE_OA_FMT_TYPE_OAM,
+	/** @DRM_XE_OA_FMT_TYPE_OAC: OAC report format */
 	DRM_XE_OA_FMT_TYPE_OAC,
+	/** @DRM_XE_OA_FMT_TYPE_OAM_MPEC: OAM SAMEDIA or OAM MPEC report format */
 	DRM_XE_OA_FMT_TYPE_OAM_MPEC,
+	/** @DRM_XE_OA_FMT_TYPE_PEC: PEC report format */
 	DRM_XE_OA_FMT_TYPE_PEC,
 };
 
Signature · 1 line
2.41.0
#2 lore raw

✗ CI.Patch_applied: failure for Xe OA Consolidated Diffs

In reply to Ashutosh Dixit
== Series Details ==

== Series Details ==

Series: Xe OA Consolidated Diffs
URL : https://patchwork.freedesktop.org/series/134742/
State : failure

== Summary ==

=== Applying kernel patches on branch 'drm-tip' with base: ===
Base commit: 1340288da1f2 drm-tip: 2024y-06m-11d-21h-24m-08s UTC integration manifest === git am output follows ===
error: patch failed: drivers/gpu/drm/xe/instructions/xe_mi_commands.h:45
error: drivers/gpu/drm/xe/instructions/xe_mi_commands.h: patch does not apply
error: drivers/gpu/drm/xe/regs/xe_oa_regs.h: does not exist in index
error: patch failed: drivers/gpu/drm/xe/xe_device.c:41
error: drivers/gpu/drm/xe/xe_device.c: patch does not apply
error: patch failed: drivers/gpu/drm/xe/xe_guc_pc.c:193
error: drivers/gpu/drm/xe/xe_guc_pc.c: patch does not apply
error: patch failed: drivers/gpu/drm/xe/xe_guc_pc.h:9
error: drivers/gpu/drm/xe/xe_guc_pc.h: patch does not apply
error: patch failed: drivers/gpu/drm/xe/xe_module.c:10
error: drivers/gpu/drm/xe/xe_module.c: patch does not apply
error: drivers/gpu/drm/xe/xe_oa.c: does not exist in index
error: drivers/gpu/drm/xe/xe_oa.h: does not exist in index
error: drivers/gpu/drm/xe/xe_oa_types.h: does not exist in index
error: drivers/gpu/drm/xe/xe_perf.c: does not exist in index
error: drivers/gpu/drm/xe/xe_perf.h: does not exist in index
error: patch failed: include/uapi/drm/xe_drm.h:1374
error: include/uapi/drm/xe_drm.h: patch does not apply
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Applying: drm/xe/oa: Combined diff of changes between v16 and v17
Patch failed at 0001 drm/xe/oa: Combined diff of changes between v16 and v17 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".