2014-10-15 12:53:27

by Daniel J Blueman

[permalink] [raw]
Subject: [PATCH 1/3] Numachip: fixes

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 <[email protected]>
Reviewed-by: Steffen Persvold <[email protected]>
---
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


2014-10-15 12:53:32

by Daniel J Blueman

[permalink] [raw]
Subject: [PATCH 3/3] Numachip: use 2GB memory block size

Use appropriate memory block size to reduce sysfs entry
creation time by 16x.

Boot-tested with the four permutations of X86_UV and X86_NUMACHIP.

Signed-off-by: Daniel J Blueman <[email protected]>
Reviewed-by: Steffen Persvold <[email protected]>
---
arch/x86/mm/init_64.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 5621c47..727f940 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -53,6 +53,7 @@
#include <asm/cacheflush.h>
#include <asm/init.h>
#include <asm/uv/uv.h>
+#include <asm/numachip/numachip.h>
#include <asm/setup.h>

#include "mm_internal.h"
@@ -1235,9 +1236,9 @@ static unsigned long probe_memory_block_size(void)
/* start from 2g */
unsigned long bz = 1UL<<31;

-#ifdef CONFIG_X86_UV
- if (is_uv_system()) {
- printk(KERN_INFO "UV: memory block size 2GB\n");
+#ifdef CONFIG_X86_64
+ if (is_uv_system() || is_numachip_system()) {
+ pr_info("Memory block size 2GB for large-SMP system\n");
return 2UL * 1024 * 1024 * 1024;
}
#endif
--
1.9.1

2014-10-15 12:53:49

by Daniel J Blueman

[permalink] [raw]
Subject: [PATCH 2/3] Numachip: drop unuseful code

Drop printing that serves no purpose, as it's printing fixed or
known values, and mark constant structure appropriately.

Signed-off-by: Daniel J Blueman <[email protected]>
Reviewed-by: Steffen Persvold <[email protected]>
---
arch/x86/kernel/apic/apic_numachip.c | 22 +++-------------------
arch/x86/pci/numachip.c | 2 +-
2 files changed, 4 insertions(+), 20 deletions(-)

diff --git a/arch/x86/kernel/apic/apic_numachip.c b/arch/x86/kernel/apic/apic_numachip.c
index 4156470..ee2052d 100644
--- a/arch/x86/kernel/apic/apic_numachip.c
+++ b/arch/x86/kernel/apic/apic_numachip.c
@@ -157,20 +157,8 @@ static int __init numachip_probe(void)
return apic == &apic_numachip;
}

-static void __init map_csrs(void)
-{
- printk(KERN_INFO "NumaChip: Mapping local CSR space (%016llx - %016llx)\n",
- NUMACHIP_LCSR_BASE, NUMACHIP_LCSR_BASE + NUMACHIP_LCSR_SIZE - 1);
- init_extra_mapping_uc(NUMACHIP_LCSR_BASE, NUMACHIP_LCSR_SIZE);
-
- printk(KERN_INFO "NumaChip: Mapping global CSR space (%016llx - %016llx)\n",
- NUMACHIP_GCSR_BASE, NUMACHIP_GCSR_BASE + NUMACHIP_GCSR_SIZE - 1);
- init_extra_mapping_uc(NUMACHIP_GCSR_BASE, NUMACHIP_GCSR_SIZE);
-}
-
static void fixup_cpu_id(struct cpuinfo_x86 *c, int node)
{
-
if (c->phys_proc_id != node) {
c->phys_proc_id = node;
per_cpu(cpu_llc_id, smp_processor_id()) = node;
@@ -179,19 +167,15 @@ static void fixup_cpu_id(struct cpuinfo_x86 *c, int node)

static int __init numachip_system_init(void)
{
- unsigned int val;
-
if (!numachip_system)
return 0;

+ init_extra_mapping_uc(NUMACHIP_LCSR_BASE, NUMACHIP_LCSR_SIZE);
+ init_extra_mapping_uc(NUMACHIP_GCSR_BASE, NUMACHIP_GCSR_SIZE);
+
x86_cpuinit.fixup_cpu_id = fixup_cpu_id;
x86_init.pci.arch_init = pci_numachip_init;

- map_csrs();
-
- val = read_lcsr(CSR_G0_NODE_IDS);
- printk(KERN_INFO "NumaChip: Local NodeID = %08x\n", val);
-
return 0;
}
early_initcall(numachip_system_init);
diff --git a/arch/x86/pci/numachip.c b/arch/x86/pci/numachip.c
index 7307d9d..2e565e6 100644
--- a/arch/x86/pci/numachip.c
+++ b/arch/x86/pci/numachip.c
@@ -103,7 +103,7 @@ static int pci_mmcfg_write_numachip(unsigned int seg, unsigned int bus,
return 0;
}

-const struct pci_raw_ops pci_mmcfg_numachip = {
+static const struct pci_raw_ops pci_mmcfg_numachip = {
.read = pci_mmcfg_read_numachip,
.write = pci_mmcfg_write_numachip,
};
--
1.9.1

2014-10-16 07:17:48

by Ingo Molnar

[permalink] [raw]
Subject: Re: [PATCH 1/3] Numachip: fixes


* Daniel J Blueman <[email protected]> wrote:

> 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.

This should be 3 patches.

Thanks,

Ingo