qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hw/riscv/virt: Fix the boot logic if pflash0 is specified
@ 2023-04-23  9:59 Yong Li
  2023-05-17  2:27 ` Alistair Francis
  0 siblings, 1 reply; 3+ messages in thread
From: Yong Li @ 2023-04-23  9:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: Yong Li, Zhiwei Liu

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

Signed-off-by: Yong Li <yong.li@intel.com>
Cc: "Zhiwei Liu" <zhiwei_liu@linux.alibaba.com>
---
 hw/riscv/virt.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
index 4e3efbee16..b38b41e685 100644
--- a/hw/riscv/virt.c
+++ b/hw/riscv/virt.c
@@ -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



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] hw/riscv/virt: Fix the boot logic if pflash0 is specified
  2023-04-23  9:59 [PATCH] hw/riscv/virt: Fix the boot logic if pflash0 is specified Yong Li
@ 2023-05-17  2:27 ` Alistair Francis
  2023-05-17  7:54   ` Li, Yong
  0 siblings, 1 reply; 3+ messages in thread
From: Alistair Francis @ 2023-05-17  2:27 UTC (permalink / raw)
  To: Yong Li; +Cc: qemu-devel, Zhiwei Liu

On Sun, Apr 23, 2023 at 11:39 PM Yong Li <yong.li@intel.com> wrote:
>
> 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

>
> Signed-off-by: Yong Li <yong.li@intel.com>
> Cc: "Zhiwei Liu" <zhiwei_liu@linux.alibaba.com>
> ---
>  hw/riscv/virt.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
> index 4e3efbee16..b38b41e685 100644
> --- a/hw/riscv/virt.c
> +++ b/hw/riscv/virt.c
> @@ -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
>
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] hw/riscv/virt: Fix the boot logic if pflash0 is specified
  2023-05-17  2:27 ` Alistair Francis
@ 2023-05-17  7:54   ` Li, Yong
  0 siblings, 0 replies; 3+ messages in thread
From: Li, Yong @ 2023-05-17  7:54 UTC (permalink / raw)
  To: Alistair Francis; +Cc: qemu-devel, Zhiwei Liu, sunilvl

[-- Attachment #1: Type: text/plain, Size: 1864 bytes --]

On 2023/5/17 10:27, Alistair Francis wrote:
> On Sun, Apr 23, 2023 at 11:39 PM Yong Li<yong.li@intel.com>  wrote:
>> 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

Hi Alistair

Thanks for your review, after syncing with Sunil from ventena team.
Sunil is also working with for thishttps://www.mail-archive.com/qemu-devel@nongnu.org/msg959882.html,
and he will handle this change in his patch. Thanks


>> Signed-off-by: Yong Li<yong.li@intel.com>
>> Cc: "Zhiwei Liu"<zhiwei_liu@linux.alibaba.com>
>> ---
>>   hw/riscv/virt.c | 8 +++++---
>>   1 file changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
>> index 4e3efbee16..b38b41e685 100644
>> --- a/hw/riscv/virt.c
>> +++ b/hw/riscv/virt.c
>> @@ -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
>>
>>

[-- Attachment #2: Type: text/html, Size: 2955 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-05-17  7:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-23  9:59 [PATCH] hw/riscv/virt: Fix the boot logic if pflash0 is specified Yong Li
2023-05-17  2:27 ` Alistair Francis
2023-05-17  7:54   ` Li, Yong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).