hw/arm/xlnx-versal: reconnect the CRL to the other devices

The CRL connects to various devices through link properties to be able
to reset them. The connections were dropped during the SoC refactoring.
Reintroduce them now.

Rely on the QOM tree to retrieve the devices to connect. The component
parts of the device names are chosen to match the properties on the CRL.

Signed-off-by: Luc Michel <luc.michel@amd.com>
Reviewed-by: Francisco Iglesias <francisco.iglesias@amd.com>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@amd.com>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20250926070806.292065-34-luc.michel@amd.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Luc Michel
2025-10-07 10:35:36 +01:00
committed by Peter Maydell
parent ff789d1556
commit 9401022bcd
+30 -1
View File
@@ -1476,17 +1476,46 @@ static void versal_create_cfu(Versal *s, const struct VersalCfuMap *map)
sysbus_mmio_get_region(sbd, 0));
}
static inline void crl_connect_dev(Object *crl, Object *dev)
{
const char *prop = object_get_canonical_path_component(dev);
/* The component part of the device path matches the CRL property name */
object_property_set_link(crl, prop, dev, &error_abort);
}
static inline void crl_connect_dev_by_name(Versal *s, Object *crl,
const char *name, size_t num)
{
size_t i;
for (i = 0; i < num; i++) {
Object *dev = versal_get_child_idx(s, name, i);
crl_connect_dev(crl, dev);
}
}
static inline void versal_create_crl(Versal *s)
{
const VersalMap *map;
const char *crl_class;
DeviceState *dev;
Object *obj;
map = versal_get_map(s);
crl_class = TYPE_XLNX_VERSAL_CRL;
dev = qdev_new(crl_class);
object_property_add_child(OBJECT(s), "crl", OBJECT(dev));
obj = OBJECT(dev);
object_property_add_child(OBJECT(s), "crl", obj);
crl_connect_dev_by_name(s, obj, "rpu-cluster/rpu",
map->rpu.num_cluster * map->rpu.num_core);
crl_connect_dev_by_name(s, obj, map->zdma[0].name, map->zdma[0].num_chan);
crl_connect_dev_by_name(s, obj, "uart", map->num_uart);
crl_connect_dev_by_name(s, obj, "gem", map->num_gem);
crl_connect_dev_by_name(s, obj, "usb", map->num_usb);
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_abort);