forked from mirrors/linux
		
	 1b5695b024
			
		
	
	
		1b5695b024
		
	
	
	
	
		
			
			The x86 implementation of range-to-target_node lookup (i.e. phys_to_target_node() and memory_add_physaddr_to_nid()) relies on numa_memblks. Since numa_memblks are now part of the generic code, move these functions from x86 to mm/numa_memblks.c and select CONFIG_NUMA_KEEP_MEMINFO when CONFIG_NUMA_MEMBLKS=y for dax and cxl. [rppt@kernel.org: fix build] Link: https://lkml.kernel.org/r/ZtVfSt_zloPdDqVB@kernel.org Link: https://lkml.kernel.org/r/20240807064110.1003856-26-rppt@kernel.org Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Tested-by: Zi Yan <ziy@nvidia.com> # for x86_64 and arm64 Tested-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> [arm64 + CXL via QEMU] Reviewed-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>
		
			
				
	
	
		
			58 lines
		
	
	
	
		
			1.5 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			58 lines
		
	
	
	
		
			1.5 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| /* SPDX-License-Identifier: GPL-2.0 */
 | |
| #ifndef __NUMA_MEMBLKS_H
 | |
| #define __NUMA_MEMBLKS_H
 | |
| 
 | |
| #ifdef CONFIG_NUMA_MEMBLKS
 | |
| #include <linux/types.h>
 | |
| 
 | |
| #define NR_NODE_MEMBLKS		(MAX_NUMNODES * 2)
 | |
| 
 | |
| void __init numa_set_distance(int from, int to, int distance);
 | |
| void __init numa_reset_distance(void);
 | |
| 
 | |
| struct numa_memblk {
 | |
| 	u64			start;
 | |
| 	u64			end;
 | |
| 	int			nid;
 | |
| };
 | |
| 
 | |
| struct numa_meminfo {
 | |
| 	int			nr_blks;
 | |
| 	struct numa_memblk	blk[NR_NODE_MEMBLKS];
 | |
| };
 | |
| 
 | |
| int __init numa_add_memblk(int nodeid, u64 start, u64 end);
 | |
| void __init numa_remove_memblk_from(int idx, struct numa_meminfo *mi);
 | |
| 
 | |
| int __init numa_cleanup_meminfo(struct numa_meminfo *mi);
 | |
| 
 | |
| int __init numa_memblks_init(int (*init_func)(void),
 | |
| 			     bool memblock_force_top_down);
 | |
| 
 | |
| #ifdef CONFIG_NUMA_EMU
 | |
| int numa_emu_cmdline(char *str);
 | |
| void __init numa_emu_update_cpu_to_node(int *emu_nid_to_phys,
 | |
| 					unsigned int nr_emu_nids);
 | |
| u64 __init numa_emu_dma_end(void);
 | |
| void __init numa_emulation(struct numa_meminfo *numa_meminfo,
 | |
| 			   int numa_dist_cnt);
 | |
| #else
 | |
| static inline void numa_emulation(struct numa_meminfo *numa_meminfo,
 | |
| 				  int numa_dist_cnt)
 | |
| { }
 | |
| static inline int numa_emu_cmdline(char *str)
 | |
| {
 | |
| 	return -EINVAL;
 | |
| }
 | |
| #endif /* CONFIG_NUMA_EMU */
 | |
| 
 | |
| #ifdef CONFIG_NUMA_KEEP_MEMINFO
 | |
| extern int phys_to_target_node(u64 start);
 | |
| #define phys_to_target_node phys_to_target_node
 | |
| extern int memory_add_physaddr_to_nid(u64 start);
 | |
| #define memory_add_physaddr_to_nid memory_add_physaddr_to_nid
 | |
| #endif /* CONFIG_NUMA_KEEP_MEMINFO */
 | |
| 
 | |
| #endif /* CONFIG_NUMA_MEMBLKS */
 | |
| 
 | |
| #endif	/* __NUMA_MEMBLKS_H */
 |