From patchwork Wed Mar 2 20:52:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 547533 Delivered-To: patch@linaro.org Received: by 2002:ac0:f585:0:0:0:0:0 with SMTP id s5csp40196imq; Wed, 2 Mar 2022 13:12:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJw0VyF+ZccGuxVTURRucjoM+BRDNXumlA0Ku3XSvGxqp4iB7+1q1cQl+8/kE3zVsXEKf+rR X-Received: by 2002:a81:b89:0:b0:2db:c3d0:ae32 with SMTP id 131-20020a810b89000000b002dbc3d0ae32mr12721093ywl.436.1646255561927; Wed, 02 Mar 2022 13:12:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646255561; cv=none; d=google.com; s=arc-20160816; b=r7yOQDFseBX7YQ94iK2UzjfHOGODl8Jo5HeHhVnKZsHCb7ymHbM8MsyjEQ9e4oO4BZ J29tggBZgOOLcPkik6qZcKrQQ8WDkw8LqXeIxlXcGUWv2UVa3EyNpDle+WvLDiekrpBP l4qQYXk8rG7s4E9UF4+5V23Zk8DBPnjHw1I8r496HmqkFMJ8HT48G9atdYQic+gOXkpA MSif0eqdB2GHToZnsHmLs9xbWLu7r9hLK+WiLbdYd6cWtkSDF1tTrt6s+GoAU/Y2uPHp dEdKDu+Mmo3M99F28rES7VvXydQIr0dYNsBKkW7PF1SnTOdDWfUBjJI4SbS3S7EAS/IT T4nA== 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=+cFrQ0gYtD+BMJbyD47IQWGJju9cN+yG8odvU6RxmJ4=; b=ODwNd5nv4ZA0XNyOijRUGaoT5NcP9bxbG1vDOfXvBNWLyMoBtyWrsfdX3lFfFRYwl3 yNhusO81AG6Mk5bAjoPrJiRMhiDGcfEjvz+1gC6o9zPKuOEETeE4ZdQt0xGe+O/SDkVY lvPZtu/zSJNw/PKRcdjebIul3AwJLHvq4UcDcoo+gVaY6vDk/so4oq4ektNxXiByMwPM 1zNRmhjK/etfD54UCy0NWG4b2VxtlRU2TwwyXQlUy1Kh4nGalFQnKnSGGtG0rtY0OEum 2nqZGRoPSXtRP6OVT1+FqOgn8lvZbF8N8Gl7xyNuH+1EA3fA8/FzCOLNtFN91fNzA2w2 74Tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=boiE02vl; 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 q189-20020a0de7c6000000b002d66f60a0f6si15621ywe.496.2022.03.02.13.12.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 02 Mar 2022 13:12:41 -0800 (PST) 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=boiE02vl; 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]:50958 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nPWH3-0003Gb-Do for patch@linaro.org; Wed, 02 Mar 2022 16:12:41 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43446) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nPVxm-0005qO-BE for qemu-devel@nongnu.org; Wed, 02 Mar 2022 15:52:47 -0500 Received: from [2a00:1450:4864:20::432] (port=35384 helo=mail-wr1-x432.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nPVxk-00088m-Li for qemu-devel@nongnu.org; Wed, 02 Mar 2022 15:52:46 -0500 Received: by mail-wr1-x432.google.com with SMTP id b5so4701407wrr.2 for ; Wed, 02 Mar 2022 12:52:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=+cFrQ0gYtD+BMJbyD47IQWGJju9cN+yG8odvU6RxmJ4=; b=boiE02vl76suB0S5OASrWRrGbYJc22XpqunH60k+nh+wls5jS4Rr3zft7IteLSXFhJ JFfuhTZ60iRzwyWagtgjp6xN9YGq/SXaGGm6PMK0lL+cZa4TQP5hnfDHVNvxNGbL/bDv +bBGIcY3K0eqLDRiMafci1DVx2IUTSSL7XXK9gSYvF/tHPlYa1i4CKmunZi4Li/LbyHb WDNGGSWmWQiepO2fStdRigQ+0lTJK6dirbKtR96/P6B6aBD7DwAvZcFjl8uBUTQtc7HY mswhzLX1xZUHzZxsoIhh2XRj03NXpW4NZYmIu1V6uslOZC42oaTaqF3gGNIdl3ntTYCr sJwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+cFrQ0gYtD+BMJbyD47IQWGJju9cN+yG8odvU6RxmJ4=; b=bWNXbnRal4vEf6lasTB2j4fu/U5Xhh0TmfxSYW0LHn0zNhufx9jmmURxP8GEb1tlqJ lA7UHNJ6cDcaaerVsNKzaj7WHY5TL6amV/m57pAq8R0eQSsN6ixLSxuvPQhIBlppROi9 +6oz9o9mdudh1NVgmxF3XCpCqBhVhNmkhULveFRF+qIKrUti1CA4VCJwvZzJ45TzkgCz tj2sqQxLqmzD4vtlcldwvBx7xCR6q/3t13gUzK09qhz6ExNj35HyBq71u9DQs16bZ/TF UpPZmT6tqLgmRG5e5N9WMn899anGgboE+fKA95UTqoCzG9gXPzh/mLdb6s8PaFgUaWF/ kFYg== X-Gm-Message-State: AOAM532jB7ZUhKaSllhz5TiMMncO6wIwgxE8TFGJcQ8eobH+xU5eLzQ2 ho+o2uxS5hoQS09QeUhvzeWu+fz9OQ2Quw== X-Received: by 2002:a5d:534a:0:b0:1f0:48f2:5f7c with SMTP id t10-20020a5d534a000000b001f048f25f7cmr1501899wrv.138.1646254363192; Wed, 02 Mar 2022 12:52:43 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id x13-20020adfec0d000000b001e31279cc38sm90801wrn.11.2022.03.02.12.52.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 12:52:42 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 12/26] target/arm: Pass outputsize down to check_s2_mmu_setup Date: Wed, 2 Mar 2022 20:52:16 +0000 Message-Id: <20220302205230.2122390-13-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220302205230.2122390-1-peter.maydell@linaro.org> References: <20220302205230.2122390-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::432 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x432.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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 Pass down the width of the output address from translation. For now this is still just PAMax, but a subsequent patch will compute the correct value from TCR_ELx.{I}PS. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220301215958.157011-6-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/helper.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index 71e575f352e..431b0c14052 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -11065,7 +11065,7 @@ do_fault: * false otherwise. */ static bool check_s2_mmu_setup(ARMCPU *cpu, bool is_aa64, int level, - int inputsize, int stride) + int inputsize, int stride, int outputsize) { const int grainsize = stride + 3; int startsizecheck; @@ -11081,22 +11081,19 @@ static bool check_s2_mmu_setup(ARMCPU *cpu, bool is_aa64, int level, } if (is_aa64) { - CPUARMState *env = &cpu->env; - unsigned int pamax = arm_pamax(cpu); - switch (stride) { case 13: /* 64KB Pages. */ - if (level == 0 || (level == 1 && pamax <= 42)) { + if (level == 0 || (level == 1 && outputsize <= 42)) { return false; } break; case 11: /* 16KB Pages. */ - if (level == 0 || (level == 1 && pamax <= 40)) { + if (level == 0 || (level == 1 && outputsize <= 40)) { return false; } break; case 9: /* 4KB Pages. */ - if (level == 0 && pamax <= 42) { + if (level == 0 && outputsize <= 42) { return false; } break; @@ -11105,8 +11102,8 @@ static bool check_s2_mmu_setup(ARMCPU *cpu, bool is_aa64, int level, } /* Inputsize checks. */ - if (inputsize > pamax && - (arm_el_is_aa64(env, 1) || inputsize > 40)) { + if (inputsize > outputsize && + (arm_el_is_aa64(&cpu->env, 1) || inputsize > 40)) { /* This is CONSTRAINED UNPREDICTABLE and we choose to fault. */ return false; } @@ -11392,7 +11389,7 @@ static bool get_phys_addr_lpae(CPUARMState *env, uint64_t address, target_ulong page_size; uint32_t attrs; int32_t stride; - int addrsize, inputsize; + int addrsize, inputsize, outputsize; TCR *tcr = regime_tcr(env, mmu_idx); int ap, ns, xn, pxn; uint32_t el = regime_el(env, mmu_idx); @@ -11422,11 +11419,13 @@ static bool get_phys_addr_lpae(CPUARMState *env, uint64_t address, addrsize = 64 - 8 * param.tbi; inputsize = 64 - param.tsz; + outputsize = arm_pamax(cpu); } else { param = aa32_va_parameters(env, address, mmu_idx); level = 1; addrsize = (mmu_idx == ARMMMUIdx_Stage2 ? 40 : 32); inputsize = addrsize - param.tsz; + outputsize = 40; } /* @@ -11511,7 +11510,7 @@ static bool get_phys_addr_lpae(CPUARMState *env, uint64_t address, /* Check that the starting level is valid. */ ok = check_s2_mmu_setup(cpu, aarch64, startlevel, - inputsize, stride); + inputsize, stride, outputsize); if (!ok) { fault_type = ARMFault_Translation; goto do_fault;