Skip to content

Commit 95a6432

Browse files
paulusmackmpe
authored andcommitted
KVM: PPC: Book3S HV: Streamlined guest entry/exit path on P9 for radix guests
This creates an alternative guest entry/exit path which is used for radix guests on POWER9 systems when we have indep_threads_mode=Y. In these circumstances there is exactly one vcpu per vcore and there is no coordination required between vcpus or vcores; the vcpu can enter the guest without needing to synchronize with anything else. The new fast path is implemented almost entirely in C in book3s_hv.c and runs with the MMU on until the guest is entered. On guest exit we use the existing path until the point where we are committed to exiting the guest (as distinct from handling an interrupt in the low-level code and returning to the guest) and we have pulled the guest context from the XIVE. At that point we check a flag in the stack frame to see whether we came in via the old path and the new path; if we came in via the new path then we go back to C code to do the rest of the process of saving the guest context and restoring the host context. The C code is split into separate functions for handling the OS-accessible state and the hypervisor state, with the idea that the latter can be replaced by a hypercall when we implement nested virtualization. Signed-off-by: Paul Mackerras <[email protected]> Reviewed-by: David Gibson <[email protected]> [mpe: Fix CONFIG_ALTIVEC=n build] Signed-off-by: Michael Ellerman <[email protected]>
1 parent 53655dd commit 95a6432

File tree

6 files changed

+593
-4
lines changed

6 files changed

+593
-4
lines changed

arch/powerpc/include/asm/asm-prototypes.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,4 +165,6 @@ void kvmhv_load_host_pmu(void);
165165
void kvmhv_save_guest_pmu(struct kvm_vcpu *vcpu, bool pmu_in_use);
166166
void kvmhv_load_guest_pmu(struct kvm_vcpu *vcpu);
167167

168+
int __kvmhv_vcpu_entry_p9(struct kvm_vcpu *vcpu);
169+
168170
#endif /* _ASM_POWERPC_ASM_PROTOTYPES_H */

arch/powerpc/include/asm/kvm_ppc.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,7 @@ extern int kvmppc_xive_set_icp(struct kvm_vcpu *vcpu, u64 icpval);
583583

584584
extern int kvmppc_xive_set_irq(struct kvm *kvm, int irq_source_id, u32 irq,
585585
int level, bool line_status);
586+
extern void kvmppc_xive_push_vcpu(struct kvm_vcpu *vcpu);
586587
#else
587588
static inline int kvmppc_xive_set_xive(struct kvm *kvm, u32 irq, u32 server,
588589
u32 priority) { return -1; }
@@ -605,6 +606,7 @@ static inline int kvmppc_xive_set_icp(struct kvm_vcpu *vcpu, u64 icpval) { retur
605606

606607
static inline int kvmppc_xive_set_irq(struct kvm *kvm, int irq_source_id, u32 irq,
607608
int level, bool line_status) { return -ENODEV; }
609+
static inline void kvmppc_xive_push_vcpu(struct kvm_vcpu *vcpu) { }
608610
#endif /* CONFIG_KVM_XIVE */
609611

610612
/*

0 commit comments

Comments
 (0)