qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Yong Li <yong.li@intel.com>
To: qemu-devel@nongnu.org
Cc: Yong Li <yong.li@intel.com>, "Zhiwei Liu" <zhiwei_liu@linux.alibaba.com>
Subject: [PATCH] hw/riscv/virt: Fix the boot logic if pflash0 is specified
Date: Sun, 23 Apr 2023 17:59:38 +0800	[thread overview]
Message-ID: <20230423095938.3232631-1-yong.li@intel.com> (raw)

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



             reply	other threads:[~2023-04-23 13:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-23  9:59 Yong Li [this message]
2023-05-17  2:27 ` [PATCH] hw/riscv/virt: Fix the boot logic if pflash0 is specified Alistair Francis
2023-05-17  7:54   ` Li, Yong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230423095938.3232631-1-yong.li@intel.com \
    --to=yong.li@intel.com \
    --cc=qemu-devel@nongnu.org \
    --cc=zhiwei_liu@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).