hw: Mark device misusing nd_table[] FIXME
authorMarkus Armbruster <armbru@redhat.com>
Wed, 25 Mar 2015 10:35:25 +0000 (11:35 +0100)
committerMarkus Armbruster <armbru@redhat.com>
Thu, 2 Apr 2015 13:30:32 +0000 (15:30 +0200)
commit19f33f16890fc5ec0d43841625ca44ef28767d1a
tree5d9391f5d6ade8a8b3331f993e08df215154eb02
parentd71b22bb6ae281e66dfa17733105468f830a8c6a
hw: Mark device misusing nd_table[] FIXME

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