]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915: Store intel_gt backpointer in vm
authorTvrtko Ursulin <tvrtko.ursulin@intel.com>
Fri, 21 Jun 2019 07:07:59 +0000 (08:07 +0100)
committerTvrtko Ursulin <tvrtko.ursulin@intel.com>
Fri, 21 Jun 2019 12:48:36 +0000 (13:48 +0100)
This will come useful in the following patch.

v2:
 * Handle mock ggtt.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190621070811.7006-21-tvrtko.ursulin@linux.intel.com
drivers/gpu/drm/i915/i915_gem_gtt.c
drivers/gpu/drm/i915/i915_gem_gtt.h
drivers/gpu/drm/i915/selftests/mock_gtt.c

index 17f690f9d95dcbb641d618202cfe608311fc823a..1467b65c9a100dabb2494e9c3059c20ef812f460 100644 (file)
@@ -1603,9 +1603,11 @@ unwind:
        return -ENOMEM;
 }
 
-static void ppgtt_init(struct drm_i915_private *i915,
-                      struct i915_ppgtt *ppgtt)
+static void ppgtt_init(struct i915_ppgtt *ppgtt, struct intel_gt *gt)
 {
+       struct drm_i915_private *i915 = gt->i915;
+
+       ppgtt->vm.gt = gt;
        ppgtt->vm.i915 = i915;
        ppgtt->vm.dma = &i915->drm.pdev->dev;
        ppgtt->vm.total = BIT_ULL(INTEL_INFO(i915)->ppgtt_size);
@@ -1634,7 +1636,7 @@ static struct i915_ppgtt *gen8_ppgtt_create(struct drm_i915_private *i915)
        if (!ppgtt)
                return ERR_PTR(-ENOMEM);
 
-       ppgtt_init(i915, ppgtt);
+       ppgtt_init(ppgtt, &i915->gt);
 
        /*
         * From bdw, there is hw support for read-only pages in the PPGTT.
@@ -2141,7 +2143,7 @@ static struct i915_ppgtt *gen6_ppgtt_create(struct drm_i915_private *i915)
        if (!ppgtt)
                return ERR_PTR(-ENOMEM);
 
-       ppgtt_init(i915, &ppgtt->base);
+       ppgtt_init(&ppgtt->base, &i915->gt);
 
        ppgtt->base.vm.allocate_va_range = gen6_alloc_va_range;
        ppgtt->base.vm.clear_range = gen6_ppgtt_clear_range;
@@ -3452,10 +3454,12 @@ static int i915_gmch_probe(struct i915_ggtt *ggtt)
        return 0;
 }
 
-static int ggtt_probe_hw(struct i915_ggtt *ggtt, struct drm_i915_private *i915)
+static int ggtt_probe_hw(struct i915_ggtt *ggtt, struct intel_gt *gt)
 {
+       struct drm_i915_private *i915 = gt->i915;
        int ret;
 
+       ggtt->vm.gt = gt;
        ggtt->vm.i915 = i915;
        ggtt->vm.dma = &i915->drm.pdev->dev;
 
@@ -3501,7 +3505,7 @@ int i915_ggtt_probe_hw(struct drm_i915_private *i915)
 {
        int ret;
 
-       ret = ggtt_probe_hw(&i915->ggtt, i915);
+       ret = ggtt_probe_hw(&i915->ggtt, &i915->gt);
        if (ret)
                return ret;
 
index ca8ba458a3101f6b70a5c938c708479536eaef97..6d1aad555ffaf173ee1e0c898b5a96658b735b1b 100644 (file)
@@ -288,6 +288,7 @@ struct i915_address_space {
        struct rcu_work rcu;
 
        struct drm_mm mm;
+       struct intel_gt *gt;
        struct drm_i915_private *i915;
        struct device *dma;
        /* Every address space belongs to a struct file - except for the global
index f625c307a4060f2558a5eea363afed73199d85fd..215372f75eecdcc6caf62aa45b1c2d3e5997cbda 100644 (file)
@@ -98,6 +98,7 @@ void mock_init_ggtt(struct drm_i915_private *i915, struct i915_ggtt *ggtt)
 {
        memset(ggtt, 0, sizeof(*ggtt));
 
+       ggtt->vm.gt = &i915->gt;
        ggtt->vm.i915 = i915;
        ggtt->vm.is_ggtt = true;