qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] arm/aspeed: Rework NIC attachment
@ 2020-05-27 12:44 Cédric Le Goater
  2020-05-27 13:36 ` Markus Armbruster
  2020-05-28  7:25 ` Joel Stanley
  0 siblings, 2 replies; 5+ messages in thread
From: Cédric Le Goater @ 2020-05-27 12:44 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Andrew Jeffery, qemu-devel, Markus Armbruster, qemu-arm,
	Joel Stanley, Philippe Mathieu-Daudé,
	Cédric Le Goater

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.

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.

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>
---

 To be applied on top of patch :

 "arm/aspeed: Compute the number of CPUs from the SoC definition" 
 http://patchwork.ozlabs.org/project/qemu-devel/patch/20200519091631.1006073-1-clg@kaod.org/

 Markus, do you mind taking this patch in your QOM series also ?

 Thanks,

 C.

 include/hw/arm/aspeed.h |  6 ++++++
 hw/arm/aspeed.c         | 13 +++++++++++++
 hw/arm/aspeed_ast2600.c |  3 +--
 hw/arm/aspeed_soc.c     |  3 +--
 4 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/include/hw/arm/aspeed.h b/include/hw/arm/aspeed.h
index 18521484b90e..95b4daece86d 100644
--- a/include/hw/arm/aspeed.h
+++ b/include/hw/arm/aspeed.h
@@ -23,6 +23,11 @@ typedef struct AspeedMachine {
     bool mmio_exec;
 } AspeedMachine;
 
+#define ASPEED_MAC0_ON   (1 << 0)
+#define ASPEED_MAC1_ON   (1 << 1)
+#define ASPEED_MAC2_ON   (1 << 2)
+#define ASPEED_MAC3_ON   (1 << 3)
+
 #define ASPEED_MACHINE_CLASS(klass) \
      OBJECT_CLASS_CHECK(AspeedMachineClass, (klass), TYPE_ASPEED_MACHINE)
 #define ASPEED_MACHINE_GET_CLASS(obj) \
@@ -39,6 +44,7 @@ typedef struct AspeedMachineClass {
     const char *fmc_model;
     const char *spi_model;
     uint32_t num_cs;
+    uint32_t macs_mask;
     void (*i2c_init)(AspeedBoardState *bmc);
 } AspeedMachineClass;
 
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index fd5cc542a584..f8f3ef89d320 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -258,6 +258,7 @@ static void aspeed_machine_init(MachineState *machine)
     DriveInfo *drive0 = drive_get(IF_MTD, 0, 0);
     ram_addr_t max_ram_size;
     int i;
+    NICInfo *nd = &nd_table[0];
 
     bmc = g_new0(AspeedBoardState, 1);
 
@@ -277,6 +278,14 @@ static void aspeed_machine_init(MachineState *machine)
     object_property_set_uint(OBJECT(&bmc->soc), ram_size, "ram-size",
                              &error_fatal);
 
