On Wed, 2026-10-28 at 14:30 +1000, Portia Stephens wrote:
> In preparation for adding the RCPU, put the Ascalon harts in a
> CPUCluster. This will allow gdb to properly handle CPUs of different
> types.
> 
> Signed-off-by: Portia Stephens <[email protected]>

- [MEDIUM] In hw/riscv/tt_atlantis.c, TYPE_TT_ASCALON_CLUSTER never
sets
  dc->user_creatable = false (unlike the sibling SoC class in the same
  file), so device_add riscv.tt-ascalon-cluster realizes the device
with
  cpu-type NULL and tt_ascalon_cluster_realize turns the NULL
  object_property_set_str with &error_abort into a host process abort.
  Add dc->user_creatable = false in tt_ascalon_cluster_class_init; the
  type was introduced by an earlier patch in this series, so the guard
  best belongs there.

Alistair

> ---
>  hw/riscv/Kconfig               |  1 +
>  hw/riscv/tt_atlantis.c         | 13 ++++++++++++-
>  include/hw/riscv/tt_atlantis.h |  2 ++
>  3 files changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/riscv/Kconfig b/hw/riscv/Kconfig
> index d89fdfcc86..4eccfa443e 100644
> --- a/hw/riscv/Kconfig
> +++ b/hw/riscv/Kconfig
> @@ -149,6 +149,7 @@ config TENSTORRENT
>      select DESIGNWARE_I2C
>      select DS1338
>      select TMP105
> +    select CPU_CLUSTER
>  
>  config XIANGSHAN_KUNMINGHU
>      bool
> diff --git a/hw/riscv/tt_atlantis.c b/hw/riscv/tt_atlantis.c
> index 9b37e845da..587c6ea733 100644
> --- a/hw/riscv/tt_atlantis.c
> +++ b/hw/riscv/tt_atlantis.c
> @@ -50,6 +50,8 @@ QEMU_BUILD_BUG_ON(TT_IMSIC_STRIDE != (0x1000 <<
> TT_IMSIC_GUEST_BITS));
>  #define TT_ACLINT_MTIMECMP      0x8000
>  #define TT_ACLINT_TIMEBASE_FREQ 1000000000
>  
> +#define ASCALON_CLUSTER_ID     0
> +
>  static const MemMapEntry tt_atlantis_memmap[] = {
>      /* Keep sorted with :'<,'>!sort -g -k 4 */
>      [TT_ATL_DDR_LO] =           { 0x00000000,    0x80000000 },
> @@ -551,7 +553,10 @@ static void tt_ascalon_cluster_init(Object *obj)
>  {
>      TTAscalonClusterState *ac = TT_ASCALON_CLUSTER(obj);
>  
> -    object_initialize_child(obj, "cpus", &ac->cpus,
> TYPE_RISCV_HART_ARRAY);
> +    object_initialize_child(obj, "tt-ascalon.cluster", &ac->cluster,
> +                            TYPE_CPU_CLUSTER);
> +    object_initialize_child(OBJECT(&ac->cluster), "cpus", &ac->cpus,
> +                            TYPE_RISCV_HART_ARRAY);
>  }
>  
>  static void tt_ascalon_cluster_realize(DeviceState *dev, Error
> **errp)
> @@ -589,6 +594,12 @@ static void
> tt_ascalon_cluster_realize(DeviceState *dev, Error **errp)
>      if (!sysbus_realize(SYS_BUS_DEVICE(&ac->cpus), errp)) {
>          return;
>      }
> +
> +    qdev_prop_set_uint32(DEVICE(&ac->cluster), "cluster-id",
> ASCALON_CLUSTER_ID);
> +    /* cluster must be realized after the hart array */
> +    if (!qdev_realize(DEVICE(&ac->cluster), NULL, errp)) {
> +        return;
> +    }
>  }
>  
>  static const Property tt_ascalon_cluster_props[] = {
> diff --git a/include/hw/riscv/tt_atlantis.h
> b/include/hw/riscv/tt_atlantis.h
> index 52b44504ae..e5fce1f675 100644
> --- a/include/hw/riscv/tt_atlantis.h
> +++ b/include/hw/riscv/tt_atlantis.h
> @@ -15,6 +15,7 @@
>  #include "hw/intc/riscv_imsic.h"
>  #include "hw/misc/tt_atlantis_prcm.h"
>  #include "hw/char/dw8250.h"
> +#include "hw/cpu/cluster.h"
>  #include "hw/riscv/riscv_hart.h"
>  
>  #define TYPE_TT_ATLANTIS_MACHINE MACHINE_TYPE_NAME("tt-atlantis")
> @@ -40,6 +41,7 @@ struct TTAscalonClusterState {
>      MemoryRegion memory;
>  
>      RISCVHartArrayState cpus;
> +    CPUClusterState cluster;
>      MemoryRegion bootrom;
>  
>      uint32_t num_harts;

Reply via email to