Skip to content

Commit

Permalink
fdc: Drop deprecated floppy configuration
Browse files Browse the repository at this point in the history
Drop the crap deprecated in commit 4a27a63 "fdc: Deprecate
configuring floppies with -global isa-fdc" (v5.1.0).

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Message-id: 20210309161214.1402527-3-armbru@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
  • Loading branch information
Markus Armbruster committed Mar 19, 2021
1 parent bd36f1f commit 36585e2
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 692 deletions.
49 changes: 0 additions & 49 deletions docs/system/deprecated.rst
Expand Up @@ -71,55 +71,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)
''''''''''''''''''''''''''''''''''''''''''''''''

Expand Down
50 changes: 50 additions & 0 deletions docs/system/removed-features.rst
Expand Up @@ -64,6 +64,56 @@ The 'file' driver for drives is no longer appropriate for character or host
devices and will only accept regular files (S_IFREG). The correct driver
for these file types is 'host_cdrom' or 'host_device' as appropriate.

Floppy controllers' drive properties (removed in 6.0)
'''''''''''''''''''''''''''''''''''''''''''''''''''''

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=...


QEMU Machine Protocol (QMP) commands
------------------------------------

Expand Down
54 changes: 2 additions & 52 deletions hw/block/fdc.c
Expand Up @@ -870,7 +870,6 @@ struct FDCtrl {
uint8_t num_floppies;
FDrive drives[MAX_FD];
struct {
BlockBackend *blk;
FloppyDriveType type;
} qdev_for_drives[MAX_FD];
int reset_sensei;
Expand Down Expand Up @@ -2517,56 +2516,12 @@ static void fdctrl_connect_drives(FDCtrl *fdctrl, DeviceState *fdc_dev,
{
unsigned int i;
FDrive *drive;
DeviceState *dev;
BlockBackend *blk;
bool ok;
const char *fdc_name, *drive_suffix;

for (i = 0; i < MAX_FD; i++) {
drive = &fdctrl->drives[i];
drive->fdctrl = fdctrl;

/* If the drive is not present, we skip creating the qdev device, but
* still have to initialise the controller. */
blk = fdctrl->qdev_for_drives[i].blk;
if (!blk) {
fd_init(drive);
fd_revalidate(drive);
continue;
}

fdc_name = object_get_typename(OBJECT(fdc_dev));
drive_suffix = !strcmp(fdc_name, "SUNW,fdtwo") ? "" : i ? "B" : "A";
warn_report("warning: property %s.drive%s is deprecated",
fdc_name, drive_suffix);
error_printf("Use -device floppy,unit=%d,drive=... instead.\n", i);

dev = qdev_new("floppy");
qdev_prop_set_uint32(dev, "unit", i);
qdev_prop_set_enum(dev, "drive-type", fdctrl->qdev_for_drives[i].type);

/*
* Hack alert: we move the backend from the floppy controller
* device to the floppy device. We first need to detach the
* controller, or else floppy_create()'s qdev_prop_set_drive()
* will die when it attaches floppy device. We also need to
* take another reference so that blk_detach_dev() doesn't
* free blk while we still need it.
*
* The hack is probably a bad idea.
*/
blk_ref(blk);
blk_detach_dev(blk, fdc_dev);
fdctrl->qdev_for_drives[i].blk = NULL;
ok = qdev_prop_set_drive_err(dev, "drive", blk, errp);
blk_unref(blk);
if (!ok) {
return;
}

if (!qdev_realize_and_unref(dev, &fdctrl->bus.bus, errp)) {
return;
}
fd_init(drive);
fd_revalidate(drive);
}
}

Expand Down Expand Up @@ -2882,8 +2837,6 @@ static Property isa_fdc_properties[] = {
DEFINE_PROP_UINT32("iobase", FDCtrlISABus, iobase, 0x3f0),
DEFINE_PROP_UINT32("irq", FDCtrlISABus, irq, 6),
DEFINE_PROP_UINT32("dma", FDCtrlISABus, dma, 2),
DEFINE_PROP_DRIVE("driveA", FDCtrlISABus, state.qdev_for_drives[0].blk),
DEFINE_PROP_DRIVE("driveB", FDCtrlISABus, state.qdev_for_drives[1].blk),
DEFINE_PROP_SIGNED("fdtypeA", FDCtrlISABus, state.qdev_for_drives[0].type,
FLOPPY_DRIVE_TYPE_AUTO, qdev_prop_fdc_drive_type,
FloppyDriveType),
Expand Down Expand Up @@ -2941,8 +2894,6 @@ static const VMStateDescription vmstate_sysbus_fdc ={
};

static Property sysbus_fdc_properties[] = {
DEFINE_PROP_DRIVE("driveA", FDCtrlSysBus, state.qdev_for_drives[0].blk),
DEFINE_PROP_DRIVE("driveB", FDCtrlSysBus, state.qdev_for_drives[1].blk),
DEFINE_PROP_SIGNED("fdtypeA", FDCtrlSysBus, state.qdev_for_drives[0].type,
FLOPPY_DRIVE_TYPE_AUTO, qdev_prop_fdc_drive_type,
FloppyDriveType),
Expand Down Expand Up @@ -2971,7 +2922,6 @@ static const TypeInfo sysbus_fdc_info = {
};

static Property sun4m_fdc_properties[] = {
DEFINE_PROP_DRIVE("drive", FDCtrlSysBus, state.qdev_for_drives[0].blk),
DEFINE_PROP_SIGNED("fdtype", FDCtrlSysBus, state.qdev_for_drives[0].type,
FLOPPY_DRIVE_TYPE_AUTO, qdev_prop_fdc_drive_type,
FloppyDriveType),
Expand Down
31 changes: 1 addition & 30 deletions tests/qemu-iotests/172
Expand Up @@ -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 ===
Expand All @@ -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

Expand Down Expand Up @@ -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

Expand All @@ -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
Expand Down

0 comments on commit 36585e2

Please sign in to comment.