summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/xe/xe_wopcm.c
diff options
context:
space:
mode:
authorBalasubramani Vivekanandan <balasubramani.vivekanandan@intel.com>2023-03-17 22:23:35 +0530
committerRodrigo Vivi <rodrigo.vivi@intel.com>2023-12-19 18:30:20 -0500
commiteb230dc47dd6f543ae2ff9c85bbe86243502e171 (patch)
tree3ae5eaa3ec9a32ab2434c6527a7b4581fefc8837 /drivers/gpu/drm/xe/xe_wopcm.c
parent1a653b879d6e408813096434ece5fa46c0752343 (diff)
downloadlwn-eb230dc47dd6f543ae2ff9c85bbe86243502e171.tar.gz
lwn-eb230dc47dd6f543ae2ff9c85bbe86243502e171.zip
drm/xe: Use max wopcm size when validating the preset GuC wopcm size
When the GuC wopcm base and size registers are populated by BIOS/IFWI, validate the parameters against the maximum allowed wopcm size. Bpsec: 44982 Signed-off-by: Balasubramani Vivekanandan <balasubramani.vivekanandan@intel.com> Reviewed-by: Matthew Brost <matthew.brost@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Diffstat (limited to 'drivers/gpu/drm/xe/xe_wopcm.c')
-rw-r--r--drivers/gpu/drm/xe/xe_wopcm.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/gpu/drm/xe/xe_wopcm.c b/drivers/gpu/drm/xe/xe_wopcm.c
index 7bb880355f6b..c8cc3f5e6154 100644
--- a/drivers/gpu/drm/xe/xe_wopcm.c
+++ b/drivers/gpu/drm/xe/xe_wopcm.c
@@ -54,6 +54,8 @@
for MTL, do a proper probe
sooner or later */
#define GEN11_WOPCM_SIZE SZ_2M
+
+#define GEN12_MAX_WOPCM_SIZE SZ_8M
/* 16KB WOPCM (RSVD WOPCM) is reserved from HuC firmware top. */
#define WOPCM_RESERVED_SIZE SZ_16K
@@ -221,6 +223,13 @@ int xe_wopcm_init(struct xe_wopcm *wopcm)
if (locked) {
drm_dbg(&xe->drm, "GuC WOPCM is already locked [%uK, %uK)\n",
guc_wopcm_base / SZ_1K, guc_wopcm_size / SZ_1K);
+ /*
+ * When the GuC wopcm base and size are preprogrammed by
+ * BIOS/IFWI, check against the max allowed wopcm size to
+ * validate if the programmed values align to the wopcm layout.
+ */
+ wopcm->size = GEN12_MAX_WOPCM_SIZE;
+
goto check;
}