Re: [Patch v3 13/13] KVM: selftests: Test Hyper-V extended hypercall exit to userspace

From: David Matlack
Date: Fri Dec 09 2022 - 17:06:08 EST


On Mon, Dec 05, 2022 at 11:14:30AM -0800, Vipin Sharma wrote:
> Hyper-V extended hypercalls by default exit to userspace. Verify
> userspace gets the call, update the result and then verify in guest
> correct result is received.
>
> Signed-off-by: Vipin Sharma <vipinsh@xxxxxxxxxx>

Signed-off-by: David Matlack <dmatlack@xxxxxxxxxx>

> ---
[...]
> +++ b/tools/testing/selftests/kvm/x86_64/hyperv_extended_hypercalls.c
> @@ -0,0 +1,93 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * Test Hyper-V extended hypercall, HV_EXT_CALL_QUERY_CAPABILITIES (0x8001),
> + * exit to userspace and receive result in guest.
> + *
> + * Negative tests are present in hyperv_features.c
> + *
> + * Copyright 2022 Google LLC
> + * Author: Vipin Sharma <vipinsh@xxxxxxxxxx>
> + */
> +
> +#include "kvm_util.h"
> +#include "processor.h"
> +#include "hyperv.h"
> +
> +/* Any value is fine */
> +#define EXT_CAPABILITIES 0xbull
> +
> +static void guest_code(vm_vaddr_t in_pg_gpa, vm_vaddr_t out_pg_gpa,
> + vm_vaddr_t out_pg_gva)

nit: Use vm_paddr_t for guest physical addresses.