[PATCH v5 14/22] hw/arm/aspeed: Introduce 'bus-label' property for AST1700 SoC

Kane Chen via qemu development posted 22 patches 2 weeks, 6 days ago
Maintainers: "Cédric Le Goater" <clg@kaod.org>, Peter Maydell <peter.maydell@linaro.org>, Steven Lee <steven_lee@aspeedtech.com>, Troy Lee <leetroy@gmail.com>, Jamin Lin <jamin_lin@aspeedtech.com>, Andrew Jeffery <andrew@codeconstruct.com.au>, Joel Stanley <joel@jms.id.au>
There is a newer version of this series
[PATCH v5 14/22] hw/arm/aspeed: Introduce 'bus-label' property for AST1700 SoC
Posted by Kane Chen via qemu development 2 weeks, 6 days ago
From: Kane-Chen-AS <kane_chen@aspeedtech.com>

The AST2700 SoC can be integrated with multiple AST1700 IO expanders.
Without unique identifiers, the I2C bus object names for the primary
BMC SoC and multiple expander chips may collide in the QOM
(QEMU Object Model) tree.

To resolve this, introduce a bus-label property to the AST1700 SoC.
This allows the parent SoC (AST2700) to assign a unique prefix
(e.g., "ioexp0", "ioexp1") to each AST1700 instance. These labels
ensure that the bus naming hierarchy remains distinct and traceable
across different expanders.

Signed-off-by: Kane-Chen-AS <kane_chen@aspeedtech.com>
---
 include/hw/arm/aspeed_ast1700.h | 1 +
 hw/arm/aspeed_ast1700.c         | 1 +
 hw/arm/aspeed_ast27x0.c         | 3 +++
 3 files changed, 5 insertions(+)

