[Skiboot] [PATCH v2 2/2] device-tree: speed up fdt building on slow simulators
Nicholas Piggin
npiggin at gmail.com
Fri May 10 14:46:27 AEST 2019
Trade size for speed and avoid de-duplicating strings in the fdt.
This costs about 2kB in fdt size, and saves about 8 million instructions
(almost half of all instructions) booting skiboot in mambo.
This was tracked down by Michael Neuling <mikey at neuling.org>.
Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
---
core/fdt.c | 6 +++++-
core/test/stubs.c | 2 +-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/core/fdt.c b/core/fdt.c
index da5cc58d9..3972592df 100644
--- a/core/fdt.c
+++ b/core/fdt.c
@@ -18,6 +18,7 @@
#include <stdarg.h>
#include <libfdt.h>
#include <device.h>
+#include <chip.h>
#include <cpu.h>
#include <opal.h>
#include <interrupts.h>
@@ -167,7 +168,10 @@ static int __create_dtb(void *fdt, size_t len,
const struct dt_node *root,
bool exclusive)
{
- save_err(fdt_create(fdt, len));
+ if (chip_quirk(QUIRK_SLOW_SIM))
+ save_err(fdt_create_with_flags(fdt, len, FDT_CREATE_FLAG_NO_NAME_DEDUP));
+ else
+ save_err(fdt_create_with_flags(fdt, len, 0));
if (fdt_error)
goto err;
diff --git a/core/test/stubs.c b/core/test/stubs.c
index e0f9829f4..0a8d8523f 100644
--- a/core/test/stubs.c
+++ b/core/test/stubs.c
@@ -94,7 +94,7 @@ void __attrconst cpu_process_local_jobs(void)
STUB(fdt_begin_node);
STUB(fdt_property);
STUB(fdt_end_node);
-STUB(fdt_create);
+STUB(fdt_create_with_flags);
STUB(fdt_add_reservemap_entry);
STUB(fdt_finish_reservemap);
STUB(fdt_strerror);
--
2.20.1
More information about the Skiboot
mailing list