qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <andreas.faerber@web.de>
To: Markus Armbruster <armbru@redhat.com>, qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org,
	Peter Crosthwaite <peter.crosthwaite@xilinx.com>,
	Michael Walle <michael@walle.cc>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	pbonzini@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2 for-2.3 1/5] hw: Mark devices picking up block backends actively FIXME
Date: Wed, 25 Mar 2015 16:17:34 +0100	[thread overview]
Message-ID: <5512D18E.4010203@web.de> (raw)
In-Reply-To: <1427292969-30929-2-git-send-email-armbru@redhat.com>

Am 25.03.2015 um 15:16 schrieb Markus Armbruster:
> Drives defined with if!=none are for board initialization to wire up.
> Board code calls drive_get() or similar to find them, and creates
> devices with their qdev drive properties set accordingly.
> 
> Except a few devices go on a fishing expedition for a suitable backend
> instead of exposing a drive property for board code to set: they call
> driver_get() or drive_get_next() in their realize() or init() method
> to implicitly connect to the "next" backend with a certain interface
> type.
> 
> Picking up backends that way works when the devices are created by
> board code.  But it's inappropriate for -device or device_add.  Not
> only is this inconsistent with how the other block device models work
> (they connect to a backend explicitly identified by a "drive"
> property), it breaks when the "next" backend has been picked up by the
> board already.
> 
> Example:
> 
>     $ qemu-system-arm -S -M connex -pflash flash.img -device ssi-sd
>     Aborted (core dumped)
> 
> Mark them with suitable FIXME comments.
> 
> Cc: Andrzej Zaborowski <balrogg@gmail.com>
> Cc: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> Cc: "Andreas Färber" <andreas.faerber@web.de>
> Cc: Michael Walle <michael@walle.cc>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  hw/arm/spitz.c            | 1 +
>  hw/block/m25p80.c         | 1 +
>  hw/isa/pc87312.c          | 2 ++
>  hw/sd/milkymist-memcard.c | 1 +
>  hw/sd/pl181.c             | 1 +
>  hw/sd/sdhci.c             | 1 +
>  hw/sd/ssi-sd.c            | 1 +
>  7 files changed, 8 insertions(+)
[...]
> diff --git a/hw/isa/pc87312.c b/hw/isa/pc87312.c
> index 40a1106..2849e8d 100644
> --- a/hw/isa/pc87312.c
> +++ b/hw/isa/pc87312.c
> @@ -319,11 +319,13 @@ static void pc87312_realize(DeviceState *dev, Error **errp)
>          d = DEVICE(isa);
>          qdev_prop_set_uint32(d, "iobase", get_fdc_iobase(s));
>          qdev_prop_set_uint32(d, "irq", 6);
> +        /* FIXME use a qdev drive property instead of drive_get() */
>          drive = drive_get(IF_FLOPPY, 0, 0);
>          if (drive != NULL) {
>              qdev_prop_set_drive_nofail(d, "driveA",
>                                         blk_by_legacy_dinfo(drive));
>          }
> +        /* FIXME use a qdev drive property instead of drive_get() */
>          drive = drive_get(IF_FLOPPY, 0, 1);
>          if (drive != NULL) {
>              qdev_prop_set_drive_nofail(d, "driveB",

As can be seen, there are drive properties driveA and driveB already on
the destination device. How do you imagine this to be fixed? Add alias
properties on the container device? (CC'ing Stefan)

Regards,
Andreas

  reply	other threads:[~2015-03-25 15:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-25 14:16 [Qemu-devel] [PATCH v2 for-2.3 0/5] Contain drive, serial, parallel, net misuse Markus Armbruster
2015-03-25 14:16 ` [Qemu-devel] [PATCH v2 for-2.3 1/5] hw: Mark devices picking up block backends actively FIXME Markus Armbruster
2015-03-25 15:17   ` Andreas Färber [this message]
2015-03-25 15:18     ` Paolo Bonzini
2015-03-25 14:16 ` [Qemu-devel] [PATCH v2 for-2.3 2/5] hw: Mark devices picking up char " Markus Armbruster
2015-03-25 15:23   ` Andreas Färber
2015-03-25 14:16 ` [Qemu-devel] [PATCH v2 for-2.3 3/5] hw: Mark device misusing nd_table[] FIXME Markus Armbruster
2015-03-25 14:16 ` [Qemu-devel] [PATCH v2 for-2.3 4/5] sdhci: Make device "sdhci-pci" unavailable with -device Markus Armbruster
2015-03-25 14:16 ` [Qemu-devel] [PATCH v2 for-2.3 5/5] sysbus: Make devices picking up backends " Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5512D18E.4010203@web.de \
    --to=andreas.faerber@web.de \
    --cc=armbru@redhat.com \
    --cc=michael@walle.cc \
    --cc=pbonzini@redhat.com \
    --cc=peter.crosthwaite@xilinx.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).