From patchwork Thu Nov 14 16:01:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 843161 Delivered-To: patch@linaro.org Received: by 2002:adf:9bcc:0:b0:382:184f:390f with SMTP id e12csp365432wrc; Thu, 14 Nov 2024 08:11:18 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCX5RNMHfM9AeyIBr7vRHLmWCxICUWOfXa8onVxAvY6eRSuXQyxCXZswyFJvMNoECi7DakBLoA==@linaro.org X-Google-Smtp-Source: AGHT+IECv6uV3aRWU9luqEBO6mYDSHBExozTyISDb3o2cM/RWN9FyGqbk5aL6WhNh2D5T5fNisaR X-Received: by 2002:a05:6102:26d2:b0:4aa:fafa:e100 with SMTP id ada2fe7eead31-4ad5863335amr3323816137.26.1731600677742; Thu, 14 Nov 2024 08:11:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731600677; cv=none; d=google.com; s=arc-20240605; b=d4+BsEexXAvl4zc4Ftp5jp+Cf4LkyGiUUH9DkHVe64109a1lzvqgphvdiyMQqUjQ8B nYG2AaISQbXCpBJP0IAU4Iir5PMy5gJLvjOoRXks3p42RZiKZyY1X2/UjA08PBmb6ghg HfRIfqlpyyLUZ03yQjFQoiShx964lpN1h9DHUQxgjLHKlY6MIkqZkDGLRYGiTm/F9v7j Nki0hEp2lT2qjntfRqN9OxwOMBFas0A7OrHXpfT/YeouyTyXFduRFQxBCpQgUAsQShuX MIZOP/vAi5VdOvCvgf3s42KNPI7PYZBdFmFTYy9DtakklumojuMYm9Oq/5q1ywGITa22 yTvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=AnWkT7tU0GDgeoHYcM5K7eCpXA9PnKUyZxtzeQFAarY=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=TI7WgPqADtu+F1Ngh8izgcriJHgUjEHVTgnECMILY7acM+Dc/gS2DySJ9PXw6fXAjk GTv6yeNexp4mPF31RDy1bfW9wXtI2jZSRa/TEttEV6B3zSsl8zs1+QwbfZGgLEwnm558 LOwVVAHZwuWo0faYfgXbAtAIQn16B8kh6ac9U6+1ahKwndhhfHFDaaKCwr21g7ZXiTj5 XZYKKDltxHYCCqAT+ywEL8uYlu9JxqZhi+iXSl+Lxp5VJF/S9XwutO7hyu4erTE5iQKC rA9U1zyo89VM/N/EKhuPPaAHj/AW+yTfaQBQPfgOBxrYXuSJkrfdb1DxYgGb4FWBM8e5 cZWg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xzsPK61F; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ada2fe7eead31-4ad59824b46si398299137.245.2024.11.14.08.11.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Nov 2024 08:11:17 -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=xzsPK61F; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tBcIT-00055f-4N; Thu, 14 Nov 2024 11:02:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tBcID-00050q-SL for qemu-devel@nongnu.org; Thu, 14 Nov 2024 11:02:05 -0500 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tBcI6-0002GH-2A for qemu-devel@nongnu.org; Thu, 14 Nov 2024 11:01:55 -0500 Received: by mail-pg1-x52c.google.com with SMTP id 41be03b00d2f7-7f43259d220so598426a12.3 for ; Thu, 14 Nov 2024 08:01:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1731600113; x=1732204913; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=AnWkT7tU0GDgeoHYcM5K7eCpXA9PnKUyZxtzeQFAarY=; b=xzsPK61FSnUindBobiONzn1KOBiD4SLunuIIgAkQ02i1kgRcs806SIhj8x58HS7oS+ mlX87IirUoVmD1dKtzDJz2P50ry6u/ElAHenTW6xktiDj1uRYf4lyReeCMcSVMYEHcGP eYWYxBN7ZS1f0lHx8IdL/yl1RgFPLsSbMBU8/COLW2C5GHkOfLPoDFHbL3rsGIbdfDl/ vJxaxk9mD8wll+fgp1PTqHfZDi1Z0tAZjZiQdhHA9lJBVo/lk3PEFn9qw6D3uOdnp0gg bjxyEF2MButakqYj5qyOKnk5Nz0ZHF3BObze5plbFPeEpzYGrD1ua2UHyk0Tcrejza05 8Z3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731600113; x=1732204913; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AnWkT7tU0GDgeoHYcM5K7eCpXA9PnKUyZxtzeQFAarY=; b=Y4emIzIf/1CauYYk2xrkw9ACQBOV3BdyGBnDe3rm0SbElPvfSFFRaKrd+ll9aGiOmL 4APecnxYeZbRtUfaXqsAdinNUsLpHQPB5YtruZZwyolYYz4TKIcWQWSbJpt9QxPrQkBs JViDgvQCSCQ3lWrQEOtPujMDFu2lZPk9dXtcDBb0gS/iPen2A8W1M7R9XvxtzAmgBZkm P9gEFbigfyTMXJYTc40rCbTg+vVvtPNPnheB4nSbdIpykQ9ZN3mIysDH+CnOEzvvj+zs j83Y5IWJ1PuXN6hndssrvDHDYgyPSCw/j46gNylRboo+EStI2rxR7D4DguipPqmnRigV ACXA== X-Gm-Message-State: AOJu0Yy6r2DLPMJysgAn6wpbxI5prccH27Ye4zV7IOo3rnq6747Z4BTw /WJq7rMEou8N2qq5tyGHHHLA65JVINVyLurwup5ln7Y2JgW91/UfKz21mHi6qeEtnmtbcolsipH e X-Received: by 2002:a17:90b:2792:b0:2e2:effb:618b with SMTP id 98e67ed59e1d1-2ea0636fd3bmr2866679a91.13.1731600112677; Thu, 14 Nov 2024 08:01:52 -0800 (PST) Received: from stoup.. ([71.212.136.242]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2ea024ec723sm1484438a91.46.2024.11.14.08.01.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2024 08:01:52 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 24/54] accel/tcg: Preserve tlb flags in tlb_set_compare Date: Thu, 14 Nov 2024 08:01:00 -0800 Message-ID: <20241114160131.48616-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241114160131.48616-1-richard.henderson@linaro.org> References: <20241114160131.48616-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52c; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52c.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=ham 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-bounces+patch=linaro.org@nongnu.org Before, if !enable, we squashed the entire address comparator to -1. This works because TLB_INVALID_MASK is set. It seemed natural, because the tlb is cleared with memset of 0xff. With this patch, we retain all of the other TLB_* bits even when the page is not enabled. This works because TLB_INVALID_MASK is set. This will be used in a subsequent patch; the addr_read comparator contains the flags for pages that are executable but not readable. Signed-off-by: Richard Henderson Reviewed-by: Pierrick Bouvier --- accel/tcg/cputlb.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index ae3a99eb47..585f4171cc 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1032,15 +1032,13 @@ static inline void tlb_set_compare(CPUTLBEntryFull *full, CPUTLBEntry *ent, vaddr address, int flags, MMUAccessType access_type, bool enable) { - if (enable) { - address |= flags & TLB_FLAGS_MASK; - flags &= TLB_SLOW_FLAGS_MASK; - if (flags) { - address |= TLB_FORCE_SLOW; - } - } else { - address = -1; - flags = 0; + if (!enable) { + address = TLB_INVALID_MASK; + } + address |= flags & TLB_FLAGS_MASK; + flags &= TLB_SLOW_FLAGS_MASK; + if (flags) { + address |= TLB_FORCE_SLOW; } ent->addr_idx[access_type] = address; full->slow_flags[access_type] = flags;