qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, Li Guang <lig.fnst@cn.fujitsu.com>,
	peter.maydell@linaro.org
Subject: [Qemu-devel] [PATCH v2 for-2.3 3/5] hw: Mark device misusing nd_table[] FIXME
Date: Wed, 25 Mar 2015 15:16:07 +0100	[thread overview]
Message-ID: <1427292969-30929-4-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1427292969-30929-1-git-send-email-armbru@redhat.com>

NICs defined with -net nic are for board initialization to wire up.
Board code examines nd_table[] to find them, and creates devices with
their qdev NIC properties set accordingly.

Except "allwinner-a10" goes on a fishing expedition for NIC
configuration instead of exposing the usual NIC properties for board
code to set: it uses nd_table[0] in its instance_init() method.

Picking up the first -net nic option's configuration that way works
when the device is created by board code.  But it's inappropriate for
-device and device_add.  Not only is it inconsistent with how the
other block device models work (they get their configuration from
properties "mac", "vlan", "netdev"), it breaks when nd_table[0] has
been picked up by the board or a previous -device / device_add
already.

Example:

    $ qemu-system-arm -S -M cubieboard -device allwinner-a10
    qemu-system-arm: -device allwinner-a10: Property 'allwinner-emac.netdev' can't take value 'hub0port0', it's in use
    Aborted (core dumped)

It also breaks in other entertaining ways:

    $ qemu-system-arm -M highbank -device allwinner-a10
    qemu-system-arm: -device allwinner-a10: Unsupported NIC model: xgmac
    $ qemu-system-arm -M highbank -net nic,model=allwinner-emac -device allwinner-a10
    qemu-system-arm: Unsupported NIC model: allwinner-emac

Mark the mistake with a FIXME comment.

Cc: Li Guang <lig.fnst@cn.fujitsu.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 hw/arm/allwinner-a10.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/arm/allwinner-a10.c b/hw/arm/allwinner-a10.c
index 86965a7..ff249af 100644
--- a/hw/arm/allwinner-a10.c
+++ b/hw/arm/allwinner-a10.c
@@ -34,6 +34,7 @@ static void aw_a10_init(Object *obj)
 
     object_initialize(&s->emac, sizeof(s->emac), TYPE_AW_EMAC);
     qdev_set_parent_bus(DEVICE(&s->emac), sysbus_get_default());
+    /* FIXME use qdev NIC properties instead of nd_table[] */
     if (nd_table[0].used) {
         qemu_check_nic_model(&nd_table[0], TYPE_AW_EMAC);
         qdev_set_nic_properties(DEVICE(&s->emac), &nd_table[0]);
-- 
1.9.3

  parent reply	other threads:[~2015-03-25 14:16 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
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 ` Markus Armbruster [this message]
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=1427292969-30929-4-git-send-email-armbru@redhat.com \
    --to=armbru@redhat.com \
    --cc=lig.fnst@cn.fujitsu.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /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).