From nobody Tue Feb 10 07:57:43 2026 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=1711370594; cv=none; d=zohomail.com; s=zohoarc; b=YnM5+R+uNeMoyHchxfB11Ff1ZPyuJYjecs3vPjmXF4WybEaHGEAsz7AwCBHe6QKlrPIqbgE4mwOZX0qamjXomF0yPvlvOqHdC/jp1kJRiBTJ6hobPVXhqtzL5bOanb+w62N9TsqTfsNO+zZZAObSd2r1RXGxuowmdNFAAVMBaZU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1711370594; h=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=ZVTG3jxPFJmDWs7WR0b95XLJPKuzwHMgZ07dA9hMpsY=; b=AUYTjQjiZqvErpqkpqElz1qXNzi27hrrs3vppwbABQez+hv1LuUQo4dybI64SK3/lwv6TTgbpA+Csu4bVJ1M0mkDCX6R/DjVcXNRYI52hZA52VfpHUF+W7m59taWCiA6glwrNrxt5O6banf3YBIoiDrrCpgEiWd+dRWpEEha0uk= 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 1711370594882782.5121777449372; Mon, 25 Mar 2024 05:43:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rojfH-0000jN-QP; Mon, 25 Mar 2024 08:42:59 -0400 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 1rojfA-0000OL-HF for qemu-devel@nongnu.org; Mon, 25 Mar 2024 08:42:53 -0400 Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rojeq-0006gg-Lz for qemu-devel@nongnu.org; Mon, 25 Mar 2024 08:42:52 -0400 Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-515a86daf09so1713448e87.3 for ; Mon, 25 Mar 2024 05:42:32 -0700 (PDT) Received: from linaro.. ([102.35.208.160]) by smtp.gmail.com with ESMTPSA id t20-20020ac243b4000000b00515b1b3a2bdsm35231lfl.194.2024.03.25.05.42.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 05:42:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711370550; x=1711975350; 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=ZVTG3jxPFJmDWs7WR0b95XLJPKuzwHMgZ07dA9hMpsY=; b=a2K5baTf/WfKnDhKFgaK70WEcKnXwEgj4Avj5NXOifiE7kiE74T1PiV8d+6Mbinh5Y Ksu3k3KLiQIXNMdatVtDkauZEbRHRyXMq7A4lpjoB0LwUV+Qo+/YVdbPZdqKaDbW4RpB bOzoB4/93NJuyNZKzfJMUj6Ii/h4UANp98FkZCC4SBadlVjQYFhrgVlG23OJqSfzu2sB 3w7qSR2xZxIdRsXfK02bh00Rbfi4AOf9XHgD9siG/srVTwxK03bOuqEbDXwtlaywf5UR +C7Fg11FeL5KyZ7CD2Wl2rF+3E09FFJFWcQ5qdPjC2a5/xxTNdHQ7LyQ2gEIubnkzmG7 31qA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711370550; x=1711975350; 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=ZVTG3jxPFJmDWs7WR0b95XLJPKuzwHMgZ07dA9hMpsY=; b=eST7PnEsOJ+A0axb+9sx3UpK0+6/SJUCbkdtCgKBhRcSXDjPzYIjpGwPrzYSa4fNaA RNs+CbSIEGD6qlSdPiUk/cmoPtHnDMwVXTqi/kUmeiH3V9Cl72Urqoa/ja45iPqlPIEg fsOqKcj/Z2tyOgkq5L9I4yMes93jK4YnufIQiyPiXvPw+FkaX/wkNNuhmin+Y4GYEzox rjskr0uSveHA2p8ZoVZKJQ8cJrRqQvIpCZrpBSTE/XutmzpAniU2h0IDOU/zaKPF8SR4 kLPjcJTWYMvmPixyd9kgdrwLhSlc7y8gybesF88efkdoJSUcT51Atl8ui1GXnZWBBSXx uC8w== X-Gm-Message-State: AOJu0YxColvhjJWxrT9uz/T6J9+rvGLH8Z+EJVB3c5aPPWtVwckVVqOa wdukWSEWd9jybSZTgAvZmQXc3IGcDIftNSnnfXF5Kv0DVDqay/LYg9SHzccrj1jpzyK4DppxtQD D X-Google-Smtp-Source: AGHT+IF33O8+50Vc8/aTpacYxOmPCVTReJPdNIGrTBJEO6Bie5x6CLNtYSAQEpjJ2CEZ4YkLixfiYQ== X-Received: by 2002:a19:e001:0:b0:515:9dcd:22ae with SMTP id x1-20020a19e001000000b005159dcd22aemr4305654lfg.66.1711370550130; Mon, 25 Mar 2024 05:42:30 -0700 (PDT) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Alexandre Iooss , Pierrick Bouvier , Richard Henderson , Paolo Bonzini , Mahmoud Mandour Subject: [PATCH v3 8/8] plugins: extract cpu_index generate Date: Mon, 25 Mar 2024 16:41:51 +0400 Message-Id: <20240325124151.336003-9-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240325124151.336003-1-pierrick.bouvier@linaro.org> References: <20240325124151.336003-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 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::12f; envelope-from=pierrick.bouvier@linaro.org; helo=mail-lf1-x12f.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, T_SPF_TEMPERROR=0.01 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: 1711370595647100005 Content-Type: text/plain; charset="utf-8" Signed-off-by: Pierrick Bouvier Reviewed-by: Richard Henderson --- accel/tcg/plugin-gen.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c index 16618adf1bc..e6fd6fdfae5 100644 --- a/accel/tcg/plugin-gen.c +++ b/accel/tcg/plugin-gen.c @@ -108,12 +108,17 @@ static void gen_disable_mem_helper(void) offsetof(ArchCPU, env)); } =20 +static TCGv_i32 gen_cpu_index(void) +{ + TCGv_i32 cpu_index =3D tcg_temp_ebb_new_i32(); + tcg_gen_ld_i32(cpu_index, tcg_env, + -offsetof(ArchCPU, env) + offsetof(CPUState, cpu_index)= ); + return cpu_index; +} + static void gen_udata_cb(struct qemu_plugin_regular_cb *cb) { - TCGv_i32 cpu_index =3D tcg_temp_ebb_new_i32(); - - tcg_gen_ld_i32(cpu_index, tcg_env, - -offsetof(ArchCPU, env) + offsetof(CPUState, cpu_index)= ); + TCGv_i32 cpu_index =3D gen_cpu_index(); tcg_gen_call2(cb->f.vcpu_udata, cb->info, NULL, tcgv_i32_temp(cpu_index), tcgv_ptr_temp(tcg_constant_ptr(cb->userp))); @@ -128,9 +133,7 @@ static TCGv_ptr gen_plugin_u64_ptr(qemu_plugin_u64 entr= y) char *base_ptr =3D arr->data + entry.offset; size_t entry_size =3D g_array_get_element_size(arr); =20 - TCGv_i32 cpu_index =3D tcg_temp_ebb_new_i32(); - tcg_gen_ld_i32(cpu_index, tcg_env, - -offsetof(ArchCPU, env) + offsetof(CPUState, cpu_index)= ); + TCGv_i32 cpu_index =3D gen_cpu_index(); tcg_gen_muli_i32(cpu_index, cpu_index, entry_size); tcg_gen_ext_i32_ptr(ptr, cpu_index); tcg_temp_free_i32(cpu_index); @@ -163,7 +166,6 @@ static TCGCond plugin_cond_to_tcgcond(enum qemu_plugin_= cond cond) static void gen_udata_cond_cb(struct qemu_plugin_conditional_cb *cb) { TCGv_ptr ptr =3D gen_plugin_u64_ptr(cb->entry); - TCGv_i32 cpu_index =3D tcg_temp_ebb_new_i32(); TCGv_i64 val =3D tcg_temp_ebb_new_i64(); TCGLabel *after_cb =3D gen_new_label(); =20 @@ -172,15 +174,14 @@ static void gen_udata_cond_cb(struct qemu_plugin_cond= itional_cb *cb) =20 tcg_gen_ld_i64(val, ptr, 0); tcg_gen_brcondi_i64(cond, val, cb->imm, after_cb); - tcg_gen_ld_i32(cpu_index, tcg_env, - -offsetof(ArchCPU, env) + offsetof(CPUState, cpu_index)= ); + TCGv_i32 cpu_index =3D gen_cpu_index(); tcg_gen_call2(cb->f.vcpu_udata, cb->info, NULL, tcgv_i32_temp(cpu_index), tcgv_ptr_temp(tcg_constant_ptr(cb->userp))); + tcg_temp_free_i32(cpu_index); gen_set_label(after_cb); =20 tcg_temp_free_i64(val); - tcg_temp_free_i32(cpu_index); tcg_temp_free_ptr(ptr); } =20 @@ -212,10 +213,7 @@ static void gen_inline_store_u64_cb(struct qemu_plugin= _inline_cb *cb) static void gen_mem_cb(struct qemu_plugin_regular_cb *cb, qemu_plugin_meminfo_t meminfo, TCGv_i64 addr) { - TCGv_i32 cpu_index =3D tcg_temp_ebb_new_i32(); - - tcg_gen_ld_i32(cpu_index, tcg_env, - -offsetof(ArchCPU, env) + offsetof(CPUState, cpu_index)= ); + TCGv_i32 cpu_index =3D gen_cpu_index(); tcg_gen_call4(cb->f.vcpu_mem, cb->info, NULL, tcgv_i32_temp(cpu_index), tcgv_i32_temp(tcg_constant_i32(meminfo)), --=20 2.39.2