From patchwork Wed Jan 22 09:30:21 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: 859142 Delivered-To: patch@linaro.org Received: by 2002:adf:f78a:0:b0:385:e875:8a9e with SMTP id q10csp244627wrp; Wed, 22 Jan 2025 01:32:50 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXhTF2yvbInjfSx/i8v+1rg5d0VAy1zFL70eT4RIIiumbKIT7zZdIRUm+RyorkqZ79GedVD+w==@linaro.org X-Google-Smtp-Source: AGHT+IEPKKf6W0QAFFKGej1U1K1wnCLs+x9Bl993Df7pix9ojV4IDDKKdWbNf/YUDl1ForJ4KQYz X-Received: by 2002:a05:620a:2981:b0:7b1:5545:7104 with SMTP id af79cd13be357-7be523b9759mr4989990685a.2.1737538370441; Wed, 22 Jan 2025 01:32:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737538370; cv=none; d=google.com; s=arc-20240605; b=B8/KJvceKXOo60Rd7f+R9OEpWwJ03zMo3ohoPEGkuo/61k0J2G8am0sSwfmqlP0WGz YWssUiE8fUzIg/I7RjMzz9pcIwWuqM7nPMX+v0gmQkAako1c4OeTDET6NAv/misYPaib IQlxFiUtVU1y8V8DUii7SctPcx2eU5ea9xFrBs5MzrVtPnD/9hVxkFeloiNC+3IoVY2D ebbUsoHKHLuWwD79rto8DbnGCzNdQDht7fTGH82hpfqHrH0rU+3gNnecgyDlwANQzdIB +Fu8FGpIPTqonTOTesxfEoH6225QB+a/F52JeBTIrC5yCxe3WwBUpNSNhRpmDuGQcgur Fl3w== 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=JSvw35u1c/GeD9pKIKqf6WHVcOBbPhJhoq/j5sOwl2I=; fh=Brec4ZYd5wGCfOwL/9Q1OxqxWlcx8jJnKse3UD0zpBM=; b=iVSoG2wrsBTNBdb02Imj5zn4fqL9pedDOgSG/S6OpCduvfrR5b0CEuOwqueiGfmbgH 4oYv6UkcXyUNmRDhvw31MDHjVGeNUvExuOvUQKDUk3DMKb3BITPqKWOxc66XcrZ1Gj53 wBL8dC+mhj8SB8d2KhFZPVm59m95rpVEL63OzmnCRrj/0rgRB+osDNRmtJ0r6NAamd6f q//fdDk/B2LFnlyKn7rq8rPtd4jjbWomY07wRPUG/6uyJrQfJQZejSvUyHL0OjxCLpaV R7v3OovOPtLZvJXOo7qoLZOJBnKgJyDE+QZ/CG4HxDRtLu2nklsBS91BVStb+3XZqn86 YLAg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=d5Kprf1h; 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 d75a77b69052e-46e10409f43si149689231cf.255.2025.01.22.01.32.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 22 Jan 2025 01:32:50 -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=d5Kprf1h; 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 1taX4c-0001PC-4Y; Wed, 22 Jan 2025 04:30:58 -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 1taX4U-0001FV-Vz for qemu-devel@nongnu.org; Wed, 22 Jan 2025 04:30:52 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1taX4S-0003Da-3J for qemu-devel@nongnu.org; Wed, 22 Jan 2025 04:30:50 -0500 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-437a92d7b96so65653335e9.2 for ; Wed, 22 Jan 2025 01:30:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737538244; x=1738143044; 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=JSvw35u1c/GeD9pKIKqf6WHVcOBbPhJhoq/j5sOwl2I=; b=d5Kprf1hmbAcIK7tj2CBTj44Kwb1h2fIzgDGVgiZvPWesGLHtSQizNTS52iZyB/yqS sXdtZsvf4DH/mDJoyRJJGUqn+cmeFkrFS19xDN4SsDw+jTmV1AdRuwSaBI/3ix41kxtl 1e42p+PHljs50DU8Alw/UyHpoclK9/iohldsy6XIgGHoFO+CcE/zSdk/90bpwkXotsIf F+UAluw5Yud6VTdTjgBq1rb6PcEERWZyVFF+N/xFzR/TzeNa0T+7ArvXiV28j8TldE49 Y8sBhB5y/0n7ScZZ7IEur2RSHC8PWyHaVn2WyB6sd7+4Bkwmv0lc+dkf+jDZTT/4awzq YSnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737538244; x=1738143044; 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=JSvw35u1c/GeD9pKIKqf6WHVcOBbPhJhoq/j5sOwl2I=; b=oIxQqeQ5kh3ZVCKwcjykfeI9IWoamBUh/5zXdLNXfvwE6rV32YEzE5/ZF4VaArE84M 1JVG4hCRPUgSiP/2124865QpWOXO512Lp+zN2Eir7aNpGd/MWeVq35sd3ElNMq+mINWS PyhTECY663KPlwdVEAqW+YzjhGjyhZgQ7zKch/mJO48rEGNb+EI1M0uFCIbFCeJs8wBd o8dnPSSQrFBPdO4TRB4t8fAs164jvyRdocROEr4/b/y79gsKIjKSjA5vlR7qMj2NfMM+ aiE3ZKZZszT62qCg8jq/+6TS/lgOatSEuixEd94KeTw5c5Oe+aFwRzmwyxNaXm9FLbwq G9KQ== X-Gm-Message-State: AOJu0YxYc7zFCob6UIQdYW76jdfQuqLnj7ugOVPkjeD0RdaFBVYZJD1L oqv8Y9eB+Yt5KamJ1+YvdE+5dV3pG4MxHzRW1sT4Da/yXSeLsKDNZiLODo6W6pn6nLdn6lWPeGK FEjI= X-Gm-Gg: ASbGncuR5mlo3gjPCi/5zntcvX8411g9AR0DbyQS4O5hhthQGtutM59PlIGaxJj6ZfN fw5yf4lPRZop9LPnocfrktO4TNSkJ21dksnmW3BmV2KRpQxqoZLNa36fMbhW5faQfavtAkiORVh yK1NcKDmON2DAwAvVIxr7/Aw0Ey5IEbNkIfHvbq3uBMs8bDnvKTT1cFETmidSXO0MFbRnbRuMoi 1akDfcEoa2G6hGvxk3XiKKuX57BbOgSej2t5ZMuZUvu4be5CcTQJ/zq9r5sWMpvsOb+F2H5BCcP Wb1svjJeDvWsv6klGsoW8Y8+5VvMfqfuCkkoFXNsJR+b X-Received: by 2002:a05:600c:3593:b0:431:5632:448b with SMTP id 5b1f17b1804b1-4389144eed4mr166894525e9.25.1737538244298; Wed, 22 Jan 2025 01:30:44 -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-438b31a1e7fsm17313825e9.10.2025.01.22.01.30.43 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 22 Jan 2025 01:30:43 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Richard Henderson , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= Subject: [PATCH v2 03/10] cpus: Cache CPUClass early in instance_init() handler Date: Wed, 22 Jan 2025 10:30:21 +0100 Message-ID: <20250122093028.52416-4-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250122093028.52416-1-philmd@linaro.org> References: <20250122093028.52416-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=philmd@linaro.org; helo=mail-wm1-x330.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;