> -----Original Message----- > From: Jan Beulich <jbeul...@suse.com> > Sent: 12 November 2020 08:50 > To: Paul Durrant <p...@xen.org> > Cc: Paul Durrant <pdurr...@amazon.com>; Wei Liu <w...@xen.org>; Andrew Cooper > <andrew.coop...@citrix.com>; Roger Pau Monné <roger....@citrix.com>; > xen-devel@lists.xenproject.org > Subject: Re: [PATCH 04/10] viridian: use hypercall_vpmask in hvcall_ipi() > > On 11.11.2020 21:07, Paul Durrant wrote: > > --- a/xen/arch/x86/hvm/viridian/viridian.c > > +++ b/xen/arch/x86/hvm/viridian/viridian.c > > @@ -533,6 +533,21 @@ static bool vpmask_test(struct hypercall_vpmask > > *vpmask, unsigned int vp) > > return test_bit(vp, vpmask->mask); > > } > > > > +static unsigned int vpmask_first(struct hypercall_vpmask *vpmask) > > +{ > > + return find_first_bit(vpmask->mask, HVM_MAX_VCPUS); > > +} > > + > > +static unsigned int vpmask_next(struct hypercall_vpmask *vpmask, unsigned > > int vp) > > +{ > > + return find_next_bit(vpmask->mask, HVM_MAX_VCPUS, vp + 1); > > Perhaps again assert on vp's range? >
Ok. > > +} > > + > > +#define for_each_vp(vpmask, vp) \ > > + for ((vp) = vpmask_first(vpmask); \ > > + (vp) < HVM_MAX_VCPUS; \ > > + (vp) = vpmask_next(vpmask, vp)) > > Nit again: Missing blanks here and ... Oh yes. > > > @@ -669,17 +693,20 @@ static int hvcall_ipi(union hypercall_input *input, > > if ( vector < 0x10 || vector > 0xff ) > > return -EINVAL; > > > > - for_each_vcpu ( currd, v ) > > + vpmask_empty(vpmask); > > + for (vp = 0; vp < 64; vp++) > > ... here. I also wonder if the literal 64 couldn't be expressed in > some suitable way. > Ok. I'll see if I can suitably macrotize it. Paul > Jan