WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] x86: clean up AMD Fam10 xenoprof IBS code

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] x86: clean up AMD Fam10 xenoprof IBS code
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 04 Nov 2010 16:50:36 -0700
Delivery-date: Thu, 04 Nov 2010 16:53:14 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir@xxxxxxx>
# Date 1288888597 0
# Node ID cb82fbef33666d61d7bfd5714bef076f928db6f7
# Parent  d9edb6b4b4a9cb33f6270df571dcdfcd014fc003
x86: clean up AMD Fam10 xenoprof IBS code

Arrange for (almost) no code to be generated for x86-32, where the
functionality is disabled anyway. Properly __init-annotate the code.
Remove some pointless bits.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---
 xen/arch/x86/oprofile/nmi_int.c         |    2 -
 xen/arch/x86/oprofile/op_model_athlon.c |   61 ++++++++++++++------------------
 xen/include/asm-x86/xenoprof.h          |    7 +++
 3 files changed, 35 insertions(+), 35 deletions(-)

diff -r d9edb6b4b4a9 -r cb82fbef3366 xen/arch/x86/oprofile/nmi_int.c
--- a/xen/arch/x86/oprofile/nmi_int.c   Thu Nov 04 16:35:58 2010 +0000
+++ b/xen/arch/x86/oprofile/nmi_int.c   Thu Nov 04 16:36:37 2010 +0000
@@ -431,7 +431,7 @@ static int __init nmi_init(void)
                        case 0x10:
                                model = &op_athlon_spec;
                                cpu_type = "x86-64/family10";
-                               ibs_caps = ibs_init();
+                               ibs_init();
                                break;
                        case 0x11:
                                model = &op_athlon_spec;
