[Intel-gfx] [RFC 04/31] drm/i915: Store some backpointers in struct intel_gt

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Fri Jun 14 15:17:04 UTC 2019


From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>

We need an easy way to get back to i915 and uncore.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/gt/intel_gt.c               | 7 ++++++-
 drivers/gpu/drm/i915/gt/intel_gt.h               | 4 +++-
 drivers/gpu/drm/i915/gt/intel_gt_types.h         | 6 ++++++
 drivers/gpu/drm/i915/i915_gem.c                  | 2 +-
 drivers/gpu/drm/i915/selftests/mock_gem_device.c | 2 +-
 5 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_gt.c b/drivers/gpu/drm/i915/gt/intel_gt.c
index 807c5f746110..e8d72570a5bf 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt.c
+++ b/drivers/gpu/drm/i915/gt/intel_gt.c
@@ -4,10 +4,15 @@
  * Copyright © 2019 Intel Corporation
  */
 
+#include "i915_drv.h"
+
 #include "intel_gt.h"
 
-void intel_gt_init(struct intel_gt *gt)
+void intel_gt_init(struct intel_gt *gt, struct drm_i915_private *i915)
 {
+	gt->i915 = i915;
+	gt->uncore = &i915->uncore;
+
 	INIT_LIST_HEAD(&gt->active_rings);
 	INIT_LIST_HEAD(&gt->closed_vma);
 
diff --git a/drivers/gpu/drm/i915/gt/intel_gt.h b/drivers/gpu/drm/i915/gt/intel_gt.h
index d0b599dd6d0f..f57ff3758f54 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt.h
+++ b/drivers/gpu/drm/i915/gt/intel_gt.h
@@ -9,6 +9,8 @@
 
 #include "gt/intel_gt_types.h"
 
-void intel_gt_init(struct intel_gt *gt);
+struct drm_i915_private;
+
+void intel_gt_init(struct intel_gt *gt, struct drm_i915_private *i915);
 
 #endif /* __INTEL_GT_H__ */
diff --git a/drivers/gpu/drm/i915/gt/intel_gt_types.h b/drivers/gpu/drm/i915/gt/intel_gt_types.h
index dcdb18e0dd84..d96df4f68741 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt_types.h
+++ b/drivers/gpu/drm/i915/gt/intel_gt_types.h
@@ -17,7 +17,13 @@
 #include "i915_vma.h"
 #include "intel_wakeref.h"
 
+struct drm_i915_private;
+struct intel_uncore;
+
 struct intel_gt {
+	struct drm_i915_private *i915;
+	struct intel_uncore *uncore;
+
 	struct i915_gt_timelines {
 		struct mutex mutex; /* protects list, tainted by GPU */
 		struct list_head active_list;
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index d5897e13897b..7fdf252f9322 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1749,7 +1749,7 @@ int i915_gem_init_early(struct drm_i915_private *dev_priv)
 {
 	int err;
 
-	intel_gt_init(&dev_priv->gt);
+	intel_gt_init(&dev_priv->gt, dev_priv);
 	intel_gt_pm_init(dev_priv);
 
 	i915_gem_init__mm(dev_priv);
diff --git a/drivers/gpu/drm/i915/selftests/mock_gem_device.c b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
index fbcccc3cf85a..413aaff1534b 100644
--- a/drivers/gpu/drm/i915/selftests/mock_gem_device.c
+++ b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
@@ -202,7 +202,7 @@ struct drm_i915_private *mock_gem_device(void)
 
 	i915_timelines_init(i915);
 
-	intel_gt_init(&i915->gt);
+	intel_gt_init(&i915->gt, i915);
 
 	mutex_lock(&i915->drm.struct_mutex);
 
-- 
2.20.1



More information about the Intel-gfx mailing list