qemu-patch-raspberry4/hw/ide
Markus Armbruster 7d0d69509a block: Fix virtual media change for if=none
BlockDriverState member removable controls whether virtual media
change (monitor commands change, eject) is allowed.  It is set when
the "type hint" is BDRV_TYPE_CDROM or BDRV_TYPE_FLOPPY.

The type hint is only set by drive_init().  It sets BDRV_TYPE_FLOPPY
for if=floppy.  It sets BDRV_TYPE_CDROM for media=cdrom and if=ide,
scsi, xen, or none.

if=ide and if=scsi work, because the type hint makes it a CD-ROM.
if=xen likewise, I think.

For the same reason, if=none works when it's used by ide-drive or
scsi-disk.  For other guest devices, there are problems:

* fdc: you can't change virtual media

    $ qemu [...] -drive if=none,id=foo,... -global isa-fdc.driveA=foo
    QEMU 0.12.50 monitor - type 'help' for more information
    (qemu) eject foo
    Device 'foo' is not removable

  unless you add media=cdrom, but that makes it readonly.

* virtio: if you add media=cdrom, you can change virtual media.  If
  you eject, the guest gets I/O errors.  If you change, the guest sees
  the drive's contents suddenly change.

* scsi-generic: if you add media=cdrom, you can change virtual media.
  I didn't test what that does to the guest or the physical device,
  but it can't be pretty.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-07-02 13:18:02 +02:00
..
cmd646.c ide: Split non-qdev code off ide_init2() 2010-06-04 11:43:39 +02:00
core.c block: Fix virtual media change for if=none 2010-07-02 13:18:02 +02:00
internal.h qdev: Decouple qdev_prop_drive from DriveInfo 2010-07-02 13:18:02 +02:00
isa.c ide: Split non-qdev code off ide_init2() 2010-06-04 11:43:39 +02:00
macio.c ide: Split non-qdev code off ide_init2() 2010-06-04 11:43:39 +02:00
microdrive.c ide: Split non-qdev code off ide_init2() 2010-06-04 11:43:39 +02:00
mmio.c ide: Split non-qdev code off ide_init2() 2010-06-04 11:43:39 +02:00
pci.c ide save/restore current transfer fields 2010-01-26 15:42:02 -06:00
pci.h ide: port pci ide to vmstate 2009-10-27 12:28:46 -05:00
piix.c ide: Split non-qdev code off ide_init2() 2010-06-04 11:43:39 +02:00
qdev.c block: Catch attempt to attach multiple devices to a blockdev 2010-07-02 13:18:02 +02:00
via.c MIPS: Initial support of VIA IDE controller used by fulong mini pc 2010-06-29 23:07:52 +02:00