[Intel-gfx] [RFC 4/8] drm/i915: explicitly prune forcewake domain

Daniele Ceraolo Spurio daniele.ceraolospurio at intel.com
Thu Jun 6 21:52:13 UTC 2019


When we know which engines we're fusing off we can immediately remove
the corresponding forcewake domain, no need to go though the masks
again.

Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio at intel.com>
---
 drivers/gpu/drm/i915/i915_drv.c          |  2 --
 drivers/gpu/drm/i915/intel_device_info.c |  4 +++
 drivers/gpu/drm/i915/intel_uncore.c      | 32 ++++--------------------
 drivers/gpu/drm/i915/intel_uncore.h      |  3 ++-
 4 files changed, 11 insertions(+), 30 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 05ee328e3f66..9094736af5da 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -995,8 +995,6 @@ static int i915_driver_init_mmio(struct drm_i915_private *dev_priv)
 
 	intel_device_info_init_mmio(dev_priv);
 
-	intel_uncore_prune_mmio_domains(&dev_priv->uncore);
-
 	intel_uc_init_mmio(dev_priv);
 
 	ret = intel_engines_init_mmio(dev_priv);
diff --git a/drivers/gpu/drm/i915/intel_device_info.c b/drivers/gpu/drm/i915/intel_device_info.c
index 97f742530fa1..48d159d9e42a 100644
--- a/drivers/gpu/drm/i915/intel_device_info.c
+++ b/drivers/gpu/drm/i915/intel_device_info.c
@@ -1027,6 +1027,8 @@ void intel_device_info_init_mmio(struct drm_i915_private *dev_priv)
 
 		if (!(BIT(i) & vdbox_mask)) {
 			info->engine_mask &= ~BIT(_VCS(i));
+			intel_uncore_fw_domain_prune(&dev_priv->uncore,
+						     FW_DOMAIN_ID_MEDIA_VDBOX0 + i);
 			DRM_DEBUG_DRIVER("vcs%u fused off\n", i);
 			continue;
 		}
@@ -1048,6 +1050,8 @@ void intel_device_info_init_mmio(struct drm_i915_private *dev_priv)
 
 		if (!(BIT(i) & vebox_mask)) {
 			info->engine_mask &= ~BIT(_VECS(i));
+			intel_uncore_fw_domain_prune(&dev_priv->uncore,
+						     FW_DOMAIN_ID_MEDIA_VEBOX0 + i);
 			DRM_DEBUG_DRIVER("vecs%u fused off\n", i);
 		}
 	}
diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c
index 30650e6e2f54..7ebea00207a6 100644
--- a/drivers/gpu/drm/i915/intel_uncore.c
+++ b/drivers/gpu/drm/i915/intel_uncore.c
@@ -1659,35 +1659,13 @@ int intel_uncore_init_mmio(struct intel_uncore *uncore)
  * the forcewake domains. Prune them, to make sure they only reference existing
  * engines.
  */
-void intel_uncore_prune_mmio_domains(struct intel_uncore *uncore)
+void intel_uncore_fw_domain_prune(struct intel_uncore *uncore,
+				  enum forcewake_domain_id domain_id)
 {
-	struct drm_i915_private *i915 = uncore_to_i915(uncore);
-
-	if (INTEL_GEN(i915) >= 11) {
-		enum forcewake_domains fw_domains = uncore->fw_domains;
-		enum forcewake_domain_id domain_id;
-		int i;
-
-		for (i = 0; i < I915_MAX_VCS; i++) {
-			domain_id = FW_DOMAIN_ID_MEDIA_VDBOX0 + i;
-
-			if (HAS_ENGINE(i915, _VCS(i)))
-				continue;
-
-			if (fw_domains & BIT(domain_id))
-				fw_domain_fini(uncore, domain_id);
-		}
-
-		for (i = 0; i < I915_MAX_VECS; i++) {
-			domain_id = FW_DOMAIN_ID_MEDIA_VEBOX0 + i;
-
-			if (HAS_ENGINE(i915, _VECS(i)))
-				continue;
+	if (WARN_ON(!(uncore->fw_domains & BIT(domain_id))))
+		return;
 
-			if (fw_domains & BIT(domain_id))
-				fw_domain_fini(uncore, domain_id);
-		}
-	}
+	fw_domain_fini(uncore, domain_id);
 }
 
 void intel_uncore_fini_mmio(struct intel_uncore *uncore)
diff --git a/drivers/gpu/drm/i915/intel_uncore.h b/drivers/gpu/drm/i915/intel_uncore.h
index 2bb80962e7c5..b2de47da053f 100644
--- a/drivers/gpu/drm/i915/intel_uncore.h
+++ b/drivers/gpu/drm/i915/intel_uncore.h
@@ -179,7 +179,8 @@ intel_uncore_has_fifo(const struct intel_uncore *uncore)
 
 void intel_uncore_init_early(struct intel_uncore *uncore);
 int intel_uncore_init_mmio(struct intel_uncore *uncore);
-void intel_uncore_prune_mmio_domains(struct intel_uncore *uncore);
+void intel_uncore_fw_domain_prune(struct intel_uncore *uncore,
+				  enum forcewake_domain_id domain_id);
 bool intel_uncore_unclaimed_mmio(struct intel_uncore *uncore);
 bool intel_uncore_arm_unclaimed_mmio_detection(struct intel_uncore *uncore);
 void intel_uncore_fini_mmio(struct intel_uncore *uncore);
-- 
2.20.1



More information about the Intel-gfx mailing list