+    for (i = 0; i < sc->macs_num; i++) {
+        if ((amc->macs_mask & (1 << i)) && nd->used) {
+            qemu_check_nic_model(nd, TYPE_FTGMAC100);
+            qdev_set_nic_properties(DEVICE(&bmc->soc.ftgmac100[i]), nd);
+            nd++;
+        }
+    }
+
     object_property_set_int(OBJECT(&bmc->soc), amc->hw_strap1, "hw-strap1",
                             &error_abort);
     object_property_set_int(OBJECT(&bmc->soc), amc->hw_strap2, "hw-strap2",
@@ -556,12 +565,14 @@ static int aspeed_soc_num_cpus(const char *soc_name)
 static void aspeed_machine_class_init(ObjectClass *oc, void *data)
 {
     MachineClass *mc = MACHINE_CLASS(oc);
+    AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(oc);
 
     mc->init = aspeed_machine_init;
     mc->no_floppy = 1;
     mc->no_cdrom = 1;
     mc->no_parallel = 1;
     mc->default_ram_id = "ram";
+    amc->macs_mask = ASPEED_MAC0_ON;
 
     aspeed_machine_class_props_init(oc);
 }
@@ -680,6 +691,7 @@ static void aspeed_machine_ast2600_evb_class_init(ObjectClass *oc, void *data)
     amc->fmc_model = "w25q512jv";
     amc->spi_model = "mx66u51235f";
     amc->num_cs    = 1;
+    amc->macs_mask  = ASPEED_MAC1_ON | ASPEED_MAC2_ON | ASPEED_MAC3_ON;
     amc->i2c_init  = ast2600_evb_i2c_init;
     mc->default_ram_size = 1 * GiB;
     mc->default_cpus = mc->min_cpus = mc->max_cpus =
@@ -698,6 +710,7 @@ static void aspeed_machine_tacoma_class_init(ObjectClass *oc, void *data)
     amc->fmc_model = "mx66l1g45g";
     amc->spi_model = "mx66l1g45g";
     amc->num_cs    = 2;
+    amc->macs_mask  = ASPEED_MAC2_ON;
     amc->i2c_init  = witherspoon_bmc_i2c_init; /* Same board layout */
     mc->default_ram_size = 1 * GiB;
     mc->default_cpus = mc->min_cpus = mc->max_cpus =
diff --git a/hw/arm/aspeed_ast2600.c b/hw/arm/aspeed_ast2600.c
index c6821b332257..b912d19f809f 100644
--- a/hw/arm/aspeed_ast2600.c
+++ b/hw/arm/aspeed_ast2600.c
@@ -461,8 +461,7 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp)
     }
 
     /* Net */