diff -r d9edb6b4b4a9 -r cb82fbef3366 xen/arch/x86/oprofile/op_model_athlon.c
--- a/xen/arch/x86/oprofile/op_model_athlon.c   Thu Nov 04 16:35:58 2010 +0000
+++ b/xen/arch/x86/oprofile/op_model_athlon.c   Thu Nov 04 16:36:37 2010 +0000
@@ -48,8 +48,12 @@ static unsigned long reset_value[NUM_COU
 
 extern char svm_stgi_label[];
 
+#ifdef CONFIG_X86_64
 u32 ibs_caps = 0;
 static u64 ibs_op_ctl;
+#else
+#define ibs_op_ctl 0
+#endif
 
 /* IBS cpuid feature detection */
 #define IBS_CPUID_FEATURES              0x8000001b
@@ -324,6 +328,7 @@ static int athlon_check_ctrs(unsigned in
 
 static inline void start_ibs(void)
 {
+#ifdef CONFIG_X86_64
        u64 val = 0;
 
        if (!ibs_caps)
@@ -361,6 +366,7 @@ static inline void start_ibs(void)
                val = op_amd_randomize_ibs_op(ibs_op_ctl);
                wrmsrl(MSR_AMD64_IBSOPCTL, val);
        }
+#endif
 }
  
 static void athlon_start(struct op_msrs const * const msrs)
@@ -407,11 +413,13 @@ static void athlon_stop(struct op_msrs c
        stop_ibs();
 }
 
+#ifdef CONFIG_X86_64
+
 #define IBSCTL_LVTOFFSETVAL             (1 << 8)
 #define APIC_EILVT_MSG_NMI              0x4
 #define APIC_EILVT_LVTOFF_IBS           1
 #define APIC_EILVTn(n)                  (0x500 + 0x10 * n)
-static inline void init_ibs_nmi_per_cpu(void *arg)
+static inline void __init init_ibs_nmi_per_cpu(void *arg)
 {
        unsigned long reg;
 
@@ -422,7 +430,7 @@ static inline void init_ibs_nmi_per_cpu(
 #define PCI_VENDOR_ID_AMD               0x1022
 #define PCI_DEVICE_ID_AMD_10H_NB_MISC   0x1203
 #define IBSCTL                          0x1cc
-static int init_ibs_nmi(void)
+static int __init init_ibs_nmi(void)
 {
        int bus, dev, func;
        u32 id, value;
@@ -438,10 +446,6 @@ static int init_ibs_nmi(void)
                        for (func = 0; func < 8; func++) {
                                id = pci_conf_read32(bus, dev, func, 
PCI_VENDOR_ID);
 
-                               if ((id == 0xffffffff) || (id == 0x00000000) ||
-                                       (id == 0x0000ffff) || (id == 
0xffff0000))
-                                       continue;
-
                                vendor_id = id & 0xffff;
                                dev_id = (id >> 16) & 0xffff;
 
@@ -456,7 +460,7 @@ static int init_ibs_nmi(void)
                                        if (value != (IBSCTL_LVTOFFSETVAL |
                                                APIC_EILVT_LVTOFF_IBS)) {
                                                printk("Xenoprofile: Failed to 
setup IBS LVT offset, "
-                                                       "IBSCTL = 0x%08x", 
value);
+                                                       "IBSCTL = %#08x\n", 
value);
                                                return 1;
                                        }
                                        nodes++;
@@ -466,55 +470,46 @@ static int init_ibs_nmi(void)
        }
 
        if (!nodes) {
-               printk("Xenoprofile: No CPU node configured for IBS");
+               printk("Xenoprofile: No CPU node configured for IBS\n");
                return 1;
        }
 
        return 0;
 }
 
-static u32 get_ibs_caps(void)
-{
-#ifdef CONFIG_X86_32
-       return 0;
-#else
+static void __init get_ibs_caps(void)
+{
        unsigned int max_level;
 
        if (!boot_cpu_has(X86_FEATURE_IBS))
-               return 0;
+               return;
 
     /* check IBS cpuid feature flags */
        max_level = cpuid_eax(0x80000000);
-       if (max_level < IBS_CPUID_FEATURES)
-               return IBS_CAPS_AVAIL;
-
-       ibs_caps = cpuid_eax(IBS_CPUID_FEATURES);
+       if (max_level >= IBS_CPUID_FEATURES)
+               ibs_caps = cpuid_eax(IBS_CPUID_FEATURES);
        if (!(ibs_caps & IBS_CAPS_AVAIL))
                /* cpuid flags not valid */
-               return IBS_CAPS_AVAIL;
-
-       return ibs_caps;
-#endif
-}
-
-u32 ibs_init(void)
-{
-       u32 ibs_caps = 0;
-
-       ibs_caps = get_ibs_caps();
+               ibs_caps = 0;
+}
+
+void __init ibs_init(void)
+{
+       get_ibs_caps();
 
        if ( !ibs_caps )
-               return 0;
+               return;
 
        if (init_ibs_nmi()) {
                ibs_caps = 0;
-               return 0;
+               return;
        }
 
        printk("Xenoprofile: AMD IBS detected (0x%08x)\n",
                (unsigned)ibs_caps);
-       return ibs_caps;
-}
+}
+
+#endif /* CONFIG_X86_64 */
 
 struct op_x86_model_spec const op_athlon_spec = {
        .num_counters = NUM_COUNTERS,
diff -r d9edb6b4b4a9 -r cb82fbef3366 xen/include/asm-x86/xenoprof.h
--- a/xen/include/asm-x86/xenoprof.h    Thu Nov 04 16:35:58 2010 +0000
+++ b/xen/include/asm-x86/xenoprof.h    Thu Nov 04 16:36:37 2010 +0000
@@ -48,8 +48,13 @@ struct cpu_user_regs;
 struct cpu_user_regs;
 
 /* AMD IBS support */
-u32 ibs_init(void);
+#ifdef CONFIG_X86_64
+void ibs_init(void);
 extern u32 ibs_caps;
+#else
+static inline void ibs_init(void) {}
+#define ibs_caps 0
+#endif
 
 int xenoprofile_get_mode(struct vcpu *v, struct cpu_user_regs * const regs);
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] x86: clean up AMD Fam10 xenoprof IBS code, Xen patchbot-unstable <=