From patchwork Fri Jun 30 13:45:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 9819655 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1A40860224 for ; Fri, 30 Jun 2017 13:46:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0D4E5201A4 for ; Fri, 30 Jun 2017 13:46:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 01AB7285E5; Fri, 30 Jun 2017 13:46:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A694C201A4 for ; Fri, 30 Jun 2017 13:46:22 +0000 (UTC) Received: from localhost ([::1]:44608 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dQwFZ-0006Fv-SO for patchwork-qemu-devel@patchwork.kernel.org; Fri, 30 Jun 2017 09:46:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50647) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dQwEQ-0006DL-Rd for qemu-devel@nongnu.org; Fri, 30 Jun 2017 09:45:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dQwEP-0007dx-G4 for qemu-devel@nongnu.org; Fri, 30 Jun 2017 09:45:10 -0400 Received: from mail-lf0-x243.google.com ([2a00:1450:4010:c07::243]:34369) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dQwEP-0007cK-8N; Fri, 30 Jun 2017 09:45:09 -0400 Received: by mail-lf0-x243.google.com with SMTP id g21so10121738lfk.1; Fri, 30 Jun 2017 06:45:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=p5ZUed3+fyuQ5Au5llR9OOBWdlCSo7ZYkk2o3195Oqk=; b=XxZhA0ZbSQhsF9P0aOdOPfmh9zrDPPVe6nyHJuOi1L2Zk8I2ETNpB+EDAYRTtH3ms9 eUlnlv/m5O76FTz55N987Oo95tU2u1iqjOcKY9gUzuVA+9fTdHyrzk4PCgldXSTb/ltP N8rY37+ytTiYYgFOC9D+LtmMWWE+OYWoqs1Gm1k04NoW/4kZJcw4hL+1qPCqcqZxsmhR oH2GMmvuJdwMr7CS3Biz9q53pWL+LwqbBzRp5I/269No4enDEdPoLEsj6/nm6fgXpagN 9mnrQjg8H9CLQkmrPGKBq9/FXLU9zIUIzfa9GadyFvCrd4cVTqcAIfd68FK3PILTYncg RKlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=p5ZUed3+fyuQ5Au5llR9OOBWdlCSo7ZYkk2o3195Oqk=; b=awYX0IitYS5FgwPbL8beZJaAmLWiMI2SNL7QLCNsV+Dh9QtcP+uCg5jMZd3jtsk9C6 3U60DudyCyQdQO4TIpX9PBkSQwbzdthq4qs/m3MwBUGS2ic7sK+QYV8LW5X75p1waLkk ISQtnayU6xwg9da0LoAINX5KayAAEvUpjHVKExAoWRArFKomUgUGlzDPbW5HRyi8BvKu 4pD8lKCDYJsQK53+wAqF2JRJw3wkErN+8Q7KZZrv0DuZpSMa6/jFVZgAYfEhp0nCsJHY 821GjB74t/JI1uMt53CuVssCu5+mWpVDPDLoW2wOYryHU12qeJxa0yZxRaIpd06F3xLe VX+g== X-Gm-Message-State: AKS2vOw12b7Y11qKLYw1xBthlQWOigXmiDZ4IarXk+DmoYurvwpu/OWS 4OpBf6skhIkHIp4F X-Received: by 10.46.33.165 with SMTP id h37mr7144061lji.15.1498830307750; Fri, 30 Jun 2017 06:45:07 -0700 (PDT) Received: from localhost (81-231-233-234-no56.tbcn.telia.com. [81.231.233.234]) by smtp.gmail.com with ESMTPSA id 3sm1646621lju.69.2017.06.30.06.45.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Jun 2017 06:45:06 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Fri, 30 Jun 2017 15:45:02 +0200 Message-Id: <1498830302-19274-3-git-send-email-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1498830302-19274-1-git-send-email-edgar.iglesias@gmail.com> References: <1498830302-19274-1-git-send-email-edgar.iglesias@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::243 Subject: [Qemu-devel] [PATCH v1 2/2] target-arm: Extend PAR format determination X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: edgar.iglesias@xilinx.com, qemu-arm@nongnu.org, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: "Edgar E. Iglesias" Extend PAR format determination to handle more cases. Signed-off-by: Edgar E. Iglesias --- target/arm/helper.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index fd1027e..6a1fffe 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -2345,12 +2345,40 @@ static uint64_t do_ats_write(CPUARMState *env, uint64_t value, uint32_t fsr; bool ret; uint64_t par64; + bool format64 = false; MemTxAttrs attrs = {}; ARMMMUFaultInfo fi = {}; ret = get_phys_addr(env, value, access_type, mmu_idx, &phys_addr, &attrs, &prot, &page_size, &fsr, &fi); - if (extended_addresses_enabled(env)) { + + if (is_a64(env)) { + format64 = true; + } else if (arm_feature(env, ARM_FEATURE_LPAE)) { + /* + * ATS1Cxx: + * * TTBCR.EAE determines whether the result is returned using the + * 32-bit or the 64-bit PAR format + * * Instructions executed in Hyp mode always use the 64bit format + * + * ATS1S2NSOxx uses the 64bit format if any of the following is true: + * * The Non-secure TTBCR.EAE bit is set to 1 + * * The implementation includes EL2, and the value of HCR.VM is 1 + * + * ATS1Hx always uses the 64bit format (not supported yet). + */ + format64 = regime_using_lpae_format(env, mmu_idx); + + if (arm_feature(env, ARM_FEATURE_EL2)) { + if (mmu_idx == ARMMMUIdx_S12NSE0 || mmu_idx == ARMMMUIdx_S12NSE1) { + format64 |= env->cp15.hcr_el2 & HCR_VM; + } else { + format64 |= arm_current_el(env) == 2; + } + } + } + + if (format64) { /* fsr is a DFSR/IFSR value for the long descriptor * translation table format, but with WnR always clear. * Convert it to a 64-bit PAR.