drm/i915/selftests: Add the mock engine to the gt->engine[]
diff mbox series

Message ID 20191018130703.31125-1-chris@chris-wilson.co.uk
State New
Headers show
Series
  • drm/i915/selftests: Add the mock engine to the gt->engine[]
Related show

Commit Message

Chris Wilson Oct. 18, 2019, 1:07 p.m. UTC
Remember to include the newly created mock engine in the list of
available engines inside the gt.

Fixes: a50134b1983b ("drm/i915: Make for_each_engine_masked work on intel_gt")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/gt/mock_engine.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Tvrtko Ursulin Oct. 18, 2019, 1:22 p.m. UTC | #1
On 18/10/2019 14:07, Chris Wilson wrote:
> Remember to include the newly created mock engine in the list of
> available engines inside the gt.
> 
> Fixes: a50134b1983b ("drm/i915: Make for_each_engine_masked work on intel_gt")
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>

Reviewed-by: Chris Wi..oh wait!^W^W^W :)

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Regards,

Tvrtko

> ---
>   drivers/gpu/drm/i915/gt/mock_engine.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/gt/mock_engine.c b/drivers/gpu/drm/i915/gt/mock_engine.c
> index 747f7c7790eb..123db2c3f956 100644
> --- a/drivers/gpu/drm/i915/gt/mock_engine.c
> +++ b/drivers/gpu/drm/i915/gt/mock_engine.c
> @@ -253,6 +253,7 @@ struct intel_engine_cs *mock_engine(struct drm_i915_private *i915,
>   	snprintf(engine->base.name, sizeof(engine->base.name), "%s", name);
>   	engine->base.id = id;
>   	engine->base.mask = BIT(id);
> +	engine->base.legacy_idx = INVALID_ENGINE;
>   	engine->base.instance = id;
>   	engine->base.status_page.addr = (void *)(engine + 1);
>   
> @@ -267,6 +268,9 @@ struct intel_engine_cs *mock_engine(struct drm_i915_private *i915,
>   	engine->base.reset.finish = mock_reset_finish;
>   	engine->base.cancel_requests = mock_cancel_requests;
>   
> +	i915->gt.engine[id] = &engine->base;
> +	i915->gt.engine_class[0][id] = &engine->base;
> +
>   	/* fake hw queue */
>   	spin_lock_init(&engine->hw_lock);
>   	timer_setup(&engine->hw_delay, hw_delay_complete, 0);
>
Chris Wilson Oct. 18, 2019, 1:25 p.m. UTC | #2
Quoting Tvrtko Ursulin (2019-10-18 14:22:39)
> 
> On 18/10/2019 14:07, Chris Wilson wrote:
> > Remember to include the newly created mock engine in the list of
> > available engines inside the gt.
> > 
> > Fixes: a50134b1983b ("drm/i915: Make for_each_engine_masked work on intel_gt")
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Chris Wilson <chris@chris-wilson.co.uk>
> 
> Reviewed-by: Chris Wi..oh wait!^W^W^W :)

I give up. I'm taking a couple of paracetamol and going for a lie down.
Both of me.
-Chris

Patch
diff mbox series

diff --git a/drivers/gpu/drm/i915/gt/mock_engine.c b/drivers/gpu/drm/i915/gt/mock_engine.c
index 747f7c7790eb..123db2c3f956 100644
--- a/drivers/gpu/drm/i915/gt/mock_engine.c
+++ b/drivers/gpu/drm/i915/gt/mock_engine.c
@@ -253,6 +253,7 @@  struct intel_engine_cs *mock_engine(struct drm_i915_private *i915,
 	snprintf(engine->base.name, sizeof(engine->base.name), "%s", name);
 	engine->base.id = id;
 	engine->base.mask = BIT(id);
+	engine->base.legacy_idx = INVALID_ENGINE;
 	engine->base.instance = id;
 	engine->base.status_page.addr = (void *)(engine + 1);
 
@@ -267,6 +268,9 @@  struct intel_engine_cs *mock_engine(struct drm_i915_private *i915,
 	engine->base.reset.finish = mock_reset_finish;
 	engine->base.cancel_requests = mock_cancel_requests;
 
+	i915->gt.engine[id] = &engine->base;
+	i915->gt.engine_class[0][id] = &engine->base;
+
 	/* fake hw queue */
 	spin_lock_init(&engine->hw_lock);
 	timer_setup(&engine->hw_delay, hw_delay_complete, 0);