From patchwork Thu Apr 24 00:49:23 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 883914 Delivered-To: patch@linaro.org Received: by 2002:a5d:474d:0:b0:38f:210b:807b with SMTP id o13csp3209283wrs; Wed, 23 Apr 2025 18:29:29 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWC9bWvMggT0DOPgWzMH/BRJRluSHnxhspv4+SjNa5gK7zNj6BfxVRDGPRyTQeCTtariQuoFA==@linaro.org X-Google-Smtp-Source: AGHT+IFIE4u4Lfj3RXUlEy+1THHjRwnTaHUpeCJIdm4Kp4gjsrxaORQY1oimzK5spyTRoD+nZV/0 X-Received: by 2002:a05:620a:3948:b0:7c7:56ac:1e89 with SMTP id af79cd13be357-7c956e8bb31mr144511085a.3.1745458169270; Wed, 23 Apr 2025 18:29:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1745458169; cv=none; d=google.com; s=arc-20240605; b=MKx+L10ucSPGC9ZhbOItfMXsMZ7j7+ZSZ6t29qF3vnaLPko3LlBqqvyQuYxBmOCmxt w0j2RAz9IflMK9dtaGEs75RwcL4DbVn+iNY7bsefm4AnXJDDZh7cFqihsfJXFbGVYiLA C6+fuL9YNBqgKa4yZymZCzNF1bC1qBW33e1JeFvuBd0KXznR5KNxjDyqePLtkqldevva ATSq2pIqY3WBWTxYgB7AuA5tXWpfz/wdAILnoDxIetu4HrB20KHMWStUz5pgQwuM7Ccy fbiiAF0WvM266MjEzRjjPcKq5ff7O+igoaJ3LLlukFIOS2TKFZLq1SnjTkN4Bt5zZ2Ni GzOQ== 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=NFR9lsWoMXNYRBlDfEvBXzbnQL4knAWePayfKJdKcZo=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=duIeGocWO8lSIyHFHnD7T4P3Ny4fg6CfeWWLyljRNH/27uMFtqZ49GY1gAm/D9Jr/+ 3zpUJbh1ZAEB25vR7tajuFptyHvCDK6RLakMRd1Z0dhdaOQvf1UbrxL2Yeo+kxwIIDmQ +J29273OMaCZ82G+G3602z56ZUD75/q8V614EA//EK6R6CX1HD7ffFhxy6ZSBtSrbY8w 1BlJqw5ipCd6J5UJ1y0H4h2yulhIopPWYas4ttnnaPo23Y02DWtYg88mGptZNNG1udVO L9jn1kg2LBWWLexc+HpuuwwQD+EXDJ6tLm5fyIIA1FFiCPkoIff00lkMQsVGfz+qo59x +mUQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mSyV3buJ; 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-7c958c9e306si26569385a.54.2025.04.23.18.29.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 23 Apr 2025 18:29:29 -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=mSyV3buJ; 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 1u7kyV-0008Gv-Cb; Wed, 23 Apr 2025 21:01: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 1u7kwu-0005Hh-Qp for qemu-devel@nongnu.org; Wed, 23 Apr 2025 21:00:21 -0400 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1u7kws-0005WI-CA for qemu-devel@nongnu.org; Wed, 23 Apr 2025 21:00:20 -0400 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-2295d78b45cso6795035ad.0 for ; Wed, 23 Apr 2025 18:00:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1745456416; x=1746061216; 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=NFR9lsWoMXNYRBlDfEvBXzbnQL4knAWePayfKJdKcZo=; b=mSyV3buJv/+sWgF7ZWKKAR1aeEs/xKb0TBY4cup1L2NUKzEwPYl/qOvubIjpY7Z0Sc Ec0pEdYu/WZf311cc3C/PncHDpXIxtvPTYWodjLtL6hGI3hyn4yn6Og9ThZXLZtLq1WC qgxJ+VOlXvgBgJy97SgycB0O+UfvY6hcAeED7d8UX1Jdm1Q2wZKcEVga1nfWuFva/Uaq ym+EWuIQpiC5Jw8fbjYIhetqbZApY+tNkQNGe7A1hdGftRJgeOcQoSeJ2olm/VaD/98j Pvgp/m2e5gN7XqegCyqxvcKfSnZRiGKDu6P65wT7yAtbdoiTlpsiASRogfCLynTjMeMT TshQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745456416; x=1746061216; 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=NFR9lsWoMXNYRBlDfEvBXzbnQL4knAWePayfKJdKcZo=; b=Eayf4BqQz9j/rIrZfg+OH0lADseujg3Di32L5oGeYQiRz1w2j2wx0ax2au4tLd3eqe KFRUdrJUPUxnV+9nWy39NvUtbV6oEATl1Sjj8gVCNETyt4hrXw+2GtcFhGKASCaksdYn Cuv9pXGzlC7fNBrrG/W5vk5nsLUqDbFg5G35g/flmXy1PzfM+2BydewtMql/YyNSKSZY UYEglhXSsO7dXa6WDd1/nCo5KLr6oK5ITUjxZFOkiC2rKSlmlrImAxMiKwj0vZust28n BpYselkHUYJksJeJkTkjjBJN0IwW8gTu4RomwO+WpvVHqHomAfi9TsBXeaTXnGsVwZr4 I6PQ== X-Gm-Message-State: AOJu0YwsiKW1nui0eHVDcE0kxrx6gyBIjJUmssNIB8miWe9y7xT1+GNa 3ih44ET9/4K6OMwtpKTODUKPprhY/ZwC7RJB5JtabDD4Fo7YaNkNgYeU/XBeJUTt+gcWLp/J66x 6 X-Gm-Gg: ASbGncu/hyP4DoqGhV+kXEW5tqEPL+UN0SveMnPm7VrRBG4LRioSimwX4gaCkcrW4gD Dqh0id4rDMeMl86xlAplzBMbN6ODzgJ5CrCSnxiFn8wKSqMXlldIq86VyIe+26UM88OX94q3n4W 5+2pk33NLzx/C2BzNwfriFRbU1OinA/0zgwar5JjU4U6f0WH+Lljf4L7bG5AEdzN5ZIUw2iiNnW X93WgUWKaE0eJ26b9S45jzvwLMHFKUlJ+Ynm5kmwSMbPYzjjPZ15ZAleQzztlLHjH+oW+Zkhaz7 t0Hr8ap5n+LaqZkmRcQYeKsOZ1GVzzEsvGC9L+5UDX6KOafoAB6vwOQ07d3Ib+T700A9aSa4XQC VPjZo+tGXhg== X-Received: by 2002:a17:902:ecca:b0:227:e6fe:2908 with SMTP id d9443c01a7336-22db3d9a1efmr8773675ad.48.1745456416548; Wed, 23 Apr 2025 18:00:16 -0700 (PDT) Received: from stoup.. (71-212-47-143.tukw.qwest.net. [71.212.47.143]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-b15f76f45c7sm129259a12.16.2025.04.23.18.00.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Apr 2025 18:00:16 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 138/148] tcg: Have tcg_req_mo() use TCGCPUOps::guest_default_memory_order Date: Wed, 23 Apr 2025 17:49:23 -0700 Message-ID: <20250424004934.598783-139-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250424004934.598783-1-richard.henderson@linaro.org> References: <20250424004934.598783-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62e; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62e.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 From: Philippe Mathieu-Daudé In order to use TCG with multiple targets, replace the compile time use of TCG_GUEST_DEFAULT_MO by a runtime access to TCGCPUOps::guest_default_memory_order via CPUState. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Signed-off-by: Richard Henderson --- accel/tcg/internal-target.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/accel/tcg/internal-target.h b/accel/tcg/internal-target.h index 23aac39b57..f5a3fd7e40 100644 --- a/accel/tcg/internal-target.h +++ b/accel/tcg/internal-target.h @@ -46,16 +46,15 @@ G_NORETURN void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr); /** * tcg_req_mo: + * @guest_mo: Guest default memory order * @type: TCGBar * * Filter @type to the barrier that is required for the guest * memory ordering vs the host memory ordering. A non-zero * result indicates that some barrier is required. - * - * This is a macro so that it's constant even without optimization. */ -#define tcg_req_mo(type) \ - ((type) & TCG_GUEST_DEFAULT_MO & ~TCG_TARGET_DEFAULT_MO) +#define tcg_req_mo(guest_mo, type) \ + ((type) & guest_mo & ~TCG_TARGET_DEFAULT_MO) /** * cpu_req_mo: @@ -67,7 +66,7 @@ G_NORETURN void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr); */ #define cpu_req_mo(cpu, type) \ do { \ - if (tcg_req_mo(type)) { \ + if (tcg_req_mo(cpu->cc->tcg_ops->guest_default_memory_order, type)) { \ smp_mb(); \ } \ } while (0)