Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Add cpufeaturebus and est(4) for Xen.



details:   https://anonhg.NetBSD.org/src/rev/fe219bd44ef7
branches:  trunk
changeset: 762598:fe219bd44ef7
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Thu Feb 24 04:42:54 2011 +0000

description:
Add cpufeaturebus and est(4) for Xen.

diffstat:

 sys/arch/amd64/conf/XEN3_DOM0 |   5 +++-
 sys/arch/i386/conf/XEN3_DOM0  |   5 +++-
 sys/arch/xen/conf/files.xen   |  16 +++++++++---
 sys/arch/xen/x86/cpu.c        |  53 +++++++++++++++++++++++++++++++++++-------
 4 files changed, 64 insertions(+), 15 deletions(-)

diffs (170 lines):

diff -r 622c751b3080 -r fe219bd44ef7 sys/arch/amd64/conf/XEN3_DOM0
--- a/sys/arch/amd64/conf/XEN3_DOM0     Thu Feb 24 04:28:41 2011 +0000
+++ b/sys/arch/amd64/conf/XEN3_DOM0     Thu Feb 24 04:42:54 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3_DOM0,v 1.62 2011/02/23 11:43:21 jruoho Exp $
+# $NetBSD: XEN3_DOM0,v 1.63 2011/02/24 04:42:54 jruoho Exp $
 
 include        "arch/amd64/conf/std.xen"
 
@@ -23,6 +23,9 @@
 # AMD PowerNow! and Cool`n'Quiet technology
 options                POWERNOW_K8
 
+# CPU features
+est0           at cpu0         # Intel Enhanced SpeedStep (non-ACPI)
+
 #options       MTRR            # memory-type range register syscall support
 
 #options       CONSDEVNAME="\"xencons\""
diff -r 622c751b3080 -r fe219bd44ef7 sys/arch/i386/conf/XEN3_DOM0
--- a/sys/arch/i386/conf/XEN3_DOM0      Thu Feb 24 04:28:41 2011 +0000
+++ b/sys/arch/i386/conf/XEN3_DOM0      Thu Feb 24 04:42:54 2011 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: XEN3_DOM0,v 1.43 2011/02/17 22:00:36 jym Exp $
+#      $NetBSD: XEN3_DOM0,v 1.44 2011/02/24 04:42:54 jruoho Exp $
 #
 #      XEN3_0: Xen 3.0 domain0 kernel
 
@@ -40,6 +40,9 @@
 # AMD PowerNow! and Cool`n'Quiet technology
 options        POWERNOW_K8
 
+# CPU features
+est0           at cpu0         # Intel Enhanced SpeedStep (non-ACPI)
+
 #options       MTRR            # memory-type range register syscall support
 
 #options       CONSDEVNAME="\"xencons\""
diff -r 622c751b3080 -r fe219bd44ef7 sys/arch/xen/conf/files.xen
--- a/sys/arch/xen/conf/files.xen       Thu Feb 24 04:28:41 2011 +0000
+++ b/sys/arch/xen/conf/files.xen       Thu Feb 24 04:42:54 2011 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.xen,v 1.111 2011/02/23 11:43:23 jruoho Exp $
+#      $NetBSD: files.xen,v 1.112 2011/02/24 04:42:54 jruoho Exp $
 #      NetBSD: files.x86,v 1.10 2003/10/08 17:30:00 bouyer Exp 
 #      NetBSD: files.i386,v 1.254 2004/03/25 23:32:10 jmc Exp 
 
@@ -161,6 +161,7 @@
 
 # xen specific mainbus attributes
 define cpubus { [apid = -1] }
+define cpufeaturebus {}
 define ioapicbus { [apid = -1] }
 define apmbus {}
 define pnpbiosbus {}
@@ -284,9 +285,9 @@
 attach ipmi at ipmibus
 file   arch/x86/x86/ipmi.c             ipmi needs-flag
 
