Message ID | 1461340713-9587-2-git-send-email-julien.grall@arm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
>>> On 22.04.16 at 17:58, <julien.grall@arm.com> wrote: > The code has been imported from the header include/linux/bitops.h in > Linux v4.6-rc3. > > Signed-off-by: Julien Grall <julien.grall@arm.com> > Acked-by: Stefano Stabellini <sstabellini@kernel.org> And just to double check - Stefano, this ack was meant also as a REST maintainer, not just an ARM one (as the latter was the context it was originally given in)? Jan
On Fri, 22 Apr 2016, Jan Beulich wrote: > >>> On 22.04.16 at 17:58, <julien.grall@arm.com> wrote: > > The code has been imported from the header include/linux/bitops.h in > > Linux v4.6-rc3. > > > > Signed-off-by: Julien Grall <julien.grall@arm.com> > > Acked-by: Stefano Stabellini <sstabellini@kernel.org> > > And just to double check - Stefano, this ack was meant also as a > REST maintainer, not just an ARM one (as the latter was the > context it was originally given in)? Yeah, the macro is OK for me. It is just a macro - we don't have to introduce it if you dislike it, we could simply explode it in xen/include/asm-arm/processor.h. On the other hand, if you don't have an opinion about it, I would go ahead with this patch. I am happy either way.
Jan Beulich writes ("Re: [for-4.7 v2 1/2] xen/bitops: Introduce GENMASK to generate mask"): > On 22.04.16 at 17:58, <julien.grall@arm.com> wrote: > > The code has been imported from the header include/linux/bitops.h in > > Linux v4.6-rc3. > > > > Signed-off-by: Julien Grall <julien.grall@arm.com> > > Acked-by: Stefano Stabellini <sstabellini@kernel.org> > > And just to double check - Stefano, this ack was meant also as a > REST maintainer, not just an ARM one (as the latter was the > context it was originally given in)? For what it's worth, on the matter of taste I agree with Julien. Having read the occasional ARM manual, the proposed macro will make it much easier to check that the code matches the book. Ian.
diff --git a/xen/include/xen/bitops.h b/xen/include/xen/bitops.h index cb56f24..bd0883a 100644 --- a/xen/include/xen/bitops.h +++ b/xen/include/xen/bitops.h @@ -3,6 +3,14 @@ #include <asm/types.h> /* + * Create a contiguous bitmask starting at bit position @l and ending at + * position @h. For example + * GENMASK(30, 21) gives us the 32bit vector 0x01fe00000. + */ +#define GENMASK(h, l) \ + (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h)))) + +/* * ffs: find first bit set. This is defined the same way as * the libc and compiler builtin ffs routines, therefore * differs in spirit from the above ffz (man ffs).