#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
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);
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;