[CI 2/3] drm/xe: Add XE_BO_GGTT_INVALIDATE_BIT flag

Lucas De Marchi lucas.demarchi at intel.com
Wed Mar 20 00:13:13 UTC 2024


On Tue, Mar 19, 2024 at 07:07:41PM -0500, Lucas De Marchi wrote:
>On Tue, Mar 19, 2024 at 11:30:09PM +0530, Ghimiray, Himal Prasad wrote:
>>
>>On 19-03-2024 22:37, Maarten Lankhorst wrote:
>>>From: Matthew Brost <matthew.brost at intel.com>
>>>
>>>Add XE_BO_GGTT_INVALIDATE_BIT flag which indicates the GGTT should be
>>>invalidated when a BO is added / removed from the GGTT. This is
>>>typically set when a BO is used by the GuC as the GuC has GGTT TLBs.
>>>
>>>Cc: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
>>>Signed-off-by: Matthew Brost <matthew.brost at intel.com>
>>>[mlankhorst: Small fix to only inherit GGTT_INVALIDATE from src bo]
>>>Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
>>>Link: https://patchwork.freedesktop.org/patch/msgid/20240306052002.311196-4-matthew.brost@intel.com
>>>---
>>> drivers/gpu/drm/xe/display/xe_fb_pin.c |  2 +-
>>> drivers/gpu/drm/xe/xe_bo.c             |  8 +++++---
>>> drivers/gpu/drm/xe/xe_bo.h             |  1 +
>>> drivers/gpu/drm/xe/xe_ggtt.c           | 12 ++++++++----
>>> drivers/gpu/drm/xe/xe_ggtt.h           |  3 ++-
>>> drivers/gpu/drm/xe/xe_guc_ads.c        |  3 ++-
>>> drivers/gpu/drm/xe/xe_guc_ct.c         |  3 ++-
>>> drivers/gpu/drm/xe/xe_guc_hwconfig.c   |  3 ++-
>>> drivers/gpu/drm/xe/xe_guc_log.c        |  3 ++-
>>> drivers/gpu/drm/xe/xe_guc_pc.c         |  3 ++-
>>> drivers/gpu/drm/xe/xe_hw_engine.c      |  3 ++-
>>> drivers/gpu/drm/xe/xe_lrc.c            |  3 ++-
>>> drivers/gpu/drm/xe/xe_memirq.c         |  1 +
>>> drivers/gpu/drm/xe/xe_sa.c             |  3 ++-
>>> drivers/gpu/drm/xe/xe_uc_fw.c          |  3 ++-
>>> 15 files changed, 36 insertions(+), 18 deletions(-)
>>>
>>>diff --git a/drivers/gpu/drm/xe/display/xe_fb_pin.c b/drivers/gpu/drm/xe/display/xe_fb_pin.c
>>>index 311ffad6e2c0..2a50a7eaaa31 100644
>>>--- a/drivers/gpu/drm/xe/display/xe_fb_pin.c
>>>+++ b/drivers/gpu/drm/xe/display/xe_fb_pin.c
>>>@@ -323,7 +323,7 @@ static void __xe_unpin_fb_vma(struct i915_vma *vma)
>>> 		xe_bo_unpin_map_no_vm(vma->dpt);
>>> 	else if (!drm_mm_node_allocated(&vma->bo->ggtt_node) ||
>>> 		 vma->bo->ggtt_node.start != vma->node.start)
>>>-		xe_ggtt_remove_node(ggtt, &vma->node);
>>>+		xe_ggtt_remove_node(ggtt, &vma->node, false);
>>> 	ttm_bo_reserve(&vma->bo->ttm, false, false, NULL);
>>> 	ttm_bo_unpin(&vma->bo->ttm);
>>>diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c
>>>index 8383c56c9960..8ee04535da2a 100644
>>>--- a/drivers/gpu/drm/xe/xe_bo.c
>>>+++ b/drivers/gpu/drm/xe/xe_bo.c
>>>@@ -1580,13 +1580,15 @@ struct xe_bo *xe_managed_bo_create_from_data(struct xe_device *xe, struct xe_til
>>> int xe_managed_bo_reinit_in_vram(struct xe_device *xe, struct xe_tile *tile, struct xe_bo **src)
>>> {
>>> 	struct xe_bo *bo;
>>>+	u32 dst_flags = XE_BO_CREATE_VRAM_IF_DGFX(tile) | XE_BO_CREATE_GGTT_BIT;
>>>+
>>>+	dst_flags |= (*src)->flags & XE_BO_GGTT_INVALIDATE_BIT;
>>> 	xe_assert(xe, IS_DGFX(xe));
>>> 	xe_assert(xe, !(*src)->vmap.is_iomem);
>>>-	bo = xe_managed_bo_create_from_data(xe, tile, (*src)->vmap.vaddr, (*src)->size,
>>>-					    XE_BO_CREATE_VRAM_IF_DGFX(tile) |
>>>-					    XE_BO_CREATE_GGTT_BIT);
>>>+	bo = xe_managed_bo_create_from_data(xe, tile, (*src)->vmap.vaddr,
>>>+					    (*src)->size, dst_flags);
>>> 	if (IS_ERR(bo))
>>> 		return PTR_ERR(bo);
>>>diff --git a/drivers/gpu/drm/xe/xe_bo.h b/drivers/gpu/drm/xe/xe_bo.h
>>>index 87ae8ee7c316..d7afcf49fd9e 100644
>>>--- a/drivers/gpu/drm/xe/xe_bo.h
>>>+++ b/drivers/gpu/drm/xe/xe_bo.h
>>>@@ -46,6 +46,7 @@
>>> #define XE_BO_NEEDS_CPU_ACCESS		BIT(13)
>>> #define XE_BO_NEEDS_UC			BIT(14)
>>> #define XE_BO_NEEDS_64K			BIT(15)
>>>+#define XE_BO_GGTT_INVALIDATE_BIT	BIT(16)
>>
>>There is another patch from lucas where he is dropping usage of _BIT 
>>suffix for existing BO flags name.
>>
>>Better to align to same convention.
>>
>>https://patchwork.freedesktop.org/patch/582863/?series=131120&rev=2
>
>The hard part of that patch was finding a convention to follow
>and the command to generate the patch. The rest is trivial and I can
>simply re-generate it on top. I don't want that patch to block other
>pending work.  So, if this is ready, feel free to apply and I will send
>mine on top.
>
>AFAIR there was another patch from Matt Auld I was waiting so my
>refactor doesn't disrupt other pending work.

found it and it's now merged: 2a4172be4013 ("drm/xe/display: mark DPT
with XE_BO_PAGETABLE"). Let me know if this is going to merge soon or if
I should just re-generate mine with the current state.

Lucas De Marchi

>
>Lucas De Marchi


More information about the Intel-xe mailing list