[PATCH 7/7] WIP - adding i915_ggtt_early_probe()

Luca Coelho luciano.coelho at intel.com
Mon Sep 30 09:29:42 UTC 2024


Signed-off-by: Luca Coelho <luciano.coelho at intel.com>
---
 drivers/gpu/drm/i915/gt/intel_ggtt.c | 24 +++++++++++++++++++++---
 drivers/gpu/drm/i915/gt/intel_gtt.h  |  1 +
 drivers/gpu/drm/i915/i915_driver.c   |  7 ++++++-
 3 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_ggtt.c b/drivers/gpu/drm/i915/gt/intel_ggtt.c
index d60a6ca0cae5..a180ec593c7c 100644
--- a/drivers/gpu/drm/i915/gt/intel_ggtt.c
+++ b/drivers/gpu/drm/i915/gt/intel_ggtt.c
@@ -1446,7 +1446,7 @@ static int gen6_gmch_probe(struct i915_ggtt *ggtt)
 	return ggtt_probe_common(ggtt, size);
 }
 
-static int ggtt_probe_hw(struct i915_ggtt *ggtt, struct intel_gt *gt)
+static int ggtt_early_probe(struct i915_ggtt *ggtt, struct intel_gt *gt)
 {
 	struct drm_i915_private *i915 = gt->i915;
 	int ret;
@@ -1468,6 +1468,13 @@ static int ggtt_probe_hw(struct i915_ggtt *ggtt, struct intel_gt *gt)
 		return ret;
 	}
 
+	return 0;
+}
+
+static int ggtt_probe_hw(struct i915_ggtt *ggtt, struct intel_gt *gt)
+{
+	struct drm_i915_private *i915 = gt->i915;
+
 	if ((ggtt->vm.total - 1) >> 32) {
 		drm_err(&i915->drm,
 			"We never expected a Global GTT with more than 32bits"
@@ -1497,10 +1504,10 @@ static int ggtt_probe_hw(struct i915_ggtt *ggtt, struct intel_gt *gt)
 }
 
 /**
- * i915_ggtt_probe_hw - Probe GGTT hardware location
+ * i915_ggtt_early_probe - Set initial probe params
  * @i915: i915 device
  */
-int i915_ggtt_probe_hw(struct drm_i915_private *i915)
+int i915_ggtt_early_probe(struct drm_i915_private *i915)
 {
 	struct intel_gt *gt;
 	int ret, i;
@@ -1511,6 +1518,17 @@ int i915_ggtt_probe_hw(struct drm_i915_private *i915)
 			return ret;
 	}
 
+	return ggtt_early_probe(to_gt(i915)->ggtt, to_gt(i915));
+}
+
+/**
+ * i915_ggtt_probe_hw - Probe GGTT hardware location
+ * @i915: i915 device
+ */
+int i915_ggtt_probe_hw(struct drm_i915_private *i915)
+{
+	int ret;
+
 	ret = ggtt_probe_hw(to_gt(i915)->ggtt, to_gt(i915));
 	if (ret)
 		return ret;
diff --git a/drivers/gpu/drm/i915/gt/intel_gtt.h b/drivers/gpu/drm/i915/gt/intel_gtt.h
index 6b85222ee3ea..ec60edebf497 100644
--- a/drivers/gpu/drm/i915/gt/intel_gtt.h
+++ b/drivers/gpu/drm/i915/gt/intel_gtt.h
@@ -590,6 +590,7 @@ void intel_ggtt_bind_vma(struct i915_address_space *vm,
 void intel_ggtt_unbind_vma(struct i915_address_space *vm,
 			   struct i915_vma_resource *vma_res);
 
+int i915_ggtt_early_probe(struct drm_i915_private *i915);
 int i915_ggtt_probe_hw(struct drm_i915_private *i915);
 int i915_ggtt_init_hw(struct drm_i915_private *i915);
 int i915_ggtt_enable_hw(struct drm_i915_private *i915);
diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c
index 3732a7e52ed3..5915a3c48268 100644
--- a/drivers/gpu/drm/i915/i915_driver.c
+++ b/drivers/gpu/drm/i915/i915_driver.c
@@ -481,10 +481,14 @@ static int i915_driver_hw_probe(struct drm_i915_private *dev_priv)
 	if (ret)
 		return ret;
 
-	ret = i915_ggtt_probe_hw(dev_priv);
+	ret = i915_ggtt_early_probe(dev_priv);
 	if (ret)
 		goto err_perf;
 
+	ret = i915_ggtt_probe_hw(dev_priv);
+	if (ret)
+		goto err_early_probe;
+
 	ret = drm_aperture_remove_conflicting_pci_framebuffers(pdev, dev_priv->drm.driver);
 	if (ret)
 		goto err_ggtt;
@@ -567,6 +571,7 @@ static int i915_driver_hw_probe(struct drm_i915_private *dev_priv)
 err_ggtt:
 	i915_ggtt_driver_release(dev_priv);
 	i915_gem_drain_freed_objects(dev_priv);
+err_early_probe:
 	i915_ggtt_driver_late_release(dev_priv);
 err_perf:
 	i915_perf_fini(dev_priv);
-- 
2.45.2



More information about the Intel-gfx-trybot mailing list