qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH for-2.3 0/3] Contain drive_get() misuse


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH for-2.3 0/3] Contain drive_get() misuse
Date: Wed, 25 Mar 2015 11:23:05 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Markus Armbruster <address@hidden> writes:

[...]
> * "allwinner-a10"
>
>    "-nodefaults -serial null -device allwinner-a10" doesn't explode,
>    which means I can't exclude the possibility that this might actually
>    do something useful for someone.  I'd say we treat it just like
>    "pc87312": leave alone now, document incompatible change.
[...]
> How could this kind of mistake could look like in NIC device models?
> "allwinner-a10"'s instance_init aw_a10_init() provides a clue: it messes
> with qemu_check_nic_model():
>
>     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]);
>     }
>
> No other device does that.  Without -nodefaults, this fails:
>
>     -device allwinner-a10: Unsupported NIC model: xgmac

Even better:

    $  qemu-system-arm -S -M highbank -monitor stdio
    QEMU 2.2.90 monitor - type 'help' for more information
    (qemu) device_add allwinner-a10
    Unsupported NIC model: xgmac
    [Exit 1 ]

exit() in monitor command, big no-no.

Machine type doesn't matter.  To get past this, nd_table[0] must have
model=allwinner-emac.  With -net nic,model=allwinner-emac, it has, and
we get to the next round of failures:

* cubieboard

  Board already creates an allwinner-a10, and creating a second one with
  -device or device_add aborts.

* Any other board with an onboard NIC, e.g. highbank

  Refuses to start, as board doesn't support model=allwinner-emac:

      qemu-system-arm: Unsupported NIC model: allwinner-emac

* Any other board without an onboard NIC, e.g. virt

  Warns on startup:

      Warning: requested NIC (anonymous, model allwinner-emac) was not created 
(not supported by this machine?

  -device / device_add allwinner-a10 succeeds, as long as serial_hds[0]
  is set.  If you suppress it with -nodefaults, -device / device_add
  exit()s (no-no again) with

      Can't create serial device, empty char device

  If the board has an onboard serial (e.g. collie), both the onboard
  serial and the allwinner-a10 get are now connected to it.  Not going
  to work.  We normally catch this error, but bypassing qdev properties
  also bypasses the check.

Actual use of -device / device_add allwinner-a10 seems vanishingly
unlikely.  Thus, setting cannot_instantiate_with_device_add_yet is
unlikely to break anything.  Let's do it to mask the "device_add
exit()s" bug.

> I haven't checked all uses of nd_table[].

I have now, this is the only offender.



reply via email to

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