From patchwork Wed Nov 5 23:23:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Bellows X-Patchwork-Id: 40238 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f72.google.com (mail-ee0-f72.google.com [74.125.83.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 993BC240A6 for ; Wed, 5 Nov 2014 23:32:43 +0000 (UTC) Received: by mail-ee0-f72.google.com with SMTP id d17sf1474622eek.3 for ; Wed, 05 Nov 2014 15:32:42 -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=DI8HNXTJ0ZEFeejo83aXbmuJE9hdoSIsYuqtHcAOCQM=; b=H+cHK0ow1LXhVInzxoJzGYwzK4GlOPztho2s1yFY9DPNCM1yMI8HNsnmSH2mgZI/qO CdJ1nUjGm2nVQQJqIM/dDy2WfEROTQj4g9ytbQHATNDSyVFL8E8kT2lUE7/yVPbdWnud +nBS09hFqwtwc/uHA7s7lQIEB5EFdJFL6uyIZ2vMW7UXHf2uCLz9p0TDgIofxkdYjiZW od7I5BJCtB1ov+M/hWCd+TWGkSucE7zrI01UdMeF/7TZFNyLPRWxoEAQBKU/jMVt/XBY 1eusxklWpxAQLXEh3+h2S5lBH+yYl7pwkvSl/nqpn4oPv29OL+tJ8LV8tNT5BH6b7YxD +gSQ== X-Gm-Message-State: ALoCoQlLdYTekFcJ5mtHw4+bcV1iUcB8NhZnP2Z4/8RbXjVNsDT+hoOpJrGOl091z5sCqRwlnMy2 X-Received: by 10.152.7.73 with SMTP id h9mr19333laa.6.1415230362815; Wed, 05 Nov 2014 15:32:42 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.21.200 with SMTP id x8ls9965lae.76.gmail; Wed, 05 Nov 2014 15:32:42 -0800 (PST) X-Received: by 10.112.125.33 with SMTP id mn1mr475529lbb.99.1415230362198; Wed, 05 Nov 2014 15:32:42 -0800 (PST) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id nb4si8819085lbb.35.2014.11.05.15.32.42 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 05 Nov 2014 15:32:42 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by mail-lb0-f169.google.com with SMTP id 10so1593769lbg.28 for ; Wed, 05 Nov 2014 15:32:42 -0800 (PST) X-Received: by 10.112.14.69 with SMTP id n5mr691689lbc.34.1415230361976; Wed, 05 Nov 2014 15:32:41 -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 ew9csp372099lbc; Wed, 5 Nov 2014 15:32:41 -0800 (PST) X-Received: by 10.140.104.200 with SMTP id a66mr861882qgf.37.1415230360623; Wed, 05 Nov 2014 15:32:40 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id s2si9065641qar.44.2014.11.05.15.32.40 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 05 Nov 2014 15:32:40 -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]:49029 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XmA47-0002kH-Pm for patch@linaro.org; Wed, 05 Nov 2014 18:32:39 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56433) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xm9va-0004T3-N1 for qemu-devel@nongnu.org; Wed, 05 Nov 2014 18:23:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xm9vV-0004fM-Cy for qemu-devel@nongnu.org; Wed, 05 Nov 2014 18:23:50 -0500 Received: from mail-pa0-f51.google.com ([209.85.220.51]:38267) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xm9vV-0004fF-7T for qemu-devel@nongnu.org; Wed, 05 Nov 2014 18:23:45 -0500 Received: by mail-pa0-f51.google.com with SMTP id kq14so1752116pab.38 for ; Wed, 05 Nov 2014 15:23:44 -0800 (PST) X-Received: by 10.68.227.104 with SMTP id rz8mr622400pbc.4.1415229824613; Wed, 05 Nov 2014 15:23:44 -0800 (PST) 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 r4sm4086349pdm.93.2014.11.05.15.23.43 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 05 Nov 2014 15:23:44 -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, 5 Nov 2014 17:23:02 -0600 Message-Id: <1415229793-3278-16-git-send-email-greg.bellows@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1415229793-3278-1-git-send-email-greg.bellows@linaro.org> References: <1415229793-3278-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.220.51 Cc: greg.bellows@linaro.org Subject: [Qemu-devel] [PATCH v9 15/26] target-arm: make CSSELR banked 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.169 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 Rename CSSELR (cache size selection register) and add secure instance (AArch32). Signed-off-by: Fabian Aggeler Signed-off-by: Greg Bellows Reviewed-by: Peter Maydell --- v8 -> v9 - Replaced call to ARM_CP_SECSTATE_TEST with direct access v7 -> v8 - Fix CSSELR CP register definition to use .opc0 rather than .cp. v5 -> v6 - Changed _el field variants to be array based - Switch to use distinct CPREG secure flags. - Merged CSSELR and CSSELR_EL1 reginfo entries v4 -> v5 - Changed to use the CCSIDR cpreg bank flag to select the csselr bank instead of the A32_BANKED macro. This more accurately uses the secure state bank matching the CCSIDR. --- target-arm/cpu.h | 10 +++++++++- target-arm/helper.c | 14 +++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/target-arm/cpu.h b/target-arm/cpu.h index 9dc711b..6996f7c 100644 --- a/target-arm/cpu.h +++ b/target-arm/cpu.h @@ -177,7 +177,15 @@ typedef struct CPUARMState { /* System control coprocessor (cp15) */ struct { uint32_t c0_cpuid; - uint64_t c0_cssel; /* Cache size selection. */ + union { /* Cache size selection */ + struct { + uint64_t _unused_csselr0; + uint64_t csselr_ns; + uint64_t _unused_csselr1; + uint64_t csselr_s; + }; + uint64_t csselr_el[4]; + }; union { /* System control register. */ struct { uint64_t _unused_sctlr; diff --git a/target-arm/helper.c b/target-arm/helper.c index 1091e0b..6f48291 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -776,7 +776,14 @@ static void scr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) static uint64_t ccsidr_read(CPUARMState *env, const ARMCPRegInfo *ri) { ARMCPU *cpu = arm_env_get_cpu(env); - return cpu->ccsidr[env->cp15.c0_cssel]; + + /* Acquire the CSSELR index from the bank corresponding to the CCSIDR + * bank + */ + uint32_t index = A32_BANKED_REG_GET(env, csselr, + ri->secure & ARM_CP_SECSTATE_S); + + return cpu->ccsidr[index]; } static void csselr_write(CPUARMState *env, const ARMCPRegInfo *ri, @@ -903,8 +910,9 @@ static const ARMCPRegInfo v7_cp_reginfo[] = { .access = PL1_R, .readfn = ccsidr_read, .type = ARM_CP_NO_MIGRATE }, { .name = "CSSELR", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .crn = 0, .crm = 0, .opc1 = 2, .opc2 = 0, - .access = PL1_RW, .fieldoffset = offsetof(CPUARMState, cp15.c0_cssel), - .writefn = csselr_write, .resetvalue = 0 }, + .access = PL1_RW, .writefn = csselr_write, .resetvalue = 0, + .bank_fieldoffsets = { offsetof(CPUARMState, cp15.csselr_s), + offsetof(CPUARMState, cp15.csselr_ns) } }, /* Auxiliary ID register: this actually has an IMPDEF value but for now * just RAZ for all cores: */