Qdev patches for 2020-06-23

-----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCAAwFiEENUvIs9frKmtoZ05fOHC0AOuRhlMFAl7yDNwSHGFybWJydUBy
 ZWRoYXQuY29tAAoJEDhwtADrkYZTHQkP/jAhlXBYO80EWl9dt/0o3tcJhzc8w/WU
 micNJPpRA90hLhAARivGbfHiiUl0sUpqiBN37/vacV3WhV9kTQoJr2owbhoGTAeg
 arvH0RyEPUWszy84kIISWpMLBEkDZZG8dHtSbqOfexFmf05vb47obqAz8okVE7kH
 7nylEzNn//D8IR9owR7qt2lSnDE8ISVPiZsd4djL9sE+5B+t0wx/dwudnlE8Q4fh
 jdLHGDJJ8xNQEQwfKZAtMb/82K+hEhQhv/JZ2Z+e3WWcsUtDyXKken8kxxbK86ZP
 Oz0FE1cFW2xh9NVsTYuLmS2sczCbq0LRAY5PWC+0O8EDqhDQAXjSMYCDvaIADOhs
 iGhl4SjExWRVq7xScSrrOi4S6yUTSWNxMhCxWSft9JU7fOZPQ/Fw3l6SudBIACbm
 YgkRatruLWnQTyFRdQa+HuYFdUyo6WlpUWBhVIpESCVB8tQMVuFK6bremKvD4A9y
 ZxzDI0FDOzXBUWf7Ebyhf6HV98UqAt39n2yyXPvHmG1PDunPrqwvTmpD0bVcGbdb
 l7jR9Pj7mUZc69QAkZ6g5wYivEkTmsZX7PhQn9M8RZoIrk0g5kHfP7FR9/pYr9g9
 9EQjGX5CWuRzxkRJHqWPYIWTVZI6uxePyeGSchsV1mTr0/1S/3zm7qu8Tr8mzBds
 m5iHhdz/xB23
 =Fhsu
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/armbru/tags/pull-qdev-2020-06-23' into staging

Qdev patches for 2020-06-23

# gpg: Signature made Tue 23 Jun 2020 15:08:28 BST
# gpg:                using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653
# gpg:                issuer "armbru@redhat.com"
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full]
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>" [full]
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653

* remotes/armbru/tags/pull-qdev-2020-06-23:
  sd/milkymist-memcard: Fix error API violation
  sd/pxa2xx_mmci: Don't crash on pxa2xx_mmci_init() error
  arm/aspeed: Drop aspeed_board_init_flashes() parameter @errp
  qdev: Make qdev_prop_set_drive() match the other helpers
  qdev: Reject chardev property override
  qdev: Reject drive property override
  qdev: Improve netdev property override error a bit
  qdev: Eliminate get_pointer(), set_pointer()
  blockdev: Deprecate -drive with bogus interface type
  docs/qdev-device-use.txt: Update section "Default Devices"
  fdc: Deprecate configuring floppies with -global isa-fdc
  fdc: Open-code fdctrl_init_isa()
  fdc: Reject clash between -drive if=floppy and -global isa-fdc
  iotests/172: Cover -global floppy.drive=...
  iotests/172: Cover empty filename and multiple use of drives
  iotests/172: Include "info block" in test output

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2020-06-25 09:34:52 +01:00
commit 0250c595c9
44 changed files with 928 additions and 270 deletions

View File

