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: 398719 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 112DC14009E for ; Sat, 11 Oct 2014 03:20:04 +1100 (EST) Received: from localhost ([::1]:49575 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XccvB-0008Nk-Vy for incoming@patchwork.ozlabs.org; Fri, 10 Oct 2014 12:20:01 -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-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=blz+z2w21UpFecDb3HoJ6JY7IYyEBWgLPMOb3zcAauk=; b=bJGa6HS/Rj9IPt40nDicB1jCf+8Sksl3D5uOiGWRIVzG1FVbvlORQPVxKsKMe6z7hI ESv5BfzC0Ek75xKrJscMWPzaMDSwGxWIye5mIpZ8nRojU1mK0WxwyfGmcjeAhbhhQud1 1jc7ShTPXLqQsjt96qSPyuA+Dnxz3KFJkve7Ze5/vJUh9L3aDdEWNIJV9uqsIHWp6vGe cCy1OT45VxLINcKLTVXVZWF+88rcHmkYDQq6AjIqIvz0kXTSbOLdUC/Dp7SmLr8fXJvY K2AGYRIARci3VUcOaP+Oar83CY/JuQjxQYJ8GkgRPmKHHtYIx3PCN+K6cKjomktl7LiA eQZg== X-Gm-Message-State: ALoCoQmy9CqhhJKtpFSj9aZM0CaobRyrXmnt2Fb5fPyEc01uYRZtbqNaq2w1lJH+rQLP/8hyDxrx 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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: */