|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [XEN PATCH v3 07/11] xen: arm: vgic: allow delivery of PPIs to guests
Allow vgic_get_hw_irq_desc to be called with a vcpu argument.
Use vcpu argument in vgic_connect_hw_irq.
vgic_connect_hw_irq is called for PPIs and SPIs, not SGIs. Enforce with
ASSERTs.
Signed-off-by: Stewart Hildebrand <stewart.hildebrand@xxxxxxxxxxxxxxx>
---
v3: new patch
---
Note: I have only modified the old vgic to allow delivery of PPIs.
---
xen/arch/arm/gic-vgic.c | 24 ++++++++++++++++--------
xen/arch/arm/vgic.c | 6 +++---
2 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/xen/arch/arm/gic-vgic.c b/xen/arch/arm/gic-vgic.c
index 98c021f1a8..2c66a8fa92 100644
--- a/xen/arch/arm/gic-vgic.c
+++ b/xen/arch/arm/gic-vgic.c
@@ -418,7 +418,7 @@ struct irq_desc *vgic_get_hw_irq_desc(struct domain *d,
struct vcpu *v,
{
struct pending_irq *p;
- ASSERT(!v && virq >= 32);
+ ASSERT((!v && (virq >= 32)) || (!d && v && (virq >= 16) && (virq < 32)));
if ( !v )
v = d->vcpu[0];
@@ -434,15 +434,23 @@ int vgic_connect_hw_irq(struct domain *d, struct vcpu *v,
unsigned int virq,
struct irq_desc *desc, bool connect)
{
unsigned long flags;
- /*
- * Use vcpu0 to retrieve the pending_irq struct. Given that we only
- * route SPIs to guests, it doesn't make any difference.
- */
- struct vcpu *v_target = vgic_get_target_vcpu(d->vcpu[0], virq);
- struct vgic_irq_rank *rank = vgic_rank_irq(v_target, virq);
- struct pending_irq *p = irq_to_pending(v_target, virq);
+ struct vcpu *v_target;
+ struct vgic_irq_rank *rank;
+ struct pending_irq *p;
int ret = 0;
+ if (v)
+ v_target = v;
+ else
+ /* Use vcpu0 to retrieve the pending_irq struct. */
+ v_target = vgic_get_target_vcpu(d->vcpu[0], virq);
+
+ rank = vgic_rank_irq(v_target, virq);
+ p = irq_to_pending(v_target, virq);
+
+ ASSERT(virq >= NR_SGIS);
+ ASSERT(p->irq >= NR_SGIS);
+
/* "desc" is optional when we disconnect an IRQ. */
ASSERT(!connect || desc);
diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
index 82f524a35c..c3933c2687 100644
--- a/xen/arch/arm/vgic.c
+++ b/xen/arch/arm/vgic.c
@@ -410,10 +410,10 @@ void vgic_enable_irqs(struct vcpu *v, uint32_t r, int n)
irq_set_affinity(p->desc, cpumask_of(v_target->processor));
spin_lock_irqsave(&p->desc->lock, flags);
/*
- * The irq cannot be a PPI, we only support delivery of SPIs
- * to guests.
+ * The irq cannot be a SGI, we only support delivery of SPIs
+ * and PPIs to guests.
*/
- ASSERT(irq >= 32);
+ ASSERT(irq >= NR_SGIS);
if ( irq_type_set_by_domain(d) )
gic_set_irq_type(p->desc, vgic_get_virq_type(v, n, i));
p->desc->handler->enable(p->desc);
--
2.24.0
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |