Skip to content

Commit 5a30f97

Browse files
vittyvksean-jc
authored andcommitted
KVM: nVMX: Hide more stuff under CONFIG_KVM_HYPERV
'hv_evmcs_vmptr'/'hv_evmcs_map'/'hv_evmcs' fields in 'struct nested_vmx' should not be used when !CONFIG_KVM_HYPERV, hide them when !CONFIG_KVM_HYPERV. No functional change intended. Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> Tested-by: Jeremi Piotrowski <jpiotrowski@linux.microsoft.com> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> Link: https://lore.kernel.org/r/20231205103630.1391318-16-vkuznets@redhat.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent c98842b commit 5a30f97

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

arch/x86/kvm/vmx/nested.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6667,6 +6667,7 @@ static int vmx_set_nested_state(struct kvm_vcpu *vcpu,
66676667
return -EINVAL;
66686668

66696669
set_current_vmptr(vmx, kvm_state->hdr.vmx.vmcs12_pa);
6670+
#ifdef CONFIG_KVM_HYPERV
66706671
} else if (kvm_state->flags & KVM_STATE_NESTED_EVMCS) {
66716672
/*
66726673
* nested_vmx_handle_enlightened_vmptrld() cannot be called
@@ -6676,6 +6677,7 @@ static int vmx_set_nested_state(struct kvm_vcpu *vcpu,
66766677
*/
66776678
vmx->nested.hv_evmcs_vmptr = EVMPTR_MAP_PENDING;
66786679
kvm_make_request(KVM_REQ_GET_NESTED_STATE_PAGES, vcpu);
6680+
#endif
66796681
} else {
66806682
return -EINVAL;
66816683
}

arch/x86/kvm/vmx/vmx.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4828,7 +4828,10 @@ static void __vmx_vcpu_reset(struct kvm_vcpu *vcpu)
48284828
vmx->nested.posted_intr_nv = -1;
48294829
vmx->nested.vmxon_ptr = INVALID_GPA;
48304830
vmx->nested.current_vmptr = INVALID_GPA;
4831+
4832+
#ifdef CONFIG_KVM_HYPERV
48314833
vmx->nested.hv_evmcs_vmptr = EVMPTR_INVALID;
4834+
#endif
48324835

48334836
vcpu->arch.microcode_version = 0x100000000ULL;
48344837
vmx->msr_ia32_feature_control_valid_bits = FEAT_CTL_LOCKED;

arch/x86/kvm/vmx/vmx.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,11 @@ struct nested_vmx {
241241
bool guest_mode;
242242
} smm;
243243

244+
#ifdef CONFIG_KVM_HYPERV
244245
gpa_t hv_evmcs_vmptr;
245246
struct kvm_host_map hv_evmcs_map;
246247
struct hv_enlightened_vmcs *hv_evmcs;
248+
#endif
247249
};
248250

249251
struct vcpu_vmx {

0 commit comments

Comments
 (0)