Merge tag 'kvm-x86-hyperv-6.8' of https://github.com/kvm-x86/linux into HEAD
KVM x86 Hyper-V changes for 6.8: - Guard KVM-on-HyperV's range-based TLB flush hooks with an #ifdef on CONFIG_HYPERV as a minor optimization, and to self-document the code. - Add CONFIG_KVM_HYPERV to allow disabling KVM support for HyperV "emulation" at build time.
This commit is contained in:
@@ -211,6 +211,8 @@ int main(void)
|
||||
vm_vaddr_t tsc_page_gva;
|
||||
int stage;
|
||||
|
||||
TEST_REQUIRE(kvm_has_cap(KVM_CAP_HYPERV_TIME));
|
||||
|
||||
vm = vm_create_with_one_vcpu(&vcpu, guest_main);
|
||||
|
||||
vcpu_set_hv_cpuid(vcpu);
|
||||
|
||||
@@ -240,11 +240,12 @@ int main(int argc, char *argv[])
|
||||
struct ucall uc;
|
||||
int stage;
|
||||
|
||||
vm = vm_create_with_one_vcpu(&vcpu, guest_code);
|
||||
|
||||
TEST_REQUIRE(kvm_cpu_has(X86_FEATURE_VMX));
|
||||
TEST_REQUIRE(kvm_has_cap(KVM_CAP_NESTED_STATE));
|
||||
TEST_REQUIRE(kvm_has_cap(KVM_CAP_HYPERV_ENLIGHTENED_VMCS));
|
||||
TEST_REQUIRE(kvm_has_cap(KVM_CAP_HYPERV_DIRECT_TLBFLUSH));
|
||||
|
||||
vm = vm_create_with_one_vcpu(&vcpu, guest_code);
|
||||
|
||||
hcall_page = vm_vaddr_alloc_pages(vm, 1);
|
||||
memset(addr_gva2hva(vm, hcall_page), 0x0, getpagesize());
|
||||
|
||||
@@ -43,6 +43,8 @@ int main(void)
|
||||
uint64_t *outval;
|
||||
struct ucall uc;
|
||||
|
||||
TEST_REQUIRE(kvm_has_cap(KVM_CAP_HYPERV_CPUID));
|
||||
|
||||
/* Verify if extended hypercalls are supported */
|
||||
if (!kvm_cpuid_has(kvm_get_supported_hv_cpuid(),
|
||||
HV_ENABLE_EXTENDED_HYPERCALLS)) {
|
||||
|
||||
@@ -690,6 +690,8 @@ static void guest_test_hcalls_access(void)
|
||||
|
||||
int main(void)
|
||||
{
|
||||
TEST_REQUIRE(kvm_has_cap(KVM_CAP_HYPERV_ENFORCE_CPUID));
|
||||
|
||||
pr_info("Testing access to Hyper-V specific MSRs\n");
|
||||
guest_test_msrs_access();
|
||||
|
||||
|
||||
@@ -248,6 +248,8 @@ int main(int argc, char *argv[])
|
||||
int stage = 1, r;
|
||||
struct ucall uc;
|
||||
|
||||
TEST_REQUIRE(kvm_has_cap(KVM_CAP_HYPERV_SEND_IPI));
|
||||
|
||||
vm = vm_create_with_one_vcpu(&vcpu[0], sender_guest_code);
|
||||
|
||||
/* Hypercall input/output */
|
||||
|
||||
@@ -158,6 +158,7 @@ int main(int argc, char *argv[])
|
||||
int stage;
|
||||
|
||||
TEST_REQUIRE(kvm_cpu_has(X86_FEATURE_SVM));
|
||||
TEST_REQUIRE(kvm_has_cap(KVM_CAP_HYPERV_DIRECT_TLBFLUSH));
|
||||
|
||||
/* Create VM */
|
||||
vm = vm_create_with_one_vcpu(&vcpu, guest_code);
|
||||
|
||||
@@ -590,6 +590,8 @@ int main(int argc, char *argv[])
|
||||
struct ucall uc;
|
||||
int stage = 1, r, i;
|
||||
|
||||
TEST_REQUIRE(kvm_has_cap(KVM_CAP_HYPERV_TLBFLUSH));
|
||||
|
||||
vm = vm_create_with_one_vcpu(&vcpu[0], sender_guest_code);
|
||||
|
||||
/* Test data page */
|
||||
|
||||
@@ -125,21 +125,25 @@ void test_vmx_nested_state(struct kvm_vcpu *vcpu)
|
||||
|
||||
/*
|
||||
* Setting vmxon_pa == -1ull and vmcs_pa == -1ull exits early without
|
||||
* setting the nested state but flags other than eVMCS must be clear.
|
||||
* The eVMCS flag can be set if the enlightened VMCS capability has
|
||||
* been enabled.
|
||||
* setting the nested state. When the eVMCS flag is not set, the
|
||||
* expected return value is '0'.
|
||||
*/
|
||||
set_default_vmx_state(state, state_sz);
|
||||
state->flags = 0;
|
||||
state->hdr.vmx.vmxon_pa = -1ull;
|
||||
state->hdr.vmx.vmcs12_pa = -1ull;
|
||||
test_nested_state_expect_einval(vcpu, state);
|
||||
test_nested_state(vcpu, state);
|
||||
|
||||
state->flags &= KVM_STATE_NESTED_EVMCS;
|
||||
/*
|
||||
* When eVMCS is supported, the eVMCS flag can only be set if the
|
||||
* enlightened VMCS capability has been enabled.
|
||||
*/
|
||||
if (have_evmcs) {
|
||||
state->flags = KVM_STATE_NESTED_EVMCS;
|
||||
test_nested_state_expect_einval(vcpu, state);
|
||||
vcpu_enable_evmcs(vcpu);
|
||||
test_nested_state(vcpu, state);
|
||||
}
|
||||
test_nested_state(vcpu, state);
|
||||
|
||||
/* It is invalid to have vmxon_pa == -1ull and SMM flags non-zero. */
|
||||
state->hdr.vmx.smm.flags = 1;
|
||||
|
||||
Reference in New Issue
Block a user