mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2024-12-28 16:53:49 +00:00
767507654c
Until now arch_numa was directly translating firmware NUMA information to memblock. Using numa_memblks as an intermediate step has a few advantages: * alignment with more battle tested x86 implementation * availability of NUMA emulation * maintaining node information for not yet populated memory Adjust a few places in numa_memblks to compile with 32-bit phys_addr_t and replace current functionality related to numa_add_memblk() and __node_distance() in arch_numa with the implementation based on numa_memblks and add functions required by numa_emulation. [rppt@kernel.org: fix section mismatch] Link: https://lkml.kernel.org/r/ZrO6cExVz1He_yPn@kernel.org [rppt@kernel.org: PFN_PHYS() translation is unnecessary here] Link: https://lkml.kernel.org/r/Zs2T5wkSYO9MGcab@kernel.org Link: https://lkml.kernel.org/r/20240807064110.1003856-25-rppt@kernel.org Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org> Tested-by: Zi Yan <ziy@nvidia.com> # for x86_64 and arm64 Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Tested-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> [arm64 + CXL via QEMU] Acked-by: Dan Williams <dan.j.williams@intel.com> Acked-by: David Hildenbrand <david@redhat.com> Cc: Alexander Gordeev <agordeev@linux.ibm.com> Cc: Andreas Larsson <andreas@gaisler.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Borislav Petkov <bp@alien8.de> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Christophe Leroy <christophe.leroy@csgroup.eu> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: Davidlohr Bueso <dave@stgolabs.net> Cc: David S. Miller <davem@davemloft.net> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Heiko Carstens <hca@linux.ibm.com> Cc: Huacai Chen <chenhuacai@kernel.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiaxun Yang <jiaxun.yang@flygoat.com> Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Palmer Dabbelt <palmer@dabbelt.com> Cc: Rafael J. Wysocki <rafael@kernel.org> Cc: Rob Herring (Arm) <robh@kernel.org> Cc: Samuel Holland <samuel.holland@sifive.com> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Vasily Gorbik <gor@linux.ibm.com> Cc: Will Deacon <will@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
57 lines
1.6 KiB
C
57 lines
1.6 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef __ASM_GENERIC_NUMA_H
|
|
#define __ASM_GENERIC_NUMA_H
|
|
|
|
#ifdef CONFIG_NUMA
|
|
|
|
#define NR_NODE_MEMBLKS (MAX_NUMNODES * 2)
|
|
|
|
int __node_distance(int from, int to);
|
|
#define node_distance(a, b) __node_distance(a, b)
|
|
|
|
extern nodemask_t numa_nodes_parsed __initdata;
|
|
|
|
extern bool numa_off;
|
|
|
|
/* Mappings between node number and cpus on that node. */
|
|
extern cpumask_var_t node_to_cpumask_map[MAX_NUMNODES];
|
|
void numa_clear_node(unsigned int cpu);
|
|
|
|
#ifdef CONFIG_DEBUG_PER_CPU_MAPS
|
|
const struct cpumask *cpumask_of_node(int node);
|
|
#else
|
|
/* Returns a pointer to the cpumask of CPUs on Node 'node'. */
|
|
static inline const struct cpumask *cpumask_of_node(int node)
|
|
{
|
|
if (node == NUMA_NO_NODE)
|
|
return cpu_all_mask;
|
|
|
|
return node_to_cpumask_map[node];
|
|
}
|
|
#endif
|
|
|
|
void __init arch_numa_init(void);
|
|
int __init numa_add_memblk(int nodeid, u64 start, u64 end);
|
|
void __init early_map_cpu_to_node(unsigned int cpu, int nid);
|
|
int early_cpu_to_node(int cpu);
|
|
void numa_store_cpu_info(unsigned int cpu);
|
|
void numa_add_cpu(unsigned int cpu);
|
|
void numa_remove_cpu(unsigned int cpu);
|
|
|
|
#else /* CONFIG_NUMA */
|
|
|
|
static inline void numa_store_cpu_info(unsigned int cpu) { }
|
|
static inline void numa_add_cpu(unsigned int cpu) { }
|
|
static inline void numa_remove_cpu(unsigned int cpu) { }
|
|
static inline void arch_numa_init(void) { }
|
|
static inline void early_map_cpu_to_node(unsigned int cpu, int nid) { }
|
|
static inline int early_cpu_to_node(int cpu) { return 0; }
|
|
|
|
#endif /* CONFIG_NUMA */
|
|
|
|
#ifdef CONFIG_NUMA_EMU
|
|
void debug_cpumask_set_cpu(unsigned int cpu, int node, bool enable);
|
|
#endif
|
|
|
|
#endif /* __ASM_GENERIC_NUMA_H */
|