]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
KVM: arm64: Repack struct vgic_irq fields
authorMarc Zyngier <maz@kernel.org>
Thu, 20 Nov 2025 17:24:57 +0000 (17:24 +0000)
committerOliver Upton <oupton@kernel.org>
Mon, 24 Nov 2025 22:29:11 +0000 (14:29 -0800)
struct vgic_irq has grown over the years, in a rather bad way.
Repack it using bitfields so that the individual flags, and move
things around a bit so that it a bit smaller.

Tested-by: Fuad Tabba <tabba@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Tested-by: Mark Brown <broonie@kernel.org>
Link: https://msgid.link/20251120172540.2267180-8-maz@kernel.org
Signed-off-by: Oliver Upton <oupton@kernel.org>
arch/arm64/kvm/vgic/vgic-v4.c
include/kvm/arm_vgic.h

index 548aec9d5a7280dc58d69c3ac5b4b51e298d2ca3..09c3e9eb23f89c22f543d1bb3a5d4156a81b22db 100644 (file)
@@ -163,6 +163,7 @@ static void vgic_v4_disable_vsgis(struct kvm_vcpu *vcpu)
                struct vgic_irq *irq = vgic_get_vcpu_irq(vcpu, i);
                struct irq_desc *desc;
                unsigned long flags;
+               bool pending;
                int ret;
 
                raw_spin_lock_irqsave(&irq->irq_lock, flags);
@@ -173,9 +174,11 @@ static void vgic_v4_disable_vsgis(struct kvm_vcpu *vcpu)
                irq->hw = false;
                ret = irq_get_irqchip_state(irq->host_irq,
                                            IRQCHIP_STATE_PENDING,
-                                           &irq->pending_latch);
+                                           &pending);
                WARN_ON(ret);
 
+               irq->pending_latch = pending;
+
                desc = irq_to_desc(irq->host_irq);
                irq_domain_deactivate_irq(irq_desc_get_irq_data(desc));
        unlock:
index 577723f5599bdd4be1ee381429d8f3c49e056255..e84a1bc5cf172a095b3a28957c17b41111494cb7 100644 (file)
@@ -123,6 +123,7 @@ struct irq_ops {
 
 struct vgic_irq {
        raw_spinlock_t irq_lock;        /* Protects the content of the struct */
+       u32 intid;                      /* Guest visible INTID */
        struct rcu_head rcu;
        struct list_head ap_list;
 
@@ -137,17 +138,17 @@ struct vgic_irq {
                                         * affinity reg (v3).
                                         */
 
-       u32 intid;                      /* Guest visible INTID */
-       bool line_level;                /* Level only */
-       bool pending_latch;             /* The pending latch state used to calculate
-                                        * the pending state for both level
-                                        * and edge triggered IRQs. */
-       bool active;
-       bool pending_release;           /* Used for LPIs only, unreferenced IRQ
+       bool pending_release:1;         /* Used for LPIs only, unreferenced IRQ
                                         * pending a release */
 
-       bool enabled;
-       bool hw;                        /* Tied to HW IRQ */
+       bool pending_latch:1;           /* The pending latch state used to calculate
+                                        * the pending state for both level
+                                        * and edge triggered IRQs. */
+       enum vgic_irq_config config:1;  /* Level or edge */
+       bool line_level:1;              /* Level only */
+       bool enabled:1;
+       bool active:1;
+       bool hw:1;                      /* Tied to HW IRQ */
        refcount_t refcount;            /* Used for LPIs */
        u32 hwintid;                    /* HW INTID number */
        unsigned int host_irq;          /* linux irq corresponding to hwintid */
@@ -159,7 +160,6 @@ struct vgic_irq {
        u8 active_source;               /* GICv2 SGIs only */
        u8 priority;
        u8 group;                       /* 0 == group 0, 1 == group 1 */
-       enum vgic_irq_config config;    /* Level or edge */
 
        struct irq_ops *ops;