-    for (i = 0; i < nb_nics && i < sc->macs_num; i++) {
-        qdev_set_nic_properties(DEVICE(&s->ftgmac100[i]), &nd_table[i]);
+    for (i = 0; i < sc->macs_num; i++) {
         object_property_set_bool(OBJECT(&s->ftgmac100[i]), true, "aspeed",
                                  &err);
         object_property_set_bool(OBJECT(&s->ftgmac100[i]), true, "realized",
diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c
index e6f4b59134ba..3ec1257c140b 100644
--- a/hw/arm/aspeed_soc.c
+++ b/hw/arm/aspeed_soc.c
@@ -404,8 +404,7 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp)
     }
 
     /* Net */
-    for (i = 0; i < nb_nics && i < sc->macs_num; i++) {
-        qdev_set_nic_properties(DEVICE(&s->ftgmac100[i]), &nd_table[i]);
+    for (i = 0; i < sc->macs_num; i++) {
         object_property_set_bool(OBJECT(&s->ftgmac100[i]), true, "aspeed",
                                  &err);
         object_property_set_bool(OBJECT(&s->ftgmac100[i]), true, "realized",
-- 
2.25.4



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v3] arm/aspeed: Rework NIC attachment
  2020-05-27 12:44 [PATCH v3] arm/aspeed: Rework NIC attachment Cédric Le Goater
@ 2020-05-27 13:36 ` Markus Armbruster
  2020-05-27 15:46   ` Cédric Le Goater
  2020-05-28  7:25 ` Joel Stanley
  1 sibling, 1 reply; 5+ messages in thread
From: Markus Armbruster @ 2020-05-27 13:36 UTC (permalink / raw)
  To: Cédric Le Goater
  Cc: Peter Maydell, Andrew Jeffery, qemu-devel, qemu-arm,
	Joel Stanley, Philippe Mathieu-Daudé

Cédric Le Goater <clg@kaod.org> writes:

> 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.
>
> 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.

Let's be more clear on what this means, and "This is actually a device
modelling fix for these two machines."  Okay?

> 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>

Here's the "info qom-tree" 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)

These changes are due to realizing MAC1, MAC2, MAC3.  Looks good.

Here's "info qtree":

       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

Here we can see the network backend now gets connected to MAC2 instead
of MAC0.

This is without any networking-related options, i.e. we get just the
single default network backend.

> ---
>
>  To be applied on top of patch :
>
>  "arm/aspeed: Compute the number of CPUs from the SoC definition" 
>  http://patchwork.ozlabs.org/project/qemu-devel/patch/20200519091631.1006073-1-clg@kaod.org/
>
>  Markus, do you mind taking this patch in your QOM series also ?

On the contrary!

I'll work my "info qom-tree" and "info qtree" diffs into the commit
message, if you don't mind.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v3] arm/aspeed: Rework NIC attachment
  2020-05-27 13:36 ` Markus Armbruster
@ 2020-05-27 15:46   ` Cédric Le Goater
  2020-05-28  7:12     ` Markus Armbruster
  0 siblings, 1 reply; 5+ messages in thread
From: Cédric Le Goater @ 2020-05-27 15:46 UTC (permalink / raw)
  To: Markus Armbruster
  Cc: Peter Maydell, Andrew Jeffery, qemu-devel, qemu-arm,
	Joel Stanley, Philippe Mathieu-Daudé

On 5/27/20 3:36 PM, Markus Armbruster wrote:
> Cédric Le Goater <clg@kaod.org> writes:
> 
>> 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.
>>
>> 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.
> 
> Let's be more clear on what this means, and "This is actually a device
> modelling fix for these two machines."  Okay?

Well, I guess so. It's a fix in the way we attach network backends to 
the MACs of the machines. 

On the tacoma-bmc, we had to use '-nic <foo> -nic <bar> -nic <good one>' 
to configure the MAC2 in use by the machine. Which was dubious.

Now, a single -nic is enough.

>> 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>
> 
> Here's the "info qom-tree" 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)

Yes. All are realized now.

>          [...]
>          /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)

Same for the MMI interfaces on AST2600.

> These changes are due to realizing MAC1, MAC2, MAC3.  Looks good.
> 
> Here's "info qtree":
> 
>        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
> 
> Here we can see the network backend now gets connected to MAC2 instead
> of MAC0.

yes.

With only one nic on the command line, the backend was attached to the 
first (unused) MAC0 of the machine and now it is attached to the first 
active MAC2 of the machine.

> 
> This is without any networking-related options, i.e. we get just the
> single default network backend.
> 
>> ---
>>
>>  To be applied on top of patch :
>>
>>  "arm/aspeed: Compute the number of CPUs from the SoC definition" 
>>  http://patchwork.ozlabs.org/project/qemu-devel/patch/20200519091631.1006073-1-clg@kaod.org/
>>
>>  Markus, do you mind taking this patch in your QOM series also ?
> 
> On the contrary!
> 
> I'll work my "info qom-tree" and "info qtree" diffs into the commit
> message, if you don't mind.

Sure. 

Thanks,

C. 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v3] arm/aspeed: Rework NIC attachment
  2020-05-27 15:46   ` Cédric Le Goater
@ 2020-05-28  7:12     ` Markus Armbruster
  0 siblings, 0 replies; 5+ messages in thread
From: Markus Armbruster @ 2020-05-28  7:12 UTC (permalink / raw)
  To: Cédric Le Goater
  Cc: Peter Maydell, Andrew Jeffery, qemu-devel, qemu-arm,
	Joel Stanley, Philippe Mathieu-Daudé

Cédric Le Goater <clg@kaod.org> writes:

> On 5/27/20 3:36 PM, Markus Armbruster wrote:
>> Cédric Le Goater <clg@kaod.org> writes:
>> 
>>> 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.
>>>
>>> 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.
>> 
>> Let's be more clear on what this means, and "This is actually a device
>> modelling fix for these two machines."  Okay?
>
> Well, I guess so. It's a fix in the way we attach network backends to 
> the MACs of the machines. 

Yes, it's that too.

> On the tacoma-bmc, we had to use '-nic <foo> -nic <bar> -nic <good one>' 
> to configure the MAC2 in use by the machine. Which was dubious.

I think you had to use something like

    -nic none -nic none -nic GOOD-ONE -nic none

to get virtual hardware that matches the physical hardware, which I
understand has all four MACs on the die, but only MAC2 connected to the
outside.

In particular, the default configuration (no -nic, -nodefaults, etc.)
got you only MAC0.  With just -nodefaults, you got none at all.

> Now, a single -nic is enough.

Now you get all four MACs regardless of configuration, but only MAC2 can
be connected to a backend, e.g. with a single -nic.

The default configuration (no -nic, -nodefaults, etc.) just works: MAC2
connected to the default network backend.

With just -nodefaults, MAC2 remains unconnected.

This matches how other machines work.

>>> 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>
>> 
>> Here's the "info qom-tree" 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)
>
> Yes. All are realized now.
>
>>          [...]
>>          /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)
>
> Same for the MMI interfaces on AST2600.
>
>> These changes are due to realizing MAC1, MAC2, MAC3.  Looks good.
>> 
>> Here's "info qtree":
>> 
>>        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
>> 
>> Here we can see the network backend now gets connected to MAC2 instead
>> of MAC0.
>
> yes.
>
> With only one nic on the command line, the backend was attached to the 
> first (unused) MAC0 of the machine and now it is attached to the first 
> active MAC2 of the machine.
>
>> 
>> This is without any networking-related options, i.e. we get just the
>> single default network backend.
>> 
>>> ---
>>>
>>>  To be applied on top of patch :
>>>
>>>  "arm/aspeed: Compute the number of CPUs from the SoC definition" 
>>>  http://patchwork.ozlabs.org/project/qemu-devel/patch/20200519091631.1006073-1-clg@kaod.org/
>>>
>>>  Markus, do you mind taking this patch in your QOM series also ?
>> 
>> On the contrary!
>> 
>> I'll work my "info qom-tree" and "info qtree" diffs into the commit
>> message, if you don't mind.
>
> Sure. 

