powerpc/kvm: Fix ifdef to remove build warning

[ Upstream commit 88688a2c8a ]

When compiling for pseries or powernv defconfig with "make C=1",
these warning were reported bu sparse tool in powerpc/kernel/kvm.c

arch/powerpc/kernel/kvm.c:635:9: warning: switch with no cases
arch/powerpc/kernel/kvm.c:646:9: warning: switch with no cases

Currently #ifdef were added after the switch case which are specific
for BOOKE and PPC_BOOK3S_32. These are not enabled in pseries/powernv
defconfig. Fix it by moving the #ifdef before switch(){}

Fixes: cbe487fac7 ("KVM: PPC: Add mtsrin PV code")
Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20250518044107.39928-1-maddy@linux.ibm.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Madhavan Srinivasan 2025-05-18 10:11:04 +05:30 committed by Greg Kroah-Hartman
parent 1907d84475
commit 5dea003c7c

View File

@ -632,19 +632,19 @@ static void __init kvm_check_ins(u32 *inst, u32 features)
#endif #endif
} }
switch (inst_no_rt & ~KVM_MASK_RB) {
#ifdef CONFIG_PPC_BOOK3S_32 #ifdef CONFIG_PPC_BOOK3S_32
switch (inst_no_rt & ~KVM_MASK_RB) {
case KVM_INST_MTSRIN: case KVM_INST_MTSRIN:
if (features & KVM_MAGIC_FEAT_SR) { if (features & KVM_MAGIC_FEAT_SR) {
u32 inst_rb = _inst & KVM_MASK_RB; u32 inst_rb = _inst & KVM_MASK_RB;
kvm_patch_ins_mtsrin(inst, inst_rt, inst_rb); kvm_patch_ins_mtsrin(inst, inst_rt, inst_rb);
} }
break; break;
#endif
} }
#endif
switch (_inst) {
#ifdef CONFIG_BOOKE #ifdef CONFIG_BOOKE
switch (_inst) {
case KVM_INST_WRTEEI_0: case KVM_INST_WRTEEI_0:
kvm_patch_ins_wrteei_0(inst); kvm_patch_ins_wrteei_0(inst);
break; break;
@ -652,8 +652,8 @@ static void __init kvm_check_ins(u32 *inst, u32 features)
case KVM_INST_WRTEEI_1: case KVM_INST_WRTEEI_1:
kvm_patch_ins_wrtee(inst, 0, 1); kvm_patch_ins_wrtee(inst, 0, 1);
break; break;
#endif
} }
#endif
} }
extern u32 kvm_template_start[]; extern u32 kvm_template_start[];