[Intel-gfx] [PATCH v5 0/1]
v5 cover [Intel-gfx] [PATCH v5 0/1]
This series is to introduce new macros generic to i915 for checking 0 and 1 bits, instead on relying on whats defined by the mmu, since it could be different or non-exisitent between different platforms.
v2: Corrected sender's email.
v3: Corrected spelling error.
v4: Clean up a few other macros that are checking 0 and 1 bits. Thanks to Lucas De Marchi for suggesting these cleanups.
v5: Remove changes to GEN6_PTE_VALID/GEN6_PDE_VALID and BYT_PTE_WRITEABLE. Those macros checks for 32bit PTEs, and our new macro is checking for 64bit.
Michael Cheng (1):
drm/i915: Introduce new macros for i915 PTE
drivers/gpu/drm/i915/gt/gen8_ppgtt.c | 6 +++--- drivers/gpu/drm/i915/gt/intel_ggtt.c | 2 +- drivers/gpu/drm/i915/gt/intel_gtt.h | 3 +++ drivers/gpu/drm/i915/gvt/gtt.c | 12 ++++++------ 4 files changed, 13 insertions(+), 10 deletions(-)
Signature · 1 line
2.25.1
PATCH v5 1/1 drm/i915: Introduce new macros for i915 PTE
Certain functions within i915 uses macros that are defined for specific architectures by the mmu, such as _PAGE_RW and _PAGE_PRESENT (Some architectures don't even have these macros defined, like ARM64).
Instead of re-using bits defined for the CPU, we should use bits defined for i915. This patch introduces two new 64 bit macros, I915_PAGE_PRESENT and I915_PAGE_RW, to check for bits 0 and 1 and, to replace all occurrences of _PAGE_RW and _PAGE_PRESENT within i915.
--- drivers/gpu/drm/i915/gt/gen8_ppgtt.c | 6 +++--- drivers/gpu/drm/i915/gt/intel_ggtt.c | 2 +- drivers/gpu/drm/i915/gt/intel_gtt.h | 3 +++ drivers/gpu/drm/i915/gvt/gtt.c | 12 ++++++------ 4 files changed, 13 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/gt/gen8_ppgtt.c +3 -3
@@ -18,7 +18,7 @@static u64 gen8_pde_encode (const dma_addr_t addr,const enum i915_cache_level level) { -u64 pde = addr | _PAGE_PRESENT | _PAGE_RW; +u64 pde = addr |I915_PAGE_PRESENT |I915_PAGE_RW ;if (level !=I915_CACHE_NONE ) pde |=PPAT_CACHED_PDE ;
@@ -32,10 +32,10 @@ static u64 gen8_pte_encode(dma_addr_t addr, enum i915_cache_level level, u32 flags) { -gen8_pte_t pte = addr | _PAGE_PRESENT | _PAGE_RW; +gen8_pte_t pte = addr |I915_PAGE_PRESENT |I915_PAGE_RW ;if (unlikely (flags &PTE_READ_ONLY )) - pte &= ~_PAGE_RW; + pte &= ~I915_PAGE_RW ;if (flags &PTE_LM ) pte |=GEN12_PPGTT_PTE_LM ;
drivers/gpu/drm/i915/gt/intel_ggtt.c +1 -1
@@ -209,7 +209,7 @@ u64 gen8_ggtt_pte_encode(dma_addr_t addr, enum i915_cache_level level, u32 flags) { -gen8_pte_t pte = addr | _PAGE_PRESENT; +gen8_pte_t pte = addr |I915_PAGE_PRESENT ;if (flags &PTE_LM ) pte |=GEN12_GGTT_PTE_LM ;
drivers/gpu/drm/i915/gt/intel_gtt.h +3 -0
@@ -39,6 +39,9 @@#define NALLOC 3/* 1 normal, 1 for concurrent threads, 1 for preallocation */ +#define I915_PAGE_PRESENT BIT_ULL(0) +#define I915_PAGE_RW BIT_ULL(1) +#define I915_GTT_PAGE_SIZE_4K BIT_ULL(12)#define I915_GTT_PAGE_SIZE_64K BIT_ULL(16)#define I915_GTT_PAGE_SIZE_2M BIT_ULL(21)
drivers/gpu/drm/i915/gvt/gtt.c +6 -6
@@ -446,17 +446,17 @@ static bool gen8_gtt_test_present(struct intel_gvt_gtt_entry *e) || e->type == GTT_TYPE_PPGTT_ROOT_L4_ENTRY)return (e->val64 !=0 ); else - return (e->val64 & _PAGE_PRESENT); + return (e->val64 & I915_PAGE_PRESENT); }static void gtt_entry_clear_present (struct intel_gvt_gtt_entry *e) { - e->val64 &= ~_PAGE_PRESENT; + e->val64 &= ~I915_PAGE_PRESENT ; }static void gtt_entry_set_present (struct intel_gvt_gtt_entry *e) { - e->val64 |= _PAGE_PRESENT; + e->val64 |=I915_PAGE_PRESENT ; }static bool gen8_gtt_test_64k_splited (struct intel_gvt_gtt_entry *e)
@@ -2439,7 +2439,7 @@ static int alloc_scratch_pages(struct intel_vgpu *vgpu,/* The entry parameters like present/writeable/cache type * set to the same as i915's scratch page tree. */ - se.val64 |= _PAGE_PRESENT | _PAGE_RW; + se.val64 |=I915_PAGE_PRESENT |I915_PAGE_RW ;if (type ==GTT_TYPE_PPGTT_PDE_PT ) se.val64 |=PPAT_CACHED ;
@@ -2896,7 +2896,7 @@ void intel_gvt_restore_ggtt(struct intel_gvt *gvt) offset =vgpu_aperture_gmadr_base (vgpu) >>PAGE_SHIFT ;for (idx =0 ; idx < num_low; idx++) { pte = mm->ggtt_mm.host_ggtt_aperture[idx]; -if (pte & _PAGE_PRESENT) +if (pte &I915_PAGE_PRESENT )write_pte64 (vgpu->gvt->gt->ggtt, offset + idx, pte); }
@@ -2904,7 +2904,7 @@ void intel_gvt_restore_ggtt(struct intel_gvt *gvt) offset =vgpu_hidden_gmadr_base (vgpu) >>PAGE_SHIFT ;for (idx =0 ; idx < num_hi; idx++) { pte = mm->ggtt_mm.host_ggtt_hidden[idx]; -if (pte & _PAGE_PRESENT) +if (pte &I915_PAGE_PRESENT )write_pte64 (vgpu->gvt->gt->ggtt, offset + idx, pte); } }
Signature · 1 line
2.25.1
Patchwork
CI[Intel-gfx] ✗ Fi.CI.BUILD: failure for series starting with [v5,1/1] drm/i915: Introduce new macros for i915 PTE
In reply to Michael Cheng== Series Details ==
== Series Details ==
Series: series starting with [v5,1/1] drm/i915: Introduce new macros for i915 PTE
URL : https://patchwork.freedesktop.org/series/97559/
State : failure
== Summary ==
Patch is empty.
When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".