Skip to content

Commit 0f2ab6a

Browse files
committed
drm/i915/irq: move i915->irq_lock to display->irq.lock
Observe that i915->irq_lock is no longer used to protect anything outside of display. Make it a display thing. This allows us to remove the ugly #define irq_lock irq.lock hack from xe compat header. Note that this is slightly more subtle than it first looks. For i915, there's no functional change here. The lock is moved. However, for xe, we'll now have *two* locks, xe->irq.lock and display->irq.lock. These should protect different things, though. Indeed, nesting in the past would've lead to a deadlock because they were the same lock. With the i915 references gone, we can make a handful more files independent of i915_drv.h. Reviewed-by: Gustavo Sousa <[email protected]> Link: https://lore.kernel.org/r/6d8d2ce0f34a9c7361a5e2fcf96bb32a34c57e76.1746536745.git.jani.nikula@intel.com [Jani: Fixed a comment while applying.] Signed-off-by: Jani Nikula <[email protected]>
1 parent 9536d60 commit 0f2ab6a

15 files changed

+169
-259
lines changed

drivers/gpu/drm/i915/display/i9xx_plane.c

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
#include <drm/drm_atomic_helper.h>
88
#include <drm/drm_blend.h>
99
#include <drm/drm_fourcc.h>
10+
#include <drm/drm_print.h>
1011

11-
#include "i915_drv.h"
1212
#include "i915_reg.h"
13+
#include "i915_utils.h"
1314
#include "i9xx_plane.h"
1415
#include "i9xx_plane_regs.h"
1516
#include "intel_atomic.h"
@@ -631,92 +632,84 @@ static void
631632
bdw_primary_enable_flip_done(struct intel_plane *plane)
632633
{
633634
struct intel_display *display = to_intel_display(plane);
634-
struct drm_i915_private *i915 = to_i915(plane->base.dev);
635635
enum pipe pipe = plane->pipe;
636636

637-
spin_lock_irq(&i915->irq_lock);
637+
spin_lock_irq(&display->irq.lock);
638638
bdw_enable_pipe_irq(display, pipe, GEN8_PIPE_PRIMARY_FLIP_DONE);
639-
spin_unlock_irq(&i915->irq_lock);
639+
spin_unlock_irq(&display->irq.lock);
640640
}
641641

642642
static void
643643
bdw_primary_disable_flip_done(struct intel_plane *plane)
644644
{
645645
struct intel_display *display = to_intel_display(plane);
646-
struct drm_i915_private *i915 = to_i915(plane->base.dev);
647646
enum pipe pipe = plane->pipe;
648647

649-
spin_lock_irq(&i915->irq_lock);
648+
spin_lock_irq(&display->irq.lock);
650649
bdw_disable_pipe_irq(display, pipe, GEN8_PIPE_PRIMARY_FLIP_DONE);
651-
spin_unlock_irq(&i915->irq_lock);
650+
spin_unlock_irq(&display->irq.lock);
652651
}
653652

654653
static void
655654
ivb_primary_enable_flip_done(struct intel_plane *plane)
656655
{
657656
struct intel_display *display = to_intel_display(plane);
658-
struct drm_i915_private *i915 = to_i915(plane->base.dev);
659657

660-
spin_lock_irq(&i915->irq_lock);
658+
spin_lock_irq(&display->irq.lock);
661659
ilk_enable_display_irq(display, DE_PLANE_FLIP_DONE_IVB(plane->i9xx_plane));
662-
spin_unlock_irq(&i915->irq_lock);
660+
spin_unlock_irq(&display->irq.lock);
663661
}
664662

665663
static void
666664
ivb_primary_disable_flip_done(struct intel_plane *plane)
667665
{
668666
struct intel_display *display = to_intel_display(plane);
669-
struct drm_i915_private *i915 = to_i915(plane->base.dev);
670667

671-
spin_lock_irq(&i915->irq_lock);
668+
spin_lock_irq(&display->irq.lock);
672669
ilk_disable_display_irq(display, DE_PLANE_FLIP_DONE_IVB(plane->i9xx_plane));
673-
spin_unlock_irq(&i915->irq_lock);
670+
spin_unlock_irq(&display->irq.lock);
674671
}
675672

676673
static void
677674
ilk_primary_enable_flip_done(struct intel_plane *plane)
678675
{
679676
struct intel_display *display = to_intel_display(plane);
680-
struct drm_i915_private *i915 = to_i915(plane->base.dev);
681677

682-
spin_lock_irq(&i915->irq_lock);
678+
spin_lock_irq(&display->irq.lock);
683679
ilk_enable_display_irq(display, DE_PLANE_FLIP_DONE(plane->i9xx_plane));
684-
spin_unlock_irq(&i915->irq_lock);
680+
spin_unlock_irq(&display->irq.lock);
685681
}
686682

687683
static void
688684
ilk_primary_disable_flip_done(struct intel_plane *plane)
689685
{
690686
struct intel_display *display = to_intel_display(plane);
691-
struct drm_i915_private *i915 = to_i915(plane->base.dev);
692687

693-
spin_lock_irq(&i915->irq_lock);
688+
spin_lock_irq(&display->irq.lock);
694689
ilk_disable_display_irq(display, DE_PLANE_FLIP_DONE(plane->i9xx_plane));
695-
spin_unlock_irq(&i915->irq_lock);
690+
spin_unlock_irq(&display->irq.lock);
696691
}
697692

698693
static void
699694
vlv_primary_enable_flip_done(struct intel_plane *plane)
700695
{
701696
struct intel_display *display = to_intel_display(plane);
702-
struct drm_i915_private *i915 = to_i915(plane->base.dev);
703697
enum pipe pipe = plane->pipe;
704698

705-
spin_lock_irq(&i915->irq_lock);
699+
spin_lock_irq(&display->irq.lock);
706700
i915_enable_pipestat(display, pipe, PLANE_FLIP_DONE_INT_STATUS_VLV);
707-
spin_unlock_irq(&i915->irq_lock);
701+
spin_unlock_irq(&display->irq.lock);
708702
}
709703

710704
static void
711705
vlv_primary_disable_flip_done(struct intel_plane *plane)
712706
{
713707
struct intel_display *display = to_intel_display(plane);
714-
struct drm_i915_private *i915 = to_i915(plane->base.dev);
715708
enum pipe pipe = plane->pipe;
716709

717-
spin_lock_irq(&i915->irq_lock);
710+
spin_lock_irq(&display->irq.lock);
718711
i915_disable_pipestat(display, pipe, PLANE_FLIP_DONE_INT_STATUS_VLV);
719-
spin_unlock_irq(&i915->irq_lock);
712+
spin_unlock_irq(&display->irq.lock);
720713
}
721714

722715
static bool i9xx_plane_can_async_flip(u64 modifier)

drivers/gpu/drm/i915/display/intel_display_core.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ struct intel_hotplug {
179179

180180
/*
181181
* Queuing of hotplug_work, reenable_work and poll_init_work is
182-
* enabled. Protected by drm_i915_private::irq_lock.
182+
* enabled. Protected by intel_display::irq::lock.
183183
*/
184184
bool detection_work_enabled;
185185

@@ -456,6 +456,9 @@ struct intel_display {
456456
} ips;
457457

458458
struct {
459+
/* protects the irq masks */
460+
spinlock_t lock;
461+
459462
/*
460463
* Most platforms treat the display irq block as an always-on
461464
* power domain. vlv/chv can disable it at runtime and need

0 commit comments

Comments
 (0)