[Intel-gfx] [PATCH 2/3] drm/i915: determine lmem_size properly
Nirmoy Das
nirmoy.das at intel.com
Wed May 11 15:37:45 UTC 2022
Determine lmem_size using ADDR_RANGE register so that lmem_setup()
works on platform with small-bar as well.
Signed-off-by: Nirmoy Das <nirmoy.das at intel.com>
---
drivers/gpu/drm/i915/gt/intel_region_lmem.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/gt/intel_region_lmem.c b/drivers/gpu/drm/i915/gt/intel_region_lmem.c
index 5a7c403d718a..cd105ec10429 100644
--- a/drivers/gpu/drm/i915/gt/intel_region_lmem.c
+++ b/drivers/gpu/drm/i915/gt/intel_region_lmem.c
@@ -101,9 +101,13 @@ static struct intel_memory_region *setup_lmem(struct intel_gt *gt)
return ERR_PTR(-ENODEV);
if (HAS_FLAT_CCS(i915)) {
+ resource_size_t lmem_range;
u64 tile_stolen, flat_ccs_base;
- lmem_size = pci_resource_len(pdev, 2);
+ lmem_range = intel_gt_read_register(&i915->gt0, XEHPSDV_TILE0_ADDR_RANGE) & 0xFFFF;
+ lmem_size = lmem_range >> XEHPSDV_TILE_LMEM_RANGE_SHIFT;
+ lmem_size *= SZ_1G;
+
flat_ccs_base = intel_gt_read_register(gt, XEHPSDV_FLAT_CCS_BASE_ADDR);
flat_ccs_base = (flat_ccs_base >> XEHPSDV_CCS_BASE_SHIFT) * SZ_64K;
--
2.35.1
More information about the Intel-gfx
mailing list