Skip to contentSkip to conversation

hw/arm/vexpress: Forbid specifying flash contents in two ways at once

PATCH In review Peter Maydell 2 participants 2 messages Jun 10, 2014 – Jun 13, 2014 Arm/versatile express platform

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/arm/vexpress: Forbid specifying flash contents in two ways at once

Detect attempts by the user to specify the contents fo the first flash device via both -bios and -drive if=pflash... simultaneously and print a helpful error message.

---
This rules out a nonsensical combination and matches what we're going to do with the 'virt' machine.

 hw/arm/vexpress.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
hw/arm/vexpress.c +9 -1
index f311595..3d83e6c 100644
@@ -533,7 +533,15 @@ static void vexpress_common_init(VEDBoardInfo *daughterboard,
      * If a bios file was provided, attempt to map it into memory
      */
     if (bios_name) {
-        const char *fn = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
+        const char *fn;
+
+        if (drive_get(IF_PFLASH, 0, 0)) {
+            error_report("The contents of the first flash device may be "
+                         "specified with -bios or with -drive if=pflash... "
+                         "but you cannot use both options at once");
+            exit(1);
+        }
+        fn = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
         if (!fn || load_image_targphys(fn, map[VE_NORFLASH0],
                                        VEXPRESS_FLASH_SIZE) < 0) {
             error_report("Could not load ROM image '%s'", bios_name);
Signature · 1 line
1.9.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 1 line · Peter Maydell

Detect attempts by the user to specify the contents fo the first flash

"for" or "of"

Quoted 4 lines

device via both -bios and -drive if=pflash... simultaneously and print a helpful error message.

Otherwise:

Quoted 32 lines

---
This rules out a nonsensical combination and matches what we're going to do with the 'virt' machine.

 hw/arm/vexpress.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
hw/arm/vexpress.c +9 -2
index f311595..3d83e6c 100644
@@ -533,7 +533,15 @@ static void vexpress_common_init(VEDBoardInfo *daughterboard,
      * If a bios file was provided, attempt to map it into memory
      */
     if (bios_name) {
-        const char *fn = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
+        const char *fn;
+
+        if (drive_get(IF_PFLASH, 0, 0)) {
+            error_report("The contents of the first flash device may be "
+                         "specified with -bios or with -drive if=pflash... "
+                         "but you cannot use both options at once");
+            exit(1);
+        }
+        fn = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
         if (!fn || load_image_targphys(fn, map[VE_NORFLASH0],
                                        VEXPRESS_FLASH_SIZE) < 0) {
             error_report("Could not load ROM image '%s'", bios_name);
--

1.9.2