Test Extended hypercall CPUID enablement
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 b66910702c0a..075fd29071a6 100644
--- a/tools/testing/selftests/kvm/include/x86_64/hyperv.h
+++ b/tools/testing/selftests/kvm/include/x86_64/hyperv.h
@@ -110,6 +110,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 */
@@ -164,6 +165,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 05b32e550a80..6b443ce456b6 100644
--- a/tools/testing/selftests/kvm/x86_64/hyperv_features.c
+++ b/tools/testing/selftests/kvm/x86_64/hyperv_features.c
@@ -602,6 +602,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;
+ 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;
}
--
2.38.1.273.g43a17bfeac-goog
On Fri, Nov 04, 2022 at 09:57:01PM -0700, Vipin Sharma wrote: > Test Extended hypercall CPUID enablement nit: Use complete sentences and provide more details on what exactly is being tested. The rest of the commit messages look pretty good so I assume you just forgot to fill this one in fully before sending to the mailing list :) > > 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 b66910702c0a..075fd29071a6 100644 > --- a/tools/testing/selftests/kvm/include/x86_64/hyperv.h > +++ b/tools/testing/selftests/kvm/include/x86_64/hyperv.h > @@ -110,6 +110,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 */ > @@ -164,6 +165,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 05b32e550a80..6b443ce456b6 100644 > --- a/tools/testing/selftests/kvm/x86_64/hyperv_features.c > +++ b/tools/testing/selftests/kvm/x86_64/hyperv_features.c > @@ -602,6 +602,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; > + 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; > } > -- > 2.38.1.273.g43a17bfeac-goog >
On Mon, Nov 7, 2022 at 10:27 AM David Matlack <dmatlack@google.com> wrote: > > On Fri, Nov 04, 2022 at 09:57:01PM -0700, Vipin Sharma wrote: > > Test Extended hypercall CPUID enablement > > nit: Use complete sentences and provide more details on what exactly > is being tested. > > The rest of the commit messages look pretty good so I assume you just > forgot to fill this one in fully before sending to the mailing list :) > Missed it, I will update it. > > > > 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 b66910702c0a..075fd29071a6 100644 > > --- a/tools/testing/selftests/kvm/include/x86_64/hyperv.h > > +++ b/tools/testing/selftests/kvm/include/x86_64/hyperv.h > > @@ -110,6 +110,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 */ > > @@ -164,6 +165,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 05b32e550a80..6b443ce456b6 100644 > > --- a/tools/testing/selftests/kvm/x86_64/hyperv_features.c > > +++ b/tools/testing/selftests/kvm/x86_64/hyperv_features.c > > @@ -602,6 +602,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; > > + 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; > > } > > -- > > 2.38.1.273.g43a17bfeac-goog > >
© 2016 - 2026 Red Hat, Inc.