Skip to contentSkip to conversation

Xe OA Consolidated Diffs

PATCH New Ashutosh Dixit 2 participants 3 messages May 24, 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 v13 and v14

 drivers/gpu/drm/xe/regs/xe_oa_regs.h |  4 ++
 drivers/gpu/drm/xe/xe_guc_pc.c       |  9 +--
 drivers/gpu/drm/xe/xe_oa.c           | 98 +++++++++++++++++++---------
 drivers/gpu/drm/xe/xe_oa_types.h     |  3 +
 include/uapi/drm/xe_drm.h            | 21 +++---
 5 files changed, 93 insertions(+), 42 deletions(-)
Signature · 1 line
2.41.0
#1 lore raw

PATCH 1/1 drm/xe/oa: Combined diff of changes between v13 and v14

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.

* Change oa_units[] array to __u64 in query_oa_units to avoid MSVC compile error
* xe_device_mem_access_get/put -> xe_pm_runtime_get/put
* Hold runtime_pm references across OA buffer alloc/free
* Reorder #includes in xe_oa.c
* Fix platforms for which OA_TLB_INV_CR is valid
* Use -EIO to signal to userspace to read OASTATUS using DRM_XE_PERF_IOCTL_STATUS, change previous sites returning -EIO to return -EINVAL
* Make drm_xe_oa_stream_status bits contiguous
* s/DRM_XE_OA_PROPERTY_OA_EXPONENT/DRM_XE_OA_PROPERTY_OA_PERIOD_EXPONENT/
* rmw oa_status bits

Note: Last published consolidated diff was for v11. Between v11 and v13 was just the addition of the patch "Enable Xe2+ overrun mode".

---
 drivers/gpu/drm/xe/regs/xe_oa_regs.h |  4 ++
 drivers/gpu/drm/xe/xe_guc_pc.c       |  9 +--
 drivers/gpu/drm/xe/xe_oa.c           | 98 +++++++++++++++++++---------
 drivers/gpu/drm/xe/xe_oa_types.h     |  3 +
 include/uapi/drm/xe_drm.h            | 21 +++---
 5 files changed, 93 insertions(+), 42 deletions(-)
drivers/gpu/drm/xe/regs/xe_oa_regs.h +4 -0
index 6ad3304c4d19..d9fcb08f500d 100644
@@ -72,6 +72,10 @@
 #define  OAG_OA_DEBUG_DISABLE_CTX_SWITCH_REPORTS	REG_BIT(1)
 
 #define OAG_OASTATUS			XE_REG(0xdafc)
+#define  OASTATUS_MMIO_TRG_Q_FULL	REG_BIT(6)
+#define  OASTATUS_COUNTER_OVERFLOW	REG_BIT(2)
+#define  OASTATUS_BUFFER_OVERFLOW	REG_BIT(1)
+#define  OASTATUS_REPORT_LOST		REG_BIT(0)
 #define OAG_MMIOTRIGGER			XE_REG(0xdb1c)
 /* OAC unit */
 #define OAC_OACONTROL			XE_REG(0x15114)
drivers/gpu/drm/xe/xe_guc_pc.c +5 -4
index 1c582d786c30..da701cf5325d 100644
@@ -24,6 +24,7 @@
 #include "xe_map.h"
 #include "xe_mmio.h"
 #include "xe_pcode.h"
+#include "xe_pm.h"
 
 #define MCHBAR_MIRROR_BASE_SNB	0x140000
 
