Skip to contentSkip to conversation

drm/i915: Remove secure batch buffer flag SNB+

PATCH In review Ben Widawsky 3 participants 5 messages Oct 5, 2011 – Oct 6, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: Remove secure batch buffer flag SNB+

Docs say that the secure batchbuffer field for > SNB B0 (products that actually shipped) should be 0 when not using PPGTT. I'd guess this has no positive or negative effect, but is just here to jive with the docs.

---
 drivers/gpu/drm/i915/i915_dma.c         |    5 ++++-
 drivers/gpu/drm/i915/intel_ringbuffer.c |   10 ++++++++--
 2 files changed, 12 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_dma.c +4 -1
index d76da38..1cb6d80 100644
@@ -477,7 +477,10 @@ static int i915_dispatch_batchbuffer(struct drm_device * dev,
 			if (ret)
 				return ret;
 
-			if (INTEL_INFO(dev)->gen >= 4) {
+			if (INTEL_INFO(dev)->gen >= 6) {
+				OUT_RING(MI_BATCH_BUFFER_START);
+				OUT_RING(batch->start);
+			} else if (INTEL_INFO(dev)->gen >= 4) {
 				OUT_RING(MI_BATCH_BUFFER_START | (2 << 6) | MI_BATCH_NON_SECURE_I965);
 				OUT_RING(batch->start);
 			} else {
drivers/gpu/drm/i915/intel_ringbuffer.c +8 -2
index 0e99589..a08d16d 100644
@@ -279,6 +279,9 @@ cleanup_pipe_control(struct intel_ring_buffer *ring)
 	ring->private = NULL;
 }
 
+static const struct intel_ring_buffer render_ring;
+static const struct intel_ring_buffer gen6_bsd_ring;
+static const struct intel_ring_buffer gen6_blt_ring;
 static int init_render_ring(struct intel_ring_buffer *ring)
 {
 	struct drm_device *dev = ring->dev;
@@ -783,7 +786,10 @@ render_ring_dispatch_execbuffer(struct intel_ring_buffer *ring,
 		if (ret)
 			return ret;
 
-		if (INTEL_INFO(dev)->gen >= 4) {
+		if (INTEL_INFO(dev)->gen >= 6) {
+			intel_ring_emit(ring, MI_BATCH_BUFFER_START);
+			intel_ring_emit(ring, offset);
+		} else if (INTEL_INFO(dev)->gen >= 4) {
 			intel_ring_emit(ring,
 					MI_BATCH_BUFFER_START | (2 << 6) |
 					MI_BATCH_NON_SECURE_I965);
@@ -1153,7 +1159,7 @@ gen6_ring_dispatch_execbuffer(struct intel_ring_buffer *ring,
 	if (ret)
 		return ret;
 
-	intel_ring_emit(ring, MI_BATCH_BUFFER_START | MI_BATCH_NON_SECURE_I965);
+	intel_ring_emit(ring, MI_BATCH_BUFFER_START);
 	/* bit0-7 is the length on GEN6+ */
 	intel_ring_emit(ring, offset);
 	intel_ring_advance(ring);
Signature · 1 line
1.7.7
#1 lore raw
Quoted 3 lines · Ben Widawsky

Docs say that the secure batchbuffer field for > SNB B0 (products that actually shipped) should be 0 when not using PPGTT. I'd guess this has no positive or negative effect, but is just here to jive with the docs.

How explicit is the warning? Enough to allow arbitrary writes into the MMIO space?
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#2 lore raw
Quoted 9 lines · On Wed, 05 Oct 2011 22:26:54 +0100 Chris Wilson <[email protected]>…
Quoted 3 lines · Ben Widawsky

Docs say that the secure batchbuffer field for > SNB B0 (products that actually shipped) should be 0 when not using PPGTT. I'd guess this has no positive or negative effect, but is just here to jive with the docs.

How explicit is the warning? Enough to allow arbitrary writes into the MMIO space?
-Chris

The docs really suck, and I am honestly quite confused.

It simply says (for both blitter and render):
"This field must be '0' unless the Per-Process GTT Enable is '1'"

:/

I'm sure we already have a test for it, but I can write one if not.

Ben

#3 lore raw
In reply to Chris Wilson
Quoted 9 lines · Chris Wilson
Quoted 3 lines · Ben Widawsky

Docs say that the secure batchbuffer field for > SNB B0 (products that actually shipped) should be 0 when not using PPGTT. I'd guess this has no positive or negative effect, but is just here to jive with the docs.

How explicit is the warning? Enough to allow arbitrary writes into the MMIO space?
-Chris

the windows driver does this from what we hear. not sure if that's good or bad though.

#4 lore raw
In reply to Chris Wilson
Quoted 7 lines · Chris Wilson
Quoted 3 lines · Ben Widawsky

Docs say that the secure batchbuffer field for > SNB B0 (products that actually shipped) should be 0 when not using PPGTT. I'd guess this has no positive or negative effect, but is just here to jive with the docs.

How explicit is the warning? Enough to allow arbitrary writes into the MMIO space?

I've run this on my snb the past month and couldn't find anything this unbreaks. Afaics it allows batchbuffers to run a few more MI commands instead of hanging the gpu with them. But we're not using these from userspace and they only started to be allowed on snb+ - previous gens convert them to noops.

Also this allows arbitrary reads/writes to system memory, because with this batchbuffers can update gtt ptes with MI_UPDATE_GTT.

Even when we find an actual hang this fixes, I think implement ppgtt is the right thing to do. So

Signature · 3 lines
Daniel Vetter
Mail: [email protected]
Mobile: +41 (0)79 365 57 48