Dave Martin <Dave.Martin@xxxxxxx> writes: > On Wed, Nov 21, 2018 at 04:16:42PM +0000, Alex Bennée wrote: >> >> Dave Martin <Dave.Martin@xxxxxxx> writes: >> >> > KVM will need to interrogate the set of SVE vector lengths >> > available on the system. >> > >> > This patch exposes the relevant bits to the kernel, along with a >> > sve_vq_available() helper to check whether a particular vector >> > length is supported. >> > >> > vq_to_bit() and bit_to_vq() are not intended for use outside these >> > functions, so they are given a __ prefix to warn people not to use >> > them unless they really know what they are doing. >> >> Personally I wouldn't have bothered with the __ but whatever: >> >> Reviewed-by: Alex Bennée <alex.bennee@xxxxxxxxxx> > > OK, thanks > > I'll probably keep the __ unless somebody else objects, but if you feel > strongly I could get rid of it. nah - it's just a personal opinion... > Perhaps I simply shouldn't have called attention to it in the commit > message ;) Psychological priming ;-) > > Cheers > ---Dave > >> >> > >> > Signed-off-by: Dave Martin <Dave.Martin@xxxxxxx> >> > --- >> > arch/arm64/include/asm/fpsimd.h | 29 +++++++++++++++++++++++++++++ >> > arch/arm64/kernel/fpsimd.c | 35 ++++++++--------------------------- >> > 2 files changed, 37 insertions(+), 27 deletions(-) >> > >> > diff --git a/arch/arm64/include/asm/fpsimd.h b/arch/arm64/include/asm/fpsimd.h >> > index df7a143..ad6d2e4 100644 >> > --- a/arch/arm64/include/asm/fpsimd.h >> > +++ b/arch/arm64/include/asm/fpsimd.h >> > @@ -24,10 +24,13 @@ >> > >> > #ifndef __ASSEMBLY__ >> > >> > +#include <linux/bitmap.h> >> > #include <linux/build_bug.h> >> > +#include <linux/bug.h> >> > #include <linux/cache.h> >> > #include <linux/init.h> >> > #include <linux/stddef.h> >> > +#include <linux/types.h> >> > >> > #if defined(__KERNEL__) && defined(CONFIG_COMPAT) >> > /* Masks for extracting the FPSR and FPCR from the FPSCR */ >> > @@ -89,6 +92,32 @@ extern u64 read_zcr_features(void); >> > >> > extern int __ro_after_init sve_max_vl; >> > extern int __ro_after_init sve_max_virtualisable_vl; >> > +/* Set of available vector lengths, as vq_to_bit(vq): */ >> > +extern __ro_after_init DECLARE_BITMAP(sve_vq_map, SVE_VQ_MAX); >> > + >> > +/* >> > + * Helpers to translate bit indices in sve_vq_map to VQ values (and >> > + * vice versa). This allows find_next_bit() to be used to find the >> > + * _maximum_ VQ not exceeding a certain value. >> > + */ >> > +static inline unsigned int __vq_to_bit(unsigned int vq) >> > +{ >> > + return SVE_VQ_MAX - vq; >> > +} >> > + >> > +static inline unsigned int __bit_to_vq(unsigned int bit) >> > +{ > > [...] -- Alex Bennée _______________________________________________ kvmarm mailing list kvmarm@xxxxxxxxxxxxxxxxxxxxx https://lists.cs.columbia.edu/mailman/listinfo/kvmarm