Commit 5b672ec3 authored by Matthew Brost's avatar Matthew Brost Committed by Thomas Hellström

drm/xe: Return 2MB page size for compact 64k PTEs

Compact 64k PTEs are only intended to be used within a single VMA which
covers the entire 2MB range of the compact 64k PTEs. Add
XE_VMA_PTE_COMPACT VMA flag to indicate compact 64k PTEs are used and
update xe_vma_max_pte_size to return at least 2MB if set.

v2: Include missing changes

Fixes: 8f33b4f0 ("drm/xe: Avoid doing rebinds")
Fixes: c47794bd ("drm/xe: Set max pte size when skipping rebinds")
Reported-by: default avatarPaulo Zanoni <paulo.r.zanoni@intel.com>
Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/758Signed-off-by: default avatarMatthew Brost <matthew.brost@intel.com>
Reviewed-by: default avatarThomas Hellström <thomas.hellstrom@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240219211942.3633795-4-matthew.brost@intel.com
(cherry picked from commit 0f688c0e)
Signed-off-by: default avatarThomas Hellström <thomas.hellstrom@linux.intel.com>
parent 4cf8ffeb
...@@ -547,13 +547,16 @@ xe_pt_stage_bind_entry(struct xe_ptw *parent, pgoff_t offset, ...@@ -547,13 +547,16 @@ xe_pt_stage_bind_entry(struct xe_ptw *parent, pgoff_t offset,
*child = &xe_child->base; *child = &xe_child->base;
/* /*
* Prefer the compact pagetable layout for L0 if possible. * Prefer the compact pagetable layout for L0 if possible. Only
* possible if VMA covers entire 2MB region as compact 64k and
* 4k pages cannot be mixed within a 2MB region.
* TODO: Suballocate the pt bo to avoid wasting a lot of * TODO: Suballocate the pt bo to avoid wasting a lot of
* memory. * memory.
*/ */
if (GRAPHICS_VERx100(tile_to_xe(xe_walk->tile)) >= 1250 && level == 1 && if (GRAPHICS_VERx100(tile_to_xe(xe_walk->tile)) >= 1250 && level == 1 &&
covers && xe_pt_scan_64K(addr, next, xe_walk)) { covers && xe_pt_scan_64K(addr, next, xe_walk)) {
walk->shifts = xe_compact_pt_shifts; walk->shifts = xe_compact_pt_shifts;
xe_walk->vma->gpuva.flags |= XE_VMA_PTE_COMPACT;
flags |= XE_PDE_64K; flags |= XE_PDE_64K;
xe_child->is_compact = true; xe_child->is_compact = true;
} }
......
...@@ -2190,7 +2190,7 @@ static u64 xe_vma_max_pte_size(struct xe_vma *vma) ...@@ -2190,7 +2190,7 @@ static u64 xe_vma_max_pte_size(struct xe_vma *vma)
{ {
if (vma->gpuva.flags & XE_VMA_PTE_1G) if (vma->gpuva.flags & XE_VMA_PTE_1G)
return SZ_1G; return SZ_1G;
else if (vma->gpuva.flags & XE_VMA_PTE_2M) else if (vma->gpuva.flags & (XE_VMA_PTE_2M | XE_VMA_PTE_COMPACT))
return SZ_2M; return SZ_2M;
else if (vma->gpuva.flags & XE_VMA_PTE_64K) else if (vma->gpuva.flags & XE_VMA_PTE_64K)
return SZ_64K; return SZ_64K;
......
...@@ -30,6 +30,7 @@ struct xe_vm; ...@@ -30,6 +30,7 @@ struct xe_vm;
#define XE_VMA_PTE_2M (DRM_GPUVA_USERBITS << 6) #define XE_VMA_PTE_2M (DRM_GPUVA_USERBITS << 6)
#define XE_VMA_PTE_1G (DRM_GPUVA_USERBITS << 7) #define XE_VMA_PTE_1G (DRM_GPUVA_USERBITS << 7)
#define XE_VMA_PTE_64K (DRM_GPUVA_USERBITS << 8) #define XE_VMA_PTE_64K (DRM_GPUVA_USERBITS << 8)
#define XE_VMA_PTE_COMPACT (DRM_GPUVA_USERBITS << 9)
/** struct xe_userptr - User pointer */ /** struct xe_userptr - User pointer */
struct xe_userptr { struct xe_userptr {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment