[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 3/5] hw: Mark device misusing nd_table[] FIXME
From: |
Markus Armbruster |
Subject: |
[Qemu-devel] [PULL v2 3/5] hw: Mark device misusing nd_table[] FIXME |
Date: |
Thu, 2 Apr 2015 15:35:15 +0200 |
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 <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
---
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
- [Qemu-devel] [PULL v2 0/5] hw: Contain drive, serial, parallel, net misuse, Markus Armbruster, 2015/04/02
- [Qemu-devel] [PULL v2 4/5] sdhci: Make device "sdhci-pci" unavailable with -device, Markus Armbruster, 2015/04/02
- [Qemu-devel] [PULL v2 1/5] hw: Mark devices picking up block backends actively FIXME, Markus Armbruster, 2015/04/02
- [Qemu-devel] [PULL v2 5/5] sysbus: Make devices picking up backends unavailable with -device, Markus Armbruster, 2015/04/02
- [Qemu-devel] [PULL v2 2/5] hw: Mark devices picking up char backends actively FIXME, Markus Armbruster, 2015/04/02
- [Qemu-devel] [PULL v2 3/5] hw: Mark device misusing nd_table[] FIXME,
Markus Armbruster <=
- Re: [Qemu-devel] [PULL v2 0/5] hw: Contain drive, serial, parallel, net misuse, Peter Maydell, 2015/04/02