Skip to content

Commit 5b672ec

Browse files
mbrost05Thomas Hellström
authored andcommitted
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: 8f33b4f ("drm/xe: Avoid doing rebinds") Fixes: c47794b ("drm/xe: Set max pte size when skipping rebinds") Reported-by: Paulo Zanoni <[email protected]> Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/758 Signed-off-by: Matthew Brost <[email protected]> Reviewed-by: Thomas Hellström <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] (cherry picked from commit 0f688c0) Signed-off-by: Thomas Hellström <[email protected]>
1 parent 4cf8ffe commit 5b672ec

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

drivers/gpu/drm/xe/xe_pt.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,13 +547,16 @@ xe_pt_stage_bind_entry(struct xe_ptw *parent, pgoff_t offset,
547547
*child = &xe_child->base;
548548

549549
/*
550-
* Prefer the compact pagetable layout for L0 if possible.
550+
* Prefer the compact pagetable layout for L0 if possible. Only
551+
* possible if VMA covers entire 2MB region as compact 64k and
552+
* 4k pages cannot be mixed within a 2MB region.
551553
* TODO: Suballocate the pt bo to avoid wasting a lot of
552554
* memory.
553555
*/
554556
if (GRAPHICS_VERx100(tile_to_xe(xe_walk->tile)) >= 1250 && level == 1 &&
555557
covers && xe_pt_scan_64K(addr, next, xe_walk)) {
556558
walk->shifts = xe_compact_pt_shifts;
559+
xe_walk->vma->gpuva.flags |= XE_VMA_PTE_COMPACT;
557560
flags |= XE_PDE_64K;
558561
xe_child->is_compact = true;
559562
}

drivers/gpu/drm/xe/xe_vm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2190,7 +2190,7 @@ static u64 xe_vma_max_pte_size(struct xe_vma *vma)
21902190
{
21912191
if (vma->gpuva.flags & XE_VMA_PTE_1G)
21922192
return SZ_1G;
2193-
else if (vma->gpuva.flags & XE_VMA_PTE_2M)
2193+
else if (vma->gpuva.flags & (XE_VMA_PTE_2M | XE_VMA_PTE_COMPACT))
21942194
return SZ_2M;
21952195
else if (vma->gpuva.flags & XE_VMA_PTE_64K)
21962196
return SZ_64K;

drivers/gpu/drm/xe/xe_vm_types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ struct xe_vm;
3030
#define XE_VMA_PTE_2M (DRM_GPUVA_USERBITS << 6)
3131
#define XE_VMA_PTE_1G (DRM_GPUVA_USERBITS << 7)
3232
#define XE_VMA_PTE_64K (DRM_GPUVA_USERBITS << 8)
33+
#define XE_VMA_PTE_COMPACT (DRM_GPUVA_USERBITS << 9)
3334

3435
/** struct xe_userptr - User pointer */
3536
struct xe_userptr {

0 commit comments

Comments
 (0)