mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: Vipin Sharma <vipinsh@google.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	seanjc@google.com, pbonzini@redhat.com, dmatlack@google.com
Subject: Re: [PATCH v2 3/6] KVM: selftests: Test Hyper-V extended hypercall enablement
Date: Tue, 22 Nov 2022 17:02:03 +0100	[thread overview]
Message-ID: <87h6yrou4k.fsf@ovpn-194-185.brq.redhat.com> (raw)
In-Reply-To: <20221121234026.3037083-4-vipinsh@google.com>

Vipin Sharma <vipinsh@google.com> writes:

> Test Hyper-V extended hypercall, HV_EXT_CALL_QUERY_CAPABILITIES
> (0x8001), access denied and invalid parameter
> cases.
>
> Access is denied if CPUID.0x40000003.EBX BIT(20) is not set.
> Invalid parameter if call has fast bit set.
>
> Signed-off-by: Vipin Sharma <vipinsh@google.com>
> ---
>  tools/testing/selftests/kvm/include/x86_64/hyperv.h  | 4 ++++
>  tools/testing/selftests/kvm/x86_64/hyperv_features.c | 9 +++++++++
>  2 files changed, 13 insertions(+)
>
> diff --git a/tools/testing/selftests/kvm/include/x86_64/hyperv.h b/tools/testing/selftests/kvm/include/x86_64/hyperv.h
> index 9218bb5f44bf..8813c1bb74a0 100644
> --- a/tools/testing/selftests/kvm/include/x86_64/hyperv.h
> +++ b/tools/testing/selftests/kvm/include/x86_64/hyperv.h
> @@ -112,6 +112,7 @@
>  #define HV_ACCESS_STATS				BIT(8)
>  #define HV_DEBUGGING				BIT(11)
>  #define HV_CPU_MANAGEMENT			BIT(12)
> +#define HV_ENABLE_EXTENDED_HYPERCALLS		BIT(20)
>  #define HV_ISOLATION				BIT(22)
>  
>  /* HYPERV_CPUID_FEATURES.EDX */
> @@ -166,6 +167,9 @@
>  #define HVCALL_FLUSH_GUEST_PHYSICAL_ADDRESS_SPACE 0x00af
>  #define HVCALL_FLUSH_GUEST_PHYSICAL_ADDRESS_LIST 0x00b0
>  
> +/* Extended hypercalls */
> +#define HV_EXT_CALL_QUERY_CAPABILITIES		0x8001
> +
>  #define HV_FLUSH_ALL_PROCESSORS			BIT(0)
>  #define HV_FLUSH_ALL_VIRTUAL_ADDRESS_SPACES	BIT(1)
>  #define HV_FLUSH_NON_GLOBAL_MAPPINGS_ONLY	BIT(2)
> diff --git a/tools/testing/selftests/kvm/x86_64/hyperv_features.c b/tools/testing/selftests/kvm/x86_64/hyperv_features.c
> index 3163c3e8db0a..a5a3146fc299 100644
> --- a/tools/testing/selftests/kvm/x86_64/hyperv_features.c
> +++ b/tools/testing/selftests/kvm/x86_64/hyperv_features.c
> @@ -583,6 +583,15 @@ static void guest_test_hcalls_access(void)
>  			hcall->expect = HV_STATUS_SUCCESS;
>  			break;
>  		case 19:
> +			hcall->control = HV_EXT_CALL_QUERY_CAPABILITIES;
> +			hcall->expect = HV_STATUS_ACCESS_DENIED;
> +			break;
> +		case 20:
> +			feat->ebx |= HV_ENABLE_EXTENDED_HYPERCALLS;

As I've mentioned on another patch, things look significantly better
after https://lore.kernel.org/kvm/20221013095849.705943-6-vkuznets@redhat.com/
cleanup, hope we can have it in soon.

> +			hcall->control = HV_EXT_CALL_QUERY_CAPABILITIES | HV_HYPERCALL_FAST_BIT;
> +			hcall->expect = HV_STATUS_INVALID_PARAMETER;
> +			break;
> +		case 21:
>  			kvm_vm_free(vm);
>  			return;
>  		}

-- 
Vitaly


  reply	other threads:[~2022-11-22 16:03 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-21 23:40 [PATCH v2 0/6] Add Hyper-v extended hypercall support in KVM Vipin Sharma
2022-11-21 23:40 ` [PATCH v2 1/6] KVM: x86: hyper-v: Use common code for hypercall userspace exit Vipin Sharma
2022-11-22 16:04   ` Vitaly Kuznetsov
2022-11-22 19:58     ` Sean Christopherson
2022-11-23 20:01       ` Vipin Sharma
2022-11-21 23:40 ` [PATCH v2 2/6] KVM: x86: hyper-v: Add extended hypercall support in Hyper-v Vipin Sharma
2022-11-22 16:29   ` Vitaly Kuznetsov
2022-11-23 19:43     ` Vipin Sharma
2022-11-24  8:36       ` Vitaly Kuznetsov
2022-11-24  9:03         ` Vipin Sharma
2022-11-24  9:28           ` Vitaly Kuznetsov
2022-11-21 23:40 ` [PATCH v2 3/6] KVM: selftests: Test Hyper-V extended hypercall enablement Vipin Sharma
2022-11-22 16:02   ` Vitaly Kuznetsov [this message]
2022-11-21 23:40 ` [PATCH v2 4/6] KVM: selftests: Replace hardcoded Linux OS id with HYPERV_LINUX_OS_ID Vipin Sharma
2022-11-22 16:00   ` Vitaly Kuznetsov
2022-11-21 23:40 ` [PATCH v2 5/6] KVM: selftests: Make vCPU exit reason test assertion common Vipin Sharma
2022-11-21 23:40 ` [PATCH v2 6/6] KVM: selftests: Test Hyper-V extended hypercall exit to userspace Vipin Sharma
2022-11-22 15:57   ` Vitaly Kuznetsov
2022-11-23 19:33     ` Vipin Sharma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h6yrou4k.fsf@ovpn-194-185.brq.redhat.com \
    --to=vkuznets@redhat.com \
    --cc=dmatlack@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=vipinsh@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®