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

drm/i915: move gen8 irq shifts to intel_lrc.c

The only usage outside the intel_lrc.c file is in the ringbuffer
init, but the irq mask calculated there is then overwritten for
all engines that have a non-zero shift, so we can drop it.

This change is not aimed at code saving but at removing from
intel_engines information that does not apply to all gens that have
the engine. When checking without the temporary WARN_ON, code size
is basically unchanged.

v2: make the irq_shifts array static const
v3: rebase, move irq_shifts array to logical_ring_default_irqs
v4: move array inside the if and use u8 for it (Chris)

Suggested-by: Michel Thierry <michel.thierry@intel.com>
Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20180314182653.26981-4-daniele.ceraolospurio@intel.com

authored by

Daniele Ceraolo Spurio and committed by
Chris Wilson
fa6f071d 210060ed

+16 -14
-10
drivers/gpu/drm/i915/intel_engine_cs.c
··· 92 92 u32 gen : 8; 93 93 u32 base : 24; 94 94 } mmio_bases[MAX_MMIO_BASES]; 95 - unsigned irq_shift; 96 95 }; 97 96 98 97 static const struct engine_info intel_engines[] = { ··· 103 104 .mmio_bases = { 104 105 { .gen = 1, .base = RENDER_RING_BASE } 105 106 }, 106 - .irq_shift = GEN8_RCS_IRQ_SHIFT, 107 107 }, 108 108 [BCS] = { 109 109 .hw_id = BCS_HW, ··· 112 114 .mmio_bases = { 113 115 { .gen = 6, .base = BLT_RING_BASE } 114 116 }, 115 - .irq_shift = GEN8_BCS_IRQ_SHIFT, 116 117 }, 117 118 [VCS] = { 118 119 .hw_id = VCS_HW, ··· 123 126 { .gen = 6, .base = GEN6_BSD_RING_BASE }, 124 127 { .gen = 4, .base = BSD_RING_BASE } 125 128 }, 126 - .irq_shift = GEN8_VCS1_IRQ_SHIFT, 127 129 }, 128 130 [VCS2] = { 129 131 .hw_id = VCS2_HW, ··· 133 137 { .gen = 11, .base = GEN11_BSD2_RING_BASE }, 134 138 { .gen = 8, .base = GEN8_BSD2_RING_BASE } 135 139 }, 136 - .irq_shift = GEN8_VCS2_IRQ_SHIFT, 137 140 }, 138 141 [VCS3] = { 139 142 .hw_id = VCS3_HW, ··· 142 147 .mmio_bases = { 143 148 { .gen = 11, .base = GEN11_BSD3_RING_BASE } 144 149 }, 145 - .irq_shift = 0, /* not used */ 146 150 }, 147 151 [VCS4] = { 148 152 .hw_id = VCS4_HW, ··· 151 157 .mmio_bases = { 152 158 { .gen = 11, .base = GEN11_BSD4_RING_BASE } 153 159 }, 154 - .irq_shift = 0, /* not used */ 155 160 }, 156 161 [VECS] = { 157 162 .hw_id = VECS_HW, ··· 161 168 { .gen = 11, .base = GEN11_VEBOX_RING_BASE }, 162 169 { .gen = 7, .base = VEBOX_RING_BASE } 163 170 }, 164 - .irq_shift = GEN8_VECS_IRQ_SHIFT, 165 171 }, 166 172 [VECS2] = { 167 173 .hw_id = VECS2_HW, ··· 170 178 .mmio_bases = { 171 179 { .gen = 11, .base = GEN11_VEBOX2_RING_BASE } 172 180 }, 173 - .irq_shift = 0, /* not used */ 174 181 }, 175 182 }; 176 183 ··· 292 301 __sprint_engine_name(engine->name, info); 293 302 engine->hw_id = engine->guc_id = info->hw_id; 294 303 engine->mmio_base = __engine_mmio_base(dev_priv, info->mmio_bases); 295 - engine->irq_shift = info->irq_shift; 296 304 engine->class = info->class; 297 305 engine->instance = info->instance; 298 306
+14 -1
drivers/gpu/drm/i915/intel_lrc.c
··· 2118 2118 static inline void 2119 2119 logical_ring_default_irqs(struct intel_engine_cs *engine) 2120 2120 { 2121 - unsigned shift = engine->irq_shift; 2121 + unsigned int shift = 0; 2122 + 2123 + if (INTEL_GEN(engine->i915) < 11) { 2124 + const u8 irq_shifts[] = { 2125 + [RCS] = GEN8_RCS_IRQ_SHIFT, 2126 + [BCS] = GEN8_BCS_IRQ_SHIFT, 2127 + [VCS] = GEN8_VCS1_IRQ_SHIFT, 2128 + [VCS2] = GEN8_VCS2_IRQ_SHIFT, 2129 + [VECS] = GEN8_VECS_IRQ_SHIFT, 2130 + }; 2131 + 2132 + shift = irq_shifts[engine->id]; 2133 + } 2134 + 2122 2135 engine->irq_enable_mask = GT_RENDER_USER_INTERRUPT << shift; 2123 2136 engine->irq_keep_mask = GT_CONTEXT_SWITCH_INTERRUPT << shift; 2124 2137 }
+2 -2
drivers/gpu/drm/i915/intel_ringbuffer.c
··· 1944 1944 static void intel_ring_init_irq(struct drm_i915_private *dev_priv, 1945 1945 struct intel_engine_cs *engine) 1946 1946 { 1947 - engine->irq_enable_mask = GT_RENDER_USER_INTERRUPT << engine->irq_shift; 1948 - 1949 1947 if (INTEL_GEN(dev_priv) >= 6) { 1950 1948 engine->irq_enable = gen6_irq_enable; 1951 1949 engine->irq_disable = gen6_irq_disable; ··· 2027 2029 2028 2030 if (HAS_L3_DPF(dev_priv)) 2029 2031 engine->irq_keep_mask = GT_RENDER_L3_PARITY_ERROR_INTERRUPT; 2032 + 2033 + engine->irq_enable_mask = GT_RENDER_USER_INTERRUPT; 2030 2034 2031 2035 if (INTEL_GEN(dev_priv) >= 6) { 2032 2036 engine->init_context = intel_rcs_ctx_init;
-1
drivers/gpu/drm/i915/intel_ringbuffer.h
··· 331 331 u8 instance; 332 332 u32 context_size; 333 333 u32 mmio_base; 334 - unsigned int irq_shift; 335 334 336 335 struct intel_ring *buffer; 337 336 struct intel_timeline *timeline;