From patchwork Thu Nov 6 15:51:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Bellows X-Patchwork-Id: 40351 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 EAA8320C4E for ; Thu, 6 Nov 2014 16:06:38 +0000 (UTC) Received: by mail-la0-f70.google.com with SMTP id ge10sf1969452lab.1 for ; Thu, 06 Nov 2014 08:06:37 -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=DywKlWGeRhN4f7Exa3zsB1u/BF59KlhTgWsGSUkCfZk=; b=jK18SeyZOD5P6T5m4q7QQSNY+jSF+0sxc1eo45b+5dZkZR2SEdTkgz3mfLP3xmDNtb 5tYZ/BvIpsIQWAZFagB9e8iCMY/Xfj5XzhiwPxz5HIpJ39G/dZcHnFmR8e6bUAretHJ6 TlvE1w+/+JWkPSM0OBBG1uZM3sn052hnC206y069UkJaYb397cup9aDMgZ53gxU3fTPO blnonOT6n5k+zZIP6lRRAqBxDGFJj8P8LRajhjXfa2PmIW+6fzIrjTyPVdkxfrqRB/4p V79xUe3cOkQ2Lk+fp9fHzsJ3UB4zTZk5hVZRUc0W/R8/VZgc0eSKJ+atAkTD+VJobMEU r2EA== X-Gm-Message-State: ALoCoQmP8L7RxVGZeIzvxKWi11iZt+g1lXJHQs6I4cA1Yn6RCt+abV6CdhtKlC5lzqPrbuK1rE9N X-Received: by 10.194.178.163 with SMTP id cz3mr900167wjc.1.1415289997856; Thu, 06 Nov 2014 08:06:37 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.203.167 with SMTP id kr7ls97787lac.94.gmail; Thu, 06 Nov 2014 08:06:37 -0800 (PST) X-Received: by 10.152.7.229 with SMTP id m5mr5991644laa.32.1415289997423; Thu, 06 Nov 2014 08:06:37 -0800 (PST) Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com. [209.85.217.180]) by mx.google.com with ESMTPS id a4si11893463lbm.77.2014.11.06.08.06.37 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 06 Nov 2014 08:06:37 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 as permitted sender) client-ip=209.85.217.180; Received: by mail-lb0-f180.google.com with SMTP id u10so1130977lbd.25 for ; Thu, 06 Nov 2014 08:06:37 -0800 (PST) X-Received: by 10.152.120.199 with SMTP id le7mr5685314lab.67.1415289997272; Thu, 06 Nov 2014 08:06:37 -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 ew9csp67498lbc; Thu, 6 Nov 2014 08:06:36 -0800 (PST) X-Received: by 10.140.40.239 with SMTP id x102mr7555879qgx.69.1415289995679; Thu, 06 Nov 2014 08:06:35 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id cz6si12465644qcb.41.2014.11.06.08.06.34 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 06 Nov 2014 08:06:35 -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]:54688 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XmPZy-0000MW-Ha for patch@linaro.org; Thu, 06 Nov 2014 11:06:34 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37003) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XmPMF-0002la-JX for qemu-devel@nongnu.org; Thu, 06 Nov 2014 10:52:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XmPM9-0004Rh-Mr for qemu-devel@nongnu.org; Thu, 06 Nov 2014 10:52:23 -0500 Received: from mail-pa0-f44.google.com ([209.85.220.44]:43331) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XmPM9-0004RU-IB for qemu-devel@nongnu.org; Thu, 06 Nov 2014 10:52:17 -0500 Received: by mail-pa0-f44.google.com with SMTP id bj1so1509985pad.3 for ; Thu, 06 Nov 2014 07:52:17 -0800 (PST) X-Received: by 10.68.192.1 with SMTP id hc1mr5057250pbc.87.1415289136955; Thu, 06 Nov 2014 07:52:16 -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.52.14 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 06 Nov 2014 07:52:16 -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:12 -0600 Message-Id: <1415289073-14681-26-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.44 Cc: greg.bellows@linaro.org Subject: [Qemu-devel] [PATCH v10 25/26] target-arm: make MAIR0/1 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.180 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 Added CP register info entries for the ARMv7 MAIR0/1 secure banks. Signed-off-by: Greg Bellows Reviewed-by: Peter Maydell --- v8 -> v9 - Added endianness support to the MAIR field structure definition. v5 -> v6 - Changed _el field variants to be array based --- target-arm/cpu.h | 21 ++++++++++++++++++++- target-arm/helper.c | 12 +++++++++--- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/target-arm/cpu.h b/target-arm/cpu.h index dd0dee0..7960a3a 100644 --- a/target-arm/cpu.h +++ b/target-arm/cpu.h @@ -296,7 +296,26 @@ typedef struct CPUARMState { uint32_t c9_pmxevtyper; /* perf monitor event type */ uint32_t c9_pmuserenr; /* perf monitor user enable */ uint32_t c9_pminten; /* perf monitor interrupt enables */ - uint64_t mair_el1; + union { /* Memory attribute redirection */ + struct { +#ifdef HOST_WORDS_BIGENDIAN + uint64_t _unused_mair_0; + uint32_t mair1_ns; + uint32_t mair0_ns; + uint64_t _unused_mair_1; + uint32_t mair1_s; + uint32_t mair0_s; +#else + uint64_t _unused_mair_0; + uint32_t mair0_ns; + uint32_t mair1_ns; + uint64_t _unused_mair_1; + uint32_t mair0_s; + uint32_t mair1_s; +#endif + }; + uint64_t mair_el[4]; + }; union { /* vector base address register */ struct { uint64_t _unused_vbar; diff --git a/target-arm/helper.c b/target-arm/helper.c index 0b5330d..9faecca 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -965,20 +965,26 @@ static const ARMCPRegInfo v7_cp_reginfo[] = { */ { .name = "MAIR_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .crn = 10, .crm = 2, .opc2 = 0, - .access = PL1_RW, .fieldoffset = offsetof(CPUARMState, cp15.mair_el1), + .access = PL1_RW, .fieldoffset = offsetof(CPUARMState, cp15.mair_el[1]), .resetvalue = 0 }, /* For non-long-descriptor page tables these are PRRR and NMRR; * regardless they still act as reads-as-written for QEMU. * The override is necessary because of the overly-broad TLB_LOCKDOWN * definition. */ + /* MAIR0/1 are defined seperately from their 64-bit counterpart which + * allows them to assign the correct fieldoffset based on the endianness + * handled in the field definitions. + */ { .name = "MAIR0", .state = ARM_CP_STATE_AA32, .type = ARM_CP_OVERRIDE, .cp = 15, .opc1 = 0, .crn = 10, .crm = 2, .opc2 = 0, .access = PL1_RW, - .fieldoffset = offsetoflow32(CPUARMState, cp15.mair_el1), + .bank_fieldoffsets = { offsetof(CPUARMState, cp15.mair0_s), + offsetof(CPUARMState, cp15.mair0_ns) }, .resetfn = arm_cp_reset_ignore }, { .name = "MAIR1", .state = ARM_CP_STATE_AA32, .type = ARM_CP_OVERRIDE, .cp = 15, .opc1 = 0, .crn = 10, .crm = 2, .opc2 = 1, .access = PL1_RW, - .fieldoffset = offsetofhigh32(CPUARMState, cp15.mair_el1), + .bank_fieldoffsets = { offsetof(CPUARMState, cp15.mair1_s), + offsetof(CPUARMState, cp15.mair1_ns) }, .resetfn = arm_cp_reset_ignore }, { .name = "ISR_EL1", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 12, .crm = 1, .opc2 = 0,