qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Huber <sebastian.huber@embedded-brains.de>
To: qemu-devel@nongnu.org
Subject: [PATCH] hw/riscv: Fix test for microchi-icicle-kit
Date: Fri, 14 Mar 2025 09:02:40 +0100	[thread overview]
Message-ID: <20250314080240.26383-1-sebastian.huber@embedded-brains.de> (raw)

Fix this test failure:

  $ QTEST_QEMU_BINARY=./build/qemu-system-riscv64 \
    ./build/tests/qtest/qom-test
  (...)
  # slow test /riscv64/qom/amd-microblaze-v-generic executed in 2.28 \
    secs
  # starting QEMU: exec ./build/qemu-system-riscv64 -qtest
    unix:/tmp/qtest-1361875.sock -qtest-log /dev/null -chardev \
    socket,path=/tmp/qtest-1361875.qmp,id=char0 -mon \
    chardev=char0,mode=control -display none -audio none -machine \
    microchip-icicle-kit -accel qtest
  **
  ERROR:../hw/riscv/boot.c:164:riscv_load_firmware: assertion failed: \
   (firmware_filename != NULL)
  Bail out! ERROR:../hw/riscv/boot.c:164:riscv_load_firmware: \
    assertion failed: (firmware_filename != NULL)

Use an approach similar to riscv_find_and_load_firmware().

Reported-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
---
 hw/riscv/microchip_pfsoc.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/hw/riscv/microchip_pfsoc.c b/hw/riscv/microchip_pfsoc.c
index 9068eed780..616bb63982 100644
--- a/hw/riscv/microchip_pfsoc.c
+++ b/hw/riscv/microchip_pfsoc.c
@@ -609,12 +609,14 @@ static void microchip_icicle_kit_machine_init(MachineState *machine)
     }
 
     /* Load the firmware if necessary */
+    firmware_end_addr = firmware_load_addr;
     if (firmware_name) {
-        const char *filename = riscv_find_firmware(firmware_name, NULL);
-        firmware_end_addr = riscv_load_firmware(filename, &firmware_load_addr,
-                                                NULL);
-    } else {
-        firmware_end_addr = firmware_load_addr;
+        char *filename = riscv_find_firmware(firmware_name, NULL);
+        if (filename) {
+            firmware_end_addr = riscv_load_firmware(filename,
+                                                    &firmware_load_addr, NULL);
+            g_free(filename);
+        }
     }
 
     riscv_boot_info_init(&boot_info, &s->soc.u_cpus);
-- 
2.43.0



                 reply	other threads:[~2025-03-14  8:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20250314080240.26383-1-sebastian.huber@embedded-brains.de \
    --to=sebastian.huber@embedded-brains.de \
    --cc=qemu-devel@nongnu.org \
    /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).