Skip to contentSkip to conversation

Drop deprecated floppy config & bogus -drive if=T

PATCH Superseded Markus Armbruster 2 participants 6 messages Jan 25, 2021 – Jan 26, 2021

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

cover Drop deprecated floppy config & bogus -drive if=T

Markus Armbruster (3):
fdc: Drop deprecated floppy configuration
fdc: Inline fdctrl_connect_drives() into fdctrl_realize_common()
blockdev: Drop deprecated bogus -drive interface type

 docs/system/deprecated.rst       |  33 --
 docs/system/removed-features.rst |  33 ++
 include/sysemu/blockdev.h        |   1 -
 blockdev.c                       |  37 +-
 hw/block/fdc.c                   |  73 +---
 softmmu/vl.c                     |   8 +-
 tests/qemu-iotests/172           |  31 +-
 tests/qemu-iotests/172.out       | 571 +------------------------------
 8 files changed, 59 insertions(+), 728 deletions(-)
Signature · 1 line
2.26.2
#1 lore raw

PATCH 1/3 fdc: Drop deprecated floppy configuration

Drop the crap deprecated in commit 4a27a638e7 "fdc: Deprecate configuring floppies with -global isa-fdc" (v5.1.0).

---
 docs/system/deprecated.rst       |  26 --
 docs/system/removed-features.rst |  26 ++
 hw/block/fdc.c                   |  54 +--
 tests/qemu-iotests/172           |  31 +-
 tests/qemu-iotests/172.out       | 571 +------------------------------
 5 files changed, 30 insertions(+), 678 deletions(-)
docs/system/deprecated.rst +0 -26
index 9de663526a..ccbddc79ff 100644
@@ -94,32 +94,6 @@ QEMU 5.1 has three options:
       to the user to load all the images they need.
  3. ``-bios <file>`` - Tells QEMU to load the specified file as the firmwrae.
 
