[Skiboot] [PATCH 6/8] slow sim: speed up fdt building

Nicholas Piggin npiggin at gmail.com
Sun Apr 28 00:44:57 AEST 2019


Trade size for speed and avoid de-duplicating strings in the fdt.
This costs about 2kB and saves about 8 million instructions (almost
half of all instructions) booting skiboot in mambo.

Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
---
 core/fdt.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/core/fdt.c b/core/fdt.c
index ce4f66380..ce9f68655 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>
@@ -48,7 +49,11 @@ static void __save_err(int err, const char *str)
 
 static void dt_property_cell(void *fdt, const char *name, u32 cell)
 {
-	save_err(fdt_property_cell(fdt, name, cell));
+	/* Deduplicating strings takes a lot of cycles */
+	if (chip_quirk(QUIRK_SLOW_SIM))
+		save_err(fdt_property_cell_nocompress(fdt, name, cell));
+	else
+		save_err(fdt_property_cell(fdt, name, cell));
 }
 
 static void dt_begin_node(void *fdt, const struct dt_node *dn)
@@ -60,7 +65,10 @@ static void dt_begin_node(void *fdt, const struct dt_node *dn)
 
 static void dt_property(void *fdt, const struct dt_property *p)
 {
-	save_err(fdt_property(fdt, p->name, p->prop, p->len));
+	if (chip_quirk(QUIRK_SLOW_SIM))
+		save_err(fdt_property_nocompress(fdt, p->name, p->prop, p->len));
+	else
+		save_err(fdt_property(fdt, p->name, p->prop, p->len));
 }
 
 static void dt_end_node(void *fdt)
-- 
2.20.1



More information about the Skiboot mailing list