From patchwork Tue Jan 21 11:40:46 2025 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: 858946 Delivered-To: patch@linaro.org Received: by 2002:adf:fb47:0:b0:385:e875:8a9e with SMTP id c7csp148123wrs; Tue, 21 Jan 2025 03:43:12 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWvRtxX2FfqEohuvej2msQnTyIM9kGk8WeJ1Ij9OdrTDCam58Zafovqd7xg2f4jrmHtRiRZFA==@linaro.org X-Google-Smtp-Source: AGHT+IFiueMXF5vHc0E51/sMAl6KIk/rFsDUU9Fjnao8Fr1R8k+IMNREOzTIq/fX35/feLlnYGT0 X-Received: by 2002:a05:620a:2686:b0:7b6:6ffc:e972 with SMTP id af79cd13be357-7be63219967mr2937596885a.5.1737459792572; Tue, 21 Jan 2025 03:43:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737459792; cv=none; d=google.com; s=arc-20240605; b=gSxwUEiP3dxcYVT/CrVozvCWnptF3KPtBVeXb4EqPwqJhhnepm9HIy18IPe54pAYuG NHAGGIyhWgCAVRcuyJGdKlzV54bvvEVd6dNM5iF1N78Rpdy9L0ECr16Jv22C0HEUX7hY 2J++o+unPoJ4ALe+93COF7ufwpkNLk5kUlUK1Yf7lTi4YwSVOA8tFoMa98KQi4BjV18q sXS9i3syDX8iYghm+Ap+qWyUox2QmZi6EQYHGRxhdF+qb0jQzxmnmfG0L5Lfym4n96+d bWFiwLE3tjhWUYHXlCFRGdyDeI9BoCynn2krdMdQ/iOx6nUOw707jBvys/sDwru+Hwb3 UZpg== 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:cc:to :from:dkim-signature; bh=FMaF6+Wa5WYYaGZJTTHWyD0ctSisYPOSoq9ZRxR4GzI=; fh=B7PgRO6ceoQX9QVqUxwheTZYUs+aKW2naPWg2jE2ats=; b=QbI1IlrxhtSYCVwRzmohYrGAS5CHvaw8oWy71nZ9LCjSZnjEgauN2ImrTRnhjYBIvE KiSkV3xDEIbEi4oVIP6EamaJiWl9v2RZLSEmwZIKdMdLv1uK6N9lXnohCZAKNe53VeTU GoTdHXtEmqW2NukoZD1YSx/CVSI2WYvjNQeaY55C8T1vzrOBlyQHhxGCHH4DMv8lv7Xx I58Ic3c2Wf7rDTkqn53tzt0zsFhQdPs7fVlRkX4dO5BQvZ4ZY3XIljNkbi74sTdsY0xx ep665xCn8G/z7Eweufo8MG61amm09bXjGhleNDQ7DUxK/t+JLwAgXnFlR4KsLf1bVcZY F+Aw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ThHmGR80; 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 af79cd13be357-7be61477a49si1208261485a.159.2025.01.21.03.43.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Jan 2025 03:43:12 -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=ThHmGR80; 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 1taCd8-0004xA-Nr; Tue, 21 Jan 2025 06:41:14 -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 1taCd6-0004vp-GZ for qemu-devel@nongnu.org; Tue, 21 Jan 2025 06:41:12 -0500 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1taCd0-0003KH-AW for qemu-devel@nongnu.org; Tue, 21 Jan 2025 06:41:12 -0500 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-4362f61757fso56490985e9.2 for ; Tue, 21 Jan 2025 03:41:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737459663; x=1738064463; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FMaF6+Wa5WYYaGZJTTHWyD0ctSisYPOSoq9ZRxR4GzI=; b=ThHmGR80lbQgQQ081h5rrGm1TLSh8wKDufGenbg3tXEC9+g84uRTm4kweJco/NxQ8e hnPp12BKT3MkZ9TJr+CJFgOgaXLVYioDblj0R8ty5+jm+Fr2qmfFtg++vGd3WxyHNwX9 1Wqk7onitcDsMNz3kkwcQSA3L6KAEPZklGPCZ5qizZMYSSKQW+jC32VTWu9x8Gi9lNOF 2sUMUmZg0GWs4C9TLjgDuYeRn4YdXlEZl3Ck2xu85LgEoT90LUSPYOiSbiamzMV6nHfF lt2dmj4xcBFC21pnfOYhWwKCY8wfaVna6ox5lQ5K3QElSXAMM3YJUMHKg9jUglRX7OSL GfWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737459663; x=1738064463; 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:message-id:reply-to; bh=FMaF6+Wa5WYYaGZJTTHWyD0ctSisYPOSoq9ZRxR4GzI=; b=LrVnFMcSV10GUflNVX5q9XpsqGUBCQC08cWoYe4FoUi5CvRjoTUXEnoFLY4QTF918f SI5rkdOMugiZ44v16DP9llGkZzSKTGa6CZ/Urfm6TFjVx/ui1eo7lXQ681HGGRwD6RyT GIIOtCYa4Up+VStbkURsSV9+cK3D9voBFT2tL5od+PG39xBM6Jk3ifBvZ+lLqzFK3kty Cltx3DKehWNgRrDJ8LrQ9rb0b60Sn2o0CzlnWh0DLz6nCEIAj63tV3h8mr588Hg+hASL f0YrZUK80W3p4erl3i14rB9zGSPGcXCSqy5g+r6Gle2wZkGb8M1705Jx4D+yxzTJ6Vsn dLIg== X-Gm-Message-State: AOJu0Yz8nNJn5mnVDy4DkIRF85ZYWj7Vga/SRHMng5Jajji7N8/mFhUH HuPiEA5PrBpFxVeJIuWelwGpWzkAUK8/C1ZuaWeVvy3h+TpZ6LZqdDwA1KlrWZXSywT7uA0Fd8D UU4E= X-Gm-Gg: ASbGncuRWAKRxV5/VeFhG0RDGGRoYLmgHgfZHHZPuLLQnbLmugdIKMmQw8UqpLTyruq ll1cmQBFsIBlFk0GXilRnXzkNVlt2a+QqNq2whje2jKUvtJZxHRQRVunbexL9qqOEetH+gHmOkh T5SrEATfc0YiL5439alAZlpHPSwCZ7XG2UqsKoviyjR+1Jwr/aZM8FIWg4x0Yn46urqrLqkCev4 aDZUzgExiLknWziCR0hcuHXG8U70GVR2x1l2t+Dmy/LNtab6yLIdL/FxrkraLwPaJCECGW5o13i FcYRVVO4UDLFjMOBNgHk9nCDzgImhvqFsJQbG3RTmiIH X-Received: by 2002:a05:600c:b8c:b0:435:330d:de86 with SMTP id 5b1f17b1804b1-438912d2c48mr162947445e9.0.1737459662693; Tue, 21 Jan 2025 03:41:02 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438904625f5sm179480395e9.28.2025.01.21.03.41.01 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 21 Jan 2025 03:41:02 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , =?utf-8?q?Alex_Benn?= =?utf-8?q?=C3=A9e?= , qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 01/11] cpus: Cache CPUClass early in instance_init() handler Date: Tue, 21 Jan 2025 12:40:46 +0100 Message-ID: <20250121114056.53949-2-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250121114056.53949-1-philmd@linaro.org> References: <20250121114056.53949-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=philmd@linaro.org; helo=mail-wm1-x32b.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-bounces+patch=linaro.org@nongnu.org Cache CPUClass as early as possible, when the instance is initialized. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- cpu-target.c | 3 --- hw/core/cpu-common.c | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cpu-target.c b/cpu-target.c index 667688332c9..89874496a41 100644 --- a/cpu-target.c +++ b/cpu-target.c @@ -134,9 +134,6 @@ const VMStateDescription vmstate_cpu_common = { bool cpu_exec_realizefn(CPUState *cpu, Error **errp) { - /* cache the cpu class for the hotpath */ - cpu->cc = CPU_GET_CLASS(cpu); - if (!accel_cpu_common_realize(cpu, errp)) { return false; } diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c index cb79566cc51..ff605059c15 100644 --- a/hw/core/cpu-common.c +++ b/hw/core/cpu-common.c @@ -238,6 +238,9 @@ static void cpu_common_initfn(Object *obj) { CPUState *cpu = CPU(obj); + /* cache the cpu class for the hotpath */ + cpu->cc = CPU_GET_CLASS(cpu); + gdb_init_cpu(cpu); cpu->cpu_index = UNASSIGNED_CPU_INDEX; cpu->cluster_index = UNASSIGNED_CLUSTER_INDEX;