Drop deprecated floppy config & bogus -drive if=T
v3 cover Drop deprecated floppy config & bogus -drive if=T
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 (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 | 562 +------------------------------ 8 files changed, 59 insertions(+), 719 deletions(-)
Signature · 1 line
2.26.2
PATCH v3 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
Re: [PATCH v3 1/4] docs/system/deprecated: Fix note on fdc drive properties
Quoted 10 lines · Markus Armbruster
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.Fixes 4a27a638e718b445648de6b27c709353551d9b44Signed-off-by Markus Armbruster <[email protected]>--- docs/system/deprecated.rst | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 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 :|
PATCH v3 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
Re: [PATCH v3 2/4] fdc: Drop deprecated floppy configuration
Quoted 11 lines · Markus Armbruster
Drop the crap deprecated in commit
4a27a638e7"fdc: Deprecate configuring floppies with -global isa-fdc" (v5.1.0).Signed-off-by Markus Armbruster <[email protected]>--- 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(-)
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 :|
PATCH v3 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) {
@@ -2565,6 +2551,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 ) {
@@ -2604,7 +2591,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
Re: [PATCH v3 3/4] fdc: Inline fdctrl_connect_drives() into fdctrl_realize_common()
Quoted 8 lines · Markus Armbruster
The 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.Signed-off-by Markus Armbruster <[email protected]>--- hw/block/fdc.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 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 :|
Re: [PATCH v3 3/4] fdc: Inline fdctrl_connect_drives() into fdctrl_realize_common()
In reply to Markus ArmbrusterQuoted 9 lines · Markus Armbruster
hw/block/fdc.c +1
-0@@ -2565,6 +2551,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 ) {
hw/block/fdc.c static void fdctrl_realize_common(DeviceState *dev, FDCtrl *fdctrl, · line 2596
Quoted 7 lines
hw/block/fdc.c +3
-1@@ -2604,7 +2591,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];
FWIW, the declaration could be local to this loop.
r~
Re: [PATCH v3 3/4] fdc: Inline fdctrl_connect_drives() into fdctrl_realize_common()
Quoted 17 lines · Richard Henderson
Quoted 8 lines · Markus Armbruster
hw/block/fdc.c +1
-0@@ -2565,6 +2551,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 ) {hw/block/fdc.c static void fdctrl_realize_common(DeviceState *dev, FDCtrl *fdctrl, · line 2595
Quoted 6 lines
hw/block/fdc.c +3
-1@@ -2604,7 +2591,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];FWIW, the declaration could be local to this loop.
Old-school habits. John, got a preference?
PATCH v3 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).
--- 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
@@ -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
@@ -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
@@ -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 ();
Signature · 1 line
2.26.2
Re: [PATCH v3 4/4] blockdev: Drop deprecated bogus -drive interface type
Quoted 128 lines · Markus Armbruster
Drop the crap deprecated in commit
a1b40bda08"blockdev: Deprecate -drive with bogus interface type" (v5.1.0).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 | 8 +------ 5 files changed, 23 insertions(+), 37 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@@ -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 +0
-0@@ -2460,13 +2460,7 @@ static void qemu_init_board(void)/* From here on we enter MACHINE_PHASE_INITIALIZED. */
softmmu/vl.c static void qemu_init_board(void) · line 2463
Quoted 10 lines
softmmu/vl.c +1
-7machine_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 ();
This method is already called by qemu_machine_creation_done(), which is invoked shortly after this qemu_init_board() is run.
So either this added instance, or the later call to drive_check_orphaned feels redundant
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 :|
Re: [PATCH v3 4/4] blockdev: Drop deprecated bogus -drive interface type
Quoted 143 lines · Daniel P. Berrangé
Quoted 128 lines · Markus Armbruster
Drop the crap deprecated in commit
a1b40bda08"blockdev: Deprecate -drive with bogus interface type" (v5.1.0).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 | 8 +------ 5 files changed, 23 insertions(+), 37 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@@ -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 +0
-0@@ -2460,13 +2460,7 @@ static void qemu_init_board(void)/* From here on we enter MACHINE_PHASE_INITIALIZED. */ softmmu/vl.c static void qemu_init_board(void) · line 2463
Quoted 10 lines
softmmu/vl.c +1
-7machine_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 ();This method is already called by
qemu_machine_creation_done(), which is invoked shortly after thisqemu_init_board()is run.
Quoted 2 lines
So either this added instance, or the later call to
drive_check_orphanedfeels redundant
You're right.
I'll drop the one in qemu_machine_creation_done(). Rationale:
* Before the patch, we reject -drive if=T when T != none and nothing claimed it. We warn unless the board claimed it. "Nothing claimed it" is known only after qemu_create_cli_devices().
* After the patch, we reject -drive if=T when T != none and the board didn't claim it. This is known earlier, after machine_run_board_init().
Re: [PATCH v3 4/4] blockdev: Drop deprecated bogus -drive interface type
In reply to Markus ArmbrusterQuoted 89 lines · Markus Armbruster
Drop the crap deprecated in commit
a1b40bda08"blockdev: Deprecate -drive with bogus interface type" (v5.1.0).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 | 8 +------ 5 files changed, 23 insertions(+), 37 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 +4
-13@@ -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;
blockdev.c void drive_check_orphaned(void) · line 259
Quoted 8 lines
blockdev.c +4
-1@@ -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.
"user's" ?
blockdev.c void drive_check_orphaned(void) · line 263
Quoted 4 lines
blockdev.c +4
-0+* 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.
Do you mean "as a feature" ?
Quoted 31 lines
blockdev.c +3
-8+*/ +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 +0
-1@@ -2460,13 +2460,7 @@ static void qemu_init_board(void)/* From here on we enter MACHINE_PHASE_INITIALIZED. */ machine_run_board_init (current_machine); -/*
softmmu/vl.c static void qemu_init_board(void) · line 2466
Quoted 10 lines
softmmu/vl.c +1
-6-* 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 ();
Rest looks okay as far as I am concerned, pending your response to Dan's remark.
(Sorry for being AWOL here. Thank you for taking the time to clean it up as you have; it feels like closing a book on some of the first reviews I ever got @ RH when I put the first orphan check in aeons ago! I think only the whitespace is left by now, haha.)
--js
Re: [PATCH v3 4/4] blockdev: Drop deprecated bogus -drive interface type
Quoted 91 lines · John Snow
Quoted 90 lines · Markus Armbruster
Drop the crap deprecated in commit
a1b40bda08"blockdev: Deprecate -drive with bogus interface type" (v5.1.0).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 | 8 +------ 5 files changed, 23 insertions(+), 37 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 +4
-13@@ -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)
Quoted 9 lines
blockdev.c void drive_check_orphaned(void) · line 259
Quoted 7 lines
blockdev.c +4
-1for (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. "user's" ?
Yes.
Quoted 6 lines
blockdev.c void drive_check_orphaned(void) · line 263
Quoted 4 lines
blockdev.c +4
-0+* 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. Do you mean "as a feature" ?
I mean "because leaving unclaimed IF_NONE available for device_add is a feature."
I'm embarrassingly prone to accidents when rewriting my own prose.
Quoted 45 lines
Quoted 31 lines
blockdev.c +3
-8+*/ +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 +0
-1@@ -2460,13 +2460,7 @@ static void qemu_init_board(void)/* From here on we enter MACHINE_PHASE_INITIALIZED. */ machine_run_board_init (current_machine); -/* softmmu/vl.c static void qemu_init_board(void) · line 2466
Quoted 10 lines
softmmu/vl.c +1
-6-* 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 ();Rest looks okay as far as I am concerned, pending your response to Dan's remark.
Quoted 4 lines
(Sorry for being AWOL here. Thank you for taking the time to clean it up as you have; it feels like closing a book on some of the first reviews I ever got @ RH when I put the first orphan check in aeons ago! I think only the whitespace is left by now, haha.)
It has served us well :)
Thank you, v4 coming!