From patchwork Wed Feb 23 22:31:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 545223 X-Google-Smtp-Source: ABdhPJyqemjUjeoTALxcpCDuTdp7Ur1ZclFVBGTCUVQZPJ+ogwh90I7/OWGLP/57q9nclGoEi+F8 X-Received: by 2002:a0c:bf12:0:b0:42c:536d:52d7 with SMTP id m18-20020a0cbf12000000b0042c536d52d7mr1362836qvi.33.1645656163418; Wed, 23 Feb 2022 14:42:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645656163; cv=none; d=google.com; s=arc-20160816; b=CFEpBZ+za6E9fUcaW6MU6F5i+DML0i9Bn4ahpYldNpT7NhiX5/Yd0bqQjcE+Cl3HC1 wv/mjpBrv8rxMC+ib70gwDJZlcrVRm+cQGFfTijOs0opFo+AtZVxdsAwzT2rndJAQEOc QLo2Z9K1aRhT37tWure4DhwEa4X/3QiB+Xr0aG04D5Shg5xdNGr/8l1nE9Wdjki+gxe2 B5WVQSLAPH3aoj6A4UQzNTRMCPaKckDeey+8/XVpH/GpQIUI2K1/rhwxtWf/g8DhiR7n SRQ4CI3BQBr84scgf5gX/6iiqdhpjIO5Ca/Giv59SOELMdFQlRBE8/3e0HT36unhPwNQ e18g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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=TAU62jUEHWqZmP/omH+DP65D27WXovgj7reF6QpCfzg=; b=OYlKTKF7zKYlUleJzx7rc/lg/CybZ2jF2N+7k9avP9MDRJfVyWKyJbxEi0r7spzAHK qN/zpyjkU6kAJw55oKpviRdGKKU/Ui3jGtLJmOe6+QECUaC8MqxJyj1nzjjLu8uRBj9J rB5Pu/K/8lNNlY4F3vuqO7irVoFslm8YNaX5V5NpDiJv2Na6hWWBKN0ABMfRdjuMxAh0 6ssqiIewPI19B3WNh0AxONdqCF6/Nup09Nck4fspUHz5LQ42EjKEY1D04AHalrUIRo0l 5HTYl5TTfdS7j9dsCuelz31iMfJwyr7Z0KfIrc1i6yiKsbcTUYYwLJ3VdQz3I6zaogBT anzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=qci+ATQT; 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=fail (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 b23si424298qvf.381.2022.02.23.14.42.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 23 Feb 2022 14:42:43 -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=fail header.i=@linaro.org header.s=google header.b=qci+ATQT; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:57264 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nN0LK-00085b-Ss for patch@linaro.org; Wed, 23 Feb 2022 17:42:42 -0500 Received: from eggs.gnu.org ([209.51.188.92]:59224) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nN0Aq-0006kx-IS for qemu-devel@nongnu.org; Wed, 23 Feb 2022 17:31:52 -0500 Received: from [2607:f8b0:4864:20::431] (port=35511 helo=mail-pf1-x431.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nN0Ao-0001Df-I3 for qemu-devel@nongnu.org; Wed, 23 Feb 2022 17:31:52 -0500 Received: by mail-pf1-x431.google.com with SMTP id l19so217138pfu.2 for ; Wed, 23 Feb 2022 14:31:50 -0800 (PST) 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=TAU62jUEHWqZmP/omH+DP65D27WXovgj7reF6QpCfzg=; b=qci+ATQTMvD+ZRQvRNzNY3SFlHbue3ZUY+cebS/Zwj2QLeycJ7oqNnHFZCnw/zGNXd FbvUOd+hMLUOjiR6yCB5RkV64k/+ZCikHlYqti+f/1dElrrA7sqH0rHbeBZtD6UFFUQd 2mxHpKOmSXsHZHUf0qf8irBBXkQGyWhrTlvDiFMN5nz3SkROpxmawZXlazUrHykhs9/7 Inu007DSVGGvpvT47d1+i4KkcFYbZTj+dkjnfdCcEMmdKaJOlfWPhfoqw6Q2Im1wFeoI 0qjv57FvReuByNfWOrdKPriy2dy8Oftw1nCq7aUfx/7QFD7AEyx/X6LsZA0PRfJDBSzV jlzw== 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=TAU62jUEHWqZmP/omH+DP65D27WXovgj7reF6QpCfzg=; b=ZeIKGJOgmC4HjooSFv3Fw6+ASt3rrmJQKcM6o4v+A5UgbtY5tJuRjElvVsPzRnG9Yu K2dWyinZKqvxKUBgIZ/wn08GeRpHDG/0paXxT1wJUvEtY4Rh0D77cCkE7gcNEm1qM8zL 1BQhybmUCqDYzEE5vkUiddpeyHrhP5EyF5YAbiRkwOaZnHwJfsTm8MI3HEDUPA+ihzhs lRb/yFA095Sl7Si80tYqNrf6lNn3OdM7btntDOnpMzXuy3LOBksWtXSI7PpiJNtEBCvk JNHTFZWmIkgjFJzqinS7EiQFpChqn9ujV7UNv8EvjTlA22XtimVHeBquyQLYrLUofHB2 yfdA== X-Gm-Message-State: AOAM530W9AJYO7nIMx5Q3cs3FvxZbUas8/TWj4vaRnRmP6rkbT+FRc0a X1kd7Cj19zDI0ipeEIefJ/DmCn/xdn22Mg== X-Received: by 2002:a63:575d:0:b0:373:a27e:7c67 with SMTP id h29-20020a63575d000000b00373a27e7c67mr1412931pgm.558.1645655509245; Wed, 23 Feb 2022 14:31:49 -0800 (PST) Received: from localhost.localdomain (cpe-50-113-46-110.hawaii.res.rr.com. [50.113.46.110]) by smtp.gmail.com with ESMTPSA id f8sm533815pfv.100.2022.02.23.14.31.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Feb 2022 14:31:48 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 05/17] target/arm: Pass outputsize down to check_s2_mmu_setup Date: Wed, 23 Feb 2022 12:31:25 -1000 Message-Id: <20220223223137.114264-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220223223137.114264-1-richard.henderson@linaro.org> References: <20220223223137.114264-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::431 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::431; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x431.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: , Cc: peter.maydell@linaro.org, qemu-arm@nongnu.org, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 --- 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 71e575f352..431b0c1405 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;