[PATCH 07/15] hyperv: dedup cpuid definitions

From: Roman Kagan
Date: Tue Dec 20 2016 - 13:31:29 EST


Use the definitions already present in the uapi header throughout the
guest driver, too.

Signed-off-by: Roman Kagan <rkagan@xxxxxxxxxxxxx>
---
drivers/hv/hyperv_vmbus.h | 19 -------------------
drivers/hv/hv.c | 6 +++---
2 files changed, 3 insertions(+), 22 deletions(-)

diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h
index 4fab154..9b0f1c9 100644
--- a/drivers/hv/hyperv_vmbus.h
+++ b/drivers/hv/hyperv_vmbus.h
@@ -39,25 +39,6 @@
*/
#define HV_UTIL_NEGO_TIMEOUT 55

-/*
- * The below CPUID leaves are present if VersionAndFeatures.HypervisorPresent
- * is set by CPUID(HVCPUID_VERSION_FEATURES).
- */
-enum hv_cpuid_function {
- HVCPUID_VERSION_FEATURES = 0x00000001,
- HVCPUID_VENDOR_MAXFUNCTION = 0x40000000,
- HVCPUID_INTERFACE = 0x40000001,
-
- /*
- * The remaining functions depend on the value of
- * HVCPUID_INTERFACE
- */
- HVCPUID_VERSION = 0x40000002,
- HVCPUID_FEATURES = 0x40000003,
- HVCPUID_ENLIGHTENMENT_INFO = 0x40000004,
- HVCPUID_IMPLEMENTATION_LIMITS = 0x40000005,
-};
-
#define HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE 0x400

#define HV_X64_MSR_CRASH_P0 0x40000100
diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
index b40c7d9..dddba07 100644
--- a/drivers/hv/hv.c
+++ b/drivers/hv/hv.c
@@ -69,17 +69,17 @@ static int query_hypervisor_info(void)
ebx = 0;
ecx = 0;
edx = 0;
- op = HVCPUID_VENDOR_MAXFUNCTION;
+ op = HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS;
cpuid(op, &eax, &ebx, &ecx, &edx);

max_leaf = eax;

- if (max_leaf >= HVCPUID_VERSION) {
+ if (max_leaf >= HYPERV_CPUID_VERSION) {
eax = 0;
ebx = 0;
ecx = 0;
edx = 0;
- op = HVCPUID_VERSION;
+ op = HYPERV_CPUID_VERSION;
cpuid(op, &eax, &ebx, &ecx, &edx);
host_info_eax = eax;
host_info_ebx = ebx;
--
2.9.3