-# CPUS
-
-device cpu
+# CPUs
+#
+device cpu: cpufeaturebus
 attach cpu at cpubus
 
 device vcpu
@@ -294,6 +295,13 @@
 
 file   arch/xen/x86/cpu.c              cpu | vcpu
 
+# CPU features
+#
+device est
+attach est at cpufeaturebus
+file   arch/x86/x86/est.c              est
+file   arch/x86/x86/intel_busclock.c   est
+
 #
 # Compatibility modules
 #
diff -r 622c751b3080 -r fe219bd44ef7 sys/arch/xen/x86/cpu.c
--- a/sys/arch/xen/x86/cpu.c    Thu Feb 24 04:28:41 2011 +0000
+++ b/sys/arch/xen/x86/cpu.c    Thu Feb 24 04:42:54 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.c,v 1.52 2010/11/14 13:43:04 bouyer Exp $  */
+/*     $NetBSD: cpu.c,v 1.53 2011/02/24 04:42:55 jruoho Exp $  */
 /* NetBSD: cpu.c,v 1.18 2004/02/20 17:35:01 yamt Exp  */
 
 /*-
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.52 2010/11/14 13:43:04 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.53 2011/02/24 04:42:55 jruoho Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -115,11 +115,13 @@
 #error cpu_info contains 32bit bitmasks
 #endif
 
-int     cpu_match(device_t, cfdata_t, void *);
-void    cpu_attach(device_t, device_t, void *);
-int     vcpu_match(device_t, cfdata_t, void *);
-void    vcpu_attach(device_t, device_t, void *);
-void    cpu_attach_common(device_t, device_t, void *);
+int    cpu_match(device_t, cfdata_t, void *);
+void   cpu_attach(device_t, device_t, void *);
+int    cpu_rescan(device_t, const char *, const int *);
+void   cpu_childdetached(device_t, device_t);
+int    vcpu_match(device_t, cfdata_t, void *);
+void   vcpu_attach(device_t, device_t, void *);
+void   cpu_attach_common(device_t, device_t, void *);
 void   cpu_offline_md(void);
 
 struct cpu_softc {
@@ -133,8 +135,9 @@
 const struct cpu_functions mp_cpu_funcs = { mp_cpu_start, NULL,
                                      mp_cpu_start_cleanup };
 
-CFATTACH_DECL_NEW(cpu, sizeof(struct cpu_softc),
-    cpu_match, cpu_attach, NULL, NULL);
+CFATTACH_DECL2_NEW(cpu, sizeof(struct cpu_softc),
+    cpu_match, cpu_attach, NULL, NULL, cpu_rescan, cpu_childdetached);
+
 CFATTACH_DECL_NEW(vcpu, sizeof(struct cpu_softc),
     vcpu_match, vcpu_attach, NULL, NULL);
 
@@ -271,6 +274,38 @@
 }
 
 int
+cpu_rescan(device_t self, const char *ifattr, const int *locators)
+{
+       struct cpu_softc *sc = device_private(self);
+       struct cpufeature_attach_args cfaa;
+       struct cpu_info *ci = sc->sc_info;
+
+       memset(&cfaa, 0, sizeof(cfaa));
+       cfaa.ci = ci;
+
+       if (ifattr_match(ifattr, "cpufeaturebus")) {
+
+               if (ci->ci_frequency == NULL) {
+                       cfaa.name = "est";
+                       ci->ci_frequency = config_found_ia(self,
+                           "cpufeaturebus", &cfaa, NULL);
+               }
+       }
+
+       return 0;
+}
+
+void
+cpu_childdetached(device_t self, device_t child)
+{
+       struct cpu_softc *sc = device_private(self);
+       struct cpu_info *ci = sc->sc_info;
+
+       if (ci->ci_frequency == child)
+               ci->ci_frequency = NULL;
+}
+
+int
 vcpu_match(device_t parent, cfdata_t match, void *aux)
 {
        struct vcpu_attach_args *vcaa = aux;



Home | Main Index | Thread Index | Old Index