Re: [PATCH 3/3] KVM: selftests: Add EVTCHNOP_send slow path test to xen_shinfo_test

From: Sean Christopherson
Date: Fri Feb 03 2023 - 21:32:55 EST


On Fri, Jan 13, 2023, David Woodhouse wrote:
> @@ -57,6 +60,7 @@ enum {
> TEST_EVTCHN_SLOWPATH,
> TEST_EVTCHN_SEND_IOCTL,
> TEST_EVTCHN_HCALL,
> + TEST_EVTCHN_HCALL_SLOWPATH,
> TEST_EVTCHN_HCALL_EVENTFD,
> TEST_TIMER_SETUP,
> TEST_TIMER_WAIT,
> @@ -270,6 +274,20 @@ static void guest_code(void)
>
> guest_wait_for_irq();
>
> + GUEST_SYNC(TEST_EVTCHN_HCALL_SLOWPATH);
> +
> + /* Same again, but this time the host has messed with memslots
> + * so it should take the slow path in kvm_xen_set_evtchn(). */

/*
* https://lore.kernel.org/all/CA+55aFyQYJerovMsSoSKS7PessZBr4vNp-3QUUwhqk4A4_jcbg@xxxxxxxxxxxxxx
*/

> + __asm__ __volatile__ ("vmcall" :
> + "=a" (rax) :
> + "a" (__HYPERVISOR_event_channel_op),
> + "D" (EVTCHNOP_send),
> + "S" (&s));
> +
> + GUEST_ASSERT(rax == 0);

There's a lot of copy+paste in this file, and we really should do VMMCALL when
running on AMD. That's easy to do with some changes that are in the queue for
6.3. I'll repost these selftest patches on top of a few patches to add helpers for
doing hypercalls using the Xen ABI.