On Fri, Apr 12, 2019 at 05:28:09PM +0100, Dave Martin wrote: > Currently, the SVE register ID macros are not all defined in the > same way, and advertise the fact that FFR maps onto the nonexistent > predicate register P16. This is really just for kernel > convenience, and may lead userspace into bad habits. > > Instead, this patch masks the ID macro arguments so that > architecturally invalid register numbers will not be passed through > any more, and uses a literal KVM_REG_ARM64_SVE_FFR_BASE macro to > define KVM_REG_ARM64_SVE_FFR(), similarly to the way the _ZREG() > and _PREG() macros are defined. > > Rather than plugging in magic numbers for the number of Z- and P- > registers and the maximum possible number of register slices, this > patch provides definitions for those too. Userspace is going to > need them in any case, and it makes sense for them to come from > <uapi/asm/kvm.h>. > > sve_reg_to_region() uses convenience constants that are defined in > a different way, and also makes use of the fact that the FFR IDs > are really contiguous with the P15 IDs, so this patch retains the > existing convenience constants in guest.c, supplemented with a > couple of sanity checks to check for consistency with with the UAPI s/with with/with/ > header. > > Fixes: e1c9c98345b3 ("KVM: arm64/sve: Add SVE support to register access ioctl interface") > Suggested-by: Andrew Jones <drjones@xxxxxxxxxx> > Signed-off-by: Dave Martin <Dave.Martin@xxxxxxx> > --- > arch/arm64/include/uapi/asm/kvm.h | 32 +++++++++++++++++++++++--------- > arch/arm64/kvm/guest.c | 9 +++++++++ > 2 files changed, 32 insertions(+), 9 deletions(-) > Reviewed-by: Andrew Jones <drjones@xxxxxxxxxx> _______________________________________________ kvmarm mailing list kvmarm@xxxxxxxxxxxxxxxxxxxxx https://lists.cs.columbia.edu/mailman/listinfo/kvmarm