Received: by 2002:a17:906:b28b:b0:78d:9097:c95d with SMTP id q11csp750159ejz; Wed, 19 Oct 2022 20:23:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5RSenIHNOC0Mk50Jdwyg9JlmHqyuIU9UvKceLW58OWwBswvYQMFNHFH6Yn0T4hv3hZQcbn X-Received: by 2002:a05:620a:1a20:b0:6ee:d757:d43b with SMTP id bk32-20020a05620a1a2000b006eed757d43bmr7823382qkb.538.1666236197791; Wed, 19 Oct 2022 20:23:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666236197; cv=none; d=google.com; s=arc-20160816; b=KmWr4cIgAV7PkhvYU61PW4srxx8+tpb21sqjhDJ3mZwhte7tsk7qffVOe2qDTQwZh5 MTgc7YJAMCrG+LRisCoI6HSG9jCPLvoNCnC7Q5cD0VnhBDNM1k5HXnsvio/nukfYyg7J D0nDT4LopAlymZVle1Y47rcAlNwWNDu1sdVU8uv6F8A3EkasMn+j2Wy1XM1Ul35a+Pv/ bhX7XeXuVZB9L06uU7qD5xR/BGdIEn4nxF16UjGz+mFUfE1g8LS62/0IqwPiGCHqAjDV qWJIUInyhcmLAD8v+MrhftdQvPTkJf+6zj0pAECEUUbUs4Txe6AfY7fgno60Lz9Xoek+ 9nLg== 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 :in-reply-to:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=vXZCl72guOE22w6Ah8XQdxkS4ltgUPMha9r4z5HCjY0=; b=rIeWHThObJVsqngACjo2DyFgl8InK+ugVdVIXKxLXpDm0KuLSI5wdrED16z+qzTumF dWHVPKhK2e3KhtRYAWvmFnfow22oQjjNDX0UNsvIfpqjv+G8FXsMaAvTCrB/Nj9fVYSl N6+QwvfEaX+FY0XUaXdbFZ3fH4d++PEBvZU/0yBqHL84WGAKd1si74S4F6PrzpsgD0f9 /H4cH86HUFIx3iTwDsVxoKNhL9lucEAHn7XxeavSCV6T1RQorD7ppdJVK3oVrZJdd7i5 yB3TCqqaplrLHM2Nn3Env2VQGur6bLTjwllK4PA0SQ+6tXqaHQgX68+7uFmTET7ubtGl 32JA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CoOGoFyT; spf=pass (google.com: domain of qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+alex.bennee=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 b129-20020a379987000000b006ce7d23c961si9359602qke.393.2022.10.19.20.23.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 19 Oct 2022 20:23:17 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+alex.bennee=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=CoOGoFyT; spf=pass (google.com: domain of qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:47358 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1olM9N-0004v9-6J for alex.bennee@linaro.org; Wed, 19 Oct 2022 23:23:17 -0400 Received: from [::1] (port=59170 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1olM5D-0002JQ-Ij for alex.bennee@linaro.org; Wed, 19 Oct 2022 23:18:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42374) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1olM37-00084P-Gf for qemu-devel@nongnu.org; Wed, 19 Oct 2022 23:16:49 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]:34367) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1olM31-0007Gq-F9 for qemu-devel@nongnu.org; Wed, 19 Oct 2022 23:16:48 -0400 Received: by mail-pf1-x42f.google.com with SMTP id f140so19075985pfa.1 for ; Wed, 19 Oct 2022 20:16:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=vXZCl72guOE22w6Ah8XQdxkS4ltgUPMha9r4z5HCjY0=; b=CoOGoFyT59/JiQllsW8C2wHDTjOeC8CE9s1t379rLfws+JqdGogv9ErgHnKrOu0Dmj AIC+t//7daw3hQt+9RALMt8py+lUB3KprvdOvjEDaw4/FOH84uV8HwM6rPZ7Gjv3cpqw 18iYKht+BHjUzXeLVsrQkmBwK+BcHZ2BXweC5poX4GnmCWhv7HJdDUd8nTYFokuqGXrj HwGC67njhNdLcfRM/BRwpqLUcnZ79j85Cy3JT/UBwWf+UyrG/w+ZV1g1nFRq/YNh8gGG rwZcKL4QO63NS5BxlSNsJP8E/QhUSd+wP7TURQRod1eN7Mm/Dx9feMwTY4qi/J0SdUVs +s9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=vXZCl72guOE22w6Ah8XQdxkS4ltgUPMha9r4z5HCjY0=; b=cmcyUxRzYskw6Y+W+osSHe1CxdeDWKilGcsSB+hf1g+4TtLf/SgWu1Z0dio6xW8OS0 NKB3tiQF4RvP5yY2GGIfYAWOQhWbUdRYbESjSruMzXADOtvZ5yG8dnuuPzumu17oeSZ0 ohfRrDsOUmLv2vvPFYBgFHlFxUcT45TGgOHk+cOCpO197xiP7RbEjU/a3cP6Ou0YH0/9 KiuvXKZsc2UIKAvDDr/yu8KAv12kM6s5/V1vdzM3yt4H/YcQYBxPYkaDShqgSg2yeB1m 0G7MTzqZ/S9P844jvEEiemvAZqOlHVNefvg2Uw6xafHe0xQViIPa3dhNxT5eaKQnywmf qCrA== X-Gm-Message-State: ACrzQf3OrVadXxrlTp/IEBGarC2sQnqlOePgdD9/EFiPuyPA8xbWgcWy Xs8uqgAcIIBIhuAq1WK6iresoA== X-Received: by 2002:a63:4517:0:b0:464:4f06:a0f1 with SMTP id s23-20020a634517000000b004644f06a0f1mr9624086pga.509.1666235802141; Wed, 19 Oct 2022 20:16:42 -0700 (PDT) Received: from [192.168.1.107] ([149.135.10.35]) by smtp.gmail.com with ESMTPSA id kx7-20020a17090b228700b001f559e00473sm632343pjb.43.2022.10.19.20.16.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 19 Oct 2022 20:16:41 -0700 (PDT) Message-ID: Date: Thu, 20 Oct 2022 13:16:35 +1000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [PATCH v4 13/24] target/arm: Add ptw_idx to S1Translate Content-Language: en-US To: Peter Maydell Cc: qemu-devel@nongnu.org, qemu-arm@nongnu.org References: <20221011031911.2408754-1-richard.henderson@linaro.org> <20221011031911.2408754-14-richard.henderson@linaro.org> From: Richard Henderson In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42f.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, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=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+alex.bennee=linaro.org@nongnu.org Sender: "Qemu-devel" X-TUID: JbEjOBJ2Mzfj On 10/17/22 20:01, Peter Maydell wrote: > On Tue, 11 Oct 2022 at 04:30, Richard Henderson > wrote: >> >> Hoist the computation of the mmu_idx for the ptw up to >> get_phys_addr_with_struct and get_phys_addr_twostage. >> This removes the duplicate check for stage2 disabled >> from the middle of the walk, performing it only once. >> >> Signed-off-by: Richard Henderson >> --- >> + if (!nstable) { >> + /* Stage2_S -> Stage2 or Phys_S -> Phys_NS */ >> + ptw->in_ptw_idx &= ~1; >> + ptw->in_secure = false; >> + } > > I feel like this bitwise manipulation of the mmuidx values > is leaving a landmine for any future re-organization of > our mmuidx use. Can we do this just using the symbolic > constant values? I can't think of a way with just symbolic values, but I can add BUILD_BUG_ON to validate expectations, so that it's not a *hidden* landmine. :-) r~