aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlistair Francis <alistair.francis@xilinx.com>2017-09-14 18:43:18 +0100
committerPeter Maydell <peter.maydell@linaro.org>2017-09-14 18:43:18 +0100
commit1946809ece906d517e96fdcb0b39c5e63916fb5a (patch)
treebfc8b80473f5789741ab834a1cb0bdadbc02c83e
parentb7436e94ded250b92aaa03bd72eab2279aba197b (diff)
xlnx-zcu102: Add a machine level virtualization property
Add a machine level virtualization property. This defaults to false and can be set to true using this machine command line argument: -machine xlnx-zcu102,virtualization=on This follows what the ARM virt machine does. This property only applies to the ZCU102 machine. The EP108 machine does not have this property. Signed-off-by: Alistair Francis <alistair.francis@xilinx.com> Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--hw/arm/xlnx-zcu102.c30
-rw-r--r--hw/arm/xlnx-zynqmp.c3
-rw-r--r--include/hw/arm/xlnx-zynqmp.h2
3 files changed, 33 insertions, 2 deletions
diff --git a/hw/arm/xlnx-zcu102.c b/hw/arm/xlnx-zcu102.c
index bd573c4695..42deefd6d4 100644
--- a/hw/arm/xlnx-zcu102.c
+++ b/hw/arm/xlnx-zcu102.c
@@ -32,6 +32,7 @@ typedef struct XlnxZCU102 {
MemoryRegion ddr_ram;
bool secure;
+ bool virt;
} XlnxZCU102;
#define TYPE_ZCU102_MACHINE MACHINE_TYPE_NAME("xlnx-zcu102")
@@ -58,6 +59,20 @@ static void zcu102_set_secure(Object *obj, bool value, Error **errp)
s->secure = value;
}
+static bool zcu102_get_virt(Object *obj, Error **errp)
+{
+ XlnxZCU102 *s = ZCU102_MACHINE(obj);
+
+ return s->virt;
+}
+
+static void zcu102_set_virt(Object *obj, bool value, Error **errp)
+{
+ XlnxZCU102 *s = ZCU102_MACHINE(obj);
+
+ s->virt = value;
+}
+
static void xlnx_zynqmp_init(XlnxZCU102 *s, MachineState *machine)
{
int i;
@@ -87,6 +102,8 @@ static void xlnx_zynqmp_init(XlnxZCU102 *s, MachineState *machine)
"ddr-ram", &error_abort);
object_property_set_bool(OBJECT(&s->soc), s->secure, "secure",
&error_fatal);
+ object_property_set_bool(OBJECT(&s->soc), s->virt, "virtualization",
+ &error_fatal);
object_property_set_bool(OBJECT(&s->soc), true, "realized", &error_fatal);
@@ -154,8 +171,9 @@ static void xlnx_ep108_machine_instance_init(Object *obj)
{
XlnxZCU102 *s = EP108_MACHINE(obj);
- /* EP108, we don't support setting secure */
+ /* EP108, we don't support setting secure or virt */
s->secure = false;
+ s->virt = false;
}
static void xlnx_ep108_machine_class_init(ObjectClass *oc, void *data)
@@ -201,6 +219,16 @@ static void xlnx_zcu102_machine_instance_init(Object *obj)
"Set on/off to enable/disable the ARM "
"Security Extensions (TrustZone)",
NULL);
+
+ /* Default to virt (EL2) being disabled */
+ s->virt = false;
+ object_property_add_bool(obj, "virtualization", zcu102_get_virt,
+ zcu102_set_virt, NULL);
+ object_property_set_description(obj, "virtualization",
+ "Set on/off to enable/disable emulating a "
+ "guest CPU which implements the ARM "
+ "Virtualization Extensions",
+ NULL);
}
static void xlnx_zcu102_machine_class_init(ObjectClass *oc, void *data)
diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c
index 22c2a33719..2b27daf51d 100644
--- a/hw/arm/xlnx-zynqmp.c
+++ b/hw/arm/xlnx-zynqmp.c
@@ -255,7 +255,7 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)
object_property_set_bool(OBJECT(&s->apu_cpu[i]),
s->secure, "has_el3", NULL);
object_property_set_bool(OBJECT(&s->apu_cpu[i]),
- false, "has_el2", NULL);
+ s->virt, "has_el2", NULL);
object_property_set_int(OBJECT(&s->apu_cpu[i]), GIC_BASE_ADDR,
"reset-cbar", &error_abort);
object_property_set_bool(OBJECT(&s->apu_cpu[i]), true, "realized",
@@ -427,6 +427,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("virtualization", XlnxZynqMPState, virt, false),
DEFINE_PROP_BOOL("has_rpu", XlnxZynqMPState, has_rpu, false),
DEFINE_PROP_LINK("ddr-ram", XlnxZynqMPState, ddr_ram, TYPE_MEMORY_REGION,
MemoryRegion *),
diff --git a/include/hw/arm/xlnx-zynqmp.h b/include/hw/arm/xlnx-zynqmp.h
index c2931bf39c..6eff81a995 100644
--- a/include/hw/arm/xlnx-zynqmp.h
+++ b/include/hw/arm/xlnx-zynqmp.h
@@ -91,6 +91,8 @@ typedef struct XlnxZynqMPState {
/* Has the ARM Security extensions? */
bool secure;
+ /* Has the ARM Virtualization extensions? */
+ bool virt;
/* Has the RPU subsystem? */
bool has_rpu;
} XlnxZynqMPState;