-``Configuring floppies with ``-global``
-'''''''''''''''''''''''''''''''''''''''
-
-Use ``-device floppy,...`` instead:
-::
-
-    -global isa-fdc.driveA=...
-    -global sysbus-fdc.driveA=...
-    -global SUNW,fdtwo.drive=...
-
-become
-::
-
-    -device floppy,unit=0,drive=...
-
-and
-::
-
-    -global isa-fdc.driveB=...
-    -global sysbus-fdc.driveB=...
-
-become
-::
-
-    -device floppy,unit=1,drive=...
-
 ``-drive`` with bogus interface type
 ''''''''''''''''''''''''''''''''''''
 
docs/system/removed-features.rst +26 -0
index 88b81a6156..d17c39bce3 100644
@@ -38,6 +38,32 @@ or ``-display default,show-cursor=on`` instead.
 QEMU 5.0 introduced an alternative syntax to specify the size of the translation
 block cache, ``-accel tcg,tb-size=``.
 
+``Configuring floppies with ``-global`` (removed in 6.0)
+''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+
+Use ``-device floppy,...`` instead:
+::
+
+    -global isa-fdc.driveA=...
+    -global sysbus-fdc.driveA=...
+    -global SUNW,fdtwo.drive=...
+
+become
+::
+
+    -device floppy,unit=0,drive=...
+
+and
+::
+
+    -global isa-fdc.driveB=...
+    -global sysbus-fdc.driveB=...
+
+become
+::
+
+    -device floppy,unit=1,drive=...
+
 QEMU Machine Protocol (QMP) commands
 ------------------------------------
 
hw/block/fdc.c +2 -52

88 lines not on this page · raw message

tests/qemu-iotests/172 +1 -30
index 0ac942a6c5..ff269ca7b5 100755
@@ -123,15 +123,6 @@ check_floppy_qtree -drive if=floppy,file="$TEST_IMG"
 check_floppy_qtree -drive if=floppy,file="$TEST_IMG",index=1
 check_floppy_qtree -drive if=floppy,file="$TEST_IMG" -drive if=floppy,file="$TEST_IMG.2",index=1
 
-echo
-echo
-echo === Using -drive if=none and -global ===
-
-check_floppy_qtree -drive if=none,file="$TEST_IMG" -global isa-fdc.driveA=none0
-check_floppy_qtree -drive if=none,file="$TEST_IMG" -global isa-fdc.driveB=none0
-check_floppy_qtree -drive if=none,file="$TEST_IMG" -drive if=none,file="$TEST_IMG.2" \
-                   -global isa-fdc.driveA=none0 -global isa-fdc.driveB=none1
-
 echo
 echo
 echo === Using -drive if=none and -device ===
@@ -145,13 +136,6 @@ echo
 echo
 echo === Mixing -fdX and -global ===
 
-# Working
-check_floppy_qtree -fda "$TEST_IMG" -drive if=none,file="$TEST_IMG.2" -global isa-fdc.driveB=none0
-check_floppy_qtree -fdb "$TEST_IMG" -drive if=none,file="$TEST_IMG.2" -global isa-fdc.driveA=none0
-
-# Conflicting
-check_floppy_qtree -fda "$TEST_IMG" -drive if=none,file="$TEST_IMG.2" -global isa-fdc.driveA=none0
-check_floppy_qtree -fdb "$TEST_IMG" -drive if=none,file="$TEST_IMG.2" -global isa-fdc.driveB=none0
 # Conflicting, -fdX wins
 check_floppy_qtree -fda "$TEST_IMG" -drive if=none,file="$TEST_IMG.2" -global floppy.drive=none0
 
@@ -186,23 +170,10 @@ echo
 echo === Mixing -global and -device ===
 
 # Working
-check_floppy_qtree -drive if=none,file="$TEST_IMG" -drive if=none,file="$TEST_IMG.2" \
-                   -global isa-fdc.driveA=none0 -device floppy,drive=none1
-check_floppy_qtree -drive if=none,file="$TEST_IMG" -drive if=none,file="$TEST_IMG.2" \
-                   -global isa-fdc.driveA=none0 -device floppy,drive=none1,unit=1
-
-check_floppy_qtree -drive if=none,file="$TEST_IMG" -drive if=none,file="$TEST_IMG.2" \
-                   -global isa-fdc.driveB=none0 -device floppy,drive=none1
-check_floppy_qtree -drive if=none,file="$TEST_IMG" -drive if=none,file="$TEST_IMG.2" \
-                   -global isa-fdc.driveB=none0 -device floppy,drive=none1,unit=0
 check_floppy_qtree -drive if=none,file="$TEST_IMG" \
                    -global floppy.drive=none0 -device floppy,unit=0
 
 # Conflicting
-check_floppy_qtree -drive if=none,file="$TEST_IMG" -drive if=none,file="$TEST_IMG.2" \
-                   -global isa-fdc.driveA=none0 -device floppy,drive=none1,unit=0
-check_floppy_qtree -drive if=none,file="$TEST_IMG" -drive if=none,file="$TEST_IMG.2" \
-                   -global isa-fdc.driveB=none0 -device floppy,drive=none1,unit=1
 check_floppy_qtree -drive if=none,file="$TEST_IMG" -drive if=none,file="$TEST_IMG.2" \
                    -global floppy.drive=none0 -device floppy,drive=none1,unit=0
 
@@ -227,7 +198,7 @@ echo === Too many floppy drives ===
 check_floppy_qtree -drive if=floppy,file="$TEST_IMG" \
                    -drive if=none,file="$TEST_IMG.2" \
                    -drive if=none,file="$TEST_IMG.3" \
-                   -global isa-fdc.driveB=none0 \
+                   -device floppy,drive=none0 \
                    -device floppy,drive=none1
 
 echo
tests/qemu-iotests/172.out +1 -570

757 lines not on this page · raw message

Signature · 1 line
2.26.2
#2 lore raw

PATCH 2/3 fdc: Inline fdctrl_connect_drives() into fdctrl_realize_common()

In reply to Markus Armbruster

The previous commit rendered the name fdctrl_realize_common() somewhat misleading. Get rid of it by inlining the (now pretty simple) function into its only caller.

---
 hw/block/fdc.c | 23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)
hw/block/fdc.c +8 -15
index c6c9393e29..7fc547c62d 100644
@@ -2521,20 +2521,6 @@ void isa_fdc_init_drives(ISADevice *fdc, DriveInfo **fds)
     fdctrl_init_drives(&ISA_FDC(fdc)->state.bus, fds);
 }
 
-static void fdctrl_connect_drives(FDCtrl *fdctrl, DeviceState *fdc_dev,
-                                  Error **errp)
-{
-    unsigned int i;
-    FDrive *drive;
-
-    for (i = 0; i < MAX_FD; i++) {
-        drive = &fdctrl->drives[i];
-        drive->fdctrl = fdctrl;
-        fd_init(drive);
-        fd_revalidate(drive);
-    }
-}
-
 void fdctrl_init_sysbus(qemu_irq irq, int dma_chann,
                         hwaddr mmio_base, DriveInfo **fds)
 {
@@ -2575,6 +2561,7 @@ static void fdctrl_realize_common(DeviceState *dev, FDCtrl *fdctrl,
                                   Error **errp)
 {
     int i, j;
+    FDrive *drive;
     static int command_tables_inited = 0;
 
     if (fdctrl->fallback == FLOPPY_DRIVE_TYPE_AUTO) {
@@ -2614,7 +2601,13 @@ static void fdctrl_realize_common(DeviceState *dev, FDCtrl *fdctrl,
     }
 
     floppy_bus_create(fdctrl, &fdctrl->bus, dev);
-    fdctrl_connect_drives(fdctrl, dev, errp);
+
+    for (i = 0; i < MAX_FD; i++) {
+        drive = &fdctrl->drives[i];
+        drive->fdctrl = fdctrl;
+        fd_init(drive);
+        fd_revalidate(drive);
+    }
 }
 
 static const MemoryRegionPortio fdc_portio_list[] = {
Signature · 1 line
2.26.2
#3 lore raw

Re: [PATCH 2/3] fdc: Inline fdctrl_connect_drives() into fdctrl_realize_common()

Am 25.01.2021 um 17:24 hat Markus Armbruster geschrieben:

Quoted 14 lines

The previous commit rendered the name fdctrl_realize_common() somewhat misleading. Get rid of it by inlining the (now pretty simple) function into its only caller.

---
 hw/block/fdc.c | 23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)
hw/block/fdc.c +0 -0
index c6c9393e29..7fc547c62d 100644

hw/block/fdc.c void isa_fdc_init_drives(ISADevice *fdc, DriveInfo **fds) · line 2525

Quoted 5 lines
hw/block/fdc.c +0 -2
@@ -2521,20 +2521,6 @@ void isa_fdc_init_drives(ISADevice *fdc, DriveInfo **fds)
     fdctrl_init_drives(&ISA_FDC(fdc)->state.bus, fds);
 }
 
-static void fdctrl_connect_drives(FDCtrl *fdctrl, DeviceState *fdc_dev,
-                                  Error **errp)

The commit message talks about fdctrl_realize_common(). I assume it really means fdctrl_connect_drives() then?

Kevin

#4 lore raw

Re: [PATCH 2/3] fdc: Inline fdctrl_connect_drives() into fdctrl_realize_common()

Quoted 18 lines · Kevin Wolf

Am 25.01.2021 um 17:24 hat Markus Armbruster geschrieben:

Quoted 17 lines

The previous commit rendered the name fdctrl_realize_common() somewhat misleading. Get rid of it by inlining the (now pretty simple) function into its only caller.

---
 hw/block/fdc.c | 23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)
hw/block/fdc.c +0 -0
index c6c9393e29..7fc547c62d 100644
@@ -2521,20 +2521,6 @@ void isa_fdc_init_drives(ISADevice *fdc, DriveInfo **fds)
     fdctrl_init_drives(&ISA_FDC(fdc)->state.bus, fds);
 }
 
Quoted 5 lines

hw/block/fdc.c void isa_fdc_init_drives(ISADevice *fdc, DriveInfo **fds) · line 2525

Quoted 2 lines
hw/block/fdc.c +0 -2
-static void fdctrl_connect_drives(FDCtrl *fdctrl, DeviceState *fdc_dev,
-                                  Error **errp)

The commit message talks about fdctrl_realize_common(). I assume it really means fdctrl_connect_drives() then?

Yes. dabbrev-expand accident. Thanks for spotting it!

#5 lore raw

PATCH 3/3 blockdev: Drop deprecated bogus -drive interface type

In reply to Markus Armbruster

Drop the crap deprecated in commit a1b40bda08 "blockdev: Deprecate -drive with bogus interface type" (v5.1.0).

---
 docs/system/deprecated.rst       |  7 ------
 docs/system/removed-features.rst |  7 ++++++
 include/sysemu/blockdev.h        |  1 -
 blockdev.c                       | 37 +++++++++++++-------------------
 softmmu/vl.c                     |  8 +------
 5 files changed, 23 insertions(+), 37 deletions(-)
docs/system/deprecated.rst +0 -7
index ccbddc79ff..2d0c46ec63 100644
@@ -94,13 +94,6 @@ QEMU 5.1 has three options:
       to the user to load all the images they need.
  3. ``-bios <file>`` - Tells QEMU to load the specified file as the firmwrae.
 
-``-drive`` with bogus interface type
-''''''''''''''''''''''''''''''''''''
-
-Drives with interface types other than ``if=none`` are for onboard
-devices.  It is possible to use drives the board doesn't pick up with
--device.  This usage is now deprecated.  Use ``if=none`` instead.
-
 Short-form boolean options (since 6.0)
 ''''''''''''''''''''''''''''''''''''''
 
docs/system/removed-features.rst +7 -0
index d17c39bce3..61c3f504b0 100644
@@ -64,6 +64,13 @@ become
 
     -device floppy,unit=1,drive=...
 
+``-drive`` with bogus interface type (removed in 6.0)
+'''''''''''''''''''''''''''''''''''''''''''''''''''''
+
+Drives with interface types other than ``if=none`` are for onboard
+devices.  Drives the board doesn't pick up can no longer be used with
+-device.  Use ``if=none`` instead.
+
 QEMU Machine Protocol (QMP) commands
 ------------------------------------
 
