ppc/pnv.c: fix "system-id" FDT when -uuid is set
PATCH v2 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" to retrieve a "system-id" attribute that does not exist, instead of using fdt_setprop_string() to create a "system-id" attribute with the uuid provided via command line.
---
changes from v1:
- fixed typo in commit title
hw/ppc/pnv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/pnv.c +1 -1
@@ -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
Quoted 9 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_BADSTATEThis happens because we're using "
fdt_property_string" to retrieve a "system-id" attribute that does not exist, instead of usingfdt_setprop_string()to create a "system-id" attribute with the uuid provided via command line.
Fix is correct but this description isn't really accurate. fdt_property_string() is a "sequential write" function, only used when you're building a new DT up from scratch, which is an entirely different mode from read/write access to an existing tree. Using when the tree is in read-write state will cause an immediate BADSTATE error; whether the property exists already or not is irrelevant.
Quoted 24 lines
Signed-off-by Daniel Henrique Barboza <[email protected]>---
changes from v1:
- fixed typo in commit titlehw/ppc/pnv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/ppc/pnv.c +1
-1@@ -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 · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Quoted 11 lines · David Gibson
Quoted 9 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_BADSTATEThis happens because we're using "
fdt_property_string" to retrieve a "system-id" attribute that does not exist, instead of usingfdt_setprop_string()to create a "system-id" attribute with the uuid provided via command line.
Quoted 8 lines
Fix is correct but this description isn't really accurate.
fdt_property_string()is a "sequential write" function, only used when you're building a new DT up from scratch, which is an entirely different mode from read/write access to an existing tree. Using when the tree is in read-write state will cause an immediate BADSTATE error; whether the property exists already or not is irrelevant.Reviewed-by David Gibson <[email protected]>
Thanks for the explanation. I'll send a v3 fixing the commit msg.
Daniel
Quoted 26 lines
Quoted 25 lines
Signed-off-by Daniel Henrique Barboza <[email protected]>---
changes from v1:
- fixed typo in commit titlehw/ppc/pnv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/ppc/pnv.c +1
-1@@ -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);