[RFC 2/9] drm/i915: Split PTE encode between Gen12 and Meteorlake

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Tue Aug 1 10:36:16 UTC 2023


From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>

No need to run extra instructions which will never trigger on platforms
before Meteorlake.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
---
 drivers/gpu/drm/i915/gt/gen8_ppgtt.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/gt/gen8_ppgtt.c b/drivers/gpu/drm/i915/gt/gen8_ppgtt.c
index c8568e5d1147..501f831a0da1 100644
--- a/drivers/gpu/drm/i915/gt/gen8_ppgtt.c
+++ b/drivers/gpu/drm/i915/gt/gen8_ppgtt.c
@@ -78,6 +78,15 @@ static u64 gen12_pte_encode(dma_addr_t addr,
 	if (pat_index & BIT(2))
 		pte |= GEN12_PPGTT_PTE_PAT2;
 
+	return pte;
+}
+
+static u64 mtl_pte_encode(dma_addr_t addr,
+			  unsigned int pat_index,
+			  u32 flags)
+{
+	gen8_pte_t pte = gen12_pte_encode(addr, pat_index, flags);
+
 	if (pat_index & BIT(3))
 		pte |= MTL_PPGTT_PTE_PAT3;
 
@@ -995,7 +1004,9 @@ struct i915_ppgtt *gen8_ppgtt_create(struct intel_gt *gt,
 	 */
 	ppgtt->vm.alloc_scratch_dma = alloc_pt_dma;
 
-	if (GRAPHICS_VER(gt->i915) >= 12)
+	if (GRAPHICS_VER_FULL(gt->i915) >= IP_VER(12, 70))
+		ppgtt->vm.pte_encode = mtl_pte_encode;
+	else if (GRAPHICS_VER(gt->i915) >= 12)
 		ppgtt->vm.pte_encode = gen12_pte_encode;
 	else
 		ppgtt->vm.pte_encode = gen8_pte_encode;
-- 
2.39.2



More information about the Intel-gfx-trybot mailing list