xref: /openbmc/linux/arch/powerpc/kvm/book3s_hv.h (revision fbb6b31a)
1 // SPDX-License-Identifier: GPL-2.0-only
2 
3 /*
4  * Privileged (non-hypervisor) host registers to save.
5  */
6 struct p9_host_os_sprs {
7 	unsigned long iamr;
8 	unsigned long amr;
9 
10 	unsigned int pmc1;
11 	unsigned int pmc2;
12 	unsigned int pmc3;
13 	unsigned int pmc4;
14 	unsigned int pmc5;
15 	unsigned int pmc6;
16 	unsigned long mmcr0;
17 	unsigned long mmcr1;
18 	unsigned long mmcr2;
19 	unsigned long mmcr3;
20 	unsigned long mmcra;
21 	unsigned long siar;
22 	unsigned long sier1;
23 	unsigned long sier2;
24 	unsigned long sier3;
25 	unsigned long sdar;
26 };
27 
28 static inline bool nesting_enabled(struct kvm *kvm)
29 {
30 	return kvm->arch.nested_enable && kvm_is_radix(kvm);
31 }
32 
33 bool load_vcpu_state(struct kvm_vcpu *vcpu,
34 			   struct p9_host_os_sprs *host_os_sprs);
35 void store_vcpu_state(struct kvm_vcpu *vcpu);
36 void save_p9_host_os_sprs(struct p9_host_os_sprs *host_os_sprs);
37 void restore_p9_host_os_sprs(struct kvm_vcpu *vcpu,
38 				    struct p9_host_os_sprs *host_os_sprs);
39 void switch_pmu_to_guest(struct kvm_vcpu *vcpu,
40 			    struct p9_host_os_sprs *host_os_sprs);
41 void switch_pmu_to_host(struct kvm_vcpu *vcpu,
42 			    struct p9_host_os_sprs *host_os_sprs);
43