drm/i915: split general MMIO setup from per-GT uncore init
authorDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Fri, 29 Oct 2021 03:28:09 +0000 (20:28 -0700)
committerMatt Roper <matthew.d.roper@intel.com>
Thu, 11 Nov 2021 05:07:16 +0000 (21:07 -0800)
In coming patches we'll be doing the actual tile initialization between
these two uncore init phases.

Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211029032817.3747750-3-matthew.d.roper@intel.com
drivers/gpu/drm/i915/i915_drv.c
drivers/gpu/drm/i915/intel_uncore.c
drivers/gpu/drm/i915/intel_uncore.h

index 066116bc0a90749c75fb0e13e5b9f61d1fd440b1..e140628dc0c5b6ea95d065d77aa9a3a172e84407 100644 (file)
@@ -415,10 +415,14 @@ static int i915_driver_mmio_probe(struct drm_i915_private *dev_priv)
        if (ret < 0)
                return ret;
 
-       ret = intel_uncore_init_mmio(&dev_priv->uncore);
+       ret = intel_uncore_setup_mmio(&dev_priv->uncore);
        if (ret < 0)
                goto err_bridge;
 
+       ret = intel_uncore_init_mmio(&dev_priv->uncore);
+       if (ret)
+               goto err_mmio;
+
        /* Try to make sure MCHBAR is enabled before poking at it */
        intel_setup_mchbar(dev_priv);
        intel_device_info_runtime_init(dev_priv);
@@ -435,6 +439,8 @@ static int i915_driver_mmio_probe(struct drm_i915_private *dev_priv)
 err_uncore:
        intel_teardown_mchbar(dev_priv);
        intel_uncore_fini_mmio(&dev_priv->uncore);
+err_mmio:
+       intel_uncore_cleanup_mmio(&dev_priv->uncore);
 err_bridge:
        pci_dev_put(dev_priv->bridge_dev);
 
@@ -449,6 +455,7 @@ static void i915_driver_mmio_release(struct drm_i915_private *dev_priv)
 {
        intel_teardown_mchbar(dev_priv);
        intel_uncore_fini_mmio(&dev_priv->uncore);
+       intel_uncore_cleanup_mmio(&dev_priv->uncore);
        pci_dev_put(dev_priv->bridge_dev);
 }
 
index e072054adac5762abb1649a045aa82d562991f58..a308e86c9d9f97e8ea7d745d51415d6d0396b0fb 100644 (file)
@@ -2020,7 +2020,7 @@ static int i915_pmic_bus_access_notifier(struct notifier_block *nb,
        return NOTIFY_OK;
 }
 
-static int uncore_mmio_setup(struct intel_uncore *uncore)
+int intel_uncore_setup_mmio(struct intel_uncore *uncore)
 {
        struct drm_i915_private *i915 = uncore->i915;
        struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
@@ -2053,7 +2053,7 @@ static int uncore_mmio_setup(struct intel_uncore *uncore)
        return 0;
 }
 
-static void uncore_mmio_cleanup(struct intel_uncore *uncore)
+void intel_uncore_cleanup_mmio(struct intel_uncore *uncore)
 {
        struct pci_dev *pdev = to_pci_dev(uncore->i915->drm.dev);
 
@@ -2146,10 +2146,6 @@ int intel_uncore_init_mmio(struct intel_uncore *uncore)
        struct drm_i915_private *i915 = uncore->i915;
        int ret;
 
-       ret = uncore_mmio_setup(uncore);
-       if (ret)
-               return ret;
-
        /*
         * The boot firmware initializes local memory and assesses its health.
         * If memory training fails, the punit will have been instructed to
@@ -2170,7 +2166,7 @@ int intel_uncore_init_mmio(struct intel_uncore *uncore)
        } else {
                ret = uncore_forcewake_init(uncore);
                if (ret)
-                       goto out_mmio_cleanup;
+                       return ret;
        }
 
        /* make sure fw funcs are set if and only if we have fw*/
@@ -2192,11 +2188,6 @@ int intel_uncore_init_mmio(struct intel_uncore *uncore)
                drm_dbg(&i915->drm, "unclaimed mmio detected on uncore init, clearing\n");
 
        return 0;
-
-out_mmio_cleanup:
-       uncore_mmio_cleanup(uncore);
-
-       return ret;
 }
 
 /*
@@ -2261,8 +2252,6 @@ void intel_uncore_fini_mmio(struct intel_uncore *uncore)
                intel_uncore_fw_domains_fini(uncore);
                iosf_mbi_punit_release();
        }
-
-       uncore_mmio_cleanup(uncore);
 }
 
 static const struct reg_whitelist {
index 3248e4e2c540ce6a42fa44d5d1d200e0ab1086f7..d1d17b04e29fc0a48cd4717b9878e731dcd57ec5 100644 (file)
@@ -218,11 +218,13 @@ void
 intel_uncore_mmio_debug_init_early(struct intel_uncore_mmio_debug *mmio_debug);
 void intel_uncore_init_early(struct intel_uncore *uncore,
                             struct drm_i915_private *i915);
+int intel_uncore_setup_mmio(struct intel_uncore *uncore);
 int intel_uncore_init_mmio(struct intel_uncore *uncore);
 void intel_uncore_prune_engine_fw_domains(struct intel_uncore *uncore,
                                          struct intel_gt *gt);
 bool intel_uncore_unclaimed_mmio(struct intel_uncore *uncore);
 bool intel_uncore_arm_unclaimed_mmio_detection(struct intel_uncore *uncore);
+void intel_uncore_cleanup_mmio(struct intel_uncore *uncore);
 void intel_uncore_fini_mmio(struct intel_uncore *uncore);
 void intel_uncore_suspend(struct intel_uncore *uncore);
 void intel_uncore_resume_early(struct intel_uncore *uncore);