From patchwork Tue Sep 30 21:49:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Bellows X-Patchwork-Id: 38202 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 61D9E2032C for ; Tue, 30 Sep 2014 22:04:02 +0000 (UTC) Received: by mail-la0-f71.google.com with SMTP id gi9sf6924693lab.6 for ; Tue, 30 Sep 2014 15:04:01 -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=ky26nXdRh5OYsuvXyElvjRlmA+iHLcYExq1DaUyg4FU=; b=GjFEOndtq3RaMhY2JJQmgMB+eSw8YivxxsVLbA192nS1aQubwniT+OtfOulo8JiCH1 O7EpnzZpDMFwOdh5nTMyg7rYP67kTIBNY2BoN8VSzP6kukdIOAiFq2u3lYqbY0UrO/Px SvHudCDSUbJZ0uMp8IWZirgUhQkfeqOkaAbQGI/gfTBy4IXfQLmdzaYCBTuxMaRV328O mO7P7pqUhYH+SIPISRdCWYSg5c75E6OHYJ3ULUnlzX1z8Jflii96TmNgZuJt2h0qKCkp CQjdlk829B6Z4A9vSYqXGeFxVAdAb5vPfwsLZcMwKQsWFkq0LntjVr05gm8+DZPGGvjC fCPg== X-Gm-Message-State: ALoCoQksBwFnTLWNlvrWMMz65EOJpILU6gvsnqXq2Ci8j9sEhcCtxILdaHcRVPwosI2cyz7JZzbu X-Received: by 10.112.157.193 with SMTP id wo1mr50lbb.19.1412114641240; Tue, 30 Sep 2014 15:04:01 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.9.226 with SMTP id d2ls88701lab.66.gmail; Tue, 30 Sep 2014 15:04:01 -0700 (PDT) X-Received: by 10.112.161.234 with SMTP id xv10mr13586786lbb.96.1412114641114; Tue, 30 Sep 2014 15:04:01 -0700 (PDT) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com [209.85.215.43]) by mx.google.com with ESMTPS id pi7si4220424lbb.15.2014.09.30.15.04.01 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 30 Sep 2014 15:04:01 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by mail-la0-f43.google.com with SMTP id gb8so11300790lab.2 for ; Tue, 30 Sep 2014 15:04:01 -0700 (PDT) X-Received: by 10.152.7.73 with SMTP id h9mr18530003laa.27.1412114641010; Tue, 30 Sep 2014 15:04:01 -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.130.169 with SMTP id of9csp430719lbb; Tue, 30 Sep 2014 15:04:00 -0700 (PDT) X-Received: by 10.224.103.194 with SMTP id l2mr17673551qao.93.1412114638733; Tue, 30 Sep 2014 15:03:58 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [208.118.235.17]) by mx.google.com with ESMTPS id p38si20294349qga.126.2014.09.30.15.03.58 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 30 Sep 2014 15:03:58 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; Received: from localhost ([::1]:46640 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XZ5WX-0004zB-SN for patch@linaro.org; Tue, 30 Sep 2014 18:03:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43553) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XZ5Jy-0001EH-Mv for qemu-devel@nongnu.org; Tue, 30 Sep 2014 17:51:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XZ5Jp-00043u-Ts for qemu-devel@nongnu.org; Tue, 30 Sep 2014 17:50:58 -0400 Received: from mail-pa0-f45.google.com ([209.85.220.45]:62135) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XZ5Jp-00041Z-Ct for qemu-devel@nongnu.org; Tue, 30 Sep 2014 17:50:49 -0400 Received: by mail-pa0-f45.google.com with SMTP id rd3so10807464pab.4 for ; Tue, 30 Sep 2014 14:50:37 -0700 (PDT) X-Received: by 10.68.65.99 with SMTP id w3mr23510984pbs.90.1412113837551; Tue, 30 Sep 2014 14:50:37 -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 qy1sm16027662pbc.27.2014.09.30.14.50.36 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 30 Sep 2014 14:50:36 -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: Tue, 30 Sep 2014 16:49:40 -0500 Message-Id: <1412113785-21525-29-git-send-email-greg.bellows@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1412113785-21525-1-git-send-email-greg.bellows@linaro.org> References: <1412113785-21525-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.45 Cc: Greg Bellows Subject: [Qemu-devel] [PATCH v5 28/33] target-arm: make PAR 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.43 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 When EL3 is running in Aarch32 (or ARMv7 with Security Extensions) PAR has a secure and a non-secure instance. Signed-off-by: Fabian Aggeler Signed-off-by: Greg Bellows ------------- v3 -> v4 - Fix par union/structure definition --- target-arm/cpu.h | 10 +++++++++- target-arm/helper.c | 25 ++++++++++++++----------- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/target-arm/cpu.h b/target-arm/cpu.h index 0f70245..4b70530 100644 --- a/target-arm/cpu.h +++ b/target-arm/cpu.h @@ -293,7 +293,15 @@ typedef struct CPUARMState { }; uint64_t far_el[4]; }; - uint64_t par_el1; /* Translation result. */ + union { /* Translation result. */ + struct { + uint64_t par_ns; + uint64_t par_s; + }; + struct { + uint64_t par_el1; + }; + }; uint32_t c9_insn; /* Cache lockdown registers. */ uint32_t c9_data; uint64_t c9_pmcr; /* performance monitor control register */ diff --git a/target-arm/helper.c b/target-arm/helper.c index e29f340..2b0918f 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -1432,7 +1432,7 @@ static void ats_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) * fault. */ } - env->cp15.par_el1 = par64; + A32_BANKED_CURRENT_REG_SET(env, par, par64); } else { /* ret is a DFSR/IFSR value for the short descriptor * translation table format (with WnR always clear). @@ -1442,14 +1442,16 @@ static void ats_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) /* We do not set any attribute bits in the PAR */ if (page_size == (1 << 24) && arm_feature(env, ARM_FEATURE_V7)) { - env->cp15.par_el1 = (phys_addr & 0xff000000) | 1 << 1; + A32_BANKED_CURRENT_REG_SET(env, par, + (phys_addr & 0xff000000) | 1 << 1); } else { - env->cp15.par_el1 = phys_addr & 0xfffff000; + A32_BANKED_CURRENT_REG_SET(env, par, phys_addr & 0xfffff000); } } else { - env->cp15.par_el1 = ((ret & (1 << 10)) >> 5) | - ((ret & (1 << 12)) >> 6) | - ((ret & 0xf) << 1) | 1; + A32_BANKED_CURRENT_REG_SET(env, par, + ((ret & (1 << 10)) >> 5) | + ((ret & (1 << 12)) >> 6) | + ((ret & 0xf) << 1) | 1); } } } @@ -1457,9 +1459,9 @@ static void ats_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) static const ARMCPRegInfo vapa_cp_reginfo[] = { { .name = "PAR", .cp = 15, .crn = 7, .crm = 4, .opc1 = 0, .opc2 = 0, - .access = PL1_RW, .resetvalue = 0, - .fieldoffset = offsetoflow32(CPUARMState, cp15.par_el1), - .writefn = par_write }, + .access = PL1_RW, .resetvalue = 0, .writefn = par_write, + .bank_fieldoffsets = { offsetoflow32(CPUARMState, cp15.par_s), + offsetoflow32(CPUARMState, cp15.par_ns) } }, #ifndef CONFIG_USER_ONLY { .name = "ATS", .cp = 15, .crn = 7, .crm = 8, .opc1 = 0, .opc2 = CP_ANY, .access = PL1_W, .accessfn = ats_access, @@ -1921,8 +1923,9 @@ static const ARMCPRegInfo lpae_cp_reginfo[] = { .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_OVERRIDE, .resetvalue = 0 }, { .name = "PAR", .cp = 15, .crm = 7, .opc1 = 0, - .access = PL1_RW, .type = ARM_CP_64BIT, - .fieldoffset = offsetof(CPUARMState, cp15.par_el1), .resetvalue = 0 }, + .access = PL1_RW, .type = ARM_CP_64BIT, .resetvalue = 0, + .bank_fieldoffsets = { offsetof(CPUARMState, cp15.par_s), + offsetof(CPUARMState, cp15.par_ns)} }, { .name = "TTBR0", .cp = 15, .crm = 2, .opc1 = 0, .access = PL1_RW, .type = ARM_CP_64BIT | ARM_CP_NO_MIGRATE, .bank_fieldoffsets = { offsetof(CPUARMState, cp15.ttbr0_s),