@@ -805,9 +806,9 @@ int xe_guc_pc_override_gucrc_mode(struct xe_guc_pc *pc, enum slpc_gucrc_mode mod
 {
 	int ret;
 
-	xe_device_mem_access_get(pc_to_xe(pc));
+	xe_pm_runtime_get(pc_to_xe(pc));
 	ret = pc_action_set_param(pc, SLPC_PARAM_PWRGATE_RC_MODE, mode);
-	xe_device_mem_access_put(pc_to_xe(pc));
+	xe_pm_runtime_put(pc_to_xe(pc));
 
 	return ret;
 }
@@ -822,9 +823,9 @@ int xe_guc_pc_unset_gucrc_mode(struct xe_guc_pc *pc)
 {
 	int ret;
 
-	xe_device_mem_access_get(pc_to_xe(pc));
+	xe_pm_runtime_get(pc_to_xe(pc));
 	ret = pc_action_unset_param(pc, SLPC_PARAM_PWRGATE_RC_MODE);
-	xe_device_mem_access_put(pc_to_xe(pc));
+	xe_pm_runtime_put(pc_to_xe(pc));
 
 	return ret;
 }
drivers/gpu/drm/xe/xe_oa.c +68 -30

221 lines not on this page · raw message

drivers/gpu/drm/xe/xe_oa_types.h +3 -0
index d8d5c9d8c22e..c62811482934 100644
@@ -225,5 +225,8 @@ struct xe_oa_stream {
 
 	/** @override_gucrc: GuC RC has been overridden for the OA stream */
 	bool override_gucrc;
+
+	/** @oa_status: temporary storage for oa_status register value */
+	u32 oa_status;
 };
 #endif
include/uapi/drm/xe_drm.h +13 -8
index dc17e1fad025..8378e5a51d37 100644
@@ -1508,8 +1508,12 @@ struct drm_xe_query_oa_units {
 	__u32 num_oa_units;
 	/** @pad: MBZ */
 	__u32 pad;
-	/** @oa_units: OA units returned for this device */
-	struct drm_xe_oa_unit oa_units[];
+	/**
+	 * @oa_units: struct @drm_xe_oa_unit array returned for this device.
+	 * Written below as a u64 array to avoid problems with nested flexible
+	 * arrays with some compilers
+	 */
+	__u64 oa_units[];
 };
 
 /** enum drm_xe_oa_format_type - OA format types */
@@ -1571,10 +1575,10 @@ enum drm_xe_oa_property_id {
 #define DRM_XE_OA_FORMAT_MASK_BC_REPORT		(0xff << 24)
 
 	/**
-	 * @DRM_XE_OA_PROPERTY_OA_EXPONENT: Requests periodic OA unit sampling
-	 * with sampling frequency proportional to 2^(period_exponent + 1)
+	 * @DRM_XE_OA_PROPERTY_OA_PERIOD_EXPONENT: Requests periodic OA unit
+	 * sampling with sampling frequency proportional to 2^(period_exponent + 1)
 	 */
-	DRM_XE_OA_PROPERTY_OA_EXPONENT,
+	DRM_XE_OA_PROPERTY_OA_PERIOD_EXPONENT,
 
 	/**
 	 * @DRM_XE_OA_PROPERTY_OA_DISABLED: A value of 1 will open the OA
@@ -1624,15 +1628,16 @@ struct drm_xe_oa_config {
 
 /**
  * struct drm_xe_oa_stream_status - OA stream status returned from
- * @DRM_XE_PERF_IOCTL_STATUS perf fd ioctl
+ * @DRM_XE_PERF_IOCTL_STATUS perf fd ioctl. Userspace can call the ioctl to
+ * query stream status in response to EIO errno from perf fd read().
  */
 struct drm_xe_oa_stream_status {
 	/** @extensions: Pointer to the first extension struct, if any */
 	__u64 extensions;
 
-	/** @oa_status: OA status register as specified in PRM/Bspec 46717/61226 */
+	/** @oa_status: OA stream status (see Bspec 46717/61226) */
 	__u64 oa_status;
-#define DRM_XE_OASTATUS_MMIO_TRG_Q_FULL		(1 << 6)
+#define DRM_XE_OASTATUS_MMIO_TRG_Q_FULL		(1 << 3)
 #define DRM_XE_OASTATUS_COUNTER_OVERFLOW	(1 << 2)
 #define DRM_XE_OASTATUS_BUFFER_OVERFLOW		(1 << 1)
 #define DRM_XE_OASTATUS_REPORT_LOST		(1 << 0)
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/134028/
State : failure

== Summary ==

=== Applying kernel patches on branch 'drm-tip' with base: ===
Base commit: 573842e9ab57 drm-tip: 2024y-05m-24d-13h-04m-26s UTC integration manifest === git am output follows ===
error: drivers/gpu/drm/xe/regs/xe_oa_regs.h: does not exist in index
error: patch failed: drivers/gpu/drm/xe/xe_guc_pc.c:805
error: drivers/gpu/drm/xe/xe_guc_pc.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_types.h: does not exist in index
error: patch failed: include/uapi/drm/xe_drm.h:1508
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 v13 and v14
Patch failed at 0001 drm/xe/oa: Combined diff of changes between v13 and v14 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".