Skip to content

Commit 7afe234

Browse files
committed
drm/i915/uncore: split unclaimed_reg_debug() to header and footer
Make it easier to have different logic for the two for follow-up. Cc: Lee Shawn C <[email protected]> Reviewed-by: Tvrtko Ursulin <[email protected]> Signed-off-by: Jani Nikula <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/8a0a93f08314f8d7e222a907d9aa5e0b89cb969e.1690886109.git.jani.nikula@intel.com
1 parent ddd33ff commit 7afe234

File tree

1 file changed

+22
-15
lines changed

1 file changed

+22
-15
lines changed

drivers/gpu/drm/i915/intel_uncore.c

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1926,24 +1926,31 @@ __unclaimed_previous_reg_debug(struct intel_uncore *uncore,
19261926
}
19271927

19281928
static inline void
1929-
unclaimed_reg_debug(struct intel_uncore *uncore,
1930-
const i915_reg_t reg,
1931-
const bool read,
1932-
const bool before)
1929+
unclaimed_reg_debug_header(struct intel_uncore *uncore,
1930+
const i915_reg_t reg, const bool read)
19331931
{
19341932
if (likely(!uncore->i915->params.mmio_debug) || !uncore->debug)
19351933
return;
19361934

19371935
/* interrupts are disabled and re-enabled around uncore->lock usage */
19381936
lockdep_assert_held(&uncore->lock);
19391937

1940-
if (before) {
1941-
spin_lock(&uncore->debug->lock);
1942-
__unclaimed_previous_reg_debug(uncore, reg, read);
1943-
} else {
1944-
__unclaimed_reg_debug(uncore, reg, read);
1945-
spin_unlock(&uncore->debug->lock);
1946-
}
1938+
spin_lock(&uncore->debug->lock);
1939+
__unclaimed_previous_reg_debug(uncore, reg, read);
1940+
}
1941+
1942+
static inline void
1943+
unclaimed_reg_debug_footer(struct intel_uncore *uncore,
1944+
const i915_reg_t reg, const bool read)
1945+
{
1946+
if (likely(!uncore->i915->params.mmio_debug) || !uncore->debug)
1947+
return;
1948+
1949+
/* interrupts are disabled and re-enabled around uncore->lock usage */
1950+
lockdep_assert_held(&uncore->lock);
1951+
1952+
__unclaimed_reg_debug(uncore, reg, read);
1953+
spin_unlock(&uncore->debug->lock);
19471954
}
19481955

19491956
#define __vgpu_read(x) \
@@ -2004,10 +2011,10 @@ __gen2_read(64)
20042011
u##x val = 0; \
20052012
assert_rpm_wakelock_held(uncore->rpm); \
20062013
spin_lock_irqsave(&uncore->lock, irqflags); \
2007-
unclaimed_reg_debug(uncore, reg, true, true)
2014+
unclaimed_reg_debug_header(uncore, reg, true)
20082015

20092016
#define GEN6_READ_FOOTER \
2010-
unclaimed_reg_debug(uncore, reg, true, false); \
2017+
unclaimed_reg_debug_footer(uncore, reg, true); \
20112018
spin_unlock_irqrestore(&uncore->lock, irqflags); \
20122019
trace_i915_reg_rw(false, reg, val, sizeof(val), trace); \
20132020
return val
@@ -2108,10 +2115,10 @@ __gen2_write(32)
21082115
trace_i915_reg_rw(true, reg, val, sizeof(val), trace); \
21092116
assert_rpm_wakelock_held(uncore->rpm); \
21102117
spin_lock_irqsave(&uncore->lock, irqflags); \
2111-
unclaimed_reg_debug(uncore, reg, false, true)
2118+
unclaimed_reg_debug_header(uncore, reg, false)
21122119

21132120
#define GEN6_WRITE_FOOTER \
2114-
unclaimed_reg_debug(uncore, reg, false, false); \
2121+
unclaimed_reg_debug_footer(uncore, reg, false); \
21152122
spin_unlock_irqrestore(&uncore->lock, irqflags)
21162123

21172124
#define __gen6_write(x) \

0 commit comments

Comments
 (0)