From patchwork Mon Oct 26 13:02:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 535938 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 5503A14012C for ; Tue, 27 Oct 2015 00:07:46 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=OWGC5NkI; dkim-atps=neutral Received: from localhost ([::1]:52799 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZqhV2-0008Fi-1k for incoming@patchwork.ozlabs.org; Mon, 26 Oct 2015 09:07:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45322) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZqhQj-0000Gg-NF for qemu-devel@nongnu.org; Mon, 26 Oct 2015 09:03:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZqhQd-0002iO-Tj for qemu-devel@nongnu.org; Mon, 26 Oct 2015 09:03:17 -0400 Received: from mail-pa0-x22a.google.com ([2607:f8b0:400e:c03::22a]:34988) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZqhQd-0002iH-OK for qemu-devel@nongnu.org; Mon, 26 Oct 2015 09:03:11 -0400 Received: by pasz6 with SMTP id z6so188275445pas.2 for ; Mon, 26 Oct 2015 06:03:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ej260zODwjAnFV0po4I3X/5ea02Xw0xpZ0otV1zhCUM=; b=OWGC5NkId75TMC5eKFc98pXMGVQk6BnNr5wn+L5t14W/p1dOXKsHtqrQWR/uHezC2a uxqhlZ+gAe2yz0c2EjLFZl3/RCk1NpyHDnWqU5nlgUZD5Ool/feq4Rd5qGlhcl4uz03T loNbwcb9MD8cdGNur009lnFxWkVpXdSJokEsOgCfSuSftPDCXU3qjBRLgO3ytIrDBmdR RtgUt7fbnCEP0TpGw06XZg9n49BDzCnre/THfLniL8ssIe2pKI1QzZe9Sc8NskQ0/onB y4BLV1rJEK2FdwTNyacHfmrAtHoJiDrH5O6cJjp0XlJ42uXO3wqtZYNOxPFNC266cHmL WQhA== X-Received: by 10.68.138.129 with SMTP id qq1mr22320573pbb.35.1445864591312; Mon, 26 Oct 2015 06:03:11 -0700 (PDT) Received: from localhost (ec2-52-8-89-49.us-west-1.compute.amazonaws.com. [52.8.89.49]) by smtp.gmail.com with ESMTPSA id sn9sm34068992pac.16.2015.10.26.06.03.09 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 26 Oct 2015 06:03:10 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Mon, 26 Oct 2015 14:02:05 +0100 Message-Id: <1445864527-14520-13-git-send-email-edgar.iglesias@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1445864527-14520-1-git-send-email-edgar.iglesias@gmail.com> References: <1445864527-14520-1-git-send-email-edgar.iglesias@gmail.com> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c03::22a Cc: laurent.desnogues@gmail.com, serge.fdrv@gmail.com, edgar.iglesias@xilinx.com, alex.bennee@linaro.org, agraf@suse.de Subject: [Qemu-devel] [PATCH v5 12/14] target-arm: Add S2 translation to 32bit S1 PTWs 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: "Edgar E. Iglesias" Add support for applying S2 translation to 32bit S1 page-table walks. Reviewed-by: Peter Maydell Signed-off-by: Edgar E. Iglesias --- target-arm/helper.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/target-arm/helper.c b/target-arm/helper.c index 76dfd33..3857c0b 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -6230,11 +6230,19 @@ static hwaddr S1_ptw_translate(CPUARMState *env, ARMMMUIdx mmu_idx, * was being done for a CPU load/store or an address translation instruction * (but not if it was for a debug access). */ -static uint32_t arm_ldl_ptw(CPUState *cs, hwaddr addr, bool is_secure) +static uint32_t arm_ldl_ptw(CPUState *cs, hwaddr addr, bool is_secure, + ARMMMUIdx mmu_idx, uint32_t *fsr, + ARMMMUFaultInfo *fi) { + ARMCPU *cpu = ARM_CPU(cs); + CPUARMState *env = &cpu->env; MemTxAttrs attrs = {}; attrs.secure = is_secure; + addr = S1_ptw_translate(env, mmu_idx, addr, attrs, fsr, fi); + if (fi->s1ptw) { + return 0; + } return address_space_ldl(cs->as, addr, attrs, NULL); } @@ -6278,7 +6286,8 @@ static bool get_phys_addr_v5(CPUARMState *env, uint32_t address, code = 5; goto do_fault; } - desc = arm_ldl_ptw(cs, table, regime_is_secure(env, mmu_idx)); + desc = arm_ldl_ptw(cs, table, regime_is_secure(env, mmu_idx), + mmu_idx, fsr, fi); type = (desc & 3); domain = (desc >> 5) & 0x0f; if (regime_el(env, mmu_idx) == 1) { @@ -6314,7 +6323,8 @@ static bool get_phys_addr_v5(CPUARMState *env, uint32_t address, /* Fine pagetable. */ table = (desc & 0xfffff000) | ((address >> 8) & 0xffc); } - desc = arm_ldl_ptw(cs, table, regime_is_secure(env, mmu_idx)); + desc = arm_ldl_ptw(cs, table, regime_is_secure(env, mmu_idx), + mmu_idx, fsr, fi); switch (desc & 3) { case 0: /* Page translation fault. */ code = 7; @@ -6395,7 +6405,8 @@ static bool get_phys_addr_v6(CPUARMState *env, uint32_t address, code = 5; goto do_fault; } - desc = arm_ldl_ptw(cs, table, regime_is_secure(env, mmu_idx)); + desc = arm_ldl_ptw(cs, table, regime_is_secure(env, mmu_idx), + mmu_idx, fsr, fi); type = (desc & 3); if (type == 0 || (type == 3 && !arm_feature(env, ARM_FEATURE_PXN))) { /* Section translation fault, or attempt to use the encoding @@ -6446,7 +6457,8 @@ static bool get_phys_addr_v6(CPUARMState *env, uint32_t address, ns = extract32(desc, 3, 1); /* Lookup l2 entry. */ table = (desc & 0xfffffc00) | ((address >> 10) & 0x3fc); - desc = arm_ldl_ptw(cs, table, regime_is_secure(env, mmu_idx)); + desc = arm_ldl_ptw(cs, table, regime_is_secure(env, mmu_idx), + mmu_idx, fsr, fi); ap = ((desc >> 4) & 3) | ((desc >> 7) & 4); switch (desc & 3) { case 0: /* Page translation fault. */