diff --git a/include/hw/arm/aspeed_ast1700.h b/include/hw/arm/aspeed_ast1700.h
index 63cfcb4c24..d364203175 100644
--- a/include/hw/arm/aspeed_ast1700.h
+++ b/include/hw/arm/aspeed_ast1700.h
@@ -27,6 +27,7 @@ struct AspeedAST1700SoCState {
     MemoryRegion *dram_mr;
     uint8_t board_idx;
     uint32_t silicon_rev;
+    char *bus_label;
 
     AspeedLTPIState ltpi;
     SerialMM uart;
diff --git a/hw/arm/aspeed_ast1700.c b/hw/arm/aspeed_ast1700.c
index c7eaf583e2..0f2d2c381d 100644
--- a/hw/arm/aspeed_ast1700.c
+++ b/hw/arm/aspeed_ast1700.c
@@ -156,6 +156,7 @@ static void aspeed_ast1700_instance_init(Object *obj)
 static const Property aspeed_ast1700_props[] = {
     DEFINE_PROP_UINT8("board-idx", AspeedAST1700SoCState, board_idx, 0),
     DEFINE_PROP_UINT32("silicon-rev", AspeedAST1700SoCState, silicon_rev, 0),
+    DEFINE_PROP_STRING("bus-label", AspeedAST1700SoCState, bus_label),
     DEFINE_PROP_LINK("dram", AspeedAST1700SoCState, dram_mr,
                      TYPE_MEMORY_REGION, MemoryRegion *),
 };
diff --git a/hw/arm/aspeed_ast27x0.c b/hw/arm/aspeed_ast27x0.c
index 58977e2fa3..b4b5afe6d3 100644
--- a/hw/arm/aspeed_ast27x0.c
+++ b/hw/arm/aspeed_ast27x0.c
@@ -503,11 +503,14 @@ static void aspeed_soc_ast2700_init(Object *obj)
     }
 
     for (i = 0; i < sc->ioexp_num; i++) {
+        g_autofree char *bus_label = g_strdup_printf("ioexp%d", i);
         /* AST1700 IOEXP */
         object_initialize_child(obj, "ioexp[*]", &s->ioexp[i],
                                 TYPE_ASPEED_AST1700);
         qdev_prop_set_uint32(DEVICE(&s->ioexp[i]), "silicon-rev",
                              sc->silicon_rev);
+        qdev_prop_set_string(DEVICE(&s->ioexp[i]), "bus-label",
+                             bus_label);
     }
 
     object_initialize_child(obj, "dpmcu", &s->dpmcu,
-- 
2.43.0
Re: [PATCH v5 14/22] hw/arm/aspeed: Introduce 'bus-label' property for AST1700 SoC
Posted by Cédric Le Goater 2 weeks ago
On 1/20/26 06:18, Kane Chen via wrote:
> From: Kane-Chen-AS <kane_chen@aspeedtech.com>
> 
> The AST2700 SoC can be integrated with multiple AST1700 IO expanders.
> Without unique identifiers, the I2C bus object names for the primary
> BMC SoC and multiple expander chips may collide in the QOM
> (QEMU Object Model) tree.
> 
> To resolve this, introduce a bus-label property to the AST1700 SoC.
> This allows the parent SoC (AST2700) to assign a unique prefix
> (e.g., "ioexp0", "ioexp1") to each AST1700 instance. These labels
> ensure that the bus naming hierarchy remains distinct and traceable
> across different expanders.
> 
> Signed-off-by: Kane-Chen-AS <kane_chen@aspeedtech.com>
> ---
>   include/hw/arm/aspeed_ast1700.h | 1 +
>   hw/arm/aspeed_ast1700.c         | 1 +
>   hw/arm/aspeed_ast27x0.c         | 3 +++
>   3 files changed, 5 insertions(+)
I don't think this change is needed.

Setting the AspeedI2CState "bus-label" property in aspeed_ast1700_realize()
should be sufficient.

Thanks,

C.
RE: [PATCH v5 14/22] hw/arm/aspeed: Introduce 'bus-label' property for AST1700 SoC
Posted by Kane Chen 2 weeks ago
> -----Original Message-----
> From: Cédric Le Goater <clg@kaod.org>
> Sent: Monday, January 26, 2026 4:45 PM
> To: Kane Chen <kane_chen@aspeedtech.com>; Peter Maydell
> <peter.maydell@linaro.org>; Steven Lee <steven_lee@aspeedtech.com>; Troy
> Lee <leetroy@gmail.com>; Jamin Lin <jamin_lin@aspeedtech.com>; Andrew
> Jeffery <andrew@codeconstruct.com.au>; Joel Stanley <joel@jms.id.au>;
> open list:ASPEED BMCs <qemu-arm@nongnu.org>; open list:All patches CC
> here <qemu-devel@nongnu.org>
> Cc: Troy Lee <troy_lee@aspeedtech.com>
> Subject: Re: [PATCH v5 14/22] hw/arm/aspeed: Introduce 'bus-label' property
> for AST1700 SoC
> 
> On 1/20/26 06:18, Kane Chen via wrote:
> > From: Kane-Chen-AS <kane_chen@aspeedtech.com>
> >
> > The AST2700 SoC can be integrated with multiple AST1700 IO expanders.
> > Without unique identifiers, the I2C bus object names for the primary
> > BMC SoC and multiple expander chips may collide in the QOM (QEMU
> > Object Model) tree.
> >
> > To resolve this, introduce a bus-label property to the AST1700 SoC.
> > This allows the parent SoC (AST2700) to assign a unique prefix (e.g.,
> > "ioexp0", "ioexp1") to each AST1700 instance. These labels ensure that
> > the bus naming hierarchy remains distinct and traceable across
> > different expanders.
> >
> > Signed-off-by: Kane-Chen-AS <kane_chen@aspeedtech.com>
> > ---
> >   include/hw/arm/aspeed_ast1700.h | 1 +
> >   hw/arm/aspeed_ast1700.c         | 1 +
> >   hw/arm/aspeed_ast27x0.c         | 3 +++
> >   3 files changed, 5 insertions(+)
> I don't think this change is needed.
> 
> Setting the AspeedI2CState "bus-label" property in aspeed_ast1700_realize()
> should be sufficient.
> 
> Thanks,
> 
> C.

Hi Cédric,

Understood. I will drop this change in the next patch series.
Thanks.

Best Regards,
Kane