aboutsummaryrefslogtreecommitdiff
path: root/arch/loongarch/kernel/numa.c
diff options
context:
space:
mode:
authorGravatar Binbin Zhou <zhoubinbin@loongson.cn> 2022-12-10 22:40:05 +0800
committerGravatar Huacai Chen <chenhuacai@loongson.cn> 2022-12-14 08:41:53 +0800
commit88d4d957edc707e037449ef71a58c6530a39d01e (patch)
treeac4ac6210684cfd8162eb850f1f46f63e8208d8c /arch/loongarch/kernel/numa.c
parentLoongArch: Use alternative to optimize libraries (diff)
downloadlinux-88d4d957edc707e037449ef71a58c6530a39d01e.tar.gz
linux-88d4d957edc707e037449ef71a58c6530a39d01e.tar.bz2
linux-88d4d957edc707e037449ef71a58c6530a39d01e.zip
LoongArch: Add FDT booting support from efi system table
Since commit 40cd01a9c324("efi/loongarch: libstub: remove dependency on flattened DT"), we can parse the FDT from efi system table. And now, LoongArch is coming to support booting with FDT, so we add the relevant booting support as well as parameter parsing. Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Diffstat (limited to 'arch/loongarch/kernel/numa.c')
-rw-r--r--arch/loongarch/kernel/numa.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/arch/loongarch/kernel/numa.c b/arch/loongarch/kernel/numa.c
index a13f92593cfd..3019ca14c760 100644
--- a/arch/loongarch/kernel/numa.c
+++ b/arch/loongarch/kernel/numa.c
@@ -388,6 +388,21 @@ static void __init numa_default_distance(void)
}
}
+/*
+ * fake_numa_init() - For Non-ACPI systems
+ * Return: 0 on success, -errno on failure.
+ */
+static int __init fake_numa_init(void)
+{
+ phys_addr_t start = memblock_start_of_DRAM();
+ phys_addr_t end = memblock_end_of_DRAM() - 1;
+
+ node_set(0, numa_nodes_parsed);
+ pr_info("Faking a node at [mem %pap-%pap]\n", &start, &end);
+
+ return numa_add_memblk(0, start, end + 1);
+}
+
int __init init_numa_memory(void)
{
int i;
@@ -404,7 +419,7 @@ int __init init_numa_memory(void)
memset(&numa_meminfo, 0, sizeof(numa_meminfo));
/* Parse SRAT and SLIT if provided by firmware. */
- ret = acpi_numa_init();
+ ret = acpi_disabled ? fake_numa_init() : acpi_numa_init();
if (ret < 0)
return ret;