From patchwork Fri Oct 10 16:03:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Bellows X-Patchwork-Id: 38617 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E6651205D8 for ; Fri, 10 Oct 2014 16:20:35 +0000 (UTC) Received: by mail-lb0-f200.google.com with SMTP id b6sf2244350lbj.11 for ; Fri, 10 Oct 2014 09:20:29 -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: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=blz+z2w21UpFecDb3HoJ6JY7IYyEBWgLPMOb3zcAauk=; b=iYrMLnX9kzXfsQIShjJxLC4jRyEmpKWSRC/+2vS1vn6sWq+qGYw8+cbqjkw2D+Hzo5 xNB86jXhAT0cq6hanomYxLh21bIzJ+L+BgXGN6dLo83/rAzrDGjv+EjKqc45NtEEXEg5 knuIvIJ97BcMXEYDci/HEDliRXzeAhnvjyEyYGkhoGayl5lKTRcfmhojlfGlg2OWjSFv 5POluQvppwHZZQUtL9m0RlWISHRZyOirDzt+0kbHoLTasmQlI7BYwkywqR/nnQut5vox 9ArFNNLciIvl7nkXWTX+TU9Ghaxd+1cBxu2lonZKxnouG9T+WxnZCKWWyGv8u7uZzWyL 1GdA== X-Gm-Message-State: ALoCoQlNDNxfYTFrlYeHyr/esptN7+wjGALPaLlq1eiuUzh5Exr1Yr4N2IHs2yf+lLXX0gmM1xsQ X-Received: by 10.180.188.52 with SMTP id fx20mr1249683wic.3.1412958029218; Fri, 10 Oct 2014 09:20:29 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.43.200 with SMTP id y8ls300507lal.93.gmail; Fri, 10 Oct 2014 09:20:29 -0700 (PDT) X-Received: by 10.112.72.38 with SMTP id a6mr5779368lbv.65.1412958029063; Fri, 10 Oct 2014 09:20:29 -0700 (PDT) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com [209.85.217.177]) by mx.google.com with ESMTPS id 7si9986775lar.88.2014.10.10.09.20.27 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 10 Oct 2014 09:20:27 -0700 (PDT) Received-SPF: temperror (google.com: error in processing during lookup of patch+caf_=patchwork-forward=linaro.org@linaro.org: DNS timeout) client-ip=209.85.217.177; Received: by mail-lb0-f177.google.com with SMTP id w7so3332022lbi.8 for ; Fri, 10 Oct 2014 09:20:27 -0700 (PDT) X-Received: by 10.152.19.195 with SMTP id h3mr5929854lae.71.1412958026878; Fri, 10 Oct 2014 09:20:26 -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.84.229 with SMTP id c5csp458814lbz; Fri, 10 Oct 2014 09:20:26 -0700 (PDT) X-Received: by 10.224.171.67 with SMTP id g3mr10507795qaz.102.1412958025359; Fri, 10 Oct 2014 09:20:25 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id n69si11843023qga.24.2014.10.10.09.20.24 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 10 Oct 2014 09:20:25 -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]:49575 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XccvY-0008Nk-BO for patch@linaro.org; Fri, 10 Oct 2014 12:20:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35215) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xccg2-0007Gf-HE for qemu-devel@nongnu.org; Fri, 10 Oct 2014 12:04:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xccfv-00086r-Rc for qemu-devel@nongnu.org; Fri, 10 Oct 2014 12:04:22 -0400 Received: from mail-oi0-f50.google.com ([209.85.218.50]:57994) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xccfv-00086h-NL for qemu-devel@nongnu.org; Fri, 10 Oct 2014 12:04:15 -0400 Received: by mail-oi0-f50.google.com with SMTP id i138so7090757oig.23 for ; Fri, 10 Oct 2014 09:04:15 -0700 (PDT) X-Received: by 10.202.171.194 with SMTP id u185mr5300990oie.24.1412957055390; Fri, 10 Oct 2014 09:04:15 -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.14 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 10 Oct 2014 09:04:14 -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:32 -0500 Message-Id: <1412957023-11105-22-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.50 Subject: [Qemu-devel] [PATCH v6 21/32] 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=temperror (google.com: error in processing during lookup of patch+caf_=patchwork-forward=linaro.org@linaro.org: DNS timeout) 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 ========== 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 | 16 ++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/target-arm/cpu.h b/target-arm/cpu.h index 5cf58f4..a8c299c 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 25d4240..55d961e 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -789,7 +789,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, + ARM_CP_SECSTATE_TEST(ri, ARM_CP_SECSTATE_S)); + + return cpu->ccsidr[index]; } static void csselr_write(CPUARMState *env, const ARMCPRegInfo *ri, @@ -915,9 +922,10 @@ static const ARMCPRegInfo v7_cp_reginfo[] = { .opc0 = 3, .crn = 0, .crm = 0, .opc1 = 1, .opc2 = 0, .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 }, + .cp = 15, .crn = 0, .crm = 0, .opc1 = 2, .opc2 = 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: */