mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 02:03:56 -06:00
xlnx-zynqmp: Make the RPU subsystem optional
The way we currently model the RPU subsystem is of quite limited use. In addition to that, it causes problems for KVM and for GDB debugging. Make the RPU optional by adding a has_rpu property and default to having it disabled. This changes the default setup from having the RPU to not longer having it. Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> Reviewed-by: Alistair Francis <alistair.francis@xilinx.com> Message-id: 1464173555-12800-3-git-send-email-edgar.iglesias@gmail.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
37d42473d1
commit
6ed92b14f6
2 changed files with 40 additions and 24 deletions
|
@ -83,6 +83,41 @@ static inline int arm_gic_ppi_index(int cpu_nr, int ppi_index)
|
|||
return GIC_NUM_SPI_INTR + cpu_nr * GIC_INTERNAL + ppi_index;
|
||||
}
|
||||
|
||||
static void xlnx_zynqmp_create_rpu(XlnxZynqMPState *s, const char *boot_cpu,
|
||||
Error **errp)
|
||||
{
|
||||
Error *err = NULL;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < XLNX_ZYNQMP_NUM_RPU_CPUS; i++) {
|
||||
char *name;
|
||||
|
||||
object_initialize(&s->rpu_cpu[i], sizeof(s->rpu_cpu[i]),
|
||||
"cortex-r5-" TYPE_ARM_CPU);
|
||||
object_property_add_child(OBJECT(s), "rpu-cpu[*]",
|
||||
OBJECT(&s->rpu_cpu[i]), &error_abort);
|
||||
|
||||
name = object_get_canonical_path_component(OBJECT(&s->rpu_cpu[i]));
|
||||
if (strcmp(name, boot_cpu)) {
|
||||
/* Secondary CPUs start in PSCI powered-down state */
|
||||
object_property_set_bool(OBJECT(&s->rpu_cpu[i]), true,
|
||||
"start-powered-off", &error_abort);
|
||||
} else {
|
||||
s->boot_cpu_ptr = &s->rpu_cpu[i];
|
||||
}
|
||||
g_free(name);
|
||||
|
||||
object_property_set_bool(OBJECT(&s->rpu_cpu[i]), true, "reset-hivecs",
|
||||
&error_abort);
|
||||
object_property_set_bool(OBJECT(&s->rpu_cpu[i]), true, "realized",
|
||||
&err);
|
||||
if (err) {
|
||||
error_propagate(errp, err);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void xlnx_zynqmp_init(Object *obj)
|
||||
{
|
||||
XlnxZynqMPState *s = XLNX_ZYNQMP(obj);
|
||||
|
@ -95,13 +130,6 @@ static void xlnx_zynqmp_init(Object *obj)
|
|||
&error_abort);
|
||||
}
|
||||
|
||||
for (i = 0; i < XLNX_ZYNQMP_NUM_RPU_CPUS; i++) {
|
||||
object_initialize(&s->rpu_cpu[i], sizeof(s->rpu_cpu[i]),
|
||||
"cortex-r5-" TYPE_ARM_CPU);
|
||||
object_property_add_child(obj, "rpu-cpu[*]", OBJECT(&s->rpu_cpu[i]),
|
||||
&error_abort);
|
||||
}
|
||||
|
||||
object_property_add_link(obj, "ddr-ram", TYPE_MEMORY_REGION,
|
||||
(Object **)&s->ddr_ram,
|
||||
qdev_prop_allow_set_link_before_realize,
|
||||
|
@ -260,23 +288,8 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)
|
|||
qdev_connect_gpio_out(DEVICE(&s->apu_cpu[i]), 1, irq);
|
||||
}
|
||||
|
||||
for (i = 0; i < XLNX_ZYNQMP_NUM_RPU_CPUS; i++) {
|
||||
char *name;
|
||||
|
||||
name = object_get_canonical_path_component(OBJECT(&s->rpu_cpu[i]));
|
||||
if (strcmp(name, boot_cpu)) {
|
||||
/* Secondary CPUs start in PSCI powered-down state */
|
||||
object_property_set_bool(OBJECT(&s->rpu_cpu[i]), true,
|
||||
"start-powered-off", &error_abort);
|
||||
} else {
|
||||
s->boot_cpu_ptr = &s->rpu_cpu[i];
|
||||
}
|
||||
g_free(name);
|
||||
|
||||
object_property_set_bool(OBJECT(&s->rpu_cpu[i]), true, "reset-hivecs",
|
||||
&error_abort);
|
||||
object_property_set_bool(OBJECT(&s->rpu_cpu[i]), true, "realized",
|
||||
&err);
|
||||
if (s->has_rpu) {
|
||||
xlnx_zynqmp_create_rpu(s, boot_cpu, &err);
|
||||
if (err) {
|
||||
error_propagate(errp, err);
|
||||
return;
|
||||
|
@ -373,6 +386,7 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)
|
|||
static Property xlnx_zynqmp_props[] = {
|
||||
DEFINE_PROP_STRING("boot-cpu", XlnxZynqMPState, boot_cpu),
|
||||
DEFINE_PROP_BOOL("secure", XlnxZynqMPState, secure, false),
|
||||
DEFINE_PROP_BOOL("has_rpu", XlnxZynqMPState, has_rpu, false),
|
||||
DEFINE_PROP_END_OF_LIST()
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue