Skip to content

Commit ae3b1da

Browse files
Yang YingliangMarc Zyngier
authored andcommitted
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: 9f968c9 ("KVM: arm64: vgic-v2: Add helper for legacy dist/cpuif base address setting") Signed-off-by: Yang Yingliang <[email protected]> [maz: tidy up commit message] Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 0982c8d commit ae3b1da

File tree

1 file changed

+4
-2
lines changed
  • arch/arm64/include/uapi/asm

1 file changed

+4
-2
lines changed

arch/arm64/include/uapi/asm/kvm.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,11 @@ struct kvm_regs {
7575

7676
/* KVM_ARM_SET_DEVICE_ADDR ioctl id encoding */
7777
#define KVM_ARM_DEVICE_TYPE_SHIFT 0
78-
#define KVM_ARM_DEVICE_TYPE_MASK (0xffff << KVM_ARM_DEVICE_TYPE_SHIFT)
78+
#define KVM_ARM_DEVICE_TYPE_MASK GENMASK(KVM_ARM_DEVICE_TYPE_SHIFT + 15, \
79+
KVM_ARM_DEVICE_TYPE_SHIFT)
7980
#define KVM_ARM_DEVICE_ID_SHIFT 16
80-
#define KVM_ARM_DEVICE_ID_MASK (0xffff << KVM_ARM_DEVICE_ID_SHIFT)
81+
#define KVM_ARM_DEVICE_ID_MASK GENMASK(KVM_ARM_DEVICE_ID_SHIFT + 15, \
82+
KVM_ARM_DEVICE_ID_SHIFT)
8183

8284
/* Supported device IDs */
8385
#define KVM_ARM_DEVICE_VGIC_V2 0

0 commit comments

Comments
 (0)