Today, I hope.  Thanks!



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v3] arm/aspeed: Rework NIC attachment
  2020-05-27 12:44 [PATCH v3] arm/aspeed: Rework NIC attachment Cédric Le Goater
  2020-05-27 13:36 ` Markus Armbruster
@ 2020-05-28  7:25 ` Joel Stanley
  1 sibling, 0 replies; 5+ messages in thread
From: Joel Stanley @ 2020-05-28  7:25 UTC (permalink / raw)
  To: Cédric Le Goater
  Cc: Peter Maydell, Andrew Jeffery, Markus Armbruster,
	QEMU Developers, qemu-arm, Philippe Mathieu-Daudé

On Wed, 27 May 2020 at 12:44, Cédric Le Goater <clg@kaod.org> wrote:
>
> 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.
>
> 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.
>
> 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>

This is a good usability improvement, thanks Cédric.

> @@ -680,6 +691,7 @@ static void aspeed_machine_ast2600_evb_class_init(ObjectClass *oc, void *data)
>      amc->fmc_model = "w25q512jv";
>      amc->spi_model = "mx66u51235f";
>      amc->num_cs    = 1;
> +    amc->macs_mask  = ASPEED_MAC1_ON | ASPEED_MAC2_ON | ASPEED_MAC3_ON;

In the future we could enable all four. The A0 silicon had a broken
MAC4 but it is working on A1.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-05-28  7:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-27 12:44 [PATCH v3] arm/aspeed: Rework NIC attachment Cédric Le Goater
2020-05-27 13:36 ` Markus Armbruster
2020-05-27 15:46   ` Cédric Le Goater
2020-05-28  7:12     ` Markus Armbruster
2020-05-28  7:25 ` Joel Stanley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).