From patchwork Mon Feb 27 14:00:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 656993 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp2370029wrb; Mon, 27 Feb 2023 06:07:49 -0800 (PST) X-Google-Smtp-Source: AK7set+gkxoCAx/ZfxmqLOQn82RKVNf5Ymy79uS7LMP69Tf4HKkmKqvCYgzhRI+KNkQ4mYML04BF X-Received: by 2002:a05:6214:d6a:b0:56e:b298:8e13 with SMTP id 10-20020a0562140d6a00b0056eb2988e13mr47275876qvs.25.1677506869314; Mon, 27 Feb 2023 06:07:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677506869; cv=none; d=google.com; s=arc-20160816; b=z+G6c52jEzMVIct3p3xKAvSlHyFgGMisZcndJ7k3LT4G2hlfkc7S9peAPAwXvXg/Xu k6cVocbRBwzwBFrOxbxxts0sLhrJ7XdHaVvIi7DrPbf+W4hIdmaaP0HpyUOZxkbPJHZH TDP8Qm3SQckPLD+z4sKlL+8oyN1VTANj0WeahwEokrNN2dUUkXcc8WPOF2BaeiNe9zDp 9ir0vCiTMiLc8/wwgjP7OuCX4yAtnnw+f+6CEd2IewXtlzbwtHTXEvf1ZrIqBz1shOA9 iey/kz1z0XT/bWjuS95FK8xFmjPZpNgsMY5t3os0pGcbAVma+0m439sZt3WHs3j4Rn+q gUNg== 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:to:from :dkim-signature; bh=BY+O27vkTKz7VveF8F3o+v7d714AMEm3Jk9i5pC/EpA=; b=hoGsPWHmLR+ahB329Rwc/OKF1uU5l5wBVg6tQdvRh8oeuYZT7t/SP1DahasUJRPlkH RTM1hSQU05mr9BoG0l3YiSbEJT8VAU80GqIfUcIw9XXnn1FeC3xbw6eJNHQBDIM+gA76 i4nptqyYyzXPdnIx/+Pf0OkmI4+W0Rl4TzsCbwI/6z3IL6HWNL5gmzx5Zm2fDArplFK0 Kze63UElHDU/qp+sfhWjBzGUdkwH8Qcm7evLZqDbw16jVnJTzbBjG4Xjb9H4sgkNnv8g PSi5DH6j5IFQKfxglqJGerCTsalla+1lRZiss8wIWMBFgYy4FpIZ0pz2xdWqPkTIi3uU se2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dHcCV7Kj; 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 a19-20020a0cca93000000b0056c20827442si6515727qvk.485.2023.02.27.06.07.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Feb 2023 06:07:49 -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=dHcCV7Kj; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pWe7i-0003rR-Eb; Mon, 27 Feb 2023 09:05:02 -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 1pWe7Y-0003ke-5J for qemu-devel@nongnu.org; Mon, 27 Feb 2023 09:04:53 -0500 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pWe7W-00082X-El for qemu-devel@nongnu.org; Mon, 27 Feb 2023 09:04:51 -0500 Received: by mail-wr1-x435.google.com with SMTP id bv17so6352412wrb.5 for ; Mon, 27 Feb 2023 06:04:49 -0800 (PST) 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:to:from:from:to:cc:subject:date:message-id :reply-to; bh=BY+O27vkTKz7VveF8F3o+v7d714AMEm3Jk9i5pC/EpA=; b=dHcCV7Kjta0W2eSKYtRuURLnrNxhVybgIc7fmqDUNArr9FkdmB9cDOsrP2HfItAWox Qg+5eS9LALDQzN04N0rTtiOvnnEWFHHf396BTb4J/RnelZ1PXAho1O1QJAeO8OWpVbam L3fZtGVRBcV9E4qy6PgwalrMicprcP1bIJ3wE3/B41JVN37h1fdCVW41KRtvfWUdEwUV J2U4gptzJwo7g9C86eg1FwI49GWZ/W6wBIHAqZHZGxWT66CbNVSXgyYa/wPM6Mbm2JYt ZMNa/UQqSkZWIy/3rZ8V0CKIYAk6TlTCrN3pnr+rGNunRP1btUGLelUtw4LDjBYmC812 aXXA== 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:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BY+O27vkTKz7VveF8F3o+v7d714AMEm3Jk9i5pC/EpA=; b=vxiat1SMs++NdwKm028CCNOYrj6+Nxn83f7mBiRJhDLn4E83hS1gIduWNc96mL8baj n0vog/eB/rCRLNB2lY2uVdcjnzLOJRgVpZsFL3c0vcBGYnYtH0YMU7aa3CmeFBL5oCJG ZoG3vzkVz2pSH29jEvHbhmXO+NS2XY3dOtOARPVWh6VRpES3FRv+wxfE4LeHQlr9NS1u smuCJC/KK+yqZRMkssAvBwPIKOC8HzbObfnpwv+XBctlABIDIbpcS9CnkdIHF9G7VRTW 1SZA/I7MmKvFZ3tfBYpa6/Ic4eFNQzQTJKQW+nylOqZ8+M80YJTEczqYQiVl6ila7LCM nTdQ== X-Gm-Message-State: AO0yUKWtDNwjdgMNhng9nApU7L8iAT1f8ClqLItNlQh+RgxXwh3bdh00 mdgl1ap6x2l9PQiL0Gc38oH9k58mWIV06cOA X-Received: by 2002:a5d:4952:0:b0:2c6:e861:2a49 with SMTP id r18-20020a5d4952000000b002c6e8612a49mr20260197wrs.59.1677506688720; Mon, 27 Feb 2023 06:04:48 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id p2-20020adfe602000000b002c561805a4csm7340780wrm.45.2023.02.27.06.04.47 for (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 27 Feb 2023 06:04:48 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PULL 038/126] hw/cpu: Extend CPUState::cluster_index documentation Date: Mon, 27 Feb 2023 15:00:45 +0100 Message-Id: <20230227140213.35084-29-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230227140213.35084-1-philmd@linaro.org> References: <20230227140213.35084-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=philmd@linaro.org; helo=mail-wr1-x435.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 Copy part of the description of commit f7b78602fd ("accel/tcg: Add cluster number to TCG TB hash") in tcg_cpu_init_cflags(), improving a bit CPUState::cluster_index documentation. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Maydell Message-Id: <20230216142338.82982-2-philmd@linaro.org> --- accel/tcg/tcg-accel-ops.c | 13 ++++++++++++- include/hw/core/cpu.h | 2 ++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c index d9228fd403..aeb1cbaf65 100644 --- a/accel/tcg/tcg-accel-ops.c +++ b/accel/tcg/tcg-accel-ops.c @@ -44,7 +44,18 @@ void tcg_cpu_init_cflags(CPUState *cpu, bool parallel) { - uint32_t cflags = cpu->cluster_index << CF_CLUSTER_SHIFT; + uint32_t cflags; + + /* + * Include the cluster number in the hash we use to look up TBs. + * This is important because a TB that is valid for one cluster at + * a given physical address and set of CPU flags is not necessarily + * valid for another: + * the two clusters may have different views of physical memory, or + * may have different CPU features (eg FPU present or absent). + */ + cflags = cpu->cluster_index << CF_CLUSTER_SHIFT; + cflags |= parallel ? CF_PARALLEL : 0; cflags |= icount_enabled() ? CF_USE_ICOUNT : 0; cpu->tcg_cflags = cflags; diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index a5aa44d12c..7fd6657039 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -272,6 +272,8 @@ struct qemu_work_item; * to a cluster this will be UNASSIGNED_CLUSTER_INDEX; otherwise it will * be the same as the cluster-id property of the CPU object's TYPE_CPU_CLUSTER * QOM parent. + * Under TCG this value is propagated to @tcg_cflags. + * See TranslationBlock::TCG CF_CLUSTER_MASK. * @tcg_cflags: Pre-computed cflags for this cpu. * @nr_cores: Number of cores within this CPU package. * @nr_threads: Number of threads within this CPU.