From patchwork Mon Nov 17 16:47:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Bellows X-Patchwork-Id: 40964 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7122C24035 for ; Mon, 17 Nov 2014 17:01:13 +0000 (UTC) Received: by mail-wi0-f199.google.com with SMTP id bs8sf1437917wib.6 for ; Mon, 17 Nov 2014 09:01:12 -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=KpSiRB6z2CO8SpsDU125nA1DoYq6lazXvXpjq1FHsw4=; b=FraC8Ou7FxOJ9B+24bbMHxS0d/XMLbyy/shj73aiHAkBRxTrkW66T80AJfVbNHFCXT IFglzqiZoQQJwyi9QSm3qOkbBe0/IQo/nBufE1mWNVU0YQYLVZW4BCL6DPZrgREv7YzA buW8YcTDNOJTU0uTaICPqw8RcHzehPS05lMyOVltVRb8pKq1Q4Pt9NM3evz1MLN9CbEg MY8HPMYox/r+0xW3XSLEHkFHEsYIGIWbKBisICwuDJsWdQlfSHY3t/plkIl2KyTbLJHe qa8DF8dgWwK9avClwZpPnfs++UxUi4k6V5bRYqoDhwtB5oRdM39tZQn35KSOreKu7a1Y oDQw== X-Gm-Message-State: ALoCoQksygv6Ht3gkJh/GZhz4B2ZmxNCj1AP6qyrFTnizfqgMtlkIDD3xG8m0T+d3y4gw2YCV7M+ X-Received: by 10.180.182.164 with SMTP id ef4mr4641610wic.0.1416243672776; Mon, 17 Nov 2014 09:01:12 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.4.33 with SMTP id cb1ls1314473lad.89.gmail; Mon, 17 Nov 2014 09:01:12 -0800 (PST) X-Received: by 10.152.8.170 with SMTP id s10mr4772576laa.56.1416243672426; Mon, 17 Nov 2014 09:01:12 -0800 (PST) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com. [209.85.217.179]) by mx.google.com with ESMTPS id rg7si29006960lbb.135.2014.11.17.09.01.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 17 Nov 2014 09:01:12 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by mail-lb0-f179.google.com with SMTP id l4so16359331lbv.38 for ; Mon, 17 Nov 2014 09:01:12 -0800 (PST) X-Received: by 10.152.8.170 with SMTP id s10mr4772525laa.56.1416243672056; Mon, 17 Nov 2014 09:01:12 -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 ew9csp1189079lbc; Mon, 17 Nov 2014 09:01:11 -0800 (PST) X-Received: by 10.236.223.198 with SMTP id v66mr26262746yhp.38.1416243670408; Mon, 17 Nov 2014 09:01:10 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id x127si35498017ykx.28.2014.11.17.09.01.09 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 17 Nov 2014 09:01:10 -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]:48950 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XqPfp-0006bq-GD for patch@linaro.org; Mon, 17 Nov 2014 12:01:09 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60152) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XqPU6-0002U3-MI for qemu-devel@nongnu.org; Mon, 17 Nov 2014 11:49:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XqPTv-0007HZ-DU for qemu-devel@nongnu.org; Mon, 17 Nov 2014 11:49:02 -0500 Received: from mail-pd0-f175.google.com ([209.85.192.175]:42278) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XqPTs-0007Gn-5R for qemu-devel@nongnu.org; Mon, 17 Nov 2014 11:48:51 -0500 Received: by mail-pd0-f175.google.com with SMTP id y10so2742806pdj.20 for ; Mon, 17 Nov 2014 08:48:47 -0800 (PST) X-Received: by 10.70.44.70 with SMTP id c6mr30607632pdm.45.1416242927324; Mon, 17 Nov 2014 08:48:47 -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 r2sm18499056pdi.60.2014.11.17.08.48.45 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 17 Nov 2014 08:48:46 -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: Mon, 17 Nov 2014 10:47:57 -0600 Message-Id: <1416242878-876-26-git-send-email-greg.bellows@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1416242878-876-1-git-send-email-greg.bellows@linaro.org> References: <1416242878-876-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.175 Cc: greg.bellows@linaro.org Subject: [Qemu-devel] [PATCH v11 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.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 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 a1fefe4..7ba55f0 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 b611573..fcbbd74 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,