Author: sephe
Date: Mon Apr 11 06:15:40 2016
New Revision: 297807
URL: https://svnweb.freebsd.org/changeset/base/297807

Log:
  hyperv: Print more features
  
  And add comment about the MSR features.
  
  MFC after:    1 week
  Sponsored by: Microsoft OSTC

Modified:
  head/sys/dev/hyperv/vmbus/hv_hv.c
  head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h

Modified: head/sys/dev/hyperv/vmbus/hv_hv.c
==============================================================================
--- head/sys/dev/hyperv/vmbus/hv_hv.c   Mon Apr 11 05:09:43 2016        
(r297806)
+++ head/sys/dev/hyperv/vmbus/hv_hv.c   Mon Apr 11 06:15:40 2016        
(r297807)
@@ -54,6 +54,9 @@ static u_int hv_get_timecount(struct tim
 u_int  hyperv_features;
 u_int  hyperv_recommends;
 
+static u_int   hyperv_pm_features;
+static u_int   hyperv_features3;
+
 /**
  * Globals
  */
@@ -426,27 +429,50 @@ hyperv_identify(void)
                return (false);
        }
        hyperv_features = regs[0];
+       hyperv_pm_features = regs[2];
+       hyperv_features3 = regs[3];
 
        op = HV_CPU_ID_FUNCTION_MS_HV_VERSION;
        do_cpuid(op, regs);
        printf("Hyper-V Version: %d.%d.%d [SP%d]\n",
            regs[1] >> 16, regs[1] & 0xffff, regs[0], regs[2]);
 
-       printf("  Features: 0x%b\n", hyperv_features,
+       printf("  Features=0x%b\n", hyperv_features,
+           "\020"
+           "\001VPRUNTIME"     /* MSR_VP_RUNTIME */
+           "\002TMREFCNT"      /* MSR_TIME_REF_COUNT */
+           "\003SYNIC"         /* MSRs for SynIC */
+           "\004SYNTM"         /* MSRs for SynTimer */
+           "\005APIC"          /* MSR_{EOI,ICR,TPR} */
+           "\006HYERCALL"      /* MSR_{GUEST_OS_ID,HYPERCALL} */
+           "\007VPINDEX"       /* MSR_VP_INDEX */
+           "\010RESET"         /* MSR_RESET */
+           "\011STATS"         /* MSR_STATS_ */
+           "\012REFTSC"        /* MSR_REFERENCE_TSC */
+           "\013IDLE"          /* MSR_GUEST_IDLE */
+           "\014TMFREQ"        /* MSR_{TSC,APIC}_FREQUENCY */
+           "\015DEBUG");       /* MSR_SYNTH_DEBUG_ */
+       printf("  PM Features=max C%u, 0x%b\n",
+           HV_PM_FEATURE_CSTATE(hyperv_pm_features),
+           (hyperv_pm_features & ~HV_PM_FEATURE_CSTATE_MASK),
+           "\020"
+           "\005C3HPET");      /* HPET is required for C3 state */
+       printf("  Features3=0x%b\n", hyperv_features3,
            "\020"
-           "\001VPRUNTIME"
-           "\002TMREFCNT"
-           "\003SYNCIC"
-           "\004SYNCTM"
-           "\005APIC"
-           "\006HYERCALL"
-           "\007VPINDEX"
-           "\010RESET"
-           "\011STATS"
-           "\012REFTSC"
-           "\013IDLE"
-           "\014TMFREQ"
-           "\015DEBUG");
+           "\001MWAIT"         /* MWAIT */
+           "\002DEBUG"         /* guest debug support */
+           "\003PERFMON"       /* performance monitor */
+           "\004PCPUDPE"       /* physical CPU dynamic partition event */
+           "\005XMMHC"         /* hypercall input through XMM regs */
+           "\006IDLE"          /* guest idle support */
+           "\007SLEEP"         /* hypervisor sleep support */
+           "\010NUMA"          /* NUMA distance query support */
+           "\011TMFREQ"        /* timer frequency query (TSC, LAPIC) */
+           "\012SYNCMC"        /* inject synthetic machine checks */
+           "\013CRASH"         /* MSRs for guest crash */
+           "\014DEBUGMSR"      /* MSRs for guest debug */
+           "\015NPIEP"         /* NPIEP */
+           "\016HVDIS");       /* disabling hypervisor */
 
        op = HV_CPU_ID_FUNCTION_MS_HV_ENLIGHTENMENT_INFORMATION;
        do_cpuid(op, regs);

Modified: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h
==============================================================================
--- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h   Mon Apr 11 05:09:43 2016        
(r297806)
+++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h   Mon Apr 11 06:15:40 2016        
(r297807)
@@ -475,12 +475,23 @@ typedef enum {
        HV_CPU_ID_FUNCTION_MS_HV_HARDWARE_FEATURE               = 0x40000006
 } hv_vmbus_cpuid_function;
 
-#define        HV_FEATURE_MSR_TIME_REFCNT      (1 << 1)
-#define        HV_FEATURE_MSR_SYNCIC           (1 << 2)
-#define        HV_FEATURE_MSR_STIMER           (1 << 3)
-#define        HV_FEATURE_MSR_APIC             (1 << 4)
-#define        HV_FEATURE_MSR_HYPERCALL        (1 << 5)
-#define        HV_FEATURE_MSR_GUEST_IDLE       (1 << 10)
+#define        HV_FEATURE_MSR_TIME_REFCNT      0x0002  /* MSR_TIME_REF_COUNT */
+#define        HV_FEATURE_MSR_SYNIC            0x0004  /* MSRs for SynIC */
+#define        HV_FEATURE_MSR_SYNTIMER         0x0008  /* MSRs for SynTimer */
+#define        HV_FEATURE_MSR_APIC             0x0010  /* MSR_{EOI,ICR,TPR} */
+#define        HV_FEATURE_MSR_HYPERCALL        0x0020  /* 
MSR_{GUEST_OS_ID,HYPERCALL} */
+#define        HV_FEATURE_MSR_GUEST_IDLE       0x0400  /* MSR_GUEST_IDLE */
+
+#define        HV_PM_FEATURE_CSTATE_MASK       0x000f
+#define        HV_PM_FEATURE_C3_HPET           0x0010  /* C3 requires HPET */
+#define        HV_PM_FEATURE_CSTATE(f)         ((f) & 
HV_PM_FEATURE_CSTATE_MASK)
+
+#define        HV_FEATURE3_MWAIT               0x0001  /* MWAIT */
+#define        HV_FEATURE3_XMM_HYPERCALL       0x0010  /* hypercall input 
through XMM regs */
+#define        HV_FEATURE3_GUEST_IDLE          0x0020  /* guest idle support */
+#define        HV_FEATURE3_NUMA                0x0080  /* NUMA distance query 
support */
+#define        HV_FEATURE3_TIME_FREQ           0x0100  /* timer frequency 
query (TSC, LAPIC) */
+#define        HV_FEATURE3_MSR_CRASH           0x0400  /* MSRs for guest crash 
*/
 
 /*
  * Define the format of the SIMP register
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to