Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/i915: Rename I915_CACHE_MLC_LLC to L3_LLC for Ivybridge

MLC_LLC was never validated for Sandybridge and was superseded by a new
level of cacheing for the GPU in Ivybridge. Update our names to be
consistent with usage, and in the process stop setting the unwanted bit
on Sandybridge.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
[danvet: s/BUG/WARN_ON(1) bikeshed.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>

authored by

Chris Wilson and committed by
Daniel Vetter
350ec881 ad8d270c

+38 -12
+5 -2
drivers/gpu/drm/i915/i915_drv.h
··· 449 449 450 450 enum i915_cache_level { 451 451 I915_CACHE_NONE = 0, 452 - I915_CACHE_LLC, 453 - I915_CACHE_LLC_MLC, /* gen6+, in docs at least! */ 452 + I915_CACHE_LLC, /* also used for snoopable memory on non-LLC */ 453 + I915_CACHE_L3_LLC, /* gen7+, L3 sits between the domain specifc 454 + caches, eg sampler/render caches, and the 455 + large Last-Level-Cache. LLC is coherent with 456 + the CPU, but L3 is only visible to the GPU. */ 454 457 }; 455 458 456 459 typedef uint32_t gen6_gtt_pte_t;
+1 -1
drivers/gpu/drm/i915/i915_gem_context.c
··· 155 155 156 156 if (INTEL_INFO(dev)->gen >= 7) { 157 157 ret = i915_gem_object_set_cache_level(ctx->obj, 158 - I915_CACHE_LLC_MLC); 158 + I915_CACHE_L3_LLC); 159 159 /* Failure shouldn't ever happen this early */ 160 160 if (WARN_ON(ret)) 161 161 goto err_out;
+30 -7
drivers/gpu/drm/i915/i915_gem_gtt.c
··· 43 43 #define GEN6_PTE_UNCACHED (1 << 1) 44 44 #define HSW_PTE_UNCACHED (0) 45 45 #define GEN6_PTE_CACHE_LLC (2 << 1) 46 - #define GEN6_PTE_CACHE_LLC_MLC (3 << 1) 46 + #define GEN7_PTE_CACHE_L3_LLC (3 << 1) 47 47 #define GEN6_PTE_ADDR_ENCODE(addr) GEN6_GTT_ADDR_ENCODE(addr) 48 48 #define HSW_PTE_ADDR_ENCODE(addr) HSW_GTT_ADDR_ENCODE(addr) 49 49 ··· 56 56 #define HSW_WB_LLC_AGE0 HSW_CACHEABILITY_CONTROL(0x3) 57 57 #define HSW_WB_ELLC_LLC_AGE0 HSW_CACHEABILITY_CONTROL(0xb) 58 58 59 - static gen6_gtt_pte_t gen6_pte_encode(dma_addr_t addr, 60 - enum i915_cache_level level) 59 + static gen6_gtt_pte_t snb_pte_encode(dma_addr_t addr, 60 + enum i915_cache_level level) 61 61 { 62 62 gen6_gtt_pte_t pte = GEN6_PTE_VALID; 63 63 pte |= GEN6_PTE_ADDR_ENCODE(addr); 64 64 65 65 switch (level) { 66 - case I915_CACHE_LLC_MLC: 67 - pte |= GEN6_PTE_CACHE_LLC_MLC; 66 + case I915_CACHE_L3_LLC: 67 + case I915_CACHE_LLC: 68 + pte |= GEN6_PTE_CACHE_LLC; 69 + break; 70 + case I915_CACHE_NONE: 71 + pte |= GEN6_PTE_UNCACHED; 72 + break; 73 + default: 74 + WARN_ON(1); 75 + } 76 + 77 + return pte; 78 + } 79 + 80 + static gen6_gtt_pte_t ivb_pte_encode(dma_addr_t addr, 81 + enum i915_cache_level level) 82 + { 83 + gen6_gtt_pte_t pte = GEN6_PTE_VALID; 84 + pte |= GEN6_PTE_ADDR_ENCODE(addr); 85 + 86 + switch (level) { 87 + case I915_CACHE_L3_LLC: 88 + pte |= GEN7_PTE_CACHE_L3_LLC; 68 89 break; 69 90 case I915_CACHE_LLC: 70 91 pte |= GEN6_PTE_CACHE_LLC; ··· 94 73 pte |= GEN6_PTE_UNCACHED; 95 74 break; 96 75 default: 97 - BUG(); 76 + WARN_ON(1); 98 77 } 99 78 100 79 return pte; ··· 911 890 gtt->base.pte_encode = hsw_pte_encode; 912 891 else if (IS_VALLEYVIEW(dev)) 913 892 gtt->base.pte_encode = byt_pte_encode; 893 + else if (INTEL_INFO(dev)->gen >= 7) 894 + gtt->base.pte_encode = ivb_pte_encode; 914 895 else 915 - gtt->base.pte_encode = gen6_pte_encode; 896 + gtt->base.pte_encode = snb_pte_encode; 916 897 } 917 898 918 899 ret = gtt->gtt_probe(dev, &gtt->base.total, &gtt->stolen_size,
+2 -2
drivers/gpu/drm/i915/i915_gpu_error.c
··· 938 938 { 939 939 switch (type) { 940 940 case I915_CACHE_NONE: return " uncached"; 941 - case I915_CACHE_LLC: return " snooped (LLC)"; 942 - case I915_CACHE_LLC_MLC: return " snooped (LLC+MLC)"; 941 + case I915_CACHE_LLC: return " snooped or LLC"; 942 + case I915_CACHE_L3_LLC: return " L3+LLC"; 943 943 default: return ""; 944 944 } 945 945 }