drm/i915: Use correct huge page manager for MTL
authorJonathan Cavitt <jonathan.cavitt@intel.com>
Wed, 26 Apr 2023 21:28:49 +0000 (23:28 +0200)
committerAndrzej Hajda <andrzej.hajda@intel.com>
Fri, 28 Apr 2023 11:20:05 +0000 (13:20 +0200)
MTL currently uses gen8_ppgtt_insert_huge when managing huge pages.
This is because MTL reports as not supporting 64K pages, or more
accurately, the system that reports whether a platform has 64K pages
reports false for MTL.  This is only half correct, as the 64K page support
reporting system only cares about 64K page support for LMEM, which MTL
doesn't have.

MTL should be using xehpsdv_ppgtt_insert_huge.  However, simply changing
over to using that manager doesn't resolve the issue because MTL is
expecting the virtual address space for the page table to be flushed after
initialization, so we must also add a flush statement there.

Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Signed-off-by: Andrzej Hajda <andrzej.hajda@intel.com>
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230425-hugepage-migrate-v8-2-7868d54eaa27@intel.com
drivers/gpu/drm/i915/gt/gen8_ppgtt.c

index 4c9a2f2db90811031014637c0ad1e47b6660bd03..22ec1566d2a7b5899c7e4bbb654a1e646dcaa99a 100644 (file)
@@ -598,6 +598,7 @@ xehpsdv_ppgtt_insert_huge(struct i915_address_space *vm,
                        }
                } while (rem >= page_size && index < max);
 
+               drm_clflush_virt_range(vaddr, PAGE_SIZE);
                vma_res->page_sizes_gtt |= page_size;
        } while (iter->sg && sg_dma_len(iter->sg));
 }
@@ -735,7 +736,7 @@ static void gen8_ppgtt_insert(struct i915_address_space *vm,
        struct sgt_dma iter = sgt_dma(vma_res);
 
        if (vma_res->bi.page_sizes.sg > I915_GTT_PAGE_SIZE) {
-               if (HAS_64K_PAGES(vm->i915))
+               if (GRAPHICS_VER_FULL(vm->i915) >= IP_VER(12, 50))
                        xehpsdv_ppgtt_insert_huge(vm, vma_res, &iter, cache_level, flags);
                else
                        gen8_ppgtt_insert_huge(vm, vma_res, &iter, cache_level, flags);