|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 5/6] xen/arm: Only enable physical IRQs when the guest asks
From: Julien Grall <julien.grall@xxxxxxxxxx>
From: Julien Grall <julien.grall@xxxxxxxxxx>
Set/Unset IRQ_DISABLED from gic_irq_enable and gic_irq_disable.
Enable IRQs when the guest requests it, not unconditionally at boot time.
Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Signed-off-by: Julien Grall <julien.grall@xxxxxxxxxx>
---
xen/arch/arm/gic.c | 13 +++++++++----
xen/arch/arm/vgic.c | 6 ++----
2 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
index 5ec3ff9..72f978d 100644
--- a/xen/arch/arm/gic.c
+++ b/xen/arch/arm/gic.c
@@ -137,6 +137,7 @@ static void gic_irq_enable(struct irq_desc *desc)
/* Enable routing */
enabler = GICD[GICD_ISENABLER + irq / 32];
GICD[GICD_ISENABLER + irq / 32] = enabler | (1u << (irq % 32));
+ desc->status &= ~IRQ_DISABLED;
}
static void gic_irq_disable(struct irq_desc *desc)
@@ -145,6 +146,7 @@ static void gic_irq_disable(struct irq_desc *desc)
/* Disable routing */
GICD[GICD_ICENABLER + irq / 32] = (1u << (irq % 32));
+ desc->status |= IRQ_DISABLED;
}
static unsigned int gic_irq_startup(struct irq_desc *desc)
@@ -562,7 +564,6 @@ void __init release_irq(unsigned int irq)
spin_lock_irqsave(&desc->lock,flags);
action = desc->action;
desc->action = NULL;
- desc->status |= IRQ_DISABLED;
desc->status &= ~IRQ_GUEST;
spin_lock(&gic.lock);
@@ -585,11 +586,8 @@ static int __setup_irq(struct irq_desc *desc, unsigned int
irq,
return -EBUSY;
desc->action = new;
- desc->status &= ~IRQ_DISABLED;
dsb();
- desc->handler->startup(desc);
-
return 0;
}
@@ -605,6 +603,8 @@ int __init setup_dt_irq(const struct dt_irq *irq, struct
irqaction *new)
rc = __setup_irq(desc, irq->irq, new);
+ desc->handler->startup(desc);
+
spin_unlock_irqrestore(&desc->lock, flags);
return rc;
@@ -743,6 +743,7 @@ int gic_route_irq_to_guest(struct domain *d, const struct
dt_irq *irq,
unsigned long flags;
int retval;
bool_t level;
+ struct pending_irq *p;
action = xmalloc(struct irqaction);
if (!action)
@@ -769,6 +770,10 @@ int gic_route_irq_to_guest(struct domain *d, const struct
dt_irq *irq,
goto out;
}
+ /* do not assume delivery to vcpu0 */
+ p = irq_to_pending(d->vcpu[0], irq->irq);
+ p->desc = desc;
+
out:
spin_unlock(&gic.lock);
spin_unlock_irqrestore(&desc->lock, flags);
diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
index 969ad2d..5b533ea 100644
--- a/xen/arch/arm/vgic.c
+++ b/xen/arch/arm/vgic.c
@@ -374,6 +374,8 @@ static void vgic_enable_irqs(struct vcpu *v, uint32_t r,
int n)
p = irq_to_pending(v, irq);
if ( !list_empty(&p->inflight) && !(p->status & GIC_IRQ_GUEST_VISIBLE)
)
gic_set_guest_irq(v, irq, GICH_LR_PENDING, p->priority);
+ if ( p->desc != NULL && (p->desc->status & IRQ_DISABLED) )
+ p->desc->handler->enable(p->desc);
i++;
}
@@ -696,10 +698,6 @@ void vgic_vcpu_inject_irq(struct vcpu *v, unsigned int
irq, int virtual)
n->irq = irq;
n->status = GIC_IRQ_GUEST_PENDING;
n->priority = priority;
- if (!virtual)
- n->desc = irq_to_desc(irq);
- else
- n->desc = NULL;
/* the irq is enabled */
if ( rank->ienable & (1 << (irq % 32)) )
--
1.7.10.4
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |