Instead of setting a flag in the prepare callback, override the default value of the host IF flag in the prepare_gif_clear callback. Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx> --- x86/svm.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/x86/svm.c b/x86/svm.c index 63fda65..2cbd9fd 100644 --- a/x86/svm.c +++ b/x86/svm.c @@ -44,8 +44,6 @@ u64 runs; u8 *io_bitmap; u8 io_bitmap_area[16384]; -u8 set_host_if; - #define MSR_BITMAP_SIZE 8192 u8 *msr_bitmap; @@ -261,7 +259,6 @@ static void test_run(struct test *test, struct vmcb *vmcb) irq_disable(); test->vmcb = vmcb; - set_host_if = 1; test->prepare(test); vmcb->save.rip = (ulong)test_thunk; vmcb->save.rsp = (ulong)(guest_stack + ARRAY_SIZE(guest_stack)); @@ -325,8 +322,6 @@ static void default_prepare(struct test *test) static void default_prepare_gif_clear(struct test *test) { - if (!set_host_if) - asm("cli"); } static bool default_finished(struct test *test) @@ -1412,8 +1407,6 @@ static void pending_event_prepare_vmask(struct test *test) pending_event_ipi_fired = false; - set_host_if = 0; - handle_irq(0xf1, pending_event_ipi_isr); apic_icr_write(APIC_DEST_SELF | APIC_DEST_PHYSICAL | @@ -1422,6 +1415,11 @@ static void pending_event_prepare_vmask(struct test *test) set_test_stage(test, 0); } +static void pending_event_prepare_gif_clear_vmask(struct test *test) +{ + asm("cli"); +} + static void pending_event_test_vmask(struct test *test) { if (pending_event_ipi_fired == true) { @@ -1575,7 +1573,7 @@ static struct test tests[] = { default_prepare_gif_clear, pending_event_test, pending_event_finished, pending_event_check }, { "pending_event_vmask", default_supported, pending_event_prepare_vmask, - default_prepare_gif_clear, + pending_event_prepare_gif_clear_vmask, pending_event_test_vmask, pending_event_finished_vmask, pending_event_check_vmask }, }; -- 1.8.3.1