From patchwork Sat Oct 1 16:22:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 611380 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp272788pvb; Sat, 1 Oct 2022 09:25:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ZqlJGl4tOMhAeSPlJ5UuYeGftrLZeUTkd2OC4JhpEgvZavaBXM16OhaLRquFNV7s2Hq29 X-Received: by 2002:a37:6456:0:b0:6cf:135a:87f6 with SMTP id y83-20020a376456000000b006cf135a87f6mr9435757qkb.227.1664641513792; Sat, 01 Oct 2022 09:25:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664641513; cv=none; d=google.com; s=arc-20160816; b=XWP4Hv+xId15AW6wYh5zQcffnxESDXqLaCZJvB9zbQex4Y3xauqfPM2nMzIbWkgpWl ys7tLyyOgord8kupDR27POQ8CzcF/ThyhcOCIujKYX3f/h5Aesjt4vVnpogROCcYSrTs lDWLOGtNiU7fp2ATfhqb6C2WPbLJd6Tv18pPuMv5HwDHJJtAfYa5wXRY6HZ+/A8E/Je8 3Vvmmgabi+SKy/uVitlnrC/Auzq3uvd4YY21PHN4y2hKuWkOjELSVocftUQKF+CpkZ2D N1Xz7ucA9gzR/D7gV6jsJ4f+QaKOX2Jj+o2exBfahGRlFcMWWoe3WdWQK6yW4h2RHvU+ UQcA== 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=4KPhpY52J+00g3rHXmwrM1G3yOLaxgKqSa5cCKMMs9A=; b=MMfCagFFp6Bc8EYqV5dWKzf5ZBmIUiHR+S8lTLfKJkzULW24mp97ln2HtstZ3rIicG vBoOunatebHlDAu9jDvExlLzeGHW3ViSoiyIViRZ8JRz7lepRSF3zqDeX3Qc3O0ojRhd kCN84rJPy/EC4shnUlt3jvd/7eWOPF+vHNqgi7PqBy8tjFMdSnIlsL7nT3x25adp4pna 6tZCwy/CgTovnFq5bniyXC22MMoD1Pg2yuOSbKrFgS18E65CflKXwYJBWTmwy6MRfYrR eVKwLh+kbEyplKBTInIvaJf6NeGuUe+PjOlGCJNPjnviEICYfhM/gczx8v7r5RZbEyJm DIxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=u9Wvim0c; 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 bk17-20020a05620a1a1100b006bb15b4bb57si2595290qkb.64.2022.10.01.09.25.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 01 Oct 2022 09:25:13 -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=u9Wvim0c; 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]:35378 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oefIf-0007EE-05 for patch@linaro.org; Sat, 01 Oct 2022 12:25:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38972) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oefH4-0006Um-00 for qemu-devel@nongnu.org; Sat, 01 Oct 2022 12:23:34 -0400 Received: from mail-qk1-x72e.google.com ([2607:f8b0:4864:20::72e]:44922) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oefH2-0006E9-E3 for qemu-devel@nongnu.org; Sat, 01 Oct 2022 12:23:33 -0400 Received: by mail-qk1-x72e.google.com with SMTP id y2so4533095qkl.11 for ; Sat, 01 Oct 2022 09:23:31 -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:subject:date; bh=4KPhpY52J+00g3rHXmwrM1G3yOLaxgKqSa5cCKMMs9A=; b=u9Wvim0cMQjf9esrozY6ssOA+U9vwHLZPGfHv57i3jsrfPtwL84T1AueH/E+xQNZXH 6tPsMJfuMJybXISYCK/c7WHNA9KBSO/OBhQ30qQfc8VBobhjwn/975FVMS0odocg1voq H+jJVFO0UNb1UO1MQNkTL+V3fgxlDy0ucMC2eVqh7sdX/JoR2fSHdLbYDD20YYMc/dqL DHb9qSu+aO7tFYh5wHHHB2ByehveodQSbl9cvW8iaYhYiFX5XTXlh2pmI7Y8jcnlpNvh C0SJRzl705cqqmFUJ98k4hz6P9vmO1vDFTx2ap+xFUs1F9/AbYYZ8V6JTcPmmeVlxyI4 KR9g== 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 :subject:date; bh=4KPhpY52J+00g3rHXmwrM1G3yOLaxgKqSa5cCKMMs9A=; b=DQFIeklWAwT38sI3caXOX5MeER9UxwGgaG7z/0jUfENG3pyMMZ6jMIrBQ/5H0vnfrs diZvNY+9FrJjKG9Rem46qUD5mBxm3nK//Q90QAEoOFfURdcI1A5MyjZEaqbh4eNhrfEg 8Rs1aCG0oUmUCc05F5LoskL8GOXsXzxFQ7Xm22Au/8Qm1Vd1vbEmIhKFI1Ygac7qGq/L OYRK4AlxHgYMm4MFZbHT5uV7JOvX8LSFMP5j4Ebdoz3Q1X1qKRn1toVQxjuAZssMhlZO fbH88W/OZlwG3WyyA7Il/ZBm8ZinjhYzS3DXUhRml7KsnrWjAhq8C3QfdIxEaS4CdWQl W8Ng== X-Gm-Message-State: ACrzQf0vDcFzT3evRcRnOjDwBsj/jQrvf5MmZN8TnAQhprckI+1RNDb9 ts9X99R2gftx1C7HIsbkWJnQs4z2WK3fMQ== X-Received: by 2002:a37:c443:0:b0:6ce:191a:bb60 with SMTP id h3-20020a37c443000000b006ce191abb60mr9577433qkm.53.1664641410360; Sat, 01 Oct 2022 09:23:30 -0700 (PDT) Received: from stoup.. ([2605:ef80:8084:91a4:f7cb:db31:c505:b931]) by smtp.gmail.com with ESMTPSA id t4-20020a37ea04000000b006d1d8fdea8asm4387445qkj.85.2022.10.01.09.23.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Oct 2022 09:23:29 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v3 03/42] target/arm: Fix S2 disabled check in S1_ptw_translate Date: Sat, 1 Oct 2022 09:22:39 -0700 Message-Id: <20221001162318.153420-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221001162318.153420-1-richard.henderson@linaro.org> References: <20221001162318.153420-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::72e; envelope-from=richard.henderson@linaro.org; helo=mail-qk1-x72e.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=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" Pass the correct stage2 mmu_idx to regime_translation_disabled, which we computed afterward. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- v3: Move earlier in the patch set. --- target/arm/ptw.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/target/arm/ptw.c b/target/arm/ptw.c index b7c999ffce..5192418c0e 100644 --- a/target/arm/ptw.c +++ b/target/arm/ptw.c @@ -200,10 +200,10 @@ static hwaddr S1_ptw_translate(CPUARMState *env, ARMMMUIdx mmu_idx, hwaddr addr, bool *is_secure, ARMMMUFaultInfo *fi) { + ARMMMUIdx s2_mmu_idx = *is_secure ? ARMMMUIdx_Stage2_S : ARMMMUIdx_Stage2; + if (arm_mmu_idx_is_stage1_of_2(mmu_idx) && - !regime_translation_disabled(env, ARMMMUIdx_Stage2)) { - ARMMMUIdx s2_mmu_idx = *is_secure ? ARMMMUIdx_Stage2_S - : ARMMMUIdx_Stage2; + !regime_translation_disabled(env, s2_mmu_idx)) { GetPhysAddrResult s2 = {}; int ret;