From patchwork Fri Oct 10 16:03: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: 398718 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id A9C731400AB for ; Sat, 11 Oct 2014 03:18:22 +1100 (EST) Received: from localhost ([::1]:49547 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XcctY-0005PI-Nr for incoming@patchwork.ozlabs.org; Fri, 10 Oct 2014 12:18:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35075) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xccft-0006zZ-MK for qemu-devel@nongnu.org; Fri, 10 Oct 2014 12:04:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xccfo-000837-Q7 for qemu-devel@nongnu.org; Fri, 10 Oct 2014 12:04:13 -0400 Received: from mail-oi0-f42.google.com ([209.85.218.42]:56395) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xccfo-00082u-L4 for qemu-devel@nongnu.org; Fri, 10 Oct 2014 12:04:08 -0400 Received: by mail-oi0-f42.google.com with SMTP id a141so7143671oig.29 for ; Fri, 10 Oct 2014 09:04:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=Gx/1eeSF4Lw/chFpvjBhUjdIGD1u33YtmTY9623Epjo=; b=G1wIdJ0ELDGTNo0d9CKSyARMbqt5nS5irvleei6Gy0cBW4MO9MkaoxhjDmuevrmyEy WMoGI5Jf+6EAF1vmqrSKMO1eK8O87R1roStk/qVoOsvK+tzFiRyYl2+pW0FAib4j512w yjYu3bpBcG8/rr7UCarHp8NtJshbNvWrrkpHos+JfmTiQ2WWtIhMs9Wz6EZksHaVECrR AKnK3mxFkBFnbOD0JkksUfvvdejs7vQsK58oB1EyOfaXQDJAHhhujYmm+SAo0VXahoF8 FFQkQo5ntiPbKpucXVAIL/sZMDHkSRLlIwkcZKCw+1kr2Sk9uHt2qsHHjEB4J9D5OvcN BhCQ== X-Gm-Message-State: ALoCoQkvsCBcdPUrnUqKVZFkNxH07f3i3RQxvFEK+StTvOcDGiZAII7dTbdpsfBmJNLmWn5CwTMC X-Received: by 10.202.132.17 with SMTP id g17mr1353170oid.119.1412957048301; Fri, 10 Oct 2014 09:04:08 -0700 (PDT) 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 d6sm5382455obt.12.2014.10.10.09.04.07 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 10 Oct 2014 09:04:07 -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: Fri, 10 Oct 2014 11:03:25 -0500 Message-Id: <1412957023-11105-15-git-send-email-greg.bellows@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1412957023-11105-1-git-send-email-greg.bellows@linaro.org> References: <1412957023-11105-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.42 Subject: [Qemu-devel] [PATCH v6 14/32] 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 f709b4a..a831b40 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