mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
xen/arm: disable a physical IRQ when the guest disables the corresponding IRQ
In vgic_disable_irqs remove irqs from the lr_pending queue so that they won't get automatically injected in the guest on maintenance interrupts. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Julien Grall <julien.grall@linaro.org>
This commit is contained in:
1 parent
132f65cb41
commit
88eb95e3fb
3 files changed
+30
No files matched your search
@@ -649,6 +649,16 @@ static inline void gic_add_to_lr_pending(struct vcpu *v, unsigned int irq,
|
||||
list_add_tail(&n->lr_queue, &v->arch.vgic.lr_pending);
|
||||
}
|
||||
|
||||
void gic_remove_from_queues(struct vcpu *v, unsigned int virtual_irq)
|
||||
{
|
||||
struct pending_irq *p = irq_to_pending(v, virtual_irq);
|
||||
|
||||
spin_lock(&gic.lock);
|
||||
if ( !list_empty(&p->lr_queue) )
|
||||
list_del_init(&p->lr_queue);
|
||||
spin_unlock(&gic.lock);
|
||||
}
|
||||
|
||||
void gic_set_guest_irq(struct vcpu *v, unsigned int virtual_irq,
|
||||
unsigned int state, unsigned int priority)
|
||||
{
|
||||
|
||||
@@ -360,6 +360,23 @@ read_as_zero:
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void vgic_disable_irqs(struct vcpu *v, uint32_t r, int n)
|
||||
{
|
||||
struct pending_irq *p;
|
||||
unsigned int irq;
|
||||
int i = 0;
|
||||
|
||||
while ( (i = find_next_bit((const long unsigned int *) &r, 32, i)) < 32 ) {
|
||||
irq = i + (32 * n);
|
||||
p = irq_to_pending(v, irq);
|
||||
clear_bit(GIC_IRQ_GUEST_ENABLED, &p->status);
|
||||
gic_remove_from_queues(v, irq);
|
||||
if ( p->desc != NULL )
|
||||
p->desc->handler->disable(p->desc);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
static void vgic_enable_irqs(struct vcpu *v, uint32_t r, int n)
|
||||
{
|
||||
struct pending_irq *p;
|
||||
@@ -490,8 +507,10 @@ static int vgic_distr_mmio_write(struct vcpu *v, mmio_info_t *info)
|
||||
rank = vgic_irq_rank(v, 1, gicd_reg - GICD_ICENABLER);
|
||||
if ( rank == NULL) goto write_ignore;
|
||||
vgic_lock_rank(v, rank);
|
||||
tr = rank->ienable;
|
||||
rank->ienable &= ~*r;
|
||||
vgic_unlock_rank(v, rank);
|
||||
vgic_disable_irqs(v, (*r) & tr, gicd_reg - GICD_ICENABLER);
|
||||
return 1;
|
||||
|
||||
case GICD_ISPENDR ... GICD_ISPENDRN:
|
||||
|
||||
@@ -158,6 +158,7 @@ extern int gic_events_need_delivery(void);
|
||||
extern void __cpuinit init_maintenance_interrupt(void);
|
||||
extern void gic_set_guest_irq(struct vcpu *v, unsigned int irq,
|
||||
unsigned int state, unsigned int priority);
|
||||
extern void gic_remove_from_queues(struct vcpu *v, unsigned int virtual_irq);
|
||||
extern int gic_route_irq_to_guest(struct domain *d,
|
||||
const struct dt_irq *irq,
|
||||
const char * devname);
|
||||
|
||||