Remove the modification of the "constant" device info by promoting the
inconsistent intel_engine static table into an initialisation error.
Now, if we add a new engine into the device_info, we must first add that
engine information into the intel_engines.

Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/gt/intel_engine_cs.c | 30 ++++++++---------------
 1 file changed, 10 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_engine_cs.c 
b/drivers/gpu/drm/i915/gt/intel_engine_cs.c
index 570c9a4813d1..c232e80d187c 100644
--- a/drivers/gpu/drm/i915/gt/intel_engine_cs.c
+++ b/drivers/gpu/drm/i915/gt/intel_engine_cs.c
@@ -366,21 +366,20 @@ void intel_engines_cleanup(struct drm_i915_private *i915)
 
 /**
  * intel_engines_init_mmio() - allocate and prepare the Engine Command 
Streamers
- * @dev_priv: i915 device private
+ * @i915: i915 device private
  *
  * Return: non-zero if the initialization failed.
  */
 int intel_engines_init_mmio(struct drm_i915_private *i915)
 {
-       struct intel_device_info *device_info = mkwrite_device_info(i915);
-       const unsigned int engine_mask = INTEL_INFO(i915)->engine_mask;
-       unsigned int mask = 0;
        unsigned int i;
        int err;
 
-       WARN_ON(engine_mask == 0);
-       WARN_ON(engine_mask &
-               GENMASK(BITS_PER_TYPE(mask) - 1, I915_NUM_ENGINES));
+       /* We always presume we have at least RCS available for later probing */
+       if (GEM_WARN_ON(!HAS_ENGINE(i915, RCS0))) {
+               err = -ENODEV;
+               goto cleanup;
+       }
 
        if (i915_inject_load_failure())
                return -ENODEV;
@@ -392,25 +391,16 @@ int intel_engines_init_mmio(struct drm_i915_private *i915)
                err = intel_engine_setup(i915, i);
                if (err)
                        goto cleanup;
-
-               mask |= BIT(i);
        }
 
-       /*
-        * Catch failures to update intel_engines table when the new engines
-        * are added to the driver by a warning and disabling the forgotten
-        * engines.
-        */
-       if (WARN_ON(mask != engine_mask))
-               device_info->engine_mask = mask;
-
-       /* We always presume we have at least RCS available for later probing */
-       if (WARN_ON(!HAS_ENGINE(i915, RCS0))) {
+       /* Catch failures to update intel_engines table for new engines. */
+       if (GEM_WARN_ON(INTEL_INFO(i915)->engine_mask >> i)) {
                err = -ENODEV;
                goto cleanup;
        }
 
-       RUNTIME_INFO(i915)->num_engines = hweight32(mask);
+       RUNTIME_INFO(i915)->num_engines =
+               hweight32(INTEL_INFO(i915)->engine_mask);
 
        i915_check_and_clear_faults(i915);
 
-- 
2.20.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to