[PATCH 3/4] drm/i915: Do not allocate unused PPAT entries
Chris Wilson
chris at chris-wilson.co.uk
Thu Sep 7 21:27:28 UTC 2017
Quoting Zhi Wang (2017-09-05 20:58:26)
> static void gen6_gmch_remove(struct i915_address_space *vm)
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.h b/drivers/gpu/drm/i915/i915_gem_gtt.h
> index e10ca89..575da15 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.h
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.h
> @@ -131,6 +131,13 @@ typedef u64 gen8_ppgtt_pml4e_t;
> #define PPAT_CACHED_INDEX _PAGE_PAT /* WB LLCeLLC */
> #define PPAT_DISPLAY_ELLC_INDEX _PAGE_PCD /* WT eLLC */
>
> +/* PPAT index = 4 * PAT + 2 * PCD + PWT */
> +static inline unsigned int ppat_bits_to_index(unsigned int bits)
> +{
> + return (4 * !!(bits & _PAGE_PAT) + 2 * !!(bits & _PAGE_PCD)
> + + !!(bits & _PAGE_PWT));
> +}
Let's not let this leak out of the gtt.c.
__alloc_ppat_entry(ppat, ppat_bits_to_index(PPAT_CACHED_PDE_INDEX), CHV_PPAT_SNOOP);
is horrible. bits_to_index() on an index is nonsense. We have a severe
naming issue here...
-Chris
More information about the intel-gvt-dev
mailing list