From patchwork Mon Jun 30 23:09:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Bellows X-Patchwork-Id: 32810 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f199.google.com (mail-pd0-f199.google.com [209.85.192.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5ADEB203F4 for ; Mon, 30 Jun 2014 23:19:42 +0000 (UTC) Received: by mail-pd0-f199.google.com with SMTP id r10sf42515420pdi.2 for ; Mon, 30 Jun 2014 16:19:41 -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=DmkD7TrT5hToBri77Ijo6V7JR3mvn7TeQSxBqVdotl0=; b=kM2wVeGdVdLFzMP6PjuFPAv7BeOS5F6+F2zpdmvAr07vNUWW3y9hsLyv2gQU6SivBc mf6ofs8+gMcXb/9JqWZ8g0JKworfV+QLXb3Bgg6punN0uQN5suPCVhXVS4kqfZ7MP8R/ ujWrobX7mQoA360/aNnNmpjNO/WoeBxVrVB0gXeg8VmHlafTbO8M6CEWe8jKHV7i5WeG qgNZzP7LfJQX6kIHh4ezZ2rm4VzTISAC0hGcxolTMhWL5rqsQuEJj0UmxG1b6BG15SyG BReGKXzOH0v1lVGPmWqZF8TB1qiwPVk/YEhJZSHwt3/XrluDzjiMUQ9VFIt3rMSjIyb7 OMTA== X-Gm-Message-State: ALoCoQlnJOUJjgDdsUMMPNjDSXpqx9E5+d/lpMdcXX/Ns4X1fZQfMNA8NTdvc5KkFrDsFGqBhsCU X-Received: by 10.66.218.105 with SMTP id pf9mr23680018pac.36.1404170381536; Mon, 30 Jun 2014 16:19:41 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.105.54 with SMTP id b51ls1754040qgf.48.gmail; Mon, 30 Jun 2014 16:19:41 -0700 (PDT) X-Received: by 10.58.160.10 with SMTP id xg10mr41661748veb.0.1404170381418; Mon, 30 Jun 2014 16:19:41 -0700 (PDT) Received: from mail-vc0-f178.google.com (mail-vc0-f178.google.com [209.85.220.178]) by mx.google.com with ESMTPS id sg10si10707944vec.88.2014.06.30.16.19.41 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 30 Jun 2014 16:19:41 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.178 as permitted sender) client-ip=209.85.220.178; Received: by mail-vc0-f178.google.com with SMTP id ij19so8354400vcb.9 for ; Mon, 30 Jun 2014 16:19:41 -0700 (PDT) X-Received: by 10.52.182.163 with SMTP id ef3mr34153672vdc.22.1404170381289; Mon, 30 Jun 2014 16:19:41 -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 tc5csp175174vcb; Mon, 30 Jun 2014 16:19:41 -0700 (PDT) X-Received: by 10.224.51.72 with SMTP id c8mr66948917qag.82.1404170380745; Mon, 30 Jun 2014 16:19:40 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 7si27049822qaq.11.2014.06.30.16.19.40 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 30 Jun 2014 16:19:40 -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]:37121 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1krM-0005yE-5z for patch@linaro.org; Mon, 30 Jun 2014 19:19:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54191) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1kjZ-0006vG-7s for qemu-devel@nongnu.org; Mon, 30 Jun 2014 19:11:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X1kjT-0003yg-RF for qemu-devel@nongnu.org; Mon, 30 Jun 2014 19:11:37 -0400 Received: from mail-ob0-f182.google.com ([209.85.214.182]:36322) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1kjT-0003yJ-C0 for qemu-devel@nongnu.org; Mon, 30 Jun 2014 19:11:31 -0400 Received: by mail-ob0-f182.google.com with SMTP id nu7so9794470obb.27 for ; Mon, 30 Jun 2014 16:11:31 -0700 (PDT) X-Received: by 10.182.115.199 with SMTP id jq7mr6935575obb.70.1404169891089; Mon, 30 Jun 2014 16:11:31 -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.29 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 30 Jun 2014 16:11:30 -0700 (PDT) From: greg.bellows@linaro.org To: qemu-devel@nongnu.org Date: Mon, 30 Jun 2014 18:09:32 -0500 Message-Id: <1404169773-20264-33-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 32/33] target-arm: make c13 cp regs banked (FCSEIDR, ...) 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.220.178 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) FCSEIDR, CONTEXTIDR, TPIDRURW, TPIDRURO and TPIDRPRW have a secure and a non-secure instance. Signed-off-by: Fabian Aggeler Signed-off-by: Greg Bellows -------------- v3 -> v4 - Fix tpidrprw mapping Signed-off-by: Greg Bellows --- target-arm/cpu.h | 45 ++++++++++++++++++++++++++++++++++++++++----- target-arm/helper.c | 27 +++++++++++++++++---------- 2 files changed, 57 insertions(+), 15 deletions(-) diff --git a/target-arm/cpu.h b/target-arm/cpu.h index aade869..3c96131 100644 --- a/target-arm/cpu.h +++ b/target-arm/cpu.h @@ -322,11 +322,46 @@ typedef struct CPUARMState { uint64_t vbar_el[4]; }; uint64_t mvbar; /* (monitor) vector base address register */ - uint32_t c13_fcse; /* FCSE PID. */ - uint64_t contextidr_el1; /* Context ID. */ - uint64_t tpidr_el0; /* User RW Thread register. */ - uint64_t tpidrro_el0; /* User RO Thread register. */ - uint64_t tpidr_el1; /* Privileged Thread register. */ + struct { /* FCSE PID. */ + uint32_t c13_fcseidr_ns; + uint32_t c13_fcseidr_s; + }; + union { /* Context ID. */ + struct { + uint64_t contextidr_ns; + uint64_t contextidr_s; + }; + struct { + uint64_t contextidr_el1; + }; + }; + union { /* User RW Thread register. */ + struct { + uint64_t tpidrurw_ns; + uint64_t tpidrurw_s; + }; + struct { + uint64_t tpidr_el0; + }; + }; + union { /* User RO Thread register. */ + struct { + uint64_t tpidruro_ns; + uint64_t tpidruro_s; + }; + struct { + uint64_t tpidrro_el0; + }; + }; + union { /* Privileged Thread register. */ + struct { + uint64_t tpidrprw_ns; + uint64_t tpidrprw_s; + }; + struct { + uint64_t tpidr_el1; + }; + }; uint64_t c14_cntfrq; /* Counter Frequency register */ uint64_t c14_cntkctl; /* Timer Control register */ ARMGenericTimer c14_timer[NUM_GTIMERS]; diff --git a/target-arm/helper.c b/target-arm/helper.c index 1a07124..3bc55fe 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -396,12 +396,15 @@ static const ARMCPRegInfo cp_reginfo[] = { { .name = "DBGDIDR", .cp = 14, .crn = 0, .crm = 0, .opc1 = 0, .opc2 = 0, .access = PL0_R, .type = ARM_CP_CONST, .resetvalue = 0 }, { .name = "FCSEIDR", .cp = 15, .crn = 13, .crm = 0, .opc1 = 0, .opc2 = 0, - .access = PL1_RW, .fieldoffset = offsetof(CPUARMState, cp15.c13_fcse), + .access = PL1_RW, + .bank_fieldoffsets = { offsetof(CPUARMState, cp15.c13_fcseidr_s), + offsetof(CPUARMState, cp15.c13_fcseidr_ns) }, .resetvalue = 0, .writefn = fcse_write, .raw_writefn = raw_write, }, { .name = "CONTEXTIDR", .state = ARM_CP_STATE_BOTH, .opc0 = 3, .opc1 = 0, .crn = 13, .crm = 0, .opc2 = 1, .access = PL1_RW, - .fieldoffset = offsetof(CPUARMState, cp15.contextidr_el1), + .bank_fieldoffsets = { offsetof(CPUARMState, cp15.contextidr_s), + offsetof(CPUARMState, cp15.contextidr_ns) }, .resetvalue = 0, .writefn = contextidr_write, .raw_writefn = raw_write, }, REGINFO_SENTINEL }; @@ -889,21 +892,25 @@ static const ARMCPRegInfo v6k_cp_reginfo[] = { .access = PL0_RW, .fieldoffset = offsetof(CPUARMState, cp15.tpidr_el0), .resetvalue = 0 }, { .name = "TPIDRURW", .cp = 15, .crn = 13, .crm = 0, .opc1 = 0, .opc2 = 2, - .access = PL0_RW, - .fieldoffset = offsetoflow32(CPUARMState, cp15.tpidr_el0), - .resetfn = arm_cp_reset_ignore }, + .access = PL0_RW, .resetfn = arm_cp_reset_ignore, + .bank_fieldoffsets = { offsetoflow32(CPUARMState, cp15.tpidrurw_s), + offsetoflow32(CPUARMState, cp15.tpidrurw_ns) } }, { .name = "TPIDRRO_EL0", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 3, .opc2 = 3, .crn = 13, .crm = 0, .access = PL0_R|PL1_W, .fieldoffset = offsetof(CPUARMState, cp15.tpidrro_el0), .resetvalue = 0 }, { .name = "TPIDRURO", .cp = 15, .crn = 13, .crm = 0, .opc1 = 0, .opc2 = 3, - .access = PL0_R|PL1_W, - .fieldoffset = offsetoflow32(CPUARMState, cp15.tpidrro_el0), - .resetfn = arm_cp_reset_ignore }, - { .name = "TPIDR_EL1", .state = ARM_CP_STATE_BOTH, + .access = PL0_R|PL1_W, .resetfn = arm_cp_reset_ignore, + .bank_fieldoffsets = { offsetoflow32(CPUARMState, cp15.tpidruro_s), + offsetoflow32(CPUARMState, cp15.tpidruro_ns) } }, + { .name = "TPIDR_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 3, .opc1 = 0, .opc2 = 4, .crn = 13, .crm = 0, .access = PL1_RW, .fieldoffset = offsetof(CPUARMState, cp15.tpidr_el1), .resetvalue = 0 }, + { .name = "TPIDRPRW", .cp = 15, .crn = 13, .crm = 0, .opc1 = 0, .opc2 = 4, + .access = PL1_RW, .resetfn = arm_cp_reset_ignore, + .bank_fieldoffsets = { offsetoflow32(CPUARMState, cp15.tpidrprw_s), + offsetoflow32(CPUARMState, cp15.tpidrprw_ns) } }, REGINFO_SENTINEL }; @@ -4615,7 +4622,7 @@ static inline int get_phys_addr(CPUARMState *env, target_ulong address, /* Fast Context Switch Extension. */ if (address < 0x02000000) - address += env->cp15.c13_fcse; + address += A32_BANKED_CURRENT_REG_GET(env, c13_fcseidr); if ((sctlr & SCTLR_M) == 0) { /* MMU/MPU disabled. */