[PATCH v4 1/2] x86/of: add early setup of DT reserved-memory nodes
From: Grzegorz Jaszczyk
Date: Fri Mar 13 2026 - 12:14:27 EST
The x86 allows booting with ACPI and DT simultaneously, and while basic
DT support is present, the processing of DT 'reserved-memory' is
currently missing.
Some drivers (such as open-dice driver) rely on the standard device-tree
bindings (Documentation/devicetree/bindings/reserved-memory/) to
communicate securely reserved memory region.
To support this add early_init_fdt_scan_reserved_mem as part of early
flattened device tree parsing.
Additionally this patch changes the sequence and calls
x86_flattree_get_config earlier in `setup_arch()`, just after e820
memblock setup, so the DT reserved-memory can be properly reflected in
the memblock before that reserved-memory is used for allocation.
Signed-off-by: Grzegorz Jaszczyk <jaszczyk@xxxxxxxxxx>
---
arch/x86/kernel/devicetree.c | 1 +
arch/x86/kernel/setup.c | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/devicetree.c b/arch/x86/kernel/devicetree.c
index dd8748c45529..f7db0e8f9c3e 100644
--- a/arch/x86/kernel/devicetree.c
+++ b/arch/x86/kernel/devicetree.c
@@ -307,6 +307,7 @@ void __init x86_flattree_get_config(void)
}
early_init_dt_verify(dt, __pa(dt));
+ early_init_fdt_scan_reserved_mem();
}
unflatten_and_copy_device_tree();
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index eebcc9db1a1b..cf6c93f8be1a 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -1076,6 +1076,8 @@ void __init setup_arch(char **cmdline_p)
e820__memblock_setup();
+ x86_flattree_get_config();
+
/*
* Needs to run after memblock setup because it needs the physical
* memory size.
@@ -1186,8 +1188,6 @@ void __init setup_arch(char **cmdline_p)
early_acpi_boot_init();
x86_init.mpparse.early_parse_smp_cfg();
- x86_flattree_get_config();
-
initmem_init();
dma_contiguous_reserve(max_pfn_mapped << PAGE_SHIFT);
--
2.53.0.851.ga537e3e6e9-goog