[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240821-loongarch_archnuma-v1-1-f47b191beee8@flygoat.com>
Date: Wed, 21 Aug 2024 14:12:15 +0100
From: Jiaxun Yang <jiaxun.yang@...goat.com>
To: Huacai Chen <chenhuacai@...nel.org>, WANG Xuerui <kernel@...0n.name>
Cc: loongarch@...ts.linux.dev, linux-kernel@...r.kernel.org,
Jiaxun Yang <jiaxun.yang@...goat.com>
Subject: [PATCH 1/3] LoongArch: Move pcibus_to_node to pci.h
Align with RISC-V and prepare for removal of numa.c.
Signed-off-by: Jiaxun Yang <jiaxun.yang@...goat.com>
---
arch/loongarch/include/asm/pci.h | 12 ++++++++++++
arch/loongarch/include/asm/topology.h | 5 -----
arch/loongarch/kernel/numa.c | 6 ------
3 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/arch/loongarch/include/asm/pci.h b/arch/loongarch/include/asm/pci.h
index 846909d7e831..0ecb3668ed0c 100644
--- a/arch/loongarch/include/asm/pci.h
+++ b/arch/loongarch/include/asm/pci.h
@@ -19,6 +19,18 @@
extern phys_addr_t mcfg_addr_init(int node);
+#if defined(CONFIG_PCI) && defined(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 /* defined(CONFIG_PCI) && defined(CONFIG_NUMA) */
+
/* generic pci stuff */
#include <asm-generic/pci.h>
diff --git a/arch/loongarch/include/asm/topology.h b/arch/loongarch/include/asm/topology.h
index 50273c9187d0..6bed5001c2e3 100644
--- a/arch/loongarch/include/asm/topology.h
+++ b/arch/loongarch/include/asm/topology.h
@@ -14,11 +14,6 @@ extern cpumask_t cpus_on_node[];
#define cpumask_of_node(node) (&cpus_on_node[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];
void numa_set_distance(int from, int to, int distance);
diff --git a/arch/loongarch/kernel/numa.c b/arch/loongarch/kernel/numa.c
index 84fe7f854820..3b69f2b847e0 100644
--- a/arch/loongarch/kernel/numa.c
+++ b/arch/loongarch/kernel/numa.c
@@ -392,9 +392,3 @@ void __init mem_init(void)
high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT);
memblock_free_all();
}
-
-int pcibus_to_node(struct pci_bus *bus)
-{
- return dev_to_node(&bus->dev);
-}
-EXPORT_SYMBOL(pcibus_to_node);
--
2.46.0
Powered by blists - more mailing lists