From patchwork Mon Jun 30 23:09:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Bellows X-Patchwork-Id: 32832 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f200.google.com (mail-pd0-f200.google.com [209.85.192.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 57D2D203F4 for ; Tue, 1 Jul 2014 00:44:57 +0000 (UTC) Received: by mail-pd0-f200.google.com with SMTP id v10sf43060381pde.7 for ; Mon, 30 Jun 2014 17:44:56 -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=BQVfRhPahpp9CTJITEOJlm95uRhp1tTVDef86dsHh+c=; b=PV8DGhxn0y3gF9WkSdpjqtLdQXHL+dBe6QkjxjPU/jjVCYEK2XYZWBgsJjg8sP78VG GftAkI94JpQxcnuhSgKjS0BqwCYzLWMzke8jqB5BuWL/f67Pko7a0eVhuB4Vchpetz8s 9BZZSY9dNOkTzhVhJ/Y5MbFSODX4bw48Ubx2966CURbgSfBP4RqdlLfbWAb4MEmcgdgr QPQnPRDmedm6D59+dEo4Kib/3Twf6fm3e4TlQWx2TEvwG0h7BU0V2WHG/TeiFiCqzo7f bgQNdzMwwwGlaNQX5h+bc/vMAmEufhK4wOGNrsubipSPbINf7VzGQ9ssKMo6bBi6S8nO jpoQ== X-Gm-Message-State: ALoCoQmPnXZ11RjlzbZ8TII6qQp4JVJiUct7EGBijmy9DJVHoGq752ZQPAGQ3f2GgnU3zCJCVpbz X-Received: by 10.66.232.229 with SMTP id tr5mr25083424pac.16.1404175496610; Mon, 30 Jun 2014 17:44:56 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.51.132 with SMTP id u4ls1808052qga.36.gmail; Mon, 30 Jun 2014 17:44:56 -0700 (PDT) X-Received: by 10.220.203.134 with SMTP id fi6mr31259432vcb.18.1404175496486; Mon, 30 Jun 2014 17:44:56 -0700 (PDT) Received: from mail-ve0-f179.google.com (mail-ve0-f179.google.com [209.85.128.179]) by mx.google.com with ESMTPS id ab3si10789456vec.46.2014.06.30.17.44.56 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 30 Jun 2014 17:44:56 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.179 as permitted sender) client-ip=209.85.128.179; Received: by mail-ve0-f179.google.com with SMTP id sa20so9010909veb.10 for ; Mon, 30 Jun 2014 17:44:56 -0700 (PDT) X-Received: by 10.220.69.72 with SMTP id y8mr41302494vci.21.1404175496403; Mon, 30 Jun 2014 17:44:56 -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.221.37.5 with SMTP id tc5csp178994vcb; Mon, 30 Jun 2014 17:44:56 -0700 (PDT) X-Received: by 10.229.127.9 with SMTP id e9mr64439429qcs.5.1404175495907; Mon, 30 Jun 2014 17:44:55 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 9si8289265qak.12.2014.06.30.17.44.55 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 30 Jun 2014 17:44:55 -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]:37701 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1mBr-0000Qv-JT for patch@linaro.org; Mon, 30 Jun 2014 20:44:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54119) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1kjU-0006oG-Ok for qemu-devel@nongnu.org; Mon, 30 Jun 2014 19:11:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X1kjP-0003uw-HR for qemu-devel@nongnu.org; Mon, 30 Jun 2014 19:11:32 -0400 Received: from mail-ob0-f182.google.com ([209.85.214.182]:60491) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1kjP-0003uh-BV for qemu-devel@nongnu.org; Mon, 30 Jun 2014 19:11:27 -0400 Received: by mail-ob0-f182.google.com with SMTP id nu7so9794412obb.27 for ; Mon, 30 Jun 2014 16:11:27 -0700 (PDT) X-Received: by 10.60.162.68 with SMTP id xy4mr12082336oeb.68.1404169887045; Mon, 30 Jun 2014 16:11:27 -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 cu7sm76370192oec.12.2014.06.30.16.11.24 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 30 Jun 2014 16:11:26 -0700 (PDT) From: greg.bellows@linaro.org To: qemu-devel@nongnu.org Date: Mon, 30 Jun 2014 18:09:30 -0500 Message-Id: <1404169773-20264-31-git-send-email-greg.bellows@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1404169773-20264-1-git-send-email-greg.bellows@linaro.org> References: <1404169773-20264-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.214.182 Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com, Fabian Aggeler , Greg Bellows , serge.fdrv@gmail.com, edgar.iglesias@gmail.com, christoffer.dall@linaro.org Subject: [Qemu-devel] [PATCH v4 30/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.128.179 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 Signed-off-by: Greg Bellows --- 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 f29bcaa..d5cad97 100644 --- a/target-arm/cpu.h +++ b/target-arm/cpu.h @@ -294,7 +294,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; uint32_t c9_pmcr; /* performance monitor control register */ diff --git a/target-arm/helper.c b/target-arm/helper.c index 3cc6d42..1178a79 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -1281,7 +1281,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). @@ -1291,14 +1291,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); } } } @@ -1306,9 +1308,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, @@ -1766,8 +1768,9 @@ static const ARMCPRegInfo lpae_cp_reginfo[] = { { .name = "DBGDSAR", .cp = 14, .crm = 2, .opc1 = 0, .access = PL0_R, .type = ARM_CP_CONST|ARM_CP_64BIT, .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),