From patchwork Thu Oct 30 21:28:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Bellows X-Patchwork-Id: 39924 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 491B32405B for ; Fri, 31 Oct 2014 15:57:49 +0000 (UTC) Received: by mail-la0-f71.google.com with SMTP id gq15sf4295921lab.10 for ; Fri, 31 Oct 2014 08:57:48 -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=xjzMwmM3hx2I4xrQYg8fzhI/TIntTgUHLW22ooMX6Mw=; b=OUpeT0BNoDXUNXPOXsqklOEZEuhMIrLrcTO0o5s/vm0onNiRDDwcykGVyDpxxAXqse Uv6fGQRY+P9zXwL1v7f9k3QX8RENMNr8lzqIBDgtV7QWThacKQtqdYlPstylUCY467tu yCdlKbwAQ4jEysdlQe/DpbhYMtpODUWje6zv99UNYJqwe5ZSQqmibhDUJndrFxnb4VOO FLNZj/Se1HiK2Mz9s5BUH5PohA5F5vr+2nK5SYBCmrCY/OWze1RBwH4q31lvIcfzyzV2 4QZci6Al648w1olmEhLGtI3yg6TnAzd1gnm1AlIfxbqL108sx7LQQBmlAYWuJj+4+7Cy auJw== X-Gm-Message-State: ALoCoQk28R+Jykbr3nzCKAEbRrFI7m9+P12Ihe43WoX3FW2GmwlTMN6p+3dH72cO8oZmdmuNrCGk X-Received: by 10.181.29.105 with SMTP id jv9mr788558wid.1.1414771068079; Fri, 31 Oct 2014 08:57:48 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.115.207 with SMTP id jq15ls554792lab.49.gmail; Fri, 31 Oct 2014 08:57:47 -0700 (PDT) X-Received: by 10.152.87.98 with SMTP id w2mr26949362laz.27.1414771067431; Fri, 31 Oct 2014 08:57:47 -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 a4si17359155lbm.77.2014.10.31.08.57.47 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 31 Oct 2014 08:57:47 -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 n15so6364523lbi.17 for ; Fri, 31 Oct 2014 08:57:47 -0700 (PDT) X-Received: by 10.152.5.38 with SMTP id p6mr27039151lap.44.1414771067226; Fri, 31 Oct 2014 08:57:47 -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 c5csp224102lbz; Fri, 31 Oct 2014 08:57:46 -0700 (PDT) X-Received: by 10.224.128.201 with SMTP id l9mr39381057qas.1.1414771065733; Fri, 31 Oct 2014 08:57:45 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 94si17633166qgk.104.2014.10.31.08.57.43 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 31 Oct 2014 08:57:44 -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]:38542 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XkEa7-00065h-A4 for patch@linaro.org; Fri, 31 Oct 2014 11:57:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38845) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XkE64-0006vX-TJ for qemu-devel@nongnu.org; Fri, 31 Oct 2014 11:28:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XjxHf-00050S-Gg for qemu-devel@nongnu.org; Thu, 30 Oct 2014 17:29:36 -0400 Received: from mail-pd0-f176.google.com ([209.85.192.176]:54005) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XjxHf-0004zY-BH for qemu-devel@nongnu.org; Thu, 30 Oct 2014 17:29:31 -0400 Received: by mail-pd0-f176.google.com with SMTP id ft15so5915134pdb.21 for ; Thu, 30 Oct 2014 14:29:30 -0700 (PDT) X-Received: by 10.68.110.161 with SMTP id ib1mr19885182pbb.109.1414704570749; Thu, 30 Oct 2014 14:29:30 -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 o5sm8017713pdr.50.2014.10.30.14.29.29 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 30 Oct 2014 14:29:30 -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: Thu, 30 Oct 2014 16:28:46 -0500 Message-Id: <1414704538-17103-16-git-send-email-greg.bellows@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1414704538-17103-1-git-send-email-greg.bellows@linaro.org> References: <1414704538-17103-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.176 Cc: greg.bellows@linaro.org Subject: [Qemu-devel] [PATCH v8 15/27] 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.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 Rename CSSELR (cache size selection register) and add secure instance (AArch32). Signed-off-by: Fabian Aggeler Signed-off-by: Greg Bellows --- 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 8acc2b0..3b776a1 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 03e6b62..f6a9b66 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, + ARM_CP_SECSTATE_TEST(ri, 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: */