Skip to contentSkip to conversation

drm/i915: Do uncore early sanitize after domain init

PATCH In review Mika Kuoppala 3 participants 7 messages Jan 28, 2015 – Feb 1, 2015

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

PATCH 1/1 drm/i915: Do uncore early sanitize after domain init

intel_uncore_early_sanitize() will reset the forcewake registers. When forcewake domains were introduced, the domain init was done after the sanitization of the forcewake registers. And as the resetting of registers use the domain accessors, we tried to reset the forcewake registers with unitialized forcewake domains and failed.

Fix this by sanitizing after all the domains have been initialized. On ivb we need special care as there we need early forcewake access to determine the final configuration for the forcewake domain.

This regression was introduced in

commit 05a2fb157e44a53c79133805d30eaada43911941

Author: Mika Kuoppala <[email protected]>
Date:   Mon Jan 19 16:20:43 2015 +0200

drm/i915: Consolidate forcewake code

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88805

---
 drivers/gpu/drm/i915/intel_uncore.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_uncore.c +9 -2
index b3951f2..c438ca4 100644
@@ -72,6 +72,7 @@ assert_device_not_suspended(struct drm_i915_private *dev_priv)
 static inline void
 fw_domain_reset(const struct intel_uncore_forcewake_domain *d)
 {
+	WARN_ON(d->reg_set == 0);
 	__raw_i915_write32(d->i915, d->reg_set, d->val_reset);
 }
 
