[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [RFC PATCH v2 04/22] ARM: vGIC: rename pending_irq->priority to cur_priority
In preparation for storing the virtual interrupt priority in the struct pending_irq, rename the existing "priority" member to "cur_priority". This is to signify that this is the current priority of an interrupt which has been injected to a VCPU. Once this happened, its priority must stay fixed at this value, subsequenct MMIO accesses to change the priority can only affect newly triggered interrupts. Also since the priority is a sorting criteria for the inflight list, it must not change when it's on a VCPUs list. Signed-off-by: Andre Przywara <andre.przywara@xxxxxxx> --- xen/arch/arm/gic-v2.c | 2 +- xen/arch/arm/gic-v3.c | 2 +- xen/arch/arm/gic.c | 10 +++++----- xen/arch/arm/vgic.c | 6 +++--- xen/include/asm-arm/vgic.h | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/xen/arch/arm/gic-v2.c b/xen/arch/arm/gic-v2.c index cbe71a9..735e23d 100644 --- a/xen/arch/arm/gic-v2.c +++ b/xen/arch/arm/gic-v2.c @@ -437,7 +437,7 @@ static void gicv2_update_lr(int lr, const struct pending_irq *p, BUG_ON(lr < 0); lr_reg = (((state & GICH_V2_LR_STATE_MASK) << GICH_V2_LR_STATE_SHIFT) | - ((GIC_PRI_TO_GUEST(p->priority) & GICH_V2_LR_PRIORITY_MASK) + ((GIC_PRI_TO_GUEST(p->cur_priority) & GICH_V2_LR_PRIORITY_MASK) << GICH_V2_LR_PRIORITY_SHIFT) | ((p->irq & GICH_V2_LR_VIRTUAL_MASK) << GICH_V2_LR_VIRTUAL_SHIFT)); diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c index f990eae..449bd55 100644 --- a/xen/arch/arm/gic-v3.c +++ b/xen/arch/arm/gic-v3.c @@ -961,7 +961,7 @@ static void gicv3_update_lr(int lr, const struct pending_irq *p, if ( current->domain->arch.vgic.version == GIC_V3 ) val |= GICH_LR_GRP1; - val |= ((uint64_t)p->priority & 0xff) << GICH_LR_PRIORITY_SHIFT; + val |= ((uint64_t)p->cur_priority & 0xff) << GICH_LR_PRIORITY_SHIFT; val |= ((uint64_t)p->irq & GICH_LR_VIRTUAL_MASK) << GICH_LR_VIRTUAL_SHIFT; if ( p->desc != NULL ) diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c index 5bd66a2..8dec736 100644 --- a/xen/arch/arm/gic.c +++ b/xen/arch/arm/gic.c @@ -389,7 +389,7 @@ static inline void gic_add_to_lr_pending(struct vcpu *v, struct pending_irq *n) list_for_each_entry ( iter, &v->arch.vgic.lr_pending, lr_queue ) { - if ( iter->priority > n->priority ) + if ( iter->cur_priority > n->cur_priority ) { list_add_tail(&n->lr_queue, &iter->lr_queue); return; @@ -542,7 +542,7 @@ void gic_update_one_lr(struct vcpu *v, int i) if ( test_bit(GIC_IRQ_GUEST_ENABLED, &p->status) && test_bit(GIC_IRQ_GUEST_QUEUED, &p->status) && !test_bit(GIC_IRQ_GUEST_MIGRATING, &p->status) ) - gic_raise_guest_irq(v, irq, p->priority); + gic_raise_guest_irq(v, irq, p->cur_priority); else { list_del_init(&p->inflight); /* @@ -610,7 +610,7 @@ static void gic_restore_pending_irqs(struct vcpu *v) /* No more free LRs: find a lower priority irq to evict */ list_for_each_entry_reverse( p_r, inflight_r, inflight ) { - if ( p_r->priority == p->priority ) + if ( p_r->cur_priority == p->cur_priority ) goto out; if ( test_bit(GIC_IRQ_GUEST_VISIBLE, &p_r->status) && !test_bit(GIC_IRQ_GUEST_ACTIVE, &p_r->status) ) @@ -676,9 +676,9 @@ int gic_events_need_delivery(void) * ordered by priority */ list_for_each_entry( p, &v->arch.vgic.inflight_irqs, inflight ) { - if ( GIC_PRI_TO_GUEST(p->priority) >= mask_priority ) + if ( GIC_PRI_TO_GUEST(p->cur_priority) >= mask_priority ) goto out; - if ( GIC_PRI_TO_GUEST(p->priority) >= active_priority ) + if ( GIC_PRI_TO_GUEST(p->cur_priority) >= active_priority ) goto out; if ( test_bit(GIC_IRQ_GUEST_ENABLED, &p->status) ) { diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c index 7b122cd..21b545e 100644 --- a/xen/arch/arm/vgic.c +++ b/xen/arch/arm/vgic.c @@ -395,7 +395,7 @@ void vgic_enable_irqs(struct vcpu *v, uint32_t r, int n) p = irq_to_pending(v_target, irq); set_bit(GIC_IRQ_GUEST_ENABLED, &p->status); if ( !list_empty(&p->inflight) && !test_bit(GIC_IRQ_GUEST_VISIBLE, &p->status) ) - gic_raise_guest_irq(v_target, irq, p->priority); + gic_raise_guest_irq(v_target, irq, p->cur_priority); spin_unlock_irqrestore(&v_target->arch.vgic.lock, flags); if ( p->desc != NULL ) { @@ -550,7 +550,7 @@ void vgic_vcpu_inject_irq(struct vcpu *v, unsigned int virq) } priority = vgic_get_virq_priority(v, virq); - n->priority = priority; + n->cur_priority = priority; /* the irq is enabled */ if ( test_bit(GIC_IRQ_GUEST_ENABLED, &n->status) ) @@ -558,7 +558,7 @@ void vgic_vcpu_inject_irq(struct vcpu *v, unsigned int virq) list_for_each_entry ( iter, &v->arch.vgic.inflight_irqs, inflight ) { - if ( iter->priority > priority ) + if ( iter->cur_priority > priority ) { list_add_tail(&n->inflight, &iter->inflight); goto out; diff --git a/xen/include/asm-arm/vgic.h b/xen/include/asm-arm/vgic.h index 1c38b9a..0df4ac7 100644 --- a/xen/include/asm-arm/vgic.h +++ b/xen/include/asm-arm/vgic.h @@ -78,7 +78,7 @@ struct pending_irq unsigned int irq; #define GIC_INVALID_LR (uint8_t)~0 uint8_t lr; - uint8_t priority; + uint8_t cur_priority; /* Holds the priority of an injected IRQ. */ uint8_t lpi_priority; /* Caches the priority if this is an LPI. */ uint8_t lpi_vcpu_id; /* The VCPU for an LPI. */ /* inflight is used to append instances of pending_irq to -- 2.9.0 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |