From patchwork Tue Apr 22 19:28:08 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 883116 Delivered-To: patch@linaro.org Received: by 2002:a5d:474d:0:b0:38f:210b:807b with SMTP id o13csp2595885wrs; Tue, 22 Apr 2025 12:59:12 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXFiOjWgaqhWZ+GUeKAjr8qtxnZty7ns3HWQ7K8iFA+Y2Uv3ImfPBsIuv3uGaG6Vokbk+Y4Og==@linaro.org X-Google-Smtp-Source: AGHT+IFKn3V6qhuTzOMBbh+KJnUmOFpSUmNwq4+KoLAFzmJWpcbR8vHKKzKhZ9v6z7o7BQ5dU67G X-Received: by 2002:a05:620a:43a2:b0:7c9:2344:ce59 with SMTP id af79cd13be357-7c927fb1bc9mr3160968285a.25.1745351951922; Tue, 22 Apr 2025 12:59:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1745351951; cv=none; d=google.com; s=arc-20240605; b=BraB+M70k6fPf827H/rDSENBDTHHt3pZVi8Sot4XGzNMTprJ3AR2RdVYw4Lmrdy9pJ FYBWgvs3tVRzOM0B/Qm4IPtC08lcsagdN6Ignri9YADu5E8HN4bIo0sX2fSPnR4w1mvU F9T5b4hU5FXmQVObBxyF2NAE7TKUdTcMKJ0TybLqpeLdFirpvrrrxrJj+sQYHMhpVIbi UPf9qer1rxA9AcQJAoxraL67f9zZKnQx7edWjdCFyzYmQpgKTZVlC7nFUgc5fUqV7d7m ICOMjt46sKed3tgn4S/T3weP71dnXFaMYZJbqJa+xvsifZA5XVQOcTFHX193DabO41tV UKSQ== 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=7VXEDUlPkpIMjb0Jt+mGuDdJy2bXxmmNFXU1sXIXZA4=; fh=kQadAhxV42GJ3cd2VUw1RyURv/zJQGvmUdF7iLEVTtc=; b=gFU4qmjNV8Qiyj47Lsm3HUUPuUTxv2EBWSe7TuqXJwBLbBFkagxhcbyOCtJPQ/xSY/ RTCs0CSa9S+uLELWmGTHX266kumLUzh4G1ohaJFc5Ptbqsw5N12X++eH47w7nbTQqAB5 V0ZkZMh/apHM3v2uyy5sd52HJ0xtYOEKubfEg1Y7SLT8CWuJ9nir4j+mhlLQH/n8Tawh pmjreSpxgH73UQJooULrRwOKLsD1I28dPvCI18N8XWxklqGvfHUIeGovThntbkQw2PqZ lCVtN1paZon3XcnZVIPqCfXTfY3509MA/WSpdUD3QHqx6aTdHROjf8sdgzyJNs7xA5xh i8Dw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="eN45/jjB"; 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-7c925ba34d3si1176496885a.392.2025.04.22.12.59.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 22 Apr 2025 12:59:11 -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="eN45/jjB"; 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 1u7JT2-00065r-K0; Tue, 22 Apr 2025 15:39:40 -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 1u7JSM-0004ID-6R for qemu-devel@nongnu.org; Tue, 22 Apr 2025 15:39:02 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1u7JSI-0007N3-Pa for qemu-devel@nongnu.org; Tue, 22 Apr 2025 15:38:56 -0400 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-224191d92e4so55809375ad.3 for ; Tue, 22 Apr 2025 12:38:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1745350733; x=1745955533; 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=7VXEDUlPkpIMjb0Jt+mGuDdJy2bXxmmNFXU1sXIXZA4=; b=eN45/jjB0RY2W+mI+d7ds/ol9TQLgN4oyclBRCK8TTaY/5xf+uQQP3dnfRoMsUO69l QpQCMfmkHaoKAVOlrutUa2cEd1cB/dOZcsApZYEpN6bG22nI7RgaB0WVzqupii9xyUah y09K6sCNfs6R/MY+jdPAuXT+0EnODgq2s5nxfeJ+uqrONOM05zHygwOWiDyZlkxpFWut yMOmlVBHvHcCakQ96WKsIWNEbYAWFvod230k+AICpPNZvxq4ru+0UQN3pz0wgK/nm/3H fBAbRNKhWSPbG6QD5kieSCYb4G/SGLnH5nielTHe8n9SNdV4yuSH1LaAJvXuO8ykSpYU ZYoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745350733; x=1745955533; 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=7VXEDUlPkpIMjb0Jt+mGuDdJy2bXxmmNFXU1sXIXZA4=; b=wjU3z065KZg6vfH5QR4yYZlDndudYPPXCq/fBVtFAyrdTloPttCOHCsSnBv/CblLi1 18EpJKph2TAEYeLXOZa2lRw6VUWn0SHB7wEK4sdFxbePNujeW3xtjDjsObOvUuukUdbb a84jI36bdwSQ4c0jjiYBH+/TxEelLrodolrv8CnSNhguBNkqzpLHHrHEmAaze2xaUafc LzLsr1iYNBYEQXdjiVs2NT8fvLxyh78oNWhdLrQzI1Zj/hOryRecuLcMhtEaG28MHFy8 tKwmsjJrIoUVR1qzT1fF50LBaDwyeF+f6vCexwQEt8gRiIGQNvfqRlrESY0Eco6hRDEM XMqA== X-Gm-Message-State: AOJu0YyX1pFBEcXkOAkGdWgKdWtWLig4b1S/K2kxBu0imZIJGvM0ekpA hGRwsh5mqXvtWBpNg/CPvfmFL8TXhLXux2ZB4cyKPsNZT3gh8DNeFmwTGNJjN2qtQ7u8TVtPGAT U X-Gm-Gg: ASbGncscbt2N9rv+J07D2f/5mYGmnAn+HMUlnW+eMaDOD78Vmg8z818e4/uAbblqj/z 0YaBcLxhoprNAJpNWxiBRWEu0gjP0x4Y65a3rG5w+HidvkbNntvduGeqcp1qaQ6rqiGsdBp/Ynt TG2BmDpSnZ8s3M30tZg3j0u/WU1m7jKsvwsv2ePm2GT59cl+Fmq1KrHxFCIRrALHeAggvhn1YMP JWPZV3+lUTlchR0AyiQgH5qvX5/fwnaLOoabCjCaHJ7bEczzdDmDdBdNdhtA1sCY2EyQGjqLswp t5w/S7kMH/unTuqNu5tF5Z+79WtE9+sJljV6EmL34iCMYvJ/80Dfp2N7SwTcHaAIytdBd1ly+qq CehV0QOnD7Q== X-Received: by 2002:a17:903:46cb:b0:225:ac99:ae08 with SMTP id d9443c01a7336-22c5337a025mr262341995ad.5.1745350732868; Tue, 22 Apr 2025 12:38:52 -0700 (PDT) Received: from stoup.. (71-212-47-143.tukw.qwest.net. [71.212.47.143]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-22c50eb484dsm88951765ad.148.2025.04.22.12.38.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Apr 2025 12:38:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 139/147] tcg: Move cpu_req_mo() macro to target-agnostic 'backend-ldst.h' Date: Tue, 22 Apr 2025 12:28:08 -0700 Message-ID: <20250422192819.302784-140-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::633; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x633.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é Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Signed-off-by: Richard Henderson --- accel/tcg/backend-ldst.h | 41 +++++++++++++++++++++++++++++++++++++ accel/tcg/internal-target.h | 28 ------------------------- accel/tcg/cputlb.c | 1 + accel/tcg/user-exec.c | 1 + 4 files changed, 43 insertions(+), 28 deletions(-) create mode 100644 accel/tcg/backend-ldst.h diff --git a/accel/tcg/backend-ldst.h b/accel/tcg/backend-ldst.h new file mode 100644 index 0000000000..9c3a407a5a --- /dev/null +++ b/accel/tcg/backend-ldst.h @@ -0,0 +1,41 @@ +/* + * Internal memory barrier helpers for QEMU (target agnostic) + * + * Copyright (c) 2003 Fabrice Bellard + * + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + +#ifndef ACCEL_TCG_BACKEND_LDST_H +#define ACCEL_TCG_BACKEND_LDST_H + +#include "tcg-target-mo.h" + +/** + * 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. + */ +#define tcg_req_mo(guest_mo, type) \ + ((type) & guest_mo & ~TCG_TARGET_DEFAULT_MO) + +/** + * cpu_req_mo: + * @cpu: CPUState + * @type: TCGBar + * + * If tcg_req_mo indicates a barrier for @type is required + * for the guest memory model, issue a host memory barrier. + */ +#define cpu_req_mo(cpu, type) \ + do { \ + if (tcg_req_mo(cpu->cc->tcg_ops->guest_default_memory_order, type)) { \ + smp_mb(); \ + } \ + } while (0) + +#endif diff --git a/accel/tcg/internal-target.h b/accel/tcg/internal-target.h index f5a3fd7e40..9a9cef3140 100644 --- a/accel/tcg/internal-target.h +++ b/accel/tcg/internal-target.h @@ -13,7 +13,6 @@ #include "exec/exec-all.h" #include "exec/translation-block.h" #include "tb-internal.h" -#include "tcg-target-mo.h" #include "exec/mmap-lock.h" /* @@ -44,31 +43,4 @@ void page_table_config_init(void); G_NORETURN void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr); #endif /* CONFIG_USER_ONLY */ -/** - * 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. - */ -#define tcg_req_mo(guest_mo, type) \ - ((type) & guest_mo & ~TCG_TARGET_DEFAULT_MO) - -/** - * cpu_req_mo: - * @cpu: CPUState - * @type: TCGBar - * - * If tcg_req_mo indicates a barrier for @type is required - * for the guest memory model, issue a host memory barrier. - */ -#define cpu_req_mo(cpu, type) \ - do { \ - if (tcg_req_mo(cpu->cc->tcg_ops->guest_default_memory_order, type)) { \ - smp_mb(); \ - } \ - } while (0) - #endif /* ACCEL_TCG_INTERNAL_H */ diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index 35b1ff03a5..d9fb68d719 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -48,6 +48,7 @@ #include "qemu/plugin-memory.h" #endif #include "tcg/tcg-ldst.h" +#include "backend-ldst.h" /* DEBUG defines, enable DEBUG_TLB_LOG to log to the CPU_LOG_MMU target */ diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c index 3f4d682446..5eef8e7f18 100644 --- a/accel/tcg/user-exec.c +++ b/accel/tcg/user-exec.c @@ -37,6 +37,7 @@ #include "qemu/int128.h" #include "trace.h" #include "tcg/tcg-ldst.h" +#include "backend-ldst.h" #include "internal-common.h" #include "internal-target.h" #include "tb-internal.h"