[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v9 2/7] xen/arm: fallback to vcpu 0 if get_target_vcpu handler not exists



From: Vijaya Kumar K <Vijaya.Kumar@xxxxxxxxxxxxxxxxxx>

if get_target_vcpu handler is not implemented. Fallback
to vcpu0 target.

This patch helps to be compatible with GICV3 driver which
does not implement this handler.

Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@xxxxxxxxxxxxxxxxxx>
---
 xen/arch/arm/vgic.c |   16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
index 6b41dbf..129b1b5 100644
--- a/xen/arch/arm/vgic.c
+++ b/xen/arch/arm/vgic.c
@@ -155,7 +155,11 @@ struct vcpu *vgic_get_target_vcpu(struct vcpu *v, unsigned 
int irq)
     unsigned long flags;
 
     vgic_lock_rank(v, rank, flags);
-    v_target = d->arch.vgic.handler->get_target_vcpu(v, irq);
+    if ( d->arch.vgic.handler->get_target_vcpu != NULL )
+        v_target = d->arch.vgic.handler->get_target_vcpu(v, irq);
+    else
+        v_target = d->vcpu[0];
+
     vgic_unlock_rank(v, rank, flags);
     return v_target;
 }
@@ -230,7 +234,10 @@ void vgic_disable_irqs(struct vcpu *v, uint32_t r, int n)
 
     while ( (i = find_next_bit(&mask, 32, i)) < 32 ) {
         irq = i + (32 * n);
-        v_target = d->arch.vgic.handler->get_target_vcpu(v, irq);
+        if ( d->arch.vgic.handler->get_target_vcpu != NULL )
+            v_target = d->arch.vgic.handler->get_target_vcpu(v, irq);
+        else
+            v_target = d->vcpu[0];
         p = irq_to_pending(v_target, irq);
         clear_bit(GIC_IRQ_GUEST_ENABLED, &p->status);
         gic_remove_from_queues(v_target, irq);
@@ -256,7 +263,10 @@ void vgic_enable_irqs(struct vcpu *v, uint32_t r, int n)
 
     while ( (i = find_next_bit(&mask, 32, i)) < 32 ) {
         irq = i + (32 * n);
-        v_target = d->arch.vgic.handler->get_target_vcpu(v, irq);
+        if ( d->arch.vgic.handler->get_target_vcpu != NULL )
+            v_target = d->arch.vgic.handler->get_target_vcpu(v, irq);
+        else
+            v_target = d->vcpu[0];
         p = irq_to_pending(v_target, irq);
         set_bit(GIC_IRQ_GUEST_ENABLED, &p->status);
         spin_lock_irqsave(&v_target->arch.vgic.lock, flags);
-- 
1.7.9.5


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.