[Intel-xe] [PATCH] drm/xe: Grab runtime PM over MMIO ioctl

Matt Roper matthew.d.roper at intel.com
Wed Jun 14 20:04:45 UTC 2023


The MMIO ioctl (which is generally used from IGT's xe_reg tool) may be
called while the device is in D3, resulting in invalid results (i.e.,
all registers read back as 0xFFFFFFFF, writes are dropped).  Make sure
we grab runtime PM wakeref before performing register reads/writes.

Signed-off-by: Matt Roper <matthew.d.roper at intel.com>
---
 drivers/gpu/drm/xe/xe_mmio.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/xe/xe_mmio.c b/drivers/gpu/drm/xe/xe_mmio.c
index f7a7f996b37f..5f4c8ae23771 100644
--- a/drivers/gpu/drm/xe/xe_mmio.c
+++ b/drivers/gpu/drm/xe/xe_mmio.c
@@ -19,6 +19,7 @@
 #include "xe_gt_mcr.h"
 #include "xe_macros.h"
 #include "xe_module.h"
+#include "xe_pm.h"
 
 #define XEHP_MTCFG_ADDR		XE_REG(0x101800)
 #define TILE_COUNT		REG_GENMASK(15, 8)
@@ -476,6 +477,7 @@ int xe_mmio_ioctl(struct drm_device *dev, void *data,
 	 */
 	reg = XE_REG(args->addr);
 
+	xe_pm_runtime_get(xe);
 	xe_force_wake_get(gt_to_fw(gt), XE_FORCEWAKE_ALL);
 
 	if (args->flags & DRM_XE_MMIO_WRITE) {
@@ -519,6 +521,7 @@ int xe_mmio_ioctl(struct drm_device *dev, void *data,
 
 exit:
 	xe_force_wake_put(gt_to_fw(gt), XE_FORCEWAKE_ALL);
+	xe_pm_runtime_put(xe);
 
 	return ret;
 }
-- 
2.40.1



More information about the Intel-xe mailing list