From patchwork Sun Jul 3 08:23:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 586802 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5036:0:0:0:0 with SMTP id e22csp2914444mab; Sun, 3 Jul 2022 01:35:06 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tbJR+jcbyrRv/WX+NKit+THt4NOZh4PE/QO+bqSck9KlOdpthgfmAPFnL/EEOd/4xfETEH X-Received: by 2002:a0d:cdc7:0:b0:318:7c40:6578 with SMTP id p190-20020a0dcdc7000000b003187c406578mr26560595ywd.202.1656837306557; Sun, 03 Jul 2022 01:35:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656837306; cv=none; d=google.com; s=arc-20160816; b=FJhLaa186mR3d+Inwcd4P9S0vNnM3Z3zuKASIgbBwk9AQnGffeI98eW2084htGLecI OIuOOzhVs75CRTbqaCbEeDN9FgN0cZDVirgp6GWAWPavEZH7uJAhVKcEmSkzRuojSJO6 hPwY46D5RA4FDOEnlI/nSH0V55IEww1mk1tKhB8Vwwysk26C4nF7P5Kk6uJJhF63Ajwu EywfqoZPlLx3OSvgWHFwNm+869/GJymuvSwFIAyaFXl8b0qw5LWA5vm011p+TGzWy/Jp j4nhV03L7K+a191b2xC/i6JCwREMQRPx6Y7AWf3/5QfDW56woxP499dB2YjJw41TkfD8 okxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AVX4IODgIG8U+4PgU+1iyUK7c7RbVvq6xSMRTLDcW6w=; b=BMmgXu+yMMue1P8hKrQcGg2snZXyP1AWuUrCauAxWKLcKmm39zM7a5SX6GcFeBByR1 qkzsfAsVcx8be0L7cHStNBw39lH9rAZMaMbHmTUTXyiRJcumqvHujKlnyGdJZmaIrCmm 5Fws20Wka6ZoxlOOp2hNck9U/TksJtD0+aSVcrEW15B+rD7kT3dPBv0bZWb6txIIAdGp cxG7QOz9piSvJ/0kqhr7fJBbFmcBCsnsIRLF6OVTW6z4LX6KtFdbw9f/Wy1OULW6SvmN ug0bH7knQYsxEtxnCILr2nwvyksuWFjW41LY043QblOny7ODXn9X9faYcfaZ+SpDzuYD Magg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="d6BK/luN"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q1-20020a2599c1000000b00668a3bd4730si34917794ybo.421.2022.07.03.01.35.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 03 Jul 2022 01:35:06 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="d6BK/luN"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:54812 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o7v4L-0006jR-Uv for patch@linaro.org; Sun, 03 Jul 2022 04:35:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52880) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o7uue-000790-Di for qemu-devel@nongnu.org; Sun, 03 Jul 2022 04:25:04 -0400 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]:34484) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o7uuc-0005tM-J6 for qemu-devel@nongnu.org; Sun, 03 Jul 2022 04:25:04 -0400 Received: by mail-pj1-x102d.google.com with SMTP id cp18-20020a17090afb9200b001ef79e8484aso1073968pjb.1 for ; Sun, 03 Jul 2022 01:25:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AVX4IODgIG8U+4PgU+1iyUK7c7RbVvq6xSMRTLDcW6w=; b=d6BK/luNlDD090aTK4Lcf/iAesoeRkE1BqmhQkCPzavf9571y1y5ju3GVZNK+Vjw6E +XUbvY06MyTUAaSia1Pi5DbWMHh/iKSWaObkfXNcjIQz2lvSQ2HYTcflp1P4Sk+2oGDQ D20es9fizccNy4fQOdncJshr8D2HI3DTIpZvaqZ79S1KFg28UroFHTj0C3mBH/fH8X1O KQ9P1JPX3GyvaTqvPsdbMCfrM5GLQUff6YsUzxsTtCbHtnSOzFb7iFCqVv4VrDgdUhvy NQTqBvhPJPcEul8ALiSi5N+CA+9TISO/m8NOexwNFi33pa+LKOs5egzX/4C4A08CG01k MA7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AVX4IODgIG8U+4PgU+1iyUK7c7RbVvq6xSMRTLDcW6w=; b=0TR9RipZFDUrcngABtohiDjkZogn6OV4XzwZCIp7HfVenaQX7qZfELcjI+yrENCQxN rEsFAflT7sjFuquxntedYaSi9qj12/Fgb1z2FdHyfiMltYgJUu+Xyhxn7CIS/HtsW+Af SAjZsAxaIML0O5tsLefT71CljlTJgsPJZuoSxP3V+PMp+EcScCIgbDuILrhhRptZhJcV +UsvI9ofDvUH/WbFwTrt/jab0v9SimNiHDOKhmCGFKPEhPzgTJOgTbkjLcVbkENiD0yt cYVkj6dDRJXTYNXGJVIR8Jn/w7W4Y/uyxOVScJ8TMPYnDzrKGypA/IjokgpmRCad/mIg sx+Q== X-Gm-Message-State: AJIora/qnJp4brOa4T9WMrTDpjJXx92cvpaL5+6wj3KvJFr9Ee7GOdiT u+pv9WoM8QHSO026lmKkg4VHEnnvRw3bMqRB X-Received: by 2002:a17:902:c7cb:b0:16b:dc5d:8959 with SMTP id r11-20020a170902c7cb00b0016bdc5d8959mr1945472pla.87.1656836701225; Sun, 03 Jul 2022 01:25:01 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id im22-20020a170902bb1600b0016a3f9e528asm13569112plb.57.2022.07.03.01.24.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Jul 2022 01:25:00 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 12/62] target/arm: Use GetPhysAddrResult in get_phys_addr_v5 Date: Sun, 3 Jul 2022 13:53:29 +0530 Message-Id: <20220703082419.770989-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220703082419.770989-1-richard.henderson@linaro.org> References: <20220703082419.770989-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102d; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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" Signed-off-by: Richard Henderson Reviewed-by: Alex Bennée --- target/arm/ptw.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index d70c9120fc..490a57ec5a 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -410,9 +410,7 @@ static int simple_ap_to_rw_prot(CPUARMState *env, ARMMMUIdx mmu_idx, int ap) static bool get_phys_addr_v5(CPUARMState *env, uint32_t address, MMUAccessType access_type, ARMMMUIdx mmu_idx, - hwaddr *phys_ptr, int *prot, - target_ulong *page_size, - ARMMMUFaultInfo *fi) + GetPhysAddrResult *result, ARMMMUFaultInfo *fi) { int level = 1; uint32_t table; @@ -460,7 +458,7 @@ static bool get_phys_addr_v5(CPUARMState *env, uint32_t address, /* 1Mb section. */ phys_addr = (desc & 0xfff00000) | (address & 0x000fffff); ap = (desc >> 10) & 3; - *page_size = 1024 * 1024; + result->page_size = 1024 * 1024; } else { /* Lookup l2 entry. */ if (type == 1) { @@ -482,12 +480,12 @@ static bool get_phys_addr_v5(CPUARMState *env, uint32_t address, case 1: /* 64k page. */ phys_addr = (desc & 0xffff0000) | (address & 0xffff); ap = (desc >> (4 + ((address >> 13) & 6))) & 3; - *page_size = 0x10000; + result->page_size = 0x10000; break; case 2: /* 4k page. */ phys_addr = (desc & 0xfffff000) | (address & 0xfff); ap = (desc >> (4 + ((address >> 9) & 6))) & 3; - *page_size = 0x1000; + result->page_size = 0x1000; break; case 3: /* 1k page, or ARMv6/XScale "extended small (4k) page" */ if (type == 1) { @@ -495,7 +493,7 @@ static bool get_phys_addr_v5(CPUARMState *env, uint32_t address, if (arm_feature(env, ARM_FEATURE_XSCALE) || arm_feature(env, ARM_FEATURE_V6)) { phys_addr = (desc & 0xfffff000) | (address & 0xfff); - *page_size = 0x1000; + result->page_size = 0x1000; } else { /* * UNPREDICTABLE in ARMv5; we choose to take a @@ -506,7 +504,7 @@ static bool get_phys_addr_v5(CPUARMState *env, uint32_t address, } } else { phys_addr = (desc & 0xfffffc00) | (address & 0x3ff); - *page_size = 0x400; + result->page_size = 0x400; } ap = (desc >> 4) & 3; break; @@ -515,14 +513,14 @@ static bool get_phys_addr_v5(CPUARMState *env, uint32_t address, g_assert_not_reached(); } } - *prot = ap_to_rw_prot(env, mmu_idx, ap, domain_prot); - *prot |= *prot ? PAGE_EXEC : 0; - if (!(*prot & (1 << access_type))) { + result->prot = ap_to_rw_prot(env, mmu_idx, ap, domain_prot); + result->prot |= result->prot ? PAGE_EXEC : 0; + if (!(result->prot & (1 << access_type))) { /* Access permission fault. */ fi->type = ARMFault_Permission; goto do_fault; } - *phys_ptr = phys_addr; + result->phys = phys_addr; return false; do_fault: fi->domain = domain; @@ -2514,8 +2512,7 @@ bool get_phys_addr(CPUARMState *env, target_ulong address, result, fi); } else { return get_phys_addr_v5(env, address, access_type, mmu_idx, - &result->phys, &result->prot, - &result->page_size, fi); + result, fi); } }