From patchwork Wed Dec 3 20:05:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Bellows X-Patchwork-Id: 41868 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B804025E88 for ; Wed, 3 Dec 2014 20:08:11 +0000 (UTC) Received: by mail-wg0-f70.google.com with SMTP id b13sf10023738wgh.5 for ; Wed, 03 Dec 2014 12:08:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=JAmGP0/09W3yMGqp/jKfelrtJ6sxssPvuiNUYzFfAW4=; b=QQbX+3rHdVtaL/j1wE0c85DgRUsXmOL5LVEo6bI1zT6e6gag/AxNVejqg5kkEVAFtd KM/eepnkUl4NBOqgR1LOzU8/k9oGK+nJU20Pabs88/M7FAWBII+Y+I4U7VNyHE/EV5Gf 4XyhpMt84SMJwmQo/oAIXtwgRaPSah+S9h8ZO76a9yxMMjpALZHsDxxf+2P82SoT10CW xSnIkaJrbXMFQXe43JFTZWhmV0SEXcFTxyVktNJow0A9zhcrHJLmZ1hieaqOLlGZbyg5 NOHrxhaWnMBTs/uAtPwVNTNGTgnOJ+jWErFgt+7MhgJVl32yOyYwKfsl7zn1GyKgZcaY R5NA== X-Gm-Message-State: ALoCoQnApKGf1w+LSMX24L/zbLHpCazIEQcsYsMuDLMaY9JFVdebkdrYkplBdrobHrpwUECnCcQY X-Received: by 10.152.43.50 with SMTP id t18mr4535lal.8.1417637291020; Wed, 03 Dec 2014 12:08:11 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.6.134 with SMTP id b6ls96100laa.27.gmail; Wed, 03 Dec 2014 12:08:10 -0800 (PST) X-Received: by 10.112.169.6 with SMTP id aa6mr6019990lbc.29.1417637290780; Wed, 03 Dec 2014 12:08:10 -0800 (PST) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id uc2si22779291lac.80.2014.12.03.12.08.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Dec 2014 12:08:10 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by mail-la0-f43.google.com with SMTP id ge10so8447558lab.2 for ; Wed, 03 Dec 2014 12:08:10 -0800 (PST) X-Received: by 10.112.38.4 with SMTP id c4mr5996088lbk.46.1417637290711; Wed, 03 Dec 2014 12:08:10 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp730747lbc; Wed, 3 Dec 2014 12:08:10 -0800 (PST) X-Received: by 10.180.91.193 with SMTP id cg1mr21817070wib.26.1417637289198; Wed, 03 Dec 2014 12:08:09 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id hg6si41558348wjc.36.2014.12.03.12.08.08 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 03 Dec 2014 12:08:09 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:43147 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XwGDX-0008V4-PN for patch@linaro.org; Wed, 03 Dec 2014 15:08:07 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54035) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XwGBw-0006mc-BM for qemu-devel@nongnu.org; Wed, 03 Dec 2014 15:06:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XwGBp-0003Uw-Jc for qemu-devel@nongnu.org; Wed, 03 Dec 2014 15:06:28 -0500 Received: from mail-oi0-f54.google.com ([209.85.218.54]:48602) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XwGBp-0003Us-FS for qemu-devel@nongnu.org; Wed, 03 Dec 2014 15:06:21 -0500 Received: by mail-oi0-f54.google.com with SMTP id u20so11319318oif.13 for ; Wed, 03 Dec 2014 12:06:21 -0800 (PST) X-Received: by 10.60.131.202 with SMTP id oo10mr4359732oeb.72.1417637181176; Wed, 03 Dec 2014 12:06:21 -0800 (PST) Received: from gbellows-linaro.bellowshome.net (99-179-1-128.lightspeed.austtx.sbcglobal.net. [99.179.1.128]) by mx.google.com with ESMTPSA id mq4sm11787321obb.22.2014.12.03.12.06.20 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Dec 2014 12:06:20 -0800 (PST) From: Greg Bellows To: qemu-devel@nongnu.org, serge.fdrv@gmail.com, edgar.iglesias@gmail.com, aggelerf@ethz.ch, peter.maydell@linaro.org Date: Wed, 3 Dec 2014 14:05:59 -0600 Message-Id: <1417637167-20640-6-git-send-email-greg.bellows@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1417637167-20640-1-git-send-email-greg.bellows@linaro.org> References: <1417637167-20640-1-git-send-email-greg.bellows@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.218.54 Cc: Greg Bellows Subject: [Qemu-devel] [PATCH 05/13] target-arm: Add vexpress machine secure property X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: greg.bellows@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 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 --- 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, };