[Intel-xe] [PATCH 1/6] drm/xe: Fix meteorlake stolen memory

Lucas De Marchi lucas.demarchi at intel.com
Tue Apr 4 17:42:35 UTC 2023


On Fri, Mar 31, 2023 at 12:24:14PM +0200, Maarten Lankhorst wrote:
>MTL should use bar2 to access stolen memory, not the physical addresses
>directly. Correct the GPU address to point to stolen base, and set the
>VRAM flag to indicate it's in device memory.

humn... shouldn't the commit message point that for integrated the
address for stolen is an offset from the base rather than the physical
address?  It was already using bar2, but with the wrong address.

>
>Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>


Reviewed-by: Lucas De Marchi <lucas.demarchi at intel.com>

thanks
Lucas De Marchi

>---
> drivers/gpu/drm/xe/xe_bo.c             | 3 ++-
> drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c | 3 ++-
> 2 files changed, 4 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c
>index e4d079b61d52..9b2f95f3ce49 100644
>--- a/drivers/gpu/drm/xe/xe_bo.c
>+++ b/drivers/gpu/drm/xe/xe_bo.c
>@@ -47,7 +47,8 @@ bool mem_type_is_vram(u32 mem_type)
>
> static bool resource_is_stolen_vram(struct xe_device *xe, struct ttm_resource *res)
> {
>-	return res->mem_type == XE_PL_STOLEN && IS_DGFX(xe);
>+	return res->mem_type == XE_PL_STOLEN &&
>+	       (IS_DGFX(xe) || !xe_ttm_stolen_cpu_access_needs_ggtt(xe));
> }
>
> static bool resource_is_vram(struct ttm_resource *res)
>diff --git a/drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c b/drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c
>index 31887fec1073..bd1b73fa84a5 100644
>--- a/drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c
>+++ b/drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c
>@@ -94,7 +94,8 @@ static u32 detect_bar2_integrated(struct xe_device *xe, struct xe_ttm_stolen_mgr
> 	if (drm_WARN_ON(&xe->drm, (ggc & GGMS_MASK) != GGMS_MASK))
> 		return 0;
>
>-	mgr->stolen_base = mgr->io_base = pci_resource_start(pdev, 2) + SZ_8M;
>+	mgr->io_base = pci_resource_start(pdev, 2) + SZ_8M;
>+	mgr->stolen_base = SZ_8M;
>
> 	/* return valid GMS value, -EIO if invalid */
> 	gms = REG_FIELD_GET(GMS_MASK, ggc);
>-- 
>2.34.1
>


More information about the Intel-xe mailing list