diff options
-rw-r--r-- | drivers/gpu/drm/i915/i915_drv.h | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem.c | 40 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_sysfs.c | 3 |
3 files changed, 23 insertions, 22 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index c6e8df737566..0c39805b881e 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -1949,7 +1949,7 @@ bool i915_gem_clflush_object(struct drm_i915_gem_object *obj, bool force); | |||
1949 | int __must_check i915_gem_object_finish_gpu(struct drm_i915_gem_object *obj); | 1949 | int __must_check i915_gem_object_finish_gpu(struct drm_i915_gem_object *obj); |
1950 | int __must_check i915_gem_init(struct drm_device *dev); | 1950 | int __must_check i915_gem_init(struct drm_device *dev); |
1951 | int __must_check i915_gem_init_hw(struct drm_device *dev); | 1951 | int __must_check i915_gem_init_hw(struct drm_device *dev); |
1952 | void i915_gem_l3_remap(struct drm_device *dev, int slice); | 1952 | int i915_gem_l3_remap(struct intel_ring_buffer *ring, int slice); |
1953 | void i915_gem_init_swizzling(struct drm_device *dev); | 1953 | void i915_gem_init_swizzling(struct drm_device *dev); |
1954 | void i915_gem_cleanup_ringbuffer(struct drm_device *dev); | 1954 | void i915_gem_cleanup_ringbuffer(struct drm_device *dev); |
1955 | int __must_check i915_gpu_idle(struct drm_device *dev); | 1955 | int __must_check i915_gpu_idle(struct drm_device *dev); |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 21a3d69679ee..e4f17e594703 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -4222,35 +4222,35 @@ i915_gem_idle(struct drm_device *dev) | |||
4222 | return 0; | 4222 | return 0; |
4223 | } | 4223 | } |
4224 | 4224 | ||
4225 | void i915_gem_l3_remap(struct drm_device *dev, int slice) | 4225 | int i915_gem_l3_remap(struct intel_ring_buffer *ring, int slice) |
4226 | { | 4226 | { |
4227 | struct drm_device *dev = ring->dev; | ||
4227 | drm_i915_private_t *dev_priv = dev->dev_private; | 4228 | drm_i915_private_t *dev_priv = dev->dev_private; |
4228 | u32 reg_base = GEN7_L3LOG_BASE + (slice * 0x200); | 4229 | u32 reg_base = GEN7_L3LOG_BASE + (slice * 0x200); |
4229 | u32 *remap_info = dev_priv->l3_parity.remap_info[slice]; | 4230 | u32 *remap_info = dev_priv->l3_parity.remap_info[slice]; |
4230 | u32 misccpctl; | 4231 | int i, ret; |
4231 | int i; | ||
4232 | 4232 | ||
4233 | if (!HAS_L3_GPU_CACHE(dev) || !remap_info) | 4233 | if (!HAS_L3_GPU_CACHE(dev) || !remap_info) |
4234 | return; | 4234 | return 0; |
4235 | 4235 | ||
4236 | misccpctl = I915_READ(GEN7_MISCCPCTL); | 4236 | ret = intel_ring_begin(ring, GEN7_L3LOG_SIZE / 4 * 3); |
4237 | I915_WRITE(GEN7_MISCCPCTL, misccpctl & ~GEN7_DOP_CLOCK_GATE_ENABLE); | 4237 | if (ret) |
4238 | POSTING_READ(GEN7_MISCCPCTL); | 4238 | return ret; |
4239 | 4239 | ||
4240 | /* | ||
4241 | * Note: We do not worry about the concurrent register cacheline hang | ||
4242 | * here because no other code should access these registers other than | ||
4243 | * at initialization time. | ||
4244 | */ | ||
4240 | for (i = 0; i < GEN7_L3LOG_SIZE; i += 4) { | 4245 | for (i = 0; i < GEN7_L3LOG_SIZE; i += 4) { |
4241 | u32 remap = I915_READ(reg_base + i); | 4246 | intel_ring_emit(ring, MI_LOAD_REGISTER_IMM(1)); |
4242 | if (remap && remap != remap_info[i/4]) | 4247 | intel_ring_emit(ring, reg_base + i); |
4243 | DRM_DEBUG("0x%x was already programmed to %x\n", | 4248 | intel_ring_emit(ring, remap_info[i/4]); |
4244 | reg_base + i, remap); | ||
4245 | if (remap && !remap_info[i/4]) | ||
4246 | DRM_DEBUG_DRIVER("Clearing remapped register\n"); | ||
4247 | I915_WRITE(reg_base + i, remap_info[i/4]); | ||
4248 | } | 4249 | } |
4249 | 4250 | ||
4250 | /* Make sure all the writes land before disabling dop clock gating */ | 4251 | intel_ring_advance(ring); |
4251 | POSTING_READ(reg_base); | ||
4252 | 4252 | ||
4253 | I915_WRITE(GEN7_MISCCPCTL, misccpctl); | 4253 | return ret; |
4254 | } | 4254 | } |
4255 | 4255 | ||
4256 | void i915_gem_init_swizzling(struct drm_device *dev) | 4256 | void i915_gem_init_swizzling(struct drm_device *dev) |
@@ -4361,15 +4361,15 @@ i915_gem_init_hw(struct drm_device *dev) | |||
4361 | I915_WRITE(GEN7_MSG_CTL, temp); | 4361 | I915_WRITE(GEN7_MSG_CTL, temp); |
4362 | } | 4362 | } |
4363 | 4363 | ||
4364 | for (i = 0; i < NUM_L3_SLICES(dev); i++) | ||
4365 | i915_gem_l3_remap(dev, i); | ||
4366 | |||
4367 | i915_gem_init_swizzling(dev); | 4364 | i915_gem_init_swizzling(dev); |
4368 | 4365 | ||
4369 | ret = i915_gem_init_rings(dev); | 4366 | ret = i915_gem_init_rings(dev); |
4370 | if (ret) | 4367 | if (ret) |
4371 | return ret; | 4368 | return ret; |
4372 | 4369 | ||
4370 | for (i = 0; i < NUM_L3_SLICES(dev); i++) | ||
4371 | i915_gem_l3_remap(&dev_priv->ring[RCS], i); | ||
4372 | |||
4373 | /* | 4373 | /* |
4374 | * XXX: There was some w/a described somewhere suggesting loading | 4374 | * XXX: There was some w/a described somewhere suggesting loading |
4375 | * contexts before PPGTT. | 4375 | * contexts before PPGTT. |
diff --git a/drivers/gpu/drm/i915/i915_sysfs.c b/drivers/gpu/drm/i915/i915_sysfs.c index 3a8bf0c9b5ce..b07bdfb8892d 100644 --- a/drivers/gpu/drm/i915/i915_sysfs.c +++ b/drivers/gpu/drm/i915/i915_sysfs.c | |||
@@ -204,7 +204,8 @@ i915_l3_write(struct file *filp, struct kobject *kobj, | |||
204 | 204 | ||
205 | memcpy(dev_priv->l3_parity.remap_info[slice] + (offset/4), buf, count); | 205 | memcpy(dev_priv->l3_parity.remap_info[slice] + (offset/4), buf, count); |
206 | 206 | ||
207 | i915_gem_l3_remap(drm_dev, slice); | 207 | if (i915_gem_l3_remap(&dev_priv->ring[RCS], slice)) |
208 | count = 0; | ||
208 | 209 | ||
209 | mutex_unlock(&drm_dev->struct_mutex); | 210 | mutex_unlock(&drm_dev->struct_mutex); |
210 | 211 | ||