Drop deprecated floppy config & bogus -drive if=T
v4 cover Drop deprecated floppy config & bogus -drive if=T
v4:
* PATCH 3: Move a declaration into a loop [Richard]
* PATCH 4: Drop a superfluous call to drive_check_orphaned() [Daniel], fix comments [John]
v3:
* PATCH 1: New [Daniel]
v2:
* Rebased, straightforward conflict with commit f5d33dd51f "hw/block/fdc: Remove the check_media_rate property" resolved
* PATCH 2: Commit message fixed [Kevin]
Markus Armbruster (4):
docs/system/deprecated: Fix note on fdc drive properties
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 | 56 +++ include/sysemu/blockdev.h | 1 - blockdev.c | 37 +- hw/block/fdc.c | 73 +--- softmmu/vl.c | 11 +- tests/qemu-iotests/172 | 31 +- tests/qemu-iotests/172.out | 562 +------------------------------ 8 files changed, 82 insertions(+), 722 deletions(-)
Signature · 1 line
2.26.2
PATCH v4 1/4 docs/system/deprecated: Fix note on fdc drive properties
Commit 4a27a638e7 "fdc: Deprecate configuring floppies with -global isa-fdc" actually deprecated any use of floppy controller driver properties, not just with -global. Correct the deprecation note accordingly.
--- docs/system/deprecated.rst | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-)
docs/system/deprecated.rst +28 -5
@@ -94,10 +94,11 @@ 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`` -''''''''''''''''''''''''''''''''''''''' +Floppy controllers' drive properties (since 5.1) +'''''''''''''''''''''''''''''''''''''''''''''''' -Use ``-device floppy,...`` instead: +Use ``-device floppy,...`` instead. When configuring onboard floppy +controllers :: -global isa-fdc.driveA=...
@@ -120,8 +121,30 @@ become -device floppy,unit=1,drive=... -``-drive`` with bogus interface type -'''''''''''''''''''''''''''''''''''' +When plugging in a floppy controller +:: + + -device isa-fdc,...,driveA=... + +becomes +:: + + -device isa-fdc,... + -device floppy,unit=0,drive=... + +and +:: + + -device isa-fdc,...,driveB=... + +becomes +:: + + -device isa-fdc,... + -device floppy,unit=1,drive=... + +``-drive`` with bogus interface type (since 5.1) +'''''''''''''''''''''''''''''''''''''''''''''''' 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
Signature · 1 line
2.26.2
PATCH v4 2/4 fdc: Drop deprecated floppy configuration
In reply to Markus ArmbrusterDrop the crap deprecated in commit 4a27a638e7 "fdc: Deprecate configuring floppies with -global isa-fdc" (v5.1.0).
--- docs/system/deprecated.rst | 49 --- docs/system/removed-features.rst | 49 +++ hw/block/fdc.c | 54 +-- tests/qemu-iotests/172 | 31 +- tests/qemu-iotests/172.out | 562 +------------------------------ 5 files changed, 53 insertions(+), 692 deletions(-)
docs/system/deprecated.rst +0 -49
@@ -94,55 +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. -Floppy controllers' drive properties (since 5.1) -'''''''''''''''''''''''''''''''''''''''''''''''' - -Use ``-device floppy,...`` instead. When configuring onboard floppy -controllers -:: - - -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=... - -When plugging in a floppy controller -:: - - -device isa-fdc,...,driveA=... - -becomes -:: - - -device isa-fdc,... - -device floppy,unit=0,drive=... - -and -:: - - -device isa-fdc,...,driveB=... - -becomes -:: - - -device isa-fdc,... - -device floppy,unit=1,drive=... - ``-drive`` with bogus interface type (since 5.1) ''''''''''''''''''''''''''''''''''''''''''''''''
docs/system/removed-features.rst +49 -0
55 lines not on this page · raw message
hw/block/fdc.c +2 -52
88 lines not on this page · raw message
tests/qemu-iotests/172 +1 -30
@@ -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 -561
748 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH v4 3/4 fdc: Inline fdctrl_connect_drives() into fdctrl_realize_common()
In reply to Markus ArmbrusterThe previous commit rendered the name fdctrl_connect_drives() 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
@@ -2511,20 +2511,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) {
@@ -2604,7 +2590,14 @@ 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++) { +FDrive *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
PATCH v4 4/4 blockdev: Drop deprecated bogus -drive interface type
In reply to Markus ArmbrusterDrop the crap deprecated in commit a1b40bda08 "blockdev: Deprecate -drive with bogus interface type" (v5.1.0).
drive_check_orphaned() no longer depends on qemu_create_cli_devices(). Call it right after board initialization for clarity.
--- docs/system/deprecated.rst | 7 ------ docs/system/removed-features.rst | 7 ++++++ include/sysemu/blockdev.h | 1 - blockdev.c | 37 +++++++++++++------------------- softmmu/vl.c | 11 +--------- 5 files changed, 23 insertions(+), 40 deletions(-)
docs/system/deprecated.rst +0 -7
@@ -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 (since 5.1) -'''''''''''''''''''''''''''''''''''''''''''''''' - -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
@@ -87,6 +87,13 @@ becomes -device isa-fdc,... -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
@@ -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
@@ -239,19 +239,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;
@@ -261,7 +252,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 +* user's fault. +* Ignore IF_VIRTIO, because it gets desugared into -device. +* Leave failing to -device. +* Ignore IF_NONE, because leaving unclaimed IF_NONE 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)) {
@@ -272,14 +273,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 -10
@@ -2460,13 +2460,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 ();
@@ -2500,9 +2494,6 @@ static void qemu_machine_creation_done(void) {MachineState *machine =MACHINE (qdev_get_machine ()); -/* Did we create any drives that we failed to create a device for? */ -drive_check_orphaned (); -/* Don't warn about the default network setup that you get if * no command line -net or -netdev options are specified. There * are two cases that we would otherwise complain about:
Signature · 1 line
2.26.2
Re: [PATCH v4 4/4] blockdev: Drop deprecated bogus -drive interface type
Quoted 6 lines · Markus Armbruster
Drop the crap deprecated in commit
a1b40bda08"blockdev: Deprecate -drive with bogus interface type" (v5.1.0).
drive_check_orphaned()no longer depends onqemu_create_cli_devices(). Call it right after board initialization for clarity.
Quoted 8 lines
Signed-off-by Markus Armbruster <[email protected]>--- docs/system/deprecated.rst | 7 ------ docs/system/removed-features.rst | 7 ++++++ include/sysemu/blockdev.h | 1 - blockdev.c | 37 +++++++++++++------------------- softmmu/vl.c | 11 +--------- 5 files changed, 23 insertions(+), 40 deletions(-)
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Quoted 19 lines · Markus Armbruster
v4:
* PATCH 3: Move a declaration into a loop [Richard]
* PATCH 4: Drop a superfluous call todrive_check_orphaned()[Daniel], fix comments [John]v3:
* PATCH 1: New [Daniel]v2:
* Rebased, straightforward conflict with commitf5d33dd51f"hw/block/fdc: Remove thecheck_media_rateproperty" resolved
* PATCH 2: Commit message fixed [Kevin]Markus Armbruster (4):
docs/system/deprecated: Fix note on fdc drive properties
fdc: Drop deprecated floppy configuration
fdc: Inlinefdctrl_connect_drives()intofdctrl_realize_common()
blockdev: Drop deprecated bogus -drive interface type
Quoted 10 lines
docs/system/deprecated.rst | 33 -- docs/system/removed-features.rst | 56 +++ include/sysemu/blockdev.h | 1 - blockdev.c | 37 +- hw/block/fdc.c | 73 +--- softmmu/vl.c | 11 +- tests/qemu-iotests/172 | 31 +- tests/qemu-iotests/172.out | 562 +------------------------------ 8 files changed, 82 insertions(+), 722 deletions(-)
Tentatively staged, pending CI:
https://gitlab.com/jsnow/qemu/-/pipelines/269277138
--js