From: Jiaxun Yang <jiaxun.yang@flygoat.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>,
Arnd Bergmann <arnd@arndb.de>,
Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
Huacai Chen <chenhuacai@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,
linux-mips@vger.kernel.org,
Jiaxun Yang <jiaxun.yang@flygoat.com>
Subject: [PATCH 2/7] MIPS: pci: Unify pcibus_to_node implementation
Date: Fri, 09 Aug 2024 20:25:02 +0100 [thread overview]
Message-ID: <20240809-mips-numa-v1-2-568751803bf8@flygoat.com> (raw)
In-Reply-To: <20240809-mips-numa-v1-0-568751803bf8@flygoat.com>
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(-)
diff --git a/arch/mips/include/asm/mach-ip27/topology.h b/arch/mips/include/asm/mach-ip27/topology.h
index d66cc53feab8..0ad74e2e0d85 100644
--- a/arch/mips/include/asm/mach-ip27/topology.h
+++ b/arch/mips/include/asm/mach-ip27/topology.h
@@ -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];
diff --git a/arch/mips/include/asm/mach-loongson64/topology.h b/arch/mips/include/asm/mach-loongson64/topology.h
index 3414a1fd1783..c60ccdbe5a94 100644
--- a/arch/mips/include/asm/mach-loongson64/topology.h
+++ b/arch/mips/include/asm/mach-loongson64/topology.h
@@ -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)])
diff --git a/arch/mips/include/asm/pci.h b/arch/mips/include/asm/pci.h
index d993df6302dc..09323348d362 100644
--- a/arch/mips/include/asm/pci.h
+++ b/arch/mips/include/asm/pci.h
@@ -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 */
diff --git a/arch/mips/loongson64/numa.c b/arch/mips/loongson64/numa.c
index 8388400d052f..d49180562c9f 100644
--- a/arch/mips/loongson64/numa.c
+++ b/arch/mips/loongson64/numa.c
@@ -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());
diff --git a/arch/mips/pci/pci-ip27.c b/arch/mips/pci/pci-ip27.c
index 973faea61cad..d919c70e02b1 100644
--- a/arch/mips/pci/pci-ip27.c
+++ b/arch/mips/pci/pci-ip27.c
@@ -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);
diff --git a/arch/mips/pci/pci-xtalk-bridge.c b/arch/mips/pci/pci-xtalk-bridge.c
index 45ddbaa6c123..45b2b390e553 100644
--- a/arch/mips/pci/pci-xtalk-bridge.c
+++ b/arch/mips/pci/pci-xtalk-bridge.c
@@ -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));
--
2.46.0
next prev parent reply other threads:[~2024-08-09 19:25 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-09 19:25 [PATCH 0/7] MIPS: arch_numa enablement Jiaxun Yang
2024-08-09 19:25 ` [PATCH 1/7] arch_numa: Provide platform numa init hook Jiaxun Yang
2024-08-09 19:41 ` Arnd Bergmann
2024-08-09 19:56 ` Jiaxun Yang
2024-08-09 20:01 ` Arnd Bergmann
2024-08-09 19:25 ` Jiaxun Yang [this message]
2024-08-09 19:25 ` [PATCH 3/7] MIPS: Prepare NUMA headers for arch_numa Jiaxun Yang
2024-08-09 19:25 ` [PATCH 4/7] MIPS: mm: init: Prepare " Jiaxun Yang
2024-08-09 19:25 ` [PATCH 5/7] MIPS: smp: Process NUMA information Jiaxun Yang
2024-08-09 19:25 ` [PATCH 6/7] MIPS: generic: Make NUMA available Jiaxun Yang
2024-08-09 19:25 ` [PATCH 7/7] MIPS: Loongson64: Migrate to arch_numa Jiaxun Yang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240809-mips-numa-v1-2-568751803bf8@flygoat.com \
--to=jiaxun.yang@flygoat.com \
--cc=arnd@arndb.de \
--cc=chenhuacai@kernel.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=tsbogend@alpha.franken.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®