Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys Check from CPUID 0x06 %eax (on Intel) whether we might a...



details:   https://anonhg.NetBSD.org/src/rev/e177991b1f9f
branches:  trunk
changeset: 757240:e177991b1f9f
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Sat Aug 21 06:45:50 2010 +0000

description:
Check from CPUID 0x06 %eax (on Intel) whether we might actually have an
invariant APIC timer or an "ARAT" ("always running APIC timer"). This means
that the APIC timer may keep ticking at the same rate also in deep C-states
with some new or forthcoming Intel CPUs.

diffstat:

 sys/arch/x86/acpi/acpi_cpu_md.c |  26 +++++++++++++-------------
 sys/dev/acpi/acpi_cpu.h         |  19 ++++++++++---------
 2 files changed, 23 insertions(+), 22 deletions(-)

diffs (104 lines):

diff -r a74fd6ed98ff -r e177991b1f9f sys/arch/x86/acpi/acpi_cpu_md.c
--- a/sys/arch/x86/acpi/acpi_cpu_md.c   Sat Aug 21 06:41:09 2010 +0000
+++ b/sys/arch/x86/acpi/acpi_cpu_md.c   Sat Aug 21 06:45:50 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu_md.c,v 1.24 2010/08/21 05:10:43 jruoho Exp $ */
+/* $NetBSD: acpi_cpu_md.c,v 1.25 2010/08/21 06:45:50 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2010 Jukka Ruohonen <jruohonen%iki.fi@localhost>
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_md.c,v 1.24 2010/08/21 05:10:43 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_md.c,v 1.25 2010/08/21 06:45:50 jruoho Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -121,7 +121,7 @@
        if ((ci->ci_feat_val[1] & CPUID2_MONITOR) != 0)
                val |= ACPICPU_FLAG_C_FFH;
 
-       val |= ACPICPU_FLAG_C_TSC;
+       val |= ACPICPU_FLAG_C_APIC | ACPICPU_FLAG_C_TSC;
 
        switch (cpu_vendor) {
 
@@ -146,18 +146,22 @@
                        val |= ACPICPU_FLAG_T_FFH;
 
                /*
-                * See if MSR_APERF, MSR_MPERF,
-                * and Turbo Boost are available.
+                * Check whether MSR_APERF, MSR_MPERF, and Turbo
+                * Boost are available. Also see if we might have
+                * an invariant local APIC timer ("ARAT").
                 */
                if (cpuid_level >= 0x06) {
 
                        x86_cpuid(0x06, regs);
 
-                       if ((regs[2] & __BIT(0)) != 0)        /* ECX.06[0] */
+                       if ((regs[2] & __BIT(0)) != 0)          /* ECX.06[0] */
                                val |= ACPICPU_FLAG_P_HW;
 
-                       if ((regs[0] & __BIT(1)) != 0)        /* EAX.06[1] */
+                       if ((regs[0] & __BIT(1)) != 0)          /* EAX.06[1] */
                                val |= ACPICPU_FLAG_P_TURBO;
+
+                       if ((regs[0] & __BIT(2)) != 0)          /* EAX.06[2] */
+                               val &= ~ACPICPU_FLAG_C_APIC;
                }
 
                /*
@@ -419,12 +423,8 @@
         * When the state is P0 and Turbo Boost has been
         * detected, we need to skip the status check as
         * BIOS may not report right comparison values for
-        * the IA32_PERF_STATUS MSR. Note that this is a
-        * BIOS issue, and that for instance AMD documents
-        * clearly state that vendors should never expose
-        * "turbo" in the ACPI objects (namely, in _PSS).
-        *
-        * For discussion, see:
+        * the IA32_PERF_STATUS register. Note that this
+        * issue is specific to Intel. For discussion, see:
         *
         *      Intel Corporation: Intel Turbo Boost Technology
         *      in Intel Core(tm) Microarchitectures (Nehalem)
diff -r a74fd6ed98ff -r e177991b1f9f sys/dev/acpi/acpi_cpu.h
--- a/sys/dev/acpi/acpi_cpu.h   Sat Aug 21 06:41:09 2010 +0000
+++ b/sys/dev/acpi/acpi_cpu.h   Sat Aug 21 06:45:50 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu.h,v 1.21 2010/08/21 03:55:24 jruoho Exp $ */
+/* $NetBSD: acpi_cpu.h,v 1.22 2010/08/21 06:45:50 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2010 Jukka Ruohonen <jruohonen%iki.fi@localhost>
@@ -100,16 +100,17 @@
 #define ACPICPU_FLAG_C_BM       __BIT(6)       /* Bus master control        */
 #define ACPICPU_FLAG_C_BM_STS   __BIT(7)       /* Bus master check required */
 #define ACPICPU_FLAG_C_ARB      __BIT(8)       /* Bus master arbitration    */
-#define ACPICPU_FLAG_C_TSC      __BIT(9)       /* TSC broken with > C1      */
-#define ACPICPU_FLAG_C_C1E      __BIT(10)      /* AMD C1E detected          */
+#define ACPICPU_FLAG_C_TSC      __BIT(9)       /* TSC broken, > C1, Px, Tx  */
+#define ACPICPU_FLAG_C_APIC     __BIT(10)      /* APIC timer broken, > C1   */
+#define ACPICPU_FLAG_C_C1E      __BIT(11)      /* AMD C1E detected          */
 
-#define ACPICPU_FLAG_P_FFH      __BIT(11)      /* Native P-states           */
-#define ACPICPU_FLAG_P_HW       __BIT(12)      /* HW coordination supported */
-#define ACPICPU_FLAG_P_XPSS     __BIT(13)      /* Microsoft XPSS in use     */
-#define ACPICPU_FLAG_P_TURBO    __BIT(14)      /* Turbo Boost / Turbo Core  */
+#define ACPICPU_FLAG_P_FFH      __BIT(12)      /* Native P-states           */
+#define ACPICPU_FLAG_P_HW       __BIT(13)      /* HW coordination supported */
+#define ACPICPU_FLAG_P_XPSS     __BIT(14)      /* Microsoft XPSS in use     */
+#define ACPICPU_FLAG_P_TURBO    __BIT(15)      /* Turbo Boost / Turbo Core  */
 
-#define ACPICPU_FLAG_T_FFH      __BIT(15)      /* Native throttling         */
-#define ACPICPU_FLAG_T_FADT     __BIT(16)      /* Throttling with FADT      */
+#define ACPICPU_FLAG_T_FFH      __BIT(16)      /* Native throttling         */
+#define ACPICPU_FLAG_T_FADT     __BIT(17)      /* Throttling with FADT      */
 
 /*
  * This is AML_RESOURCE_GENERIC_REGISTER,



Home | Main Index | Thread Index | Old Index