From patchwork Thu Nov 6 15:51: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: 40343 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DE25620C4E for ; Thu, 6 Nov 2014 16:02:23 +0000 (UTC) Received: by mail-wg0-f71.google.com with SMTP id b13sf833979wgh.6 for ; Thu, 06 Nov 2014 08:02:23 -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=sKGlq3+v/hUNHzrUahwiPYKWy5mkJ6ZiHYae02UYIyQ=; b=L5/bG4id+t3lS8IZH5/mlEtRDGwoxG2qvTb43hpZ6MlieRxaCM9YdWDmEHvksOD7NN r4ZSabyRRRPThceTCie3zpyjRPcG3keiBAIzqwapAJAR82fHVuka4DXQCpGcXtM1UWn4 wESy8w5EQ9qIRSC+zj05SceB+zqk9mJGsmd6cvTRuiIKkbbOo4Rb6onahuLdkJZ7MlqQ XDpsHBybNWceAXogfpMbEdmnKGurYnN/G7n9m8H5zUN+0jMeU8MFos8U4hAcR6pEV3cc dnghxXLxbUSQO9g2UxrlcfkAkDnwH8M3tfjf+GfbnIaOAxEj/8EcAjSX+KZTFeDzDfpI r13w== X-Gm-Message-State: ALoCoQn2nZf44Dp5wdIOwLNktvmn9HdSLQl2PWHWmb9q1y4s9GGlAzqHFzfLvbG6rmgNlI/ld6Yb X-Received: by 10.152.36.135 with SMTP id q7mr266780laj.8.1415289743036; Thu, 06 Nov 2014 08:02:23 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.4.5 with SMTP id ca5ls80880lad.68.gmail; Thu, 06 Nov 2014 08:02:22 -0800 (PST) X-Received: by 10.112.239.12 with SMTP id vo12mr5782725lbc.81.1415289742895; Thu, 06 Nov 2014 08:02:22 -0800 (PST) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com. [209.85.215.45]) by mx.google.com with ESMTPS id rs4si12035533lbb.12.2014.11.06.08.02.22 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 06 Nov 2014 08:02:22 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by mail-la0-f45.google.com with SMTP id pn19so2869254lab.32 for ; Thu, 06 Nov 2014 08:02:22 -0800 (PST) X-Received: by 10.112.52.37 with SMTP id q5mr5858825lbo.32.1415289742793; Thu, 06 Nov 2014 08:02:22 -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 ew9csp66748lbc; Thu, 6 Nov 2014 08:02:21 -0800 (PST) X-Received: by 10.140.105.164 with SMTP id c33mr7595573qgf.11.1415289741223; Thu, 06 Nov 2014 08:02:21 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id k10si12404047qae.72.2014.11.06.08.02.20 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 06 Nov 2014 08:02:21 -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]:54645 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XmPVs-0001e0-DF for patch@linaro.org; Thu, 06 Nov 2014 11:02:20 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36820) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XmPLt-00027f-TU for qemu-devel@nongnu.org; Thu, 06 Nov 2014 10:52:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XmPLo-0004LO-9z for qemu-devel@nongnu.org; Thu, 06 Nov 2014 10:52:01 -0500 Received: from mail-pa0-f48.google.com ([209.85.220.48]:55935) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XmPLo-0004LB-44 for qemu-devel@nongnu.org; Thu, 06 Nov 2014 10:51:56 -0500 Received: by mail-pa0-f48.google.com with SMTP id ey11so1489239pad.21 for ; Thu, 06 Nov 2014 07:51:55 -0800 (PST) X-Received: by 10.68.131.133 with SMTP id om5mr5154199pbb.41.1415289115494; Thu, 06 Nov 2014 07:51:55 -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 z9sm6245585pdp.73.2014.11.06.07.51.53 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 06 Nov 2014 07:51:54 -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: Thu, 6 Nov 2014 09:51:02 -0600 Message-Id: <1415289073-14681-16-git-send-email-greg.bellows@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1415289073-14681-1-git-send-email-greg.bellows@linaro.org> References: <1415289073-14681-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.48 Cc: greg.bellows@linaro.org Subject: [Qemu-devel] [PATCH v10 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.215.45 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 1c8691f..67f319f 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 9186fc7..5377480 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: */