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: 13946203 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7D3FCC0218C for ; Tue, 21 Jan 2025 11:43:12 +0000 (UTC) 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-Google-Smtp-Source: AGHT+IFxIGaP83HpPmv6NXZkFq2jfmtvkIsdcXSRb5Ou3rbnTeLi0+ZTeJpHOJpXjMv4wJPlutsUQA== 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.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;