Skip to contentSkip to conversation

ppc/pnv.c: fix "system-id" FDT when -uuid is set

PATCH Applied Daniel Henrique Barboza 2 participants 2 messages Dec 7, 2021 – Dec 15, 2021

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 ppc/pnv.c: fix "system-id" FDT when -uuid is set

Setting -uuid in the pnv machine does not work:

./qemu-system-ppc64 -machine powernv8,accel=tcg -uuid 7ff61ca1-a4a0-4bc1-944c-abd114a35e80
qemu-system-ppc64: error creating device tree: (fdt_property_string(fdt, "system-id", buf)): FDT_ERR_BADSTATE

This happens because we're using fdt_property_string(), which is a sequential write function that is supposed to be used when we're building a new FDT, in a case where read/writing into an existing FDT.

Fix it by using fdt_setprop_string() instead.

---

changes from v2:
- fixed commit message after David explained what fdt_property_string() does
- added David's r-b

 hw/ppc/pnv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/pnv.c +1 -1
index 32ab8071a4..9e532caa9f 100644
@@ -552,7 +552,7 @@ static void *pnv_dt_create(MachineState *machine)
     buf =  qemu_uuid_unparse_strdup(&qemu_uuid);
     _FDT((fdt_setprop_string(fdt, 0, "vm,uuid", buf)));
     if (qemu_uuid_set) {
-        _FDT((fdt_property_string(fdt, "system-id", buf)));
+        _FDT((fdt_setprop_string(fdt, 0, "system-id", buf)));
     }
     g_free(buf);
 
Signature · 1 line
2.31.1
#1 lore raw
Quoted 5 lines · Daniel Henrique Barboza

Setting -uuid in the pnv machine does not work:

./qemu-system-ppc64 -machine powernv8,accel=tcg -uuid 7ff61ca1-a4a0-4bc1-944c-abd114a35e80
qemu-system-ppc64: error creating device tree: (fdt_property_string(fdt, "system-id", buf)): FDT_ERR_BADSTATE

Quoted 8 lines

This happens because we're using fdt_property_string(), which is a sequential write function that is supposed to be used when we're building a new FDT, in a case where read/writing into an existing FDT.

Fix it by using fdt_setprop_string() instead.

Applied to ppc-next.

Thanks,

C.