Numachip: fixes
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.
--- arch/x86/include/asm/numachip/numachip.h | 9 +++++++++ arch/x86/kernel/apic/apic_numachip.c | 12 ++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-)
arch/x86/include/asm/numachip/numachip.h +9 -0
@@ -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 */
arch/x86/kernel/apic/apic_numachip.c +8 -4
@@ -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 )
Signature · 1 line
1.9.1
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.
--- arch/x86/kernel/apic/apic_numachip.c | 22 +++------------------- arch/x86/pci/numachip.c | 2 +- 2 files changed, 4 insertions(+), 20 deletions(-)
arch/x86/kernel/apic/apic_numachip.c +3 -19
@@ -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);
arch/x86/pci/numachip.c +1 -1
@@ -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, };
Signature · 1 line
1.9.1
PATCH 3/3 Numachip: use 2GB memory block size
In reply to Daniel J BluemanUse appropriate memory block size to reduce sysfs entry creation time by 16x.
Boot-tested with the four permutations of X86_UV and X86_NUMACHIP.
--- arch/x86/mm/init_64.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
arch/x86/mm/init_64.c +4 -3
@@ -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
Signature · 1 line
1.9.1
Quoted 10 lines · Daniel J Blueman
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