Skip to contentSkip to conversation

drm/i915/bdw: Populate lrc with aliasing ppgtt if required

PATCH In review Thomas Daniel 3 participants 3 messages Aug 18, 2014 – Aug 19, 2014

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

PATCH 1/1 drm/i915/bdw: Populate lrc with aliasing ppgtt if required

A previous commit broke aliasing PPGTT for lrc, resulting in a kernel oops on boot. Add a check so that is full PPGTT is not in use the context is populated with the aliasing PPGTT.

Issue: VIZ-4278

---
 drivers/gpu/drm/i915/intel_lrc.c |    7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/i915/intel_lrc.c +7 -0
index c096b9b..79a6b91 100644
@@ -1452,12 +1452,19 @@ static int
 populate_lr_context(struct intel_context *ctx, struct drm_i915_gem_object *ctx_obj,
 		    struct intel_engine_cs *ring, struct intel_ringbuffer *ringbuf)
 {
+	struct drm_device *dev = ring->dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct drm_i915_gem_object *ring_obj = ringbuf->obj;
 	struct i915_hw_ppgtt *ppgtt = ctx->ppgtt;
 	struct page *page;
 	uint32_t *reg_state;
 	int ret;
 
+	if (USES_FULL_PPGTT(dev))
+		ppgtt = ctx->ppgtt;
+	else
+		ppgtt = dev_priv->mm.aliasing_ppgtt;
+
 	ret = i915_gem_object_set_to_cpu_domain(ctx_obj, true);
 	if (ret) {
 		DRM_DEBUG_DRIVER("Could not set to CPU domain\n");
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 15 lines · Thomas Daniel

A previous commit broke aliasing PPGTT for lrc, resulting in a kernel oops on boot. Add a check so that is full PPGTT is not in use the context is populated with the aliasing PPGTT.

Issue: VIZ-4278

---
 drivers/gpu/drm/i915/intel_lrc.c |    7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/i915/intel_lrc.c +0 -0
index c096b9b..79a6b91 100644

drivers/gpu/drm/i915/intel_lrc.c static int · line 1458

Quoted 7 lines
drivers/gpu/drm/i915/intel_lrc.c +2 -0
@@ -1452,12 +1452,19 @@ static int
 populate_lr_context(struct intel_context *ctx, struct drm_i915_gem_object *ctx_obj,
 		    struct intel_engine_cs *ring, struct intel_ringbuffer *ringbuf)
 {
+	struct drm_device *dev = ring->dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct drm_i915_gem_object *ring_obj = ringbuf->obj;
 	struct i915_hw_ppgtt *ppgtt = ctx->ppgtt;

It's a bit weird to leave ppgtt initialized here when you're going to always override it below.

drivers/gpu/drm/i915/intel_lrc.c static int · line 1467

Quoted 9 lines
drivers/gpu/drm/i915/intel_lrc.c +5 -0
 	struct page *page;
 	uint32_t *reg_state;
 	int ret;
 
+	if (USES_FULL_PPGTT(dev))
+		ppgtt = ctx->ppgtt;
+	else
+		ppgtt = dev_priv->mm.aliasing_ppgtt;
+

The patch drom daniel you mention removes the usage of USES_FULL_PPGTT() to directly test ctx->ppgtt. You may want to reproduce that here ie.

	ppgtt = ctx->ppgtt;
	if (!ppgtt)
		ppgtt = dev_priv->mm.aliasing_ppgtt;

doesn't really matter either way I guess, but can we at least not set then always override ppgtt?

Thanks,

Signature · 1 line
Damien
#2 lore raw

Ok, things start to dawn upon me - let's blame it on the lack of decent coffee here ;-) I mixed up USES_PPGTT with USES_FULL_PPGTT (again) so didn't realize that execlist works with just aliasing ppgtt. So I guess there's still room to clean up these macros a bit, maybe do an s/USES_PPGTT/USES_HW_PPGTT/ or so, to make it clear that this isn't about multiple address spaces.

I do like Damien's suggestion though since imo depending upon runtime state is less fragile than rechecking driver option. -Daniel

Quoted 55 lines · Damien Lespiau
Quoted 15 lines · Thomas Daniel

A previous commit broke aliasing PPGTT for lrc, resulting in a kernel oops on boot. Add a check so that is full PPGTT is not in use the context is populated with the aliasing PPGTT.

Issue: VIZ-4278

---
 drivers/gpu/drm/i915/intel_lrc.c |    7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/i915/intel_lrc.c +0 -0
index c096b9b..79a6b91 100644

drivers/gpu/drm/i915/intel_lrc.c static int · line 1458

Quoted 7 lines
drivers/gpu/drm/i915/intel_lrc.c +2 -0
@@ -1452,12 +1452,19 @@ static int
 populate_lr_context(struct intel_context *ctx, struct drm_i915_gem_object *ctx_obj,
                  struct intel_engine_cs *ring, struct intel_ringbuffer *ringbuf)
 {
+     struct drm_device *dev = ring->dev;
+     struct drm_i915_private *dev_priv = dev->dev_private;
      struct drm_i915_gem_object *ring_obj = ringbuf->obj;
      struct i915_hw_ppgtt *ppgtt = ctx->ppgtt;

It's a bit weird to leave ppgtt initialized here when you're going to always override it below.

drivers/gpu/drm/i915/intel_lrc.c static int · line 1467

Quoted 9 lines
drivers/gpu/drm/i915/intel_lrc.c +5 -0
      struct page *page;
      uint32_t *reg_state;
      int ret;
 
+     if (USES_FULL_PPGTT(dev))
+             ppgtt = ctx->ppgtt;
+     else
+             ppgtt = dev_priv->mm.aliasing_ppgtt;
+

The patch drom daniel you mention removes the usage of USES_FULL_PPGTT() to directly test ctx->ppgtt. You may want to reproduce that here ie.

        ppgtt = ctx->ppgtt;
        if (!ppgtt)
                ppgtt = dev_priv->mm.aliasing_ppgtt;

doesn't really matter either way I guess, but can we at least not set then always override ppgtt?

Thanks,

--
Damien
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch