qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH real v5 0/4] fdc: Use separate qdev device for d


From: John Snow
Subject: Re: [Qemu-devel] [PATCH real v5 0/4] fdc: Use separate qdev device for drives
Date: Tue, 25 Oct 2016 14:20:01 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0

fdc.use.separate.qdev.device.for.drives.EN.V5.REPACK.PC.LINUX-kw0lf-kr3w

 __            _______  .__   _____   __          ________
|  | ____  _  _\   _  \ |  |_/ ____\ |  | ________\_____  \_  _  __
|  |/ /\ \/ \/ /  /_\  \|  |\   __\  |  |/ /\_  __ \_(__  < \/ \/ /
|    <  \     /\  \_/   \  |_|  |    |    <  |  | \/       \     /
|__|_ \  \/\_/  \_____  /____/__|    |__|_ \ |__| /______  /\/\_/
     \/               \/                  \/             \/

         ________             _________
         \_____  \  ____     |__\   _  \ ___.__.
  ______   _(__  < /    \    |  /  /_\  <   |  |  ______
 /_____/  /       \   |  \   |  \  \_/   \___  | /_____/
         /______  /___|  /\__|  |\_____  / ____|
                \/     \/\______|      \/\/


On 10/25/2016 05:14 AM, Kevin Wolf wrote:
We have been complaining for a long time about how the floppy controller and
floppy drives are combined in a single qdev device and how this makes the
device awkward to work with because it behaves different from all other block
devices.

The latest reason to complain was when I noticed that using qdev device names
in QMP commands (e.g. for media change) doesn't really work when only the
controller is a qdev device, but the drives aren't.

So I decided to have a go at it, and this is the result.

It doesn't actually change any of the inner workings of the floppy controller,
but it wires things up differently on the qdev layer so that a floppy
controller now exposes a bus on which the floppy drives sit. This results in a
structure that is similar to IDE where the actual drive state is still in the
controller and the qdev device basically just contains the qdev properties -
not pretty, but quite workable.

The commit message of patch 3 explains how to use it. In short, there is a
'-device floppy' now and it does what you would expect if you ever used ide-cd.

The other problem is old command lines, especially those using things like
'-global isa-fdc,driveA=...'. In order to keep them working, we need to forward
the property to an internally created floppy drive device. This is a bit like
usb-storage, which we know is ugly, but works well enough in practice. The good
news here is that in contrast to usb-storage, the floppy controller only does
the forwarding for legacy configurations; as soon as you start using '-device
floppy', it doesn't happen any more.

So as you may have expected, this conversion doesn't result in a perfect
device, but I think it's definitely an improvement over the old state. I hope
you like it despite the warts. :-)

v5:
- Apply _filter_qemu to stderr, too [John]
- Rename the bus to floppy-bus [Frederic]
- Use FLOPPY_BUS() instead of DO_UPDATE() [Frederic]

v4:
- John says that his grep is broken and hangs at 100% CPU with my attempt to
  extract the floppy controller from info qtree. Use a simpler sed command
  instead (which, unlike the grep command, doesn't handle arbitrary indentation
  level of the next item, but we know what comes next, so just hardcoding 10
  spaces works, too).

v3:
- Fixed omissons in the conversion sysbus-fdc and the Sun one. Nice, combining
  floppy controllers and weird platforms in a single series. [John]

v2:
- Added patch 4 (qemu-iotests case for floppy config on the command line)
- Patch 2: Create a floppy device only if a BlockBackend exists instead of
  always creating two of them
- Patch 2: Initialise drive->fdctrl even if no drive is attached, it is
  accessed anyway during migration
- Patch 3: Keep 'type' qdev property and FDrive->drive in sync
- Patch 3: Removed if with condition that is always true

Kevin Wolf (4):
  fdc: Add a floppy qbus
  fdc: Add a floppy drive qdev
  fdc: Move qdev properties to FloppyDrive
  qemu-iotests: Test creating floppy drives

 hw/block/fdc.c             |  271 ++++++++--
 tests/qemu-iotests/172     |  246 ++++++++++
 tests/qemu-iotests/172.out | 1170 ++++++++++++++++++++++++++++++++++++++++++++
 tests/qemu-iotests/group   |    1 +
 vl.c                       |    1 +
 5 files changed, 1641 insertions(+), 48 deletions(-)
 create mode 100755 tests/qemu-iotests/172
 create mode 100644 tests/qemu-iotests/172.out


Thanks, applied to my IDE tree:

https://github.com/jnsnow/qemu/commits/ide
https://github.com/jnsnow/qemu.git

--js

(Yes, the IDE one instead of the FDC one. I'm just going to batch submit a few disparate patches I have kicking around.)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]