@@ -166,6 +167,8 @@ fw_domains_reset(struct drm_i915_private *dev_priv, enum forcewake_domains fw_do
 	struct intel_uncore_forcewake_domain *d;
 	enum forcewake_domain_id id;
 
+	WARN_ON(dev_priv->uncore.fw_domains == 0);
+
 	for_each_fw_domain_mask(d, fw_domains, dev_priv, id)
 		fw_domain_reset(d);
 
@@ -987,8 +990,7 @@ static void fw_domain_init(struct drm_i915_private *dev_priv,
 void intel_uncore_init(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
-
-	__intel_uncore_early_sanitize(dev, false);
+	bool sanitize_done = false;
 
 	if (IS_GEN9(dev)) {
 		dev_priv->uncore.funcs.force_wake_get = fw_domains_get;
@@ -1037,6 +1039,8 @@ void intel_uncore_init(struct drm_device *dev)
 
 		fw_domain_init(dev_priv, FW_DOMAIN_ID_RENDER,
 			       FORCEWAKE_MT, FORCEWAKE_MT_ACK);
+		__intel_uncore_early_sanitize(dev, false);
+		sanitize_done = true;
 		mutex_lock(&dev->struct_mutex);
 		fw_domains_get_with_thread_status(dev_priv, FORCEWAKE_ALL);
 		ecobus = __raw_i915_read32(dev_priv, ECOBUS);
@@ -1058,6 +1062,9 @@ void intel_uncore_init(struct drm_device *dev)
 			       FORCEWAKE, FORCEWAKE_ACK);
 	}
 
+	if (sanitize_done == false)
+		__intel_uncore_early_sanitize(dev, false);
+
 	switch (INTEL_INFO(dev)->gen) {
 	default:
 		MISSING_CASE(INTEL_INFO(dev)->gen);
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 48 lines · Mika Kuoppala

intel_uncore_early_sanitize() will reset the forcewake registers. When forcewake domains were introduced, the domain init was done after the sanitization of the forcewake registers. And as the resetting of registers use the domain accessors, we tried to reset the forcewake registers with unitialized forcewake domains and failed.

Fix this by sanitizing after all the domains have been initialized. On ivb we need special care as there we need early forcewake access to determine the final configuration for the forcewake domain.

This regression was introduced in

commit 05a2fb157e44a53c79133805d30eaada43911941

Author: Mika Kuoppala <[email protected]>
Date:   Mon Jan 19 16:20:43 2015 +0200

drm/i915: Consolidate forcewake code

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88805

---
 drivers/gpu/drm/i915/intel_uncore.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_uncore.c +3 -0
index b3951f2..c438ca4 100644
@@ -72,6 +72,7 @@ assert_device_not_suspended(struct drm_i915_private *dev_priv)
 static inline void
 fw_domain_reset(const struct intel_uncore_forcewake_domain *d)
 {
+	WARN_ON(d->reg_set == 0);
 	__raw_i915_write32(d->i915, d->reg_set, d->val_reset);
 }
 
@@ -166,6 +167,8 @@ fw_domains_reset(struct drm_i915_private *dev_priv, enum forcewake_domains fw_do
 	struct intel_uncore_forcewake_domain *d;
 	enum forcewake_domain_id id;
 
+	WARN_ON(dev_priv->uncore.fw_domains == 0);
+
 	for_each_fw_domain_mask(d, fw_domains, dev_priv, id)
 		fw_domain_reset(d);
 

drivers/gpu/drm/i915/intel_uncore.c static void fw_domain_init(struct drm_i915_private *dev_priv, · line 993

Quoted 6 lines
drivers/gpu/drm/i915/intel_uncore.c +1 -2
@@ -987,8 +990,7 @@ static void fw_domain_init(struct drm_i915_private *dev_priv,
 void intel_uncore_init(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
-
-	__intel_uncore_early_sanitize(dev, false);
+	bool sanitize_done = false;

I felt this looks quite clumsy. The only reason why you want to restrict calling __intel_uncore_early_sanitize() is that it does ellc_size detection and has a DRM_INFO right?

I think you want to pull that out of __intel_uncore_early_santize() into intel_uncore_init() itself (or better, it's own intel_uncore_ellc_detect()). ellc_size detection has nothing to do with sanitizing register state.

Then it should be simple to enough to sanitize twice, once with a comment in the code explaining how we verify that FORCEWAKE_MT is enabled by a manual forcewaked read of ECOBUS.
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw
Quoted 60 lines · Chris Wilson
Quoted 48 lines · Mika Kuoppala

intel_uncore_early_sanitize() will reset the forcewake registers. When forcewake domains were introduced, the domain init was done after the sanitization of the forcewake registers. And as the resetting of registers use the domain accessors, we tried to reset the forcewake registers with unitialized forcewake domains and failed.

Fix this by sanitizing after all the domains have been initialized. On ivb we need special care as there we need early forcewake access to determine the final configuration for the forcewake domain.

This regression was introduced in

commit 05a2fb157e44a53c79133805d30eaada43911941

Author: Mika Kuoppala <[email protected]>
Date:   Mon Jan 19 16:20:43 2015 +0200

drm/i915: Consolidate forcewake code

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88805

---
 drivers/gpu/drm/i915/intel_uncore.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_uncore.c +3 -0
index b3951f2..c438ca4 100644
@@ -72,6 +72,7 @@ assert_device_not_suspended(struct drm_i915_private *dev_priv)
 static inline void
 fw_domain_reset(const struct intel_uncore_forcewake_domain *d)
 {
+	WARN_ON(d->reg_set == 0);
 	__raw_i915_write32(d->i915, d->reg_set, d->val_reset);
 }
 
@@ -166,6 +167,8 @@ fw_domains_reset(struct drm_i915_private *dev_priv, enum forcewake_domains fw_do
 	struct intel_uncore_forcewake_domain *d;
 	enum forcewake_domain_id id;
 
+	WARN_ON(dev_priv->uncore.fw_domains == 0);
+
 	for_each_fw_domain_mask(d, fw_domains, dev_priv, id)
 		fw_domain_reset(d);
 

drivers/gpu/drm/i915/intel_uncore.c static void fw_domain_init(struct drm_i915_private *dev_priv, · line 993

Quoted 6 lines
drivers/gpu/drm/i915/intel_uncore.c +1 -2
@@ -987,8 +990,7 @@ static void fw_domain_init(struct drm_i915_private *dev_priv,
 void intel_uncore_init(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
-
-	__intel_uncore_early_sanitize(dev, false);
+	bool sanitize_done = false;

I felt this looks quite clumsy. The only reason why you want to restrict calling __intel_uncore_early_sanitize() is that it does ellc_size detection and has a DRM_INFO right?

Quoted 8 lines

I think you want to pull that out of __intel_uncore_early_santize() into intel_uncore_init() itself (or better, it's own intel_uncore_ellc_detect()). ellc_size detection has nothing to do with sanitizing register state.

Then it should be simple to enough to sanitize twice, once with a comment in the code explaining how we verify that FORCEWAKE_MT is enabled by a manual forcewaked read of ECOBUS.

Also, why are we not calling fw_domain_reset() from fw_domain_init()? That would be enough to avoid the early santize required for ivb, right? -Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw
Quoted 66 lines · Chris Wilson
Quoted 65 lines · Chris Wilson
Quoted 48 lines · Mika Kuoppala

intel_uncore_early_sanitize() will reset the forcewake registers. When forcewake domains were introduced, the domain init was done after the sanitization of the forcewake registers. And as the resetting of registers use the domain accessors, we tried to reset the forcewake registers with unitialized forcewake domains and failed.

Fix this by sanitizing after all the domains have been initialized. On ivb we need special care as there we need early forcewake access to determine the final configuration for the forcewake domain.

This regression was introduced in

commit 05a2fb157e44a53c79133805d30eaada43911941

Author: Mika Kuoppala <[email protected]>
Date:   Mon Jan 19 16:20:43 2015 +0200

drm/i915: Consolidate forcewake code

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88805

---
 drivers/gpu/drm/i915/intel_uncore.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_uncore.c +3 -0
index b3951f2..c438ca4 100644
@@ -72,6 +72,7 @@ assert_device_not_suspended(struct drm_i915_private *dev_priv)
 static inline void
 fw_domain_reset(const struct intel_uncore_forcewake_domain *d)
 {
+	WARN_ON(d->reg_set == 0);
 	__raw_i915_write32(d->i915, d->reg_set, d->val_reset);
 }
 
@@ -166,6 +167,8 @@ fw_domains_reset(struct drm_i915_private *dev_priv, enum forcewake_domains fw_do
 	struct intel_uncore_forcewake_domain *d;
 	enum forcewake_domain_id id;
 
+	WARN_ON(dev_priv->uncore.fw_domains == 0);
+
 	for_each_fw_domain_mask(d, fw_domains, dev_priv, id)
 		fw_domain_reset(d);
 

drivers/gpu/drm/i915/intel_uncore.c static void fw_domain_init(struct drm_i915_private *dev_priv, · line 993

Quoted 6 lines
drivers/gpu/drm/i915/intel_uncore.c +1 -2
@@ -987,8 +990,7 @@ static void fw_domain_init(struct drm_i915_private *dev_priv,
 void intel_uncore_init(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
-
-	__intel_uncore_early_sanitize(dev, false);
+	bool sanitize_done = false;

I felt this looks quite clumsy. The only reason why you want to restrict calling __intel_uncore_early_sanitize() is that it does ellc_size detection and has a DRM_INFO right?

I think you want to pull that out of __intel_uncore_early_santize() into intel_uncore_init() itself (or better, it's own intel_uncore_ellc_detect()). ellc_size detection has nothing to do with sanitizing register state.

Quoted 7 lines
Quoted 3 lines

Then it should be simple to enough to sanitize twice, once with a comment in the code explaining how we verify that FORCEWAKE_MT is enabled by a manual forcewaked read of ECOBUS.

Also, why are we not calling fw_domain_reset() from fw_domain_init()? That would be enough to avoid the early santize required for ivb, right?

Agreed here. That was my plan originally, doing the sanitize inside in domain inits. But I wanted to fix this particular item by trying to be as close as possible to the previous init/forcewake ordering on all gens.

Reasoning is that I would like to see this stabilize a short while before introducing further changes. I burned my fingers already touching these, so they need to heal :)

Ok if this is for future work?

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

#4 lore raw
Quoted 9 lines · Mika Kuoppala
Quoted 3 lines · Chris Wilson

Also, why are we not calling fw_domain_reset() from fw_domain_init()? That would be enough to avoid the early santize required for ivb, right?

Agreed here. That was my plan originally, doing the sanitize inside in domain inits. But I wanted to fix this particular item by trying to be as close as possible to the previous init/forcewake ordering on all gens.

Quoted 5 lines

Reasoning is that I would like to see this stabilize a short while before introducing further changes. I burned my fingers already touching these, so they need to heal :)

Ok if this is for future work?

The bug is in -next, so take advantage of the guinea pigs... -Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw
Quoted 10 lines · Chris Wilson
Quoted 9 lines · Mika Kuoppala
Quoted 3 lines · Chris Wilson

Also, why are we not calling fw_domain_reset() from fw_domain_init()? That would be enough to avoid the early santize required for ivb, right?

Agreed here. That was my plan originally, doing the sanitize inside in domain inits. But I wanted to fix this particular item by trying to be as close as possible to the previous init/forcewake ordering on all gens.

Quoted 7 lines
Quoted 5 lines

Reasoning is that I would like to see this stabilize a short while before introducing further changes. I burned my fingers already touching these, so they need to heal :)

Ok if this is for future work?

The bug is in -next, so take advantage of the guinea pigs...

v2 in:

[email protected]

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

Tested-by on v1 1/1
#6 lore raw
In reply to Mika Kuoppala

Task id: 5673 -------------------------------------Summary-------------------------------------
Platform Delta drm-intel-nightly Series Applied
PNV 353/353 353/353
ILK -3 355/355 352/355
SNB 400/422 400/422
IVB +1-1 485/487 485/487
BYT 296/296 296/296
HSW +1 507/508 508/508
BDW 401/402 401/402
-------------------------------------Detailed-------------------------------------
Platform Test drm-intel-nightly Series Applied

*ILK  igt_drv_suspend_debugfs-reader      PASS(3, M26)      DMESG_WARN(1, M26)
*ILK  igt_gem_unfence_active_buffers      PASS(3, M26)      DMESG_WARN(1, M26)
*ILK  igt_gem_workarounds_suspend-resume      PASS(3, M26)      DMESG_WARN(1, M26)
 IVB  igt_gem_storedw_batches_loop_normal      DMESG_WARN(6, M34M4)PASS(16, M34M4M21)      PASS(1, M34)
 IVB  igt_gem_storedw_batches_loop_secure-dispatch      DMESG_WARN(1, M34)PASS(7, M34M4)      DMESG_WARN(1, M34)
 HSW  igt_gem_pwrite_pread_snooped-pwrite-blt-cpu_mmap-performance      DMESG_WARN(1, M40)PASS(20, M40M20)      PASS(1, M40)

Note: You need to pay more attention to line start with '*'
_______________________________________________
Intel-gfx mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx