qemu/hw/arm
Cédric Le Goater d3bad7e7c4 arm/aspeed: Rework NIC attachment
The number of MACs supported by an Aspeed SoC is defined by "macs_num"
under the SoC model, that is two for the AST2400 and AST2500 and four
for the AST2600. The model initializes the maximum number of supported
MACs but the number of realized devices is capped by the number of
network device back-ends defined on the command line. This can leave
unrealized devices hanging around in the QOM composition tree.

To get virtual hardware that matches the physical hardware, you have
to pass exactly as many -nic options as there are MACs, and some of
them must be -nic none:

* Machines ast2500-evb, palmetto-bmc, romulus-bmc, sonorapass-bmc,
  swift-bmc, and witherspoon-bmc: two -nic, and the second one must be
  -nic none.

* Machine ast2600-evb: four -nic, the first one must be -nic none.

* Machine tacoma-bmc: four nic, the first two and the last one must be
  -nic none.

Modify the machine initialization to define which MACs are attached to
a network device back-end using a bit-field property "macs-mask" and
let the SoC realize all network devices.

The default setting of "macs-mask" is "use MAC0" only, which works for
all our AST2400 and AST2500 machines. The AST2600 machines have
different configurations. The AST2600 EVB machine activates MAC1, MAC2
and MAC3 and the Tacoma BMC machine activates MAC2.

Incompatible CLI change: -nic options now apply to *active* MACs:
MAC1, MAC2, MAC3 for ast2600-evb, MAC2 for tacoma-bmc, and MAC0 for
all the others.

The machines now always get all MACs as they should. Visible in "info
qom-tree", here's the change for tacoma-bmc:

     /machine (tacoma-bmc-machine)
       /peripheral (container)
       /peripheral-anon (container)
       /soc (ast2600-a1)
         [...]
         /ftgmac100[0] (ftgmac100)
           /ftgmac100[0] (qemu:memory-region)
         /ftgmac100[1] (ftgmac100)
    +      /ftgmac100[0] (qemu:memory-region)
         /ftgmac100[2] (ftgmac100)
    +      /ftgmac100[0] (qemu:memory-region)
         /ftgmac100[3] (ftgmac100)
    +      /ftgmac100[0] (qemu:memory-region)
         [...]
         /mii[0] (aspeed-mmi)
           /aspeed-mmi[0] (qemu:memory-region)
         /mii[1] (aspeed-mmi)
    +      /aspeed-mmi[0] (qemu:memory-region)
         /mii[2] (aspeed-mmi)
    +      /aspeed-mmi[0] (qemu:memory-region)
         /mii[3] (aspeed-mmi)
    +      /aspeed-mmi[0] (qemu:memory-region)

Also visible in "info qtree"; here's the change for tacoma-bmc:

       dev: ftgmac100, id ""
         gpio-out "sysbus-irq" 1
         aspeed = true
    -    mac = "52:54:00:12:34:56"
    -    netdev = "hub0port0"
    +    mac = "52:54:00:12:34:57"
    +    netdev = ""
         mmio 000000001e660000/0000000000002000
       dev: ftgmac100, id ""
    -    aspeed = false
    -    mac = "00:00:00:00:00:00"
    +    gpio-out "sysbus-irq" 1
    +    aspeed = true
    +    mac = "52:54:00:12:34:58"
         netdev = ""
    +    mmio 000000001e680000/0000000000002000
       dev: ftgmac100, id ""
    -    aspeed = false
    -    mac = "00:00:00:00:00:00"
    -    netdev = ""
    +    gpio-out "sysbus-irq" 1
    +    aspeed = true
    +    mac = "52:54:00:12:34:56"
    +    netdev = "hub0port0"
    +    mmio 000000001e670000/0000000000002000
       dev: ftgmac100, id ""
    -    aspeed = false
    -    mac = "00:00:00:00:00:00"
    +    gpio-out "sysbus-irq" 1
    +    aspeed = true
    +    mac = "52:54:00:12:34:59"
         netdev = ""
    +    mmio 000000001e690000/0000000000002000
       [...]
       dev: aspeed-mmi, id ""
         mmio 000000001e650000/0000000000000008
       dev: aspeed-mmi, id ""
    +    mmio 000000001e650008/0000000000000008
       dev: aspeed-mmi, id ""
    +    mmio 000000001e650010/0000000000000008
       dev: aspeed-mmi, id ""
    +    mmio 000000001e650018/0000000000000008

Inactive MACs will have no peer and QEMU may warn the user with :

    qemu-system-arm: warning: nic ftgmac100.0 has no peer
    qemu-system-arm: warning: nic ftgmac100.1 has no peer
    qemu-system-arm: warning: nic ftgmac100.3 has no peer

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Joel Stanley <joel@jms.id.au>
[Commit message expanded]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20200609122339.937862-6-armbru@redhat.com>
2020-06-15 21:36:09 +02:00
..
allwinner-a10.c qom: Drop parameter @errp of object_property_add() & friends 2020-05-15 07:07:58 +02:00
allwinner-h3.c qom: Drop parameter @errp of object_property_add() & friends 2020-05-15 07:07:58 +02:00
armsse.c qdev: set properties with device_class_set_props() 2020-01-24 20:59:15 +01:00
armv7m.c qom: Drop parameter @errp of object_property_add() & friends 2020-05-15 07:07:58 +02:00
aspeed_ast2600.c arm/aspeed: Rework NIC attachment 2020-06-15 21:36:09 +02:00
aspeed_soc.c arm/aspeed: Rework NIC attachment 2020-06-15 21:36:09 +02:00
aspeed.c arm/aspeed: Rework NIC attachment 2020-06-15 21:36:09 +02:00
bcm2835_peripherals.c wire in the dwc-hsotg (dwc2) USB host controller emulation 2020-06-05 17:23:09 +01:00
bcm2836.c qom: Drop parameter @errp of object_property_add() & friends 2020-05-15 07:07:58 +02:00
boot.c Remove unnecessary cast when using the address_space API 2020-02-20 14:47:08 +01:00
collie.c hw/arm/collie: Put StrongARMState* into a CollieMachineState struct 2020-04-03 19:23:37 +01:00
cubieboard.c qom: Drop parameter @errp of object_property_add() & friends 2020-05-15 07:07:58 +02:00
digic_boards.c arm/digic_boards: use memdev for RAM 2020-02-19 16:49:54 +00:00
digic.c
exynos4_boards.c
exynos4210.c hw/arm: Let devices own the MemoryRegion they create 2020-03-17 15:18:50 +01:00
fsl-imx6.c hw/arm/fsl-imx6: Connect watchdog interrupts 2020-05-21 22:05:27 +01:00
fsl-imx6ul.c hw/arm/fsl-imx6ul: Connect watchdog interrupts 2020-05-21 22:05:27 +01:00
fsl-imx7.c hw/arm/fsl-imx7: Connect watchdog interrupts 2020-05-21 22:05:27 +01:00
fsl-imx25.c hw/arm/fsl-imx25: Wire up watchdog 2020-05-21 22:05:27 +01:00
fsl-imx31.c hw/arm/fsl-imx31: Wire up watchdog 2020-05-21 22:05:27 +01:00
gumstix.c hw/arm/gumstix: Simplify since the machines are little-endian only 2020-03-05 16:09:14 +00:00
highbank.c arm/highbank: use memdev for RAM 2020-02-19 16:49:54 +00:00
imx25_pdk.c hw/arm/fsl-imx25: Wire up eSDHC controllers 2020-03-12 16:27:33 +00:00
integratorcp.c hw/arm/integratorcp: Replace hw_error() by qemu_log_mask() 2020-05-21 22:05:27 +01:00
Kconfig hw/arm/fsl-imx31: Wire up watchdog 2020-05-21 22:05:27 +01:00
kzm.c arm/kzm: use memdev for RAM 2020-02-19 16:49:55 +00:00
mainstone.c hw/arm: Use memory_region_init_rom() with read-only regions 2020-03-17 15:18:46 +01:00
Makefile.objs hw/arm: add Xunlong Orange Pi PC machine 2020-03-12 16:27:33 +00:00
mcimx6ul-evk.c qom: Drop parameter @errp of object_property_add() & friends 2020-05-15 07:07:58 +02:00
mcimx7d-sabre.c qom: Drop parameter @errp of object_property_add() & friends 2020-05-15 07:07:58 +02:00
microbit.c
mps2-tz.c hw/arm/mps2-tz: Use TYPE_IOTKIT instead of hardcoded string 2020-05-04 10:32:46 +01:00
mps2.c arm/mps2: use memdev for RAM 2020-02-19 16:49:55 +00:00
msf2-soc.c qom: Drop parameter @errp of object_property_add() & friends 2020-05-15 07:07:58 +02:00
msf2-som.c
musca.c
musicpal.c hw/arm/musicpal: Map the UART devices unconditionally 2020-05-11 11:48:50 +01:00
netduino2.c
netduinoplus2.c hw/arm: Add the Netduino Plus 2 2020-01-17 14:09:29 +00:00
nrf51_soc.c qom: Drop parameter @errp of object_property_add() & friends 2020-05-15 07:07:58 +02:00
nseries.c arm/nseries: use memdev for RAM 2020-02-19 16:49:56 +00:00
omap1.c omap-gpio: remove PROP_PTR 2020-01-07 17:24:29 +04:00
omap2.c omap-gpio: remove PROP_PTR 2020-01-07 17:24:29 +04:00
omap_sx1.c hw/arm: Use memory_region_init_rom() with read-only regions 2020-03-17 15:18:46 +01:00
orangepi.c qom: Drop parameter @errp of object_property_add() & friends 2020-05-15 07:07:58 +02:00
palm.c hw/arm: Use memory_region_init_rom() with read-only regions 2020-03-17 15:18:46 +01:00
pxa2xx_gpio.c hw/arm/pxa2xx: Replace hw_error() by qemu_log_mask() 2020-05-21 22:05:27 +01:00
pxa2xx_pic.c
pxa2xx.c hw/arm/pxa2xx: Replace printf() call by qemu_log_mask() 2020-06-05 17:23:08 +01:00
raspi.c qom: Drop parameter @errp of object_property_add() & friends 2020-05-15 07:07:58 +02:00
realview.c
sabrelite.c arm/sabrelite: Consistently use &error_fatal in sabrelite_init() 2020-05-27 07:45:45 +02:00
sbsa-ref.c hw: Use QEMU_IS_ALIGNED() on parallel flash block size 2020-05-18 19:05:25 +02:00
smmu-common.c hw/arm/smmu-common: Simplify smmu_find_smmu_pcibus() logic 2020-03-05 16:09:14 +00:00
smmu-internal.h
smmuv3-internal.h
smmuv3.c hw: Remove unnecessary cast when calling dma_memory_read() 2020-02-20 14:47:08 +01:00
spitz.c hw/arm: Use memory_region_init_rom() with read-only regions 2020-03-17 15:18:46 +01:00
stellaris.c hw/arm: Use memory_region_init_rom() with read-only regions 2020-03-17 15:18:46 +01:00
stm32f205_soc.c hw/arm: Let devices own the MemoryRegion they create 2020-03-17 15:18:50 +01:00
stm32f405_soc.c arm/stm32f405: Fix realization of "stm32f2xx-adc" devices 2020-06-15 21:35:52 +02:00
strongarm.c hw/arm/strongarm: move timer_new from init() into realize() to avoid memleaks 2020-03-05 16:09:16 +00:00
strongarm.h
sysbus-fdt.c hw/arm/virt: vTPM support 2020-03-05 12:18:16 -05:00
tosa.c hw/arm: Use memory_region_init_rom() with read-only regions 2020-03-17 15:18:46 +01:00
trace-events
versatilepb.c arm/versatilepb: use memdev for RAM 2020-02-19 16:49:56 +00:00
vexpress.c qom: Drop parameter @errp of object_property_add() & friends 2020-05-15 07:07:58 +02:00
virt-acpi-build.c arm/acpi: TPM2 ACPI table support 2020-06-09 12:46:45 -04:00
virt.c hw: Use QEMU_IS_ALIGNED() on parallel flash block size 2020-05-18 19:05:25 +02:00
xilinx_zynq.c qom: Drop parameter @errp of object_property_add() & friends 2020-05-15 07:07:58 +02:00
xlnx-versal-virt.c qom: Drop parameter @errp of object_property_add() & friends 2020-05-15 07:07:58 +02:00
xlnx-versal.c qom: Drop parameter @errp of object_property_add() & friends 2020-05-15 07:07:58 +02:00
xlnx-zcu102.c qom: Drop parameter @errp of object_property_add() & friends 2020-05-15 07:07:58 +02:00
xlnx-zynqmp.c qom: Drop parameter @errp of object_property_add() & friends 2020-05-15 07:07:58 +02:00
z2.c hw/arm/z2: Simplify since the machines are little-endian only 2020-03-05 16:09:15 +00:00