Commit a24f2fb7 authored by Huacai Chen's avatar Huacai Chen
Browse files

LoongArch: Introduce the numa_memblks conversion



Commit 87482708 ("mm: introduce numa_memblks") has moved
numa_memblks from x86 to the generic code, but LoongArch was left out
of this conversion.

This patch introduces the generic numa_memblks for LoongArch.

In detail:
1. Enable NUMA_MEMBLKS (but disable NUMA_EMU) in Kconfig;
2. Use generic definition for numa_memblk and numa_meminfo;
3. Use generic implementation for numa_add_memblk() and its friends;
4. Use generic implementation for numa_set_distance() and its friends;
5. Use generic implementation for memory_add_physaddr_to_nid() and its
   friends.

Note: Disable NUMA_EMU because it needs more efforts and no obvious
demand now.

Tested-by: default avatarBinbin Zhou <zhoubinbin@loongson.cn>
Signed-off-by: default avatarYuquan Wang <wangyuquan1236@phytium.com.cn>
Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
parent 9559d580
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -189,6 +189,7 @@ config LOONGARCH
	select MODULES_USE_ELF_RELA if MODULES
	select NEED_PER_CPU_EMBED_FIRST_CHUNK
	select NEED_PER_CPU_PAGE_FIRST_CHUNK
	select NUMA_MEMBLKS if NUMA
	select OF
	select OF_EARLY_FLATTREE
	select PCI
+0 −14
Original line number Diff line number Diff line
@@ -22,20 +22,6 @@ extern int numa_off;
extern s16 __cpuid_to_node[CONFIG_NR_CPUS];
extern nodemask_t numa_nodes_parsed __initdata;

struct numa_memblk {
	u64			start;
	u64			end;
	int			nid;
};

#define NR_NODE_MEMBLKS		(MAX_NUMNODES*2)
struct numa_meminfo {
	int			nr_blks;
	struct numa_memblk	blk[NR_NODE_MEMBLKS];
};

extern int __init numa_add_memblk(int nodeid, u64 start, u64 end);

extern void __init early_numa_add_cpu(int cpuid, s16 node);
extern void numa_add_cpu(unsigned int cpu);
extern void numa_remove_cpu(unsigned int cpu);
+0 −5
Original line number Diff line number Diff line
@@ -21,11 +21,6 @@
#define VMEMMAP_SIZE	0	/* 1, For FLATMEM; 2, For SPARSEMEM without VMEMMAP. */
#endif

#ifdef CONFIG_MEMORY_HOTPLUG
int memory_add_physaddr_to_nid(u64 addr);
#define memory_add_physaddr_to_nid memory_add_physaddr_to_nid
#endif

#define INIT_MEMBLOCK_RESERVED_REGIONS	(INIT_MEMBLOCK_REGIONS + NR_CPUS)

#endif /* _LOONGARCH_SPARSEMEM_H */
+2 −5
Original line number Diff line number Diff line
@@ -19,11 +19,8 @@ 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);

#define node_distance(from, to)	(node_distances[(from)][(to)])
int __node_distance(int from, int to);
#define node_distance(from, to) __node_distance(from, to)

#else
#define pcibus_to_node(bus)	0
+0 −11
Original line number Diff line number Diff line
@@ -244,17 +244,6 @@ void __init acpi_boot_table_init(void)

#ifdef CONFIG_ACPI_NUMA

void __init numa_set_distance(int from, int to, int distance)
{
	if ((u8)distance != distance || (from == to && distance != LOCAL_DISTANCE)) {
		pr_warn_once("Warning: invalid distance parameter, from=%d to=%d distance=%d\n",
				from, to, distance);
		return;
	}

	node_distances[from][to] = distance;
}

/* Callback for Proximity Domain -> CPUID mapping */
void __init
acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *pa)
Loading