9
9
#include <linux/stringify.h>
10
10
#include <stdint.h>
11
11
12
+ #include "kvm_test_harness.h"
12
13
#include "apic.h"
13
14
#include "test_util.h"
14
15
#include "kvm_util.h"
@@ -83,6 +84,8 @@ static void guest_main(void)
83
84
GUEST_DONE ();
84
85
}
85
86
87
+ KVM_ONE_VCPU_TEST_SUITE (fix_hypercall );
88
+
86
89
static void enter_guest (struct kvm_vcpu * vcpu )
87
90
{
88
91
struct kvm_run * run = vcpu -> run ;
@@ -103,14 +106,11 @@ static void enter_guest(struct kvm_vcpu *vcpu)
103
106
}
104
107
}
105
108
106
- static void test_fix_hypercall (bool disable_quirk )
109
+ static void test_fix_hypercall (struct kvm_vcpu * vcpu , bool disable_quirk )
107
110
{
108
- struct kvm_vcpu * vcpu ;
109
- struct kvm_vm * vm ;
110
-
111
- vm = vm_create_with_one_vcpu (& vcpu , guest_main );
111
+ struct kvm_vm * vm = vcpu -> vm ;
112
112
113
- vm_init_descriptor_tables (vcpu -> vm );
113
+ vm_init_descriptor_tables (vm );
114
114
vcpu_init_descriptor_tables (vcpu );
115
115
vm_install_exception_handler (vcpu -> vm , UD_VECTOR , guest_ud_handler );
116
116
@@ -126,10 +126,19 @@ static void test_fix_hypercall(bool disable_quirk)
126
126
enter_guest (vcpu );
127
127
}
128
128
129
- int main (void )
129
+ KVM_ONE_VCPU_TEST (fix_hypercall , enable_quirk , guest_main )
130
+ {
131
+ test_fix_hypercall (vcpu , false);
132
+ }
133
+
134
+ KVM_ONE_VCPU_TEST (fix_hypercall , disable_quirk , guest_main )
135
+ {
136
+ test_fix_hypercall (vcpu , true);
137
+ }
138
+
139
+ int main (int argc , char * argv [])
130
140
{
131
141
TEST_REQUIRE (kvm_check_cap (KVM_CAP_DISABLE_QUIRKS2 ) & KVM_X86_QUIRK_FIX_HYPERCALL_INSN );
132
142
133
- test_fix_hypercall (false);
134
- test_fix_hypercall (true);
143
+ return test_harness_run (argc , argv );
135
144
}
0 commit comments