From patchwork Thu Oct 30 21:28:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Bellows X-Patchwork-Id: 39967 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 29B532405B for ; Fri, 31 Oct 2014 19:05:25 +0000 (UTC) Received: by mail-la0-f70.google.com with SMTP id ge10sf4501897lab.5 for ; Fri, 31 Oct 2014 12:05:24 -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=+oVsOtGwHgkVGAfKY3hb/OIhvQL4QxKwzTGOhCN0lWo=; b=J6vnAYE7r4nO4ButZ0pAvQljNVHsOaRy59PiLKyiRq8R5RmU330mlx/Lb8ygVSq8R+ /bYkPhuXjib7vB+wfSO86rcJf2GCs+U08Lb+6K+RXUNJOKPKiRzVK2u809fry3dcpgk2 X/CIZd7idZAjVWNWpyy0M0bxMWPrlVXZI/9e1FD5efBXNn+ZezJlQnVHC67uLifpKbB3 np8jChgaXqr1/w/5TqE3tA3iXNpFayqtYEcy/WgmI0fHmFWRopVa5vQp0bu4ER16U0gl 0Pva7N6z/vlZgDau7emRooGTuzUlxkaf5tfhf0McfoYy/wKHltcYQfz4ZEQxed3fbHZa uiHg== X-Gm-Message-State: ALoCoQmV/8Icvg09PAmdn29PBj5UxT6OLk5VrLTkTtn2QbMUXnVJc6Dt7wYjc/ljuZFHqSKdttxY X-Received: by 10.112.140.132 with SMTP id rg4mr676616lbb.12.1414782323934; Fri, 31 Oct 2014 12:05:23 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.38 with SMTP id n6ls470714laj.86.gmail; Fri, 31 Oct 2014 12:05:23 -0700 (PDT) X-Received: by 10.112.54.162 with SMTP id k2mr28463401lbp.63.1414782323783; Fri, 31 Oct 2014 12:05:23 -0700 (PDT) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com. [209.85.217.181]) by mx.google.com with ESMTPS id jt11si18205478lab.123.2014.10.31.12.05.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 31 Oct 2014 12:05:23 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.181 as permitted sender) client-ip=209.85.217.181; Received: by mail-lb0-f181.google.com with SMTP id w7so6441851lbi.40 for ; Fri, 31 Oct 2014 12:05:23 -0700 (PDT) X-Received: by 10.112.14.69 with SMTP id n5mr28514471lbc.34.1414782323633; Fri, 31 Oct 2014 12:05:23 -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 c5csp247439lbz; Fri, 31 Oct 2014 12:05:22 -0700 (PDT) X-Received: by 10.140.81.21 with SMTP id e21mr37729115qgd.45.1414782322093; Fri, 31 Oct 2014 12:05:22 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id l6si18483654qat.90.2014.10.31.12.05.21 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 31 Oct 2014 12:05:22 -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]:41426 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XkHVh-0003KV-63 for patch@linaro.org; Fri, 31 Oct 2014 15:05:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45984) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XkE62-00086a-9X for qemu-devel@nongnu.org; Fri, 31 Oct 2014 11:27:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XjxHr-0005FX-Dh for qemu-devel@nongnu.org; Thu, 30 Oct 2014 17:29:48 -0400 Received: from mail-pd0-f178.google.com ([209.85.192.178]:42519) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XjxHr-0005Eb-4v for qemu-devel@nongnu.org; Thu, 30 Oct 2014 17:29:43 -0400 Received: by mail-pd0-f178.google.com with SMTP id fp1so5964707pdb.9 for ; Thu, 30 Oct 2014 14:29:42 -0700 (PDT) X-Received: by 10.70.137.42 with SMTP id qf10mr20222713pdb.100.1414704582477; Thu, 30 Oct 2014 14:29:42 -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.41 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 30 Oct 2014 14:29:41 -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:54 -0500 Message-Id: <1414704538-17103-24-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.178 Cc: greg.bellows@linaro.org Subject: [Qemu-devel] [PATCH v8 23/27] 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.217.181 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 --- v5 -> v6 - Changed _el field variants to be array based 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 10985d4..3c6ff4a 100644 --- a/target-arm/cpu.h +++ b/target-arm/cpu.h @@ -288,7 +288,15 @@ typedef struct CPUARMState { }; uint64_t far_el[4]; }; - uint64_t par_el1; /* Translation result. */ + union { /* Translation result. */ + struct { + uint64_t _unused_par_0; + uint64_t par_ns; + uint64_t _unused_par_1; + uint64_t par_s; + }; + uint64_t par_el[4]; + }; 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 c4d0db4..ec957fb 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -1419,7 +1419,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). @@ -1429,14 +1429,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); } } } @@ -1444,9 +1446,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, @@ -1902,8 +1904,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),