powerpc/pseries: Fix VPHN build errors on non-SMP systems

The header asm/hvcall.h was previously included indirectly via
smp.h. On non-SMP systems, however, these declarations are excluded
and the build breaks. This is easily fixed by including asm/hvcall.h
directly.

The VPHN feature is only meaningful on NUMA systems that implement
the SPLPAR option, so exclude the VPHN code on systems without
SPLPAR enabled.

Also, expose unmap_cpu_from_node() on systems with SPLPAR enabled,
even if CONFIG_HOTPLUG_CPU is disabled.

Lastly, map_cpu_to_node() is now needed by VPHN to manipulate the
node masks after boot time, so remove the __cpuinit annotation to
fix a section mismatch.

Signed-off-by: Jesse Larrew <jlarrew@linux.vnet.ibm.com>
This commit is contained in:
Jesse Larrew 2010-12-17 22:07:47 +00:00 committed by Benjamin Herrenschmidt
parent eed0ba0b4a
commit 39bf990ead
2 changed files with 17 additions and 12 deletions

View File

@ -93,9 +93,20 @@ extern void __init dump_numa_cpu_topology(void);
extern int sysfs_add_device_to_node(struct sys_device *dev, int nid); extern int sysfs_add_device_to_node(struct sys_device *dev, int nid);
extern void sysfs_remove_device_from_node(struct sys_device *dev, int nid); extern void sysfs_remove_device_from_node(struct sys_device *dev, int nid);
#ifdef CONFIG_PPC_SPLPAR
extern int start_topology_update(void); extern int start_topology_update(void);
extern int stop_topology_update(void); extern int stop_topology_update(void);
#else #else
static inline int start_topology_update(void)
{
return 0;
}
static inline int stop_topology_update(void)
{
return 0;
}
#endif /* CONFIG_PPC_SPLPAR */
#else
static inline void dump_numa_cpu_topology(void) {} static inline void dump_numa_cpu_topology(void) {}
@ -108,15 +119,6 @@ static inline void sysfs_remove_device_from_node(struct sys_device *dev,
int nid) int nid)
{ {
} }
static inline int start_topology_update(void)
{
return 0;
}
static inline int stop_topology_update(void)
{
return 0;
}
#endif /* CONFIG_NUMA */ #endif /* CONFIG_NUMA */
#include <asm-generic/topology.h> #include <asm-generic/topology.h>

View File

@ -28,6 +28,7 @@
#include <asm/smp.h> #include <asm/smp.h>
#include <asm/firmware.h> #include <asm/firmware.h>
#include <asm/paca.h> #include <asm/paca.h>
#include <asm/hvcall.h>
static int numa_enabled = 1; static int numa_enabled = 1;
@ -167,7 +168,7 @@ static void __init get_node_active_region(unsigned long start_pfn,
work_with_active_regions(nid, get_active_region_work_fn, node_ar); work_with_active_regions(nid, get_active_region_work_fn, node_ar);
} }
static void __cpuinit map_cpu_to_node(int cpu, int node) static void map_cpu_to_node(int cpu, int node)
{ {
numa_cpu_lookup_table[cpu] = node; numa_cpu_lookup_table[cpu] = node;
@ -177,7 +178,7 @@ static void __cpuinit map_cpu_to_node(int cpu, int node)
cpumask_set_cpu(cpu, node_to_cpumask_map[node]); cpumask_set_cpu(cpu, node_to_cpumask_map[node]);
} }
#ifdef CONFIG_HOTPLUG_CPU #if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_PPC_SPLPAR)
static void unmap_cpu_from_node(unsigned long cpu) static void unmap_cpu_from_node(unsigned long cpu)
{ {
int node = numa_cpu_lookup_table[cpu]; int node = numa_cpu_lookup_table[cpu];
@ -191,7 +192,7 @@ static void unmap_cpu_from_node(unsigned long cpu)
cpu, node); cpu, node);
} }
} }
#endif /* CONFIG_HOTPLUG_CPU */ #endif /* CONFIG_HOTPLUG_CPU || CONFIG_PPC_SPLPAR */
/* must hold reference to node during call */ /* must hold reference to node during call */
static const int *of_get_associativity(struct device_node *dev) static const int *of_get_associativity(struct device_node *dev)
@ -1289,6 +1290,7 @@ u64 memory_hotplug_max(void)
#endif /* CONFIG_MEMORY_HOTPLUG */ #endif /* CONFIG_MEMORY_HOTPLUG */
/* Vrtual Processor Home Node (VPHN) support */ /* Vrtual Processor Home Node (VPHN) support */
#ifdef CONFIG_PPC_SPLPAR
#define VPHN_NR_CHANGE_CTRS (8) #define VPHN_NR_CHANGE_CTRS (8)
static u8 vphn_cpu_change_counts[NR_CPUS][VPHN_NR_CHANGE_CTRS]; static u8 vphn_cpu_change_counts[NR_CPUS][VPHN_NR_CHANGE_CTRS];
static cpumask_t cpu_associativity_changes_mask; static cpumask_t cpu_associativity_changes_mask;
@ -1531,3 +1533,4 @@ int stop_topology_update(void)
vphn_enabled = 0; vphn_enabled = 0;
return del_timer_sync(&topology_timer); return del_timer_sync(&topology_timer);
} }
#endif /* CONFIG_PPC_SPLPAR */