From patchwork Tue Apr 22 19:26:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 883111 Delivered-To: patch@linaro.org Received: by 2002:a5d:474d:0:b0:38f:210b:807b with SMTP id o13csp2595824wrs; Tue, 22 Apr 2025 12:59:02 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV4B+z+0qQri3RTIh25no8SzekfZJVbxKy01O+G0JGQvwVe2IaoLQMSaoQvpexOHuBtLtkciw==@linaro.org X-Google-Smtp-Source: AGHT+IERlvOoH9Fnhebi9UjvNWDU+MeiY4XiPNVuI6V8gV+ojzDSUHzDD/WPX36iIAKIbJ2r40Dx X-Received: by 2002:a05:620a:240c:b0:7c5:a513:1fd2 with SMTP id af79cd13be357-7c927f59459mr2515212885a.6.1745351942267; Tue, 22 Apr 2025 12:59:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1745351942; cv=none; d=google.com; s=arc-20240605; b=ic5bUroy74YM1clBSAq931DnW7C2sSVp8Lab9bS+UVUG7SyIwURCCsNNkHFTmztK58 woJc58JPYtzgTYc7QlIDfSX2Aos/jsUZQfQBaarQohbJvWDzS0YIahe5L+H+0wDvqkh8 QioXEsnZBVpAsp1XoqhHtzKv7XkptnV/tsvmCY68Yrg5Wz0C4CFdM5F280em53ZHY/lL oRagh48TDvtFS0zSfknXv69jtFwfsE288lnxmNtaRBrvGlAtvxiwh39k9wbBv2hGixPk hoprRTlKqbPnk67os035MvbrErtJf8TwZ+vxob/59YDsKaNCBSdRVZR/LMkaqjmQ0tju VC5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jprqwHHwWojdGfQ1QgUvwGwX1dYcnH5RZgYMJfPxUv8=; fh=Gx9DtyNvQGBGx72Z12no3KggLYwBGD0Je53Cblw8uQs=; b=NZqL7GC8GApdnL3Kb5seyILHF0aMRWp2PetprMknRMVD4ivGR++lhLY+Wy9gAgpPh7 +9TZ1WgyMlEC1mOuV4FMfVbErwaygWD2jXiUo6GB7dY+P2AcGWtLYO/4tAAdP+rXgFUo P5fIS8msdrrJZO8nH+/K/LpurHOqDkA/MiSiDP8Ut8jSXwelFXGCvKAB4E65YPscUwjB 7YBExA+h91tsjI4ak4H6rp5CUcYALuuYKGJiUVE1ES3TbdQKcmZwRh+aqjX1zH9JYYYG 8RGfYg/DuTJlbQwSh1eaONC1ZVxiwcgQAzRKRYx6p95YXGKqmO4uPF72wRiUH9wacyIo 8CfQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mQGACf9d; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7c925b8148esi1129420085a.261.2025.04.22.12.59.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 22 Apr 2025 12:59:02 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mQGACf9d; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u7JId-0002aM-4r; Tue, 22 Apr 2025 15:28:55 -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 1u7JIP-0002Ue-LG for qemu-devel@nongnu.org; Tue, 22 Apr 2025 15:28:43 -0400 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1u7JIJ-0006CI-06 for qemu-devel@nongnu.org; Tue, 22 Apr 2025 15:28:40 -0400 Received: by mail-pj1-x1029.google.com with SMTP id 98e67ed59e1d1-2ff6e91cff5so5299808a91.2 for ; Tue, 22 Apr 2025 12:28:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1745350113; x=1745954913; 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=jprqwHHwWojdGfQ1QgUvwGwX1dYcnH5RZgYMJfPxUv8=; b=mQGACf9dhegM/COoRNRFK/Fbn96R+tb8J+wRYPiJgnOd0TFIpMcnu/jELbOTetI+jv PAI5OiGe5YZ8XH1zHaRH80yG74H8bERRcMcXPzhlvK8K7KSyWznb2QgSuRj/P/jHJmIA Q2LIW1VjKYLG5m3yQac5UWJRgR6dfzfp0eCY1J992PQUiINghAoTRDU+XDKe4vUZFr1N Od92hZRJ/p89oRi550dSA/J78h3e4OtA4PmhVhNu+KLyPiZvDAcC7hTbUkhQuBTPXHtF eICE/SuCdbyYVc2sIBoQmg4dvo+krvzQFwbFXsFla70v8nZ2nGSENG5yp0R7hAFsxuiu iEbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745350113; x=1745954913; 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=jprqwHHwWojdGfQ1QgUvwGwX1dYcnH5RZgYMJfPxUv8=; b=Z6JamqI17gFCR5Yu4q1LCaWL/NuFTEhRrA5lQu7t0G2U+GtNkVp+HiiHegBmBSyIVf qkE9mmzg7jLxJV6ZAlBeKnFyh5JGcjxmuhCKGdyw0itMNv0+mc5GAIEYTeAohzWGwneT q9U4V9f7woEG41euikHdqOGB60ud/Mnln9cqz+iGznefNbVBJ+3FEFE1xZEKdcPiZsev dVosjXbr2BFLbqz0E8ro18aLyM/UlQ1P/VSoZVJx+kCA7XvvDpNTBLOuNaoTplfr7z6a wtLxjSYzA1qRAiHixpYPfIJtB9nA+wZqrhSEupuHBdFvtvzsvJkus0f7AFr+tqtLs5vN GWsw== X-Gm-Message-State: AOJu0YxnziAGAoyJY7XqG/AiNTZJ0tuUZGHGAHkBPYD/L6577dJoblix 9/vbyVBI+1n0M4Pc7loCwckJTe+yLHT5wq6k6sDzVqATG+mLIRgxBKilmLhceYzkpSSRiTSi0X+ y X-Gm-Gg: ASbGncvUVWWWTVIoQZTkIiOZzSOQp8aCNdtYp4jrukXHdrOGr3SIkHdkFWsbkabcFDe /T/yGXU1B4u1XeQsQXYO32OxlcixLtIxsRnn25kAL3V9Hftfynbw4VOjvWBA48QePO0PXsT0936 07QgE72faIOHRSTuA91qmrWvnzY8/tCUthUvkNeZkDxbdzK63YsKNSn3U+fA/alNvHqQuPF8Lmr 6KzfxCSJiXvN50wzaAuH5CKFGE+fbhmyyHtl0tYoUsBPLZmtOJ3SF8xjoHiOmMKq/NZa8e2gLdP jTtAgpbW4/ZF502KCkkdNZisphZzrbduKyerpisWcgYyj9oqRP8FfVCHtTDqsPxub78MQg8LRiA = X-Received: by 2002:a17:90b:582b:b0:2ee:c04a:4276 with SMTP id 98e67ed59e1d1-3087bb36bd4mr24228876a91.5.1745350113569; Tue, 22 Apr 2025 12:28:33 -0700 (PDT) Received: from stoup.. (71-212-47-143.tukw.qwest.net. [71.212.47.143]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3087df21278sm9146865a91.29.2025.04.22.12.28.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Apr 2025 12:28:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier Subject: [PATCH 020/147] accel/tcg: Build plugin-gen.c once Date: Tue, 22 Apr 2025 12:26:09 -0700 Message-ID: <20250422192819.302784-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250422192819.302784-1-richard.henderson@linaro.org> References: <20250422192819.302784-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1029; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1029.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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org We assert that env immediately follows CPUState in cpu-all.h. Change the offsetof expressions to be based on CPUState instead of ArchCPU. Reviewed-by: Alex Bennée Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- accel/tcg/plugin-gen.c | 13 +++++-------- accel/tcg/meson.build | 7 ++++--- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c index 7e5f040bf7..c1da753894 100644 --- a/accel/tcg/plugin-gen.c +++ b/accel/tcg/plugin-gen.c @@ -22,13 +22,12 @@ #include "qemu/osdep.h" #include "qemu/plugin.h" #include "qemu/log.h" -#include "cpu.h" #include "tcg/tcg.h" #include "tcg/tcg-temp-internal.h" -#include "tcg/tcg-op.h" -#include "exec/exec-all.h" +#include "tcg/tcg-op-common.h" #include "exec/plugin-gen.h" #include "exec/translator.h" +#include "exec/translation-block.h" enum plugin_gen_from { PLUGIN_GEN_FROM_TB, @@ -89,15 +88,13 @@ static void gen_enable_mem_helper(struct qemu_plugin_tb *ptb, qemu_plugin_add_dyn_cb_arr(arr); tcg_gen_st_ptr(tcg_constant_ptr((intptr_t)arr), tcg_env, - offsetof(CPUState, neg.plugin_mem_cbs) - - offsetof(ArchCPU, env)); + offsetof(CPUState, neg.plugin_mem_cbs) - sizeof(CPUState)); } static void gen_disable_mem_helper(void) { tcg_gen_st_ptr(tcg_constant_ptr(0), tcg_env, - offsetof(CPUState, neg.plugin_mem_cbs) - - offsetof(ArchCPU, env)); + offsetof(CPUState, neg.plugin_mem_cbs) - sizeof(CPUState)); } static TCGv_i32 gen_cpu_index(void) @@ -113,7 +110,7 @@ static TCGv_i32 gen_cpu_index(void) } TCGv_i32 cpu_index = tcg_temp_ebb_new_i32(); tcg_gen_ld_i32(cpu_index, tcg_env, - -offsetof(ArchCPU, env) + offsetof(CPUState, cpu_index)); + offsetof(CPUState, cpu_index) - sizeof(CPUState)); return cpu_index; } diff --git a/accel/tcg/meson.build b/accel/tcg/meson.build index 14bf797fda..185830d0f5 100644 --- a/accel/tcg/meson.build +++ b/accel/tcg/meson.build @@ -3,6 +3,10 @@ common_ss.add(when: 'CONFIG_TCG', if_true: files( 'tcg-runtime.c', 'tcg-runtime-gvec.c', )) +if get_option('plugins') + common_ss.add(when: 'CONFIG_TCG', if_true: files('plugin-gen.c')) +endif + tcg_specific_ss = ss.source_set() tcg_specific_ss.add(files( 'tcg-all.c', @@ -12,9 +16,6 @@ tcg_specific_ss.add(files( 'translator.c', )) tcg_specific_ss.add(when: 'CONFIG_USER_ONLY', if_true: files('user-exec.c')) -if get_option('plugins') - tcg_specific_ss.add(files('plugin-gen.c')) -endif specific_ss.add_all(when: 'CONFIG_TCG', if_true: tcg_specific_ss) specific_ss.add(when: ['CONFIG_SYSTEM_ONLY', 'CONFIG_TCG'], if_true: files(