mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-04-30 21:40:37 -04:00
drm/xe: Add XE_BO_GGTT_INVALIDATE flag
Add XE_BO_GGTT_INVALIDATE 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@linux.intel.com> Signed-off-by: Matthew Brost <matthew.brost@intel.com> [mlankhorst: Small fix to only inherit GGTT_INVALIDATE from src bo] [mlankhorst: Remove _BIT from name] Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240306052002.311196-4-matthew.brost@intel.com
This commit is contained in:
committed by
Maarten Lankhorst
parent
72bae5c281
commit
231c411087
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
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);
|
||||
|
||||
|
||||
@@ -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(16)
|
||||
/* this one is trigger internally only */
|
||||
#define XE_BO_INTERNAL_TEST BIT(30)
|
||||
#define XE_BO_INTERNAL_64K BIT(31)
|
||||
|
||||
@@ -390,7 +390,8 @@ void xe_ggtt_map_bo(struct xe_ggtt *ggtt, struct xe_bo *bo)
|
||||
xe_ggtt_set_pte(ggtt, start + offset, pte);
|
||||
}
|
||||
|
||||
xe_ggtt_invalidate(ggtt);
|
||||
if (bo->flags & XE_BO_GGTT_INVALIDATE)
|
||||
xe_ggtt_invalidate(ggtt);
|
||||
}
|
||||
|
||||
static int __xe_ggtt_insert_bo_at(struct xe_ggtt *ggtt, struct xe_bo *bo,
|
||||
@@ -435,7 +436,8 @@ int xe_ggtt_insert_bo(struct xe_ggtt *ggtt, struct xe_bo *bo)
|
||||
return __xe_ggtt_insert_bo_at(ggtt, bo, 0, U64_MAX);
|
||||
}
|
||||
|
||||
void xe_ggtt_remove_node(struct xe_ggtt *ggtt, struct drm_mm_node *node)
|
||||
void xe_ggtt_remove_node(struct xe_ggtt *ggtt, struct drm_mm_node *node,
|
||||
bool invalidate)
|
||||
{
|
||||
xe_device_mem_access_get(tile_to_xe(ggtt->tile));
|
||||
mutex_lock(&ggtt->lock);
|
||||
@@ -444,7 +446,8 @@ void xe_ggtt_remove_node(struct xe_ggtt *ggtt, struct drm_mm_node *node)
|
||||
drm_mm_remove_node(node);
|
||||
node->size = 0;
|
||||
|
||||
xe_ggtt_invalidate(ggtt);
|
||||
if (invalidate)
|
||||
xe_ggtt_invalidate(ggtt);
|
||||
|
||||
mutex_unlock(&ggtt->lock);
|
||||
xe_device_mem_access_put(tile_to_xe(ggtt->tile));
|
||||
@@ -458,7 +461,8 @@ void xe_ggtt_remove_bo(struct xe_ggtt *ggtt, struct xe_bo *bo)
|
||||
/* This BO is not currently in the GGTT */
|
||||
xe_tile_assert(ggtt->tile, bo->ggtt_node.size == bo->size);
|
||||
|
||||
xe_ggtt_remove_node(ggtt, &bo->ggtt_node);
|
||||
xe_ggtt_remove_node(ggtt, &bo->ggtt_node,
|
||||
bo->flags & XE_BO_GGTT_INVALIDATE);
|
||||
}
|
||||
|
||||
int xe_ggtt_dump(struct xe_ggtt *ggtt, struct drm_printer *p)
|
||||
|
||||
@@ -23,7 +23,8 @@ int xe_ggtt_insert_special_node(struct xe_ggtt *ggtt, struct drm_mm_node *node,
|
||||
int xe_ggtt_insert_special_node_locked(struct xe_ggtt *ggtt,
|
||||
struct drm_mm_node *node,
|
||||
u32 size, u32 align, u32 mm_flags);
|
||||
void xe_ggtt_remove_node(struct xe_ggtt *ggtt, struct drm_mm_node *node);
|
||||
void xe_ggtt_remove_node(struct xe_ggtt *ggtt, struct drm_mm_node *node,
|
||||
bool invalidate);
|
||||
void xe_ggtt_map_bo(struct xe_ggtt *ggtt, struct xe_bo *bo);
|
||||
int xe_ggtt_insert_bo(struct xe_ggtt *ggtt, struct xe_bo *bo);
|
||||
int xe_ggtt_insert_bo_at(struct xe_ggtt *ggtt, struct xe_bo *bo,
|
||||
|
||||
@@ -274,7 +274,8 @@ int xe_guc_ads_init(struct xe_guc_ads *ads)
|
||||
|
||||
bo = xe_managed_bo_create_pin_map(xe, tile, guc_ads_size(ads) + MAX_GOLDEN_LRC_SIZE,
|
||||
XE_BO_CREATE_SYSTEM_BIT |
|
||||
XE_BO_CREATE_GGTT_BIT);
|
||||
XE_BO_CREATE_GGTT_BIT |
|
||||
XE_BO_GGTT_INVALIDATE);
|
||||
if (IS_ERR(bo))
|
||||
return PTR_ERR(bo);
|
||||
|
||||
|
||||
@@ -156,7 +156,8 @@ int xe_guc_ct_init(struct xe_guc_ct *ct)
|
||||
|
||||
bo = xe_managed_bo_create_pin_map(xe, tile, guc_ct_size(),
|
||||
XE_BO_CREATE_SYSTEM_BIT |
|
||||
XE_BO_CREATE_GGTT_BIT);
|
||||
XE_BO_CREATE_GGTT_BIT |
|
||||
XE_BO_GGTT_INVALIDATE);
|
||||
if (IS_ERR(bo))
|
||||
return PTR_ERR(bo);
|
||||
|
||||
|
||||
@@ -79,7 +79,8 @@ int xe_guc_hwconfig_init(struct xe_guc *guc)
|
||||
|
||||
bo = xe_managed_bo_create_pin_map(xe, tile, PAGE_ALIGN(size),
|
||||
XE_BO_CREATE_SYSTEM_BIT |
|
||||
XE_BO_CREATE_GGTT_BIT);
|
||||
XE_BO_CREATE_GGTT_BIT |
|
||||
XE_BO_GGTT_INVALIDATE);
|
||||
if (IS_ERR(bo))
|
||||
return PTR_ERR(bo);
|
||||
guc->hwconfig.bo = bo;
|
||||
|
||||
@@ -85,7 +85,8 @@ int xe_guc_log_init(struct xe_guc_log *log)
|
||||
|
||||
bo = xe_managed_bo_create_pin_map(xe, tile, guc_log_size(),
|
||||
XE_BO_CREATE_SYSTEM_BIT |
|
||||
XE_BO_CREATE_GGTT_BIT);
|
||||
XE_BO_CREATE_GGTT_BIT |
|
||||
XE_BO_GGTT_INVALIDATE);
|
||||
if (IS_ERR(bo))
|
||||
return PTR_ERR(bo);
|
||||
|
||||
|
||||
@@ -955,7 +955,8 @@ int xe_guc_pc_init(struct xe_guc_pc *pc)
|
||||
|
||||
bo = xe_managed_bo_create_pin_map(xe, tile, size,
|
||||
XE_BO_CREATE_VRAM_IF_DGFX(tile) |
|
||||
XE_BO_CREATE_GGTT_BIT);
|
||||
XE_BO_CREATE_GGTT_BIT |
|
||||
XE_BO_GGTT_INVALIDATE);
|
||||
if (IS_ERR(bo))
|
||||
return PTR_ERR(bo);
|
||||
|
||||
|
||||
@@ -519,7 +519,8 @@ static int hw_engine_init(struct xe_gt *gt, struct xe_hw_engine *hwe,
|
||||
|
||||
hwe->hwsp = xe_managed_bo_create_pin_map(xe, tile, SZ_4K,
|
||||
XE_BO_CREATE_VRAM_IF_DGFX(tile) |
|
||||
XE_BO_CREATE_GGTT_BIT);
|
||||
XE_BO_CREATE_GGTT_BIT |
|
||||
XE_BO_GGTT_INVALIDATE);
|
||||
if (IS_ERR(hwe->hwsp)) {
|
||||
err = PTR_ERR(hwe->hwsp);
|
||||
goto err_name;
|
||||
|
||||
@@ -746,7 +746,8 @@ int xe_lrc_init(struct xe_lrc *lrc, struct xe_hw_engine *hwe,
|
||||
ring_size + xe_lrc_size(xe, hwe->class),
|
||||
ttm_bo_type_kernel,
|
||||
XE_BO_CREATE_VRAM_IF_DGFX(tile) |
|
||||
XE_BO_CREATE_GGTT_BIT);
|
||||
XE_BO_CREATE_GGTT_BIT |
|
||||
XE_BO_GGTT_INVALIDATE);
|
||||
if (IS_ERR(lrc->bo))
|
||||
return PTR_ERR(lrc->bo);
|
||||
|
||||
|
||||
@@ -129,6 +129,7 @@ static int memirq_alloc_pages(struct xe_memirq *memirq)
|
||||
ttm_bo_type_kernel,
|
||||
XE_BO_CREATE_SYSTEM_BIT |
|
||||
XE_BO_CREATE_GGTT_BIT |
|
||||
XE_BO_GGTT_INVALIDATE |
|
||||
XE_BO_NEEDS_UC |
|
||||
XE_BO_NEEDS_CPU_ACCESS);
|
||||
if (IS_ERR(bo)) {
|
||||
|
||||
@@ -49,7 +49,8 @@ struct xe_sa_manager *xe_sa_bo_manager_init(struct xe_tile *tile, u32 size, u32
|
||||
|
||||
bo = xe_bo_create_pin_map(xe, tile, NULL, size, ttm_bo_type_kernel,
|
||||
XE_BO_CREATE_VRAM_IF_DGFX(tile) |
|
||||
XE_BO_CREATE_GGTT_BIT);
|
||||
XE_BO_CREATE_GGTT_BIT |
|
||||
XE_BO_GGTT_INVALIDATE);
|
||||
if (IS_ERR(bo)) {
|
||||
drm_err(&xe->drm, "failed to allocate bo for sa manager: %ld\n",
|
||||
PTR_ERR(bo));
|
||||
|
||||
@@ -763,7 +763,8 @@ int xe_uc_fw_init(struct xe_uc_fw *uc_fw)
|
||||
return 0;
|
||||
|
||||
err = uc_fw_copy(uc_fw, fw->data, fw->size,
|
||||
XE_BO_CREATE_SYSTEM_BIT | XE_BO_CREATE_GGTT_BIT);
|
||||
XE_BO_CREATE_SYSTEM_BIT | XE_BO_CREATE_GGTT_BIT |
|
||||
XE_BO_GGTT_INVALIDATE);
|
||||
|
||||
uc_fw_release(fw);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user