xref: /OK3568_Linux_fs/kernel/arch/x86/kvm/vmx/nested.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */
2*4882a593Smuzhiyun #ifndef __KVM_X86_VMX_NESTED_H
3*4882a593Smuzhiyun #define __KVM_X86_VMX_NESTED_H
4*4882a593Smuzhiyun 
5*4882a593Smuzhiyun #include "kvm_cache_regs.h"
6*4882a593Smuzhiyun #include "vmcs12.h"
7*4882a593Smuzhiyun #include "vmx.h"
8*4882a593Smuzhiyun 
9*4882a593Smuzhiyun /*
10*4882a593Smuzhiyun  * Status returned by nested_vmx_enter_non_root_mode():
11*4882a593Smuzhiyun  */
12*4882a593Smuzhiyun enum nvmx_vmentry_status {
13*4882a593Smuzhiyun 	NVMX_VMENTRY_SUCCESS,		/* Entered VMX non-root mode */
14*4882a593Smuzhiyun 	NVMX_VMENTRY_VMFAIL,		/* Consistency check VMFail */
15*4882a593Smuzhiyun 	NVMX_VMENTRY_VMEXIT,		/* Consistency check VMExit */
16*4882a593Smuzhiyun 	NVMX_VMENTRY_KVM_INTERNAL_ERROR,/* KVM internal error */
17*4882a593Smuzhiyun };
18*4882a593Smuzhiyun 
19*4882a593Smuzhiyun void vmx_leave_nested(struct kvm_vcpu *vcpu);
20*4882a593Smuzhiyun void nested_vmx_setup_ctls_msrs(struct nested_vmx_msrs *msrs, u32 ept_caps);
21*4882a593Smuzhiyun void nested_vmx_hardware_unsetup(void);
22*4882a593Smuzhiyun __init int nested_vmx_hardware_setup(int (*exit_handlers[])(struct kvm_vcpu *));
23*4882a593Smuzhiyun void nested_vmx_set_vmcs_shadowing_bitmap(void);
24*4882a593Smuzhiyun void nested_vmx_free_vcpu(struct kvm_vcpu *vcpu);
25*4882a593Smuzhiyun enum nvmx_vmentry_status nested_vmx_enter_non_root_mode(struct kvm_vcpu *vcpu,
26*4882a593Smuzhiyun 						     bool from_vmentry);
27*4882a593Smuzhiyun bool nested_vmx_reflect_vmexit(struct kvm_vcpu *vcpu);
28*4882a593Smuzhiyun void nested_vmx_vmexit(struct kvm_vcpu *vcpu, u32 vm_exit_reason,
29*4882a593Smuzhiyun 		       u32 exit_intr_info, unsigned long exit_qualification);
30*4882a593Smuzhiyun void nested_sync_vmcs12_to_shadow(struct kvm_vcpu *vcpu);
31*4882a593Smuzhiyun int vmx_set_vmx_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 data);
32*4882a593Smuzhiyun int vmx_get_vmx_msr(struct nested_vmx_msrs *msrs, u32 msr_index, u64 *pdata);
33*4882a593Smuzhiyun int get_vmx_mem_address(struct kvm_vcpu *vcpu, unsigned long exit_qualification,
34*4882a593Smuzhiyun 			u32 vmx_instruction_info, bool wr, int len, gva_t *ret);
35*4882a593Smuzhiyun void nested_vmx_pmu_entry_exit_ctls_update(struct kvm_vcpu *vcpu);
36*4882a593Smuzhiyun void nested_mark_vmcs12_pages_dirty(struct kvm_vcpu *vcpu);
37*4882a593Smuzhiyun bool nested_vmx_check_io_bitmaps(struct kvm_vcpu *vcpu, unsigned int port,
38*4882a593Smuzhiyun 				 int size);
39*4882a593Smuzhiyun 
get_vmcs12(struct kvm_vcpu * vcpu)40*4882a593Smuzhiyun static inline struct vmcs12 *get_vmcs12(struct kvm_vcpu *vcpu)
41*4882a593Smuzhiyun {
42*4882a593Smuzhiyun 	return to_vmx(vcpu)->nested.cached_vmcs12;
43*4882a593Smuzhiyun }
44*4882a593Smuzhiyun 
get_shadow_vmcs12(struct kvm_vcpu * vcpu)45*4882a593Smuzhiyun static inline struct vmcs12 *get_shadow_vmcs12(struct kvm_vcpu *vcpu)
46*4882a593Smuzhiyun {
47*4882a593Smuzhiyun 	return to_vmx(vcpu)->nested.cached_shadow_vmcs12;
48*4882a593Smuzhiyun }
49*4882a593Smuzhiyun 
50*4882a593Smuzhiyun /*
51*4882a593Smuzhiyun  * Note: the same condition is checked against the state provided by userspace
52*4882a593Smuzhiyun  * in vmx_set_nested_state; if it is satisfied, the nested state must include
53*4882a593Smuzhiyun  * the VMCS12.
54*4882a593Smuzhiyun  */
vmx_has_valid_vmcs12(struct kvm_vcpu * vcpu)55*4882a593Smuzhiyun static inline int vmx_has_valid_vmcs12(struct kvm_vcpu *vcpu)
56*4882a593Smuzhiyun {
57*4882a593Smuzhiyun 	struct vcpu_vmx *vmx = to_vmx(vcpu);
58*4882a593Smuzhiyun 
59*4882a593Smuzhiyun 	/*
60*4882a593Smuzhiyun 	 * In case we do two consecutive get/set_nested_state()s while L2 was
61*4882a593Smuzhiyun 	 * running hv_evmcs may end up not being mapped (we map it from
62*4882a593Smuzhiyun 	 * nested_vmx_run()/vmx_vcpu_run()). Check is_guest_mode() as we always
63*4882a593Smuzhiyun 	 * have vmcs12 if it is true.
64*4882a593Smuzhiyun 	 */
65*4882a593Smuzhiyun 	return is_guest_mode(vcpu) || vmx->nested.current_vmptr != -1ull ||
66*4882a593Smuzhiyun 		vmx->nested.hv_evmcs;
67*4882a593Smuzhiyun }
68*4882a593Smuzhiyun 
nested_get_vpid02(struct kvm_vcpu * vcpu)69*4882a593Smuzhiyun static inline u16 nested_get_vpid02(struct kvm_vcpu *vcpu)
70*4882a593Smuzhiyun {
71*4882a593Smuzhiyun 	struct vcpu_vmx *vmx = to_vmx(vcpu);
72*4882a593Smuzhiyun 
73*4882a593Smuzhiyun 	return vmx->nested.vpid02 ? vmx->nested.vpid02 : vmx->vpid;
74*4882a593Smuzhiyun }
75*4882a593Smuzhiyun 
nested_ept_get_eptp(struct kvm_vcpu * vcpu)76*4882a593Smuzhiyun static inline unsigned long nested_ept_get_eptp(struct kvm_vcpu *vcpu)
77*4882a593Smuzhiyun {
78*4882a593Smuzhiyun 	/* return the page table to be shadowed - in our case, EPT12 */
79*4882a593Smuzhiyun 	return get_vmcs12(vcpu)->ept_pointer;
80*4882a593Smuzhiyun }
81*4882a593Smuzhiyun 
nested_ept_ad_enabled(struct kvm_vcpu * vcpu)82*4882a593Smuzhiyun static inline bool nested_ept_ad_enabled(struct kvm_vcpu *vcpu)
83*4882a593Smuzhiyun {
84*4882a593Smuzhiyun 	return nested_ept_get_eptp(vcpu) & VMX_EPTP_AD_ENABLE_BIT;
85*4882a593Smuzhiyun }
86*4882a593Smuzhiyun 
87*4882a593Smuzhiyun /*
88*4882a593Smuzhiyun  * Return the cr0 value that a nested guest would read. This is a combination
89*4882a593Smuzhiyun  * of the real cr0 used to run the guest (guest_cr0), and the bits shadowed by
90*4882a593Smuzhiyun  * its hypervisor (cr0_read_shadow).
91*4882a593Smuzhiyun  */
nested_read_cr0(struct vmcs12 * fields)92*4882a593Smuzhiyun static inline unsigned long nested_read_cr0(struct vmcs12 *fields)
93*4882a593Smuzhiyun {
94*4882a593Smuzhiyun 	return (fields->guest_cr0 & ~fields->cr0_guest_host_mask) |
95*4882a593Smuzhiyun 		(fields->cr0_read_shadow & fields->cr0_guest_host_mask);
96*4882a593Smuzhiyun }
nested_read_cr4(struct vmcs12 * fields)97*4882a593Smuzhiyun static inline unsigned long nested_read_cr4(struct vmcs12 *fields)
98*4882a593Smuzhiyun {
99*4882a593Smuzhiyun 	return (fields->guest_cr4 & ~fields->cr4_guest_host_mask) |
100*4882a593Smuzhiyun 		(fields->cr4_read_shadow & fields->cr4_guest_host_mask);
101*4882a593Smuzhiyun }
102*4882a593Smuzhiyun 
nested_cpu_vmx_misc_cr3_count(struct kvm_vcpu * vcpu)103*4882a593Smuzhiyun static inline unsigned nested_cpu_vmx_misc_cr3_count(struct kvm_vcpu *vcpu)
104*4882a593Smuzhiyun {
105*4882a593Smuzhiyun 	return vmx_misc_cr3_count(to_vmx(vcpu)->nested.msrs.misc_low);
106*4882a593Smuzhiyun }
107*4882a593Smuzhiyun 
108*4882a593Smuzhiyun /*
109*4882a593Smuzhiyun  * Do the virtual VMX capability MSRs specify that L1 can use VMWRITE
110*4882a593Smuzhiyun  * to modify any valid field of the VMCS, or are the VM-exit
111*4882a593Smuzhiyun  * information fields read-only?
112*4882a593Smuzhiyun  */
nested_cpu_has_vmwrite_any_field(struct kvm_vcpu * vcpu)113*4882a593Smuzhiyun static inline bool nested_cpu_has_vmwrite_any_field(struct kvm_vcpu *vcpu)
114*4882a593Smuzhiyun {
115*4882a593Smuzhiyun 	return to_vmx(vcpu)->nested.msrs.misc_low &
116*4882a593Smuzhiyun 		MSR_IA32_VMX_MISC_VMWRITE_SHADOW_RO_FIELDS;
117*4882a593Smuzhiyun }
118*4882a593Smuzhiyun 
nested_cpu_has_zero_length_injection(struct kvm_vcpu * vcpu)119*4882a593Smuzhiyun static inline bool nested_cpu_has_zero_length_injection(struct kvm_vcpu *vcpu)
120*4882a593Smuzhiyun {
121*4882a593Smuzhiyun 	return to_vmx(vcpu)->nested.msrs.misc_low & VMX_MISC_ZERO_LEN_INS;
122*4882a593Smuzhiyun }
123*4882a593Smuzhiyun 
nested_cpu_supports_monitor_trap_flag(struct kvm_vcpu * vcpu)124*4882a593Smuzhiyun static inline bool nested_cpu_supports_monitor_trap_flag(struct kvm_vcpu *vcpu)
125*4882a593Smuzhiyun {
126*4882a593Smuzhiyun 	return to_vmx(vcpu)->nested.msrs.procbased_ctls_high &
127*4882a593Smuzhiyun 			CPU_BASED_MONITOR_TRAP_FLAG;
128*4882a593Smuzhiyun }
129*4882a593Smuzhiyun 
nested_cpu_has_vmx_shadow_vmcs(struct kvm_vcpu * vcpu)130*4882a593Smuzhiyun static inline bool nested_cpu_has_vmx_shadow_vmcs(struct kvm_vcpu *vcpu)
131*4882a593Smuzhiyun {
132*4882a593Smuzhiyun 	return to_vmx(vcpu)->nested.msrs.secondary_ctls_high &
133*4882a593Smuzhiyun 		SECONDARY_EXEC_SHADOW_VMCS;
134*4882a593Smuzhiyun }
135*4882a593Smuzhiyun 
nested_cpu_has(struct vmcs12 * vmcs12,u32 bit)136*4882a593Smuzhiyun static inline bool nested_cpu_has(struct vmcs12 *vmcs12, u32 bit)
137*4882a593Smuzhiyun {
138*4882a593Smuzhiyun 	return vmcs12->cpu_based_vm_exec_control & bit;
139*4882a593Smuzhiyun }
140*4882a593Smuzhiyun 
nested_cpu_has2(struct vmcs12 * vmcs12,u32 bit)141*4882a593Smuzhiyun static inline bool nested_cpu_has2(struct vmcs12 *vmcs12, u32 bit)
142*4882a593Smuzhiyun {
143*4882a593Smuzhiyun 	return (vmcs12->cpu_based_vm_exec_control &
144*4882a593Smuzhiyun 			CPU_BASED_ACTIVATE_SECONDARY_CONTROLS) &&
145*4882a593Smuzhiyun 		(vmcs12->secondary_vm_exec_control & bit);
146*4882a593Smuzhiyun }
147*4882a593Smuzhiyun 
nested_cpu_has_preemption_timer(struct vmcs12 * vmcs12)148*4882a593Smuzhiyun static inline bool nested_cpu_has_preemption_timer(struct vmcs12 *vmcs12)
149*4882a593Smuzhiyun {
150*4882a593Smuzhiyun 	return vmcs12->pin_based_vm_exec_control &
151*4882a593Smuzhiyun 		PIN_BASED_VMX_PREEMPTION_TIMER;
152*4882a593Smuzhiyun }
153*4882a593Smuzhiyun 
nested_cpu_has_nmi_exiting(struct vmcs12 * vmcs12)154*4882a593Smuzhiyun static inline bool nested_cpu_has_nmi_exiting(struct vmcs12 *vmcs12)
155*4882a593Smuzhiyun {
156*4882a593Smuzhiyun 	return vmcs12->pin_based_vm_exec_control & PIN_BASED_NMI_EXITING;
157*4882a593Smuzhiyun }
158*4882a593Smuzhiyun 
nested_cpu_has_virtual_nmis(struct vmcs12 * vmcs12)159*4882a593Smuzhiyun static inline bool nested_cpu_has_virtual_nmis(struct vmcs12 *vmcs12)
160*4882a593Smuzhiyun {
161*4882a593Smuzhiyun 	return vmcs12->pin_based_vm_exec_control & PIN_BASED_VIRTUAL_NMIS;
162*4882a593Smuzhiyun }
163*4882a593Smuzhiyun 
nested_cpu_has_mtf(struct vmcs12 * vmcs12)164*4882a593Smuzhiyun static inline int nested_cpu_has_mtf(struct vmcs12 *vmcs12)
165*4882a593Smuzhiyun {
166*4882a593Smuzhiyun 	return nested_cpu_has(vmcs12, CPU_BASED_MONITOR_TRAP_FLAG);
167*4882a593Smuzhiyun }
168*4882a593Smuzhiyun 
nested_cpu_has_ept(struct vmcs12 * vmcs12)169*4882a593Smuzhiyun static inline int nested_cpu_has_ept(struct vmcs12 *vmcs12)
170*4882a593Smuzhiyun {
171*4882a593Smuzhiyun 	return nested_cpu_has2(vmcs12, SECONDARY_EXEC_ENABLE_EPT);
172*4882a593Smuzhiyun }
173*4882a593Smuzhiyun 
nested_cpu_has_xsaves(struct vmcs12 * vmcs12)174*4882a593Smuzhiyun static inline bool nested_cpu_has_xsaves(struct vmcs12 *vmcs12)
175*4882a593Smuzhiyun {
176*4882a593Smuzhiyun 	return nested_cpu_has2(vmcs12, SECONDARY_EXEC_XSAVES);
177*4882a593Smuzhiyun }
178*4882a593Smuzhiyun 
nested_cpu_has_pml(struct vmcs12 * vmcs12)179*4882a593Smuzhiyun static inline bool nested_cpu_has_pml(struct vmcs12 *vmcs12)
180*4882a593Smuzhiyun {
181*4882a593Smuzhiyun 	return nested_cpu_has2(vmcs12, SECONDARY_EXEC_ENABLE_PML);
182*4882a593Smuzhiyun }
183*4882a593Smuzhiyun 
nested_cpu_has_virt_x2apic_mode(struct vmcs12 * vmcs12)184*4882a593Smuzhiyun static inline bool nested_cpu_has_virt_x2apic_mode(struct vmcs12 *vmcs12)
185*4882a593Smuzhiyun {
186*4882a593Smuzhiyun 	return nested_cpu_has2(vmcs12, SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE);
187*4882a593Smuzhiyun }
188*4882a593Smuzhiyun 
nested_cpu_has_vpid(struct vmcs12 * vmcs12)189*4882a593Smuzhiyun static inline bool nested_cpu_has_vpid(struct vmcs12 *vmcs12)
190*4882a593Smuzhiyun {
191*4882a593Smuzhiyun 	return nested_cpu_has2(vmcs12, SECONDARY_EXEC_ENABLE_VPID);
192*4882a593Smuzhiyun }
193*4882a593Smuzhiyun 
nested_cpu_has_apic_reg_virt(struct vmcs12 * vmcs12)194*4882a593Smuzhiyun static inline bool nested_cpu_has_apic_reg_virt(struct vmcs12 *vmcs12)
195*4882a593Smuzhiyun {
196*4882a593Smuzhiyun 	return nested_cpu_has2(vmcs12, SECONDARY_EXEC_APIC_REGISTER_VIRT);
197*4882a593Smuzhiyun }
198*4882a593Smuzhiyun 
nested_cpu_has_vid(struct vmcs12 * vmcs12)199*4882a593Smuzhiyun static inline bool nested_cpu_has_vid(struct vmcs12 *vmcs12)
200*4882a593Smuzhiyun {
201*4882a593Smuzhiyun 	return nested_cpu_has2(vmcs12, SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY);
202*4882a593Smuzhiyun }
203*4882a593Smuzhiyun 
nested_cpu_has_posted_intr(struct vmcs12 * vmcs12)204*4882a593Smuzhiyun static inline bool nested_cpu_has_posted_intr(struct vmcs12 *vmcs12)
205*4882a593Smuzhiyun {
206*4882a593Smuzhiyun 	return vmcs12->pin_based_vm_exec_control & PIN_BASED_POSTED_INTR;
207*4882a593Smuzhiyun }
208*4882a593Smuzhiyun 
nested_cpu_has_vmfunc(struct vmcs12 * vmcs12)209*4882a593Smuzhiyun static inline bool nested_cpu_has_vmfunc(struct vmcs12 *vmcs12)
210*4882a593Smuzhiyun {
211*4882a593Smuzhiyun 	return nested_cpu_has2(vmcs12, SECONDARY_EXEC_ENABLE_VMFUNC);
212*4882a593Smuzhiyun }
213*4882a593Smuzhiyun 
nested_cpu_has_eptp_switching(struct vmcs12 * vmcs12)214*4882a593Smuzhiyun static inline bool nested_cpu_has_eptp_switching(struct vmcs12 *vmcs12)
215*4882a593Smuzhiyun {
216*4882a593Smuzhiyun 	return nested_cpu_has_vmfunc(vmcs12) &&
217*4882a593Smuzhiyun 		(vmcs12->vm_function_control &
218*4882a593Smuzhiyun 		 VMX_VMFUNC_EPTP_SWITCHING);
219*4882a593Smuzhiyun }
220*4882a593Smuzhiyun 
nested_cpu_has_shadow_vmcs(struct vmcs12 * vmcs12)221*4882a593Smuzhiyun static inline bool nested_cpu_has_shadow_vmcs(struct vmcs12 *vmcs12)
222*4882a593Smuzhiyun {
223*4882a593Smuzhiyun 	return nested_cpu_has2(vmcs12, SECONDARY_EXEC_SHADOW_VMCS);
224*4882a593Smuzhiyun }
225*4882a593Smuzhiyun 
nested_cpu_has_save_preemption_timer(struct vmcs12 * vmcs12)226*4882a593Smuzhiyun static inline bool nested_cpu_has_save_preemption_timer(struct vmcs12 *vmcs12)
227*4882a593Smuzhiyun {
228*4882a593Smuzhiyun 	return vmcs12->vm_exit_controls &
229*4882a593Smuzhiyun 	    VM_EXIT_SAVE_VMX_PREEMPTION_TIMER;
230*4882a593Smuzhiyun }
231*4882a593Smuzhiyun 
nested_exit_on_nmi(struct kvm_vcpu * vcpu)232*4882a593Smuzhiyun static inline bool nested_exit_on_nmi(struct kvm_vcpu *vcpu)
233*4882a593Smuzhiyun {
234*4882a593Smuzhiyun 	return nested_cpu_has_nmi_exiting(get_vmcs12(vcpu));
235*4882a593Smuzhiyun }
236*4882a593Smuzhiyun 
237*4882a593Smuzhiyun /*
238*4882a593Smuzhiyun  * In nested virtualization, check if L1 asked to exit on external interrupts.
239*4882a593Smuzhiyun  * For most existing hypervisors, this will always return true.
240*4882a593Smuzhiyun  */
nested_exit_on_intr(struct kvm_vcpu * vcpu)241*4882a593Smuzhiyun static inline bool nested_exit_on_intr(struct kvm_vcpu *vcpu)
242*4882a593Smuzhiyun {
243*4882a593Smuzhiyun 	return get_vmcs12(vcpu)->pin_based_vm_exec_control &
244*4882a593Smuzhiyun 		PIN_BASED_EXT_INTR_MASK;
245*4882a593Smuzhiyun }
246*4882a593Smuzhiyun 
247*4882a593Smuzhiyun /*
248*4882a593Smuzhiyun  * if fixed0[i] == 1: val[i] must be 1
249*4882a593Smuzhiyun  * if fixed1[i] == 0: val[i] must be 0
250*4882a593Smuzhiyun  */
fixed_bits_valid(u64 val,u64 fixed0,u64 fixed1)251*4882a593Smuzhiyun static inline bool fixed_bits_valid(u64 val, u64 fixed0, u64 fixed1)
252*4882a593Smuzhiyun {
253*4882a593Smuzhiyun 	return ((val & fixed1) | fixed0) == val;
254*4882a593Smuzhiyun }
255*4882a593Smuzhiyun 
nested_guest_cr0_valid(struct kvm_vcpu * vcpu,unsigned long val)256*4882a593Smuzhiyun static inline bool nested_guest_cr0_valid(struct kvm_vcpu *vcpu, unsigned long val)
257*4882a593Smuzhiyun {
258*4882a593Smuzhiyun 	u64 fixed0 = to_vmx(vcpu)->nested.msrs.cr0_fixed0;
259*4882a593Smuzhiyun 	u64 fixed1 = to_vmx(vcpu)->nested.msrs.cr0_fixed1;
260*4882a593Smuzhiyun 	struct vmcs12 *vmcs12 = get_vmcs12(vcpu);
261*4882a593Smuzhiyun 
262*4882a593Smuzhiyun 	if (to_vmx(vcpu)->nested.msrs.secondary_ctls_high &
263*4882a593Smuzhiyun 		SECONDARY_EXEC_UNRESTRICTED_GUEST &&
264*4882a593Smuzhiyun 	    nested_cpu_has2(vmcs12, SECONDARY_EXEC_UNRESTRICTED_GUEST))
265*4882a593Smuzhiyun 		fixed0 &= ~(X86_CR0_PE | X86_CR0_PG);
266*4882a593Smuzhiyun 
267*4882a593Smuzhiyun 	return fixed_bits_valid(val, fixed0, fixed1);
268*4882a593Smuzhiyun }
269*4882a593Smuzhiyun 
nested_host_cr0_valid(struct kvm_vcpu * vcpu,unsigned long val)270*4882a593Smuzhiyun static inline bool nested_host_cr0_valid(struct kvm_vcpu *vcpu, unsigned long val)
271*4882a593Smuzhiyun {
272*4882a593Smuzhiyun 	u64 fixed0 = to_vmx(vcpu)->nested.msrs.cr0_fixed0;
273*4882a593Smuzhiyun 	u64 fixed1 = to_vmx(vcpu)->nested.msrs.cr0_fixed1;
274*4882a593Smuzhiyun 
275*4882a593Smuzhiyun 	return fixed_bits_valid(val, fixed0, fixed1);
276*4882a593Smuzhiyun }
277*4882a593Smuzhiyun 
nested_cr4_valid(struct kvm_vcpu * vcpu,unsigned long val)278*4882a593Smuzhiyun static inline bool nested_cr4_valid(struct kvm_vcpu *vcpu, unsigned long val)
279*4882a593Smuzhiyun {
280*4882a593Smuzhiyun 	u64 fixed0 = to_vmx(vcpu)->nested.msrs.cr4_fixed0;
281*4882a593Smuzhiyun 	u64 fixed1 = to_vmx(vcpu)->nested.msrs.cr4_fixed1;
282*4882a593Smuzhiyun 
283*4882a593Smuzhiyun 	return fixed_bits_valid(val, fixed0, fixed1);
284*4882a593Smuzhiyun }
285*4882a593Smuzhiyun 
286*4882a593Smuzhiyun /* No difference in the restrictions on guest and host CR4 in VMX operation. */
287*4882a593Smuzhiyun #define nested_guest_cr4_valid	nested_cr4_valid
288*4882a593Smuzhiyun #define nested_host_cr4_valid	nested_cr4_valid
289*4882a593Smuzhiyun 
290*4882a593Smuzhiyun extern struct kvm_x86_nested_ops vmx_nested_ops;
291*4882a593Smuzhiyun 
292*4882a593Smuzhiyun #endif /* __KVM_X86_VMX_NESTED_H */
293