From patchwork Thu Sep 22 16:35:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 608240 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp489008pvb; Thu, 22 Sep 2022 11:00:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ICgSxc2L31K8VV5SvY04uJi3ss6fST98b7TOv2UKyI8/JsXgEjkPAiDINyId0CbMWkdQ6 X-Received: by 2002:ac8:5a06:0:b0:35c:cc7b:610c with SMTP id n6-20020ac85a06000000b0035ccc7b610cmr3897041qta.131.1663869652364; Thu, 22 Sep 2022 11:00:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663869652; cv=none; d=google.com; s=arc-20160816; b=zyZICqomOtW1iWbs/eCFSTYWsuqGoFoF0K+xrsQg5HXHEvZznPUSkmAT4l+fK1oGoM xGlD8d/8MryrzmEgS9kbAfkAwK5C6hOgvVEABqjNFt95JNsVhd5HsKd6CtCROIWVLQGc 1Kg0eDuNqVtb/Y6wIQEXQpWZTaQohYJRAyDOfvmZbUahifwKF7TKpaBwyWvkoHzpHfkN iITHVol0tU3dA1bd6qZLLdZLDDvupaM7Fbnt/45G2anId1tiXufGtPMUvRTeqkfyrFr3 m/2zMZ6XgsrH+4m451zv5cDEvgFnhZAcaft+ke5NgMO/RoEZDi9/PT8F7J6jLaQbDELx hDiA== 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:to:from :dkim-signature; bh=eQDdX78ZoQvVzGawdbiqTYqIYpkUGBdGasPvevMFAeU=; b=gkRP0rTDWEs4cQFSQDsiQ6HcH7cl6UKDyQgwzNXiz9wwoYcdSVbbXwWdXb0WMDCXPJ 2XxuzVONX/Ox+rJV9GgJnxzxfx7C0+3EeVabDexJBOOZAIlktR4DlQRY6Eo4WSoAsr+v HEKN8AANd3491+I3GbmeEg+dOApTrkERdpzQKq8hFzoOMHgOujWrkVuYgwmmEpSAzkhl X0pprsgypyuq4CvO+rG20wLZEykJed2YdUaOsWw/YHJ+WmZsbtI9mJltLRRCt4ZThK0f bTQKHGT3LHCej84xzvSUBJFwvo4QN410ZuNiqzUQa3zW+LR2cuzXFsW7y0Cil0sEy4eM c8ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=u9r3Eytj; 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 9-20020a05620a070900b006cbcdcc70a6si3017700qkc.556.2022.09.22.11.00.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 22 Sep 2022 11:00:52 -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=u9r3Eytj; 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]:40258 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1obQVH-00022H-U8 for patch@linaro.org; Thu, 22 Sep 2022 14:00:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59040) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obPAw-0002AO-Pp for qemu-devel@nongnu.org; Thu, 22 Sep 2022 12:35:48 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:53869) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1obPAu-0005Of-Ug for qemu-devel@nongnu.org; Thu, 22 Sep 2022 12:35:46 -0400 Received: by mail-wm1-x32f.google.com with SMTP id e18so7138577wmq.3 for ; Thu, 22 Sep 2022 09:35:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date; bh=eQDdX78ZoQvVzGawdbiqTYqIYpkUGBdGasPvevMFAeU=; b=u9r3Eytj/iz08hDVl8t3xIYPAy/5uG93jba9cYXVp76GviKCLwRE7UlmEUiX1OBObs +QYL1toZM7CeOt7vqA961AScic14ULglu4QrKAAeXwa0BVzgPOysuDAeZf6xffrEPQJL qHryaRE6xAmpxH8tu8zm5Q57xz8E9cFs5P97zAC+Bn8KZ4/7clT4xQr5OcnCXkWCAxM/ h1Znn7mU/dS8kUZsXYCaOyf5LcaAgUKN96FBhWsxf6SEuBi3yeiH8ZKFC4zyDccsOjgH +ofvgGQNXR+AgWFznPfcFAyqbrCoTxHoEMvsYXb6jv2FTQvopxPPXX/6P+Eg3iAMoIS4 wSxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date; bh=eQDdX78ZoQvVzGawdbiqTYqIYpkUGBdGasPvevMFAeU=; b=om3/Ii6Zpgy6mReHIcZ1uYJ4ExqlCyv4utQTT0wbAaNGBq/OszgsNxBrCgfDHn+9nS j16yFsEepdggZpQo/lo3ZWl9O9Qd3MYR6WC4Ad8nu20ohVJhivjOk6j7iPUwwSjUqTPx ahYVdAWSXlNUPivVd7tE1jTQGKcN84gSTFq9Za/BfCenWl4353L/wuwAOcEPDjcLb/1w jPh6koZx4GWnWbrAadmaL4XsPvf8bHuvkzwQm6++KD7Ynu5vgpf6tWlFC0D3H0+xNLEc oYhuYRh5GZAi8K46IPBTRSOUg0DTVFE38Mh304Z8mUa7aB2/xJvOcn5NVNRj8mX4cwAh UyeQ== X-Gm-Message-State: ACrzQf3Fqoa1NXFYvxFolYLbyFnKVvovaCh8D1HZv7hHdwoXyeyA7Vn+ U5CxNqv3KU8dY0ZG8kogZklQkWmdloqFLw== X-Received: by 2002:a05:600c:2142:b0:3b4:92b6:73ba with SMTP id v2-20020a05600c214200b003b492b673bamr10409354wml.139.1663864542619; Thu, 22 Sep 2022 09:35:42 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id iw1-20020a05600c54c100b003b3401f1e24sm6452599wmb.28.2022.09.22.09.35.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Sep 2022 09:35:42 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 06/39] target/arm: Use GetPhysAddrResult in get_phys_addr_v5 Date: Thu, 22 Sep 2022 17:35:03 +0100 Message-Id: <20220922163536.1096175-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220922163536.1096175-1-peter.maydell@linaro.org> References: <20220922163536.1096175-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32f.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 autolearn=ham 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" From: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson Message-id: 20220822152741.1617527-6-richard.henderson@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- 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 600d9e6650d..4e2476278e1 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -414,9 +414,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; @@ -464,7 +462,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) { @@ -486,12 +484,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) { @@ -499,7 +497,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 @@ -510,7 +508,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; @@ -519,14 +517,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; @@ -2520,8 +2518,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); } }