Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at master 39 lines 849 B view raw
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Copyright (C) 2022, Google LLC. 4 * 5 * Test for KVM_CAP_EXIT_ON_EMULATION_FAILURE. 6 */ 7#include "flds_emulation.h" 8#include "test_util.h" 9#include "ucall_common.h" 10 11#define MMIO_GPA 0x700000000 12#define MMIO_GVA MMIO_GPA 13 14static void guest_code(void) 15{ 16 /* Execute flds with an MMIO address to force KVM to emulate it. */ 17 flds(MMIO_GVA); 18 GUEST_DONE(); 19} 20 21int main(int argc, char *argv[]) 22{ 23 struct kvm_vcpu *vcpu; 24 struct kvm_vm *vm; 25 26 TEST_REQUIRE(kvm_has_cap(KVM_CAP_EXIT_ON_EMULATION_FAILURE)); 27 28 vm = vm_create_with_one_vcpu(&vcpu, guest_code); 29 vm_enable_cap(vm, KVM_CAP_EXIT_ON_EMULATION_FAILURE, 1); 30 virt_map(vm, MMIO_GVA, MMIO_GPA, 1); 31 32 vcpu_run(vcpu); 33 handle_flds_emulation_failure_exit(vcpu); 34 vcpu_run(vcpu); 35 TEST_ASSERT_EQ(get_ucall(vcpu, NULL), UCALL_DONE); 36 37 kvm_vm_free(vm); 38 return 0; 39}