hw/riscv/virt: Fix the boot logic if pflash0 is specified
PATCH 1/1 hw/riscv/virt: Fix the boot logic if pflash0 is specified
The firmware may be specified with -bios
and the plfash0 device with option -drive if=pflash.
If both options are applied, it is intented that the pflash0 will store the secure variable and the firmware be the one specified by -bios. Explicitly specify "-bios none" if choose to boot from pflash0
--- hw/riscv/virt.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
hw/riscv/virt.c +5 -3
@@ -1296,10 +1296,12 @@ static void virt_machine_done(Notifier *notifier, void *data) kernel_entry =0 ; } -if (drive_get (IF_PFLASH ,0 ,0 )) { +if (drive_get (IF_PFLASH ,0 ,0 ) && + !strcmp (machine->firmware,"none" )) {/* -* Pflash was supplied, let's overwrite the address we jump to after -* reset to the base of the flash. +* If pflash (unit 0) was supplied and at the same time the -bois +* is not specified, then let's overwrite the address we jump to +* after reset to the base of the flash. */ start_addr = virt_memmap[VIRT_FLASH ].base; }
Signature · 1 line
2.25.1
Quoted 7 lines · Yong Li
The firmware may be specified with -bios
and the plfash0 device with option -drive if=pflash.
If both options are applied, it is intented that the pflash0 will store the secure variable and the firmware be the one specified by -bios. Explicitly specify "-bios none" if choose to boot from pflash0
This seems like the right approach.
Can you update the docs/system/riscv/virt.rst docs to include this information?
Alistair
Quoted 31 lines
Signed-off-by Yong Li <[email protected]>Cc "Zhiwei Liu" <[email protected]>--- hw/riscv/virt.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)hw/riscv/virt.c +5
-4@@ -1296,10 +1296,12 @@ static void virt_machine_done(Notifier *notifier, void *data) kernel_entry =0 ; } -if (drive_get (IF_PFLASH ,0 ,0 )) { +if (drive_get (IF_PFLASH ,0 ,0 ) && + !strcmp (machine->firmware,"none" )) {/* -* Pflash was supplied, let's overwrite the address we jump to after -* reset to the base of the flash. +* If pflash (unit 0) was supplied and at the same time the -bois +* is not specified, then let's overwrite the address we jump to +* after reset to the base of the flash. */ start_addr = virt_memmap[VIRT_FLASH ].base; } --2.25.1
Quoted 7 lines · Alistair Francis
Quoted 6 lines · Yong Li
The firmware may be specified with -bios
and the plfash0 device with option -drive if=pflash.
If both options are applied, it is intented that the pflash0 will store the secure variable and the firmware be the one specified by -bios. Explicitly specify "-bios none" if choose to boot from pflash0
Quoted 5 lines
This seems like the right approach.
Can you update the
docs/system/riscv/virt.rstdocs to include this information?Alistair
Hi Alistair
Thanks for your review, after syncing with Sunil from ventena team.
Sunil is also working with for thishttps://www.mail-archive.com/[email protected]/msg959882.html, and he will handle this change in his patch. Thanks
Quoted 30 lines
Quoted 30 lines
Signed-off-by Yong Li<[email protected]>Cc "Zhiwei Liu"<[email protected]>--- hw/riscv/virt.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)hw/riscv/virt.c +5
-4@@ -1296,10 +1296,12 @@ static void virt_machine_done(Notifier *notifier, void *data) kernel_entry =0 ; } -if (drive_get (IF_PFLASH ,0 ,0 )) { +if (drive_get (IF_PFLASH ,0 ,0 ) && + !strcmp (machine->firmware,"none" )) {/* -* Pflash was supplied, let's overwrite the address we jump to after -* reset to the base of the flash. +* If pflash (unit 0) was supplied and at the same time the -bois +* is not specified, then let's overwrite the address we jump to +* after reset to the base of the flash. */ start_addr = virt_memmap[VIRT_FLASH ].base; } --2.25.1