include/sysemu/blockdev.h +0 -1
index 3b5fcda08d..32c2d6023c 100644
@@ -35,7 +35,6 @@ struct DriveInfo {
     bool is_default;            /* Added by default_drive() ?  */
     int media_cd;
     QemuOpts *opts;
-    bool claimed_by_board;
     QTAILQ_ENTRY(DriveInfo) next;
 };
 
blockdev.c +15 -22
index 2431448c5d..8e7be8b7b1 100644
@@ -240,19 +240,10 @@ DriveInfo *drive_get(BlockInterfaceType type, int bus, int unit)
     return NULL;
 }
 
-void drive_mark_claimed_by_board(void)
-{
-    BlockBackend *blk;
-    DriveInfo *dinfo;
-
-    for (blk = blk_next(NULL); blk; blk = blk_next(blk)) {
-        dinfo = blk_legacy_dinfo(blk);
-        if (dinfo && blk_get_attached_dev(blk)) {
-            dinfo->claimed_by_board = true;
-        }
-    }
-}
-
+/*
+ * Check board claimed all -drive that are meant to be claimed.
+ * Fatal error if any remain unclaimed.
+ */
 void drive_check_orphaned(void)
 {
     BlockBackend *blk;
@@ -262,7 +253,17 @@ void drive_check_orphaned(void)
 
     for (blk = blk_next(NULL); blk; blk = blk_next(blk)) {
         dinfo = blk_legacy_dinfo(blk);
-        if (dinfo->is_default || dinfo->type == IF_NONE) {
+        /*
+         * Ignore default drives, because we create certain default
+         * drives unconditionally, then leave them unclaimed.  Not the
+         * users fault.
+         * Ignore IF_VIRTIO, because it gets desugared into -device,
+         * so we can leave failing to -device.
+         * Ignore IF_NONE, because leaving unclaimed IF_NONE remains
+         * available for device_add is a feature.
+         */
+        if (dinfo->is_default || dinfo->type == IF_VIRTIO
+            || dinfo->type == IF_NONE) {
             continue;
         }
         if (!blk_get_attached_dev(blk)) {
@@ -273,14 +274,6 @@ void drive_check_orphaned(void)
                          if_name[dinfo->type], dinfo->bus, dinfo->unit);
             loc_pop(&loc);
             orphans = true;
-            continue;
-        }
-        if (!dinfo->claimed_by_board && dinfo->type != IF_VIRTIO) {
-            loc_push_none(&loc);
-            qemu_opts_loc_restore(dinfo->opts);
-            warn_report("bogus if=%s is deprecated, use if=none",
-                        if_name[dinfo->type]);
-            loc_pop(&loc);
         }
     }
 
softmmu/vl.c +1 -7
index a8876b8965..81766cd568 100644
@@ -2454,13 +2454,7 @@ static void qemu_init_board(void)
     /* From here on we enter MACHINE_PHASE_INITIALIZED.  */
     machine_run_board_init(current_machine);
 
-    /*
-     * TODO To drop support for deprecated bogus if=..., move
-     * drive_check_orphaned() here, replacing this call.  Also drop
-     * its deprecation warning, along with DriveInfo member
-     * @claimed_by_board.
-     */
-    drive_mark_claimed_by_board();
+    drive_check_orphaned();
 
     realtime_init();
 
Signature · 1 line
2.26.2