drm/i915: handle uncore spinlock when not available
authorLuca Coelho <luciano.coelho@intel.com>
Fri, 1 Dec 2023 10:00:32 +0000 (12:00 +0200)
committerJouni Högander <jouni.hogander@intel.com>
Thu, 7 Dec 2023 10:07:58 +0000 (12:07 +0200)
commitdcdf1bbe82f4b2a301a3692a0b1942c3fda70644
tree421880bd20562ea3ad9ee41085eba1abbc8551cf
parent01a39f1c4f1220a4e6a25729fae87ff5794cbc52
drm/i915: handle uncore spinlock when not available

The uncore code may not always be available (e.g. when we build the
display code with Xe), so we can't always rely on having the uncore's
spinlock.

To handle this, split the spin_lock/unlock_irqsave/restore() into
spin_lock/unlock() followed by a call to local_irq_save/restore() and
create wrapper functions for locking and unlocking the uncore's
spinlock.  In these functions, we have a condition check and only
actually try to lock/unlock the spinlock when I915 is defined, and
thus uncore is available.

This keeps the ifdefs contained in these new functions and all such
logic inside the display code.

Cc: Tvrtko Ursulin <tvrto.ursulin@intel.com>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231201100032.1367589-1-luciano.coelho@intel.com
drivers/gpu/drm/i915/display/intel_vblank.c