From patchwork Tue Sep 30 21:49:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Bellows X-Patchwork-Id: 38187 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 262D02032C for ; Tue, 30 Sep 2014 21:54:15 +0000 (UTC) Received: by mail-lb0-f198.google.com with SMTP id b6sf1059212lbj.5 for ; Tue, 30 Sep 2014 14:54:13 -0700 (PDT) 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=sDaftSc1jeIBfb0nV0mg4BfezkZ9yeOJqAZoKHrQDFM=; b=g8vkLbLWGBNiIWRZad9qTfifxvbjSvZTFAwMeenkhMO6fTg2/BX7MgCLvc1oa+unAo q94f5lo+0ibNvYjxqIVzu2T6LKP+9ZSyfW4YSYc+O1NRWoxWQszzUl9yZftjFrYpEVIN 63Czrkhbg3Wb2hmZLUOEJQR2Z2tsVDblKnSiRbB6E1GfomyRtndf2Bo0RTrfc5BbpAYp GKy9unOUQYe6yVJBlG/NvQwO8Dnl6RQXefCczvQtHPVqVfdFEO09iOj4lywxyiMpZLMM 1RfiGoGbiK/GLn1bIrVskGZvLkqammEFKPNbjlaUGVqI7JvgSuX3d+/APquXu7Kn8EP/ v2RA== X-Gm-Message-State: ALoCoQlKONkpTfNQHVOvu21svowxkCdeQKnV78X41AAU4ZDoRgWXZtiMAVdeRH+0HPrvJEZJAPRJ X-Received: by 10.112.189.69 with SMTP id gg5mr812189lbc.14.1412114053907; Tue, 30 Sep 2014 14:54:13 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.234.233 with SMTP id uh9ls95672lac.70.gmail; Tue, 30 Sep 2014 14:54:13 -0700 (PDT) X-Received: by 10.152.197.35 with SMTP id ir3mr21049019lac.82.1412114053765; Tue, 30 Sep 2014 14:54:13 -0700 (PDT) Received: from mail-lb0-f172.google.com (mail-lb0-f172.google.com [209.85.217.172]) by mx.google.com with ESMTPS id kf3si24536900lbc.68.2014.09.30.14.54.13 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 30 Sep 2014 14:54:13 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.172 as permitted sender) client-ip=209.85.217.172; Received: by mail-lb0-f172.google.com with SMTP id b6so5463346lbj.3 for ; Tue, 30 Sep 2014 14:54:13 -0700 (PDT) X-Received: by 10.112.163.103 with SMTP id yh7mr47556758lbb.73.1412114053700; Tue, 30 Sep 2014 14:54:13 -0700 (PDT) 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.130.169 with SMTP id of9csp429495lbb; Tue, 30 Sep 2014 14:54:13 -0700 (PDT) X-Received: by 10.194.94.165 with SMTP id dd5mr55553691wjb.75.1412114053149; Tue, 30 Sep 2014 14:54:13 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id bv11si18125169wib.47.2014.09.30.14.54.11 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 30 Sep 2014 14:54:13 -0700 (PDT) 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]:46560 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XZ5N0-0005ZM-D5 for patch@linaro.org; Tue, 30 Sep 2014 17:54:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43164) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XZ5JN-0000b2-6G for qemu-devel@nongnu.org; Tue, 30 Sep 2014 17:50:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XZ5JI-0003r1-BE for qemu-devel@nongnu.org; Tue, 30 Sep 2014 17:50:21 -0400 Received: from mail-pd0-f170.google.com ([209.85.192.170]:37740) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XZ5JG-0003pB-9l for qemu-devel@nongnu.org; Tue, 30 Sep 2014 17:50:16 -0400 Received: by mail-pd0-f170.google.com with SMTP id ft15so4315837pdb.29 for ; Tue, 30 Sep 2014 14:50:13 -0700 (PDT) X-Received: by 10.70.90.101 with SMTP id bv5mr90954548pdb.0.1412113813709; Tue, 30 Sep 2014 14:50:13 -0700 (PDT) Received: from gbellows-linaro.qualcomm.com (rrcs-67-52-129-61.west.biz.rr.com. [67.52.129.61]) by mx.google.com with ESMTPSA id qy1sm16027662pbc.27.2014.09.30.14.50.12 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 30 Sep 2014 14:50:13 -0700 (PDT) From: Greg Bellows To: qemu-devel@nongnu.org, peter.maydell@linaro.org, serge.fdrv@gmail.com, edgar.iglesias@gmail.com, aggelerf@ethz.ch Date: Tue, 30 Sep 2014 16:49:25 -0500 Message-Id: <1412113785-21525-14-git-send-email-greg.bellows@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1412113785-21525-1-git-send-email-greg.bellows@linaro.org> References: <1412113785-21525-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.192.170 Cc: Sergey Fedorov , Greg Bellows Subject: [Qemu-devel] [PATCH v5 13/33] target-arm: move Aarch32 SCR into security reglist 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.217.172 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 From: Fabian Aggeler Define a new ARM CP register info list for the ARMv7 Security Extension feature. Register that list only for ARM cores with Security Extension/EL3 support. Moving Aarch32 SCR into Security Extension register group. Signed-off-by: Sergey Fedorov Signed-off-by: Fabian Aggeler Signed-off-by: Greg Bellows ------------------ v4 -> v5 - Added reset value on SCR_EL3 - Squashed SCR Migration fix (previously patch 33) This patch adds code to mark duplicate CP register registrations as NO_MIGRATE to avoid duplicate migrations. v3 -> v4 - Renamed security_cp_reginfo to v7_el3_cp_reginfo - Conditionalized define on whether v7 or v8 were enabled Signed-off-by: Greg Bellows --- target-arm/helper.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/target-arm/helper.c b/target-arm/helper.c index a0f53dd..cb2eb3c 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -898,9 +898,6 @@ static const ARMCPRegInfo v7_cp_reginfo[] = { .access = PL1_RW, .writefn = vbar_write, .fieldoffset = offsetof(CPUARMState, cp15.vbar_el[1]), .resetvalue = 0 }, - { .name = "SCR", .cp = 15, .crn = 1, .crm = 1, .opc1 = 0, .opc2 = 0, - .access = PL1_RW, .fieldoffset = offsetoflow32(CPUARMState, cp15.scr_el3), - .resetvalue = 0, .writefn = scr_write }, { .name = "CCSIDR", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .crn = 0, .crm = 0, .opc1 = 1, .opc2 = 0, .access = PL1_R, .readfn = ccsidr_read, .type = ARM_CP_NO_MIGRATE }, @@ -2335,11 +2332,21 @@ static const ARMCPRegInfo v8_el3_cp_reginfo[] = { .access = PL3_RW, .writefn = vbar_write, .fieldoffset = offsetof(CPUARMState, cp15.vbar_el[3]), .resetvalue = 0 }, - { .name = "SCR_EL3", .state = ARM_CP_STATE_AA64, - .type = ARM_CP_NO_MIGRATE, + /* SCR will always be registered for v7, but not necessarily for v8, so + * this entry is marked to allow migration to be handled by the v7 + * registration instance. + */ + { .name = "SCR_EL3", .state = ARM_CP_STATE_AA64, .type = ARM_CP_NO_MIGRATE, .opc0 = 3, .opc1 = 6, .crn = 1, .crm = 1, .opc2 = 0, .access = PL3_RW, .fieldoffset = offsetof(CPUARMState, cp15.scr_el3), - .writefn = scr_write }, + .resetvalue = 0, .writefn = scr_write }, + REGINFO_SENTINEL +}; + +static const ARMCPRegInfo v7_el3_cp_reginfo[] = { + { .name = "SCR", .cp = 15, .crn = 1, .crm = 1, .opc1 = 0, .opc2 = 0, + .access = PL3_RW, .fieldoffset = offsetof(CPUARMState, cp15.scr_el3), + .resetvalue = 0, .writefn = scr_write}, REGINFO_SENTINEL }; @@ -2960,7 +2967,12 @@ void register_cp_regs_for_features(ARMCPU *cpu) } } if (arm_feature(env, ARM_FEATURE_EL3)) { - define_arm_cp_regs(cpu, v8_el3_cp_reginfo); + if (arm_feature(env, ARM_FEATURE_V8)) { + define_arm_cp_regs(cpu, v8_el3_cp_reginfo); + } + if (arm_feature(env, ARM_FEATURE_V7)) { + define_arm_cp_regs(cpu, v7_el3_cp_reginfo); + } } if (arm_feature(env, ARM_FEATURE_MPU)) { /* These are the MPU registers prior to PMSAv6. Any new