diff options
author | Yang Yingliang <yangyingliang@huawei.com> | 2022-08-10 09:34:35 +0800 |
---|---|---|
committer | Marc Zyngier <maz@kernel.org> | 2022-08-10 09:49:16 +0100 |
commit | ae3b1da95413614f96ffa23d200929c6f809c807 (patch) | |
tree | 994438679afb5430d009248512381ed533934c50 /arch/arm64/include/uapi | |
parent | 0982c8d859f8f7022b9fd44d421c7ec721bb41f9 (diff) | |
download | linux-stable-ae3b1da95413614f96ffa23d200929c6f809c807.tar.gz linux-stable-ae3b1da95413614f96ffa23d200929c6f809c807.tar.bz2 linux-stable-ae3b1da95413614f96ffa23d200929c6f809c807.zip |
KVM: arm64: Fix compile error due to sign extension
Use GENMASK() to generate the masks of device type and device id,
fixing compilation errors due to the sign extension when using
older versions of GCC (such as is 7.5):
In function ‘kvm_vm_ioctl_set_device_addr.isra.38’,
inlined from ‘kvm_arch_vm_ioctl’ at arch/arm64/kvm/arm.c:1454:10:
././include/linux/compiler_types.h:354:38: error: call to ‘__compiletime_assert_599’ \
declared with attribute error: FIELD_GET: mask is not constant
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
Fixes: 9f968c9266aa ("KVM: arm64: vgic-v2: Add helper for legacy dist/cpuif base address setting")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
[maz: tidy up commit message]
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20220810013435.1525363-1-yangyingliang@huawei.com
Diffstat (limited to 'arch/arm64/include/uapi')
-rw-r--r-- | arch/arm64/include/uapi/asm/kvm.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/arm64/include/uapi/asm/kvm.h b/arch/arm64/include/uapi/asm/kvm.h index 3bb134355874..316917b98707 100644 --- a/arch/arm64/include/uapi/asm/kvm.h +++ b/arch/arm64/include/uapi/asm/kvm.h @@ -75,9 +75,11 @@ struct kvm_regs { /* KVM_ARM_SET_DEVICE_ADDR ioctl id encoding */ #define KVM_ARM_DEVICE_TYPE_SHIFT 0 -#define KVM_ARM_DEVICE_TYPE_MASK (0xffff << KVM_ARM_DEVICE_TYPE_SHIFT) +#define KVM_ARM_DEVICE_TYPE_MASK GENMASK(KVM_ARM_DEVICE_TYPE_SHIFT + 15, \ + KVM_ARM_DEVICE_TYPE_SHIFT) #define KVM_ARM_DEVICE_ID_SHIFT 16 -#define KVM_ARM_DEVICE_ID_MASK (0xffff << KVM_ARM_DEVICE_ID_SHIFT) +#define KVM_ARM_DEVICE_ID_MASK GENMASK(KVM_ARM_DEVICE_ID_SHIFT + 15, \ + KVM_ARM_DEVICE_ID_SHIFT) /* Supported device IDs */ #define KVM_ARM_DEVICE_VGIC_V2 0 |