summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@intel.com>2023-07-26 09:07:07 -0700
committerRodrigo Vivi <rodrigo.vivi@intel.com>2023-12-21 11:39:14 -0500
commitc0d6b6163fd99c5e73eca3b747e704877e070acc (patch)
tree05b7d20aaebdbbf38b6ea92fde6c61b824ac3aba /drivers
parent58052eb70cdeaaa2a48ec4369e702d097fee13f6 (diff)
downloadlwn-c0d6b6163fd99c5e73eca3b747e704877e070acc.tar.gz
lwn-c0d6b6163fd99c5e73eca3b747e704877e070acc.zip
drm/xe: Carve out top of DSM as reserved
Top of DSM contains the WOPCM where kernel driver shouldn't access as it contains data from other HW agents. Carve it out from the stolen memory. On a MTL system, the output now matches the expected values: Reviewed-by: Matt Roper <matthew.d.roper@intel.com> Link: https://lore.kernel.org/r/20230726160708.3967790-10-lucas.demarchi@intel.com Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/xe/regs/xe_regs.h3
-rw-r--r--drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c8
2 files changed, 10 insertions, 1 deletions
diff --git a/drivers/gpu/drm/xe/regs/xe_regs.h b/drivers/gpu/drm/xe/regs/xe_regs.h
index e0734c8f922c..b344796bb868 100644
--- a/drivers/gpu/drm/xe/regs/xe_regs.h
+++ b/drivers/gpu/drm/xe/regs/xe_regs.h
@@ -97,4 +97,7 @@
#define DSMBASE XE_REG(0x1080C0)
#define BDSM_MASK REG_GENMASK64(63, 20)
+#define STOLEN_RESERVED XE_REG(0x1082c0)
+#define WOPCM_SIZE_MASK REG_GENMASK64(8, 7)
+
#endif
diff --git a/drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c b/drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c
index 271b3fba4129..7bba8fff5a5d 100644
--- a/drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c
+++ b/drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c
@@ -89,7 +89,7 @@ static s64 detect_bar2_dgfx(struct xe_device *xe, struct xe_ttm_stolen_mgr *mgr)
static u32 detect_bar2_integrated(struct xe_device *xe, struct xe_ttm_stolen_mgr *mgr)
{
struct pci_dev *pdev = to_pci_dev(xe->drm.dev);
- u32 stolen_size;
+ u32 stolen_size, wopcm_size;
u32 ggc, gms;
ggc = xe_mmio_read32(xe_root_mmio_gt(xe), GGC);
@@ -124,6 +124,12 @@ static u32 detect_bar2_integrated(struct xe_device *xe, struct xe_ttm_stolen_mgr
return 0;
}
+ /* Carve out the top of DSM as it contains the reserved WOPCM region */
+ wopcm_size = REG_FIELD_GET64(WOPCM_SIZE_MASK,
+ xe_mmio_read64(xe_root_mmio_gt(xe),
+ STOLEN_RESERVED));
+ stolen_size -= (1U << wopcm_size) * SZ_1M;
+
if (drm_WARN_ON(&xe->drm, stolen_size + SZ_8M > pci_resource_len(pdev, 2)))
return 0;