]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/i915/uncore: split unclaimed_reg_debug() to header and footer
authorJani Nikula <jani.nikula@intel.com>
Tue, 1 Aug 2023 12:32:49 +0000 (15:32 +0300)
committerJani Nikula <jani.nikula@intel.com>
Tue, 1 Aug 2023 16:39:15 +0000 (19:39 +0300)
Make it easier to have different logic for the two for follow-up.

Cc: Lee Shawn C <shawn.c.lee@intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/8a0a93f08314f8d7e222a907d9aa5e0b89cb969e.1690886109.git.jani.nikula@intel.com
drivers/gpu/drm/i915/intel_uncore.c

index 796ebfe6c5507293c34fa3fb96a340f63a47b1a0..a88aa342b623aefbc48ee326b2e4cbba270d6838 100644 (file)
@@ -1926,10 +1926,8 @@ __unclaimed_previous_reg_debug(struct intel_uncore *uncore,
 }
 
 static inline void
-unclaimed_reg_debug(struct intel_uncore *uncore,
-                   const i915_reg_t reg,
-                   const bool read,
-                   const bool before)
+unclaimed_reg_debug_header(struct intel_uncore *uncore,
+                          const i915_reg_t reg, const bool read)
 {
        if (likely(!uncore->i915->params.mmio_debug) || !uncore->debug)
                return;
@@ -1937,13 +1935,22 @@ unclaimed_reg_debug(struct intel_uncore *uncore,
        /* interrupts are disabled and re-enabled around uncore->lock usage */
        lockdep_assert_held(&uncore->lock);
 
-       if (before) {
-               spin_lock(&uncore->debug->lock);
-               __unclaimed_previous_reg_debug(uncore, reg, read);
-       } else {
-               __unclaimed_reg_debug(uncore, reg, read);
-               spin_unlock(&uncore->debug->lock);
-       }
+       spin_lock(&uncore->debug->lock);
+       __unclaimed_previous_reg_debug(uncore, reg, read);
+}
+
+static inline void
+unclaimed_reg_debug_footer(struct intel_uncore *uncore,
+                          const i915_reg_t reg, const bool read)
+{
+       if (likely(!uncore->i915->params.mmio_debug) || !uncore->debug)
+               return;
+
+       /* interrupts are disabled and re-enabled around uncore->lock usage */
+       lockdep_assert_held(&uncore->lock);
+
+       __unclaimed_reg_debug(uncore, reg, read);
+       spin_unlock(&uncore->debug->lock);
 }
 
 #define __vgpu_read(x) \
@@ -2004,10 +2011,10 @@ __gen2_read(64)
        u##x val = 0; \
        assert_rpm_wakelock_held(uncore->rpm); \
        spin_lock_irqsave(&uncore->lock, irqflags); \
-       unclaimed_reg_debug(uncore, reg, true, true)
+       unclaimed_reg_debug_header(uncore, reg, true)
 
 #define GEN6_READ_FOOTER \
-       unclaimed_reg_debug(uncore, reg, true, false); \
+       unclaimed_reg_debug_footer(uncore, reg, true); \
        spin_unlock_irqrestore(&uncore->lock, irqflags); \
        trace_i915_reg_rw(false, reg, val, sizeof(val), trace); \
        return val
@@ -2108,10 +2115,10 @@ __gen2_write(32)
        trace_i915_reg_rw(true, reg, val, sizeof(val), trace); \
        assert_rpm_wakelock_held(uncore->rpm); \
        spin_lock_irqsave(&uncore->lock, irqflags); \
-       unclaimed_reg_debug(uncore, reg, false, true)
+       unclaimed_reg_debug_header(uncore, reg, false)
 
 #define GEN6_WRITE_FOOTER \
-       unclaimed_reg_debug(uncore, reg, false, false); \
+       unclaimed_reg_debug_footer(uncore, reg, false); \
        spin_unlock_irqrestore(&uncore->lock, irqflags)
 
 #define __gen6_write(x) \