[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v14 1/9] xen: introduce generic non-atomic test_*bit()
Hi Oleksii, On 02/07/2024 13:01, Oleksii Kurochko wrote: > > > The following generic functions were introduced: > * test_bit > * generic__test_and_set_bit > * generic__test_and_clear_bit > * generic__test_and_change_bit > > These functions and macros can be useful for architectures > that don't have corresponding arch-specific instructions. > > Also, the patch introduces the following generics which are > used by the functions mentioned above: > * BITOP_BITS_PER_WORD > * BITOP_MASK > * BITOP_WORD > * BITOP_TYPE > > The following approach was chosen for generic*() and arch*() bit > operation functions: > If the bit operation function that is going to be generic starts > with the prefix "__", then the corresponding generic/arch function > will also contain the "__" prefix. For example: > * test_bit() will be defined using arch_test_bit() and > generic_test_bit(). > * __test_and_set_bit() will be defined using > arch__test_and_set_bit() and generic__test_and_set_bit(). > > Signed-off-by: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx> > Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx> Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx> with one question... [...] > diff --git a/xen/include/xen/bitops.h b/xen/include/xen/bitops.h > index 6a5e28730a..cc09d273c9 100644 > --- a/xen/include/xen/bitops.h > +++ b/xen/include/xen/bitops.h > @@ -4,6 +4,19 @@ > #include <xen/compiler.h> > #include <xen/types.h> > > +#define BITOP_BITS_PER_WORD 32 > +typedef uint32_t bitop_uint_t; > + > +#define BITOP_MASK(nr) ((bitop_uint_t)1 << ((nr) % BITOP_BITS_PER_WORD)) > + > +#define BITOP_WORD(nr) ((nr) / BITOP_BITS_PER_WORD) > + > +#define BITS_PER_BYTE 8 Shouldn't you remove the same macros from riscv and x86 config.h ? ~Michal
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |