Skip to content

Commit 3d9fdc2

Browse files
chenhuacaibonzini
authored andcommitted
KVM: MIPS: Fix build errors for 32bit kernel
Commit dc6d95b ("KVM: MIPS: Add more MMIO load/store instructions emulation") introduced some 64bit load/store instructions emulation which are unavailable on 32bit platform, and it causes build errors: arch/mips/kvm/emulate.c: In function 'kvm_mips_emulate_store': arch/mips/kvm/emulate.c:1734:6: error: right shift count >= width of type [-Werror] ((vcpu->arch.gprs[rt] >> 56) & 0xff); ^ arch/mips/kvm/emulate.c:1738:6: error: right shift count >= width of type [-Werror] ((vcpu->arch.gprs[rt] >> 48) & 0xffff); ^ arch/mips/kvm/emulate.c:1742:6: error: right shift count >= width of type [-Werror] ((vcpu->arch.gprs[rt] >> 40) & 0xffffff); ^ arch/mips/kvm/emulate.c:1746:6: error: right shift count >= width of type [-Werror] ((vcpu->arch.gprs[rt] >> 32) & 0xffffffff); ^ arch/mips/kvm/emulate.c:1796:6: error: left shift count >= width of type [-Werror] (vcpu->arch.gprs[rt] << 32); ^ arch/mips/kvm/emulate.c:1800:6: error: left shift count >= width of type [-Werror] (vcpu->arch.gprs[rt] << 40); ^ arch/mips/kvm/emulate.c:1804:6: error: left shift count >= width of type [-Werror] (vcpu->arch.gprs[rt] << 48); ^ arch/mips/kvm/emulate.c:1808:6: error: left shift count >= width of type [-Werror] (vcpu->arch.gprs[rt] << 56); ^ cc1: all warnings being treated as errors make[3]: *** [arch/mips/kvm/emulate.o] Error 1 So, use #if defined(CONFIG_64BIT) && defined(CONFIG_KVM_MIPS_VZ) to guard the 64bit load/store instructions emulation. Reported-by: kernel test robot <[email protected]> Fixes: dc6d95b ("KVM: MIPS: Add more MMIO load/store instructions emulation") Signed-off-by: Huacai Chen <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 83d31e5 commit 3d9fdc2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

arch/mips/kvm/emulate.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1722,6 +1722,7 @@ enum emulation_result kvm_mips_emulate_store(union mips_instruction inst,
17221722
vcpu->arch.gprs[rt], *(u32 *)data);
17231723
break;
17241724

1725+
#if defined(CONFIG_64BIT) && defined(CONFIG_KVM_MIPS_VZ)
17251726
case sdl_op:
17261727
run->mmio.phys_addr = kvm_mips_callbacks->gva_to_gpa(
17271728
vcpu->arch.host_cp0_badvaddr) & (~0x7);
@@ -1815,6 +1816,7 @@ enum emulation_result kvm_mips_emulate_store(union mips_instruction inst,
18151816
vcpu->arch.pc, vcpu->arch.host_cp0_badvaddr,
18161817
vcpu->arch.gprs[rt], *(u64 *)data);
18171818
break;
1819+
#endif
18181820

18191821
#ifdef CONFIG_CPU_LOONGSON64
18201822
case sdc2_op:
@@ -2002,6 +2004,7 @@ enum emulation_result kvm_mips_emulate_load(union mips_instruction inst,
20022004
}
20032005
break;
20042006

2007+
#if defined(CONFIG_64BIT) && defined(CONFIG_KVM_MIPS_VZ)
20052008
case ldl_op:
20062009
run->mmio.phys_addr = kvm_mips_callbacks->gva_to_gpa(
20072010
vcpu->arch.host_cp0_badvaddr) & (~0x7);
@@ -2073,6 +2076,7 @@ enum emulation_result kvm_mips_emulate_load(union mips_instruction inst,
20732076
break;
20742077
}
20752078
break;
2079+
#endif
20762080

20772081
#ifdef CONFIG_CPU_LOONGSON64
20782082
case ldc2_op:

0 commit comments

Comments
 (0)