On 3 January 2014 03:21, Peter Crosthwaite <peter.crosthwa...@xilinx.com> wrote:
> Don't conditionalise GEM instantiation on networking attachments. The
> device should always be present even if not attached to a network.
>
> This allows for probing of the device by expectant guests (such as
> OS's).  This is needed because sysbus (or AXI in Xilinx's real hw case)
> is not self identifying so the guest has no dynamic way of detecting
> device absence.

Agreed that this is the right thing.

Some day I might try to look into how to update our handling
of embedded NICs to work with non-legacy command lines...


> -    for (n = 0; n < nb_nics; n++) {
> -        nd = &nd_table[n];
> +    for (n = 0; n < 2; n++) {
> +        NICInfo *nd = n < nb_nics ? &nd_table[n] : NULL;
>          if (n == 0) {
>              gem_init(nd, 0xE000B000, pic[54-IRQ_OFFSET]);
>          } else if (n == 1) {

This is now a rather odd loop which goes round exactly twice
and uses an if() statement to make the body different each time.

Instead you can just say:
     gem_init(nd_table[0], 0xe000b000, pic[54 - IRQ_OFFSET]);
     gem_init(nd_table[1], 0xe000c000, pic[54 - IRQ_OFFSET]);

and have gem_init() condition the calls to qdev_set_nic_properties
and qdev_check_nic_model on "if (nd->used)".

thanks
-- PMM

Reply via email to