[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 05/13] target-arm: Add vexpress machine secure prope
From: |
Greg Bellows |
Subject: |
[Qemu-devel] [PATCH 05/13] target-arm: Add vexpress machine secure property |
Date: |
Wed, 3 Dec 2014 14:05:59 -0600 |
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 <address@hidden>
---
hw/arm/vexpress.c | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c
index 4a38a82..6dc5d3b 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,
};
--
1.8.3.2
- [Qemu-devel] [PATCH 00/13] target-arm: Add CPU security extension enablement, Greg Bellows, 2014/12/03
- [Qemu-devel] [PATCH 05/13] target-arm: Add vexpress machine secure property,
Greg Bellows <=
- [Qemu-devel] [PATCH 06/13] target-arm: Change vexpress daughterboard init arg, Greg Bellows, 2014/12/03
- [Qemu-devel] [PATCH 04/13] target-arm: Add secure qemu machine option, Greg Bellows, 2014/12/03
- Re: [Qemu-devel] [PATCH 04/13] target-arm: Add secure qemu machine option, Peter Maydell, 2014/12/05
- Re: [Qemu-devel] [PATCH 04/13] target-arm: Add secure qemu machine option, Greg Bellows, 2014/12/05
- Re: [Qemu-devel] [PATCH 04/13] target-arm: Add secure qemu machine option, Peter Maydell, 2014/12/05
- Re: [Qemu-devel] [PATCH 04/13] target-arm: Add secure qemu machine option, Marcel Apfelbaum, 2014/12/05
- Re: [Qemu-devel] [PATCH 04/13] target-arm: Add secure qemu machine option, Greg Bellows, 2014/12/05
- Re: [Qemu-devel] [PATCH 04/13] target-arm: Add secure qemu machine option, Marcel Apfelbaum, 2014/12/05
- Re: [Qemu-devel] [PATCH 04/13] target-arm: Add secure qemu machine option, Greg Bellows, 2014/12/05