Message ID | 20170809082038.3236-8-proskurin@sec.in.tum.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi all, On 08/09/2017 10:20 AM, Sergej Proskurin wrote: > The current implementation of GENMASK is capable of creating bitmasks of > 32-bit values on AArch32 and 64-bit values on AArch64. As we need to > create masks for 64-bit values on AArch32 as well, in this commit we > introduce the GENMASK_ULL bit operation. Please note that the > GENMASK_ULL implementation has been lifted from the linux kernel source > code. > As all other patches of this patch series have been Acked, I would like to friendly remind "The REST" maintainers to provide me with your opinion/review on this particular patch. Thank you very much in advance :) > Signed-off-by: Sergej Proskurin <proskurin@sec.in.tum.de> > --- > Cc: Andrew Cooper <andrew.cooper3@citrix.com> > Cc: George Dunlap <George.Dunlap@eu.citrix.com> > Cc: Ian Jackson <ian.jackson@eu.citrix.com> > Cc: Jan Beulich <jbeulich@suse.com> > Cc: Julien Grall <julien.grall@arm.com> > Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> > Cc: Stefano Stabellini <sstabellini@kernel.org> > Cc: Tim Deegan <tim@xen.org> > Cc: Wei Liu <wei.liu2@citrix.com> > --- > v6: As similar patches have been already submitted and NACKED in the > past, we resubmit this patch with 'THE REST' maintainers in Cc to > discuss whether this patch shall be applied into common or put into > ARM related code. > > v7: Change the introduced macro BITS_PER_LONG_LONG to BITS_PER_LLONG. > > Define BITS_PER_LLONG also in asm-x86/config.h in order to allow > global usage of the introduced macro GENMASK_ULL. > > Remove previously unintended whitespace elimination in the function > get_bitmask_order as it is not the right patch to address cleanup. > --- > xen/include/asm-arm/config.h | 2 ++ > xen/include/asm-x86/config.h | 2 ++ > xen/include/xen/bitops.h | 3 +++ > 3 files changed, 7 insertions(+) > > diff --git a/xen/include/asm-arm/config.h b/xen/include/asm-arm/config.h > index 5b6f3c985d..7da94698e1 100644 > --- a/xen/include/asm-arm/config.h > +++ b/xen/include/asm-arm/config.h > @@ -19,6 +19,8 @@ > #define BITS_PER_LONG (BYTES_PER_LONG << 3) > #define POINTER_ALIGN BYTES_PER_LONG > > +#define BITS_PER_LLONG 64 > + > /* xen_ulong_t is always 64 bits */ > #define BITS_PER_XEN_ULONG 64 > > diff --git a/xen/include/asm-x86/config.h b/xen/include/asm-x86/config.h > index bc0730fd9d..8b1de07dbc 100644 > --- a/xen/include/asm-x86/config.h > +++ b/xen/include/asm-x86/config.h > @@ -15,6 +15,8 @@ > #define BITS_PER_BYTE 8 > #define POINTER_ALIGN BYTES_PER_LONG > > +#define BITS_PER_LLONG 64 > + > #define BITS_PER_XEN_ULONG BITS_PER_LONG > > #define CONFIG_PAGING_ASSISTANCE 1 > diff --git a/xen/include/xen/bitops.h b/xen/include/xen/bitops.h > index bd0883ab22..e2019b02a3 100644 > --- a/xen/include/xen/bitops.h > +++ b/xen/include/xen/bitops.h > @@ -10,6 +10,9 @@ > #define GENMASK(h, l) \ > (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h)))) > > +#define GENMASK_ULL(h, l) \ > + (((~0ULL) << (l)) & (~0ULL >> (BITS_PER_LLONG - 1 - (h)))) > + > /* > * ffs: find first bit set. This is defined the same way as > * the libc and compiler builtin ffs routines, therefore Cheers, ~Sergej
On Wed, 9 Aug 2017, Sergej Proskurin wrote: > The current implementation of GENMASK is capable of creating bitmasks of > 32-bit values on AArch32 and 64-bit values on AArch64. As we need to > create masks for 64-bit values on AArch32 as well, in this commit we > introduce the GENMASK_ULL bit operation. Please note that the > GENMASK_ULL implementation has been lifted from the linux kernel source > code. > > Signed-off-by: Sergej Proskurin <proskurin@sec.in.tum.de> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> > --- > Cc: Andrew Cooper <andrew.cooper3@citrix.com> > Cc: George Dunlap <George.Dunlap@eu.citrix.com> > Cc: Ian Jackson <ian.jackson@eu.citrix.com> > Cc: Jan Beulich <jbeulich@suse.com> > Cc: Julien Grall <julien.grall@arm.com> > Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> > Cc: Stefano Stabellini <sstabellini@kernel.org> > Cc: Tim Deegan <tim@xen.org> > Cc: Wei Liu <wei.liu2@citrix.com> > --- > v6: As similar patches have been already submitted and NACKED in the > past, we resubmit this patch with 'THE REST' maintainers in Cc to > discuss whether this patch shall be applied into common or put into > ARM related code. > > v7: Change the introduced macro BITS_PER_LONG_LONG to BITS_PER_LLONG. > > Define BITS_PER_LLONG also in asm-x86/config.h in order to allow > global usage of the introduced macro GENMASK_ULL. > > Remove previously unintended whitespace elimination in the function > get_bitmask_order as it is not the right patch to address cleanup. > --- > xen/include/asm-arm/config.h | 2 ++ > xen/include/asm-x86/config.h | 2 ++ > xen/include/xen/bitops.h | 3 +++ > 3 files changed, 7 insertions(+) > > diff --git a/xen/include/asm-arm/config.h b/xen/include/asm-arm/config.h > index 5b6f3c985d..7da94698e1 100644 > --- a/xen/include/asm-arm/config.h > +++ b/xen/include/asm-arm/config.h > @@ -19,6 +19,8 @@ > #define BITS_PER_LONG (BYTES_PER_LONG << 3) > #define POINTER_ALIGN BYTES_PER_LONG > > +#define BITS_PER_LLONG 64 > + > /* xen_ulong_t is always 64 bits */ > #define BITS_PER_XEN_ULONG 64 > > diff --git a/xen/include/asm-x86/config.h b/xen/include/asm-x86/config.h > index bc0730fd9d..8b1de07dbc 100644 > --- a/xen/include/asm-x86/config.h > +++ b/xen/include/asm-x86/config.h > @@ -15,6 +15,8 @@ > #define BITS_PER_BYTE 8 > #define POINTER_ALIGN BYTES_PER_LONG > > +#define BITS_PER_LLONG 64 > + > #define BITS_PER_XEN_ULONG BITS_PER_LONG > > #define CONFIG_PAGING_ASSISTANCE 1 > diff --git a/xen/include/xen/bitops.h b/xen/include/xen/bitops.h > index bd0883ab22..e2019b02a3 100644 > --- a/xen/include/xen/bitops.h > +++ b/xen/include/xen/bitops.h > @@ -10,6 +10,9 @@ > #define GENMASK(h, l) \ > (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h)))) > > +#define GENMASK_ULL(h, l) \ > + (((~0ULL) << (l)) & (~0ULL >> (BITS_PER_LLONG - 1 - (h)))) > + > /* > * ffs: find first bit set. This is defined the same way as > * the libc and compiler builtin ffs routines, therefore > -- > 2.13.3 >
diff --git a/xen/include/asm-arm/config.h b/xen/include/asm-arm/config.h index 5b6f3c985d..7da94698e1 100644 --- a/xen/include/asm-arm/config.h +++ b/xen/include/asm-arm/config.h @@ -19,6 +19,8 @@ #define BITS_PER_LONG (BYTES_PER_LONG << 3) #define POINTER_ALIGN BYTES_PER_LONG +#define BITS_PER_LLONG 64 + /* xen_ulong_t is always 64 bits */ #define BITS_PER_XEN_ULONG 64 diff --git a/xen/include/asm-x86/config.h b/xen/include/asm-x86/config.h index bc0730fd9d..8b1de07dbc 100644 --- a/xen/include/asm-x86/config.h +++ b/xen/include/asm-x86/config.h @@ -15,6 +15,8 @@ #define BITS_PER_BYTE 8 #define POINTER_ALIGN BYTES_PER_LONG +#define BITS_PER_LLONG 64 + #define BITS_PER_XEN_ULONG BITS_PER_LONG #define CONFIG_PAGING_ASSISTANCE 1 diff --git a/xen/include/xen/bitops.h b/xen/include/xen/bitops.h index bd0883ab22..e2019b02a3 100644 --- a/xen/include/xen/bitops.h +++ b/xen/include/xen/bitops.h @@ -10,6 +10,9 @@ #define GENMASK(h, l) \ (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h)))) +#define GENMASK_ULL(h, l) \ + (((~0ULL) << (l)) & (~0ULL >> (BITS_PER_LLONG - 1 - (h)))) + /* * ffs: find first bit set. This is defined the same way as * the libc and compiler builtin ffs routines, therefore
The current implementation of GENMASK is capable of creating bitmasks of 32-bit values on AArch32 and 64-bit values on AArch64. As we need to create masks for 64-bit values on AArch32 as well, in this commit we introduce the GENMASK_ULL bit operation. Please note that the GENMASK_ULL implementation has been lifted from the linux kernel source code. Signed-off-by: Sergej Proskurin <proskurin@sec.in.tum.de> --- Cc: Andrew Cooper <andrew.cooper3@citrix.com> Cc: George Dunlap <George.Dunlap@eu.citrix.com> Cc: Ian Jackson <ian.jackson@eu.citrix.com> Cc: Jan Beulich <jbeulich@suse.com> Cc: Julien Grall <julien.grall@arm.com> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Cc: Stefano Stabellini <sstabellini@kernel.org> Cc: Tim Deegan <tim@xen.org> Cc: Wei Liu <wei.liu2@citrix.com> --- v6: As similar patches have been already submitted and NACKED in the past, we resubmit this patch with 'THE REST' maintainers in Cc to discuss whether this patch shall be applied into common or put into ARM related code. v7: Change the introduced macro BITS_PER_LONG_LONG to BITS_PER_LLONG. Define BITS_PER_LLONG also in asm-x86/config.h in order to allow global usage of the introduced macro GENMASK_ULL. Remove previously unintended whitespace elimination in the function get_bitmask_order as it is not the right patch to address cleanup. --- xen/include/asm-arm/config.h | 2 ++ xen/include/asm-x86/config.h | 2 ++ xen/include/xen/bitops.h | 3 +++ 3 files changed, 7 insertions(+)