Skip to content

Commit ed351c5

Browse files
Gautam Menghanimpe
authored andcommitted
Revert "KVM: PPC: Book3S HV Nested: Stop forwarding all HFUs to L1"
This reverts commit 7c3ded5. On PowerNV, when a nested guest tries to use a feature prohibited by HFSCR, the nested hypervisor (L1) should get a H_FAC_UNAVAILABLE trap so that L1 can emulate the feature. But with the change introduced by commit 7c3ded5 ("KVM: PPC: Book3S HV Nested: Stop forwarding all HFUs to L1") the L1 ends up getting a H_EMUL_ASSIST because of which, the L1 ends up injecting a SIGILL when L2 (nested guest) tries to use doorbells. Reviewed-by: Nicholas Piggin <[email protected]> Signed-off-by: Gautam Menghani <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent 96e266e commit ed351c5

File tree

1 file changed

+2
-29
lines changed

1 file changed

+2
-29
lines changed

arch/powerpc/kvm/book3s_hv.c

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2063,36 +2063,9 @@ static int kvmppc_handle_nested_exit(struct kvm_vcpu *vcpu)
20632063
fallthrough; /* go to facility unavailable handler */
20642064
#endif
20652065

2066-
case BOOK3S_INTERRUPT_H_FAC_UNAVAIL: {
2067-
u64 cause = vcpu->arch.hfscr >> 56;
2068-
2069-
/*
2070-
* Only pass HFU interrupts to the L1 if the facility is
2071-
* permitted but disabled by the L1's HFSCR, otherwise
2072-
* the interrupt does not make sense to the L1 so turn
2073-
* it into a HEAI.
2074-
*/
2075-
if (!(vcpu->arch.hfscr_permitted & (1UL << cause)) ||
2076-
(vcpu->arch.nested_hfscr & (1UL << cause))) {
2077-
ppc_inst_t pinst;
2078-
vcpu->arch.trap = BOOK3S_INTERRUPT_H_EMUL_ASSIST;
2079-
2080-
/*
2081-
* If the fetch failed, return to guest and
2082-
* try executing it again.
2083-
*/
2084-
r = kvmppc_get_last_inst(vcpu, INST_GENERIC, &pinst);
2085-
vcpu->arch.emul_inst = ppc_inst_val(pinst);
2086-
if (r != EMULATE_DONE)
2087-
r = RESUME_GUEST;
2088-
else
2089-
r = RESUME_HOST;
2090-
} else {
2091-
r = RESUME_HOST;
2092-
}
2093-
2066+
case BOOK3S_INTERRUPT_H_FAC_UNAVAIL:
2067+
r = RESUME_HOST;
20942068
break;
2095-
}
20962069

20972070
case BOOK3S_INTERRUPT_HV_RM_HARD:
20982071
vcpu->arch.trap = 0;

0 commit comments

Comments
 (0)