Daniel J Blueman
2014-10-15 12:53:06 UTC
Fix APIC declaration to be consistent with definition; this addresses
a compilation failure with the development branch of GCC, see:
https://bugzilla.kernel.org/show_bug.cgi?id=78251
Fix 16-bit APIC ID truncation and redundant APIC ICR idle polling
for IPI to self (AMD64 APICs are documented in the system developer
manuals to queue APIC writes).
Finally, add safe function to check if Numachip is detected, to be
used elsewhere.
Candidate for stable.
Signed-off-by: Daniel J Blueman <***@numascale.com>
Reviewed-by: Steffen Persvold <***@numascale.com>
---
arch/x86/include/asm/numachip/numachip.h | 9 +++++++++
arch/x86/kernel/apic/apic_numachip.c | 12 ++++++++----
2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/arch/x86/include/asm/numachip/numachip.h b/arch/x86/include/asm/numachip/numachip.h
index 1c6f7f6..3e1f4f9 100644
--- a/arch/x86/include/asm/numachip/numachip.h
+++ b/arch/x86/include/asm/numachip/numachip.h
@@ -16,4 +16,13 @@
extern int __init pci_numachip_init(void);
+#ifdef CONFIG_X86_NUMACHIP
+extern bool is_numachip_system(void);
+#else
+static inline bool is_numachip_system(void)
+{
+ return 0;
+}
+#endif
+
#endif /* _ASM_X86_NUMACHIP_NUMACHIP_H */
diff --git a/arch/x86/kernel/apic/apic_numachip.c b/arch/x86/kernel/apic/apic_numachip.c
index ae91539..4156470 100644
--- a/arch/x86/kernel/apic/apic_numachip.c
+++ b/arch/x86/kernel/apic/apic_numachip.c
@@ -30,9 +30,13 @@
#include <asm/apic_flat_64.h>
#include <asm/pgtable.h>
-static int numachip_system __read_mostly;
+static bool numachip_system __read_mostly;
+static const struct apic apic_numachip __refconst;
-static const struct apic apic_numachip __read_mostly;
+bool is_numachip_system(void)
+{
+ return numachip_system;
+}
static unsigned int get_apic_id(unsigned long x)
{
@@ -40,7 +44,7 @@ static unsigned int get_apic_id(unsigned long x)
unsigned int id;
rdmsrl(MSR_FAM10H_NODE_ID, value);
- id = ((x >> 24) & 0xffU) | ((value << 2) & 0x3f00U);
+ id = ((x >> 24) & 0xffU) | ((value << 2) & 0xff00U);
return id;
}
@@ -145,7 +149,7 @@ static void numachip_send_IPI_all(int vector)
static void numachip_send_IPI_self(int vector)
{
- __default_send_IPI_shortcut(APIC_DEST_SELF, vector, APIC_DEST_PHYSICAL);
+ apic_write(APIC_SELF_IPI, vector);
}
static int __init numachip_probe(void)
a compilation failure with the development branch of GCC, see:
https://bugzilla.kernel.org/show_bug.cgi?id=78251
Fix 16-bit APIC ID truncation and redundant APIC ICR idle polling
for IPI to self (AMD64 APICs are documented in the system developer
manuals to queue APIC writes).
Finally, add safe function to check if Numachip is detected, to be
used elsewhere.
Candidate for stable.
Signed-off-by: Daniel J Blueman <***@numascale.com>
Reviewed-by: Steffen Persvold <***@numascale.com>
---
arch/x86/include/asm/numachip/numachip.h | 9 +++++++++
arch/x86/kernel/apic/apic_numachip.c | 12 ++++++++----
2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/arch/x86/include/asm/numachip/numachip.h b/arch/x86/include/asm/numachip/numachip.h
index 1c6f7f6..3e1f4f9 100644
--- a/arch/x86/include/asm/numachip/numachip.h
+++ b/arch/x86/include/asm/numachip/numachip.h
@@ -16,4 +16,13 @@
extern int __init pci_numachip_init(void);
+#ifdef CONFIG_X86_NUMACHIP
+extern bool is_numachip_system(void);
+#else
+static inline bool is_numachip_system(void)
+{
+ return 0;
+}
+#endif
+
#endif /* _ASM_X86_NUMACHIP_NUMACHIP_H */
diff --git a/arch/x86/kernel/apic/apic_numachip.c b/arch/x86/kernel/apic/apic_numachip.c
index ae91539..4156470 100644
--- a/arch/x86/kernel/apic/apic_numachip.c
+++ b/arch/x86/kernel/apic/apic_numachip.c
@@ -30,9 +30,13 @@
#include <asm/apic_flat_64.h>
#include <asm/pgtable.h>
-static int numachip_system __read_mostly;
+static bool numachip_system __read_mostly;
+static const struct apic apic_numachip __refconst;
-static const struct apic apic_numachip __read_mostly;
+bool is_numachip_system(void)
+{
+ return numachip_system;
+}
static unsigned int get_apic_id(unsigned long x)
{
@@ -40,7 +44,7 @@ static unsigned int get_apic_id(unsigned long x)
unsigned int id;
rdmsrl(MSR_FAM10H_NODE_ID, value);
- id = ((x >> 24) & 0xffU) | ((value << 2) & 0x3f00U);
+ id = ((x >> 24) & 0xffU) | ((value << 2) & 0xff00U);
return id;
}
@@ -145,7 +149,7 @@ static void numachip_send_IPI_all(int vector)
static void numachip_send_IPI_self(int vector)
{
- __default_send_IPI_shortcut(APIC_DEST_SELF, vector, APIC_DEST_PHYSICAL);
+ apic_write(APIC_SELF_IPI, vector);
}
static int __init numachip_probe(void)
--
1.9.1
1.9.1