aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Bellows <greg.bellows@linaro.org>2014-12-01 14:25:31 -0600
committerGreg Bellows <greg.bellows@linaro.org>2014-12-03 10:34:10 -0600
commitd34182115132cf00c038e5697d829089af656753 (patch)
tree5a534104cdb58af483fe5101ed43b127764f1d7b
parentbd139d58c1777b87be25e07e1d2a8f1d2ded8580 (diff)
target-arm: Add vexpress machine secure property
Add "secure" Vexpress machine specific property to allow override of the default secure state configuration. By default, when using the QEMU -kernel command line argument, Vexpress machines boot into NS/SVC. When using the QEMU -bios command line argument, Vexpress machines boot into S/SVC. The secure state can be changed from the default specifying the secure state as a machine property. For example, the below command line would enable secure state on a -linux boot: aarch64-softmmu/qemu-system-aarch64 -machine type=vexpress-a15,secure=on -kernel ... Signed-off-by: Greg Bellows <greg.bellows@linaro.org>
-rw-r--r--hw/arm/vexpress.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c
index 4a38a822c..6dc5d3b2d 100644
--- a/hw/arm/vexpress.c
+++ b/hw/arm/vexpress.c
@@ -164,6 +164,7 @@ typedef struct {
typedef struct {
MachineState parent;
+ bool secure;
} VexpressMachineState;
#define TYPE_VEXPRESS_MACHINE "vexpress"
@@ -701,6 +702,41 @@ static void vexpress_common_init(MachineState *machine)
arm_load_kernel(ARM_CPU(first_cpu), &daughterboard->bootinfo);
}
+static bool vexpress_get_secure(Object *obj, Error **errp)
+{
+ VexpressMachineState *vms = VEXPRESS_MACHINE(obj);
+
+ return vms->secure;
+}
+
+static void vexpress_set_secure(Object *obj, bool value, Error **errp)
+{
+ VexpressMachineState *vms = VEXPRESS_MACHINE(obj);
+
+ vms->secure = value;
+}
+
+static void vexpress_instance_init(Object *obj)
+{
+ VexpressMachineState *vms = VEXPRESS_MACHINE(obj);
+
+ /* All Vexpress machine instances have a secure property
+ * Determine whether to start in a secure state or non-secure state based
+ * on whether we are directly booting a kernel ("-kernel" option). If we
+ * are, then we default to booting into non-secure state. Otherwise, we
+ * default to the machine default which is secure EL1/SVC.
+ * This may be overridden by the "secure" machine property.
+ */
+ if (qemu_opt_get(qemu_get_machine_opts(), "kernel")) {
+ vms->secure = false;
+ } else {
+ vms->secure = true;
+ }
+
+ object_property_add_bool(obj, "secure", vexpress_get_secure,
+ vexpress_set_secure, NULL);
+}
+
static void vexpress_class_init(ObjectClass *oc, void *data)
{
MachineClass *mc = MACHINE_CLASS(oc);
@@ -738,6 +774,7 @@ static const TypeInfo vexpress_info = {
.name = TYPE_VEXPRESS_MACHINE,
.parent = TYPE_MACHINE,
.instance_size = sizeof(VexpressMachineState),
+ .instance_init = vexpress_instance_init,
.class_size = sizeof(VexpressMachineClass),
.class_init = vexpress_class_init,
};