@@ -17,10 +17,6 @@ extern struct cpuinfo_ip27 sn_cpu_info[NR_CPUS];
#define cpumask_of_node(node) ((node) == -1 ? \
cpu_all_mask : \
&hub_data(node)->h_cpus)
-struct pci_bus;
-extern int pcibus_to_node(struct pci_bus *);
-
-#define cpumask_of_pcibus(bus) (cpumask_of_node(pcibus_to_node(bus)))
extern unsigned char __node_distances[MAX_NUMNODES][MAX_NUMNODES];
@@ -9,11 +9,6 @@
extern cpumask_t __node_cpumask[];
#define cpumask_of_node(node) (&__node_cpumask[node])
-struct pci_bus;
-extern int pcibus_to_node(struct pci_bus *);
-
-#define cpumask_of_pcibus(bus) (cpu_online_mask)
-
extern unsigned char __node_distances[MAX_NUMNODES][MAX_NUMNODES];
#define node_distance(from, to) (__node_distances[(from)][(to)])
@@ -134,6 +134,18 @@ static inline int pci_proc_domain(struct pci_bus *bus)
}
#endif /* CONFIG_PCI_DOMAINS */
+#ifdef CONFIG_NUMA
+static inline int pcibus_to_node(struct pci_bus *bus)
+{
+ return dev_to_node(&bus->dev);
+}
+#ifndef cpumask_of_pcibus
+#define cpumask_of_pcibus(bus) (pcibus_to_node(bus) == -1 ? \
+ cpu_all_mask : \
+ cpumask_of_node(pcibus_to_node(bus)))
+#endif
+#endif
+
#endif /* __KERNEL__ */
/* Do platform specific device initialization at pci_enable_device() time */
@@ -171,13 +171,6 @@ void __init mem_init(void)
setup_zero_pages(); /* This comes from node 0 */
}
-/* All PCI device belongs to logical Node-0 */
-int pcibus_to_node(struct pci_bus *bus)
-{
- return 0;
-}
-EXPORT_SYMBOL(pcibus_to_node);
-
void __init prom_init_numa_memory(void)
{
pr_info("CP0_Config3: CP0 16.3 (0x%x)\n", read_c0_config3());
@@ -17,16 +17,6 @@
#include <asm/sn/ioc3.h>
#include <asm/pci/bridge.h>
-#ifdef CONFIG_NUMA
-int pcibus_to_node(struct pci_bus *bus)
-{
- struct bridge_controller *bc = BRIDGE_CONTROLLER(bus);
-
- return bc->nasid;
-}
-EXPORT_SYMBOL(pcibus_to_node);
-#endif /* CONFIG_NUMA */
-
static void ip29_fixup_phy(struct pci_dev *dev)
{
int nasid = pcibus_to_node(dev->bus);
@@ -633,6 +633,7 @@ static int bridge_probe(struct platform_device *pdev)
return -ENOMEM;
}
+ set_dev_node(dev, bd->nasid);
pci_set_flags(PCI_PROBE_ONLY);
host = devm_pci_alloc_host_bridge(dev, sizeof(*bc));
Nowadays PCI Bus NUMA node information is always stored in struct device of host bridge. Unify the implementation of pcibus_to_node to simplify code. Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> --- arch/mips/include/asm/mach-ip27/topology.h | 4 ---- arch/mips/include/asm/mach-loongson64/topology.h | 5 ----- arch/mips/include/asm/pci.h | 12 ++++++++++++ arch/mips/loongson64/numa.c | 7 ------- arch/mips/pci/pci-ip27.c | 10 ---------- arch/mips/pci/pci-xtalk-bridge.c | 1 + 6 files changed, 13 insertions(+), 26 deletions(-)