Skip to contentSkip to conversation

drm/i915/vgpu: Neuter forcewakes for VGPU more thouroughly

PATCH In review Tvrtko Ursulin 7 participants 12 messages Mar 10, 2017 – Mar 17, 2017

Subsystems (2)
lore
Share & tools
lore

Tvrtko Ursulin

author maintainer
#0 lore raw

PATCH 1/1 drm/i915/vgpu: Neuter forcewakes for VGPU more thouroughly

From: Tvrtko Ursulin <[email protected]>

If we avoid initializing forcewake domains when running as a guest, and also use gen2 mmio accessors in that case, we can avoid the timer traffic and any looping through the forcewake code which is currently just so it can end up in the no-op forcewake implementation.

---
 drivers/gpu/drm/i915/intel_uncore.c | 76 +++++++++++++------------------------
 1 file changed, 27 insertions(+), 49 deletions(-)
drivers/gpu/drm/i915/intel_uncore.c +27 -49
index 71b9b387ad04..09f5f02d7901 100644
@@ -138,13 +138,6 @@ fw_domains_put(struct drm_i915_private *dev_priv, enum forcewake_domains fw_doma
 }
 
 static void
-vgpu_fw_domains_nop(struct drm_i915_private *dev_priv,
-		    enum forcewake_domains fw_domains)
-{
-	/* Guest driver doesn't need to takes care forcewake. */
-}
-
-static void
 fw_domains_posting_read(struct drm_i915_private *dev_priv)
 {
 	struct intel_uncore_forcewake_domain *d;
@@ -1187,7 +1180,7 @@ static void fw_domain_init(struct drm_i915_private *dev_priv,
 
 static void intel_uncore_fw_domains_init(struct drm_i915_private *dev_priv)
 {
-	if (INTEL_INFO(dev_priv)->gen <= 5)
+	if (INTEL_GEN(dev_priv) <= 5 || intel_vgpu_active(dev_priv))
 		return;
 
 	if (IS_GEN9(dev_priv)) {
@@ -1273,11 +1266,6 @@ static void intel_uncore_fw_domains_init(struct drm_i915_private *dev_priv)
 			       FORCEWAKE, FORCEWAKE_ACK);
 	}
 
-	if (intel_vgpu_active(dev_priv)) {
-		dev_priv->uncore.funcs.force_wake_get = vgpu_fw_domains_nop;
-		dev_priv->uncore.funcs.force_wake_put = vgpu_fw_domains_nop;
-	}
-
 	/* All future platforms are expected to require complex power gating */
 	WARN_ON(dev_priv->uncore.fw_domains == 0);
 }
@@ -1327,22 +1315,22 @@ void intel_uncore_init(struct drm_i915_private *dev_priv)
 	dev_priv->uncore.pmic_bus_access_nb.notifier_call =
 		i915_pmic_bus_access_notifier;
 
-	switch (INTEL_INFO(dev_priv)->gen) {
-	default:
-	case 9:
-		ASSIGN_FW_DOMAINS_TABLE(__gen9_fw_ranges);
-		ASSIGN_WRITE_MMIO_VFUNCS(fwtable);
-		ASSIGN_READ_MMIO_VFUNCS(fwtable);
-		if (HAS_DECOUPLED_MMIO(dev_priv)) {
-			dev_priv->uncore.funcs.mmio_readl =
-						gen9_decoupled_read32;
-			dev_priv->uncore.funcs.mmio_readq =
-						gen9_decoupled_read64;
-			dev_priv->uncore.funcs.mmio_writel =
-						gen9_decoupled_write32;
+	if (IS_GEN(dev_priv, 2, 4) || intel_vgpu_active(dev_priv)) {
+		ASSIGN_WRITE_MMIO_VFUNCS(gen2);
+		ASSIGN_READ_MMIO_VFUNCS(gen2);
+	} else if (IS_GEN5(dev_priv)) {
+		ASSIGN_WRITE_MMIO_VFUNCS(gen5);
+		ASSIGN_READ_MMIO_VFUNCS(gen5);
+	} else if (IS_GEN(dev_priv, 6, 7)) {
+		ASSIGN_WRITE_MMIO_VFUNCS(gen6);
+
+		if (IS_VALLEYVIEW(dev_priv)) {
+			ASSIGN_FW_DOMAINS_TABLE(__vlv_fw_ranges);
+			ASSIGN_READ_MMIO_VFUNCS(fwtable);
+		} else {
+			ASSIGN_READ_MMIO_VFUNCS(gen6);
 		}
-		break;
-	case 8:
+	} else if (IS_GEN8(dev_priv)) {
 		if (IS_CHERRYVIEW(dev_priv)) {
 			ASSIGN_FW_DOMAINS_TABLE(__chv_fw_ranges);
 			ASSIGN_WRITE_MMIO_VFUNCS(fwtable);
@@ -1352,28 +1340,18 @@ void intel_uncore_init(struct drm_i915_private *dev_priv)
 			ASSIGN_WRITE_MMIO_VFUNCS(gen8);
 			ASSIGN_READ_MMIO_VFUNCS(gen6);
 		}
-		break;
-	case 7:
-	case 6:
-		ASSIGN_WRITE_MMIO_VFUNCS(gen6);
-
-		if (IS_VALLEYVIEW(dev_priv)) {
-			ASSIGN_FW_DOMAINS_TABLE(__vlv_fw_ranges);
-			ASSIGN_READ_MMIO_VFUNCS(fwtable);
-		} else {
-			ASSIGN_READ_MMIO_VFUNCS(gen6);
+	} else {
+		ASSIGN_FW_DOMAINS_TABLE(__gen9_fw_ranges);
+		ASSIGN_WRITE_MMIO_VFUNCS(fwtable);
+		ASSIGN_READ_MMIO_VFUNCS(fwtable);
+		if (HAS_DECOUPLED_MMIO(dev_priv)) {
+			dev_priv->uncore.funcs.mmio_readl =
+						gen9_decoupled_read32;
+			dev_priv->uncore.funcs.mmio_readq =
+						gen9_decoupled_read64;
+			dev_priv->uncore.funcs.mmio_writel =
+						gen9_decoupled_write32;
 		}
-		break;
-	case 5:
-		ASSIGN_WRITE_MMIO_VFUNCS(gen5);
-		ASSIGN_READ_MMIO_VFUNCS(gen5);
-		break;
-	case 4:
-	case 3:
-	case 2:
-		ASSIGN_WRITE_MMIO_VFUNCS(gen2);
-		ASSIGN_READ_MMIO_VFUNCS(gen2);
-		break;
 	}
 
 	iosf_mbi_register_pmic_bus_access_notifier(
Signature · 6 lines
2.9.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 34 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

If we avoid initializing forcewake domains when running as a guest, and also use gen2 mmio accessors in that case, we can avoid the timer traffic and any looping through the forcewake code which is currently just so it can end up in the no-op forcewake implementation.

---
 drivers/gpu/drm/i915/intel_uncore.c | 76 +++++++++++++------------------------
 1 file changed, 27 insertions(+), 49 deletions(-)
drivers/gpu/drm/i915/intel_uncore.c +0 -7
index 71b9b387ad04..09f5f02d7901 100644
@@ -138,13 +138,6 @@ fw_domains_put(struct drm_i915_private *dev_priv, enum forcewake_domains fw_doma
 }
 
 static void
-vgpu_fw_domains_nop(struct drm_i915_private *dev_priv,
-		    enum forcewake_domains fw_domains)
-{
-	/* Guest driver doesn't need to takes care forcewake. */
-}
-
-static void
 fw_domains_posting_read(struct drm_i915_private *dev_priv)
 {
 	struct intel_uncore_forcewake_domain *d;

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

Quoted 5 lines
drivers/gpu/drm/i915/intel_uncore.c +1 -1
@@ -1187,7 +1180,7 @@ static void fw_domain_init(struct drm_i915_private *dev_priv,
 
 static void intel_uncore_fw_domains_init(struct drm_i915_private *dev_priv)
 {
-	if (INTEL_INFO(dev_priv)->gen <= 5)
+	if (INTEL_GEN(dev_priv) <= 5 || intel_vgpu_active(dev_priv))

Make these separate ifs, they aren't semantically related so be verbose.

Quoted 23 lines
drivers/gpu/drm/i915/intel_uncore.c +0 -9
 		return;
 
 	if (IS_GEN9(dev_priv)) {
@@ -1273,11 +1266,6 @@ static void intel_uncore_fw_domains_init(struct drm_i915_private *dev_priv)
 			       FORCEWAKE, FORCEWAKE_ACK);
 	}
 
-	if (intel_vgpu_active(dev_priv)) {
-		dev_priv->uncore.funcs.force_wake_get = vgpu_fw_domains_nop;
-		dev_priv->uncore.funcs.force_wake_put = vgpu_fw_domains_nop;
-	}
-
 	/* All future platforms are expected to require complex power gating */
 	WARN_ON(dev_priv->uncore.fw_domains == 0);
 }
@@ -1327,22 +1315,22 @@ void intel_uncore_init(struct drm_i915_private *dev_priv)
 	dev_priv->uncore.pmic_bus_access_nb.notifier_call =
 		i915_pmic_bus_access_notifier;
 
-	switch (INTEL_INFO(dev_priv)->gen) {
-	default:
-	case 9:
-		ASSIGN_FW_DOMAINS_TABLE(__gen9_fw_ranges);

drivers/gpu/drm/i915/intel_uncore.c void intel_uncore_init(struct drm_i915_private *dev_priv) · line 1318

Quoted 10 lines
drivers/gpu/drm/i915/intel_uncore.c +1 -9
-		ASSIGN_WRITE_MMIO_VFUNCS(fwtable);
-		ASSIGN_READ_MMIO_VFUNCS(fwtable);
-		if (HAS_DECOUPLED_MMIO(dev_priv)) {
-			dev_priv->uncore.funcs.mmio_readl =
-						gen9_decoupled_read32;
-			dev_priv->uncore.funcs.mmio_readq =
-						gen9_decoupled_read64;
-			dev_priv->uncore.funcs.mmio_writel =
-						gen9_decoupled_write32;
+	if (IS_GEN(dev_priv, 2, 4) || intel_vgpu_active(dev_priv)) {

Ok, this doesn't look too bad.

Do the gvt-g hosts in CI now provide coverage for us of vgpu paths? -Chris

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

✓ Fi.CI.BAT: success for drm/i915/vgpu: Neuter forcewakes for VGPU more thouroughly

In reply to Tvrtko Ursulin
== Series Details ==

== Series Details ==

Series: drm/i915/vgpu: Neuter forcewakes for VGPU more thouroughly
URL : https://patchwork.freedesktop.org/series/21047/
State : success

== Summary ==

Series 21047v1 drm/i915/vgpu: Neuter forcewakes for VGPU more thouroughly
https://patchwork.freedesktop.org/api/1.0/series/21047/revisions/1/mbox/

fi-bdw-5557u     total:278  pass:267  dwarn:0   dfail:0   fail:0   skip:11  time: 467s
fi-bsw-n3050     total:278  pass:239  dwarn:0   dfail:0   fail:0   skip:39  time: 605s
fi-bxt-j4205     total:278  pass:259  dwarn:0   dfail:0   fail:0   skip:19  time: 536s
fi-bxt-t5700     total:278  pass:258  dwarn:0   dfail:0   fail:0   skip:20  time: 609s
fi-byt-j1900     total:278  pass:251  dwarn:0   dfail:0   fail:0   skip:27  time: 506s
fi-byt-n2820     total:278  pass:247  dwarn:0   dfail:0   fail:0   skip:31  time: 500s
fi-hsw-4770      total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time: 441s
fi-hsw-4770r     total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time: 434s
fi-ilk-650       total:278  pass:228  dwarn:0   dfail:0   fail:0   skip:50  time: 441s
fi-ivb-3520m     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time: 507s
fi-ivb-3770      total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time: 493s
fi-kbl-7500u     total:278  pass:259  dwarn:1   dfail:0   fail:0   skip:18  time: 476s
fi-skl-6260u     total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time: 503s
fi-skl-6700hq    total:278  pass:261  dwarn:0   dfail:0   fail:0   skip:17  time: 608s
fi-skl-6700k     total:278  pass:256  dwarn:4   dfail:0   fail:0   skip:18  time: 507s
fi-skl-6770hq    total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time: 559s
fi-snb-2520m     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time: 561s
fi-snb-2600      total:278  pass:249  dwarn:0   dfail:0   fail:0   skip:29  time: 427s

d8d69f76555feef19e3e4b601378446604d90da5 drm-tip: 2017y-03m-10d-11h-50m-04s UTC integration manifest 212fdd9 drm/i915/vgpu: Neuter forcewakes for VGPU more thouroughly

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4133/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw
In reply to Chris Wilson
Quoted 62 lines · Chris Wilson
Quoted 34 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

If we avoid initializing forcewake domains when running as a guest, and also use gen2 mmio accessors in that case, we can avoid the timer traffic and any looping through the forcewake code which is currently just so it can end up in the no-op forcewake implementation.

---
 drivers/gpu/drm/i915/intel_uncore.c | 76 +++++++++++++------------------------
 1 file changed, 27 insertions(+), 49 deletions(-)
drivers/gpu/drm/i915/intel_uncore.c +0 -7
index 71b9b387ad04..09f5f02d7901 100644
@@ -138,13 +138,6 @@ fw_domains_put(struct drm_i915_private *dev_priv, enum forcewake_domains fw_doma
 }
 
 static void
-vgpu_fw_domains_nop(struct drm_i915_private *dev_priv,
-		    enum forcewake_domains fw_domains)
-{
-	/* Guest driver doesn't need to takes care forcewake. */
-}
-
-static void
 fw_domains_posting_read(struct drm_i915_private *dev_priv)
 {
 	struct intel_uncore_forcewake_domain *d;

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

Quoted 5 lines
drivers/gpu/drm/i915/intel_uncore.c +1 -1
@@ -1187,7 +1180,7 @@ static void fw_domain_init(struct drm_i915_private *dev_priv,
 
 static void intel_uncore_fw_domains_init(struct drm_i915_private *dev_priv)
 {
-	if (INTEL_INFO(dev_priv)->gen <= 5)
+	if (INTEL_GEN(dev_priv) <= 5 || intel_vgpu_active(dev_priv))

Make these separate ifs, they aren't semantically related so be verbose.

Quoted 19 lines
drivers/gpu/drm/i915/intel_uncore.c +0 -5
 		return;
 
 	if (IS_GEN9(dev_priv)) {
@@ -1273,11 +1266,6 @@ static void intel_uncore_fw_domains_init(struct drm_i915_private *dev_priv)
 			       FORCEWAKE, FORCEWAKE_ACK);
 	}
 
-	if (intel_vgpu_active(dev_priv)) {
-		dev_priv->uncore.funcs.force_wake_get = vgpu_fw_domains_nop;
-		dev_priv->uncore.funcs.force_wake_put = vgpu_fw_domains_nop;
-	}
-
 	/* All future platforms are expected to require complex power gating */
 	WARN_ON(dev_priv->uncore.fw_domains == 0);
 }
@@ -1327,22 +1315,22 @@ void intel_uncore_init(struct drm_i915_private *dev_priv)
 	dev_priv->uncore.pmic_bus_access_nb.notifier_call =
 		i915_pmic_bus_access_notifier;
 
Quoted 16 lines
Quoted 4 lines
drivers/gpu/drm/i915/intel_uncore.c +0 -4
-	switch (INTEL_INFO(dev_priv)->gen) {
-	default:
-	case 9:
-		ASSIGN_FW_DOMAINS_TABLE(__gen9_fw_ranges);

drivers/gpu/drm/i915/intel_uncore.c void intel_uncore_init(struct drm_i915_private *dev_priv) · line 1318

Quoted 10 lines
drivers/gpu/drm/i915/intel_uncore.c +1 -9
-		ASSIGN_WRITE_MMIO_VFUNCS(fwtable);
-		ASSIGN_READ_MMIO_VFUNCS(fwtable);
-		if (HAS_DECOUPLED_MMIO(dev_priv)) {
-			dev_priv->uncore.funcs.mmio_readl =
-						gen9_decoupled_read32;
-			dev_priv->uncore.funcs.mmio_readq =
-						gen9_decoupled_read64;
-			dev_priv->uncore.funcs.mmio_writel =
-						gen9_decoupled_write32;
+	if (IS_GEN(dev_priv, 2, 4) || intel_vgpu_active(dev_priv)) {

Ok, this doesn't look too bad.

First I thought that he hates switches :) But yup, not bad. -Mika

Quoted 10 lines

Do the gvt-g hosts in CI now provide coverage for us of vgpu paths? -Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

#3 lore raw
In reply to Chris Wilson
Quoted 79 lines · Chris Wilson
Quoted 34 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

If we avoid initializing forcewake domains when running as a guest, and also use gen2 mmio accessors in that case, we can avoid the timer traffic and any looping through the forcewake code which is currently just so it can end up in the no-op forcewake implementation.

---
 drivers/gpu/drm/i915/intel_uncore.c | 76 +++++++++++++------------------------
 1 file changed, 27 insertions(+), 49 deletions(-)
drivers/gpu/drm/i915/intel_uncore.c +0 -7
index 71b9b387ad04..09f5f02d7901 100644
@@ -138,13 +138,6 @@ fw_domains_put(struct drm_i915_private *dev_priv, enum forcewake_domains fw_doma
 }
 
 static void
-vgpu_fw_domains_nop(struct drm_i915_private *dev_priv,
-		    enum forcewake_domains fw_domains)
-{
-	/* Guest driver doesn't need to takes care forcewake. */
-}
-
-static void
 fw_domains_posting_read(struct drm_i915_private *dev_priv)
 {
 	struct intel_uncore_forcewake_domain *d;

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

Quoted 5 lines
drivers/gpu/drm/i915/intel_uncore.c +1 -1
@@ -1187,7 +1180,7 @@ static void fw_domain_init(struct drm_i915_private *dev_priv,
 
 static void intel_uncore_fw_domains_init(struct drm_i915_private *dev_priv)
 {
-	if (INTEL_INFO(dev_priv)->gen <= 5)
+	if (INTEL_GEN(dev_priv) <= 5 || intel_vgpu_active(dev_priv))

Make these separate ifs, they aren't semantically related so be verbose.

Quoted 23 lines
drivers/gpu/drm/i915/intel_uncore.c +0 -9
 		return;
 
 	if (IS_GEN9(dev_priv)) {
@@ -1273,11 +1266,6 @@ static void intel_uncore_fw_domains_init(struct drm_i915_private *dev_priv)
 			       FORCEWAKE, FORCEWAKE_ACK);
 	}
 
-	if (intel_vgpu_active(dev_priv)) {
-		dev_priv->uncore.funcs.force_wake_get = vgpu_fw_domains_nop;
-		dev_priv->uncore.funcs.force_wake_put = vgpu_fw_domains_nop;
-	}
-
 	/* All future platforms are expected to require complex power gating */
 	WARN_ON(dev_priv->uncore.fw_domains == 0);
 }
@@ -1327,22 +1315,22 @@ void intel_uncore_init(struct drm_i915_private *dev_priv)
 	dev_priv->uncore.pmic_bus_access_nb.notifier_call =
 		i915_pmic_bus_access_notifier;
 
-	switch (INTEL_INFO(dev_priv)->gen) {
-	default:
-	case 9:
-		ASSIGN_FW_DOMAINS_TABLE(__gen9_fw_ranges);

drivers/gpu/drm/i915/intel_uncore.c void intel_uncore_init(struct drm_i915_private *dev_priv) · line 1318

Quoted 10 lines
drivers/gpu/drm/i915/intel_uncore.c +1 -9
-		ASSIGN_WRITE_MMIO_VFUNCS(fwtable);
-		ASSIGN_READ_MMIO_VFUNCS(fwtable);
-		if (HAS_DECOUPLED_MMIO(dev_priv)) {
-			dev_priv->uncore.funcs.mmio_readl =
-						gen9_decoupled_read32;
-			dev_priv->uncore.funcs.mmio_readq =
-						gen9_decoupled_read64;
-			dev_priv->uncore.funcs.mmio_writel =
-						gen9_decoupled_write32;
+	if (IS_GEN(dev_priv, 2, 4) || intel_vgpu_active(dev_priv)) {

Ok, this doesn't look too bad.

Quoted 1 line

Do the gvt-g hosts in CI now provide coverage for us of vgpu paths?

No idea.

Adding Zhenyu. So this patch avoids burning CPU cycles in guests and scheduling timers when all of that ends up in the dummy/no-op forcewake implementation.

If interesting to you, would it be easy for you to test it or how should we proceed?

Regards,

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

#4 lore raw
Quoted 83 lines · Tvrtko Ursulin
Quoted 79 lines · Chris Wilson
Quoted 34 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

If we avoid initializing forcewake domains when running as a guest, and also use gen2 mmio accessors in that case, we can avoid the timer traffic and any looping through the forcewake code which is currently just so it can end up in the no-op forcewake implementation.

---
 drivers/gpu/drm/i915/intel_uncore.c | 76 +++++++++++++------------------------
 1 file changed, 27 insertions(+), 49 deletions(-)
drivers/gpu/drm/i915/intel_uncore.c +0 -7
index 71b9b387ad04..09f5f02d7901 100644
@@ -138,13 +138,6 @@ fw_domains_put(struct drm_i915_private *dev_priv, enum forcewake_domains fw_doma
 }
 
 static void
-vgpu_fw_domains_nop(struct drm_i915_private *dev_priv,
-		    enum forcewake_domains fw_domains)
-{
-	/* Guest driver doesn't need to takes care forcewake. */
-}
-
-static void
 fw_domains_posting_read(struct drm_i915_private *dev_priv)
 {
 	struct intel_uncore_forcewake_domain *d;

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

Quoted 5 lines
drivers/gpu/drm/i915/intel_uncore.c +1 -1
@@ -1187,7 +1180,7 @@ static void fw_domain_init(struct drm_i915_private *dev_priv,
 
 static void intel_uncore_fw_domains_init(struct drm_i915_private *dev_priv)
 {
-	if (INTEL_INFO(dev_priv)->gen <= 5)
+	if (INTEL_GEN(dev_priv) <= 5 || intel_vgpu_active(dev_priv))

Make these separate ifs, they aren't semantically related so be verbose.

Quoted 23 lines
drivers/gpu/drm/i915/intel_uncore.c +0 -9
 		return;
 
 	if (IS_GEN9(dev_priv)) {
@@ -1273,11 +1266,6 @@ static void intel_uncore_fw_domains_init(struct drm_i915_private *dev_priv)
 			       FORCEWAKE, FORCEWAKE_ACK);
 	}
 
-	if (intel_vgpu_active(dev_priv)) {
-		dev_priv->uncore.funcs.force_wake_get = vgpu_fw_domains_nop;
-		dev_priv->uncore.funcs.force_wake_put = vgpu_fw_domains_nop;
-	}
-
 	/* All future platforms are expected to require complex power gating */
 	WARN_ON(dev_priv->uncore.fw_domains == 0);
 }
@@ -1327,22 +1315,22 @@ void intel_uncore_init(struct drm_i915_private *dev_priv)
 	dev_priv->uncore.pmic_bus_access_nb.notifier_call =
 		i915_pmic_bus_access_notifier;
 
-	switch (INTEL_INFO(dev_priv)->gen) {
-	default:
-	case 9:
-		ASSIGN_FW_DOMAINS_TABLE(__gen9_fw_ranges);

drivers/gpu/drm/i915/intel_uncore.c void intel_uncore_init(struct drm_i915_private *dev_priv) · line 1318

Quoted 10 lines
drivers/gpu/drm/i915/intel_uncore.c +1 -9
-		ASSIGN_WRITE_MMIO_VFUNCS(fwtable);
-		ASSIGN_READ_MMIO_VFUNCS(fwtable);
-		if (HAS_DECOUPLED_MMIO(dev_priv)) {
-			dev_priv->uncore.funcs.mmio_readl =
-						gen9_decoupled_read32;
-			dev_priv->uncore.funcs.mmio_readq =
-						gen9_decoupled_read64;
-			dev_priv->uncore.funcs.mmio_writel =
-						gen9_decoupled_write32;
+	if (IS_GEN(dev_priv, 2, 4) || intel_vgpu_active(dev_priv)) {

Ok, this doesn't look too bad.

Quoted 1 line

Do the gvt-g hosts in CI now provide coverage for us of vgpu paths?

Quoted 9 lines

No idea.

Adding Zhenyu. So this patch avoids burning CPU cycles in guests and scheduling timers when all of that ends up in the dummy/no-op forcewake implementation.

If interesting to you, would it be easy for you to test it or how should we proceed?

Patch looks fine to me. I can apply it for our QA testing if required.

About CI for gvt, I think Terrence is still working but don't know how far it goes now.

Signature · 3 lines
Open Source Technology Center, Intel ltd.

$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827

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

#5 lore raw
Quoted 90 lines · Zhenyu Wang
Quoted 89 lines · Tvrtko Ursulin
Quoted 79 lines · Chris Wilson
Quoted 34 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

If we avoid initializing forcewake domains when running as a guest, and also use gen2 mmio accessors in that case, we can avoid the timer traffic and any looping through the forcewake code which is currently just so it can end up in the no-op forcewake implementation.

---
 drivers/gpu/drm/i915/intel_uncore.c | 76 +++++++++++++------------------------
 1 file changed, 27 insertions(+), 49 deletions(-)
drivers/gpu/drm/i915/intel_uncore.c +0 -7
index 71b9b387ad04..09f5f02d7901 100644
@@ -138,13 +138,6 @@ fw_domains_put(struct drm_i915_private *dev_priv, enum forcewake_domains fw_doma
 }
 
 static void
-vgpu_fw_domains_nop(struct drm_i915_private *dev_priv,
-		    enum forcewake_domains fw_domains)
-{
-	/* Guest driver doesn't need to takes care forcewake. */
-}
-
-static void
 fw_domains_posting_read(struct drm_i915_private *dev_priv)
 {
 	struct intel_uncore_forcewake_domain *d;

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

Quoted 5 lines
drivers/gpu/drm/i915/intel_uncore.c +1 -1
@@ -1187,7 +1180,7 @@ static void fw_domain_init(struct drm_i915_private *dev_priv,
 
 static void intel_uncore_fw_domains_init(struct drm_i915_private *dev_priv)
 {
-	if (INTEL_INFO(dev_priv)->gen <= 5)
+	if (INTEL_GEN(dev_priv) <= 5 || intel_vgpu_active(dev_priv))

Make these separate ifs, they aren't semantically related so be verbose.

Quoted 23 lines
drivers/gpu/drm/i915/intel_uncore.c +0 -9
 		return;
 
 	if (IS_GEN9(dev_priv)) {
@@ -1273,11 +1266,6 @@ static void intel_uncore_fw_domains_init(struct drm_i915_private *dev_priv)
 			       FORCEWAKE, FORCEWAKE_ACK);
 	}
 
-	if (intel_vgpu_active(dev_priv)) {
-		dev_priv->uncore.funcs.force_wake_get = vgpu_fw_domains_nop;
-		dev_priv->uncore.funcs.force_wake_put = vgpu_fw_domains_nop;
-	}
-
 	/* All future platforms are expected to require complex power gating */
 	WARN_ON(dev_priv->uncore.fw_domains == 0);
 }
@@ -1327,22 +1315,22 @@ void intel_uncore_init(struct drm_i915_private *dev_priv)
 	dev_priv->uncore.pmic_bus_access_nb.notifier_call =
 		i915_pmic_bus_access_notifier;
 
-	switch (INTEL_INFO(dev_priv)->gen) {
-	default:
-	case 9:
-		ASSIGN_FW_DOMAINS_TABLE(__gen9_fw_ranges);

drivers/gpu/drm/i915/intel_uncore.c void intel_uncore_init(struct drm_i915_private *dev_priv) · line 1318

Quoted 10 lines
drivers/gpu/drm/i915/intel_uncore.c +1 -9
-		ASSIGN_WRITE_MMIO_VFUNCS(fwtable);
-		ASSIGN_READ_MMIO_VFUNCS(fwtable);
-		if (HAS_DECOUPLED_MMIO(dev_priv)) {
-			dev_priv->uncore.funcs.mmio_readl =
-						gen9_decoupled_read32;
-			dev_priv->uncore.funcs.mmio_readq =
-						gen9_decoupled_read64;
-			dev_priv->uncore.funcs.mmio_writel =
-						gen9_decoupled_write32;
+	if (IS_GEN(dev_priv, 2, 4) || intel_vgpu_active(dev_priv)) {

Ok, this doesn't look too bad.

Quoted 1 line

Do the gvt-g hosts in CI now provide coverage for us of vgpu paths?

No idea.

Adding Zhenyu. So this patch avoids burning CPU cycles in guests and scheduling timers when all of that ends up in the dummy/no-op forcewake implementation.

Quoted 5 lines
Quoted 3 lines

If interesting to you, would it be easy for you to test it or how should we proceed?

Patch looks fine to me. I can apply it for our QA testing if required.

That would be good I think, thank you. When it has been cleared that it actually works and doesn't break anything we can then merge it.

Regards,

Tvrtko

Quoted 2 lines

About CI for gvt, I think Terrence is still working but don't know how far it goes now.

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

Reviewed-by
#6 lore raw
Quoted 92 lines · Tvrtko Ursulin
Quoted 90 lines · Zhenyu Wang
Quoted 89 lines · Tvrtko Ursulin
Quoted 79 lines · Chris Wilson
Quoted 34 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

If we avoid initializing forcewake domains when running as a guest, and also use gen2 mmio accessors in that case, we can avoid the timer traffic and any looping through the forcewake code which is currently just so it can end up in the no-op forcewake implementation.

---
drivers/gpu/drm/i915/intel_uncore.c | 76 +++++++++++++------------------------

1 file changed, 27 insertions(+), 49 deletions(-)
drivers/gpu/drm/i915/intel_uncore.c +0 -0
index 71b9b387ad04..09f5f02d7901 100644
@@ -138,13 +138,6 @@ fw_domains_put(struct drm_i915_private *dev_priv, enum forcewake_domains fw_doma
 }
 

static void

drivers/gpu/drm/i915/intel_uncore.c +0 -7
-vgpu_fw_domains_nop(struct drm_i915_private *dev_priv,
-		    enum forcewake_domains fw_domains)
-{
-	/* Guest driver doesn't need to takes care forcewake. */
-}
-
-static void

fw_domains_posting_read(struct drm_i915_private *dev_priv)

{
	struct intel_uncore_forcewake_domain *d;

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

Quoted 5 lines
drivers/gpu/drm/i915/intel_uncore.c +1 -1
@@ -1187,7 +1180,7 @@ static void fw_domain_init(struct drm_i915_private *dev_priv,
 
 static void intel_uncore_fw_domains_init(struct drm_i915_private *dev_priv)
 {
-	if (INTEL_INFO(dev_priv)->gen <= 5)
+	if (INTEL_GEN(dev_priv) <= 5 || intel_vgpu_active(dev_priv))

Make these separate ifs, they aren't semantically related so be verbose.

Quoted 23 lines
drivers/gpu/drm/i915/intel_uncore.c +0 -9
 		return;
 
 	if (IS_GEN9(dev_priv)) {
@@ -1273,11 +1266,6 @@ static void intel_uncore_fw_domains_init(struct drm_i915_private *dev_priv)
 			       FORCEWAKE, FORCEWAKE_ACK);
 	}
 
-	if (intel_vgpu_active(dev_priv)) {
-		dev_priv->uncore.funcs.force_wake_get = vgpu_fw_domains_nop;
-		dev_priv->uncore.funcs.force_wake_put = vgpu_fw_domains_nop;
-	}
-
 	/* All future platforms are expected to require complex power gating */
 	WARN_ON(dev_priv->uncore.fw_domains == 0);
 }
@@ -1327,22 +1315,22 @@ void intel_uncore_init(struct drm_i915_private *dev_priv)
 	dev_priv->uncore.pmic_bus_access_nb.notifier_call =
 		i915_pmic_bus_access_notifier;
 
-	switch (INTEL_INFO(dev_priv)->gen) {
-	default:
-	case 9:
-		ASSIGN_FW_DOMAINS_TABLE(__gen9_fw_ranges);

drivers/gpu/drm/i915/intel_uncore.c void intel_uncore_init(struct drm_i915_private *dev_priv) · line 1318

Quoted 10 lines
drivers/gpu/drm/i915/intel_uncore.c +1 -9
-		ASSIGN_WRITE_MMIO_VFUNCS(fwtable);
-		ASSIGN_READ_MMIO_VFUNCS(fwtable);
-		if (HAS_DECOUPLED_MMIO(dev_priv)) {
-			dev_priv->uncore.funcs.mmio_readl =
-						gen9_decoupled_read32;
-			dev_priv->uncore.funcs.mmio_readq =
-						gen9_decoupled_read64;
-			dev_priv->uncore.funcs.mmio_writel =
-						gen9_decoupled_write32;
+	if (IS_GEN(dev_priv, 2, 4) || intel_vgpu_active(dev_priv)) {

Ok, this doesn't look too bad.

Quoted 1 line

Do the gvt-g hosts in CI now provide coverage for us of vgpu paths?

No idea.

Adding Zhenyu. So this patch avoids burning CPU cycles in guests and scheduling timers when all of that ends up in the dummy/no-op forcewake implementation.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

If interesting to you, would it be easy for you to test it or how should we proceed?

Patch looks fine to me. I can apply it for our QA testing if required.

That would be good I think, thank you. When it has been cleared that it actually works and doesn't break anything we can then merge it.

For the record,

-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw
In reply to Zhenyu Wang

Hi,

Quoted 90 lines · Zhenyu Wang
Quoted 89 lines · Tvrtko Ursulin
Quoted 79 lines · Chris Wilson
Quoted 34 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

If we avoid initializing forcewake domains when running as a guest, and also use gen2 mmio accessors in that case, we can avoid the timer traffic and any looping through the forcewake code which is currently just so it can end up in the no-op forcewake implementation.

---
 drivers/gpu/drm/i915/intel_uncore.c | 76 +++++++++++++------------------------
 1 file changed, 27 insertions(+), 49 deletions(-)
drivers/gpu/drm/i915/intel_uncore.c +0 -7
index 71b9b387ad04..09f5f02d7901 100644
@@ -138,13 +138,6 @@ fw_domains_put(struct drm_i915_private *dev_priv, enum forcewake_domains fw_doma
 }
 
 static void
-vgpu_fw_domains_nop(struct drm_i915_private *dev_priv,
-		    enum forcewake_domains fw_domains)
-{
-	/* Guest driver doesn't need to takes care forcewake. */
-}
-
-static void
 fw_domains_posting_read(struct drm_i915_private *dev_priv)
 {
 	struct intel_uncore_forcewake_domain *d;

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

Quoted 5 lines
drivers/gpu/drm/i915/intel_uncore.c +1 -1
@@ -1187,7 +1180,7 @@ static void fw_domain_init(struct drm_i915_private *dev_priv,
 
 static void intel_uncore_fw_domains_init(struct drm_i915_private *dev_priv)
 {
-	if (INTEL_INFO(dev_priv)->gen <= 5)
+	if (INTEL_GEN(dev_priv) <= 5 || intel_vgpu_active(dev_priv))

Make these separate ifs, they aren't semantically related so be verbose.

Quoted 23 lines
drivers/gpu/drm/i915/intel_uncore.c +0 -9
 		return;
 
 	if (IS_GEN9(dev_priv)) {
@@ -1273,11 +1266,6 @@ static void intel_uncore_fw_domains_init(struct drm_i915_private *dev_priv)
 			       FORCEWAKE, FORCEWAKE_ACK);
 	}
 
-	if (intel_vgpu_active(dev_priv)) {
-		dev_priv->uncore.funcs.force_wake_get = vgpu_fw_domains_nop;
-		dev_priv->uncore.funcs.force_wake_put = vgpu_fw_domains_nop;
-	}
-
 	/* All future platforms are expected to require complex power gating */
 	WARN_ON(dev_priv->uncore.fw_domains == 0);
 }
@@ -1327,22 +1315,22 @@ void intel_uncore_init(struct drm_i915_private *dev_priv)
 	dev_priv->uncore.pmic_bus_access_nb.notifier_call =
 		i915_pmic_bus_access_notifier;
 
-	switch (INTEL_INFO(dev_priv)->gen) {
-	default:
-	case 9:
-		ASSIGN_FW_DOMAINS_TABLE(__gen9_fw_ranges);

drivers/gpu/drm/i915/intel_uncore.c void intel_uncore_init(struct drm_i915_private *dev_priv) · line 1318

Quoted 10 lines
drivers/gpu/drm/i915/intel_uncore.c +1 -9
-		ASSIGN_WRITE_MMIO_VFUNCS(fwtable);
-		ASSIGN_READ_MMIO_VFUNCS(fwtable);
-		if (HAS_DECOUPLED_MMIO(dev_priv)) {
-			dev_priv->uncore.funcs.mmio_readl =
-						gen9_decoupled_read32;
-			dev_priv->uncore.funcs.mmio_readq =
-						gen9_decoupled_read64;
-			dev_priv->uncore.funcs.mmio_writel =
-						gen9_decoupled_write32;
+	if (IS_GEN(dev_priv, 2, 4) || intel_vgpu_active(dev_priv)) {

Ok, this doesn't look too bad.

Quoted 1 line

Do the gvt-g hosts in CI now provide coverage for us of vgpu paths?

No idea.

Adding Zhenyu. So this patch avoids burning CPU cycles in guests and scheduling timers when all of that ends up in the dummy/no-op forcewake implementation.

Quoted 5 lines
Quoted 3 lines

If interesting to you, would it be easy for you to test it or how should we proceed?

Patch looks fine to me. I can apply it for our QA testing if required.

Were you perhaps able to smoke test this one?

Regards,

Tvrtko

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

Tested-by
#8 lore raw
Quoted 113 lines

-----Original Message-----
From: Tvrtko Ursulin [mailto:[email protected]]
Sent: Friday, March 17, 2017 5:30 PM
To: Zhenyu Wang <[email protected]>
Cc: Chris Wilson <[email protected]>; Tvrtko Ursulin <[email protected]>; [email protected]; Ursulin, Tvrtko <[email protected]>; Li, Weinan Z <[email protected]>; Xu, Terrence <[email protected]>
Subject: Re: [Intel-gfx] [PATCH] drm/i915/vgpu: Neuter forcewakes for VGPU more thouroughly

Hi,

Quoted 28 lines · Zhenyu Wang
Quoted 27 lines · Tvrtko Ursulin
Quoted 25 lines · Chris Wilson
Quoted 24 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

If we avoid initializing forcewake domains when running as a guest, and also use gen2 mmio accessors in that case, we can avoid the timer traffic and any looping through the forcewake code which is currently just so it can end up in the no-op forcewake implementation.

---
 drivers/gpu/drm/i915/intel_uncore.c | 76
+++++++++++++------------------------
 1 file changed, 27 insertions(+), 49 deletions(-)
drivers/gpu/drm/i915/intel_uncore.c +0 -0
index 71b9b387ad04..09f5f02d7901 100644
@@ -138,13 +138,6 @@ fw_domains_put(struct drm_i915_private
 *dev_priv, enum forcewake_domains fw_doma  }
 
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

drivers/gpu/drm/i915/intel_uncore.c fw_domains_put(struct drm_i915_private *dev_priv, enum forcewake_domains fw_doma

Quoted 10 lines
drivers/gpu/drm/i915/intel_uncore.c +0 -7
 static void
-vgpu_fw_domains_nop(struct drm_i915_private *dev_priv,
-		    enum forcewake_domains fw_domains)
-{
-	/* Guest driver doesn't need to takes care forcewake. */
-}
-
-static void
 fw_domains_posting_read(struct drm_i915_private *dev_priv)  {
 	struct intel_uncore_forcewake_domain *d; @@ -1187,7 +1180,7

@@

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

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

Quoted 6 lines
drivers/gpu/drm/i915/intel_uncore.c +0 -0
 static void fw_domain_init(struct drm_i915_private *dev_priv,

static void intel_uncore_fw_domains_init(struct drm_i915_private
*dev_priv) {

drivers/gpu/drm/i915/intel_uncore.c +1 -1
-	if (INTEL_INFO(dev_priv)->gen <= 5)
+	if (INTEL_GEN(dev_priv) <= 5 || intel_vgpu_active(dev_priv))

Make these separate ifs, they aren't semantically related so be verbose.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

drivers/gpu/drm/i915/intel_uncore.c static void

Quoted 4 lines
drivers/gpu/drm/i915/intel_uncore.c +0 -0
 		return;
 
 	if (IS_GEN9(dev_priv)) {
@@ -1273,11 +1266,6 @@ static void

intel_uncore_fw_domains_init(struct drm_i915_private *dev_priv)

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

drivers/gpu/drm/i915/intel_uncore.c static void intel_uncore_fw_domains_init(struct drm_i915_private *dev_priv)

Quoted 5 lines
drivers/gpu/drm/i915/intel_uncore.c +0 -2
 			       FORCEWAKE, FORCEWAKE_ACK);
 	}
 
-	if (intel_vgpu_active(dev_priv)) {
-		dev_priv->uncore.funcs.force_wake_get =

vgpu_fw_domains_nop;

Quoted 1 line
Quoted 1 line
Quoted 1 line

drivers/gpu/drm/i915/intel_uncore.c static void · line 1278

Quoted 1 line
drivers/gpu/drm/i915/intel_uncore.c +0 -1
-		dev_priv->uncore.funcs.force_wake_put =

vgpu_fw_domains_nop;

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

drivers/gpu/drm/i915/intel_uncore.c fw_domains_put(struct drm_i915_private *dev_priv, enum forcewake_domains fw_doma

Quoted 3 lines
drivers/gpu/drm/i915/intel_uncore.c +0 -2
-	}
-
 	/* All future platforms are expected to require complex power gating

*/

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

drivers/gpu/drm/i915/intel_uncore.c static void · line 1271

Quoted 2 lines
drivers/gpu/drm/i915/intel_uncore.c +1 -0
 	WARN_ON(dev_priv->uncore.fw_domains == 0);  } @@ -1327,22
+1315,22 @@ void intel_uncore_init(struct drm_i915_private

*dev_priv)

Quoted 28 lines
Quoted 28 lines
Quoted 20 lines
Quoted 7 lines
drivers/gpu/drm/i915/intel_uncore.c +0 -4
 	dev_priv->uncore.pmic_bus_access_nb.notifier_call =
 		i915_pmic_bus_access_notifier;
 
-	switch (INTEL_INFO(dev_priv)->gen) {
-	default:
-	case 9:
-		ASSIGN_FW_DOMAINS_TABLE(__gen9_fw_ranges);

drivers/gpu/drm/i915/intel_uncore.c void intel_uncore_init(struct drm_i915_private *dev_priv) · line 1318

Quoted 10 lines
drivers/gpu/drm/i915/intel_uncore.c +1 -9
-		ASSIGN_WRITE_MMIO_VFUNCS(fwtable);
-		ASSIGN_READ_MMIO_VFUNCS(fwtable);
-		if (HAS_DECOUPLED_MMIO(dev_priv)) {
-			dev_priv->uncore.funcs.mmio_readl =
-						gen9_decoupled_read32;
-			dev_priv->uncore.funcs.mmio_readq =
-						gen9_decoupled_read64;
-			dev_priv->uncore.funcs.mmio_writel =
-						gen9_decoupled_write32;
+	if (IS_GEN(dev_priv, 2, 4) || intel_vgpu_active(dev_priv)) {

Ok, this doesn't look too bad.

Quoted 1 line

Do the gvt-g hosts in CI now provide coverage for us of vgpu paths?

No idea.

Adding Zhenyu. So this patch avoids burning CPU cycles in guests and scheduling timers when all of that ends up in the dummy/no-op forcewake implementation.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

If interesting to you, would it be easy for you to test it or how should we proceed?

Patch looks fine to me. I can apply it for our QA testing if required.

Were you perhaps able to smoke test this one?

Hi Ursulin, we have verified your patch in guest, no regression be found.

Quoted 3 lines

Regards,

Tvrtko

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

#9 lore raw
Quoted 115 lines · Terrence
Quoted 115 lines

-----Original Message-----
From: Tvrtko Ursulin [mailto:[email protected]]
Sent: Friday, March 17, 2017 5:30 PM
To: Zhenyu Wang <[email protected]>
Cc: Chris Wilson <[email protected]>; Tvrtko Ursulin <[email protected]>; [email protected]; Ursulin, Tvrtko <[email protected]>; Li, Weinan Z <[email protected]>; Xu, Terrence <[email protected]>
Subject: Re: [Intel-gfx] [PATCH] drm/i915/vgpu: Neuter forcewakes for VGPU more thouroughly

Hi,

Quoted 28 lines · Zhenyu Wang
Quoted 27 lines · Tvrtko Ursulin
Quoted 25 lines · Chris Wilson
Quoted 24 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

If we avoid initializing forcewake domains when running as a guest, and also use gen2 mmio accessors in that case, we can avoid the timer traffic and any looping through the forcewake code which is currently just so it can end up in the no-op forcewake implementation.

---
 drivers/gpu/drm/i915/intel_uncore.c | 76
+++++++++++++------------------------
 1 file changed, 27 insertions(+), 49 deletions(-)
drivers/gpu/drm/i915/intel_uncore.c +0 -0
index 71b9b387ad04..09f5f02d7901 100644
@@ -138,13 +138,6 @@ fw_domains_put(struct drm_i915_private
 *dev_priv, enum forcewake_domains fw_doma  }
 
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

drivers/gpu/drm/i915/intel_uncore.c fw_domains_put(struct drm_i915_private *dev_priv, enum forcewake_domains fw_doma

Quoted 10 lines
drivers/gpu/drm/i915/intel_uncore.c +0 -7
 static void
-vgpu_fw_domains_nop(struct drm_i915_private *dev_priv,
-		    enum forcewake_domains fw_domains)
-{
-	/* Guest driver doesn't need to takes care forcewake. */
-}
-
-static void
 fw_domains_posting_read(struct drm_i915_private *dev_priv)  {
 	struct intel_uncore_forcewake_domain *d; @@ -1187,7 +1180,7

@@

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

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

Quoted 6 lines
drivers/gpu/drm/i915/intel_uncore.c +0 -0
 static void fw_domain_init(struct drm_i915_private *dev_priv,

static void intel_uncore_fw_domains_init(struct drm_i915_private
*dev_priv) {

drivers/gpu/drm/i915/intel_uncore.c +1 -1
-	if (INTEL_INFO(dev_priv)->gen <= 5)
+	if (INTEL_GEN(dev_priv) <= 5 || intel_vgpu_active(dev_priv))

Make these separate ifs, they aren't semantically related so be verbose.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

drivers/gpu/drm/i915/intel_uncore.c static void

Quoted 4 lines
drivers/gpu/drm/i915/intel_uncore.c +0 -0
 		return;
 
 	if (IS_GEN9(dev_priv)) {
@@ -1273,11 +1266,6 @@ static void

intel_uncore_fw_domains_init(struct drm_i915_private *dev_priv)

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

drivers/gpu/drm/i915/intel_uncore.c static void intel_uncore_fw_domains_init(struct drm_i915_private *dev_priv)

Quoted 5 lines
drivers/gpu/drm/i915/intel_uncore.c +0 -2
 			       FORCEWAKE, FORCEWAKE_ACK);
 	}
 
-	if (intel_vgpu_active(dev_priv)) {
-		dev_priv->uncore.funcs.force_wake_get =

vgpu_fw_domains_nop;

Quoted 1 line
Quoted 1 line
Quoted 1 line

drivers/gpu/drm/i915/intel_uncore.c static void · line 1278

Quoted 1 line
drivers/gpu/drm/i915/intel_uncore.c +0 -1
-		dev_priv->uncore.funcs.force_wake_put =

vgpu_fw_domains_nop;

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

drivers/gpu/drm/i915/intel_uncore.c fw_domains_put(struct drm_i915_private *dev_priv, enum forcewake_domains fw_doma

Quoted 3 lines
drivers/gpu/drm/i915/intel_uncore.c +0 -2
-	}
-
 	/* All future platforms are expected to require complex power gating

*/

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

drivers/gpu/drm/i915/intel_uncore.c static void · line 1271

Quoted 2 lines
drivers/gpu/drm/i915/intel_uncore.c +1 -0
 	WARN_ON(dev_priv->uncore.fw_domains == 0);  } @@ -1327,22
+1315,22 @@ void intel_uncore_init(struct drm_i915_private

*dev_priv)

Quoted 32 lines
Quoted 31 lines
Quoted 20 lines
Quoted 7 lines
drivers/gpu/drm/i915/intel_uncore.c +0 -4
 	dev_priv->uncore.pmic_bus_access_nb.notifier_call =
 		i915_pmic_bus_access_notifier;
 
-	switch (INTEL_INFO(dev_priv)->gen) {
-	default:
-	case 9:
-		ASSIGN_FW_DOMAINS_TABLE(__gen9_fw_ranges);

drivers/gpu/drm/i915/intel_uncore.c void intel_uncore_init(struct drm_i915_private *dev_priv) · line 1318

Quoted 10 lines
drivers/gpu/drm/i915/intel_uncore.c +1 -9
-		ASSIGN_WRITE_MMIO_VFUNCS(fwtable);
-		ASSIGN_READ_MMIO_VFUNCS(fwtable);
-		if (HAS_DECOUPLED_MMIO(dev_priv)) {
-			dev_priv->uncore.funcs.mmio_readl =
-						gen9_decoupled_read32;
-			dev_priv->uncore.funcs.mmio_readq =
-						gen9_decoupled_read64;
-			dev_priv->uncore.funcs.mmio_writel =
-						gen9_decoupled_write32;
+	if (IS_GEN(dev_priv, 2, 4) || intel_vgpu_active(dev_priv)) {

Ok, this doesn't look too bad.

Quoted 1 line

Do the gvt-g hosts in CI now provide coverage for us of vgpu paths?

No idea.

Adding Zhenyu. So this patch avoids burning CPU cycles in guests and scheduling timers when all of that ends up in the dummy/no-op forcewake implementation.

If interesting to you, would it be easy for you to test it or how should we proceed?

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Patch looks fine to me. I can apply it for our QA testing if required.

Were you perhaps able to smoke test this one?

Hi Ursulin, we have verified your patch in guest, no regression be found.

Thanks!

Regards,

Tvrtko

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

#11 lore raw

Re: ✓ Fi.CI.BAT: success for drm/i915/vgpu: Neuter forcewakes for VGPU more thouroughly

In reply to Patchwork
Quoted 30 lines · Patchwork

== Series Details ==

Series: drm/i915/vgpu: Neuter forcewakes for VGPU more thouroughly
URL : https://patchwork.freedesktop.org/series/21047/
State : success

== Summary ==

Series 21047v1 drm/i915/vgpu: Neuter forcewakes for VGPU more thouroughly
https://patchwork.freedesktop.org/api/1.0/series/21047/revisions/1/mbox/

fi-bdw-5557u     total:278  pass:267  dwarn:0   dfail:0   fail:0   skip:11  time: 467s
fi-bsw-n3050     total:278  pass:239  dwarn:0   dfail:0   fail:0   skip:39  time: 605s
fi-bxt-j4205     total:278  pass:259  dwarn:0   dfail:0   fail:0   skip:19  time: 536s
fi-bxt-t5700     total:278  pass:258  dwarn:0   dfail:0   fail:0   skip:20  time: 609s
fi-byt-j1900     total:278  pass:251  dwarn:0   dfail:0   fail:0   skip:27  time: 506s
fi-byt-n2820     total:278  pass:247  dwarn:0   dfail:0   fail:0   skip:31  time: 500s
fi-hsw-4770      total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time: 441s
fi-hsw-4770r     total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time: 434s
fi-ilk-650       total:278  pass:228  dwarn:0   dfail:0   fail:0   skip:50  time: 441s
fi-ivb-3520m     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time: 507s
fi-ivb-3770      total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time: 493s
fi-kbl-7500u     total:278  pass:259  dwarn:1   dfail:0   fail:0   skip:18  time: 476s
fi-skl-6260u     total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time: 503s
fi-skl-6700hq    total:278  pass:261  dwarn:0   dfail:0   fail:0   skip:17  time: 608s
fi-skl-6700k     total:278  pass:256  dwarn:4   dfail:0   fail:0   skip:18  time: 507s
fi-skl-6770hq    total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time: 559s
fi-snb-2520m     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time: 561s
fi-snb-2600      total:278  pass:249  dwarn:0   dfail:0   fail:0   skip:29  time: 427s
Quoted 2 lines

d8d69f76555feef19e3e4b601378446604d90da5 drm-tip: 2017y-03m-10d-11h-50m-04s UTC integration manifest 212fdd9 drm/i915/vgpu: Neuter forcewakes for VGPU more thouroughly

Pushed, thanks for review and testing!

Regards,

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