Skip to content

Commit 9739ff4

Browse files
Gautam Menghanimpe
authored andcommitted
KVM: PPC: Book3S HV: Refactor HFSCR emulation for KVM guests
Refactor HFSCR emulation for KVM guests when they exit out with H_FAC_UNAVAIL to use a switch case instead of checking all "cause" values, since the "cause" values are mutually exclusive; and this is better expressed with a switch case. Signed-off-by: Gautam Menghani <gautam@linux.ibm.com> Reviewed-by: Madhavan Srinivasan <maddy@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://msgid.link/20240716115206.70210-1-gautam@linux.ibm.com
1 parent de9c2c6 commit 9739ff4

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

arch/powerpc/kvm/book3s_hv.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1922,14 +1922,22 @@ static int kvmppc_handle_exit_hv(struct kvm_vcpu *vcpu,
19221922

19231923
r = EMULATE_FAIL;
19241924
if (cpu_has_feature(CPU_FTR_ARCH_300)) {
1925-
if (cause == FSCR_MSGP_LG)
1925+
switch (cause) {
1926+
case FSCR_MSGP_LG:
19261927
r = kvmppc_emulate_doorbell_instr(vcpu);
1927-
if (cause == FSCR_PM_LG)
1928+
break;
1929+
case FSCR_PM_LG:
19281930
r = kvmppc_pmu_unavailable(vcpu);
1929-
if (cause == FSCR_EBB_LG)
1931+
break;
1932+
case FSCR_EBB_LG:
19301933
r = kvmppc_ebb_unavailable(vcpu);
1931-
if (cause == FSCR_TM_LG)
1934+
break;
1935+
case FSCR_TM_LG:
19321936
r = kvmppc_tm_unavailable(vcpu);
1937+
break;
1938+
default:
1939+
break;
1940+
}
19331941
}
19341942
if (r == EMULATE_FAIL) {
19351943
kvmppc_core_queue_program(vcpu, SRR1_PROGILL |

0 commit comments

Comments
 (0)