@ -239,6 +239,19 @@ 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;
}
}
}
void drive_check_orphaned(void)
{
BlockBackend *blk;
@ -248,8 +261,10 @@ void drive_check_orphaned(void)
for (blk = blk_next(NULL); blk; blk = blk_next(blk)) {
dinfo = blk_legacy_dinfo(blk);
if (!blk_get_attached_dev(blk) && !dinfo->is_default &&
dinfo->type != IF_NONE) {
if (dinfo->is_default || dinfo->type == IF_NONE) {
continue;
}
if (!blk_get_attached_dev(blk)) {
loc_push_none(&loc);
qemu_opts_loc_restore(dinfo->opts);
error_report("machine type does not support"
@ -257,6 +272,14 @@ 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);
}
}

View File

@ -104,15 +104,10 @@ The -device argument differs in detail for each type of drive:
* if=floppy
-global isa-fdc.driveA=DRIVE-ID
-global isa-fdc.driveB=DRIVE-ID
-device floppy,unit=UNIT,drive=DRIVE-ID
This is -global instead of -device, because the floppy controller is
created automatically, and we want to configure that one, not create
a second one (which isn't possible anyway).
Without any -global isa-fdc,... you get an empty driveA and no
driveB. You can use -nodefaults to suppress the default driveA, see
Without any -device floppy,... you get an empty unit 0 and no unit
1. You can use -nodefaults to suppress the default unit 0, see
"Default Devices".
* if=virtio
@ -385,12 +380,12 @@ some DEVNAMEs:
default device suppressing DEVNAMEs
CD-ROM ide-cd, ide-drive, ide-hd, scsi-cd, scsi-hd
isa-fdc's driveA floppy, isa-fdc
floppy floppy, isa-fdc
parallel isa-parallel
serial isa-serial
VGA VGA, cirrus-vga, isa-vga, isa-cirrus-vga,
vmware-svga, qxl-vga, virtio-vga
virtioconsole virtio-serial-pci, virtio-serial
vmware-svga, qxl-vga, virtio-vga, ati-vga,
vhost-user-vga
The default NIC is connected to a default part created along with it.
It is *not* suppressed by configuring a NIC with -device (you may call

View File

@ -164,6 +164,40 @@ previously available ``-tb-size`` option.
Use ``-display sdl,show-cursor=on`` or
``-display gtk,show-cursor=on`` instead.
``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
''''''''''''''''''''''''''''''''''''
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.
QEMU Machine Protocol (QMP) commands
------------------------------------

View File

@ -215,8 +215,8 @@ static void write_boot_rom(DriveInfo *dinfo, hwaddr addr, size_t rom_size,
g_free(storage);
}
static void aspeed_board_init_flashes(AspeedSMCState *s, const char *flashtype,
Error **errp)
static void aspeed_board_init_flashes(AspeedSMCState *s,
const char *flashtype)
{
int i ;
@ -227,8 +227,8 @@ static void aspeed_board_init_flashes(AspeedSMCState *s, const char *flashtype,
fl->flash = qdev_new(flashtype);
if (dinfo) {
qdev_prop_set_drive(fl->flash, "drive", blk_by_legacy_dinfo(dinfo),
errp);
qdev_prop_set_drive(fl->flash, "drive",
blk_by_legacy_dinfo(dinfo));
}
qdev_realize_and_unref(fl->flash, BUS(s->spi), &error_fatal);
@ -243,8 +243,8 @@ static void sdhci_attach_drive(SDHCIState *sdhci, DriveInfo *dinfo)
card = qdev_new(TYPE_SD_CARD);
if (dinfo) {
qdev_prop_set_drive(card, "drive", blk_by_legacy_dinfo(dinfo),
&error_fatal);
qdev_prop_set_drive_err(card, "drive", blk_by_legacy_dinfo(dinfo),
&error_fatal);
}
qdev_realize_and_unref(card,
qdev_get_child_bus(DEVICE(sdhci), "sd-bus"),
@ -314,8 +314,8 @@ static void aspeed_machine_init(MachineState *machine)
"max_ram", max_ram_size - ram_size);
memory_region_add_subregion(&bmc->ram_container, ram_size, &bmc->max_ram);
aspeed_board_init_flashes(&bmc->soc.fmc, amc->fmc_model, &error_abort);
aspeed_board_init_flashes(&bmc->soc.spi[0], amc->spi_model, &error_abort);
aspeed_board_init_flashes(&bmc->soc.fmc, amc->fmc_model);
aspeed_board_init_flashes(&bmc->soc.spi[0], amc->spi_model);
/* Install first FMC flash content as a boot rom. */
if (drive0) {

View File

@ -93,7 +93,7 @@ static void cubieboard_init(MachineState *machine)
/* Plug in SD card */
carddev = qdev_new(TYPE_SD_CARD);
qdev_prop_set_drive(carddev, "drive", blk, &error_fatal);
qdev_prop_set_drive_err(carddev, "drive", blk, &error_fatal);
qdev_realize_and_unref(carddev, bus, &error_fatal);
memory_region_add_subregion(get_system_memory(), AW_A10_SDRAM_BASE,

View File

@ -434,7 +434,7 @@ static void exynos4210_realize(DeviceState *socdev, Error **errp)
di = drive_get(IF_SD, 0, n);
blk = di ? blk_by_legacy_dinfo(di) : NULL;
carddev = qdev_new(TYPE_SD_CARD);
qdev_prop_set_drive(carddev, "drive", blk, &error_abort);
qdev_prop_set_drive(carddev, "drive", blk);
qdev_realize_and_unref(carddev, qdev_get_child_bus(dev, "sd-bus"),
&error_fatal);
}

View File

@ -130,7 +130,7 @@ static void imx25_pdk_init(MachineState *machine)
blk = di ? blk_by_legacy_dinfo(di) : NULL;
bus = qdev_get_child_bus(DEVICE(&s->soc.esdhc[i]), "sd-bus");
carddev = qdev_new(TYPE_SD_CARD);
qdev_prop_set_drive(carddev, "drive", blk, &error_fatal);
qdev_prop_set_drive_err(carddev, "drive", blk, &error_fatal);
qdev_realize_and_unref(carddev, bus, &error_fatal);
}

View File

@ -55,7 +55,7 @@ static void mcimx6ul_evk_init(MachineState *machine)
blk = di ? blk_by_legacy_dinfo(di) : NULL;
bus = qdev_get_child_bus(DEVICE(&s->usdhc[i]), "sd-bus");
carddev = qdev_new(TYPE_SD_CARD);
qdev_prop_set_drive(carddev, "drive", blk, &error_fatal);
qdev_prop_set_drive_err(carddev, "drive", blk, &error_fatal);
qdev_realize_and_unref(carddev, bus, &error_fatal);
}

View File

@ -57,7 +57,7 @@ static void mcimx7d_sabre_init(MachineState *machine)
blk = di ? blk_by_legacy_dinfo(di) : NULL;
bus = qdev_get_child_bus(DEVICE(&s->usdhc[i]), "sd-bus");
carddev = qdev_new(TYPE_SD_CARD);
qdev_prop_set_drive(carddev, "drive", blk, &error_fatal);
qdev_prop_set_drive_err(carddev, "drive", blk, &error_fatal);
qdev_realize_and_unref(carddev, bus, &error_fatal);
}

View File

@ -86,8 +86,8 @@ static void emcraft_sf2_s2s010_init(MachineState *machine)
spi_flash = qdev_new("s25sl12801");
qdev_prop_set_uint8(spi_flash, "spansion-cr2nv", 1);
if (dinfo) {
qdev_prop_set_drive(spi_flash, "drive", blk_by_legacy_dinfo(dinfo),
&error_fatal);
qdev_prop_set_drive_err(spi_flash, "drive",
blk_by_legacy_dinfo(dinfo), &error_fatal);
}
qdev_realize_and_unref(spi_flash, spi_bus, &error_fatal);
cs_line = qdev_get_gpio_in_named(spi_flash, SSI_GPIO_CS, 0);

View File

@ -182,8 +182,8 @@ static void n8x0_nand_setup(struct n800_s *s)
qdev_prop_set_int32(s->nand, "shift", 1);
dinfo = drive_get(IF_MTD, 0, 0);
if (dinfo) {
qdev_prop_set_drive(s->nand, "drive", blk_by_legacy_dinfo(dinfo),
&error_fatal);
qdev_prop_set_drive_err(s->nand, "drive", blk_by_legacy_dinfo(dinfo),
&error_fatal);
}
sysbus_realize_and_unref(SYS_BUS_DEVICE(s->nand), &error_fatal);
sysbus_connect_irq(SYS_BUS_DEVICE(s->nand), 0,

View File

@ -95,7 +95,7 @@ static void orangepi_init(MachineState *machine)
/* Plug in SD card */
carddev = qdev_new(TYPE_SD_CARD);
qdev_prop_set_drive(carddev, "drive", blk, &error_fatal);
qdev_prop_set_drive_err(carddev, "drive", blk, &error_fatal);
qdev_realize_and_unref(carddev, bus, &error_fatal);
/* SDRAM */

View File

@ -298,7 +298,7 @@ static void raspi_machine_init(MachineState *machine)
exit(1);
}
carddev = qdev_new(TYPE_SD_CARD);
qdev_prop_set_drive(carddev, "drive", blk, &error_fatal);
qdev_prop_set_drive_err(carddev, "drive", blk, &error_fatal);
qdev_realize_and_unref(carddev, bus, &error_fatal);
vcram_size = object_property_get_uint(OBJECT(&s->soc), "vcram-size",

View File

@ -77,9 +77,9 @@ static void sabrelite_init(MachineState *machine)
flash_dev = qdev_new("sst25vf016b");
if (dinfo) {
qdev_prop_set_drive(flash_dev, "drive",
blk_by_legacy_dinfo(dinfo),
&error_fatal);
qdev_prop_set_drive_err(flash_dev, "drive",
blk_by_legacy_dinfo(dinfo),
&error_fatal);
}
qdev_realize_and_unref(flash_dev, BUS(spi_bus), &error_fatal);

View File

@ -518,8 +518,7 @@ static PFlashCFI01 *ve_pflash_cfi01_register(hwaddr base, const char *name,
DeviceState *dev = qdev_new(TYPE_PFLASH_CFI01);
if (di) {
qdev_prop_set_drive(dev, "drive", blk_by_legacy_dinfo(di),
&error_abort);
qdev_prop_set_drive(dev, "drive", blk_by_legacy_dinfo(di));
}
qdev_prop_set_uint32(dev, "num-blocks",

View File

@ -159,8 +159,9 @@ static inline void zynq_init_spi_flashes(uint32_t base_addr, qemu_irq irq,
DriveInfo *dinfo = drive_get_next(IF_MTD);
flash_dev = qdev_new("n25q128");
if (dinfo) {
qdev_prop_set_drive(flash_dev, "drive",
blk_by_legacy_dinfo(dinfo), &error_fatal);
qdev_prop_set_drive_err(flash_dev, "drive",
blk_by_legacy_dinfo(dinfo),
&error_fatal);
}
qdev_realize_and_unref(flash_dev, BUS(spi), &error_fatal);
@ -290,7 +291,7 @@ static void zynq_init(MachineState *machine)
di = drive_get_next(IF_SD);
blk = di ? blk_by_legacy_dinfo(di) : NULL;
carddev = qdev_new(TYPE_SD_CARD);
qdev_prop_set_drive(carddev, "drive", blk, &error_fatal);
qdev_prop_set_drive_err(carddev, "drive", blk, &error_fatal);
qdev_realize_and_unref(carddev, qdev_get_child_bus(dev, "sd-bus"),
&error_fatal);
}

View File

@ -465,7 +465,7 @@ static void sd_plugin_card(SDHCIState *sd, DriveInfo *di)
card = qdev_new(TYPE_SD_CARD);
object_property_add_child(OBJECT(sd), "card[*]", OBJECT(card));
qdev_prop_set_drive(card, "drive", blk, &error_fatal);
qdev_prop_set_drive_err(card, "drive", blk, &error_fatal);
qdev_realize_and_unref(card, qdev_get_child_bus(DEVICE(sd), "sd-bus"),
&error_fatal);
}

View File

@ -143,7 +143,7 @@ static void xlnx_zcu102_init(MachineState *machine)
exit(1);
}
carddev = qdev_new(TYPE_SD_CARD);
qdev_prop_set_drive(carddev, "drive", blk, &error_fatal);
qdev_prop_set_drive_err(carddev, "drive", blk, &error_fatal);
qdev_realize_and_unref(carddev, bus, &error_fatal);
}
@ -159,8 +159,8 @@ static void xlnx_zcu102_init(MachineState *machine)
flash_dev = qdev_new("sst25wf080");
if (dinfo) {
qdev_prop_set_drive(flash_dev, "drive", blk_by_legacy_dinfo(dinfo),
&error_fatal);
qdev_prop_set_drive_err(flash_dev, "drive",
blk_by_legacy_dinfo(dinfo), &error_fatal);
}
qdev_realize_and_unref(flash_dev, spi_bus, &error_fatal);
@ -182,8 +182,8 @@ static void xlnx_zcu102_init(MachineState *machine)
flash_dev = qdev_new("n25q512a11");
if (dinfo) {
qdev_prop_set_drive(flash_dev, "drive", blk_by_legacy_dinfo(dinfo),
&error_fatal);
qdev_prop_set_drive_err(flash_dev, "drive",
blk_by_legacy_dinfo(dinfo), &error_fatal);
}
qdev_realize_and_unref(flash_dev, spi_bus, &error_fatal);

View File

@ -2497,6 +2497,29 @@ static void fdctrl_result_timer(void *opaque)
}
/* Init functions */
static void fdctrl_init_drives(FloppyBus *bus, DriveInfo **fds)
{
DeviceState *dev;
int i;
for (i = 0; i < MAX_FD; i++) {
if (fds[i]) {
dev = qdev_new("floppy");
qdev_prop_set_uint32(dev, "unit", i);
qdev_prop_set_enum(dev, "drive-type", FLOPPY_DRIVE_TYPE_AUTO);
qdev_prop_set_drive_err(dev, "drive", blk_by_legacy_dinfo(fds[i]),
&error_fatal);
qdev_realize_and_unref(dev, &bus->bus, &error_fatal);
}
}
}
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)
{
@ -2505,6 +2528,7 @@ static void fdctrl_connect_drives(FDCtrl *fdctrl, DeviceState *fdc_dev,
DeviceState *dev;
BlockBackend *blk;
Error *local_err = NULL;
const char *fdc_name, *drive_suffix;
for (i = 0; i < MAX_FD; i++) {
drive = &fdctrl->drives[i];
@ -2519,14 +2543,30 @@ static void fdctrl_connect_drives(FDCtrl *fdctrl, DeviceState *fdc_dev,
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;
qdev_prop_set_drive(dev, "drive", blk, &local_err);
qdev_prop_set_drive_err(dev, "drive", blk, &local_err);
blk_unref(blk);
if (local_err) {
@ -2542,30 +2582,6 @@ static void fdctrl_connect_drives(FDCtrl *fdctrl, DeviceState *fdc_dev,
}
}
ISADevice *fdctrl_init_isa(ISABus *bus, DriveInfo **fds)
{
DeviceState *dev;
ISADevice *isadev;
isadev = isa_try_new(TYPE_ISA_FDC);
if (!isadev) {
return NULL;
}
dev = DEVICE(isadev);
if (fds[0]) {
qdev_prop_set_drive(dev, "driveA", blk_by_legacy_dinfo(fds[0]),
&error_fatal);
}
if (fds[1]) {
qdev_prop_set_drive(dev, "driveB", blk_by_legacy_dinfo(fds[1]),
&error_fatal);
}
isa_realize_and_unref(isadev, bus, &error_fatal);
return isadev;
}
void fdctrl_init_sysbus(qemu_irq irq, int dma_chann,
hwaddr mmio_base, DriveInfo **fds)
{
@ -2578,18 +2594,12 @@ void fdctrl_init_sysbus(qemu_irq irq, int dma_chann,
sys = SYSBUS_FDC(dev);
fdctrl = &sys->state;
fdctrl->dma_chann = dma_chann; /* FIXME */
if (fds[0]) {
qdev_prop_set_drive(dev, "driveA", blk_by_legacy_dinfo(fds[0]),
&error_fatal);
}
if (fds[1]) {
qdev_prop_set_drive(dev, "driveB", blk_by_legacy_dinfo(fds[1]),
&error_fatal);
}
sbd = SYS_BUS_DEVICE(dev);
sysbus_realize_and_unref(sbd, &error_fatal);
sysbus_connect_irq(sbd, 0, irq);
sysbus_mmio_map(sbd, 0, mmio_base);
fdctrl_init_drives(&sys->state.bus, fds);
}
void sun4m_fdctrl_init(qemu_irq irq, hwaddr io_base,
@ -2599,15 +2609,13 @@ void sun4m_fdctrl_init(qemu_irq irq, hwaddr io_base,
FDCtrlSysBus *sys;
dev = qdev_new("SUNW,fdtwo");
if (fds[0]) {
qdev_prop_set_drive(dev, "drive", blk_by_legacy_dinfo(fds[0]),
&error_fatal);
}
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
sys = SYSBUS_FDC(dev);
sysbus_connect_irq(SYS_BUS_DEVICE(sys), 0, irq);
sysbus_mmio_map(SYS_BUS_DEVICE(sys), 0, io_base);
*fdc_tc = qdev_get_gpio_in(dev, 0);
fdctrl_init_drives(&sys->state.bus, fds);
}
static void fdctrl_realize_common(DeviceState *dev, FDCtrl *fdctrl,

View File

@ -648,7 +648,7 @@ DeviceState *nand_init(BlockBackend *blk, int manf_id, int chip_id)
qdev_prop_set_uint8(dev, "manufacturer_id", manf_id);
qdev_prop_set_uint8(dev, "chip_id", chip_id);
if (blk) {
qdev_prop_set_drive(dev, "drive", blk, &error_fatal);
qdev_prop_set_drive_err(dev, "drive", blk, &error_fatal);
}
qdev_realize(dev, NULL, &error_fatal);

View File

@ -962,7 +962,7 @@ PFlashCFI01 *pflash_cfi01_register(hwaddr base,
DeviceState *dev = qdev_new(TYPE_PFLASH_CFI01);
if (blk) {
qdev_prop_set_drive(dev, "drive", blk, &error_abort);
qdev_prop_set_drive(dev, "drive", blk);
}
assert(QEMU_IS_ALIGNED(size, sector_len));
qdev_prop_set_uint32(dev, "num-blocks", size / sector_len);
@ -1010,8 +1010,8 @@ void pflash_cfi01_legacy_drive(PFlashCFI01 *fl, DriveInfo *dinfo)
error_report("clashes with -machine");
exit(1);
}
qdev_prop_set_drive(DEVICE(fl), "drive",
blk_by_legacy_dinfo(dinfo), &error_fatal);
qdev_prop_set_drive_err(DEVICE(fl), "drive", blk_by_legacy_dinfo(dinfo),
&error_fatal);
loc_pop(&loc);
}

View File

@ -1001,7 +1001,7 @@ PFlashCFI02 *pflash_cfi02_register(hwaddr base,
DeviceState *dev = qdev_new(TYPE_PFLASH_CFI02);
if (blk) {
qdev_prop_set_drive(dev, "drive", blk, &error_abort);
qdev_prop_set_drive(dev, "drive", blk);
}
assert(QEMU_IS_ALIGNED(size, sector_len));
qdev_prop_set_uint32(dev, "num-blocks", size / sector_len);

View File

@ -25,29 +25,67 @@
#include "sysemu/iothread.h"
#include "sysemu/tpm_backend.h"
static void get_pointer(Object *obj, Visitor *v, Property *prop,
char *(*print)(void *ptr),
const char *name, Error **errp)
static bool check_prop_still_unset(DeviceState *dev, const char *name,
const void *old_val, const char *new_val,
Error **errp)
{
const GlobalProperty *prop = qdev_find_global_prop(dev, name);
if (!old_val) {
return true;
}
if (prop) {
error_setg(errp, "-global %s.%s=... conflicts with %s=%s",
prop->driver, prop->property, name, new_val);
} else {
/* Error message is vague, but a better one would be hard */
error_setg(errp, "%s=%s conflicts, and override is not implemented",
name, new_val);
}
return false;
}
/* --- drive --- */
static void get_drive(Object *obj, Visitor *v, const char *name, void *opaque,
Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
void **ptr = qdev_get_prop_ptr(dev, prop);
const char *value;
char *p;
p = *ptr ? print(*ptr) : g_strdup("");
if (*ptr) {
value = blk_name(*ptr);
if (!*value) {
BlockDriverState *bs = blk_bs(*ptr);
if (bs) {
value = bdrv_get_node_name(bs);
}
}
} else {
value = "";
}
p = g_strdup(value);
visit_type_str(v, name, &p, errp);
g_free(p);
}
static void set_pointer(Object *obj, Visitor *v, Property *prop,
void (*parse)(DeviceState *dev, const char *str,
void **ptr, const char *propname,
Error **errp),
const char *name, Error **errp)
static void set_drive_helper(Object *obj, Visitor *v, const char *name,
void *opaque, bool iothread, Error **errp)
{
DeviceState *dev = DEVICE(obj);
Property *prop = opaque;
Error *local_err = NULL;
void **ptr = qdev_get_prop_ptr(dev, prop);
char *str;
BlockBackend *blk;
bool blk_created = false;
int ret;
if (dev->realized) {
qdev_prop_set_after_realize(dev, name, errp);
@ -59,23 +97,20 @@ static void set_pointer(Object *obj, Visitor *v, Property *prop,
error_propagate(errp, local_err);
return;
}
/*
* TODO Should this really be an error? If no, the old value
* needs to be released before we store the new one.
*/
if (!check_prop_still_unset(dev, name, *ptr, str, errp)) {
return;
}
if (!*str) {
g_free(str);
*ptr = NULL;
return;
}
parse(dev, str, ptr, prop->name, errp);
g_free(str);
}
/* --- drive --- */
static void do_parse_drive(DeviceState *dev, const char *str, void **ptr,
const char *propname, bool iothread, Error **errp)
{
BlockBackend *blk;
bool blk_created = false;
int ret;
blk = blk_by_name(str);
if (!blk) {
@ -101,7 +136,7 @@ static void do_parse_drive(DeviceState *dev, const char *str, void **ptr,
}
if (!blk) {
error_setg(errp, "Property '%s.%s' can't find value '%s'",
object_get_typename(OBJECT(dev)), propname, str);
object_get_typename(OBJECT(dev)), prop->name, str);
goto fail;
}
if (blk_attach_dev(blk, dev) < 0) {
@ -126,18 +161,20 @@ fail:
/* If we need to keep a reference, blk_attach_dev() took it */
blk_unref(blk);
}
g_free(str);
}
static void parse_drive(DeviceState *dev, const char *str, void **ptr,
const char *propname, Error **errp)
static void set_drive(Object *obj, Visitor *v, const char *name, void *opaque,
Error **errp)
{
do_parse_drive(dev, str, ptr, propname, false, errp);
set_drive_helper(obj, v, name, opaque, false, errp);
}
static void parse_drive_iothread(DeviceState *dev, const char *str, void **ptr,
const char *propname, Error **errp)
static void set_drive_iothread(Object *obj, Visitor *v, const char *name,
void *opaque, Error **errp)
{
do_parse_drive(dev, str, ptr, propname, true, errp);
set_drive_helper(obj, v, name, opaque, true, errp);
}
static void release_drive(Object *obj, const char *name, void *opaque)
@ -156,38 +193,6 @@ static void release_drive(Object *obj, const char *name, void *opaque)
}
}
static char *print_drive(void *ptr)
{
const char *name;
name = blk_name(ptr);
if (!*name) {
BlockDriverState *bs = blk_bs(ptr);
if (bs) {
name = bdrv_get_node_name(bs);
}
}
return g_strdup(name);
}
static void get_drive(Object *obj, Visitor *v, const char *name, void *opaque,
Error **errp)
{
get_pointer(obj, v, opaque, print_drive, name, errp);
}
static void set_drive(Object *obj, Visitor *v, const char *name, void *opaque,
Error **errp)
{
set_pointer(obj, v, opaque, parse_drive, name, errp);
}
static void set_drive_iothread(Object *obj, Visitor *v, const char *name,
void *opaque, Error **errp)
{
set_pointer(obj, v, opaque, parse_drive_iothread, name, errp);
}
const PropertyInfo qdev_prop_drive = {
.name = "str",
.description = "Node name or ID of a block device to use as a backend",
@ -239,6 +244,14 @@ static void set_chr(Object *obj, Visitor *v, const char *name, void *opaque,
return;
}
/*
* TODO Should this really be an error? If no, the old value
* needs to be released before we store the new one.
*/
if (!check_prop_still_unset(dev, name, be->chr, str, errp)) {
return;
}
if (!*str) {
g_free(str);
be->chr = NULL;
@ -324,14 +337,16 @@ static void set_netdev(Object *obj, Visitor *v, const char *name,
}
for (i = 0; i < queues; i++) {
if (peers[i]->peer) {
err = -EEXIST;
goto out;
}
if (ncs[i]) {
err = -EINVAL;
/*
* TODO Should this really be an error? If no, the old value
* needs to be released before we store the new one.
*/
if (!check_prop_still_unset(dev, name, ncs[i], str, errp)) {
goto out;
}
@ -410,8 +425,8 @@ const PropertyInfo qdev_prop_audiodev = {
.set = set_audiodev,
};
void qdev_prop_set_drive(DeviceState *dev, const char *name,
BlockBackend *value, Error **errp)
void qdev_prop_set_drive_err(DeviceState *dev, const char *name,
BlockBackend *value, Error **errp)
{
const char *ref = "";
@ -428,6 +443,12 @@ void qdev_prop_set_drive(DeviceState *dev, const char *name,
object_property_set_str(OBJECT(dev), ref, name, errp);
}
void qdev_prop_set_drive(DeviceState *dev, const char *name,
BlockBackend *value)
{
qdev_prop_set_drive_err(dev, name, value, &error_abort);
}
void qdev_prop_set_chr(DeviceState *dev, const char *name,
Chardev *value)
{

View File

@ -1246,6 +1246,23 @@ void qdev_prop_register_global(GlobalProperty *prop)
g_ptr_array_add(global_props(), prop);
}
const GlobalProperty *qdev_find_global_prop(DeviceState *dev,
const char *name)
{
GPtrArray *props = global_props();
const GlobalProperty *p;
int i;
for (i = 0; i < props->len; i++) {
p = g_ptr_array_index(props, i);
if (object_dynamic_cast(OBJECT(dev), p->driver)
&& !strcmp(p->property, name)) {
return p;
}
}
return NULL;
}
int qdev_prop_check_globals(void)
{
int i, ret = 0;

View File

@ -1142,7 +1142,7 @@ static void pc_superio_init(ISABus *isa_bus, bool create_fdctrl, bool no_vmport)
int i;
DriveInfo *fd[MAX_FD];
qemu_irq *a20_line;
ISADevice *i8042, *port92, *vmmouse;
ISADevice *fdc, *i8042, *port92, *vmmouse;
serial_hds_isa_init(isa_bus, 0, MAX_ISA_SERIAL_PORTS);
parallel_hds_isa_init(isa_bus, MAX_PARALLEL_PORTS);
@ -1152,7 +1152,11 @@ static void pc_superio_init(ISABus *isa_bus, bool create_fdctrl, bool no_vmport)
create_fdctrl |= !!fd[i];
}
if (create_fdctrl) {
fdctrl_init_isa(isa_bus, fd);
fdc = isa_new(TYPE_ISA_FDC);
if (fdc) {
isa_realize_and_unref(fdc, isa_bus, &error_fatal);
isa_fdc_init_drives(fdc, fd);
}
}
i8042 = isa_create_simple(isa_bus, "i8042");

View File

@ -129,8 +129,8 @@ IDEDevice *ide_create_drive(IDEBus *bus, int unit, DriveInfo *drive)
dev = qdev_new(drive->media_cd ? "ide-cd" : "ide-hd");
qdev_prop_set_uint32(dev, "unit", unit);
qdev_prop_set_drive(dev, "drive", blk_by_legacy_dinfo(drive),
&error_fatal);
qdev_prop_set_drive_err(dev, "drive", blk_by_legacy_dinfo(drive),
&error_fatal);
qdev_realize_and_unref(dev, &bus->qbus, &error_fatal);
return DO_UPCAST(IDEDevice, qdev, dev);
}

View File

@ -17,6 +17,7 @@
#include "sysemu/sysemu.h"
#include "sysemu/blockdev.h"
#include "chardev/char.h"
#include "hw/block/fdc.h"
#include "hw/isa/superio.h"
#include "hw/qdev-properties.h"
#include "hw/input/i8042.h"
@ -31,7 +32,7 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)
ISADevice *isa;
DeviceState *d;
Chardev *chr;
DriveInfo *drive;
DriveInfo *fd[MAX_FD];
char *name;
int i;
@ -115,7 +116,7 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)
/* Floppy disc */
if (!k->floppy.is_enabled || k->floppy.is_enabled(sio, 0)) {
isa = isa_new("isa-fdc");
isa = isa_new(TYPE_ISA_FDC);
d = DEVICE(isa);
if (k->floppy.get_iobase) {
qdev_prop_set_uint32(d, "iobase", k->floppy.get_iobase(sio, 0));
@ -124,19 +125,12 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)
qdev_prop_set_uint32(d, "irq", k->floppy.get_irq(sio, 0));
}
/* FIXME use a qdev drive property instead of drive_get() */
drive = drive_get(IF_FLOPPY, 0, 0);
if (drive != NULL) {
qdev_prop_set_drive(d, "driveA", blk_by_legacy_dinfo(drive),
&error_fatal);
}
/* FIXME use a qdev drive property instead of drive_get() */
drive = drive_get(IF_FLOPPY, 0, 1);
if (drive != NULL) {
qdev_prop_set_drive(d, "driveB", blk_by_legacy_dinfo(drive),
&error_fatal);
for (i = 0; i < MAX_FD; i++) {
fd[i] = drive_get(IF_FLOPPY, 0, i);
}
object_property_add_child(OBJECT(sio), "isa-fdc", OBJECT(isa));
isa_realize_and_unref(isa, bus, &error_fatal);
isa_fdc_init_drives(isa, fd);
sio->floppy = isa;
trace_superio_create_floppy(0,
k->floppy.get_iobase ?

View File

@ -221,8 +221,7 @@ static void q800_init(MachineState *machine)
via_dev = qdev_new(TYPE_MAC_VIA);
dinfo = drive_get(IF_MTD, 0, 0);
if (dinfo) {
qdev_prop_set_drive(via_dev, "drive", blk_by_legacy_dinfo(dinfo),
&error_abort);
qdev_prop_set_drive(via_dev, "drive", blk_by_legacy_dinfo(dinfo));
}
sysbus = SYS_BUS_DEVICE(via_dev);
sysbus_realize_and_unref(sysbus, &error_fatal);

View File

@ -188,8 +188,9 @@ petalogix_ml605_init(MachineState *machine)
dev = qdev_new("n25q128");
if (dinfo) {
qdev_prop_set_drive(dev, "drive", blk_by_legacy_dinfo(dinfo),
&error_fatal);
qdev_prop_set_drive_err(dev, "drive",
blk_by_legacy_dinfo(dinfo),
&error_fatal);
}
qdev_realize_and_unref(dev, BUS(spi), &error_fatal);

View File

@ -730,8 +730,7 @@ static void pnv_init(MachineState *machine)
*/
dev = qdev_new(TYPE_PNV_PNOR);
if (pnor) {
qdev_prop_set_drive(dev, "drive", blk_by_legacy_dinfo(pnor),
&error_abort);
qdev_prop_set_drive(dev, "drive", blk_by_legacy_dinfo(pnor));
}
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
pnv->pnor = PNV_PNOR(dev);

View File

@ -1716,8 +1716,8 @@ static void spapr_create_nvram(SpaprMachineState *spapr)
DriveInfo *dinfo = drive_get(IF_PFLASH, 0, 0);
if (dinfo) {
qdev_prop_set_drive(dev, "drive", blk_by_legacy_dinfo(dinfo),
&error_fatal);
qdev_prop_set_drive_err(dev, "drive", blk_by_legacy_dinfo(dinfo),
&error_fatal);
}
qdev_realize_and_unref(dev, &spapr->vio_bus->bus, &error_fatal);

View File

@ -277,7 +277,7 @@ SCSIDevice *scsi_bus_legacy_add_drive(SCSIBus *bus, BlockBackend *blk,
if (serial && object_property_find(OBJECT(dev), "serial", NULL)) {
qdev_prop_set_string(dev, "serial", serial);
}
qdev_prop_set_drive(dev, "drive", blk, &err);
qdev_prop_set_drive_err(dev, "drive", blk, &err);
if (err) {
error_propagate(errp, err);
object_unparent(OBJECT(dev));

View File

@ -279,7 +279,7 @@ static void milkymist_memcard_realize(DeviceState *dev, Error **errp)
dinfo = drive_get_next(IF_SD);
blk = dinfo ? blk_by_legacy_dinfo(dinfo) : NULL;
carddev = qdev_new(TYPE_SD_CARD);
qdev_prop_set_drive(carddev, "drive", blk, &err);
qdev_prop_set_drive(carddev, "drive", blk);
qdev_realize_and_unref(carddev, BUS(&s->sdbus), &err);
if (err) {
error_setg(errp, "failed to init SD card: %s", error_get_pretty(err));

View File

@ -18,7 +18,6 @@
#include "hw/arm/pxa.h"
#include "hw/sd/sd.h"
#include "hw/qdev-properties.h"
#include "qemu/error-report.h"
#include "qemu/log.h"
#include "qemu/module.h"
#include "trace.h"
@ -483,7 +482,6 @@ PXA2xxMMCIState *pxa2xx_mmci_init(MemoryRegion *sysmem,
DeviceState *dev, *carddev;
SysBusDevice *sbd;
PXA2xxMMCIState *s;
Error *err = NULL;
dev = qdev_new(TYPE_PXA2XX_MMCI);
s = PXA2XX_MMCI(dev);
@ -496,16 +494,9 @@ PXA2xxMMCIState *pxa2xx_mmci_init(MemoryRegion *sysmem,
/* Create and plug in the sd card */
carddev = qdev_new(TYPE_SD_CARD);
qdev_prop_set_drive(carddev, "drive", blk, &err);
if (err) {
error_reportf_err(err, "failed to init SD card: ");
return NULL;
}
qdev_realize_and_unref(carddev, qdev_get_child_bus(dev, "sd-bus"), &err);
if (err) {
error_reportf_err(err, "failed to init SD card: ");
return NULL;
}
qdev_prop_set_drive_err(carddev, "drive", blk, &error_fatal);
qdev_realize_and_unref(carddev, qdev_get_child_bus(dev, "sd-bus"),
&error_fatal);
return s;
}

View File

@ -706,7 +706,7 @@ SDState *sd_init(BlockBackend *blk, bool is_spi)
obj = object_new(TYPE_SD_CARD);
dev = DEVICE(obj);
qdev_prop_set_drive(dev, "drive", blk, &err);
qdev_prop_set_drive_err(dev, "drive", blk, &err);
if (err) {
error_reportf_err(err, "sd_init failed: ");
return NULL;

View File

@ -254,7 +254,8 @@ static void ssi_sd_realize(SSISlave *d, Error **errp)
dinfo = drive_get_next(IF_SD);
carddev = qdev_new(TYPE_SD_CARD);
if (dinfo) {
qdev_prop_set_drive(carddev, "drive", blk_by_legacy_dinfo(dinfo), &err);
qdev_prop_set_drive_err(carddev, "drive", blk_by_legacy_dinfo(dinfo),
&err);
if (err) {
goto fail;
}

View File

@ -341,16 +341,9 @@ static void ebus_realize(PCIDevice *pci_dev, Error **errp)
}
isa_dev = isa_new(TYPE_ISA_FDC);
dev = DEVICE(isa_dev);
if (fd[0]) {
qdev_prop_set_drive(dev, "driveA", blk_by_legacy_dinfo(fd[0]),
&error_abort);
}
if (fd[1]) {
qdev_prop_set_drive(dev, "driveB", blk_by_legacy_dinfo(fd[1]),
&error_abort);
}
qdev_prop_set_uint32(dev, "dma", -1);
isa_realize_and_unref(isa_dev, s->isa_bus, &error_fatal);
isa_fdc_init_drives(isa_dev, fd);
/* Power */
dev = qdev_new(TYPE_SUN4U_POWER);

View File

@ -173,8 +173,7 @@ static PFlashCFI01 *xtfpga_flash_init(MemoryRegion *address_space,
SysBusDevice *s;
DeviceState *dev = qdev_new(TYPE_PFLASH_CFI01);
qdev_prop_set_drive(dev, "drive", blk_by_legacy_dinfo(dinfo),
&error_abort);
qdev_prop_set_drive(dev, "drive", blk_by_legacy_dinfo(dinfo));
qdev_prop_set_uint32(dev, "num-blocks",
board->flash->size / board->flash->sector_size);
qdev_prop_set_uint64(dev, "sector-length", board->flash->sector_size);

View File

@ -9,7 +9,7 @@
#define TYPE_ISA_FDC "isa-fdc"
ISADevice *fdctrl_init_isa(ISABus *bus, DriveInfo **fds);
void isa_fdc_init_drives(ISADevice *fdc, DriveInfo **fds);
void fdctrl_init_sysbus(qemu_irq irq, int dma_chann,
hwaddr mmio_base, DriveInfo **fds);
void sun4m_fdctrl_init(qemu_irq irq, hwaddr io_base,

View File

@ -233,8 +233,16 @@ extern const PropertyInfo qdev_prop_pcie_link_width;
#define DEFINE_PROP_END_OF_LIST() \
{}
/* Set properties between creation and init. */
void *qdev_get_prop_ptr(DeviceState *dev, Property *prop);
/*
* Set properties between creation and realization.
*/
void qdev_prop_set_drive_err(DeviceState *dev, const char *name,
BlockBackend *value, Error **errp);
/*
* Set properties between creation and realization.
* @value must be valid. Each property may be set at most once.
*/
void qdev_prop_set_bit(DeviceState *dev, const char *name, bool value);
void qdev_prop_set_uint8(DeviceState *dev, const char *name, uint8_t value);
void qdev_prop_set_uint16(DeviceState *dev, const char *name, uint16_t value);
@ -245,12 +253,16 @@ void qdev_prop_set_string(DeviceState *dev, const char *name, const char *value)
void qdev_prop_set_chr(DeviceState *dev, const char *name, Chardev *value);
void qdev_prop_set_netdev(DeviceState *dev, const char *name, NetClientState *value);
void qdev_prop_set_drive(DeviceState *dev, const char *name,
BlockBackend *value, Error **errp);
BlockBackend *value);
void qdev_prop_set_macaddr(DeviceState *dev, const char *name,
const uint8_t *value);
void qdev_prop_set_enum(DeviceState *dev, const char *name, int value);
void *qdev_get_prop_ptr(DeviceState *dev, Property *prop);
void qdev_prop_register_global(GlobalProperty *prop);
const GlobalProperty *qdev_find_global_prop(DeviceState *dev,
const char *name);
int qdev_prop_check_globals(void);
void qdev_prop_set_globals(DeviceState *dev);
void error_set_from_qdev_prop_error(Error **errp, int ret, DeviceState *dev,

View File

@ -35,6 +35,7 @@ struct DriveInfo {
bool is_default; /* Added by default_drive() ? */
int media_cd;
QemuOpts *opts;
bool claimed_by_board;
QTAILQ_ENTRY(DriveInfo) next;
};
@ -45,6 +46,7 @@ BlockBackend *blk_by_legacy_dinfo(DriveInfo *dinfo);
void override_max_devs(BlockInterfaceType type, int max_devs);
DriveInfo *drive_get(BlockInterfaceType type, int bus, int unit);
void drive_mark_claimed_by_board(void);
void drive_check_orphaned(void);
DriveInfo *drive_get_by_index(BlockInterfaceType type, int index);
int drive_get_max_bus(BlockInterfaceType type);

View File

@ -4347,6 +4347,14 @@ void qemu_init(int argc, char **argv, char **envp)
/* from here on runstate is RUN_STATE_PRELAUNCH */
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();
realtime_init();
soundhw_init();

View File

@ -69,9 +69,10 @@ check_floppy_qtree()
#
# Apply the sed filter to stdout only, but keep the stderr output and
# filter the qemu program name in it.
echo "info qtree" |
printf "info qtree\ninfo block\n" |
(QEMU_OPTIONS="" do_run_qemu "$@" |
sed -ne '/^ dev: isa-fdc/,/^ dev:/{x;p}' ) 2>&1 |
_filter_testdir |_filter_generated_node_ids | _filter_hmp |
sed -ne '/^ dev: isa-fdc/,/^ dev:/{x;p};/^[a-z][^ ]* (NODE_NAME):* /,/^(qemu)$/{p}') 2>&1 |
_filter_win32 | _filter_qemu
}
@ -110,6 +111,7 @@ echo === Using -fda/-fdb options ===
check_floppy_qtree -fda "$TEST_IMG"
check_floppy_qtree -fdb "$TEST_IMG"
check_floppy_qtree -fda "$TEST_IMG" -fdb "$TEST_IMG.2"
check_floppy_qtree -fdb ""
echo
@ -146,9 +148,11 @@ echo === Mixing -fdX and -global ===
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 (-fdX wins)
# 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
echo
echo
@ -190,12 +194,29 @@ check_floppy_qtree -drive if=none,file="$TEST_IMG" -drive if=none,file="$TEST_IM
-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
echo
echo
echo === Attempt to use drive twice ===
# if=none
check_floppy_qtree -drive if=none -device floppy,drive=none0 -device floppy -device floppy,drive=none0
check_floppy_qtree -drive if=none -global floppy.drive=none0 -device floppy -device floppy
# if=floppy
check_floppy_qtree -fda "" -device floppy,drive=floppy0
check_floppy_qtree -fda "" -global floppy.drive=floppy0
# default if=floppy (not found, because it's created later)
check_floppy_qtree -device floppy,drive=floppy0
echo
echo

View File

@ -62,6 +62,19 @@ Testing: -fda TEST_DIR/t.qcow2
write-cache = "auto"
share-rw = false
drive-type = "144"
floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
Attached to: /machine/unattached/device[15]
Removable device: not locked, tray closed
Cache mode: writeback
ide1-cd0: [not inserted]
Attached to: /machine/unattached/device[22]
Removable device: not locked, tray closed
sd0: [not inserted]
Removable device: not locked, tray closed
(qemu) quit
Testing: -fdb TEST_DIR/t.qcow2
@ -100,6 +113,23 @@ Testing: -fdb TEST_DIR/t.qcow2
write-cache = "auto"
share-rw = false
drive-type = "288"
floppy1 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
Attached to: /machine/unattached/device[16]
Removable device: not locked, tray closed
Cache mode: writeback
ide1-cd0: [not inserted]
Attached to: /machine/unattached/device[23]
Removable device: not locked, tray closed
floppy0: [not inserted]
Attached to: /machine/unattached/device[15]
Removable device: not locked, tray closed
sd0: [not inserted]
Removable device: not locked, tray closed
(qemu) quit
Testing: -fda TEST_DIR/t.qcow2 -fdb TEST_DIR/t.qcow2.2
@ -138,6 +168,62 @@ Testing: -fda TEST_DIR/t.qcow2 -fdb TEST_DIR/t.qcow2.2
write-cache = "auto"
share-rw = false
drive-type = "144"
floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
Attached to: /machine/unattached/device[15]
Removable device: not locked, tray closed
Cache mode: writeback
floppy1 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2)
Attached to: /machine/unattached/device[16]
Removable device: not locked, tray closed
Cache mode: writeback
ide1-cd0: [not inserted]
Attached to: /machine/unattached/device[23]
Removable device: not locked, tray closed
sd0: [not inserted]
Removable device: not locked, tray closed
(qemu) quit
Testing: -fdb
dev: isa-fdc, id ""
iobase = 1008 (0x3f0)
irq = 6 (0x6)
dma = 2 (0x2)
driveA = ""
driveB = ""
check_media_rate = true
fdtypeA = "auto"
fdtypeB = "auto"
fallback = "288"
isa irq 6
bus: floppy-bus.0
type floppy-bus
dev: floppy, id ""
unit = 1 (0x1)
drive = "floppy1"
logical_block_size = 512 (512 B)
physical_block_size = 512 (512 B)
min_io_size = 0 (0 B)
opt_io_size = 0 (0 B)
discard_granularity = 4294967295 (4 GiB)
write-cache = "auto"
share-rw = false
drive-type = "288"
dev: floppy, id ""
unit = 0 (0x0)
drive = "floppy0"
logical_block_size = 512 (512 B)
physical_block_size = 512 (512 B)
min_io_size = 0 (0 B)
opt_io_size = 0 (0 B)
discard_granularity = 4294967295 (4 GiB)
write-cache = "auto"
share-rw = false
drive-type = "288"
=== Using -drive options ===
@ -168,6 +254,19 @@ Testing: -drive if=floppy,file=TEST_DIR/t.qcow2
write-cache = "auto"
share-rw = false
drive-type = "144"
floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
Attached to: /machine/unattached/device[15]
Removable device: not locked, tray closed
Cache mode: writeback
ide1-cd0: [not inserted]
Attached to: /machine/unattached/device[22]
Removable device: not locked, tray closed
sd0: [not inserted]
Removable device: not locked, tray closed
(qemu) quit
Testing: -drive if=floppy,file=TEST_DIR/t.qcow2,index=1
@ -206,6 +305,23 @@ Testing: -drive if=floppy,file=TEST_DIR/t.qcow2,index=1
write-cache = "auto"
share-rw = false
drive-type = "288"
floppy1 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
Attached to: /machine/unattached/device[16]
Removable device: not locked, tray closed
Cache mode: writeback
ide1-cd0: [not inserted]
Attached to: /machine/unattached/device[23]
Removable device: not locked, tray closed
floppy0: [not inserted]
Attached to: /machine/unattached/device[15]
Removable device: not locked, tray closed
sd0: [not inserted]
Removable device: not locked, tray closed
(qemu) quit
Testing: -drive if=floppy,file=TEST_DIR/t.qcow2 -drive if=floppy,file=TEST_DIR/t.qcow2.2,index=1
@ -244,11 +360,31 @@ Testing: -drive if=floppy,file=TEST_DIR/t.qcow2 -drive if=floppy,file=TEST_DIR/t
write-cache = "auto"
share-rw = false
drive-type = "144"
floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
Attached to: /machine/unattached/device[15]
Removable device: not locked, tray closed
Cache mode: writeback
floppy1 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2)
Attached to: /machine/unattached/device[16]
Removable device: not locked, tray closed
Cache mode: writeback
ide1-cd0: [not inserted]
Attached to: /machine/unattached/device[23]
Removable device: not locked, tray closed
sd0: [not inserted]
Removable device: not locked, tray closed
(qemu) quit
=== Using -drive if=none and -global ===
Testing: -drive if=none,file=TEST_DIR/t.qcow2 -global isa-fdc.driveA=none0
QEMU_PROG: warning: warning: property isa-fdc.driveA is deprecated
Use -device floppy,unit=0,drive=... instead.
dev: isa-fdc, id ""
iobase = 1008 (0x3f0)
@ -274,8 +410,23 @@ Testing: -drive if=none,file=TEST_DIR/t.qcow2 -global isa-fdc.driveA=none0
write-cache = "auto"
share-rw = false
drive-type = "144"
none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
Attached to: /machine/unattached/device[15]
Removable device: not locked, tray closed
Cache mode: writeback
ide1-cd0: [not inserted]
Attached to: /machine/unattached/device[22]
Removable device: not locked, tray closed
sd0: [not inserted]
Removable device: not locked, tray closed
(qemu) quit
Testing: -drive if=none,file=TEST_DIR/t.qcow2 -global isa-fdc.driveB=none0
QEMU_PROG: warning: warning: property isa-fdc.driveB is deprecated
Use -device floppy,unit=1,drive=... instead.
dev: isa-fdc, id ""
iobase = 1008 (0x3f0)
@ -301,8 +452,25 @@ Testing: -drive if=none,file=TEST_DIR/t.qcow2 -global isa-fdc.driveB=none0
write-cache = "auto"
share-rw = false
drive-type = "144"
none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
Attached to: /machine/unattached/device[15]
Removable device: not locked, tray closed
Cache mode: writeback
ide1-cd0: [not inserted]
Attached to: /machine/unattached/device[22]
Removable device: not locked, tray closed
sd0: [not inserted]
Removable device: not locked, tray closed
(qemu) quit
Testing: -drive if=none,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -global isa-fdc.driveA=none0 -global isa-fdc.driveB=none1
QEMU_PROG: warning: warning: property isa-fdc.driveA is deprecated
Use -device floppy,unit=0,drive=... instead.
QEMU_PROG: warning: warning: property isa-fdc.driveB is deprecated
Use -device floppy,unit=1,drive=... instead.
dev: isa-fdc, id ""
iobase = 1008 (0x3f0)
@ -339,6 +507,24 @@ Testing: -drive if=none,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qco
write-cache = "auto"
share-rw = false
drive-type = "144"
none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
Attached to: /machine/unattached/device[15]
Removable device: not locked, tray closed
Cache mode: writeback
none1 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2)
Attached to: /machine/unattached/device[16]
Removable device: not locked, tray closed
Cache mode: writeback
ide1-cd0: [not inserted]
Attached to: /machine/unattached/device[23]
Removable device: not locked, tray closed
sd0: [not inserted]
Removable device: not locked, tray closed
(qemu) quit
=== Using -drive if=none and -device ===
@ -369,6 +555,19 @@ Testing: -drive if=none,file=TEST_DIR/t.qcow2 -device floppy,drive=none0
write-cache = "auto"
share-rw = false
drive-type = "144"
none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
Attached to: /machine/peripheral-anon/device[0]
Removable device: not locked, tray closed
Cache mode: writeback
ide1-cd0: [not inserted]
Attached to: /machine/unattached/device[21]
Removable device: not locked, tray closed
sd0: [not inserted]
Removable device: not locked, tray closed
(qemu) quit
Testing: -drive if=none,file=TEST_DIR/t.qcow2 -device floppy,drive=none0,unit=1
@ -396,6 +595,19 @@ Testing: -drive if=none,file=TEST_DIR/t.qcow2 -device floppy,drive=none0,unit=1
write-cache = "auto"
share-rw = false
drive-type = "144"
none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
Attached to: /machine/peripheral-anon/device[0]
Removable device: not locked, tray closed
Cache mode: writeback
ide1-cd0: [not inserted]
Attached to: /machine/unattached/device[21]
Removable device: not locked, tray closed
sd0: [not inserted]
Removable device: not locked, tray closed
(qemu) quit
Testing: -drive if=none,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -device floppy,drive=none0 -device floppy,drive=none1,unit=1
@ -434,11 +646,31 @@ Testing: -drive if=none,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qco
write-cache = "auto"
share-rw = false
drive-type = "144"
none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
Attached to: /machine/peripheral-anon/device[0]
Removable device: not locked, tray closed
Cache mode: writeback
none1 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2)
Attached to: /machine/peripheral-anon/device[1]
Removable device: not locked, tray closed
Cache mode: writeback
ide1-cd0: [not inserted]
Attached to: /machine/unattached/device[21]
Removable device: not locked, tray closed
sd0: [not inserted]
Removable device: not locked, tray closed
(qemu) quit
=== Mixing -fdX and -global ===
Testing: -fda TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -global isa-fdc.driveB=none0
QEMU_PROG: warning: warning: property isa-fdc.driveB is deprecated
Use -device floppy,unit=1,drive=... instead.
dev: isa-fdc, id ""
iobase = 1008 (0x3f0)
@ -453,17 +685,6 @@ Testing: -fda TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -global is
isa irq 6
bus: floppy-bus.0
type floppy-bus
dev: floppy, id ""
unit = 1 (0x1)
drive = "none0"
logical_block_size = 512 (512 B)
physical_block_size = 512 (512 B)
min_io_size = 0 (0 B)
opt_io_size = 0 (0 B)
discard_granularity = 4294967295 (4 GiB)
write-cache = "auto"
share-rw = false
drive-type = "144"
dev: floppy, id ""
unit = 0 (0x0)
drive = "floppy0"
@ -475,8 +696,39 @@ Testing: -fda TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -global is
write-cache = "auto"
share-rw = false
drive-type = "144"
dev: floppy, id ""
unit = 1 (0x1)
drive = "none0"
logical_block_size = 512 (512 B)
physical_block_size = 512 (512 B)
min_io_size = 0 (0 B)
opt_io_size = 0 (0 B)
discard_granularity = 4294967295 (4 GiB)
write-cache = "auto"
share-rw = false
drive-type = "144"
floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
Attached to: /machine/unattached/device[16]
Removable device: not locked, tray closed
Cache mode: writeback
none0 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2)
Attached to: /machine/unattached/device[15]
Removable device: not locked, tray closed
Cache mode: writeback
ide1-cd0: [not inserted]
Attached to: /machine/unattached/device[23]
Removable device: not locked, tray closed
sd0: [not inserted]
Removable device: not locked, tray closed
(qemu) quit
Testing: -fdb TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -global isa-fdc.driveA=none0
QEMU_PROG: warning: warning: property isa-fdc.driveA is deprecated
Use -device floppy,unit=0,drive=... instead.
dev: isa-fdc, id ""
iobase = 1008 (0x3f0)
@ -513,60 +765,37 @@ Testing: -fdb TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -global is
write-cache = "auto"
share-rw = false
drive-type = "144"
floppy1 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
Attached to: /machine/unattached/device[16]
Removable device: not locked, tray closed
Cache mode: writeback
none0 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2)
Attached to: /machine/unattached/device[15]
Removable device: not locked, tray closed
Cache mode: writeback
ide1-cd0: [not inserted]
Attached to: /machine/unattached/device[23]
Removable device: not locked, tray closed
sd0: [not inserted]
Removable device: not locked, tray closed
(qemu) quit
Testing: -fda TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -global isa-fdc.driveA=none0
dev: isa-fdc, id ""
iobase = 1008 (0x3f0)
irq = 6 (0x6)
dma = 2 (0x2)
driveA = ""
driveB = ""
check_media_rate = true
fdtypeA = "auto"
fdtypeB = "auto"
fallback = "288"
isa irq 6
bus: floppy-bus.0
type floppy-bus
dev: floppy, id ""
unit = 0 (0x0)
drive = "floppy0"
logical_block_size = 512 (512 B)
physical_block_size = 512 (512 B)
min_io_size = 0 (0 B)
opt_io_size = 0 (0 B)
discard_granularity = 4294967295 (4 GiB)
write-cache = "auto"
share-rw = false
drive-type = "144"
QEMU_PROG: warning: warning: property isa-fdc.driveA is deprecated
Use -device floppy,unit=0,drive=... instead.
QEMU_PROG: Floppy unit 0 is in use
Testing: -fdb TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -global isa-fdc.driveB=none0
QEMU_PROG: warning: warning: property isa-fdc.driveB is deprecated
Use -device floppy,unit=1,drive=... instead.
QEMU_PROG: Floppy unit 1 is in use
dev: isa-fdc, id ""
iobase = 1008 (0x3f0)
irq = 6 (0x6)
dma = 2 (0x2)
driveA = ""
driveB = ""
check_media_rate = true
fdtypeA = "auto"
fdtypeB = "auto"
fallback = "288"
isa irq 6
bus: floppy-bus.0
type floppy-bus
dev: floppy, id ""
unit = 1 (0x1)
drive = "floppy1"
logical_block_size = 512 (512 B)
physical_block_size = 512 (512 B)
min_io_size = 0 (0 B)
opt_io_size = 0 (0 B)
discard_granularity = 4294967295 (4 GiB)
write-cache = "auto"
share-rw = false
drive-type = "144"
Testing: -fda TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -global floppy.drive=none0
QEMU_PROG: -global floppy.drive=... conflicts with drive=floppy0
=== Mixing -fdX and -device ===
@ -608,6 +837,24 @@ Testing: -fda TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -device fl
write-cache = "auto"
share-rw = false
drive-type = "144"
floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
Attached to: /machine/unattached/device[15]
Removable device: not locked, tray closed
Cache mode: writeback
none0 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2)
Attached to: /machine/peripheral-anon/device[0]
Removable device: not locked, tray closed
Cache mode: writeback
ide1-cd0: [not inserted]
Attached to: /machine/unattached/device[22]
Removable device: not locked, tray closed
sd0: [not inserted]
Removable device: not locked, tray closed
(qemu) quit
Testing: -fda TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -device floppy,drive=none0,unit=1
@ -646,6 +893,24 @@ Testing: -fda TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -device fl
write-cache = "auto"
share-rw = false
drive-type = "144"
floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
Attached to: /machine/unattached/device[15]
Removable device: not locked, tray closed
Cache mode: writeback
none0 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2)
Attached to: /machine/peripheral-anon/device[0]
Removable device: not locked, tray closed
Cache mode: writeback
ide1-cd0: [not inserted]
Attached to: /machine/unattached/device[22]
Removable device: not locked, tray closed
sd0: [not inserted]
Removable device: not locked, tray closed
(qemu) quit
Testing: -fdb TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -device floppy,drive=none0
@ -684,6 +949,24 @@ Testing: -fdb TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -device fl
write-cache = "auto"
share-rw = false
drive-type = "144"
floppy1 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
Attached to: /machine/unattached/device[15]
Removable device: not locked, tray closed
Cache mode: writeback
none0 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2)
Attached to: /machine/peripheral-anon/device[0]
Removable device: not locked, tray closed
Cache mode: writeback
ide1-cd0: [not inserted]
Attached to: /machine/unattached/device[22]
Removable device: not locked, tray closed
sd0: [not inserted]
Removable device: not locked, tray closed
(qemu) quit
Testing: -fdb TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -device floppy,drive=none0,unit=0
@ -722,6 +1005,24 @@ Testing: -fdb TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -device fl
write-cache = "auto"
share-rw = false
drive-type = "144"
floppy1 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
Attached to: /machine/unattached/device[15]
Removable device: not locked, tray closed
Cache mode: writeback
none0 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2)
Attached to: /machine/peripheral-anon/device[0]
Removable device: not locked, tray closed
Cache mode: writeback
ide1-cd0: [not inserted]
Attached to: /machine/unattached/device[22]
Removable device: not locked, tray closed
sd0: [not inserted]
Removable device: not locked, tray closed
(qemu) quit
Testing: -fda TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -device floppy,drive=none0,unit=0
QEMU_PROG: -device floppy,drive=none0,unit=0: Floppy unit 0 is in use
@ -769,6 +1070,24 @@ Testing: -drive if=floppy,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.q
write-cache = "auto"
share-rw = false
drive-type = "144"
floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
Attached to: /machine/unattached/device[15]
Removable device: not locked, tray closed
Cache mode: writeback
none0 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2)
Attached to: /machine/peripheral-anon/device[0]
Removable device: not locked, tray closed
Cache mode: writeback
ide1-cd0: [not inserted]
Attached to: /machine/unattached/device[22]
Removable device: not locked, tray closed
sd0: [not inserted]
Removable device: not locked, tray closed
(qemu) quit
Testing: -drive if=floppy,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -device floppy,drive=none0,unit=1
@ -807,6 +1126,24 @@ Testing: -drive if=floppy,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.q
write-cache = "auto"
share-rw = false
drive-type = "144"
floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
Attached to: /machine/unattached/device[15]
Removable device: not locked, tray closed
Cache mode: writeback
none0 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2)
Attached to: /machine/peripheral-anon/device[0]
Removable device: not locked, tray closed
Cache mode: writeback
ide1-cd0: [not inserted]
Attached to: /machine/unattached/device[22]
Removable device: not locked, tray closed
sd0: [not inserted]
Removable device: not locked, tray closed
(qemu) quit
Testing: -drive if=floppy,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -device floppy,drive=none0,unit=0
QEMU_PROG: -device floppy,drive=none0,unit=0: Floppy unit 0 is in use
@ -815,6 +1152,8 @@ QEMU_PROG: -device floppy,drive=none0,unit=0: Floppy unit 0 is in use
=== Mixing -global and -device ===
Testing: -drive if=none,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -global isa-fdc.driveA=none0 -device floppy,drive=none1
QEMU_PROG: warning: warning: property isa-fdc.driveA is deprecated
Use -device floppy,unit=0,drive=... instead.
dev: isa-fdc, id ""
iobase = 1008 (0x3f0)
@ -851,8 +1190,28 @@ Testing: -drive if=none,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qco
write-cache = "auto"
share-rw = false
drive-type = "144"
none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
Attached to: /machine/unattached/device[15]
Removable device: not locked, tray closed
Cache mode: writeback
none1 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2)
Attached to: /machine/peripheral-anon/device[0]
Removable device: not locked, tray closed
Cache mode: writeback
ide1-cd0: [not inserted]
Attached to: /machine/unattached/device[22]
Removable device: not locked, tray closed
sd0: [not inserted]
Removable device: not locked, tray closed
(qemu) quit
Testing: -drive if=none,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -global isa-fdc.driveA=none0 -device floppy,drive=none1,unit=1
QEMU_PROG: warning: warning: property isa-fdc.driveA is deprecated
Use -device floppy,unit=0,drive=... instead.
dev: isa-fdc, id ""
iobase = 1008 (0x3f0)
@ -889,8 +1248,28 @@ Testing: -drive if=none,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qco
write-cache = "auto"
share-rw = false
drive-type = "144"
none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
Attached to: /machine/unattached/device[15]
Removable device: not locked, tray closed
Cache mode: writeback
none1 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2)
Attached to: /machine/peripheral-anon/device[0]
Removable device: not locked, tray closed
Cache mode: writeback
ide1-cd0: [not inserted]
Attached to: /machine/unattached/device[22]
Removable device: not locked, tray closed
sd0: [not inserted]
Removable device: not locked, tray closed
(qemu) quit
Testing: -drive if=none,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -global isa-fdc.driveB=none0 -device floppy,drive=none1
QEMU_PROG: warning: warning: property isa-fdc.driveB is deprecated
Use -device floppy,unit=1,drive=... instead.
dev: isa-fdc, id ""
iobase = 1008 (0x3f0)
@ -927,8 +1306,28 @@ Testing: -drive if=none,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qco
write-cache = "auto"
share-rw = false
drive-type = "144"
none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
Attached to: /machine/unattached/device[15]
Removable device: not locked, tray closed
Cache mode: writeback
none1 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2)
Attached to: /machine/peripheral-anon/device[0]
Removable device: not locked, tray closed
Cache mode: writeback
ide1-cd0: [not inserted]
Attached to: /machine/unattached/device[22]
Removable device: not locked, tray closed
sd0: [not inserted]
Removable device: not locked, tray closed
(qemu) quit
Testing: -drive if=none,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -global isa-fdc.driveB=none0 -device floppy,drive=none1,unit=0
QEMU_PROG: warning: warning: property isa-fdc.driveB is deprecated
Use -device floppy,unit=1,drive=... instead.
dev: isa-fdc, id ""
iobase = 1008 (0x3f0)
@ -965,17 +1364,102 @@ Testing: -drive if=none,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qco
write-cache = "auto"
share-rw = false
drive-type = "144"
none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
Attached to: /machine/unattached/device[15]
Removable device: not locked, tray closed
Cache mode: writeback
none1 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2)
Attached to: /machine/peripheral-anon/device[0]
Removable device: not locked, tray closed
Cache mode: writeback
ide1-cd0: [not inserted]
Attached to: /machine/unattached/device[22]
Removable device: not locked, tray closed
sd0: [not inserted]
Removable device: not locked, tray closed
(qemu) quit
Testing: -drive if=none,file=TEST_DIR/t.qcow2 -global floppy.drive=none0 -device floppy,unit=0
dev: isa-fdc, id ""
iobase = 1008 (0x3f0)
irq = 6 (0x6)
dma = 2 (0x2)
driveA = ""
driveB = ""
check_media_rate = true
fdtypeA = "auto"
fdtypeB = "auto"
fallback = "288"
isa irq 6
bus: floppy-bus.0
type floppy-bus
dev: floppy, id ""
unit = 0 (0x0)
drive = "none0"
logical_block_size = 512 (512 B)
physical_block_size = 512 (512 B)
min_io_size = 0 (0 B)
opt_io_size = 0 (0 B)
discard_granularity = 4294967295 (4 GiB)
write-cache = "auto"
share-rw = false
drive-type = "144"
none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
Attached to: /machine/peripheral-anon/device[0]
Removable device: not locked, tray closed
Cache mode: writeback
ide1-cd0: [not inserted]
Attached to: /machine/unattached/device[21]
Removable device: not locked, tray closed
sd0: [not inserted]
Removable device: not locked, tray closed
(qemu) quit
Testing: -drive if=none,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -global isa-fdc.driveA=none0 -device floppy,drive=none1,unit=0
QEMU_PROG: warning: warning: property isa-fdc.driveA is deprecated
Use -device floppy,unit=0,drive=... instead.
QEMU_PROG: -device floppy,drive=none1,unit=0: Floppy unit 0 is in use
Testing: -drive if=none,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -global isa-fdc.driveB=none0 -device floppy,drive=none1,unit=1
QEMU_PROG: warning: warning: property isa-fdc.driveB is deprecated
Use -device floppy,unit=1,drive=... instead.
QEMU_PROG: -device floppy,drive=none1,unit=1: Floppy unit 1 is in use
Testing: -drive if=none,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -global floppy.drive=none0 -device floppy,drive=none1,unit=0
QEMU_PROG: -device floppy,drive=none1,unit=0: -global floppy.drive=... conflicts with drive=none1
=== Attempt to use drive twice ===
Testing: -drive if=none -device floppy,drive=none0 -device floppy -device floppy,drive=none0
QEMU_PROG: -device floppy,drive=none0: Drive 'none0' is already in use by another device
Testing: -drive if=none -global floppy.drive=none0 -device floppy -device floppy
QEMU_PROG: -device floppy: can't apply global floppy.drive=none0: Drive 'none0' is already in use by another device
Testing: -fda -device floppy,drive=floppy0
QEMU_PROG: -device floppy,drive=floppy0: Drive 'floppy0' is already in use because it has been automatically connected to another device (did you need 'if=none' in the drive options?)
Testing: -fda -global floppy.drive=floppy0
QEMU_PROG: -global floppy.drive=... conflicts with drive=floppy0
Testing: -device floppy,drive=floppy0
QEMU_PROG: -device floppy,drive=floppy0: Property 'floppy.drive' can't find value 'floppy0'
=== Too many floppy drives ===
Testing: -drive if=floppy,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -drive if=none,file=TEST_DIR/t.qcow2.3 -global isa-fdc.driveB=none0 -device floppy,drive=none1
QEMU_PROG: warning: warning: property isa-fdc.driveB is deprecated
Use -device floppy,unit=1,drive=... instead.
QEMU_PROG: -device floppy,drive=none1: Can't create floppy unit 2, bus supports only 2 units
@ -1118,6 +1602,19 @@ Testing: -drive if=none,file=TEST_DIR/t.qcow2 -device floppy,drive=none0,drive-t
write-cache = "auto"
share-rw = false
drive-type = "120"
none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
Attached to: /machine/peripheral-anon/device[0]
Removable device: not locked, tray closed
Cache mode: writeback
ide1-cd0: [not inserted]
Attached to: /machine/unattached/device[21]
Removable device: not locked, tray closed
sd0: [not inserted]
Removable device: not locked, tray closed
(qemu) quit
Testing: -drive if=none,file=TEST_DIR/t.qcow2 -device floppy,drive=none0,drive-type=288
@ -1145,6 +1642,19 @@ Testing: -drive if=none,file=TEST_DIR/t.qcow2 -device floppy,drive=none0,drive-t
write-cache = "auto"
share-rw = false
drive-type = "288"
none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
Attached to: /machine/peripheral-anon/device[0]
Removable device: not locked, tray closed
Cache mode: writeback
ide1-cd0: [not inserted]
Attached to: /machine/unattached/device[21]
Removable device: not locked, tray closed
sd0: [not inserted]
Removable device: not locked, tray closed
(qemu) quit
=== Try passing different block sizes ===
@ -1175,6 +1685,19 @@ Testing: -drive if=none,file=TEST_DIR/t.qcow2 -device floppy,drive=none0,logical
write-cache = "auto"
share-rw = false
drive-type = "144"
none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
Attached to: /machine/peripheral-anon/device[0]
Removable device: not locked, tray closed
Cache mode: writeback
ide1-cd0: [not inserted]
Attached to: /machine/unattached/device[21]
Removable device: not locked, tray closed
sd0: [not inserted]
Removable device: not locked, tray closed
(qemu) quit
Testing: -drive if=none,file=TEST_DIR/t.qcow2 -device floppy,drive=none0,physical_block_size=512
@ -1202,6 +1725,19 @@ Testing: -drive if=none,file=TEST_DIR/t.qcow2 -device floppy,drive=none0,physica
write-cache = "auto"
share-rw = false
drive-type = "144"
none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
Attached to: /machine/peripheral-anon/device[0]
Removable device: not locked, tray closed
Cache mode: writeback
ide1-cd0: [not inserted]
Attached to: /machine/unattached/device[21]
Removable device: not locked, tray closed
sd0: [not inserted]
Removable device: not locked, tray closed
(qemu) quit
Testing: -drive if=none,file=TEST_DIR/t.qcow2 -device floppy,drive=none0,logical_block_size=4096
QEMU_PROG: -device floppy,drive=none0,logical_block_size=4096: logical_block_size > physical_block_size not supported