From patchwork Fri Mar 21 12:57:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 875235 Delivered-To: patch@linaro.org Received: by 2002:a5d:5f4c:0:b0:38f:210b:807b with SMTP id cm12csp850548wrb; Fri, 21 Mar 2025 05:58:35 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUOji5M2DTtzyfe+MBgzHE+5/+28MxaqoGcMo+akpDwTFQAib91bP3Z1nxC9l84G/hDx2RUrQ==@linaro.org X-Google-Smtp-Source: AGHT+IHJKQKTOaXZD93/tMPVkLH4JX1c3Bq5jLiH5Q5EhCRtmm8qIHQcFE3cghJLcFZ4OC6ZH57y X-Received: by 2002:a05:6214:194b:b0:6e4:2d8e:5cce with SMTP id 6a1803df08f44-6eb3f33d7a7mr47392186d6.36.1742561915445; Fri, 21 Mar 2025 05:58:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1742561915; cv=none; d=google.com; s=arc-20240605; b=io8JE8JnxYQOLN8VKu1IN/YiyR/ivbhKNVuEsT0VWtvQqQgIQHPvz9WUE0RayVnVb5 c4d7uD9E6nuWXAYyqeDbv7h0fn8c4F1Kq6GWxsLBib+0BxzMG9LcfCbwiW96JGqjIZ/o QL4GtT6MOIptNkn3LUWTwFC5vUW/cmMY3brhjhbVkQ3qp5A8yVWHqsV/NriZHeO/zjkq d2qqMuKxmblwDUkIpHzq9pGuSgRMz6mDDJZ7d90rMKpBQSL0Zc0NSyheuOkF14AT5u9n OWQTsH/T2SG5yl0WGVPouM8itbaMK3XIqMqE8trBlH131qIcQQgUkOKE+8sO9A5Fh5XR wt5A== 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=6p8JdnoFtJMlt94AcQnrnXDcS8L2LbxvHkgDYqG268g=; fh=XDQo9MxlQvkKKMc+GSRdYwnUFePgPMK1K6LipBj+HSM=; b=hJpXja1oKA2BfYyfN+QevF0cFwJRk8C69JyJ6wz0rQgqckHARZJs+eEgqUoMvRIIwo r3FvMxpZCVDRPhbAMOh/UZTG2aQeJn/v1oJ//tK8eb9KcyvtcuIEnUcT3f8N/RLg8syT sbbY47SJlhJCHvS17Icw5MsohCcyd0w9cP5xZlaqCj1ilytSCMDleMkj8x1jmBRajZ1x 1Dk2plB0LlnoA17mtMiKgmc74tFSeI4zlnYlZfXk4Iy18KmQGivKVC8TaCAxmQ+wRiq6 pRgUGohRf/WwisZXgvbLZG/effF6HBmRC1qOltA87t8y9/e/setokAHtCfguEKw95ssL xXCA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LWryqueI; 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 6a1803df08f44-6eb3ef48d5dsi18341376d6.46.2025.03.21.05.58.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 21 Mar 2025 05:58:35 -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=LWryqueI; 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 1tvbwb-0007iT-Us; Fri, 21 Mar 2025 08:57:49 -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 1tvbwa-0007i8-65 for qemu-devel@nongnu.org; Fri, 21 Mar 2025 08:57:48 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tvbwY-000308-IL for qemu-devel@nongnu.org; Fri, 21 Mar 2025 08:57:47 -0400 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-39141ffa9fcso1737629f8f.0 for ; Fri, 21 Mar 2025 05:57:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1742561864; x=1743166664; 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=6p8JdnoFtJMlt94AcQnrnXDcS8L2LbxvHkgDYqG268g=; b=LWryqueI8+Qco2XyrFhie4QDTBpTMVX7BdCCVCbwdI3XMrjsInuXZzJL7rLi5n97kr ZpvB/hYqARFyrQsdoG1g91TrlHMD7atWLa33wdk7OOZpu03h9whBe62i229rfWA7cYHG UFkd7XrEmB8ZIA3eQtQ/HQfozMwtQFF520jcH06CBqgOPTPmvzhjuos7UyuFflzIM4j4 5Z9EUL0rPs2DQtMaVD0InnKqcpmjKMBJHMz6kedbzmUvKHkrp7khbs9OUxea+pa+2SSL 9Jd7MMOGJkisbv0ROra+KcbO7Baj9FsD1tK6pCC4CX4Fc3nDWHzSl6WraiT7//1aF2dK kwKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742561864; x=1743166664; 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=6p8JdnoFtJMlt94AcQnrnXDcS8L2LbxvHkgDYqG268g=; b=t4PAwWrxbqq7eAKXscDWh6OA2p+65eUQMRyLr/DlahnKwq+u6tw+vcHYN0u0VBBZ5u KNEnYYiz3Twc34MDaUg/W4PKX4WC6+6+x3EjxA8zBfKHqIAOo97dAlmtwnX0FlEQTVW5 iFtVto+ClnFJrLV25tcLPYb+vsg3fLblZXL5qsDpBV4MySUVyy+PtKJssvQBPaoNS1zl d2jrdfRzaQefNF8wLiG747DiCi9PxbnmnxRhzdpHcUuH/WYlkR49RY4u7TkpiAQI9I48 PWwaJUQj5W/gHq3UDXz0JN9NThB4o+div+G1pW+J8sbAAqRQj35uRFPb4KNe6piOjDbQ S1Tg== X-Forwarded-Encrypted: i=1; AJvYcCVWxyPVq+g9hotZKxqzIZp6gwunD/OQs5Mjit/dh/CwtwpA0YwjB/MpCCOholVjgrinCJchw98VMVwt@nongnu.org X-Gm-Message-State: AOJu0YwlqZ+9wgwcAMv0qBYfsQScxGfP1lqTU43OT03Rf/IfGC7oRGxX vL/z+9F5m/+HYNN/EtcskunNGQcawJtrkWCh7lkeySDbxvnaDZJqMZshsdeCGr0= X-Gm-Gg: ASbGncv/RJtvpUV/5fbDZo5qKp936ibMEQBecfjftrEiPU66rEAsd/AYEpMqDZ8zsxa h1IpMtug9qvtccrQuPS/gfejavPz6pOAL/nMJ0gp6EuUAXrfQAUV6WJHulkbWrjGaqy2fKd/ttA DtkzXg3GUcc11jW/23NpPtg3oy0D9YYXWz+4sFL4oqIhJx3MDpRnj93fS0e7QP0KQxnywp69WEj mw8owaspVoOwpf3mm+BMbVK+W3Rf3Nt/wEoteEWhs6Bjk1+fkC+99ygkrpNUgT0usLQDPRXo4Wd nxPrequmi3bq3rxpbHp2gyPahf8skCeFCSuwn3yJUr9sggoNWhc0yKAyieaUmKotrjHU9ZQ+tx8 Xw4KEyZuNwf6MNSW4zeGjg0AB4yzj7g== X-Received: by 2002:a05:6000:21c2:b0:399:6d53:68d9 with SMTP id ffacd0b85a97d-3997f939949mr2323472f8f.38.1742561864432; Fri, 21 Mar 2025 05:57:44 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3997f9e6445sm2306470f8f.71.2025.03.21.05.57.43 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 21 Mar 2025 05:57:43 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Richard Henderson , qemu-devel@nongnu.org Cc: Paolo Bonzini , Pierrick Bouvier , =?utf-8?q?Alex_Benn=C3=A9e?= , Anton Johansson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH-for-10.1 1/4] tcg: Always define TCG_GUEST_DEFAULT_MO Date: Fri, 21 Mar 2025 13:57:34 +0100 Message-ID: <20250321125737.72839-2-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250321125737.72839-1-philmd@linaro.org> References: <20250321125737.72839-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=philmd@linaro.org; helo=mail-wr1-x42d.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 only require the TCG_GUEST_DEFAULT_MO for MTTCG-enabled frontends, otherwise we use a default value of TCG_MO_ALL. In order to simplify, require the definition for all targets, defining it for hexagon, m68k, rx, sh4 and tricore. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Anton Johansson Reviewed-by: Richard Henderson Reviewed-by: Pierrick Bouvier --- target/hexagon/cpu-param.h | 3 +++ target/m68k/cpu-param.h | 3 +++ target/rx/cpu-param.h | 3 +++ target/sh4/cpu-param.h | 3 +++ target/tricore/cpu-param.h | 3 +++ accel/tcg/translate-all.c | 4 ---- 6 files changed, 15 insertions(+), 4 deletions(-) diff --git a/target/hexagon/cpu-param.h b/target/hexagon/cpu-param.h index 45ee7b46409..2d57ea6caf9 100644 --- a/target/hexagon/cpu-param.h +++ b/target/hexagon/cpu-param.h @@ -23,4 +23,7 @@ #define TARGET_PHYS_ADDR_SPACE_BITS 36 #define TARGET_VIRT_ADDR_SPACE_BITS 32 +/* MTTCG not yet supported: require strict ordering */ +#define TCG_GUEST_DEFAULT_MO TCG_MO_ALL + #endif diff --git a/target/m68k/cpu-param.h b/target/m68k/cpu-param.h index 7afbf6d302d..1a909eaa13e 100644 --- a/target/m68k/cpu-param.h +++ b/target/m68k/cpu-param.h @@ -17,4 +17,7 @@ #define TARGET_PHYS_ADDR_SPACE_BITS 32 #define TARGET_VIRT_ADDR_SPACE_BITS 32 +/* MTTCG not yet supported: require strict ordering */ +#define TCG_GUEST_DEFAULT_MO TCG_MO_ALL + #endif diff --git a/target/rx/cpu-param.h b/target/rx/cpu-param.h index ef1970a09e9..2ce199164d7 100644 --- a/target/rx/cpu-param.h +++ b/target/rx/cpu-param.h @@ -24,4 +24,7 @@ #define TARGET_PHYS_ADDR_SPACE_BITS 32 #define TARGET_VIRT_ADDR_SPACE_BITS 32 +/* MTTCG not yet supported: require strict ordering */ +#define TCG_GUEST_DEFAULT_MO TCG_MO_ALL + #endif diff --git a/target/sh4/cpu-param.h b/target/sh4/cpu-param.h index 2b6e11dd0ac..1bc90d4695e 100644 --- a/target/sh4/cpu-param.h +++ b/target/sh4/cpu-param.h @@ -16,4 +16,7 @@ # define TARGET_VIRT_ADDR_SPACE_BITS 32 #endif +/* MTTCG not yet supported: require strict ordering */ +#define TCG_GUEST_DEFAULT_MO TCG_MO_ALL + #endif diff --git a/target/tricore/cpu-param.h b/target/tricore/cpu-param.h index 790242ef3d2..923459370cc 100644 --- a/target/tricore/cpu-param.h +++ b/target/tricore/cpu-param.h @@ -12,4 +12,7 @@ #define TARGET_PHYS_ADDR_SPACE_BITS 32 #define TARGET_VIRT_ADDR_SPACE_BITS 32 +/* MTTCG not yet supported: require strict ordering */ +#define TCG_GUEST_DEFAULT_MO TCG_MO_ALL + #endif diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 82bc16bd535..fb9f83dbba3 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -349,11 +349,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu, tcg_ctx->tlb_dyn_max_bits = CPU_TLB_DYN_MAX_BITS; #endif tcg_ctx->insn_start_words = TARGET_INSN_START_WORDS; -#ifdef TCG_GUEST_DEFAULT_MO tcg_ctx->guest_mo = TCG_GUEST_DEFAULT_MO; -#else - tcg_ctx->guest_mo = TCG_MO_ALL; -#endif restart_translate: trace_translate_block(tb, pc, tb->tc.ptr); From patchwork Fri Mar 21 12:57:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 875238 Delivered-To: patch@linaro.org Received: by 2002:a5d:5f4c:0:b0:38f:210b:807b with SMTP id cm12csp850714wrb; Fri, 21 Mar 2025 05:58:58 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVxKO1ZUu9llWaFGqp24IJN3SRMURVedXdfSqCajyw/xg2NxME9co0YuFT1J+rO5sNWqWdbGw==@linaro.org X-Google-Smtp-Source: AGHT+IG++shXcjcJJvYfBdblzWF2x9kpRcpPq3A6NqVXCBuN15IE1pjGbP5q0Roxuc9o43sscwTZ X-Received: by 2002:a05:6214:f64:b0:6eb:1c42:a14b with SMTP id 6a1803df08f44-6eb348e0487mr112906276d6.1.1742561938217; Fri, 21 Mar 2025 05:58:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1742561938; cv=none; d=google.com; s=arc-20240605; b=gMRIVuzsH7hmfEsJGJ+c9F5pJbDMmx4ZMHOSVveuRN+a9582bLbqfBaynQMYjCE743 Adc4zxGXlqrpIOrbOf3tNGO98aNb5DOX7Sn6qcJ5CWkc+b840nwbliSbfMfbRrWZGRFs d0bB8zGj7JD+QWlD22+0cXfjmOwSht7lUHTOgp4BnNEKn12+vTpf2CkstR4NEm0Ky69r XnXV9ljYLaw9fAlmhos5etiXFz1R9xbpIZMfYh6lsraortvVooLwoz7uDsSJ8bU9CAN4 yaX7vXQs0Uau8aPNeVe2IP5EaKeyFBRzCOEWMEtnkVDqvD/bXkBi/MwD98bHVOf/QEbJ vqcQ== 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=AO+ZUcaKZQJk5enooplb2+PJUlk54AQnNwm/1pAm8KA=; fh=k6vQFqpBIEOZDEx+jp8POk/T7kPLkYHaVFRSFvPBflI=; b=Jed4bUjjK5HeOlohgVCof/63lBPY+31cyWp7jkSfx25OI3I3ZxeLgsZgDIYR412HBj 2sLjuqzw9BTgGpbU/mmBWcISalkQwecZLv0UUQHv6wpZMi5K8PkoYUbe6v+L152a64U9 SbEP3jrhLut3lAO9VIZG/JSqaNdaC6mDRssycefkNpb173AJNkdoi55FKLcKPl3UHPNX F8+wj9e1/703h9yCSebmskPEjALCcMYqPzHcwRT+GLeRIwPnnnkcWL7OoKtI3CNQY8T7 37zYK7cINnBNTETPB4VfAA6YAhhIIGB99omyt7mC48PRXvBG8HXkyhJNvOCTe9ZbAsk5 X9Fw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rtfgn9Nl; 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 6a1803df08f44-6eb3f01cc2fsi17528546d6.334.2025.03.21.05.58.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 21 Mar 2025 05:58:58 -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=rtfgn9Nl; 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 1tvbwi-0007jl-5Y; Fri, 21 Mar 2025 08:57:56 -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 1tvbwe-0007j4-6q for qemu-devel@nongnu.org; Fri, 21 Mar 2025 08:57:52 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tvbwc-00030W-Lc for qemu-devel@nongnu.org; Fri, 21 Mar 2025 08:57:51 -0400 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-39133f709f5so1040543f8f.0 for ; Fri, 21 Mar 2025 05:57:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1742561869; x=1743166669; 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=AO+ZUcaKZQJk5enooplb2+PJUlk54AQnNwm/1pAm8KA=; b=rtfgn9Nl5uIkp+4zLVlcf5YjdrAnvN1R+i2ITaAPHfbkdzmZU6SQSCeaFS+S4fXqFJ DmNntJSQfI7L5rSXYYUMvji+odVceT4hwIsT0O2w/ZOlzXKgF54xW4zYnJmSTKeHGeng Vmo+FH5zrf6OvpBEy45R7Ae/4h43u9YvMxCnwGQf1K4hyfkK9cYMQdUdkGLRQmdmXqRe seXHzeYw/LcIZxzyPYeR/dehjYJBTHMPr9tIXGtaFTjdsg+WdDi2jT0Tgs59dzm6a7S7 oSQICZwy0NMIys6U5Sso4LLZbDkC+/MSrqVuSVx0DuPDQEvgY20nLIl7JZvilGcAatSP +AwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742561869; x=1743166669; 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=AO+ZUcaKZQJk5enooplb2+PJUlk54AQnNwm/1pAm8KA=; b=omPFoafBXtYCzFnRjsqh9LSlnqAg7rf3ozE6Ysug1P81DelshYCipQAq0V7CPzZ5nS kMFPNtMdg3PnA7WPGouogNCj3ToEg0faNZyZo9bEoNbmASTeCGp9FlGb9PEFmmzf31mN AnIY0pUZDAIg3Afrfcnru28wcC32zTA6mPbPJCeBCvgu806LhYDyhlBIc+mTTHG0gBEH 6nVYorT44iLoOl5TDjOChLOffQ4kKubMyPH88iTBMf4WkAgD/Ww02Sy/4TaWQAmQN8HZ 9vUSIst4vK5ibM4A0+rltuQsvChjtIRVd46ZhDxS9Nvjkqy8OAw631L51MBLaTqoQW0j rniw== X-Forwarded-Encrypted: i=1; AJvYcCWWAeNSQQj10QjxuodMSxVjqQZ61abfPGeQRZqjxlHnrhfchptSCdEDGt/CQmLx4YxShhVHe6rN9586@nongnu.org X-Gm-Message-State: AOJu0Yw4QPmXBEfBv79xsRwAwgVRrZHvuGTL7zcGPVn6XIE/0aExmdaU +47wR90Qq2P/Ctx2ZpJF7DvP+AE+a8LjtUq2UUTNlqXeYwTwounOMZkTVa/Jaa8= X-Gm-Gg: ASbGncvmVSILoKDDCHsWOa7WK9qmtfsqczSMgzGvsQKfPUwKP8F5kJkmJNopY9got3n TiYYw19QDNtANQ880JKJ2PVzCb6mb6yUfUi0RRtYTRFO4+XXQhsakcUnBlX0xIXNr7UmaU4BIxF 0MuhlI9siecImxw8Ap5NCFmB9jyuxU2uBS0f6zvP8VUjpWYzLLdD2WaYHUApWywQA/WA9aJ5Skn eHpzPXqdKU0h3/all1MPSFWMga072P8XRZe6DyfpeDuhTSeovmdBeof84IP8RIzNfdB6SfrTn65 e279QQtbvfWLgVREvCGTPn8n+66uSh64iGPrkf0OG/0RRfLecZhiF3a343YzNWDjFVEDVkM30s/ 9/t/855lKfcnQsMA5CYs= X-Received: by 2002:a05:6000:156f:b0:391:ffc:2413 with SMTP id ffacd0b85a97d-3997f92d5ccmr3843398f8f.40.1742561869187; Fri, 21 Mar 2025 05:57:49 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43d43f55721sm77437695e9.20.2025.03.21.05.57.48 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 21 Mar 2025 05:57:48 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Richard Henderson , qemu-devel@nongnu.org Cc: Paolo Bonzini , Pierrick Bouvier , =?utf-8?q?Alex_Benn=C3=A9e?= , Anton Johansson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH-for-10.1 2/4] tcg: Simplify tcg_req_mo() macro Date: Fri, 21 Mar 2025 13:57:35 +0100 Message-ID: <20250321125737.72839-3-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250321125737.72839-1-philmd@linaro.org> References: <20250321125737.72839-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=philmd@linaro.org; helo=mail-wr1-x434.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 Now that TCG_GUEST_DEFAULT_MO is always defined, simplify the tcg_req_mo() macro. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Anton Johansson Reviewed-by: Richard Henderson Reviewed-by: Pierrick Bouvier --- accel/tcg/internal-target.h | 9 +-------- accel/tcg/tcg-all.c | 3 --- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/accel/tcg/internal-target.h b/accel/tcg/internal-target.h index 2cdf11c905e..1cb35dba99e 100644 --- a/accel/tcg/internal-target.h +++ b/accel/tcg/internal-target.h @@ -50,17 +50,10 @@ G_NORETURN void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr); * memory ordering vs the host memory ordering. A non-zero * result indicates that some barrier is required. * - * If TCG_GUEST_DEFAULT_MO is not defined, assume that the - * guest requires strict ordering. - * * This is a macro so that it's constant even without optimization. */ -#ifdef TCG_GUEST_DEFAULT_MO -# define tcg_req_mo(type) \ +#define tcg_req_mo(type) \ ((type) & TCG_GUEST_DEFAULT_MO & ~TCG_TARGET_DEFAULT_MO) -#else -# define tcg_req_mo(type) ((type) & ~TCG_TARGET_DEFAULT_MO) -#endif /** * cpu_req_mo: diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c index c1a30b01219..cb632cc8cc7 100644 --- a/accel/tcg/tcg-all.c +++ b/accel/tcg/tcg-all.c @@ -77,9 +77,6 @@ static bool default_mttcg_enabled(void) return false; } #ifdef TARGET_SUPPORTS_MTTCG -# ifndef TCG_GUEST_DEFAULT_MO -# error "TARGET_SUPPORTS_MTTCG without TCG_GUEST_DEFAULT_MO" -# endif return true; #else return false; From patchwork Fri Mar 21 12:57:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 875237 Delivered-To: patch@linaro.org Received: by 2002:a5d:5f4c:0:b0:38f:210b:807b with SMTP id cm12csp850697wrb; Fri, 21 Mar 2025 05:58:55 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV/IKLtm0oLagPPPfe5/9WSPJoMc+JewQnVb+8p0wGq7NkZGbPoQ8INHDnTJv525DNkx+U9fg==@linaro.org X-Google-Smtp-Source: AGHT+IFedkEJpnWYd2gPboucX4OAKdbgt50QPZMrQ2vK5wOeoCkHJ50Yt9MZ5XyHPOOygKnKqweP X-Received: by 2002:a05:622a:260b:b0:477:c89:3813 with SMTP id d75a77b69052e-4771dd62403mr39627941cf.9.1742561935430; Fri, 21 Mar 2025 05:58:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1742561935; cv=none; d=google.com; s=arc-20240605; b=iPN4vJqjEEdPQ67PA94ZTXwj0LeAWz0/qvvDPiHXrLSglW4iJ9rUo5JAHNQRKc4beL faxs13r/0DDG0o9an8w4EGrynu8FDLt4WsBncY1SU85kcn+JtY+/5UDtwnV/zvwnllRt Q4aHqRXkcz3WTarJH84M0FzFeWPN0Oh6LdpDrTHzFl9aywQl8EL+SH5Be31jF34EvkiJ 5rfBZzMFvSSExtGnT7J3saBWkS89glY0yK40JZlVrKrVdsbWNjoi7u7b7HuNTdGPaB4V WSldM3UY+juaWbaNyff0hta5nDe+/f1wt8s5CPMbXXMy8/g9DtInyHJ2hEPxRnUhXSMD sXEA== 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=VI0tJYTkCb6gsC09E2J8+oKikCYS17hZ29QKB1qjUsQ=; fh=6KR989Wp7QU5PJHl1R8iq8ouoTta8oEk/HyvGTu7KLY=; b=RmvqGTG22roeo0IzeUdlMGbeewNVF8L7hHJrFkQtQfQ/LvaAc+VWeXkpr17SiigzYt sRMMoL0McUY2qkpuBo7X4kkCHJGzC0hPk7iw/wrWw1CRY8fQy5agZqziAV4SikbufjjX t+7ecP9bMSgy25Q1Cf1N5UOB+QBHtGKVcPAZkPP2yXNDo+QkRK2uyrVCHr+eIexZ1OGb /aH/XfbsPvWjqFgRTWDaiRwGuRoxpCsHIwezy/RmJIAhmNfb0nheqywM2jaA8D11vomi 2mglVEMcNeMXQ93XrbKN7km/Y5cZViRVdEfWKl0rZy/E0on03gYUhE5U7BrZX5VWqjNQ r1Rw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Gt+11wjY; 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 d75a77b69052e-4771d1801cfsi19093761cf.184.2025.03.21.05.58.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 21 Mar 2025 05:58:55 -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=Gt+11wjY; 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 1tvbwn-0007lO-BR; Fri, 21 Mar 2025 08:58:01 -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 1tvbwj-0007kC-7X for qemu-devel@nongnu.org; Fri, 21 Mar 2025 08:57:57 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tvbwh-00031A-NI for qemu-devel@nongnu.org; Fri, 21 Mar 2025 08:57:56 -0400 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-399737f4fa4so1197624f8f.0 for ; Fri, 21 Mar 2025 05:57:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1742561874; x=1743166674; 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=VI0tJYTkCb6gsC09E2J8+oKikCYS17hZ29QKB1qjUsQ=; b=Gt+11wjYIqVNjFfdRobtxCVUHAWaY0MvTUYSyxzk34LmgdtZOY77q5gWyxy/dyXjOh 4QKwGpPjC1/MMJ+dTkkqBDrTOJCuHODyfWFFwhNWmZ+gVnB38YPMAAkUryS1HJXJ1sow Uu+uclkSMkNcQxC1fYh9Ixp7/+AkMhl7d9zMQaqV3FSwfULINC+LM+osFOQ5b+s3c0JD 19szF+Elcb1Qzxqh/ru0wtSggoWvJvVP6E4kGNGOFjQV+MDRBzfLVaxDQ3yMc327ZTa9 cY5HQzzoj5MkbaCg6heH3ZOEPs2MnUBc8788zJ/tjPRHuBb/hlVw9NplGxCUdUA2GvN2 pWLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742561874; x=1743166674; 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=VI0tJYTkCb6gsC09E2J8+oKikCYS17hZ29QKB1qjUsQ=; b=vcY1x0sgYSXebZh9fiLANy5KeogbwR0Zu7cQa27/K3ZRHE0OV8aKDo1ckA6ek3HE1I anQtMT/dy7ZEWpxlO9GIDswOfB6K3PQmiNTZPP80c+T6WDUMU+r0UETux74cY1/NZ9ap MWoP116hovh6R9K0USOYZVXfzvOZPPTQ7AOlXluSZaVXSvxgoX5520RAHO0XWHBXHTwZ +Y6yvjId4dTnn+ibPwH2x1WUSre4Aj6413uNMuzqIWdB5/qCEhRJFCB7H8e8Wq6rFSTX vVCaMq6p7wRFWJP8lUbnEZkWVb0EPeUKg8eOVEt+AWPMJebc3dkw3JX1KjNVxqUrdjPK LrJA== X-Forwarded-Encrypted: i=1; AJvYcCWbNYh1mqApt/rG6ZDEDdvqTX+n5X9ixj/pwaVK/amjdBqeFBOvR5zUL2Y/57Xri9G5AMQIfT5c9cs+@nongnu.org X-Gm-Message-State: AOJu0YxBMiMbCeKKPQYh/hV8vVRY5djwB/lD8P2az080shWLYvr5J5uE RUK67a8CWhw/I7vWu98zIY3gjQ4vwGZKUlJF5tv+AnLMjVkZk+78WF9sqEEb3bQ= X-Gm-Gg: ASbGncuCc6WvlHWT6uWqKvZK+sCDi7JgLFU2O6Jr7x3sRULQZ2W55rPcsrPedgFuxz8 KhPbt48kQFg5e49kqPiQKncGpzyG3hWZmtEackAnwD46/EJUvBZdz1RNtltVWCNXo0LFiaQ0G9X paAH9RabJYu4w/wYglbkgYw3cLHrwa6osc4ENr3/4UNNpgvoZFPyypSyHKIsAUtFA3/m2NX6ilf +xgL1+dRVyI5LFxZWq8lBgEb/ShtTW/rAHTK54UfVe0WTxHdoG0AWPIlsslhVcnCKMc3pnqzHM+ Ke5TVS47ohVQmpaLG7khA34T9WKFEul4dkAH+aRTauSRw2AlkOBZ5UdTvieVdcAw5BBFnkDtYFB 0GpNuNlhchYBdunaZNa8= X-Received: by 2002:a5d:5f8b:0:b0:38f:231a:635e with SMTP id ffacd0b85a97d-3997f912722mr3297314f8f.25.1742561873979; Fri, 21 Mar 2025 05:57:53 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3997f9e6539sm2305615f8f.77.2025.03.21.05.57.53 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 21 Mar 2025 05:57:53 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Richard Henderson , qemu-devel@nongnu.org Cc: Paolo Bonzini , Pierrick Bouvier , =?utf-8?q?Alex_Benn=C3=A9e?= , Anton Johansson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [RFC PATCH-for-10.1 3/4] tcg: Have tcg_req_mo() use runtime TCGContext::guest_mo Date: Fri, 21 Mar 2025 13:57:36 +0100 Message-ID: <20250321125737.72839-4-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250321125737.72839-1-philmd@linaro.org> References: <20250321125737.72839-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=philmd@linaro.org; helo=mail-wr1-x42e.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 In order to use TCG with multiple targets, replace the compile time use of TCG_GUEST_DEFAULT_MO by a runtime access to tcg_ctx->guest_mo. Signed-off-by: Philippe Mathieu-Daudé --- accel/tcg/internal-target.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/accel/tcg/internal-target.h b/accel/tcg/internal-target.h index 1cb35dba99e..014ee756f9d 100644 --- a/accel/tcg/internal-target.h +++ b/accel/tcg/internal-target.h @@ -49,11 +49,9 @@ G_NORETURN void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr); * 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) + ((type) & tcg_ctx->guest_mo & ~TCG_TARGET_DEFAULT_MO) /** * cpu_req_mo: From patchwork Fri Mar 21 12:57:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 875236 Delivered-To: patch@linaro.org Received: by 2002:a5d:5f4c:0:b0:38f:210b:807b with SMTP id cm12csp850587wrb; Fri, 21 Mar 2025 05:58:40 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWuC9o4dslVt781jEmO0gP+CYKj0SJb92DyRH0mWEyqs7LojPy85fxX8pjmmMlX90PIy/9fEQ==@linaro.org X-Google-Smtp-Source: AGHT+IH8Usjar2pV+i7JDLtY41+sPd2DtdxJdcuiG1WMV/kIqx+PhWeUqauDlTc7B9x+ZVugbAlX X-Received: by 2002:a05:620a:440a:b0:7c5:59a6:baeb with SMTP id af79cd13be357-7c5ba131cf5mr348996885a.2.1742561920478; Fri, 21 Mar 2025 05:58:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1742561920; cv=none; d=google.com; s=arc-20240605; b=NThpUtR2ajnF4JkJ8TQdd8RFa217n7ifOzG1ycM0vPkK8CHxQXxLbZwEnZZ3VLSqCH oA+ENhx8tO/UtsAUNuI2jvRgFHb2job+nwrgUtMN6ryBUGfKvvWQ9Kdu4EyFwG2S1VQ7 HMop9AfObqpknv2YeuaYfnfTXQ+qpJpqggWVM6myjDFoL/rPxCsJn+z1ZikZxE2X+zVz uOVI5yyMxOjhO5s6rxnkbB8FmboifPx/V5zt6DO5seXJXAqbaprW+/axXEgrnTRLGFZP VHDQI8sKGc4Aa6ciRHIHwPdX4dRHIi88OzdGbF721dgQ6M4mOJtF0TeSXWaxSoyPq8Cm MuEg== 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=WasTNRPB8s2qD7li7JaGZOSGNzq59uPVovl8lwAiCyo=; fh=srMujOzdmweNnc2VZX9qaC3MPQjlWPcnqRfns2QF4CI=; b=ewz/L6uJ4sYnveXO6PUQm6YE5Z9c+4drmCIx1z1C8sqKad0mhqJYuSKBw47qHmO3Pr 7tQJ3aKv96j1ySsPTYqG6vMFYcMXvik0bjWM8zmva11IGWQt/RhbYh1zvqlIGtAHW9hr pwDmzfMQRvDKI8EbGT/WIqgRhLiEKhwkYKGIR3NK/rK1XzmIqSLlGImjXb4SaFUnAmpN RsJEHnmQbbmdn2JVpKArRWAGo+CeONg3S7bh/QjhqS4ZY+0Uch+pfxAoew/vmizLWXiI Iayg0yFDeVoZZNqUnOfrl3UUh0FH8b2MYF9jbrIBahRHivxqaLjbXQPdpjtJK5SQ8q9h j7Fw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="s7/JsxmA"; 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-7c5b9360811si180732585a.474.2025.03.21.05.58.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 21 Mar 2025 05:58:40 -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="s7/JsxmA"; 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 1tvbww-0007mx-6h; Fri, 21 Mar 2025 08:58:10 -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 1tvbwp-0007lz-Nr for qemu-devel@nongnu.org; Fri, 21 Mar 2025 08:58:04 -0400 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 1tvbwm-00031h-R6 for qemu-devel@nongnu.org; Fri, 21 Mar 2025 08:58:03 -0400 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-3997205e43eso1549352f8f.0 for ; Fri, 21 Mar 2025 05:58:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1742561879; x=1743166679; 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=WasTNRPB8s2qD7li7JaGZOSGNzq59uPVovl8lwAiCyo=; b=s7/JsxmAIIFBYs8XpsM45soOSz2IFmifrI8N5zqDqwFUQu4FLNyBt+5CBCzJWq/tj4 mcZpgY91lR5gUeeL3tLZuKtO/JiS3F1qndaZ52hhXVfiqANT3Teos/CAY0irHwq2raTJ xZAI/0cz8fs/wDZH+XQ8TKSoZPPwpR7dM+lrLxWwqIyU/5q6Uai9ABqYAtX0/t6yOGF9 gB64Dk8dBWdqzWUZoyLapyInQiyA+3wG/jOpRykLtAfhU4mD9g4jtLMX3LwuCo0qPsdY FdKQsGTQDVIVqpd7WvE3EpY0JiYKd14/tdvcLV96R1GKNT2EXiozlnDIN4yxfVgfLjyf B8xA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742561879; x=1743166679; 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=WasTNRPB8s2qD7li7JaGZOSGNzq59uPVovl8lwAiCyo=; b=vAUQCagFGbrYRFFNMWcgQCtlcVHNMa8Loxy+rvGokD5lZq2G5OccFJGktSDd44inDl eNecZeGK30NOFe5R9d+ZPLM+ut6LFfkBBgq2t1azjMd8/UjcjVVKo26NOygq+n0j10FP KnzTI5KOLKbm+hZH/1qNsZcjqF/jKiG7SpguaVuIcIdzlnmrKCDY0Q5twUTp2lchZnXr RT09sEq63LsBSmr96Mzg+KSmQeD6/M/nDtuQQTtXplxrVxpi608IyMNW2iLRxOR4Td/Y RbPStpf+VNuBX13DtelPuHaeRm9Q4FFbjYLnPG9gxv+By1xumDb/8jZxgW2aZk6jh6Qy Fl+w== X-Forwarded-Encrypted: i=1; AJvYcCUwKFkTUQ0D22mD/eP/YkENnSFhxMbJZtmAQUZlGEVpBvbIu6xFUpoH4ioSu61rylxv7yP7/IDsWkwo@nongnu.org X-Gm-Message-State: AOJu0Yy4kTPQobYYaEmotpJMnwaFrO4zLYAQoqCS6uVErzJlbAizBYQL dc1/1V8Gt8EHP8/xF3XLDlCmIKolRKjXR7MqKc5HBH1ou5X/2aHEPQZZeee4Wbs= X-Gm-Gg: ASbGnctlC/xdbo09xmWyFRzDC7QOYxPdzvjiYwaGnl+EG0TgYOGQE7wsP7DYK+owr04 bDfb24/nb3chfipdCEe1RV9yQQFXKIPqGJYvGt0ODFnjTX5hDh2vLc3M5ViUbaAgvyUfIpOSwxg fRJw8MA92Ru0D1FKLN9zSWqoDFFNIZvNN11GaGaEb783DuNSaIXbe2aoRjyAS/uZjIJxZi+Tve/ Zg9tkdXhFfRdx7UqkSoNDL+akrcCJz0XQWpEkJ27JvFdBBE0VTEdlZNvKKhEoj16cVrZQcNDzPq Xg9KBcQaUQqclzMfhYuoK7gOGWSWwmVUH+FS7l8QefEnUEyDmImaN/wmgd2ttvR7zJtbwogIODx pIC3Sf9Ogd7GeBGZSpWw= X-Received: by 2002:a5d:64a7:0:b0:391:13d6:c9e5 with SMTP id ffacd0b85a97d-3997f902a67mr3109302f8f.19.1742561879106; Fri, 21 Mar 2025 05:57:59 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3997f9956b4sm2298150f8f.7.2025.03.21.05.57.57 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 21 Mar 2025 05:57:58 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Richard Henderson , qemu-devel@nongnu.org Cc: Paolo Bonzini , Pierrick Bouvier , =?utf-8?q?Alex_Benn=C3=A9e?= , Anton Johansson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [RFC PATCH-for-10.1 4/4] tcg: Define guest_default_memory_order in TCGCPUOps Date: Fri, 21 Mar 2025 13:57:37 +0100 Message-ID: <20250321125737.72839-5-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250321125737.72839-1-philmd@linaro.org> References: <20250321125737.72839-1-philmd@linaro.org> MIME-Version: 1.0 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Add the TCGCPUOps::guest_default_memory_order field and have each target initialize it. Use it to set TCGContext::guest_mo in tb_gen_code(), removing the need for the TCG_GUEST_DEFAULT_MO definition. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Anton Johansson Reviewed-by: Richard Henderson Reviewed-by: Pierrick Bouvier --- include/accel/tcg/cpu-ops.h | 8 ++++++++ target/alpha/cpu-param.h | 3 --- target/arm/cpu-param.h | 3 --- target/avr/cpu-param.h | 2 -- target/hexagon/cpu-param.h | 3 --- target/hppa/cpu-param.h | 8 -------- target/i386/cpu-param.h | 3 --- target/loongarch/cpu-param.h | 2 -- target/m68k/cpu-param.h | 3 --- target/microblaze/cpu-param.h | 3 --- target/mips/cpu-param.h | 2 -- target/openrisc/cpu-param.h | 2 -- target/ppc/cpu-param.h | 2 -- target/riscv/cpu-param.h | 2 -- target/rx/cpu-param.h | 3 --- target/s390x/cpu-param.h | 6 ------ target/sh4/cpu-param.h | 3 --- target/sparc/cpu-param.h | 23 ----------------------- target/tricore/cpu-param.h | 3 --- target/xtensa/cpu-param.h | 3 --- accel/tcg/translate-all.c | 2 +- target/alpha/cpu.c | 3 +++ target/arm/cpu.c | 3 +++ target/arm/tcg/cpu-v7m.c | 3 +++ target/avr/cpu.c | 1 + target/hexagon/cpu.c | 2 ++ target/hppa/cpu.c | 8 ++++++++ target/i386/tcg/tcg-cpu.c | 5 +++++ target/loongarch/cpu.c | 2 ++ target/m68k/cpu.c | 3 +++ target/microblaze/cpu.c | 3 +++ target/mips/cpu.c | 2 ++ target/openrisc/cpu.c | 2 ++ target/ppc/cpu_init.c | 2 ++ target/riscv/tcg/tcg-cpu.c | 2 ++ target/rx/cpu.c | 3 +++ target/s390x/cpu.c | 6 ++++++ target/sh4/cpu.c | 3 +++ target/sparc/cpu.c | 23 +++++++++++++++++++++++ target/tricore/cpu.c | 2 ++ target/xtensa/cpu.c | 3 +++ 41 files changed, 90 insertions(+), 80 deletions(-) diff --git a/include/accel/tcg/cpu-ops.h b/include/accel/tcg/cpu-ops.h index f60e5303f21..5fd299cefb6 100644 --- a/include/accel/tcg/cpu-ops.h +++ b/include/accel/tcg/cpu-ops.h @@ -16,8 +16,16 @@ #include "exec/memop.h" #include "exec/mmu-access-type.h" #include "exec/vaddr.h" +#include "tcg/tcg-mo.h" struct TCGCPUOps { + + /** + * @guest_default_memory_order: default barrier that is required + * for the guest memory ordering. + */ + TCGBar guest_default_memory_order; + /** * @initialize: Initialize TCG state * diff --git a/target/alpha/cpu-param.h b/target/alpha/cpu-param.h index ff06e41497a..c74556d2667 100644 --- a/target/alpha/cpu-param.h +++ b/target/alpha/cpu-param.h @@ -25,7 +25,4 @@ # define TARGET_VIRT_ADDR_SPACE_BITS (30 + TARGET_PAGE_BITS) #endif -/* Alpha processors have a weak memory model */ -#define TCG_GUEST_DEFAULT_MO (0) - #endif diff --git a/target/arm/cpu-param.h b/target/arm/cpu-param.h index 896b35bd6d5..55de4d54544 100644 --- a/target/arm/cpu-param.h +++ b/target/arm/cpu-param.h @@ -38,7 +38,4 @@ # define TARGET_PAGE_BITS_MIN 10 #endif /* !CONFIG_USER_ONLY */ -/* ARM processors have a weak memory model */ -#define TCG_GUEST_DEFAULT_MO (0) - #endif diff --git a/target/avr/cpu-param.h b/target/avr/cpu-param.h index 81f3f49ee1f..11e827109c0 100644 --- a/target/avr/cpu-param.h +++ b/target/avr/cpu-param.h @@ -31,6 +31,4 @@ #define TARGET_PHYS_ADDR_SPACE_BITS 24 #define TARGET_VIRT_ADDR_SPACE_BITS 24 -#define TCG_GUEST_DEFAULT_MO 0 - #endif diff --git a/target/hexagon/cpu-param.h b/target/hexagon/cpu-param.h index 2d57ea6caf9..45ee7b46409 100644 --- a/target/hexagon/cpu-param.h +++ b/target/hexagon/cpu-param.h @@ -23,7 +23,4 @@ #define TARGET_PHYS_ADDR_SPACE_BITS 36 #define TARGET_VIRT_ADDR_SPACE_BITS 32 -/* MTTCG not yet supported: require strict ordering */ -#define TCG_GUEST_DEFAULT_MO TCG_MO_ALL - #endif diff --git a/target/hppa/cpu-param.h b/target/hppa/cpu-param.h index 7ed6b5741e7..e0b2c7c9157 100644 --- a/target/hppa/cpu-param.h +++ b/target/hppa/cpu-param.h @@ -19,12 +19,4 @@ #define TARGET_PAGE_BITS 12 -/* PA-RISC 1.x processors have a strong memory model. */ -/* - * ??? While we do not yet implement PA-RISC 2.0, those processors have - * a weak memory model, but with TLB bits that force ordering on a per-page - * basis. It's probably easier to fall back to a strong memory model. - */ -#define TCG_GUEST_DEFAULT_MO TCG_MO_ALL - #endif diff --git a/target/i386/cpu-param.h b/target/i386/cpu-param.h index b0e884c5d70..909bc027923 100644 --- a/target/i386/cpu-param.h +++ b/target/i386/cpu-param.h @@ -22,7 +22,4 @@ #endif #define TARGET_PAGE_BITS 12 -/* The x86 has a strong memory model with some store-after-load re-ordering */ -#define TCG_GUEST_DEFAULT_MO (TCG_MO_ALL & ~TCG_MO_ST_LD) - #endif diff --git a/target/loongarch/cpu-param.h b/target/loongarch/cpu-param.h index 52437946e56..071567712b3 100644 --- a/target/loongarch/cpu-param.h +++ b/target/loongarch/cpu-param.h @@ -13,6 +13,4 @@ #define TARGET_PAGE_BITS 12 -#define TCG_GUEST_DEFAULT_MO (0) - #endif diff --git a/target/m68k/cpu-param.h b/target/m68k/cpu-param.h index 1a909eaa13e..7afbf6d302d 100644 --- a/target/m68k/cpu-param.h +++ b/target/m68k/cpu-param.h @@ -17,7 +17,4 @@ #define TARGET_PHYS_ADDR_SPACE_BITS 32 #define TARGET_VIRT_ADDR_SPACE_BITS 32 -/* MTTCG not yet supported: require strict ordering */ -#define TCG_GUEST_DEFAULT_MO TCG_MO_ALL - #endif diff --git a/target/microblaze/cpu-param.h b/target/microblaze/cpu-param.h index c866ec6c149..6a0714bb3d7 100644 --- a/target/microblaze/cpu-param.h +++ b/target/microblaze/cpu-param.h @@ -27,7 +27,4 @@ /* FIXME: MB uses variable pages down to 1K but linux only uses 4k. */ #define TARGET_PAGE_BITS 12 -/* MicroBlaze is always in-order. */ -#define TCG_GUEST_DEFAULT_MO TCG_MO_ALL - #endif diff --git a/target/mips/cpu-param.h b/target/mips/cpu-param.h index 11b3ac0ac63..35fb6ea7243 100644 --- a/target/mips/cpu-param.h +++ b/target/mips/cpu-param.h @@ -25,6 +25,4 @@ #define TARGET_PAGE_BITS_MIN 12 #endif -#define TCG_GUEST_DEFAULT_MO (0) - #endif diff --git a/target/openrisc/cpu-param.h b/target/openrisc/cpu-param.h index 37627f2c394..3011bf5fcca 100644 --- a/target/openrisc/cpu-param.h +++ b/target/openrisc/cpu-param.h @@ -12,6 +12,4 @@ #define TARGET_PHYS_ADDR_SPACE_BITS 32 #define TARGET_VIRT_ADDR_SPACE_BITS 32 -#define TCG_GUEST_DEFAULT_MO (0) - #endif diff --git a/target/ppc/cpu-param.h b/target/ppc/cpu-param.h index 6c4525fdf3c..2cee113ddd3 100644 --- a/target/ppc/cpu-param.h +++ b/target/ppc/cpu-param.h @@ -38,6 +38,4 @@ # define TARGET_PAGE_BITS 12 #endif -#define TCG_GUEST_DEFAULT_MO 0 - #endif diff --git a/target/riscv/cpu-param.h b/target/riscv/cpu-param.h index fba30e966a8..a80310ef2c5 100644 --- a/target/riscv/cpu-param.h +++ b/target/riscv/cpu-param.h @@ -26,6 +26,4 @@ * - M mode HLV/HLVX/HSV 0b111 */ -#define TCG_GUEST_DEFAULT_MO 0 - #endif diff --git a/target/rx/cpu-param.h b/target/rx/cpu-param.h index 2ce199164d7..ef1970a09e9 100644 --- a/target/rx/cpu-param.h +++ b/target/rx/cpu-param.h @@ -24,7 +24,4 @@ #define TARGET_PHYS_ADDR_SPACE_BITS 32 #define TARGET_VIRT_ADDR_SPACE_BITS 32 -/* MTTCG not yet supported: require strict ordering */ -#define TCG_GUEST_DEFAULT_MO TCG_MO_ALL - #endif diff --git a/target/s390x/cpu-param.h b/target/s390x/cpu-param.h index 5c331ec424c..a5f798eeae7 100644 --- a/target/s390x/cpu-param.h +++ b/target/s390x/cpu-param.h @@ -12,10 +12,4 @@ #define TARGET_PHYS_ADDR_SPACE_BITS 64 #define TARGET_VIRT_ADDR_SPACE_BITS 64 -/* - * The z/Architecture has a strong memory model with some - * store-after-load re-ordering. - */ -#define TCG_GUEST_DEFAULT_MO (TCG_MO_ALL & ~TCG_MO_ST_LD) - #endif diff --git a/target/sh4/cpu-param.h b/target/sh4/cpu-param.h index 1bc90d4695e..2b6e11dd0ac 100644 --- a/target/sh4/cpu-param.h +++ b/target/sh4/cpu-param.h @@ -16,7 +16,4 @@ # define TARGET_VIRT_ADDR_SPACE_BITS 32 #endif -/* MTTCG not yet supported: require strict ordering */ -#define TCG_GUEST_DEFAULT_MO TCG_MO_ALL - #endif diff --git a/target/sparc/cpu-param.h b/target/sparc/cpu-param.h index 6952ee2b826..6e8e2a51469 100644 --- a/target/sparc/cpu-param.h +++ b/target/sparc/cpu-param.h @@ -21,27 +21,4 @@ # define TARGET_VIRT_ADDR_SPACE_BITS 32 #endif -/* - * From Oracle SPARC Architecture 2015: - * - * Compatibility notes: The PSO memory model described in SPARC V8 and - * SPARC V9 compatibility architecture specifications was never implemented - * in a SPARC V9 implementation and is not included in the Oracle SPARC - * Architecture specification. - * - * The RMO memory model described in the SPARC V9 specification was - * implemented in some non-Sun SPARC V9 implementations, but is not - * directly supported in Oracle SPARC Architecture 2015 implementations. - * - * Therefore always use TSO in QEMU. - * - * D.5 Specification of Partial Store Order (PSO) - * ... [loads] are followed by an implied MEMBAR #LoadLoad | #LoadStore. - * - * D.6 Specification of Total Store Order (TSO) - * ... PSO with the additional requirement that all [stores] are followed - * by an implied MEMBAR #StoreStore. - */ -#define TCG_GUEST_DEFAULT_MO (TCG_MO_LD_LD | TCG_MO_LD_ST | TCG_MO_ST_ST) - #endif diff --git a/target/tricore/cpu-param.h b/target/tricore/cpu-param.h index 923459370cc..790242ef3d2 100644 --- a/target/tricore/cpu-param.h +++ b/target/tricore/cpu-param.h @@ -12,7 +12,4 @@ #define TARGET_PHYS_ADDR_SPACE_BITS 32 #define TARGET_VIRT_ADDR_SPACE_BITS 32 -/* MTTCG not yet supported: require strict ordering */ -#define TCG_GUEST_DEFAULT_MO TCG_MO_ALL - #endif diff --git a/target/xtensa/cpu-param.h b/target/xtensa/cpu-param.h index 5e4848ad059..06d85218b84 100644 --- a/target/xtensa/cpu-param.h +++ b/target/xtensa/cpu-param.h @@ -16,7 +16,4 @@ #define TARGET_VIRT_ADDR_SPACE_BITS 32 #endif -/* Xtensa processors have a weak memory model */ -#define TCG_GUEST_DEFAULT_MO (0) - #endif diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index fb9f83dbba3..26442e83776 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -349,7 +349,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu, tcg_ctx->tlb_dyn_max_bits = CPU_TLB_DYN_MAX_BITS; #endif tcg_ctx->insn_start_words = TARGET_INSN_START_WORDS; - tcg_ctx->guest_mo = TCG_GUEST_DEFAULT_MO; + tcg_ctx->guest_mo = cpu->cc->tcg_ops->guest_default_memory_order; restart_translate: trace_translate_block(tb, pc, tb->tc.ptr); diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c index 584c2aa76bd..e5e14976f51 100644 --- a/target/alpha/cpu.c +++ b/target/alpha/cpu.c @@ -239,6 +239,9 @@ static const TCGCPUOps alpha_tcg_ops = { .synchronize_from_tb = alpha_cpu_synchronize_from_tb, .restore_state_to_opc = alpha_restore_state_to_opc, + /* Alpha processors have a weak memory model */ + .guest_default_memory_order = 0, + #ifdef CONFIG_USER_ONLY .record_sigsegv = alpha_cpu_record_sigsegv, .record_sigbus = alpha_cpu_record_sigbus, diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 01786ac7879..8b9f2acf82b 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -2675,6 +2675,9 @@ static const TCGCPUOps arm_tcg_ops = { .debug_excp_handler = arm_debug_excp_handler, .restore_state_to_opc = arm_restore_state_to_opc, + /* ARM processors have a weak memory model */ + .guest_default_memory_order = 0, + #ifdef CONFIG_USER_ONLY .record_sigsegv = arm_cpu_record_sigsegv, .record_sigbus = arm_cpu_record_sigbus, diff --git a/target/arm/tcg/cpu-v7m.c b/target/arm/tcg/cpu-v7m.c index c4dd3092726..df6b7198944 100644 --- a/target/arm/tcg/cpu-v7m.c +++ b/target/arm/tcg/cpu-v7m.c @@ -238,6 +238,9 @@ static const TCGCPUOps arm_v7m_tcg_ops = { .debug_excp_handler = arm_debug_excp_handler, .restore_state_to_opc = arm_restore_state_to_opc, + /* ARM processors have a weak memory model */ + .guest_default_memory_order = 0, + #ifdef CONFIG_USER_ONLY .record_sigsegv = arm_cpu_record_sigsegv, .record_sigbus = arm_cpu_record_sigbus, diff --git a/target/avr/cpu.c b/target/avr/cpu.c index 834c7082aa7..24e52e28f44 100644 --- a/target/avr/cpu.c +++ b/target/avr/cpu.c @@ -216,6 +216,7 @@ static const TCGCPUOps avr_tcg_ops = { .cpu_exec_halt = avr_cpu_has_work, .tlb_fill = avr_cpu_tlb_fill, .do_interrupt = avr_cpu_do_interrupt, + .guest_default_memory_order = 0, }; static void avr_cpu_class_init(ObjectClass *oc, void *data) diff --git a/target/hexagon/cpu.c b/target/hexagon/cpu.c index 766b6786511..34734b0edb0 100644 --- a/target/hexagon/cpu.c +++ b/target/hexagon/cpu.c @@ -324,6 +324,8 @@ static const TCGCPUOps hexagon_tcg_ops = { .translate_code = hexagon_translate_code, .synchronize_from_tb = hexagon_cpu_synchronize_from_tb, .restore_state_to_opc = hexagon_restore_state_to_opc, + /* MTTCG not yet supported: require strict ordering */ + .guest_default_memory_order = TCG_MO_ALL, }; static void hexagon_cpu_class_init(ObjectClass *c, void *data) diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c index 2a85495d02f..997bd69db19 100644 --- a/target/hppa/cpu.c +++ b/target/hppa/cpu.c @@ -257,6 +257,14 @@ static const TCGCPUOps hppa_tcg_ops = { .synchronize_from_tb = hppa_cpu_synchronize_from_tb, .restore_state_to_opc = hppa_restore_state_to_opc, + /* PA-RISC 1.x processors have a strong memory model. */ + /* + * ??? While we do not yet implement PA-RISC 2.0, those processors have + * a weak memory model, but with TLB bits that force ordering on a per-page + * basis. It's probably easier to fall back to a strong memory model. + */ + .guest_default_memory_order = TCG_MO_ALL, + #ifndef CONFIG_USER_ONLY .tlb_fill_align = hppa_cpu_tlb_fill_align, .cpu_exec_interrupt = hppa_cpu_exec_interrupt, diff --git a/target/i386/tcg/tcg-cpu.c b/target/i386/tcg/tcg-cpu.c index b8aff825eec..4a76c475971 100644 --- a/target/i386/tcg/tcg-cpu.c +++ b/target/i386/tcg/tcg-cpu.c @@ -128,6 +128,11 @@ static const TCGCPUOps x86_tcg_ops = { .debug_check_breakpoint = x86_debug_check_breakpoint, .need_replay_interrupt = x86_need_replay_interrupt, #endif /* !CONFIG_USER_ONLY */ + + /* + * The x86 has a strong memory model with some store-after-load re-ordering + */ + .guest_default_memory_order = TCG_MO_ALL & ~TCG_MO_ST_LD, }; static void x86_tcg_cpu_init_ops(AccelCPUClass *accel_cpu, CPUClass *cc) diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c index ea1665e2705..c39ff056157 100644 --- a/target/loongarch/cpu.c +++ b/target/loongarch/cpu.c @@ -869,6 +869,8 @@ static const TCGCPUOps loongarch_tcg_ops = { .synchronize_from_tb = loongarch_cpu_synchronize_from_tb, .restore_state_to_opc = loongarch_restore_state_to_opc, + .guest_default_memory_order = 0, + #ifndef CONFIG_USER_ONLY .tlb_fill = loongarch_cpu_tlb_fill, .cpu_exec_interrupt = loongarch_cpu_exec_interrupt, diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c index 0065e1c1ca5..e96b379e266 100644 --- a/target/m68k/cpu.c +++ b/target/m68k/cpu.c @@ -593,6 +593,9 @@ static const TCGCPUOps m68k_tcg_ops = { .translate_code = m68k_translate_code, .restore_state_to_opc = m68k_restore_state_to_opc, + /* MTTCG not yet supported: require strict ordering */ + .guest_default_memory_order = TCG_MO_ALL, + #ifndef CONFIG_USER_ONLY .tlb_fill = m68k_cpu_tlb_fill, .cpu_exec_interrupt = m68k_cpu_exec_interrupt, diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c index f3bebea856e..4b9ef6e52c4 100644 --- a/target/microblaze/cpu.c +++ b/target/microblaze/cpu.c @@ -432,6 +432,9 @@ static const TCGCPUOps mb_tcg_ops = { .synchronize_from_tb = mb_cpu_synchronize_from_tb, .restore_state_to_opc = mb_restore_state_to_opc, + /* MicroBlaze is always in-order. */ + .guest_default_memory_order = TCG_MO_ALL, + #ifndef CONFIG_USER_ONLY .tlb_fill = mb_cpu_tlb_fill, .cpu_exec_interrupt = mb_cpu_exec_interrupt, diff --git a/target/mips/cpu.c b/target/mips/cpu.c index b207106dd79..5ddc9bbb829 100644 --- a/target/mips/cpu.c +++ b/target/mips/cpu.c @@ -554,6 +554,8 @@ static const TCGCPUOps mips_tcg_ops = { .synchronize_from_tb = mips_cpu_synchronize_from_tb, .restore_state_to_opc = mips_restore_state_to_opc, + .guest_default_memory_order = 0, + #if !defined(CONFIG_USER_ONLY) .tlb_fill = mips_cpu_tlb_fill, .cpu_exec_interrupt = mips_cpu_exec_interrupt, diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c index e8abf1f8b5c..6a878aaadd8 100644 --- a/target/openrisc/cpu.c +++ b/target/openrisc/cpu.c @@ -248,6 +248,8 @@ static const TCGCPUOps openrisc_tcg_ops = { .synchronize_from_tb = openrisc_cpu_synchronize_from_tb, .restore_state_to_opc = openrisc_restore_state_to_opc, + .guest_default_memory_order = 0, + #ifndef CONFIG_USER_ONLY .tlb_fill = openrisc_cpu_tlb_fill, .cpu_exec_interrupt = openrisc_cpu_exec_interrupt, diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c index 8b590e7f17c..28fbbb8d3c1 100644 --- a/target/ppc/cpu_init.c +++ b/target/ppc/cpu_init.c @@ -7490,6 +7490,8 @@ static const TCGCPUOps ppc_tcg_ops = { .translate_code = ppc_translate_code, .restore_state_to_opc = ppc_restore_state_to_opc, + .guest_default_memory_order = 0, + #ifdef CONFIG_USER_ONLY .record_sigsegv = ppc_cpu_record_sigsegv, #else diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c index 5aef9eef366..fb903992faa 100644 --- a/target/riscv/tcg/tcg-cpu.c +++ b/target/riscv/tcg/tcg-cpu.c @@ -139,6 +139,8 @@ static const TCGCPUOps riscv_tcg_ops = { .synchronize_from_tb = riscv_cpu_synchronize_from_tb, .restore_state_to_opc = riscv_restore_state_to_opc, + .guest_default_memory_order = 0, + #ifndef CONFIG_USER_ONLY .tlb_fill = riscv_cpu_tlb_fill, .cpu_exec_interrupt = riscv_cpu_exec_interrupt, diff --git a/target/rx/cpu.c b/target/rx/cpu.c index 0ba0d55ab5b..6a24e7e9136 100644 --- a/target/rx/cpu.c +++ b/target/rx/cpu.c @@ -212,6 +212,9 @@ static const TCGCPUOps rx_tcg_ops = { .cpu_exec_interrupt = rx_cpu_exec_interrupt, .cpu_exec_halt = rx_cpu_has_work, .do_interrupt = rx_cpu_do_interrupt, + + /* MTTCG not yet supported: require strict ordering */ + .guest_default_memory_order = TCG_MO_ALL, }; static void rx_cpu_class_init(ObjectClass *klass, void *data) diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index d73142600bf..12fd853c00a 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -360,6 +360,12 @@ static const TCGCPUOps s390_tcg_ops = { .debug_excp_handler = s390x_cpu_debug_excp_handler, .do_unaligned_access = s390x_cpu_do_unaligned_access, #endif /* !CONFIG_USER_ONLY */ + + /* + * The z/Architecture has a strong memory model with some + * store-after-load re-ordering. + */ + .guest_default_memory_order = TCG_MO_ALL & ~TCG_MO_ST_LD, }; #endif /* CONFIG_TCG */ diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c index ce84bdf539a..ce9ed75107a 100644 --- a/target/sh4/cpu.c +++ b/target/sh4/cpu.c @@ -267,6 +267,9 @@ static const TCGCPUOps superh_tcg_ops = { .synchronize_from_tb = superh_cpu_synchronize_from_tb, .restore_state_to_opc = superh_restore_state_to_opc, + /* MTTCG not yet supported: require strict ordering */ + .guest_default_memory_order = TCG_MO_ALL, + #ifndef CONFIG_USER_ONLY .tlb_fill = superh_cpu_tlb_fill, .cpu_exec_interrupt = superh_cpu_exec_interrupt, diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index 57161201173..39bd0c42855 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -1005,6 +1005,29 @@ static const TCGCPUOps sparc_tcg_ops = { .synchronize_from_tb = sparc_cpu_synchronize_from_tb, .restore_state_to_opc = sparc_restore_state_to_opc, + /* + * From Oracle SPARC Architecture 2015: + * + * Compatibility notes: The PSO memory model described in SPARC V8 and + * SPARC V9 compatibility architecture specifications was never + * implemented in a SPARC V9 implementation and is not included in the + * Oracle SPARC Architecture specification. + * + * The RMO memory model described in the SPARC V9 specification was + * implemented in some non-Sun SPARC V9 implementations, but is not + * directly supported in Oracle SPARC Architecture 2015 implementations. + * + * Therefore always use TSO in QEMU. + * + * D.5 Specification of Partial Store Order (PSO) + * ... [loads] are followed by an implied MEMBAR #LoadLoad | #LoadStore. + * + * D.6 Specification of Total Store Order (TSO) + * ... PSO with the additional requirement that all [stores] are followed + * by an implied MEMBAR #StoreStore. + */ + .guest_default_memory_order = TCG_MO_LD_LD | TCG_MO_LD_ST | TCG_MO_ST_ST, + #ifndef CONFIG_USER_ONLY .tlb_fill = sparc_cpu_tlb_fill, .cpu_exec_interrupt = sparc_cpu_exec_interrupt, diff --git a/target/tricore/cpu.c b/target/tricore/cpu.c index 16acc4ecb92..e0a48065948 100644 --- a/target/tricore/cpu.c +++ b/target/tricore/cpu.c @@ -179,6 +179,8 @@ static const TCGCPUOps tricore_tcg_ops = { .tlb_fill = tricore_cpu_tlb_fill, .cpu_exec_interrupt = tricore_cpu_exec_interrupt, .cpu_exec_halt = tricore_cpu_has_work, + /* MTTCG not yet supported: require strict ordering */ + .guest_default_memory_order = TCG_MO_ALL, }; static void tricore_cpu_class_init(ObjectClass *c, void *data) diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c index 7663b62d01e..dd9061ba469 100644 --- a/target/xtensa/cpu.c +++ b/target/xtensa/cpu.c @@ -237,6 +237,9 @@ static const TCGCPUOps xtensa_tcg_ops = { .debug_excp_handler = xtensa_breakpoint_handler, .restore_state_to_opc = xtensa_restore_state_to_opc, + /* Xtensa processors have a weak memory model */ + .guest_default_memory_order = 0, + #ifndef CONFIG_USER_ONLY .tlb_fill = xtensa_cpu_tlb_fill, .cpu_exec_interrupt = xtensa_cpu_exec_interrupt,