|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v5 04/14] xen/arm: support for guest SGI
On Thu, 2 May 2013, Julien Grall wrote:
> On 04/30/2013 06:03 PM, Stefano Stabellini wrote:
>
> > Trap writes to GICD_SGIR, parse the requests, inject SGIs into the right
> > guest vcpu.
> >
> > Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
> >
> > Changes in v5:
> > - assert virtual_irq < 16;
> > - align GICD defines;
> > - test for _VPF_down in pause_flags before adding a vcpu to the mask.
> >
> > Changes in v4:
> > - move the code to a separate function;
> > - use gdprintk for debugging output;
> > - make use of PRIregister;
> > - replace the cpumask with a bitmask;
> > - move the virtual_irq check outside the loop;
> > - ignore non-existent target vcpus.
> >
> > Changes in v3:
> > - make use of cpumask_from_bitmap.
> > ---
> > xen/arch/arm/vgic.c | 72
> > ++++++++++++++++++++++++++++++++++++++++++--
> > xen/include/asm-arm/gic.h | 15 +++++----
> > 2 files changed, 77 insertions(+), 10 deletions(-)
> >
> > diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
> > index b30da78..34c08c5 100644
> > --- a/xen/arch/arm/vgic.c
> > +++ b/xen/arch/arm/vgic.c
> > @@ -17,6 +17,7 @@
> > * GNU General Public License for more details.
> > */
> >
> > +#include <xen/bitops.h>
> > #include <xen/config.h>
> > #include <xen/lib.h>
> > #include <xen/init.h>
> > @@ -368,6 +369,70 @@ static void vgic_enable_irqs(struct vcpu *v, uint32_t
> > r, int n)
> > }
> > }
> >
> > +static inline int is_vcpu_running(struct domain *d, int vcpuid)
> > +{
> > + struct vcpu *v;
> > +
> > + if ( vcpuid >= d->max_vcpus )
> > + return 0;
> > +
> > + v = d->vcpu[vcpuid];
> > + if ( v == NULL )
> > + return 0;
> > + if (test_bit(_VPF_down, &v->pause_flags) )
> > + return 0;
> > +
> > + return 1;
> > +}
> > +
> > +static int vgic_to_sgi(struct vcpu *v, register_t sgir)
> > +{
> > + struct domain *d = v->domain;
> > + int virtual_irq;
> > + int filter;
> > + int vcpuid;
> > + int i;
> > + unsigned long vcpu_mask = 0;
> > +
> > + ASSERT(d->max_vcpus < 8*sizeof(vcpu_mask));
> > +
> > + filter = (sgir & GICD_SGI_TARGET_LIST_MASK);
> > + virtual_irq = (sgir & GICD_SGI_INTID_MASK);
> > + ASSERT( virtual_irq < 16 );
> > +
> > + switch ( filter )
> > + {
> > + case GICD_SGI_TARGET_LIST:
> > + vcpu_mask = (sgir & GICD_SGI_TARGET_MASK) >>
> > GICD_SGI_TARGET_SHIFT;
> > + break;
> > + case GICD_SGI_TARGET_OTHERS:
> > + for ( i = 0; i < d->max_vcpus; i++ )
> > + {
> > + if ( i != current->vcpu_id && is_vcpu_running(d, i) )
> > + set_bit(i, &vcpu_mask);
> > + }
>
>
> I think a break; is missing here.
Damn, you are right! Good catch!!
I'll resend with the fix.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |