aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2017-03-13 13:04:33 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-04-18 01:11:46 -0400
commit954ce087072cceb25a9106ba85d98e3219e4af7a (patch)
tree562f34e83d3d65263d2c098201445d345a345a13 /drivers/gpu/drm
parent1cbf6296fb355b3906813852e025f1073db508ff (diff)
drm/i915: Drop support for I915_EXEC_CONSTANTS_* execbuf parameters.
commit 0f5418e564ac6452b9086295646e602a9addc4bf upstream. This patch makes the I915_PARAM_HAS_EXEC_CONSTANTS getparam return 0 (indicating the optional feature is not supported), and makes execbuf always return -EINVAL if the flags are used. Apparently, no userspace ever shipped which used this optional feature: I checked the git history of Mesa, xf86-video-intel, libva, and Beignet, and there were zero commits showing a use of these flags. Kernel commit 72bfa19c8deb4 apparently introduced the feature prematurely. According to Chris, the intention was to use this in cairo-drm, but "the use was broken for gen6", so I don't think it ever happened. 'relative_constants_mode' has always been tracked per-device, but this has actually been wrong ever since hardware contexts were introduced, as the INSTPM register is saved (and automatically restored) as part of the render ring context. The software per-device value could therefore get out of sync with the hardware per-context value. This meant that using them is actually unsafe: a client which tried to use them could damage the state of other clients, causing the GPU to interpret their BO offsets as absolute pointers, leading to bogus memory reads. These flags were also never ported to execlist mode, making them no-ops on Gen9+ (which requires execlists), and Gen8 in the default mode. On Gen8+, userspace can write these registers directly, achieving the same effect. On Gen6-7.5, it likely makes sense to extend the command parser to support them. I don't think anyone wants this on Gen4-5. Based on a patch by Dave Gordon. v3: Return -ENODEV for the getparam, as this is what we do for other obsolete features. Suggested by Chris Wilson. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92448 Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Link: http://patchwork.freedesktop.org/patch/msgid/20170215093446.21291-1-kenneth@whitecape.org Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Link: http://patchwork.freedesktop.org/patch/msgid/20170313170433.26843-1-chris@chris-wilson.co.uk (cherry picked from commit ef0f411f51475f4eebf9fc1b19a85be698af19ff) Signed-off-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/i915/i915_drv.c4
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h2
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c2
-rw-r--r--drivers/gpu/drm/i915/i915_gem_execbuffer.c52
4 files changed, 3 insertions, 57 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 670beebc32f6..923150de46cb 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -240,6 +240,7 @@ static int i915_getparam(struct drm_device *dev, void *data,
240 case I915_PARAM_IRQ_ACTIVE: 240 case I915_PARAM_IRQ_ACTIVE:
241 case I915_PARAM_ALLOW_BATCHBUFFER: 241 case I915_PARAM_ALLOW_BATCHBUFFER:
242 case I915_PARAM_LAST_DISPATCH: 242 case I915_PARAM_LAST_DISPATCH:
243 case I915_PARAM_HAS_EXEC_CONSTANTS:
243 /* Reject all old ums/dri params. */ 244 /* Reject all old ums/dri params. */
244 return -ENODEV; 245 return -ENODEV;
245 case I915_PARAM_CHIPSET_ID: 246 case I915_PARAM_CHIPSET_ID:
@@ -266,9 +267,6 @@ static int i915_getparam(struct drm_device *dev, void *data,
266 case I915_PARAM_HAS_BSD2: 267 case I915_PARAM_HAS_BSD2:
267 value = intel_engine_initialized(&dev_priv->engine[VCS2]); 268 value = intel_engine_initialized(&dev_priv->engine[VCS2]);
268 break; 269 break;
269 case I915_PARAM_HAS_EXEC_CONSTANTS:
270 value = INTEL_GEN(dev_priv) >= 4;
271 break;
272 case I915_PARAM_HAS_LLC: 270 case I915_PARAM_HAS_LLC:
273 value = HAS_LLC(dev_priv); 271 value = HAS_LLC(dev_priv);
274 break; 272 break;
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index da832d3cdca7..107146c82776 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1751,8 +1751,6 @@ struct drm_i915_private {
1751 1751
1752 const struct intel_device_info info; 1752 const struct intel_device_info info;
1753 1753
1754 int relative_constants_mode;
1755
1756 void __iomem *regs; 1754 void __iomem *regs;
1757 1755
1758 struct intel_uncore uncore; 1756 struct intel_uncore uncore;
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 00eb4814b913..7b2030925825 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -4587,8 +4587,6 @@ i915_gem_load_init(struct drm_device *dev)
4587 init_waitqueue_head(&dev_priv->gpu_error.wait_queue); 4587 init_waitqueue_head(&dev_priv->gpu_error.wait_queue);
4588 init_waitqueue_head(&dev_priv->gpu_error.reset_queue); 4588 init_waitqueue_head(&dev_priv->gpu_error.reset_queue);
4589 4589
4590 dev_priv->relative_constants_mode = I915_EXEC_CONSTANTS_REL_GENERAL;
4591
4592 init_waitqueue_head(&dev_priv->pending_flip_queue); 4590 init_waitqueue_head(&dev_priv->pending_flip_queue);
4593 4591
4594 dev_priv->mm.interruptible = true; 4592 dev_priv->mm.interruptible = true;
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index 0c400f852a76..2117f172d7a2 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -1454,10 +1454,7 @@ execbuf_submit(struct i915_execbuffer_params *params,
1454 struct drm_i915_gem_execbuffer2 *args, 1454 struct drm_i915_gem_execbuffer2 *args,
1455 struct list_head *vmas) 1455 struct list_head *vmas)
1456{ 1456{
1457 struct drm_i915_private *dev_priv = params->request->i915;
1458 u64 exec_start, exec_len; 1457 u64 exec_start, exec_len;
1459 int instp_mode;
1460 u32 instp_mask;
1461 int ret; 1458 int ret;
1462 1459
1463 ret = i915_gem_execbuffer_move_to_gpu(params->request, vmas); 1460 ret = i915_gem_execbuffer_move_to_gpu(params->request, vmas);
@@ -1468,56 +1465,11 @@ execbuf_submit(struct i915_execbuffer_params *params,
1468 if (ret) 1465 if (ret)
1469 return ret; 1466 return ret;
1470 1467
1471 instp_mode = args->flags & I915_EXEC_CONSTANTS_MASK; 1468 if (args->flags & I915_EXEC_CONSTANTS_MASK) {
1472 instp_mask = I915_EXEC_CONSTANTS_MASK; 1469 DRM_DEBUG("I915_EXEC_CONSTANTS_* unsupported\n");
1473 switch (instp_mode) {
1474 case I915_EXEC_CONSTANTS_REL_GENERAL:
1475 case I915_EXEC_CONSTANTS_ABSOLUTE:
1476 case I915_EXEC_CONSTANTS_REL_SURFACE:
1477 if (instp_mode != 0 && params->engine->id != RCS) {
1478 DRM_DEBUG("non-0 rel constants mode on non-RCS\n");
1479 return -EINVAL;
1480 }
1481
1482 if (instp_mode != dev_priv->relative_constants_mode) {
1483 if (INTEL_INFO(dev_priv)->gen < 4) {
1484 DRM_DEBUG("no rel constants on pre-gen4\n");
1485 return -EINVAL;
1486 }
1487
1488 if (INTEL_INFO(dev_priv)->gen > 5 &&
1489 instp_mode == I915_EXEC_CONSTANTS_REL_SURFACE) {
1490 DRM_DEBUG("rel surface constants mode invalid on gen5+\n");
1491 return -EINVAL;
1492 }
1493
1494 /* The HW changed the meaning on this bit on gen6 */
1495 if (INTEL_INFO(dev_priv)->gen >= 6)
1496 instp_mask &= ~I915_EXEC_CONSTANTS_REL_SURFACE;
1497 }
1498 break;
1499 default:
1500 DRM_DEBUG("execbuf with unknown constants: %d\n", instp_mode);
1501 return -EINVAL; 1470 return -EINVAL;
1502 } 1471 }
1503 1472
1504 if (params->engine->id == RCS &&
1505 instp_mode != dev_priv->relative_constants_mode) {
1506 struct intel_ring *ring = params->request->ring;
1507
1508 ret = intel_ring_begin(params->request, 4);
1509 if (ret)
1510 return ret;
1511
1512 intel_ring_emit(ring, MI_NOOP);
1513 intel_ring_emit(ring, MI_LOAD_REGISTER_IMM(1));
1514 intel_ring_emit_reg(ring, INSTPM);
1515 intel_ring_emit(ring, instp_mask << 16 | instp_mode);
1516 intel_ring_advance(ring);
1517
1518 dev_priv->relative_constants_mode = instp_mode;
1519 }
1520
1521 if (args->flags & I915_EXEC_GEN7_SOL_RESET) { 1473 if (args->flags & I915_EXEC_GEN7_SOL_RESET) {
1522 ret = i915_reset_gen7_sol_offsets(params->request); 1474 ret = i915_reset_gen7_sol_offsets(params->request);
1523 if (ret) 1475 if (ret)