Message ID | 20241012024524.1377836-6-vivek.kasireddy@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/xe/sriov: Don't migrate dmabuf BO to System RAM while running in VM | expand |
On Fri, Oct 11, 2024 at 07:40:27PM -0700, Vivek Kasireddy wrote: > If a BO's is_devmem_external flag is set, it means that it is an > imported dmabuf BO that has a backing store in VRAM. Therefore, we > need to add XE_PPGTT_PTE_DM to the PTE flags as part of vm_bind. > So here if we land on a DPA cursor [1] we'd have to update the bind code to use this cursor. Again I think this is my preference. Matt [1] https://patchwork.freedesktop.org/patch/619451/?series=139920&rev=1#comment_1127450 > Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com> > --- > drivers/gpu/drm/xe/xe_pt.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/xe/xe_pt.c b/drivers/gpu/drm/xe/xe_pt.c > index f27f579f4d85..909e5b96d518 100644 > --- a/drivers/gpu/drm/xe/xe_pt.c > +++ b/drivers/gpu/drm/xe/xe_pt.c > @@ -660,10 +660,11 @@ xe_pt_stage_bind(struct xe_tile *tile, struct xe_vma *vma, > xe_walk.default_pte &= ~XE_USM_PPGTT_PTE_AE; > } > > - if (is_devmem) { > + if (is_devmem || bo->is_devmem_external) > xe_walk.default_pte |= XE_PPGTT_PTE_DM; > + > + if (is_devmem) > xe_walk.dma_offset = vram_region_gpu_offset(bo->ttm.resource); > - } > > if (!xe_vma_has_no_bo(vma) && xe_bo_is_stolen(bo)) > xe_walk.dma_offset = xe_ttm_stolen_gpu_offset(xe_bo_device(bo)); > -- > 2.45.1 >
diff --git a/drivers/gpu/drm/xe/xe_pt.c b/drivers/gpu/drm/xe/xe_pt.c index f27f579f4d85..909e5b96d518 100644 --- a/drivers/gpu/drm/xe/xe_pt.c +++ b/drivers/gpu/drm/xe/xe_pt.c @@ -660,10 +660,11 @@ xe_pt_stage_bind(struct xe_tile *tile, struct xe_vma *vma, xe_walk.default_pte &= ~XE_USM_PPGTT_PTE_AE; } - if (is_devmem) { + if (is_devmem || bo->is_devmem_external) xe_walk.default_pte |= XE_PPGTT_PTE_DM; + + if (is_devmem) xe_walk.dma_offset = vram_region_gpu_offset(bo->ttm.resource); - } if (!xe_vma_has_no_bo(vma) && xe_bo_is_stolen(bo)) xe_walk.dma_offset = xe_ttm_stolen_gpu_offset(xe_bo_device(bo));
If a BO's is_devmem_external flag is set, it means that it is an imported dmabuf BO that has a backing store in VRAM. Therefore, we need to add XE_PPGTT_PTE_DM to the PTE flags as part of vm_bind. Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com> --- drivers/gpu/drm/xe/xe_pt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)