From patchwork Mon Aug 22 15:27:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 599190 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:4388:0:0:0:0 with SMTP id w8csp1877749mae; Mon, 22 Aug 2022 11:34:42 -0700 (PDT) X-Google-Smtp-Source: AA6agR7zJrNySrfrvJqqqMJf/LrEtqZRFbiJI+7pTxxKx1yq1vnWEVTM57JcVXaIbANgF5uZb6TF X-Received: by 2002:a05:622a:1aaa:b0:343:6d4e:25d1 with SMTP id s42-20020a05622a1aaa00b003436d4e25d1mr12541440qtc.385.1661193282827; Mon, 22 Aug 2022 11:34:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661193282; cv=none; d=google.com; s=arc-20160816; b=OpLYzGGMj/RiDw/ftwhYRM/sletw6iXrcnoMGgxvarkBAhTcAjF33nm/KEPjxFXAPJ UGBBeSWQIeg4+YoErWIZj1CkELIfAYWciuj8ObwaEiOKEPwNCxY1eycIPL1o4ruf5XX+ S+nGY1hcxe7q55XRkjN+6a6hwgP87WW0d028xoa+Jeayqe7ZnvULII3tqy25pLgnw0H0 9/BLMOjhwIWn6OED7AWeXAeqbGddZTrSVAzHwEvycCp5ZySNZhb4wcCDP349rFY0BHIj lUdGOOfUV5fyina0MKcgzZDQqgYxU2p2LZ7PU/wghq3+Ra59OR0otiW6U/PhppC8eZI1 JLng== 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=tCVH1Kl59BnkmKbSQf/4G0BExsgfIMMri2yi/FRxOQo=; b=ltDP0bY1ETlyVNvpFQRCqaDO8qVN/bzd4t3LNetKPHAQYmISesFQv/Rww0Vo3WDt+N P4wQLnt11/6aDenhT4YBaKYi/Es71IAlIvfrO/62mWRunIaQ7L2W+JefY7RRIVWBUHDY lX5jsnvmTfU6cOrzKvpURigIY8SZFWYXe+FNSVZr5zZrIR9nJaQbXUTRXaQOUiyzgeAF wua2DBPTHJdzdweoZVCFmwdBb7MBolkUmyou98vvo46bDtk/S+7cfSq+O8/6vOJG3rZo K5ZXhYoDXCthq7xKhmkI+VwIeKbBNjbPMu5UINqSWGiJjD9wEQDrvEHzxM1OfZO0NRU4 4zjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=F6o0yTuF; 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 ci18-20020a05622a261200b00316cc5b2e9fsi5386747qtb.8.2022.08.22.11.34.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 22 Aug 2022 11:34:42 -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=F6o0yTuF; 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]:56606 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQCG2-0007lG-CO for patch@linaro.org; Mon, 22 Aug 2022 14:34:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58286) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQ9Ox-0004kj-Ml for qemu-devel@nongnu.org; Mon, 22 Aug 2022 11:31:47 -0400 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]:55829) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQ9Oj-0001e4-5T for qemu-devel@nongnu.org; Mon, 22 Aug 2022 11:31:35 -0400 Received: by mail-pj1-x1031.google.com with SMTP id pm13so2434571pjb.5 for ; Mon, 22 Aug 2022 08:31:28 -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:cc:to:from:from:to:cc; bh=tCVH1Kl59BnkmKbSQf/4G0BExsgfIMMri2yi/FRxOQo=; b=F6o0yTuF+CPWWucyTOzZen4xOlYTgXOFmhfJlkIBCB9av7gMgv3kFLemjenTVKlH3A xXth4pFoayFQP/CaJqaKOxJwst+lIhuqszvTh4aGXKis7QIh1TFZrhAtvLJLY6l43QLv ellNdKvLc1EPo3Ha+qfJWzl1MwXPmwplBogMnGTJOCbAS+mM+g4a+hb53WeOOWi5OZUC 3nFYZEUTw4D1WDScSvc1Xn4aUj5nhvu7/p2mffIi0M6vzt8lRxMRZ2lgp5Wb920W0kj/ ulqJ+JKQmyIixr5wHssiUyneGoJ3VNvIr82GJko/ZlbNvyqbFZ7uE0QzBcFqoRMV1ptA XGSw== 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:cc:to:from:x-gm-message-state:from:to:cc; bh=tCVH1Kl59BnkmKbSQf/4G0BExsgfIMMri2yi/FRxOQo=; b=Th1hVyw9IANgIMSq6UDPG6f4x4NVqC2qYk6I0624iWyMyyzHVJrz+/KGttLQStCY6e oXZnPQQ5JoyE7/Mkah+uFQvrS6StujraTI/3mGo7+jFC5+HkczQjGMr03IvtX4i4Q8PE gTUo3paZC4Nfd3tupZwIsbnpdfeiDQBVmUchCSfTNq9akmDoZK1yCJqDj/R5mL363cqg GNYg8d531xVI4KZixovxauQFFmpAgVzOoHiMssjdXtXxkrXAvSEzhIc8GzE39qXjDtWA tlQwHGdabBKrPTjOTs56NUphart5x+OmK1ol0PXtnHCtWPv0aX+dUE04vFgvnza89Ahi NuXQ== X-Gm-Message-State: ACgBeo0/oljtyxQH07LvdB+ybjSFPsQ7yINFQTzx88i2yJOm3CJQcRVm ATBFtT8KumtvIr/EGO+hDZ4oszsuEv7u2g== X-Received: by 2002:a17:902:f64f:b0:172:a790:320a with SMTP id m15-20020a170902f64f00b00172a790320amr20671005plg.149.1661182287920; Mon, 22 Aug 2022 08:31:27 -0700 (PDT) Received: from stoup.. ([71.212.157.236]) by smtp.gmail.com with ESMTPSA id i6-20020a17090a3d8600b001f262f6f717sm10353835pjc.3.2022.08.22.08.31.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Aug 2022 08:31:27 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v2 51/66] target/arm: Hoist check for disabled stage2 translation. Date: Mon, 22 Aug 2022 08:27:26 -0700 Message-Id: <20220822152741.1617527-52-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220822152741.1617527-1-richard.henderson@linaro.org> References: <20220822152741.1617527-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1031; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1031.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" If stage2 translation is disabled, E1&0 translation is just a single stage. Use the complete single stage path rather than breaking out of the middle of the two stage path. Signed-off-by: Richard Henderson --- target/arm/ptw.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index 628c046cab..d9daaf7536 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -2437,9 +2437,10 @@ bool get_phys_addr_with_secure(CPUARMState *env, target_ulong address, if (mmu_idx != s1_mmu_idx) { /* * Call ourselves recursively to do the stage 1 and then stage 2 - * translations if mmu_idx is a two-stage regime. + * translations if mmu_idx is a two-stage regime, and stage2 enabled. */ - if (arm_feature(env, ARM_FEATURE_EL2)) { + if (arm_feature(env, ARM_FEATURE_EL2) && + !regime_translation_disabled(env, ARMMMUIdx_Stage2, is_secure)) { hwaddr ipa; int s1_prot; int ret; @@ -2452,9 +2453,8 @@ bool get_phys_addr_with_secure(CPUARMState *env, target_ulong address, ret = get_phys_addr_with_secure(env, address, access_type, s1_mmu_idx, is_secure, result, fi); - /* If S1 fails or S2 is disabled, return early. */ - if (ret || regime_translation_disabled(env, ARMMMUIdx_Stage2, - is_secure)) { + /* If S1 fails, return early. */ + if (ret) { return ret; }