From nobody Thu Jan 23 03:13:41 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1737459793; cv=none; d=zohomail.com; s=zohoarc; b=WGVniKJui+thm2mHXKLuHsPsIeXnXWXz/1fySnM0njCgFOMlrQsyC1jBKxIai3+l4ekw0+Y0RMATYONUNdgBs3YvcEdVOAMTFYG1+aZOnMGUkQ8YugStq74BJE2yKLnFhnZUp8Mj815TGMuSl3PNCrSzb2NA1Hi/PFHE+bWGMtc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1737459793; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=FMaF6+Wa5WYYaGZJTTHWyD0ctSisYPOSoq9ZRxR4GzI=; b=Jowxs2R8EcTJP5dT1fqpCcyR3jnbo7yW8VJAdTpJhF6619g9xIVMaJ8nwPP5IA1YAB5H0dsECMyD7MuFirNwlW9LE5Ez6BwGPlSHHrnZGnf9GI7kFesOtyMST+FuFbByA7GbQ49RZ2j5s51mF7awnbAr0NbY4IUrME75vGku6LQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1737459793469381.5604324968375; Tue, 21 Jan 2025 03:43:13 -0800 (PST) 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) 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) 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) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1737459795276019000 Cache CPUClass as early as possible, when the instance is initialized. Signed-off-by: Philippe Mathieu-Daud=C3=A9 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 =3D { =20 bool cpu_exec_realizefn(CPUState *cpu, Error **errp) { - /* cache the cpu class for the hotpath */ - cpu->cc =3D 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 =3D CPU(obj); =20 + /* cache the cpu class for the hotpath */ + cpu->cc =3D CPU_GET_CLASS(cpu); + gdb_init_cpu(cpu); cpu->cpu_index =3D UNASSIGNED_CPU_INDEX; cpu->cluster_index =3D UNASSIGNED_CLUSTER_INDEX; --=20 2.47.1 From nobody Thu Jan 23 03:13:41 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1737459723; cv=none; d=zohomail.com; s=zohoarc; b=dDIpytDvo9ZxjRaYtgy7c3jNjV/dQ2fJxgKQuegHMxCmC6Sn37Rq35Z/JJakEJS85w3yxl15w2w/F4Sp66TiyNmGXYZhisAXXCDnpqQO7bnyBKyok7VKsTDZLW3G8euDWZvB72E+MEwNOb6KRUv6PcG8ibeHXLMDONsnJPZq3z4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1737459723; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=/3HlKJr0e+T3QTj2gDcsUT1Px2dX5i+yFz6MQF4ebrA=; b=UaCoA3B9s0oTuYyhHif3kUq+ihy6tHZh+O/5R99dOnBmu+JaN7z0y0PfabP4YI1PpKJq3QPeC2JRtO130KUyxJ+oTzhppgSMldfRL/qRPPdE8vCixBho147FOB01JoloqhEszQcbcm7SJ+XNUBR2BMYe4flXSINuIYj4SAwTiMo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17374597232034.148965308365632; Tue, 21 Jan 2025 03:42:03 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1taCdE-0004zr-Ew; Tue, 21 Jan 2025 06:41:20 -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 1taCdB-0004xh-5v for qemu-devel@nongnu.org; Tue, 21 Jan 2025 06:41:17 -0500 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1taCd5-0003LN-2f for qemu-devel@nongnu.org; Tue, 21 Jan 2025 06:41:16 -0500 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-3862b40a6e0so3533497f8f.0 for ; Tue, 21 Jan 2025 03:41:10 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38bf327decbsm13358853f8f.90.2025.01.21.03.41.06 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 21 Jan 2025 03:41:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737459667; x=1738064467; 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=/3HlKJr0e+T3QTj2gDcsUT1Px2dX5i+yFz6MQF4ebrA=; b=mz8T6jYw/d8GZ3b/EqoHokECOyWY8EjmsAVzNuavU92ilP+6mmPsWRwIN963za2sRy QGzkoy1433rnFCmGXbOZOkgCvRuAQBGbDH5CuihGlaKSadfyDp3b0vTcnKi9dRz4UGgo rAGlU41SzZAfJ0hFY6yMF81k2V0It+/SckDmvUwSEotNKVJmOvL81IrgFi9h5sBKzRnP n5hy/dfOaidcQbyLDVTUckjR9PpPVWztAH7YtxStVFdvpHjdCptwcXvYyCBWJ+uoQrga 6JQ3lu+wNFTAP5ZC1i3uSH3ehNLkftD2aGNyeOC3pqP4y4AHMd4PngkV5Mxx7/CVuPVN ju8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737459667; x=1738064467; 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=/3HlKJr0e+T3QTj2gDcsUT1Px2dX5i+yFz6MQF4ebrA=; b=pKjilkHE84TkNl53p8opa++gzAo7iP4G2r9t/2VY3UoiHR55vtPwuh8SmxSNbK0qK8 5Dsw2kwJtOY8yN+zFZET7EXvVYk1rTiRg4yMQx2RVMUSXFHXTpJfzxA0ERoc+t4gkY8L S4WGCo4dRX4Y3WYYhwzbZoPxc8OmtXOm98HHD8sT8TL3NVGfCibz65Z5AKNnWfuJWwO2 52Z6iWH36uQfIxT/t7OaTSTwy1CGUHVTiM4JWlYnORLsoMfZ+/7cUuBcYLKSv3W1NB63 CX1O0pd1+E+Sd07Qj03ehOPW9cmMHrA2cMg//4uXas62KPHq1Jt3ZApft1jc2tCqrfU/ 0siw== X-Gm-Message-State: AOJu0YzDTpXL2qxUji01EZRL1wRSy5gKtOhuvIIlOPEO248JGbD/cDnA 5VlKLDEOkOj1TttS3yzsa3BkFPpau0lX8WjECXnojg8z82n3+eA88mNgbmZ4sKMiavLfYvPR6gn 5Uhs= X-Gm-Gg: ASbGncuBFwg3E2GLaBrxWC1Erzi6U2fgAbp4WlV3aQRAzQDgLQJMrLa7v8vc9hYsjXT Tx2gB2Ss1XCTxbrVuq+9njfr5UCZQkhdY7TtjoivYSoIZ9ZCRM743wHSxezHnZh1T0n5FEgDUtC l1vQoY6ja9/uDFktkCN84JFHFdx8nL9heHI5Yh+rlrM+c831T4xCJxbwBhlKbdQtLxJALN9hIWY xSrcxXOS086a7WXq9WCdq2jm/BZhBuvRmD3rU6duAj/O4YGUmDY7P68DCz0P9vgWrGvJNmE0ecy 7z9Tt4qvCkHWhyfmczJkoOOEIsBzBxG/aWHzcVnUm0Xm X-Google-Smtp-Source: AGHT+IGs/ATla//lQ2AtPoPkcgm+ShlMsf7RR27CE1JH3r1iRxS5tELAIaHWMxn4/3oiZmjM0gynjA== X-Received: by 2002:adf:ef4f:0:b0:38a:418e:bee with SMTP id ffacd0b85a97d-38bf57a2843mr10469117f8f.42.1737459667407; Tue, 21 Jan 2025 03:41:07 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 02/11] cpus: Prefer cached CpuClass over CPU_GET_CLASS() macro Date: Tue, 21 Jan 2025 12:40:47 +0100 Message-ID: <20250121114056.53949-3-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=philmd@linaro.org; helo=mail-wr1-x430.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1737459724934019000 CpuState caches its CPUClass since commit 6fbdff87062 ("cpu: cache CPUClass in CPUState for hot code paths"), use it. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- include/hw/core/cpu.h | 10 +++----- cpu-common.c | 10 ++++---- cpu-target.c | 6 ++--- hw/core/cpu-common.c | 13 ++++------ hw/core/cpu-system.c | 55 +++++++++++++++---------------------------- 5 files changed, 32 insertions(+), 62 deletions(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index fb397cdfc53..b7367f6d808 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -824,10 +824,8 @@ const char *parse_cpu_option(const char *cpu_option); */ static inline bool cpu_has_work(CPUState *cpu) { - CPUClass *cc =3D CPU_GET_CLASS(cpu); - - g_assert(cc->has_work); - return cc->has_work(cpu); + g_assert(cpu->cc->has_work); + return cpu->cc->has_work(cpu); } =20 /** @@ -966,9 +964,7 @@ void cpu_interrupt(CPUState *cpu, int mask); */ static inline void cpu_set_pc(CPUState *cpu, vaddr addr) { - CPUClass *cc =3D CPU_GET_CLASS(cpu); - - cc->set_pc(cpu, addr); + cpu->cc->set_pc(cpu, addr); } =20 /** diff --git a/cpu-common.c b/cpu-common.c index 4248b2d727e..3a409aacb2e 100644 --- a/cpu-common.c +++ b/cpu-common.c @@ -389,11 +389,10 @@ void process_queued_cpu_work(CPUState *cpu) int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, int flags, CPUBreakpoint **breakpoint) { - CPUClass *cc =3D CPU_GET_CLASS(cpu); CPUBreakpoint *bp; =20 - if (cc->gdb_adjust_breakpoint) { - pc =3D cc->gdb_adjust_breakpoint(cpu, pc); + if (cpu->cc->gdb_adjust_breakpoint) { + pc =3D cpu->cc->gdb_adjust_breakpoint(cpu, pc); } =20 bp =3D g_malloc(sizeof(*bp)); @@ -419,11 +418,10 @@ int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, in= t flags, /* Remove a specific breakpoint. */ int cpu_breakpoint_remove(CPUState *cpu, vaddr pc, int flags) { - CPUClass *cc =3D CPU_GET_CLASS(cpu); CPUBreakpoint *bp; =20 - if (cc->gdb_adjust_breakpoint) { - pc =3D cc->gdb_adjust_breakpoint(cpu, pc); + if (cpu->cc->gdb_adjust_breakpoint) { + pc =3D cpu->cc->gdb_adjust_breakpoint(cpu, pc); } =20 QTAILQ_FOREACH(bp, &cpu->breakpoints, entry) { diff --git a/cpu-target.c b/cpu-target.c index 89874496a41..98e9e7cc4a1 100644 --- a/cpu-target.c +++ b/cpu-target.c @@ -159,10 +159,8 @@ bool cpu_exec_realizefn(CPUState *cpu, Error **errp) void cpu_exec_unrealizefn(CPUState *cpu) { #ifndef CONFIG_USER_ONLY - CPUClass *cc =3D CPU_GET_CLASS(cpu); - - if (cc->sysemu_ops->legacy_vmsd !=3D NULL) { - vmstate_unregister(NULL, cc->sysemu_ops->legacy_vmsd, cpu); + if (cpu->cc->sysemu_ops->legacy_vmsd !=3D NULL) { + vmstate_unregister(NULL, cpu->cc->sysemu_ops->legacy_vmsd, cpu); } if (qdev_get_vmsd(DEVICE(cpu)) =3D=3D NULL) { vmstate_unregister(NULL, &vmstate_cpu_common, cpu); diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c index ff605059c15..886aa793c04 100644 --- a/hw/core/cpu-common.c +++ b/hw/core/cpu-common.c @@ -40,9 +40,7 @@ CPUState *cpu_by_arch_id(int64_t id) CPUState *cpu; =20 CPU_FOREACH(cpu) { - CPUClass *cc =3D CPU_GET_CLASS(cpu); - - if (cc->get_arch_id(cpu) =3D=3D id) { + if (cpu->cc->get_arch_id(cpu) =3D=3D id) { return cpu; } } @@ -101,11 +99,9 @@ static int cpu_common_gdb_write_register(CPUState *cpu,= uint8_t *buf, int reg) =20 void cpu_dump_state(CPUState *cpu, FILE *f, int flags) { - CPUClass *cc =3D CPU_GET_CLASS(cpu); - - if (cc->dump_state) { + if (cpu->cc->dump_state) { cpu_synchronize_state(cpu); - cc->dump_state(cpu, f, flags); + cpu->cc->dump_state(cpu, f, flags); } } =20 @@ -119,11 +115,10 @@ void cpu_reset(CPUState *cpu) static void cpu_common_reset_hold(Object *obj, ResetType type) { CPUState *cpu =3D CPU(obj); - CPUClass *cc =3D CPU_GET_CLASS(cpu); =20 if (qemu_loglevel_mask(CPU_LOG_RESET)) { qemu_log("CPU Reset (CPU %d)\n", cpu->cpu_index); - log_cpu_state(cpu, cc->reset_dump_flags); + log_cpu_state(cpu, cpu->cc->reset_dump_flags); } =20 cpu->interrupt_request =3D 0; diff --git a/hw/core/cpu-system.c b/hw/core/cpu-system.c index 6aae28a349a..37d54d04bf8 100644 --- a/hw/core/cpu-system.c +++ b/hw/core/cpu-system.c @@ -25,10 +25,8 @@ =20 bool cpu_paging_enabled(const CPUState *cpu) { - CPUClass *cc =3D CPU_GET_CLASS(cpu); - - if (cc->sysemu_ops->get_paging_enabled) { - return cc->sysemu_ops->get_paging_enabled(cpu); + if (cpu->cc->sysemu_ops->get_paging_enabled) { + return cpu->cc->sysemu_ops->get_paging_enabled(cpu); } =20 return false; @@ -37,10 +35,8 @@ bool cpu_paging_enabled(const CPUState *cpu) bool cpu_get_memory_mapping(CPUState *cpu, MemoryMappingList *list, Error **errp) { - CPUClass *cc =3D CPU_GET_CLASS(cpu); - - if (cc->sysemu_ops->get_memory_mapping) { - return cc->sysemu_ops->get_memory_mapping(cpu, list, errp); + if (cpu->cc->sysemu_ops->get_memory_mapping) { + return cpu->cc->sysemu_ops->get_memory_mapping(cpu, list, errp); } =20 error_setg(errp, "Obtaining memory mappings is unsupported on this CPU= ."); @@ -50,14 +46,12 @@ bool cpu_get_memory_mapping(CPUState *cpu, MemoryMappin= gList *list, hwaddr cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr, MemTxAttrs *attrs) { - CPUClass *cc =3D CPU_GET_CLASS(cpu); - - if (cc->sysemu_ops->get_phys_page_attrs_debug) { - return cc->sysemu_ops->get_phys_page_attrs_debug(cpu, addr, attrs); + if (cpu->cc->sysemu_ops->get_phys_page_attrs_debug) { + return cpu->cc->sysemu_ops->get_phys_page_attrs_debug(cpu, addr, a= ttrs); } /* Fallback for CPUs which don't implement the _attrs_ hook */ *attrs =3D MEMTXATTRS_UNSPECIFIED; - return cc->sysemu_ops->get_phys_page_debug(cpu, addr); + return cpu->cc->sysemu_ops->get_phys_page_debug(cpu, addr); } =20 hwaddr cpu_get_phys_page_debug(CPUState *cpu, vaddr addr) @@ -81,64 +75,53 @@ int cpu_asidx_from_attrs(CPUState *cpu, MemTxAttrs attr= s) int cpu_write_elf32_qemunote(WriteCoreDumpFunction f, CPUState *cpu, void *opaque) { - CPUClass *cc =3D CPU_GET_CLASS(cpu); - - if (!cc->sysemu_ops->write_elf32_qemunote) { + if (!cpu->cc->sysemu_ops->write_elf32_qemunote) { return 0; } - return (*cc->sysemu_ops->write_elf32_qemunote)(f, cpu, opaque); + return (*cpu->cc->sysemu_ops->write_elf32_qemunote)(f, cpu, opaque); } =20 int cpu_write_elf32_note(WriteCoreDumpFunction f, CPUState *cpu, int cpuid, void *opaque) { - CPUClass *cc =3D CPU_GET_CLASS(cpu); - - if (!cc->sysemu_ops->write_elf32_note) { + if (!cpu->cc->sysemu_ops->write_elf32_note) { return -1; } - return (*cc->sysemu_ops->write_elf32_note)(f, cpu, cpuid, opaque); + return (*cpu->cc->sysemu_ops->write_elf32_note)(f, cpu, cpuid, opaque); } =20 int cpu_write_elf64_qemunote(WriteCoreDumpFunction f, CPUState *cpu, void *opaque) { - CPUClass *cc =3D CPU_GET_CLASS(cpu); - - if (!cc->sysemu_ops->write_elf64_qemunote) { + if (!cpu->cc->sysemu_ops->write_elf64_qemunote) { return 0; } - return (*cc->sysemu_ops->write_elf64_qemunote)(f, cpu, opaque); + return (*cpu->cc->sysemu_ops->write_elf64_qemunote)(f, cpu, opaque); } =20 int cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cpu, int cpuid, void *opaque) { - CPUClass *cc =3D CPU_GET_CLASS(cpu); - - if (!cc->sysemu_ops->write_elf64_note) { + if (!cpu->cc->sysemu_ops->write_elf64_note) { return -1; } - return (*cc->sysemu_ops->write_elf64_note)(f, cpu, cpuid, opaque); + return (*cpu->cc->sysemu_ops->write_elf64_note)(f, cpu, cpuid, opaque); } =20 bool cpu_virtio_is_big_endian(CPUState *cpu) { - CPUClass *cc =3D CPU_GET_CLASS(cpu); - - if (cc->sysemu_ops->virtio_is_big_endian) { - return cc->sysemu_ops->virtio_is_big_endian(cpu); + if (cpu->cc->sysemu_ops->virtio_is_big_endian) { + return cpu->cc->sysemu_ops->virtio_is_big_endian(cpu); } return target_words_bigendian(); } =20 GuestPanicInformation *cpu_get_crash_info(CPUState *cpu) { - CPUClass *cc =3D CPU_GET_CLASS(cpu); GuestPanicInformation *res =3D NULL; =20 - if (cc->sysemu_ops->get_crash_info) { - res =3D cc->sysemu_ops->get_crash_info(cpu); + if (cpu->cc->sysemu_ops->get_crash_info) { + res =3D cpu->cc->sysemu_ops->get_crash_info(cpu); } return res; } --=20 2.47.1 From nobody Thu Jan 23 03:13:41 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1737459726; cv=none; d=zohomail.com; s=zohoarc; b=h/3aIzn/2ilHNsAKgeCvmuTwLTSUsx96j4hFqCpHlzcb5t+B84KQlVUJcK0+gNcoyIIKFGLrtwoIn+AfsWlV344C3Vimsz+5+kAYEMkaQL6hqyGJzHeCYL7pA1nqqmcWUtCKFzVyrtdRSld7o5QBbJ1qJrBY6XzTyd6wN5KQsuk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1737459726; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=6+sqenivOKOaIj/HGMbrfNMWNgVlPE7OSpRM12hfj2M=; b=EBltT7vcB5x3+spfOgOEkJB3VWvtn1JOBfGkwDsQtQTCapeKMjC2xg9G8KPUpFjaiwEkNg1n8YIf5jS7e48lDVUIh8cAp74GhVjYnWs4MtOdNfzjSYJE3ddnXrvV59iI5KL7LyrWCUkCLKHdP5JZ87iL4Ja2gewZo4aH2awYT7w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1737459726197261.57995071063544; Tue, 21 Jan 2025 03:42:06 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1taCdC-0004y9-SO; Tue, 21 Jan 2025 06:41:19 -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 1taCdA-0004xW-Mq for qemu-devel@nongnu.org; Tue, 21 Jan 2025 06:41:16 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1taCd8-0003MX-N0 for qemu-devel@nongnu.org; Tue, 21 Jan 2025 06:41:16 -0500 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-436ce2ab251so38219165e9.1 for ; Tue, 21 Jan 2025 03:41:13 -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-437c1664e8dsm179961565e9.1.2025.01.21.03.41.11 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 21 Jan 2025 03:41:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737459672; x=1738064472; 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=6+sqenivOKOaIj/HGMbrfNMWNgVlPE7OSpRM12hfj2M=; b=tTVdLzTKZmAbxkkEyQRTJd180XusWURGXeTV9v1oQF3nzcQe/9ayODKiBLtup74tFH PGJsHaC/EAytYXrLegp0xBCNT+stc8i5tSPY2kW8lTe9rkntbBA2fQjkNCb+CCSgL5Om k0H6LbkBcOzdqPfy1YQDRoy9AK6GMlRFE8N579vrAdD/xKcs/c72xcaTO9YqbBIGjjhv JEfNZkud9BtZbV8epRLjhoRp4ySTEH2DSubYSPZ5DJH0d1BMR4sSc4Irb4nRNmUCu/o/ sZfiX9dcGOOuxnvrV3qs2L5kGJSoOej1Lbr6Be7WMvPMO8Kj31UY+LQjXzsMf+EF9pwY DtIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737459672; x=1738064472; 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=6+sqenivOKOaIj/HGMbrfNMWNgVlPE7OSpRM12hfj2M=; b=UwQSL9qBJi1Ta4cfhcmS+hQ/7Cmzhb4PckW9XpPtkFg9BWdJZtHxs+LlX3+6x/J/8F t4u7pzBNVPKXKUEjGQFOHBGNiyEYThAfCJBJbBchVABDhMJvwctczuQ4QZUr/rVoAgQe zHc9LyGfdksLhUhY7uGUq4vOOdxfhwHQCYWCdSNA8DIKkai2tIQ6ZGS7kN/kMvNWpDKs XVH9HKSQmenku2lRQanN+50HNRLf5Pvc6qUkG0mDhJn8cNeRx6kswb6glP0MifAFKA9f Umt7lfp90hWI3lkJX3iWeZScHpkTmS+KVnWgK9yFC6v1kkRVb0TB8MVhGy5oiv8BmuIS 0ewQ== X-Gm-Message-State: AOJu0YzBpuv3/r2RRl7wHKdHtCUHyy/31EuFMSuJq5SwuPsWFRybCPw9 GjqOjV8YXxiItvEWbZYWJyys47D/pydAbQobEsfT8q/sp+npBu/FsnAZSU/NrWiecFLoXgKnzNa nhsU= X-Gm-Gg: ASbGncv0WFCgBbfzcVKiv5t8BuaLd8U6JCZ8cqRVTPHsxgi4ksWneb/FFwrKw69pyeA Hyvpf+r97iNav2/4n9ujMRm3uhB9WGK1fdudzFv10vOwVZ2e0rCQu8SxFaKi/T7hP7V6LTx/oU9 V+d+/T9FiZyrOcZegv3c4hXA+Pwa2PzXmiY77U1SIp0ghogzxBhar4BAD2yUBPFkDT9YrcwGnNP gkDlPQVE2VEXSc41q/MjOXKMjhIo+INWyLjHYi9WEurbVsxcISnpfIGhEkK4EudwBd4ELNP6NLw vmr38xJAYc3cJImlSK0QVpJ4Bt4Nh0Y0p+PlLjt5TQGr X-Google-Smtp-Source: AGHT+IFAV++RtKn1KotX+3ii/fxqKc/fb8NWI3UzdXKs0eo21SJuKzQB4kr02Ht3HAyC4Lmg9PLMTg== X-Received: by 2002:a05:600c:138f:b0:436:ed50:4f8a with SMTP id 5b1f17b1804b1-438913caeb9mr178310015e9.10.1737459672025; Tue, 21 Jan 2025 03:41:12 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 03/11] accel: Prefer cached CpuClass over CPU_GET_CLASS() macro Date: Tue, 21 Jan 2025 12:40:48 +0100 Message-ID: <20250121114056.53949-4-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=philmd@linaro.org; helo=mail-wm1-x32e.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1737459727414019000 CpuState caches its CPUClass since commit 6fbdff87062 ("cpu: cache CPUClass in CPUState for hot code paths"), use it. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- accel/accel-target.c | 12 +++++------- accel/tcg/tcg-accel-ops.c | 3 +-- accel/tcg/translate-all.c | 2 +- accel/tcg/watchpoint.c | 9 ++++----- 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/accel/accel-target.c b/accel/accel-target.c index 08626c00c2d..8a16c0c3ae0 100644 --- a/accel/accel-target.c +++ b/accel/accel-target.c @@ -112,22 +112,20 @@ void accel_init_interfaces(AccelClass *ac) =20 void accel_cpu_instance_init(CPUState *cpu) { - CPUClass *cc =3D CPU_GET_CLASS(cpu); - - if (cc->accel_cpu && cc->accel_cpu->cpu_instance_init) { - cc->accel_cpu->cpu_instance_init(cpu); + if (cpu->cc->accel_cpu && cpu->cc->accel_cpu->cpu_instance_init) { + cpu->cc->accel_cpu->cpu_instance_init(cpu); } } =20 bool accel_cpu_common_realize(CPUState *cpu, Error **errp) { - CPUClass *cc =3D CPU_GET_CLASS(cpu); AccelState *accel =3D current_accel(); AccelClass *acc =3D ACCEL_GET_CLASS(accel); =20 /* target specific realization */ - if (cc->accel_cpu && cc->accel_cpu->cpu_target_realize - && !cc->accel_cpu->cpu_target_realize(cpu, errp)) { + if (cpu->cc->accel_cpu + && cpu->cc->accel_cpu->cpu_target_realize + && !cpu->cc->accel_cpu->cpu_target_realize(cpu, errp)) { return false; } =20 diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c index 6e3f1fa92b2..299d6176cfb 100644 --- a/accel/tcg/tcg-accel-ops.c +++ b/accel/tcg/tcg-accel-ops.c @@ -120,10 +120,9 @@ static inline int xlat_gdb_type(CPUState *cpu, int gdb= type) [GDB_WATCHPOINT_ACCESS] =3D BP_GDB | BP_MEM_ACCESS, }; =20 - CPUClass *cc =3D CPU_GET_CLASS(cpu); int cputype =3D xlat[gdbtype]; =20 - if (cc->gdb_stop_before_watchpoint) { + if (cpu->cc->gdb_stop_before_watchpoint) { cputype |=3D BP_STOP_BEFORE_ACCESS; } return cputype; diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index d56ca13cddf..5a378cb0281 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -622,7 +622,7 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr) * to account for the re-execution of the branch. */ n =3D 1; - cc =3D CPU_GET_CLASS(cpu); + cc =3D cpu->cc; if (cc->tcg_ops->io_recompile_replay_branch && cc->tcg_ops->io_recompile_replay_branch(cpu, tb)) { cpu->neg.icount_decr.u16.low++; diff --git a/accel/tcg/watchpoint.c b/accel/tcg/watchpoint.c index af57d182d5b..52e550dec6b 100644 --- a/accel/tcg/watchpoint.c +++ b/accel/tcg/watchpoint.c @@ -69,7 +69,6 @@ int cpu_watchpoint_address_matches(CPUState *cpu, vaddr a= ddr, vaddr len) void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len, MemTxAttrs attrs, int flags, uintptr_t ra) { - CPUClass *cc =3D CPU_GET_CLASS(cpu); CPUWatchpoint *wp; =20 assert(tcg_enabled()); @@ -85,9 +84,9 @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vadd= r len, return; } =20 - if (cc->tcg_ops->adjust_watchpoint_address) { + if (cpu->cc->tcg_ops->adjust_watchpoint_address) { /* this is currently used only by ARM BE32 */ - addr =3D cc->tcg_ops->adjust_watchpoint_address(cpu, addr, len); + addr =3D cpu->cc->tcg_ops->adjust_watchpoint_address(cpu, addr, le= n); } =20 assert((flags & ~BP_MEM_ACCESS) =3D=3D 0); @@ -119,8 +118,8 @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, va= ddr len, wp->hitattrs =3D attrs; =20 if (wp->flags & BP_CPU - && cc->tcg_ops->debug_check_watchpoint - && !cc->tcg_ops->debug_check_watchpoint(cpu, wp)) { + && cpu->cc->tcg_ops->debug_check_watchpoint + && !cpu->cc->tcg_ops->debug_check_watchpoint(cpu, wp)) { wp->flags &=3D ~BP_WATCHPOINT_HIT; continue; } --=20 2.47.1 From nobody Thu Jan 23 03:13:41 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1737459791; cv=none; d=zohomail.com; s=zohoarc; b=ddq5PeTJ+iMPAWSl0ljcgHavZM0/h5yiDu/kKFsonf75rsBrOsirfjjX7Gl5Slqajns4BDhSpsHhd2RJ1MPYOhA/eM9Z3ZXe0Xvv3x55YCYeXhnQfNMod5FohdnlLrURfVD2rojUaMU57v9IPIhF9wvpqGaAaXfXbpnd6E6XQxA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1737459791; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=UK2TrLeD2Zn1+uH64aqzpAn7UZ7ZT3zI/v5l0LjGSTY=; b=EVbn5AtJxfbzo92dQMXe/mu0TOTiqIfY8ATX6mT7M/DNFArXW2DvncvnVLJ/5jm5qurGYXahx8VXp5ZmHBQi8676NnFO3ok19KDRaKyjuIwA72Erj4O1rOeErtDHlSKpR5EUuhNT4mwrB7RdKb/CBOyjY/N5G4r3GmLdsr6EfJ8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 173745979131610.842592318715106; Tue, 21 Jan 2025 03:43:11 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1taCdS-0005M9-SN; Tue, 21 Jan 2025 06:41:34 -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 1taCdP-0005K9-GD for qemu-devel@nongnu.org; Tue, 21 Jan 2025 06:41:31 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1taCdG-0003NF-Bn for qemu-devel@nongnu.org; Tue, 21 Jan 2025 06:41:31 -0500 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-438a3216fc2so27433875e9.1 for ; Tue, 21 Jan 2025 03:41:18 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38bf327ded8sm12932429f8f.89.2025.01.21.03.41.15 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 21 Jan 2025 03:41:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737459676; x=1738064476; 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=UK2TrLeD2Zn1+uH64aqzpAn7UZ7ZT3zI/v5l0LjGSTY=; b=CToApptADlKARC2KiWU1ItmAYUZk/B/+7UhFTecRAYVkFTd+8gEFiLuyjqSsaYaDpt VsY8Xy0pgcjgsc0N7+Yco0QtL9gwVBDX1HNAm8sjiImu4N6f9mET0W93ouXtkdWZLLH4 HGDzOBLyZHRZbszixj3Onu1h5+3CpsJAAhgM9paDDkO6fhuhjOo/bXX2e8i/GBRufj3C q3zQbXgLG49iBVV8tL3b0aQvwNS1e4GIjh+U27qxGyTJ4ZKtvvAoRow1qY+Ogqad5n9H rec8fitlw1kfB9osyTsPsXgKbueMRhXalCh5Fl4ABVbCf0mrRbQHYUxFpL7r6Gh9e0Ys /ZUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737459676; x=1738064476; 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=UK2TrLeD2Zn1+uH64aqzpAn7UZ7ZT3zI/v5l0LjGSTY=; b=JoDqfFNhGS45buuJODURnZRfA3fKVaVOgB18pRhwlGkrBEfzN9tLUt3kIlNP02RvmC 2v23SMt4UkAorkTwF7g6a4oupFHZW143Cl4ffbY3HFO2rK3gqeBVc6rBO2jZo3aCwDFc 0WKBrHPvIhdVDBW0EEWtaf0Rr0AS10x94CSgxr4Pr1p5ZYzL0ZVxVHJBsp4tRaZPx7a3 tPm8KQ4qMAQPPoKqjlhTeXnLXK5Qi3tqFqxKGCh/fVsL7y2QyJNJFv23hou5knwGwxgh Vv1DlTGXtdusfA3JBWBlloR7hCcK2hkHFFCr88+iCQrQd5JJSXrKUoG2WsNaj95KLBQa dcJw== X-Gm-Message-State: AOJu0YzF5Kcj3z/XM0lhLofPRSsPDOqByyf877DHZadVwBhkjxXn0r20 5wM0PVgEdsMjxRq9nQQwnCnV7FdR1UlZRHQg6YvamPVrkKwo5MTeKWWJKv5VnhZ5BfCl0BbU2Mi zKpU= X-Gm-Gg: ASbGncspnAuF3MR3MAZzvbyFRO4uF12z1Kj2OzkkQ3/77/+/TGcE8R5RsLx5E5revwU fYJET1XhyEKBVKoWfngVE5tz66i+APRX8iZgtWufWcRrWT4+wFvKnECXpGNPo4v83MOQ7hvWPpZ nOsLAz+Ojwckgwi1CpEwqr4v8zkMvxTGwlpbgSgQ/6/02NN44KBmyc/iFRzTn3TotLppzXxIDH3 7R+kA3og1GVAdy+IK5PaPEGPsZD4Z/xjT2xprRmxwnGRHdcW1YHnHkfTxnwBve63O+gNUez5LgQ WoXjVctta0IeMJ8uvv/6PN6jMX0dPDHSfLW0o4DXbIcz X-Google-Smtp-Source: AGHT+IEGMsuskHAZZ9w4pwzHFYH3HntWs1FX387Dlx0h/AuPPOB/Ktl0DAeXr4nCplNVVZ5CWeOAQQ== X-Received: by 2002:a05:6000:2a7:b0:38a:615c:8225 with SMTP id ffacd0b85a97d-38bf577ff42mr16730772f8f.15.1737459676557; Tue, 21 Jan 2025 03:41:16 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 04/11] user: Prefer cached CpuClass over CPU_GET_CLASS() macro Date: Tue, 21 Jan 2025 12:40:49 +0100 Message-ID: <20250121114056.53949-5-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=philmd@linaro.org; helo=mail-wm1-x331.google.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1737459793291019000 CpuState caches its CPUClass since commit 6fbdff87062 ("cpu: cache CPUClass in CPUState for hot code paths"), use it. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- linux-user/alpha/target_proc.h | 2 +- bsd-user/signal.c | 4 ++-- linux-user/signal.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/linux-user/alpha/target_proc.h b/linux-user/alpha/target_proc.h index dac37dffc9d..da437ee0e56 100644 --- a/linux-user/alpha/target_proc.h +++ b/linux-user/alpha/target_proc.h @@ -15,7 +15,7 @@ static int open_cpuinfo(CPUArchState *cpu_env, int fd) const char *p, *q; int t; =20 - p =3D object_class_get_name(OBJECT_CLASS(CPU_GET_CLASS(env_cpu(cpu_env= )))); + p =3D object_class_get_name(OBJECT_CLASS(env_cpu(cpu_env)->cc)); q =3D strchr(p, '-'); t =3D q - p; assert(t < sizeof(model)); diff --git a/bsd-user/signal.c b/bsd-user/signal.c index b4e1458237a..4e32cd64f18 100644 --- a/bsd-user/signal.c +++ b/bsd-user/signal.c @@ -1021,7 +1021,7 @@ void process_pending_signals(CPUArchState *env) void cpu_loop_exit_sigsegv(CPUState *cpu, target_ulong addr, MMUAccessType access_type, bool maperr, uintptr= _t ra) { - const TCGCPUOps *tcg_ops =3D CPU_GET_CLASS(cpu)->tcg_ops; + const TCGCPUOps *tcg_ops =3D cpu->cc->tcg_ops; =20 if (tcg_ops->record_sigsegv) { tcg_ops->record_sigsegv(cpu, addr, access_type, maperr, ra); @@ -1037,7 +1037,7 @@ void cpu_loop_exit_sigsegv(CPUState *cpu, target_ulon= g addr, void cpu_loop_exit_sigbus(CPUState *cpu, target_ulong addr, MMUAccessType access_type, uintptr_t ra) { - const TCGCPUOps *tcg_ops =3D CPU_GET_CLASS(cpu)->tcg_ops; + const TCGCPUOps *tcg_ops =3D cpu->cc->tcg_ops; =20 if (tcg_ops->record_sigbus) { tcg_ops->record_sigbus(cpu, addr, access_type, ra); diff --git a/linux-user/signal.c b/linux-user/signal.c index 087c4d270e4..53b40e82261 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -743,7 +743,7 @@ void force_sigsegv(int oldsig) void cpu_loop_exit_sigsegv(CPUState *cpu, target_ulong addr, MMUAccessType access_type, bool maperr, uintptr= _t ra) { - const TCGCPUOps *tcg_ops =3D CPU_GET_CLASS(cpu)->tcg_ops; + const TCGCPUOps *tcg_ops =3D cpu->cc->tcg_ops; =20 if (tcg_ops->record_sigsegv) { tcg_ops->record_sigsegv(cpu, addr, access_type, maperr, ra); @@ -759,7 +759,7 @@ void cpu_loop_exit_sigsegv(CPUState *cpu, target_ulong = addr, void cpu_loop_exit_sigbus(CPUState *cpu, target_ulong addr, MMUAccessType access_type, uintptr_t ra) { - const TCGCPUOps *tcg_ops =3D CPU_GET_CLASS(cpu)->tcg_ops; + const TCGCPUOps *tcg_ops =3D cpu->cc->tcg_ops; =20 if (tcg_ops->record_sigbus) { tcg_ops->record_sigbus(cpu, addr, access_type, ra); --=20 2.47.1 From nobody Thu Jan 23 03:13:41 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1737459810; cv=none; d=zohomail.com; s=zohoarc; b=LresXS+E4BGbK0CXpZEzefN5qKbdITf7wevcUXcacD8HB9/m6akr7hvnLyCRqcgF6f8LU0nXKFPBMZiR3ZsMiVdDyi8gFNW1/5bm/kDe5J8+lhFpV1M/+86Z37d410NKifllbJxykqKdEyHsbilvh0Kg/XQT5Rpvr9U32Id0WMk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1737459810; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ZpYqX6c238IVN8ObNqaQEL0twXm4e68BH00WB9vFFrA=; b=SDmqkQnAHxsD4vDhcchlCN8PJ+lHA318bThKiyVmjgTMhwOPvf7K1YCAQXlOnC+XNv92NDpgSSyWqZKsp1ID9yFf3hgWd8jqReRcdZiQCtwjcW4LM1gTBF3W7rZq1hNXvVL0S0zdQrLnQlVkpvqBxT+kAl2IeQqaeLvmv22B2+s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1737459810423427.62784172751356; Tue, 21 Jan 2025 03:43:30 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1taCdP-0005JL-1N; Tue, 21 Jan 2025 06:41:31 -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 1taCdN-0005FV-3J for qemu-devel@nongnu.org; Tue, 21 Jan 2025 06:41:29 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1taCdH-0003No-2b for qemu-devel@nongnu.org; Tue, 21 Jan 2025 06:41:28 -0500 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-4361b6f9faeso35076495e9.1 for ; Tue, 21 Jan 2025 03:41:22 -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-437c7499b28sm245220405e9.8.2025.01.21.03.41.20 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 21 Jan 2025 03:41:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737459681; x=1738064481; 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=ZpYqX6c238IVN8ObNqaQEL0twXm4e68BH00WB9vFFrA=; b=D8gRT90CbaFwhZAyuo6iH4FnIgPnfB6SVf4vinwB5YkTyLHl6t+3BqSk9PAknnHABj Pogr5SLdIpEpNpCYD3hKmfDftSJHQ1/U+Q7pJyjp37yo/RnXeMrKoGiVpS9LeNjQutgz 8Q3qmVaLNszoNTuD9F7q51tkuPqRrrwAr73GT+SLifvBl9UmFF/9NL+Hmv4wPldVqjcB OHFsCc1r4z3wnpvBN/sxhHwo+V3V8h0qEVGMqn0wOvfvV6JQR1aMZ8FXDDTKI5zTlvYJ JWZtYqTZtsGjnOKUklpPZ5U18ptPSW5C8Ul/oDrc1lCy3K9BgzUPwpEuD3e+8Yu+/Bg0 w7iQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737459681; x=1738064481; 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=ZpYqX6c238IVN8ObNqaQEL0twXm4e68BH00WB9vFFrA=; b=Gc2EUYytNPZBw2aAdy6YxbESIpogGjaUwBhWe9rzJ6ORRuShc1WDwY9ailT92JIB0+ uy8AfV/tszoGJezKTJ4deh1dD6AlZlVQ6982SnDiUPN7FaOHLO5n4tD2jMhfaOkD1CEA bz4bkQvn9mu4ODdZv6scTTCvyuZxDsm2U27gssJ57gj3CVWIlqinmC8G9P2sjmJKn7Hd CobUfC8nT8XQrvDI5WfmUwySn1bAcyPWYyfHENdesYYDK6aeO+kFPPk86NszjoycHHVt mQcP1DNxPag3uiueXXHgtFfpJOHWZlvd2pMxhVJPwVdvlRwt2AMzpUc0sGxK0/AoXHES ZRug== X-Gm-Message-State: AOJu0Yz+8W1kFtV6G3QLtfK+XusJbgjfRXCWYPoewsrlb4ehrc7ZejTN 7wGfqDm03c3JKIu/EJdm6cZjP8u/2growWHNzAqoJnDDktNmZNJ1L6NYpNN2QAWZAmyDJy037Xv D3h8= X-Gm-Gg: ASbGncvCiE3aUEdfc2yl0hK6L/9lWxKUDGrJr69ZPpgGdeC32Vsf2RMIzHS1A6jmy54 PDUVlcjXwtg6UF3jXozfLf7UFpYeCFxsFFOmD6ykYVmDgbHWW0ov0/b7VaqGdiGwc+aQFx23AmY 9++6ArARCgzDEov4Pqn+HC+D2TTqJtaRW6nF97r0t4a/Tsr4OFC25sqAF2h62iy5gF5TO3HnN8W yekSheAdLR+wT3vw65B8QTVAXqBohDJFe7EdHV1B0WQRbJWdnk3zt4l5rNof3wqm9Sch8scLenL nNltTWBsOGoW6nzG1LYdLYzSBT1WLGV6vMWvNBAyiqYY X-Google-Smtp-Source: AGHT+IECj/AjCUgw1aODfaV1DbdsklgNdgfzkjy2bPPCeT2mx7sdBBOvETv2hoHFNOd/sSopUJmBqw== X-Received: by 2002:a05:600c:4f53:b0:434:fa73:a906 with SMTP id 5b1f17b1804b1-438918c5d0fmr139458315e9.4.1737459681114; Tue, 21 Jan 2025 03:41:21 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 05/11] disas: Prefer cached CpuClass over CPU_GET_CLASS() macro Date: Tue, 21 Jan 2025 12:40:50 +0100 Message-ID: <20250121114056.53949-6-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=philmd@linaro.org; helo=mail-wm1-x331.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1737459811429019000 CpuState caches its CPUClass since commit 6fbdff87062 ("cpu: cache CPUClass in CPUState for hot code paths"), use it. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- disas/disas-common.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/disas/disas-common.c b/disas/disas-common.c index de61f6d8a12..57505823cb7 100644 --- a/disas/disas-common.c +++ b/disas/disas-common.c @@ -67,9 +67,8 @@ void disas_initialize_debug_target(CPUDebug *s, CPUState = *cpu) s->info.endian =3D BFD_ENDIAN_LITTLE; } =20 - CPUClass *cc =3D CPU_GET_CLASS(cpu); - if (cc->disas_set_info) { - cc->disas_set_info(cpu, &s->info); + if (cpu->cc->disas_set_info) { + cpu->cc->disas_set_info(cpu, &s->info); } } =20 --=20 2.47.1 From nobody Thu Jan 23 03:13:41 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1737459835; cv=none; d=zohomail.com; s=zohoarc; b=iip3HTtDXsf8LCEfDqCTBC1C2wd9JXwfei5qT+SdHYb9kHRWGgE5l3dPox+bgLNguGh6DMMxgyT8zpOEDzcdYKvMHFJVhg9ePMPwzkb9b88r6VxfOB5OorBHxjXcPgAZG1QUUy0+aA+J5RQCLpiNvCMF7V7nVYSpDd5HlI8cIlc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1737459835; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=cyX5PKm7gMuZd0pQEaHJ3A+gIhVc1meczJHLvspqXIY=; b=jBNPeCbSvfmJOYivTHgsy4nioy3WA6WRR63QCR1Zjz3dQTGQANGfgovFT9AbBqdKpGX6ebvI+/J8YBBzt3NMyHxEjrnf1SJl4mPdpsr7ujOaS4fu3eaE8/K6L/dy0RxmmmCJ6JOeoZbpgXmWukvhdCWO/IyOYqBhlNBZep36zLU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1737459835163302.9593528685392; Tue, 21 Jan 2025 03:43:55 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1taCdT-0005Mt-NZ; Tue, 21 Jan 2025 06:41:35 -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 1taCdQ-0005LV-Jb for qemu-devel@nongnu.org; Tue, 21 Jan 2025 06:41:32 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1taCdN-0003Of-B4 for qemu-devel@nongnu.org; Tue, 21 Jan 2025 06:41:32 -0500 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-3862d16b4f5so3145062f8f.0 for ; Tue, 21 Jan 2025 03:41:28 -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-4389046c59csm177990735e9.40.2025.01.21.03.41.24 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 21 Jan 2025 03:41:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737459686; x=1738064486; 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=cyX5PKm7gMuZd0pQEaHJ3A+gIhVc1meczJHLvspqXIY=; b=durdhZqF4tHlWGW02QkwKNArmikCFFDrPqG3lD9cTmciT1gpTVpPX7UG+u0uLf/Vq5 nayp1gVPvU00iwWVcNUSk9NKixOPQqCpBPwB+P+2abqf3rQqqUAW0Y3GJiZ8T4OoY6RF S2kuLuLM8cOsTe8JhENSXLMK7deBoTYZOv199P4JJ+h/NHWdf2KpYb0mIaXT4JR9AgVk McgcFUVjCypXQX4RVDR4Zl4cQWB2czaI8pTiWYziXwZeIltecfJMeYLVZujF/KVmnSzt RF42u57g91MFAC1+g1ebT3pMzT73NbgNPLazVDPEe3US/EsDb4/CZGWIep4KIL92GGPs Ff3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737459686; x=1738064486; 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=cyX5PKm7gMuZd0pQEaHJ3A+gIhVc1meczJHLvspqXIY=; b=G6CC2pHnLEWsZbJEZjY45e0a3erduTvmkRypXFgzi10yuL5lnCK9TyouBadCFssxjZ gkHFmgaNTfFwwYSOCRe+z0rYTmrQedKIHA0PJZNGahQKc3hX5wrSKB9txRRPbJ5PQ9JB /OiG7XMXzxQ/8MQuP7nenP7Mcb163Z/tJBxdDgIncPnCDNsnEgbtm1Nw2KJ6nyX5swqo KrZwpUmpajrU2X7Wm+cVjJ0BqPPmmhVMvR3vNz6ohLr8oxHfKnP3Yyo+Kgi5CX0qMhbD Xj+XzWTEoHX1APbSoBZfHwlI9+Ssfw86pi5m9RW6XYvWD54KyfOgObEZ/q3oK2I2iUGd 6g0Q== X-Gm-Message-State: AOJu0YwVPf9pvmtDr1TSsAJ3RdM0fR44hDzoKrhYNQ6Oo8X2ajQLEYDW C2hoXLtlHPwG3HtJ02Rnn2yQlLEjhu4yMT8Ley13wO/fx5MyHffSRFXJtlFMU7bu8kBk1AmEm4l AMEc= X-Gm-Gg: ASbGncvoc/KxMnSLK9A5TRxGgLkL7UJTqyN2X9CGb/Ci0dy2m9xD+69wFW1sOUihDMf 3mu+8AQVnCEmG0GU5BX0wZR7swOhu+1k0R6Lse/KzYQQt+mrOBWaJkW4HVgivTAIu3vOjXj7AIl mWAdk3tqXZBjj7YHhOWbdxgaIbJZtUVRbFcdqEr//XuKG3dzZQrnQ/HriCpfUGcd2m8iV7S/PMz J5vBQ8/nfqKK7Y/3djWkTSSJTlRgCI9pUE+pHHWDvNXWfuxppYdwVaWosKV/KX1wC3sDTYibNy7 pGmLvUGoP/SZwoAGiNYcrHcVWmFyj9BdsXQnZWQy11g5 X-Google-Smtp-Source: AGHT+IEx+UQCtRLciv8/c/J74uoXTeSchq83sY/i+Oe2hK2uv70zHQ4B8Ug2Kfgs3imx44w9PRo+uQ== X-Received: by 2002:a05:6000:2a1:b0:386:42b1:d7e4 with SMTP id ffacd0b85a97d-38bec54287fmr18087643f8f.19.1737459685675; Tue, 21 Jan 2025 03:41:25 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 06/11] gdbstub: Prefer cached CpuClass over CPU_GET_CLASS() macro Date: Tue, 21 Jan 2025 12:40:51 +0100 Message-ID: <20250121114056.53949-7-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=philmd@linaro.org; helo=mail-wr1-x42b.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1737459835611019000 CpuState caches its CPUClass since commit 6fbdff87062 ("cpu: cache CPUClass in CPUState for hot code paths"), use it. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson --- gdbstub/gdbstub.c | 26 +++++++++----------------- gdbstub/system.c | 7 ++----- gdbstub/user-target.c | 6 ++---- gdbstub/user.c | 7 ++----- 4 files changed, 15 insertions(+), 31 deletions(-) diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index e366df12d4a..282e13e163f 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -354,7 +354,6 @@ static const char *get_feature_xml(const char *p, const= char **newp, GDBProcess *process) { CPUState *cpu =3D gdb_get_first_cpu_in_process(process); - CPUClass *cc =3D CPU_GET_CLASS(cpu); GDBRegisterState *r; size_t len; =20 @@ -377,11 +376,11 @@ static const char *get_feature_xml(const char *p, con= st char **newp, "" "")); =20 - if (cc->gdb_arch_name) { + if (cpu->cc->gdb_arch_name) { g_ptr_array_add( xml, g_markup_printf_escaped("%s", - cc->gdb_arch_name(cpu))); + cpu->cc->gdb_arch_name(cpu))); } for (guint i =3D 0; i < cpu->gdb_regs->len; i++) { r =3D &g_array_index(cpu->gdb_regs, GDBRegisterState, i); @@ -520,11 +519,10 @@ GArray *gdb_get_register_list(CPUState *cpu) =20 int gdb_read_register(CPUState *cpu, GByteArray *buf, int reg) { - CPUClass *cc =3D CPU_GET_CLASS(cpu); GDBRegisterState *r; =20 - if (reg < cc->gdb_num_core_regs) { - return cc->gdb_read_register(cpu, buf, reg); + if (reg < cpu->cc->gdb_num_core_regs) { + return cpu->cc->gdb_read_register(cpu, buf, reg); } =20 for (guint i =3D 0; i < cpu->gdb_regs->len; i++) { @@ -538,11 +536,10 @@ int gdb_read_register(CPUState *cpu, GByteArray *buf,= int reg) =20 static int gdb_write_register(CPUState *cpu, uint8_t *mem_buf, int reg) { - CPUClass *cc =3D CPU_GET_CLASS(cpu); GDBRegisterState *r; =20 - if (reg < cc->gdb_num_core_regs) { - return cc->gdb_write_register(cpu, mem_buf, reg); + if (reg < cpu->cc->gdb_num_core_regs) { + return cpu->cc->gdb_write_register(cpu, mem_buf, reg); } =20 for (guint i =3D 0; i < cpu->gdb_regs->len; i++) { @@ -570,7 +567,7 @@ static void gdb_register_feature(CPUState *cpu, int bas= e_reg, =20 void gdb_init_cpu(CPUState *cpu) { - CPUClass *cc =3D CPU_GET_CLASS(cpu); + CPUClass *cc =3D cpu->cc; const GDBFeature *feature; =20 cpu->gdb_regs =3D g_array_new(false, false, sizeof(GDBRegisterState)); @@ -1646,11 +1643,8 @@ void gdb_extend_qsupported_features(char *qflags) =20 static void handle_query_supported(GArray *params, void *user_ctx) { - CPUClass *cc; - g_string_printf(gdbserver_state.str_buf, "PacketSize=3D%x", MAX_PACKET= _LENGTH); - cc =3D CPU_GET_CLASS(first_cpu); - if (cc->gdb_core_xml_file) { + if (first_cpu->cc->gdb_core_xml_file) { g_string_append(gdbserver_state.str_buf, ";qXfer:features:read+"); } =20 @@ -1697,7 +1691,6 @@ static void handle_query_supported(GArray *params, vo= id *user_ctx) static void handle_query_xfer_features(GArray *params, void *user_ctx) { GDBProcess *process; - CPUClass *cc; unsigned long len, total_len, addr; const char *xml; const char *p; @@ -1708,8 +1701,7 @@ static void handle_query_xfer_features(GArray *params= , void *user_ctx) } =20 process =3D gdb_get_cpu_process(gdbserver_state.g_cpu); - cc =3D CPU_GET_CLASS(gdbserver_state.g_cpu); - if (!cc->gdb_core_xml_file) { + if (!gdbserver_state.g_cpu->cc->gdb_core_xml_file) { gdb_put_packet(""); return; } diff --git a/gdbstub/system.c b/gdbstub/system.c index 8ce79fa88cf..215a2c5dcad 100644 --- a/gdbstub/system.c +++ b/gdbstub/system.c @@ -452,8 +452,6 @@ static int phy_memory_mode; int gdb_target_memory_rw_debug(CPUState *cpu, hwaddr addr, uint8_t *buf, int len, bool is_write) { - CPUClass *cc; - if (phy_memory_mode) { if (is_write) { cpu_physical_memory_write(addr, buf, len); @@ -463,9 +461,8 @@ int gdb_target_memory_rw_debug(CPUState *cpu, hwaddr ad= dr, return 0; } =20 - cc =3D CPU_GET_CLASS(cpu); - if (cc->memory_rw_debug) { - return cc->memory_rw_debug(cpu, addr, buf, len, is_write); + if (cpu->cc->memory_rw_debug) { + return cpu->cc->memory_rw_debug(cpu, addr, buf, len, is_write); } =20 return cpu_memory_rw_debug(cpu, addr, buf, len, is_write); diff --git a/gdbstub/user-target.c b/gdbstub/user-target.c index 22bf4008c0f..355b1901b4f 100644 --- a/gdbstub/user-target.c +++ b/gdbstub/user-target.c @@ -233,10 +233,8 @@ void gdb_handle_query_offsets(GArray *params, void *us= er_ctx) static inline int target_memory_rw_debug(CPUState *cpu, target_ulong addr, uint8_t *buf, int len, bool is_wr= ite) { - CPUClass *cc; - cc =3D CPU_GET_CLASS(cpu); - if (cc->memory_rw_debug) { - return cc->memory_rw_debug(cpu, addr, buf, len, is_write); + if (cpu->cc->memory_rw_debug) { + return cpu->cc->memory_rw_debug(cpu, addr, buf, len, is_write); } return cpu_memory_rw_debug(cpu, addr, buf, len, is_write); } diff --git a/gdbstub/user.c b/gdbstub/user.c index c2bdfc3d491..375f7f80653 100644 --- a/gdbstub/user.c +++ b/gdbstub/user.c @@ -665,11 +665,8 @@ int gdb_continue_partial(char *newstates) int gdb_target_memory_rw_debug(CPUState *cpu, hwaddr addr, uint8_t *buf, int len, bool is_write) { - CPUClass *cc; - - cc =3D CPU_GET_CLASS(cpu); - if (cc->memory_rw_debug) { - return cc->memory_rw_debug(cpu, addr, buf, len, is_write); + if (cpu->cc->memory_rw_debug) { + return cpu->cc->memory_rw_debug(cpu, addr, buf, len, is_write); } return cpu_memory_rw_debug(cpu, addr, buf, len, is_write); } --=20 2.47.1 From nobody Thu Jan 23 03:13:41 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1737459805; cv=none; d=zohomail.com; s=zohoarc; b=ZHPXAGSDXHqG5j7LnDhfNbtTdZYlbTBzo6fqmWdZiJoIg2HK5s1i1EkRTXdTgvmabwsD6vHKMv1i9AyljbU93SU7K7iAMLlykgOZ9m+yE8UCNCIU1HutHna6D6pe3hqO9NLTzJAfvgUOXMU9e+fCb2x9MUeWMMT4euJrHXPLfgI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1737459805; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=DeYTxKfeYGnuCZs4uhCLhCH6gP528hwEuAlYwVcOULg=; b=KmJN42rGIqextTHM60gjo2iQnNTOAniytEosxZ66zhQz+DIWzZYQ0RvDfpFSs4knS8VUBhfaI5k60IaYv3WxOgrX+iMcAbWIqCN1A4LIjnEodYK6X1wD2gQHv0TVTeS4H7KnaIi5pRCnKj/7eGvwQbUPRzPMzJf2T5kaz4g+FeE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1737459805491140.17846725436357; Tue, 21 Jan 2025 03:43:25 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1taCdV-0005NW-Ki; Tue, 21 Jan 2025 06:41:37 -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 1taCdT-0005MS-5s for qemu-devel@nongnu.org; Tue, 21 Jan 2025 06:41:35 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1taCdQ-0003PU-DK for qemu-devel@nongnu.org; Tue, 21 Jan 2025 06:41:34 -0500 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-4363ae65100so60364995e9.0 for ; Tue, 21 Jan 2025 03:41:31 -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-437c75290a2sm238291245e9.29.2025.01.21.03.41.29 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 21 Jan 2025 03:41:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737459690; x=1738064490; 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=DeYTxKfeYGnuCZs4uhCLhCH6gP528hwEuAlYwVcOULg=; b=W3GP7sLeHtet/KBti2TeVQYKTq+uKCeFPGzKZo0EVnE5A9L+MdrCWkU6jEjYR4WJfy nkLVVxGhkLnKGSIJiuyMgHofvMajBw3Mndls4wkbNJwQM/WuALUdV8g+nw/Jcgzn3TOy dA7DFzPHXHPfSIJ1/LKU/dZXpTiuoSu+5A4J/bcjF53Je3ot5dr37xpwdVJmnY6bFtdL OmgK2l44RmdkV2faN9mOPFqCkJJ68uerM5xFt39FaW1l8CZqK6ZQeO7n5mlTRwBGPfyF cxglLsKloocSRv7dPvrgbVWcKKVIzf/BfCpOVuAKA8TitiXoMT2iW+V9AHRGuiO5oRUC hMjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737459690; x=1738064490; 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=DeYTxKfeYGnuCZs4uhCLhCH6gP528hwEuAlYwVcOULg=; b=LbXZcQRHaIBIbnkoXrQHyHTRWKAIqY7GYfQ0R7jCC4Ywdt7zKjugkP+pbZj3CxPPNQ ZULrq+yDyGl/Qy/mdbQgIvVtja8IezfdgYm6qRy9rTccfLSDehGmI1PIN2TOjrSllNOS aiFVFfPYQbCsA4iQBiYaU+PL9WwZPSjKNVp78EZOofffA9vfj6kIDlXWKaKm1+SKGi0d vyJ/VMWhm7FkBUkmNW4xI1/16Pzeyr/Vd0PIt1ufse/HkwJBJzzp2s3W3LsxfKUhKyyy VgbLXksAtrv8j2pT/Y1vr/Kl43bVq0CLLkZxRpnK22eS1rKZVQUv97uenXZATbumFstT C/zA== X-Gm-Message-State: AOJu0YxfHW7/moh53HoFPiPuux4S8Bk6iLL3AS9cph5lWS9+Nepd9HOy 8Uoc8tasoMIxC3rDl1qKc2CuOiFuLi8j93KwBKHTpYnQPbfdYEMtLRaZiNmZCaLRDymvss+aITK gWP8= X-Gm-Gg: ASbGnctAvLuZV2ZJ5z2mmMwCCgBurJAWGX1AFYPoI/26h0gTvCxTaVF+WE0cCJ2fiz1 8YdVNAzbzel2zCCRDCqE725ppyWdy76p2cDphMBa+iYIeB/q6er06SzJ0abRo8VBJzsTPtdOsv8 lNYmBe8/Z9pWg0Bfs4rRMdsS3Ta9+XYVh2kdGtjCLc+EtMKxmAPYrYsasAjTh6/YSXHbKc8BwbI hlzDfqWeNhaFMCFKg9vPzhV5bpe8AJu1ctgvqGKr/RSJHRVYM9pcN5zBAcw8+jMVSpSBYBYhNVI f5YA37kWYZyBBlKUQ7ZK551FZmvA0EvSgnzuuVT2TLci X-Google-Smtp-Source: AGHT+IFYePQ7W9qEBZjkBoTzSbXA4iRi/jfN3vePvpN5KZLxmU/7I4ErTsDfpMpd1xt0kQIOxaZvCg== X-Received: by 2002:a05:600c:6c95:b0:438:a1f5:3e41 with SMTP id 5b1f17b1804b1-438a1f53fa6mr113851535e9.12.1737459690343; Tue, 21 Jan 2025 03:41:30 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 07/11] hw/acpi: Prefer cached CpuClass over CPU_GET_CLASS() macro Date: Tue, 21 Jan 2025 12:40:52 +0100 Message-ID: <20250121114056.53949-8-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=philmd@linaro.org; helo=mail-wm1-x32a.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1737459807733019000 CpuState caches its CPUClass since commit 6fbdff87062 ("cpu: cache CPUClass in CPUState for hot code paths"), use it. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- hw/acpi/cpu.c | 4 ++-- hw/acpi/cpu_hotplug.c | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/hw/acpi/cpu.c b/hw/acpi/cpu.c index f70a2c045e1..6f1ae79edbf 100644 --- a/hw/acpi/cpu.c +++ b/hw/acpi/cpu.c @@ -235,8 +235,8 @@ void cpu_hotplug_hw_init(MemoryRegion *as, Object *owne= r, =20 static AcpiCpuStatus *get_cpu_status(CPUHotplugState *cpu_st, DeviceState = *dev) { - CPUClass *k =3D CPU_GET_CLASS(dev); - uint64_t cpu_arch_id =3D k->get_arch_id(CPU(dev)); + CPUState *cpu =3D CPU(dev); + uint64_t cpu_arch_id =3D cpu->cc->get_arch_id(cpu); int i; =20 for (i =3D 0; i < cpu_st->dev_count; i++) { diff --git a/hw/acpi/cpu_hotplug.c b/hw/acpi/cpu_hotplug.c index 83b8bc5deb8..aa0e1e3efa5 100644 --- a/hw/acpi/cpu_hotplug.c +++ b/hw/acpi/cpu_hotplug.c @@ -62,10 +62,9 @@ static const MemoryRegionOps AcpiCpuHotplug_ops =3D { static void acpi_set_cpu_present_bit(AcpiCpuHotplug *g, CPUState *cpu, bool *swtchd_to_modern) { - CPUClass *k =3D CPU_GET_CLASS(cpu); int64_t cpu_id; =20 - cpu_id =3D k->get_arch_id(cpu); + cpu_id =3D cpu->cc->get_arch_id(cpu); if ((cpu_id / 8) >=3D ACPI_GPE_PROC_LEN) { object_property_set_bool(g->device, "cpu-hotplug-legacy", false, &error_abort); --=20 2.47.1 From nobody Thu Jan 23 03:13:41 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1737459787; cv=none; d=zohomail.com; s=zohoarc; b=ky0L8//spcwIoHrZ2VDm5jte6sXZTl6OMZOTOntmEa6m+HHk/8w/V1RqCEjpzYco6F4kkzFc5/IMBXvcSy+BlOrwzSOcVfUAH2s2uOt6f0a/H+Fr5d6Ysnviz6aTeAHsUBO1oODIKzRFQi2Xl846qtra6kgeAFTZ0EJMeza3Z7g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1737459787; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=8EBvExqekhvI6jcPU9fttVcHOfFc5T0tfJ+EZdg5nMg=; b=WGwTTQXSWIoScvZy6YNTOvmmKagXOMWCQBLschY1tU/QYLfkLIV74KYAW6KzNYcqLj+aF5jC6uBlfL+RYA2+euI2jow+pMV0DKOfC09TnNjnGSQvgkvy+aZTc9vNRue4ETmoM0XUMbFsuJlqPzsgjqfnfu5M75NF18GUVIZqUQM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1737459787700572.319757888389; Tue, 21 Jan 2025 03:43:07 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1taCdo-0005kx-1e; Tue, 21 Jan 2025 06:41:56 -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 1taCdi-0005gf-Do for qemu-devel@nongnu.org; Tue, 21 Jan 2025 06:41:50 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1taCdb-0003Qs-1f for qemu-devel@nongnu.org; Tue, 21 Jan 2025 06:41:50 -0500 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-4361b0ec57aso56670195e9.0 for ; Tue, 21 Jan 2025 03:41:36 -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-438a46b0497sm109750045e9.28.2025.01.21.03.41.34 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 21 Jan 2025 03:41:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737459695; x=1738064495; 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=8EBvExqekhvI6jcPU9fttVcHOfFc5T0tfJ+EZdg5nMg=; b=qXcuvQ8KDvy+Sqgb920fqpJBtbf6OFybJQYhK6E7vU0IVBzr0IlVvmqtOPHjn8jryR XRIN7GpHiDDPWJkT9B/cV6WertJz5Xaosrzat+WDqJRGm0Tsj6WotZfbKgVfsIfl2aVC a0HLjrdYbLFsBq31Hb7MNCptjANTuabUccZNZJnPSksINW9KqsFs9y6Peq+RzNNmTMro n1z35uhECZnjTR4+2alVZAjarNTnj7dW0nyuJcCheC1SY7bNRGkaKFxX1j4XpSmXF1ZL r5+0R8CpGtDQ0ZwUcjwO2a12rdcb0xGIZQLxCKQUX9fIbYteLXMiiXP5kujDFS77X6Kz B4bQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737459695; x=1738064495; 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=8EBvExqekhvI6jcPU9fttVcHOfFc5T0tfJ+EZdg5nMg=; b=N4vSNR0crA4tXLjS9ke1QkscJtkszGiXU0Zy2OVj0ymUF3+ORMPmIWOg9gDMaZvB9U cZ019X+MugW77zO7N6DYNFi30Zd2I13/yhwHAH7wYgAKY1HHYMNXl7Ee3eYQIhbfoHza GWfoGwiPgwTxAJl7SMoap5smCyQIPeuK7NS0sdrE/KV7fB0/kDDmrDsf2atyPVXx1xe6 SyyfsEWvlFEa+BHNG5sq7XxwR56NnmxUR6Kh0eQhSrptfPvfr01RJ+NDkcWADFHSzgtd nb2xyQZqulB9ws/LUGPbZouaHzMg+bWsk/91jbSoYneGbeNswBFDNJ72Kp4JGeQnG96r qY0w== X-Gm-Message-State: AOJu0YzxYyiN6Wz6tYeOEgapAWKS5v5MBwVZ3esFej7rDqPdG9WFPjn2 0lnWMs1I+U1dUDnNlC+NkUg3qhDVJBjDP/Hbr73yd+d3Bgtpu8e5ApYKvdBkffiEEwb1yVwW8kS Rj5o= X-Gm-Gg: ASbGncu2THvvlFKSH0SljSV1rEwOwuuPVyrdmy5DUJGmjzD/kSVb5EaWhaAlKPEcAUT 44YMPC+45ImYQLsz5srL2QmQZGliY+JIRfN0pZfZdomRPAH7xrxzJK9gChMk0dADl5G8/3gacZF FYKyFoYTIHAG7TiIMp7wWjUHfMAwLfBITCudB6S1J1Ps5i+wvLhvip2XxtM45H5O9+p7lgFoL57 EsQeJBYiKl9+VTBukn9JJ3u1tRG5xGrHv6CKpsuIbu0QUDfAIvuXryY9+J0ovg0OnxEFTjXYEGZ dczTGwRs/RekZpiQTMbr4f7HXcNtt4beRrI1/kMpMhKP X-Google-Smtp-Source: AGHT+IE+K5MC6VWNvBNlmvep3x60OHi1bN+kYIodq+lGzOgTwLM8ACjm1FxvjtkMJ+iiA85448mYhg== X-Received: by 2002:a05:600c:511b:b0:435:14d:f61a with SMTP id 5b1f17b1804b1-438914304a8mr123262745e9.25.1737459694869; Tue, 21 Jan 2025 03:41:34 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 08/11] hw/core/generic-loader: Prefer cached CpuClass over CPU_GET_CLASS macro Date: Tue, 21 Jan 2025 12:40:53 +0100 Message-ID: <20250121114056.53949-9-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=philmd@linaro.org; helo=mail-wm1-x32c.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1737459789251019000 CpuState caches its CPUClass since commit 6fbdff87062 ("cpu: cache CPUClass in CPUState for hot code paths"), use it. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/core/generic-loader.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/hw/core/generic-loader.c b/hw/core/generic-loader.c index fb354693aff..0ddb3a359a2 100644 --- a/hw/core/generic-loader.c +++ b/hw/core/generic-loader.c @@ -48,11 +48,8 @@ static void generic_loader_reset(void *opaque) GenericLoaderState *s =3D GENERIC_LOADER(opaque); =20 if (s->set_pc) { - CPUClass *cc =3D CPU_GET_CLASS(s->cpu); cpu_reset(s->cpu); - if (cc) { - cc->set_pc(s->cpu, s->addr); - } + s->cpu->cc->set_pc(s->cpu, s->addr); } =20 if (s->data_len) { --=20 2.47.1 From nobody Thu Jan 23 03:13:41 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1737459745; cv=none; d=zohomail.com; s=zohoarc; b=XzntBk9o00q6qJcjJW0JLvN31FnCmEvACrev0likhqqbv6++vqirOZSI+JhKU6z65FLJsO6jymAb/DtMo3xzKYBnLDi3dgtqFFVksO8F8xqDXeIZuJ0ODnKReilOuwL+3b3dHfkHOrL5n+I815o9tFDf+aYzQMam+FHT8LnNCpc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1737459745; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=sbmqBhov6nOW5WRBICFiiuCzE2uEl3xQcd3ZviTByWc=; b=jhuLn3rgGETSjJM+9PEgQz4FbJOostHBFLeMoC4tqQZMuog/r1sNGcFGGvnog+I5y16WwegNEtWFsyZKKNABiTLo3HzhjMsTQ0cDBXSuhT1sAKMQjGHD8WtZSnkoqaD/UdlVKQtXEmhLhT+lb661Vo3Xafm+UCXDu9HJcf7iNUs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1737459745643895.0768291908631; Tue, 21 Jan 2025 03:42:25 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1taCdr-0005px-PO; Tue, 21 Jan 2025 06:41:59 -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 1taCdi-0005gg-Em for qemu-devel@nongnu.org; Tue, 21 Jan 2025 06:41:50 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1taCda-0003RU-V3 for qemu-devel@nongnu.org; Tue, 21 Jan 2025 06:41:50 -0500 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-4362bae4d7dso39752305e9.1 for ; Tue, 21 Jan 2025 03:41:40 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38bf3221b70sm12914454f8f.26.2025.01.21.03.41.38 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 21 Jan 2025 03:41:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737459699; x=1738064499; 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=sbmqBhov6nOW5WRBICFiiuCzE2uEl3xQcd3ZviTByWc=; b=dsnDzGPke5MdZwrS83aUUy8aE0nfygNv4So3jBELCOgnquQVI/tzUc4w+8uJs0kRbN gBjMThm094Vq+r9yxP5m7BHYPx3gVxHNO7rjSipUSN5zhW5zh34CZQXM42az/bn547Qt hUKbN80fpWs2SkbHfLTT3un7OcFtEh9Roh0MIAF7ARWp0EiJI1pQVhpElnkuaTB/7big POaawaOAvkhBCKCcG70nCdNSyEe5ON7d2ndkumxIeY6r3LwQKHmjywomR1ktkbsEWISy vTOfYgrUO15ppGbBI3K10ZENd1ZPfnjLbaMAQ2km5z9AiYpicD857lQiuhWNmTa6LPSr 8BzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737459699; x=1738064499; 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=sbmqBhov6nOW5WRBICFiiuCzE2uEl3xQcd3ZviTByWc=; b=ZFxexqUmW7gdFCLDh16F4oIrdp5rMURBviVi8bYLpTkyOHNgHN2Z6/KKV24DM9bpjO zwIfofffZsWFCPrgaHBkAqEHwm3/GpxLcL8FhwBQNCVFK2cQW1dXZW1BWCZfxp2wAg5t GnBTX2aD6CBppRjLreNc9DFMQ2OsI9I5RsuxpwXNLnIcB1H0QgAo6hL5u/NLSEpApztw 0UkGhifQNlNmNg71FU9ngj/y7w3jDXIV0Szjz9tHCiqRoZm1KpaPkPAEzbmZaP38VQyS urMy7etN3pdekY7M1aDA9WDXygGCDIbZP9h8COwH3KUCR4o96uW+MjPQensj4tMgOwXA ntqQ== X-Gm-Message-State: AOJu0YyxYF49j8QnPdiH6vEfHVn5gnKnRvfBM/hclQIsTWcIuM8KvuaX tURLHXfWSuhfUqFYAP44roqqCRipcr9M8zTd+LxeBnL4Gwzm1zjjScNZ+oGP9rEr5FKvEoDivXW eyas= X-Gm-Gg: ASbGncs5ytloeeBZ1jOUDe99fszUw+hXXnAUGMphMLh/yKjoj3aJ+mGcEK+u1HjN7oA 6D8Ba2VboeqcwFf8R5V0SHgt2z39+v33/gH2LpTXOIcEChVfS/7fhTY2bgbqdVamxX89mG0TDAz lhocced2Ew2pYGioK8eWfmVzwszo7hTkggEchKCpp069Bv4idKSi66Z7rQGa918I34wS7vBIh7D nB9cA0vaJKJrM1wMiVI0/TQk6Xd5yt+mEGf0okGASeCJdOUKAN5VWZ/Z6tDNuStpfrGIxpD9txp 12aOxjAyXnvCMIiJZx4IjtRf1/fn/8cMAen1iOuUg1o8 X-Google-Smtp-Source: AGHT+IFvrLae6bJODFDwt+1EVnAkGSeOwOakfLBXI2a6CaNkQA7Dm+nSRgUsdOq69rgIxYGYYEYnSg== X-Received: by 2002:a05:600c:4ece:b0:434:f609:1afa with SMTP id 5b1f17b1804b1-438913c6787mr153654015e9.4.1737459699396; Tue, 21 Jan 2025 03:41:39 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 09/11] target/arm: Prefer cached CpuClass over CPU_GET_CLASS() macro Date: Tue, 21 Jan 2025 12:40:54 +0100 Message-ID: <20250121114056.53949-10-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=philmd@linaro.org; helo=mail-wm1-x332.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1737459747011019000 CpuState caches its CPUClass since commit 6fbdff87062 ("cpu: cache CPUClass in CPUState for hot code paths"), use it. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Alex Benn=C3=A9e --- target/arm/cpu.c | 3 +-- target/arm/tcg/cpu-v7m.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index dc0231233a6..048b825a006 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -846,7 +846,6 @@ static inline bool arm_excp_unmasked(CPUState *cs, unsi= gned int excp_idx, =20 static bool arm_cpu_exec_interrupt(CPUState *cs, int interrupt_request) { - CPUClass *cc =3D CPU_GET_CLASS(cs); CPUARMState *env =3D cpu_env(cs); uint32_t cur_el =3D arm_current_el(env); bool secure =3D arm_is_secure(env); @@ -946,7 +945,7 @@ static bool arm_cpu_exec_interrupt(CPUState *cs, int in= terrupt_request) found: cs->exception_index =3D excp_idx; env->exception.target_el =3D target_el; - cc->tcg_ops->do_interrupt(cs); + cs->cc->tcg_ops->do_interrupt(cs); return true; } =20 diff --git a/target/arm/tcg/cpu-v7m.c b/target/arm/tcg/cpu-v7m.c index 03acdf83e00..d2d0b94b630 100644 --- a/target/arm/tcg/cpu-v7m.c +++ b/target/arm/tcg/cpu-v7m.c @@ -19,7 +19,6 @@ =20 static bool arm_v7m_cpu_exec_interrupt(CPUState *cs, int interrupt_request) { - CPUClass *cc =3D CPU_GET_CLASS(cs); ARMCPU *cpu =3D ARM_CPU(cs); CPUARMState *env =3D &cpu->env; bool ret =3D false; @@ -35,7 +34,7 @@ static bool arm_v7m_cpu_exec_interrupt(CPUState *cs, int = interrupt_request) if (interrupt_request & CPU_INTERRUPT_HARD && (armv7m_nvic_can_take_pending_exception(env->nvic))) { cs->exception_index =3D EXCP_IRQ; - cc->tcg_ops->do_interrupt(cs); + cs->cc->tcg_ops->do_interrupt(cs); ret =3D true; } return ret; --=20 2.47.1 From nobody Thu Jan 23 03:13:41 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1737459820; cv=none; d=zohomail.com; s=zohoarc; b=cfKlfldDX6vTMcTyuQ1zFsH68LFIZSU66nbAPRDN0Hn1r44yN+4zjDDbXtWtfMU0iS7t5AnsGPWngfPNykYpFwpM6CiKziP2PIXqlRh5aJZLGgi1x1JUysc/sk19uBiPduk3uW0N/P9unMRuMMm26WNliXlykd9zfMScR7bVe0E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1737459820; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Yh+UbdQGf2CtgAWqdvcoJx6GX/6Sn3uz5UbIP9DkSEk=; b=DmLhIj+sQnj7V+/fAHJwRbQ1h4NpH+CGbZ006d6ZtTeZROqPV+qP9VloqjVxiLhrm/PXQiJB4jO1PqdPtuFLEMTV4wpRVIgO+rFLTeJoxbuMTEcen6Hjhl1852xDFjbvffzEmdyC13GcYEe1q8ncMgjKuTLbJtEWPb76r2wb3HY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1737459820863202.87519140566803; Tue, 21 Jan 2025 03:43:40 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1taCdy-0006C1-BA; Tue, 21 Jan 2025 06:42:06 -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 1taCdo-0005mI-4I for qemu-devel@nongnu.org; Tue, 21 Jan 2025 06:41:56 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1taCde-0003SE-4q for qemu-devel@nongnu.org; Tue, 21 Jan 2025 06:41:55 -0500 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-4363ae65100so60368435e9.0 for ; Tue, 21 Jan 2025 03:41:45 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38bf322ad74sm13306034f8f.56.2025.01.21.03.41.43 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 21 Jan 2025 03:41:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737459704; x=1738064504; 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=Yh+UbdQGf2CtgAWqdvcoJx6GX/6Sn3uz5UbIP9DkSEk=; b=iVXMX4Afse8Ls9EleNrGaQi6H1jLrCe8oY+qSVfz5FxobB61/BJPq3+vCmd9tOFnJZ HruneO/E+hQymS7KdnfC3pzkiYmrX/ULB3LjFprmwFuYJ2SjBf/epyGAMIF35I5zc1qk UzCsy6+K2gPLitu6U2WWlI3g7gbw8BRSrU17khVl2CXOObLXJyIv88aziLM/k/amzNp5 52Y//zBSCPm+vcUNMgNiz8usjKBPVFGcNN/caazty6qDl7k7T5pqmdNLhqU978AgvrsI Gfo8wX3D8AiIpYx0FiSwVKLpbr+AO8rXar0dshP1Ni8WSBv9xzjI7ijUQLivBIM0DmfE w9Sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737459704; x=1738064504; 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=Yh+UbdQGf2CtgAWqdvcoJx6GX/6Sn3uz5UbIP9DkSEk=; b=Ra2Phdul7BjfIgGl0I24aW6aR9qK1VnbifT8yKSU+M6oA0HlK9tYLYSTTcUfF21KN2 ySRZ+HG8jHqYbT1JSNw+D1G5Jo6uzZz6yMi8ueL7RMGcpfvc1g4QqoUskj0ALeFp+mL9 VbJwIaAHKhWVGq7N8LGG1SFtstSduoAhYGEnsxkRmIrxOZMHPQ0D0AbUfUEl/AnUNbei IopH27vmtUg6F7rNITqg0Oo0PhrcY40xEUdHQM9pNwAl9aYtF91DlALsZsQzmxjdtcf4 vLvuDAkySrfMLt90ynwzIxXD6n0c1Di5U7VGh7rDtx9ntCoV2cgw6mRBCnsfUGfA3dQ9 K59w== X-Gm-Message-State: AOJu0YxdrV24AhiO6GoAk0+XvsCPKhUSbJHJjsYWuHQ7vhZz55THExMV zMGrNAs44D2kOEoga7rguNj5v1PsSandDc0d2HDm9dne1WpRdh4wED5z9b5skTCiCx2UqH67fF9 OVJo= X-Gm-Gg: ASbGncsMzJe78P88Zrt3UZF2VwaHoCnPCWzQJWjtN9cp+Jh068knsZi/Oy5sExXm/Om HRbC5roJKXlpGejA8LtKkGzXbjfWlBJYDDdFyc+F4kqMPSJ7N8XoX4FbDhhBHOe66WVC0l/wDDL ZqAmI/nouE5+xp3OsIn1Tt3PkNzVkwBrsOWw4IHjnpOLfzReRh5bb98EqqaTDD/9Vb7ndKuEQxv PofcHaf5mg/Yi0RVXRdyUqLPRIvYwwgGCOeWKUpeQ3gEaI1Xp0HUwrH/arCbZUU2FRQVwbjjgdI GI+bQH3vNSJAONqi9avXd/pAHy5CVkaCMQqm9y0ZBK1t X-Google-Smtp-Source: AGHT+IFpB2rYVUvGYR5mMClkISZgoJI9xiLPY4vVTM3qUpJkrxr1utH7Jel7yEGJjtEsgQDQLXYGqg== X-Received: by 2002:a5d:6da1:0:b0:385:dc45:ea22 with SMTP id ffacd0b85a97d-38bf57a7746mr18709934f8f.39.1737459704005; Tue, 21 Jan 2025 03:41:44 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 10/11] target/microblaze: Prefer cached CpuClass over CPU_GET_CLASS() macro Date: Tue, 21 Jan 2025 12:40:55 +0100 Message-ID: <20250121114056.53949-11-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=philmd@linaro.org; helo=mail-wm1-x32f.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1737459821434019000 CpuState caches its CPUClass since commit 6fbdff87062 ("cpu: cache CPUClass in CPUState for hot code paths"), use it. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- target/microblaze/gdbstub.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/microblaze/gdbstub.c b/target/microblaze/gdbstub.c index 09d74e164d0..8b08ed5cb49 100644 --- a/target/microblaze/gdbstub.c +++ b/target/microblaze/gdbstub.c @@ -110,11 +110,10 @@ int mb_cpu_gdb_read_stack_protect(CPUState *cs, GByte= Array *mem_buf, int n) =20 int mb_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) { - CPUClass *cc =3D CPU_GET_CLASS(cs); CPUMBState *env =3D cpu_env(cs); uint32_t tmp; =20 - if (n > cc->gdb_num_core_regs) { + if (n > cs->cc->gdb_num_core_regs) { return 0; } =20 --=20 2.47.1 From nobody Thu Jan 23 03:13:41 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1737459787; cv=none; d=zohomail.com; s=zohoarc; b=m+WrYcjB9C+AIuod5jF/KXpoJ8Ds7CPb7ZTeFLcFoHWL23WDwdzcvsC9cbn6cqVgBGRGp3bLT3tpfYc0KEPBXrtmGInDxPTJSEU3/K7JxobN7poVzovFVd1SG9e0WDYMVF0br9bmB3l8+vBRjsDatn189+hqTiysyNFFxqELkUM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1737459787; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=JKO/X1IO97t8jG/iIr5dS6mXwUKP9YiNx8QxL9MbrbA=; b=jl7ygjINLvFiStUIwYbkycIwUZiHQXXI/B+G9os6qrZx6Hv81T2Lh3//qFlmuNEgyJ95OgKQD1DlbWCZ5exTW1k2E4Ax7q+wsDf6x41+qN4yMjIOicyWn6+74QBk0tUvi8T7jiRVPO0erlgpoyV8+++eubTyOj8KpwzR+j3nkXQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 173745978743131.43809866006859; Tue, 21 Jan 2025 03:43:07 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1taCdu-0005zG-5Q; Tue, 21 Jan 2025 06:42:03 -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 1taCdr-0005sI-Cr for qemu-devel@nongnu.org; Tue, 21 Jan 2025 06:41:59 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1taCdk-0003Su-5S for qemu-devel@nongnu.org; Tue, 21 Jan 2025 06:41:59 -0500 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-4362bae4d7dso39753585e9.1 for ; Tue, 21 Jan 2025 03:41:50 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38bf322a859sm12903513f8f.43.2025.01.21.03.41.47 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 21 Jan 2025 03:41:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737459709; x=1738064509; 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=JKO/X1IO97t8jG/iIr5dS6mXwUKP9YiNx8QxL9MbrbA=; b=mv7Ew0+1zn6sgpGDe8hH7tsfmrArrw8vfYhUwUt9G9tbBQccn+h3bZnIlnGWMUdp8N tbL9a3CRJXhFKE7o9vtsiGIjxIyur32sEe/vpoa9C10lRzSZ2fyTf4q6l3+T21hRommT xOQbsy53MiICeuAmxepsmm5xn/Ghqr4ySXrqLYMtp2j/ce/igmxdsbIz6FaTqiRT3gei ya8PRkY987XkIyQdjPa5W/be64Yej/1m7ahaeANEmPlDaoDxIWwp4UnStVvbg+aa+DZH cqUHvh+dxlaCegVq1/KoIlNcR00RVZbUQZz7bZMkmeu2k+U5/otl7Pptpa6CqdaAHI5A FVJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737459709; x=1738064509; 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=JKO/X1IO97t8jG/iIr5dS6mXwUKP9YiNx8QxL9MbrbA=; b=l13eeCtixFMbx7zsrL9QOKPeNuRBnRH6dBwtIhaVdxUNupvGahkkg+lZDBssBIzDVw s5R9pnjyctRySzp39SlvtfsGJNV8uXm/+3dw+kkrO5B06wQedw+h6OHpFQCVQlB+JShr TF2eLFmihyTGaBNzQ38+2UKmbC1doPQPMR/nxhxYhKNR3AXTisiPhN/9xON95K2WRKi7 tvtOtD5v01Qz2NDJ2/K3wuMz8rR4HEO2+wXgNFDgfVdKJ1xo5N+1cXgze18uMgWO3lbW S5FRg1S4dLWjZRCbEDN8nU+3SXb0o64abOtqab8WUcT01YoDPVc1uQ2BXMXqzoG+yhm7 UXUg== X-Gm-Message-State: AOJu0YzQig0wXWBgrv9F8ZUsywyFBAxeCLNjOU/T8LiZNS68+NXksqzm hEpSkxHqC45Y8kgeVynGRP6UD18XVc1prZjQZSjAKuj3oMcotQOcwDof7kHXFwWHOnHq7k1p+/x dcHA= X-Gm-Gg: ASbGncuQ8vPzqLc0jOPiYyDhteIzefnjcM2NtNZYwpA4xxXGpwV3jwtGNwK+1pSHz4S IjqzFIW/yUBAGZyEFJQ6t5+1KIhfftajMzy73mGAuQuMStrYoxA7rqZQpy8sNhSEizKQWnpRbxg rUjM3tq51V8pnjXVQMoUxKcbfY3wcn+aC6V0FoZq8OOfnsXPnmq8j3t2PshcLiNDXy3mCiD4vmF 04a9ewXmfqUCug7oTQk2mDw2lVhcT2KXe2g4P0RGZA6+x5GXkx3lIEBIaW69SIUy4upyB51KkSW BwsdzfwvIQ9oy3su03kD8c6XdRfSr1YnVptvdGj6jpoU X-Google-Smtp-Source: AGHT+IEF6r/BOM15SlwCgbDLBO7CnzXyrWtA2PXkV9Mzb5yTQDnNfIiv2ZYAH4Cn6iQ5ZwFQlubQ1A== X-Received: by 2002:a5d:64a3:0:b0:38a:624b:d55e with SMTP id ffacd0b85a97d-38bf57a684fmr18798886f8f.41.1737459708732; Tue, 21 Jan 2025 03:41:48 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 11/11] target/openrisc: Prefer cached CpuClass over CPU_GET_CLASS() macro Date: Tue, 21 Jan 2025 12:40:56 +0100 Message-ID: <20250121114056.53949-12-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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=philmd@linaro.org; helo=mail-wm1-x32c.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1737459789250019000 CpuState caches its CPUClass since commit 6fbdff87062 ("cpu: cache CPUClass in CPUState for hot code paths"), use it. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- target/openrisc/gdbstub.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/openrisc/gdbstub.c b/target/openrisc/gdbstub.c index c2a77d5d4d5..7b6a31fc97d 100644 --- a/target/openrisc/gdbstub.c +++ b/target/openrisc/gdbstub.c @@ -47,11 +47,10 @@ int openrisc_cpu_gdb_read_register(CPUState *cs, GByteA= rray *mem_buf, int n) =20 int openrisc_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) { - CPUClass *cc =3D CPU_GET_CLASS(cs); CPUOpenRISCState *env =3D cpu_env(cs); uint32_t tmp; =20 - if (n > cc->gdb_num_core_regs) { + if (n > cs->cc->gdb_num_core_regs) { return 0; } =20 --=20 2.47.1