From patchwork Fri Mar 21 18:34:46 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: 875258 Delivered-To: patch@linaro.org Received: by 2002:a5d:5f4c:0:b0:38f:210b:807b with SMTP id cm12csp1022810wrb; Fri, 21 Mar 2025 11:36:28 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCViigCf54D41aKV5CWeehH7UVTmIlUtCOFbv6jDEUDQQVrw+tZ6yAwGoH0jq06TXYc1KZfQmw==@linaro.org X-Google-Smtp-Source: AGHT+IFlyGCOtGXEl43ReesRU+rUFf8Exx4o9HlUJY4gQOGOjPoBUofnKRzkYZvJM9rVgLBO/vcx X-Received: by 2002:a05:6214:234b:b0:6e6:5bd5:f3c3 with SMTP id 6a1803df08f44-6eb3f36c58amr56839216d6.44.1742582188095; Fri, 21 Mar 2025 11:36:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1742582188; cv=none; d=google.com; s=arc-20240605; b=OJzBXqzpZC83pj6B3iebJYJ+2hpwTpiUGJccwQsVwNdtzl6jlhi85EGyIUH5J2hZiz JXH6WI9mX0JxrMbAZH0Q4pf7byn9+Zd3y3yondu824W+OK99sUSAOszPW429xvL0Syun nkXD2SpWv1jT4iVCnknXQNg14UFGz38G4UdluuoJlB4d7zCb6TFErtfVGhMdFD6kNzom MUfU2gVy23CFZriK1LPHU+bntCjJ+PapO9i1l9AIWja/6iHzmAM0PYMUNMfZ8CFgWRb5 EpL6EIQ6H/6GQZPMBkQ74q7EVoWXZH+3TlXkJxsyz5rxMEFGOBo+DWHiBBIL68LyDhhW mg2Q== 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=RE0wVdA5EPxT4KkB4AoQ5ApL61ocTdG+Qs76h+UaNCY=; fh=JOtEYZycBJ2eRJNk2XKxm3YyoIxBN+VCL7xQpDRjdkY=; b=dUTRh4sQPm0QGWOsIPllpNH06+ZXdbvRODX0DtmY8cwUIJRUSjNS2hgpDwU6yEjT51 fDGoXLDpF73BdngVswjP6agPUfn1oUnxSGNPI1U65udfj2z0aSwFYWxZdc/QXSGElPnt FFtH+eWZaNW75hIFGuGRocXUtEIJHhc5NMrEvyFp/WrDRaRqhOgYsqpyOzt2/oN6aDzs 8NB0O2KBqoo+uCl2LATQDbdahWSZInK1E9DWCkbWY8Xfi+UzK+kO6DwErHWYzDtNHrsY Jvrsmb/RgQcVZ5yT2mvCU9yhX1oD77a3Djs/O8UQfrt/g4slsumd7zmtazO2TkYDjrYG 3Ysg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YZ6+tjZG; 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-6eb3ef49bf8si22196946d6.60.2025.03.21.11.36.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 21 Mar 2025 11:36:28 -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=YZ6+tjZG; 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 1tvhD3-0007hV-QW; Fri, 21 Mar 2025 14:35:11 -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 1tvhCv-0007fo-2s for qemu-devel@nongnu.org; Fri, 21 Mar 2025 14:35:01 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tvhCt-0006R6-FL for qemu-devel@nongnu.org; Fri, 21 Mar 2025 14:35:00 -0400 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-3914aba1ce4so1903992f8f.2 for ; Fri, 21 Mar 2025 11:34:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1742582098; x=1743186898; 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=RE0wVdA5EPxT4KkB4AoQ5ApL61ocTdG+Qs76h+UaNCY=; b=YZ6+tjZGFvEqvuZK0tstaJ0MSwCntg3m6IyPfui4uJwNLQfA+7F3HNYg3lK9PbbYZJ FuYIX/xWAOeHNzCEAhmVx/T3YCPZM32dByaiIfKkYyuM7pxQ0aQ2049tWhHbtaMSjNZ5 0ys/7AuC9MJUnhBxSfjM8ApzhPJpg8+u8KBXa6KTOFl+YrSEHY8Mrj3FPRQsEvrDRvax k/1KNEzTRUrGKvCXD0OAtkMN636d4ddheJQttTFwS8qWpAU2szrfvBEVLJG/BGb8F2/d 3nRhmJle/ezGOOQl6WX0HkDAsaiMYtPKGOIx5b2uFwDKZuKEAyWjPktPLP3/SBW1jDtR w66A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742582098; x=1743186898; 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=RE0wVdA5EPxT4KkB4AoQ5ApL61ocTdG+Qs76h+UaNCY=; b=vZkSotuSYF0Qa4kr/fVvk4j1iFPbfhRFqwbwtjbwUNxjjlbV4oPW++O4FPz8zaU8Ze rI85yUBS+Gg7khPjPL6sXFR/XxOg3k2hdUmqw/h2GLxVZ8D7k8FQfBmVmCXKK8Whby4Q /kvDkf5k9FI2oPKqSs67BTvS1v5+FdBhPPRz3xD/08msBTxGPGMYiDZBWVZh7JLJ1BIx Gmu/NdRepxRVrqPnBq2Z5G5ifAJuwcBhSzb9VvYo8JKk5Ttd9XZW270iOMMHuw/YXvgh CuFRju2W8gukRd3L14DRGQT3NoXq5lIAlYUprIfw0iVVBV8xITODrK2Im/XLiB9qk3ti I7Iw== X-Forwarded-Encrypted: i=1; AJvYcCUvzl6yv1BM3Ly+Md2Ef7LzlKbJb1DUtNnCGY2VwTGGcnh1f0zptGH6ZkeLu3gyvhdofiXQ1OkMHahL@nongnu.org X-Gm-Message-State: AOJu0YwbHSBGrLrsVpniX5qlmkDka3b7hYhmDU82lmdZPIg4lGul0x3K 1jl4jBj1h3ue1LKQl2S0dX0tvoGd+QCW2xS5BDV/O0Wc9CPbOGfpFyvcD7AfRD4= X-Gm-Gg: ASbGncsZbxRdJ3ZxthdnwjsyGRbt6VNBRG/RyuFSIz83KOcj8aCktfT4k7FerZGwz4+ sku8msLbjA+o9A2r5D6G/biRr0HzOW+N96sc0+K+KqVtTmJh6Clc+HEDCnAv7kc5tWg9otWpBaR 48b4zgR/mdmJIdi11kggwXM71AQD/Bl1ovpPu9rq2RmCWhS58C9Q80obepi1Y6XfaYzmtzNA6BM 0WQgaaa1PapIy75g78WGkaq5WOT27ukNZdv/cNdn+D2q39m+9dAksLemWH7F27UPW72E/E+Wap5 lKwa7MjzvygV70Nl3Uv1nVedZGIugYCXWv7nzO8p9dSkWPgbAoWsZqbBlYLdwSXaaJ8ASmbRUV9 aYlHj019+7BaOjLhuaQ8= X-Received: by 2002:a05:6000:18a3:b0:38f:2efb:b829 with SMTP id ffacd0b85a97d-3997f940da2mr3370977f8f.50.1742582097698; Fri, 21 Mar 2025 11:34:57 -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-3997f9a3428sm3073186f8f.26.2025.03.21.11.34.56 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 21 Mar 2025 11:34:57 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Richard Henderson , qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Anton Johansson , Pierrick Bouvier , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH-for-10.1 v2 1/4] target/riscv: Restrict RV128 MTTCG check on system emulation Date: Fri, 21 Mar 2025 19:34:46 +0100 Message-ID: <20250321183450.3970-2-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250321183450.3970-1-philmd@linaro.org> References: <20250321183450.3970-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=philmd@linaro.org; helo=mail-wr1-x432.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 Multi-threaded TCG only concerns system emulation. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Pierrick Bouvier --- target/riscv/tcg/tcg-cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c index fb903992faa..60a26acc503 100644 --- a/target/riscv/tcg/tcg-cpu.c +++ b/target/riscv/tcg/tcg-cpu.c @@ -1050,6 +1050,7 @@ static bool riscv_tcg_cpu_realize(CPUState *cs, Error **errp) return false; } +#ifndef CONFIG_USER_ONLY if (mcc->misa_mxl_max >= MXL_RV128 && qemu_tcg_mttcg_enabled()) { /* Missing 128-bit aligned atomics */ error_setg(errp, @@ -1058,7 +1059,6 @@ static bool riscv_tcg_cpu_realize(CPUState *cs, Error **errp) return false; } -#ifndef CONFIG_USER_ONLY CPURISCVState *env = &cpu->env; tcg_cflags_set(CPU(cs), CF_PCREL); From patchwork Fri Mar 21 18:34:47 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: 875254 Delivered-To: patch@linaro.org Received: by 2002:a5d:5f4c:0:b0:38f:210b:807b with SMTP id cm12csp1022567wrb; Fri, 21 Mar 2025 11:35:50 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWf5gGehvzfQpl6LeRsxx5kl+JseZaDgMmw1y9NJxSWWfTiuUVstS5nco1miBKIxspG1YuRQA==@linaro.org X-Google-Smtp-Source: AGHT+IF3YnLYesxEbIlTKBA5mb06fqprcxHCo1pcnGm1IPPs1nzkAfbwo4ePtxBJ6RQmbuDDB+la X-Received: by 2002:a05:620a:d8e:b0:7c5:95e6:ce1d with SMTP id af79cd13be357-7c5ba09ad53mr655079585a.0.1742582149970; Fri, 21 Mar 2025 11:35:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1742582149; cv=none; d=google.com; s=arc-20240605; b=N89r10R36MBRQnLtwmrRh737fmRV4bl+5Bui/hdqF+FWr5bcz6WHDxodpaCc3RPY76 hC58xYI/5JAFLy5bSR/Zs+8LU14eZAeBPJrQYmJ1vHpYcW5q8KXKovmh2mpiyVe+kpFx kDavPqj5nnhsNN9RpvE2ZatsTFRPnqFo0wYSZ5kkTQePxLyDDbwP8GvagzqXXRagl+s1 rB7SAAZ5CjPNtMXbyb6s4sbqr70z3wcBszQ/o3cID8wtfe2AB7Y8E3pHoICfnBU5SEZD TBg5A4I0Q1sHFI9PE0C20XLm6nsfV64T+f0gS8MbG1eL6rabe7BUZ3CvjZfFQYUmlrLx HonQ== 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=IjwZgCIi2jBsPZIag25qd8ZTCLcuQDiSa/Kk3V0wr/4=; fh=f4lFsqRI4PPE/d0NdCEVCgiz5yKQEobB22Po5bip4LE=; b=ClEi0Vzy+Y/cPSEuTJINZguu1mItTpTDilt8aIWf3D44qUAd/R6v5gEOC5HT/teA9P 8eIpwWMj06MvgYaAV8mexjj2ye00a3GRv08AV9LsUSkm8CyxjvRR9sueAHNf56odWVVI JqR4g8CZzoRnCSp+3iVmpQLnjswznj1CItdmoqW0Yc0AnN620X/FNB8lxicYbmxBXgkG d1vUZIluSB0BZS/ZCF2aiLfXgkXoYbIqQKV5wIFHjumwRyXA66Uqn7Y5IMIbrhjBJPyX l0MH/qO06er+NglftzwQ4/NGgUFCpm/11GkigAryHfImSP3CIDsScn0QTlLHVNfnmvK+ GZsA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gW4DFREW; 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-7c5b92b116asi237323685a.8.2025.03.21.11.35.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 21 Mar 2025 11:35:49 -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=gW4DFREW; 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 1tvhD8-0007n0-GM; Fri, 21 Mar 2025 14:35:14 -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 1tvhD1-0007h1-OR for qemu-devel@nongnu.org; Fri, 21 Mar 2025 14:35:08 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tvhCz-0006SD-Uq for qemu-devel@nongnu.org; Fri, 21 Mar 2025 14:35:07 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-43cf06eabdaso21714865e9.2 for ; Fri, 21 Mar 2025 11:35:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1742582103; x=1743186903; 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=IjwZgCIi2jBsPZIag25qd8ZTCLcuQDiSa/Kk3V0wr/4=; b=gW4DFREWmmBwOo9lwo7jV0e9YfdirGQ9Hd+SkEP0oZyaTF0uGhL7yW7uSIpo26i/iz WuWu/QjbPt5J79PduD27+90FUAEaMM9DgJCgagRgE+HixCSPW013s2Fqa3r7PIOAJ3yM MPSkWiBJe/2dtg7+A0qzHMvmX7G1UaMJl7wPVthBx+TnXjK/dvCtFUK1eYB9CM3tzQKi euHZ2oMHzvIXNhbJ0jhACMQ8sWD6Rz8jf+UTkgr37XErfuY8TczeEqX8c1+b51NEs4EV 2X4ucFRVjI8fRuaojgqi6ZD5oMW44nJWkBQyEAM55aTk9EQIcDrfHdq8gPP3KOmDE/9J MGXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742582103; x=1743186903; 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=IjwZgCIi2jBsPZIag25qd8ZTCLcuQDiSa/Kk3V0wr/4=; b=orVlKijQ6bkWlWPXuHjZHRb33rCGAFSbXXb6M7SKr/60GShfgas3VRPxmkQ8/aOZAt lFbSZdj4gv3Fr/gP3drzGvV9712ApjOwee05V4GoaA6y6h1bhJsDAOfsgU7QVcFrFO// nQlYFyrwcwhmBiaPo9xqury9Ul8dO2ylWsDiO3DfdZM09hxbcTBKiW5zsGAQhNR47NC5 qz8F4/EzBQcGBPGQhDEJGC+9ZdMCmGDYtidZYDjMG1JhErv1Zy113aIV2vzBYwSTLne0 WPM5hjd9m8lnV7EUUnmuj+4FILd07dSGMY91Q4sG756NtGGgbXfZX1ifC06DTfwnzPAE vxrg== X-Forwarded-Encrypted: i=1; AJvYcCUmKHEdq7+iUWMt/llWuCJKWLZfJaHgi6W/NBywcqTic64ehWuGashaEhQhMvlAgwltNesuhfMeFnyT@nongnu.org X-Gm-Message-State: AOJu0Yy5xJHRGnqzqzaHDGB1N3w3/PCf/LfnkL+FkamEI/nt/+M0o0NN qXJcvxWX5OAjftYreL9CogGbZevuYGK5nnOU4W5G9CD4oHA8mHGKoyf8D3ChKdQ= X-Gm-Gg: ASbGncu/TMegFAC2jRu5uxBM3lyVj/99sPTUunPVRwpbIdeZkIl59cUu0J7fhuUnRcH TmiFiPX7Wv/qCecRk2gJt9q74sNSNLSsprD8rg0H/KGra42weX8t1jUANuI5U3G/wWs5CBy88P1 hb0E47tykIV61H5Q9o/NaAevrQFQ4pJBIPEzh4tGo5LJ+gLexKOZPScbkY6HstzEw7hX9VWhlII l1D6/f+ltL6S0ITCt9YVtSD/evT4NuoBOVkcuflDCZ/3H0JOoRvb2yq43GtVY2kBtekL0zk43ow 7uyAYeyRVyJ30ytQ4XBAck7FIhaA7jtrIJgdp7uG18NA0lX7S+f5A16M858hbYWQb5Sx4t39p81 M3ko8nsCt5juwcq9UGXQ= X-Received: by 2002:a05:600c:4f85:b0:43c:e481:3353 with SMTP id 5b1f17b1804b1-43d50a13947mr41133405e9.17.1742582102694; Fri, 21 Mar 2025 11:35:02 -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-43d3cf2e1ffsm49736555e9.3.2025.03.21.11.35.01 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 21 Mar 2025 11:35:02 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Richard Henderson , qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Anton Johansson , Pierrick Bouvier , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH-for-10.1 v2 2/4] tcg: Move qemu_tcg_mttcg_enabled() to 'system/tcg.h' Date: Fri, 21 Mar 2025 19:34:47 +0100 Message-ID: <20250321183450.3970-3-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250321183450.3970-1-philmd@linaro.org> References: <20250321183450.3970-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=philmd@linaro.org; helo=mail-wm1-x336.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 qemu_tcg_mttcg_enabled() is specific to 1/ TCG and 2/ system emulation. Move the prototype declaration to "system/tcg.h", reducing 'mttcg_enabled' variable scope. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Pierrick Bouvier --- include/hw/core/cpu.h | 9 --------- include/system/tcg.h | 8 ++++++++ accel/tcg/tcg-all.c | 11 ++++++++++- target/riscv/tcg/tcg-cpu.c | 1 + tcg/region.c | 4 +++- 5 files changed, 22 insertions(+), 11 deletions(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 5d11d26556a..54570d21aea 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -597,15 +597,6 @@ extern CPUTailQ cpus_queue; extern __thread CPUState *current_cpu; -/** - * qemu_tcg_mttcg_enabled: - * Check whether we are running MultiThread TCG or not. - * - * Returns: %true if we are in MTTCG mode %false otherwise. - */ -extern bool mttcg_enabled; -#define qemu_tcg_mttcg_enabled() (mttcg_enabled) - /** * cpu_paging_enabled: * @cpu: The CPU whose state is to be inspected. diff --git a/include/system/tcg.h b/include/system/tcg.h index 73229648c63..7622dcea302 100644 --- a/include/system/tcg.h +++ b/include/system/tcg.h @@ -17,4 +17,12 @@ extern bool tcg_allowed; #define tcg_enabled() 0 #endif +/** + * qemu_tcg_mttcg_enabled: + * Check whether we are running MultiThread TCG or not. + * + * Returns: %true if we are in MTTCG mode %false otherwise. + */ +bool qemu_tcg_mttcg_enabled(void); + #endif diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c index cb632cc8cc7..d75ecf531b6 100644 --- a/accel/tcg/tcg-all.c +++ b/accel/tcg/tcg-all.c @@ -38,6 +38,7 @@ #include "hw/qdev-core.h" #else #include "hw/boards.h" +#include "system/tcg.h" #endif #include "internal-common.h" #include "cpu-param.h" @@ -58,6 +59,15 @@ typedef struct TCGState TCGState; DECLARE_INSTANCE_CHECKER(TCGState, TCG_STATE, TYPE_TCG_ACCEL) +static bool mttcg_enabled; + +#ifndef CONFIG_USER_ONLY +bool qemu_tcg_mttcg_enabled(void) +{ + return mttcg_enabled; +} +#endif + /* * We default to false if we know other options have been enabled * which are currently incompatible with MTTCG. Otherwise when each @@ -97,7 +107,6 @@ static void tcg_accel_instance_init(Object *obj) #endif } -bool mttcg_enabled; bool one_insn_per_tb; static int tcg_init_machine(MachineState *ms) diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c index 60a26acc503..5ccd7b9dc07 100644 --- a/target/riscv/tcg/tcg-cpu.c +++ b/target/riscv/tcg/tcg-cpu.c @@ -35,6 +35,7 @@ #include "tcg/tcg.h" #ifndef CONFIG_USER_ONLY #include "hw/boards.h" +#include "system/tcg.h" #endif /* Hash that stores user set extensions */ diff --git a/tcg/region.c b/tcg/region.c index 478ec051c4b..56d2e988719 100644 --- a/tcg/region.c +++ b/tcg/region.c @@ -34,7 +34,9 @@ #include "exec/translation-block.h" #include "tcg-internal.h" #include "host/cpuinfo.h" - +#ifndef CONFIG_USER_ONLY +#include "system/tcg.h" +#endif /* * Local source-level compatibility with Unix. From patchwork Fri Mar 21 18:34:48 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: 875257 Delivered-To: patch@linaro.org Received: by 2002:a5d:5f4c:0:b0:38f:210b:807b with SMTP id cm12csp1022802wrb; Fri, 21 Mar 2025 11:36:27 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWHpDdNV2jJiTSmCGjd/vUs0IrXByOxq7+FlrgQeby/ji8mDvg61AhayFiUuDlNq0hJyw2kwg==@linaro.org X-Google-Smtp-Source: AGHT+IEpuQl1dfty5Ch660puYNm4eqbaz8HBErChj7M1ooUnLTXEY8D+BurO9A4H36I6ToG41//W X-Received: by 2002:a05:6214:20c3:b0:6ea:fac1:ef19 with SMTP id 6a1803df08f44-6eb34a06a09mr123970326d6.15.1742582187209; Fri, 21 Mar 2025 11:36:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1742582187; cv=none; d=google.com; s=arc-20240605; b=KSKkYR6cXUw7HLhhh+zChQpC6VHYuRP/Xcp9V09xfP8ln9I28u9CaUazZU5y+MPMKE +hr2ofiAJu/Z5i76kBXACLrd8BRXEIk+I2K4QcEUQxIi2QkaO2ESjq2LONkSszG9h8Uf 1yyGJja/nUpHg9wRkdWSVgOFMWaPJoPUtGFtbvudhY7+12PmQimtcCKUl/nkjT0yegtr FakpvxXJqZwmwJAzq0mCL86PJjF1QOGhS05hO08wIgd07F0UbzWgeOpr/M6b82/r244M yD2GA8fX259niw/WTmxL8znsjJQMjXVfggUNl8MUMHOLLTgB93hBZQNCkq3X12hgPpcb Ynrw== 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=gFcvKnJ/OFG2ddpHAkQ7xN+mVhKOeS5fntJYMy/mG4s=; fh=8nT/wHgfAGci2ksGRsOaHndfKS2ajB7Bh33OZT5ZOYs=; b=dannQSm1XrjHamGNdpx5JHJqU2V+nnXznl/SZn72u2Xm8cr1HMwrCSNiflIU5ErrYf ssLz/hvKYb66IvZIkhzi3yBgkx1snrScgRRb3YcmB4S8nWTVIPnsQ+c4UAwQ4mNFgOGi YUgv0deUt5hMy9rW516aapTDoLsrAADxr+8S0+EWVqw8m3Aic71YxgTx42QP1OV9P3oP RRYaRjnqtO7zVWmy1pboDkCI4w0amB08RUsISkHMmFRnPa4yZp6cUofxTdZEqDV57zo9 ZDA9cO/vKrGRS88bb4ocn0q7TMkAIiegVTefB5aceumjP6IKKpWcrquWyi2kaj+f9Nuv wExQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xpWIMQvX; 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-6eb3eff3747si22178196d6.218.2025.03.21.11.36.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 21 Mar 2025 11:36:27 -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=xpWIMQvX; 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 1tvhD7-0007m9-JN; Fri, 21 Mar 2025 14:35:13 -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 1tvhD5-0007iQ-Kg for qemu-devel@nongnu.org; Fri, 21 Mar 2025 14:35:11 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tvhD3-0006U2-Q4 for qemu-devel@nongnu.org; Fri, 21 Mar 2025 14:35:11 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-4393dc02b78so15846105e9.3 for ; Fri, 21 Mar 2025 11:35:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1742582108; x=1743186908; 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=gFcvKnJ/OFG2ddpHAkQ7xN+mVhKOeS5fntJYMy/mG4s=; b=xpWIMQvXs5RD6ulV9hmLgxn9TOZc6OpCLBNnoeu0WG3e2/CrG1CyVfXm+Z9mNWaQtX wRi/dynuCljDfKBoBKHgW92xkUIRP2MvJcruZpSx0aFCeuJAtE5oS5Da38UgqxIhU7yT 8/DhEENVmIRYo0gPU9S0rCfw9+Z81FFytsMb9Iu4vZE6azo6sAxXGsgVonj0q864iyzl kjIL7JY5LkY2k50I0uqjUN5gCFissj/Z8JuaDbOzJ5vXdHi2b8AzR2QXUMWxHCzIoTqK 48J8m0E2PeeRA4i26bIIGtuDNYrYGb1RbucRbvWdSut3P/mZq62nw1fBYtpHZNZAwjuF Ymbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742582108; x=1743186908; 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=gFcvKnJ/OFG2ddpHAkQ7xN+mVhKOeS5fntJYMy/mG4s=; b=Nuvb0um0A64TI9RH3g/yQCwQwj2C+JfQM8CcClp+OeGF0VY/FD+I4aYKBanGhg2jLs ylLYkGuu8iQYg01vEuUixjIBQCEbzDdUx1O0G3a9lYz19cMKW8tU6vG1zix7x5bGZKsD T10falOyI4Z1xumbe1JX8LKFwSIYkNyILDfc3v9cjs7wAmZq18+6MiyNEMY6Kh1lnOGL W1DcuOBdP3S40ySfiWyjJB01Od7gTrrf28WrfGHfn9QSYpqt1iu9nYF4yKH6QGUVMYiT ifYbV5vWPbEV4V0vE/+hCKukQb1XeWdtxrRj3juJmdBovbc+9MJe/o1bMvoaPXiTf7fs kyKA== X-Forwarded-Encrypted: i=1; AJvYcCW9FVMy9VjxcLjDn7E78akAsC3JRDTnvyzlHcxTeNol2Jc56W+Nj/N1DaK5zmLXPgQ+mYiB17AN+GgW@nongnu.org X-Gm-Message-State: AOJu0YxM+UgKBdc6OwXKgScOhIJEiONCdGvbpSfolW2BhGyyrS01sxMV Q5oofmErhjoeZCjB+1koiTt/lbFtVMFO+kFodSBHg8csZpFWhquTVDSj0VCBhwM= X-Gm-Gg: ASbGncvoSB0EBw4xTIzOSbdXQ9xx3E2JgIn+a/foVnqmvWg0BpoNueBBkN9h+1qUcoG oBQnJ3WA2iAtr6OglsafqwffaIv5sWqa7S5u1J8x3SoBrO7v752ycDsWXnDqblJYZl0/vJW2NHO xoP6SEDYC1bIl47FEq8Pd1N1/UHiBHdWjFXhjE6y2YhmHBBr6FjSXVT4HRXU5ZvKpaxn+pHmgk0 GijcrHjgNU6/BT94QbAq5vu6v9f35odNyBxMhPfxeIre6zjtSKh1t7MjqTokkkxKS4638PVQ1/8 MOveRF9mWl9SjFpCnFkib/bsVaalK8kRxL8498ADL4GXCaYexuE0cAkdJB8NIukxVV+iSIkNUhc qQZM5+7oIe0PLoR7gIRU= X-Received: by 2002:a05:600c:3b95:b0:43b:b756:f0a9 with SMTP id 5b1f17b1804b1-43d509ea96fmr42703105e9.11.1742582107598; Fri, 21 Mar 2025 11:35:07 -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-3997f99561dsm3097827f8f.12.2025.03.21.11.35.06 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 21 Mar 2025 11:35:07 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Richard Henderson , qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Anton Johansson , Pierrick Bouvier , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH-for-10.1 v2 3/4] tcg: Convert TCGState::mttcg_enabled to TriState Date: Fri, 21 Mar 2025 19:34:48 +0100 Message-ID: <20250321183450.3970-4-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250321183450.3970-1-philmd@linaro.org> References: <20250321183450.3970-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=philmd@linaro.org; helo=mail-wm1-x32e.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 Use the OnOffAuto type as 3-state. Since the TCGState instance is zero-initialized, the mttcg_enabled is initialzed as AUTO (ON_OFF_AUTO_AUTO). In tcg_init_machine(), if mttcg_enabled is still AUTO, set a default value (effectively inlining the default_mttcg_enabled() method content). Instead of emiting a warning when the 'thread' property is set in tcg_set_thread(), emit it in tcg_init_machine() where it is consumed. This is in preparation of the next commit where we replace the TARGET_SUPPORTS_MTTCG definition by getting the value at runtime via CPUState -> CPUClass -> TCGCPUOps -> mttcg_supported, so we need an initialized CPUState -- which is not possible at instance_init time). In the tcg_get_thread() getter, consider AUTO / OFF states as "single", otherwise ON is "multi". Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Anton Johansson Reviewed-by: Pierrick Bouvier --- accel/tcg/tcg-all.c | 69 ++++++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 35 deletions(-) diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c index d75ecf531b6..f83f9b9d79e 100644 --- a/accel/tcg/tcg-all.c +++ b/accel/tcg/tcg-all.c @@ -32,6 +32,7 @@ #include "qemu/error-report.h" #include "qemu/accel.h" #include "qemu/atomic.h" +#include "qapi/qapi-types-common.h" #include "qapi/qapi-builtin-visit.h" #include "qemu/units.h" #if defined(CONFIG_USER_ONLY) @@ -47,7 +48,7 @@ struct TCGState { AccelState parent_obj; - bool mttcg_enabled; + OnOffAuto mttcg_enabled; bool one_insn_per_tb; int splitwx_enabled; unsigned long tb_size; @@ -68,37 +69,10 @@ bool qemu_tcg_mttcg_enabled(void) } #endif -/* - * We default to false if we know other options have been enabled - * which are currently incompatible with MTTCG. Otherwise when each - * guest (target) has been updated to support: - * - atomic instructions - * - memory ordering primitives (barriers) - * they can set the appropriate CONFIG flags in ${target}-softmmu.mak - * - * Once a guest architecture has been converted to the new primitives - * there is one remaining limitation to check: - * - The guest can't be oversized (e.g. 64 bit guest on 32 bit host) - */ - -static bool default_mttcg_enabled(void) -{ - if (icount_enabled()) { - return false; - } -#ifdef TARGET_SUPPORTS_MTTCG - return true; -#else - return false; -#endif -} - static void tcg_accel_instance_init(Object *obj) { TCGState *s = TCG_STATE(obj); - s->mttcg_enabled = default_mttcg_enabled(); - /* If debugging enabled, default "auto on", otherwise off. */ #if defined(CONFIG_DEBUG_TCG) && !defined(CONFIG_USER_ONLY) s->splitwx_enabled = -1; @@ -117,8 +91,37 @@ static int tcg_init_machine(MachineState *ms) #else unsigned max_cpus = ms->smp.max_cpus; #endif +#ifdef TARGET_SUPPORTS_MTTCG + bool mttcg_supported = true; +#else + bool mttcg_supported = false; +#endif tcg_allowed = true; + + if (s->mttcg_enabled == ON_OFF_AUTO_AUTO) { + /* + * We default to false if we know other options have been enabled + * which are currently incompatible with MTTCG. Otherwise when each + * guest (target) has been updated to support: + * - atomic instructions + * - memory ordering primitives (barriers) + * they can set the appropriate CONFIG flags in ${target}-softmmu.mak + * + * Once a guest architecture has been converted to the new primitives + * there is one remaining limitation to check: + * - The guest can't be oversized (e.g. 64 bit guest on 32 bit host) + */ + if (icount_enabled()) { + s->mttcg_enabled = ON_OFF_AUTO_OFF; + } else { + s->mttcg_enabled = mttcg_supported; + } + } + if (s->mttcg_enabled == ON_OFF_AUTO_ON && !mttcg_supported) { + warn_report("Guest not yet converted to MTTCG - " + "you may get unexpected results"); + } mttcg_enabled = s->mttcg_enabled; page_init(); @@ -144,7 +147,7 @@ static char *tcg_get_thread(Object *obj, Error **errp) { TCGState *s = TCG_STATE(obj); - return g_strdup(s->mttcg_enabled ? "multi" : "single"); + return g_strdup(s->mttcg_enabled == ON_OFF_AUTO_ON ? "multi" : "single"); } static void tcg_set_thread(Object *obj, const char *value, Error **errp) @@ -155,14 +158,10 @@ static void tcg_set_thread(Object *obj, const char *value, Error **errp) if (icount_enabled()) { error_setg(errp, "No MTTCG when icount is enabled"); } else { -#ifndef TARGET_SUPPORTS_MTTCG - warn_report("Guest not yet converted to MTTCG - " - "you may get unexpected results"); -#endif - s->mttcg_enabled = true; + s->mttcg_enabled = ON_OFF_AUTO_ON; } } else if (strcmp(value, "single") == 0) { - s->mttcg_enabled = false; + s->mttcg_enabled = ON_OFF_AUTO_OFF; } else { error_setg(errp, "Invalid 'thread' setting %s", value); } From patchwork Fri Mar 21 18:34:49 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: 875256 Delivered-To: patch@linaro.org Received: by 2002:a5d:5f4c:0:b0:38f:210b:807b with SMTP id cm12csp1022745wrb; Fri, 21 Mar 2025 11:36:18 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVlx7PNkAZcq4DZsB8mwv9QAyaVZ9dmCESjNA+rC2mFRkrXYE4JQ3Bo9kJGmYYx/ts+sJYB7w==@linaro.org X-Google-Smtp-Source: AGHT+IHE+G6Vq5bbHIpxuGd2J1mFMW7iYDaX4yYdaTAuadJu58nbFHyXk8SEPnpt6J1i0DXlkvz+ X-Received: by 2002:a05:6214:508e:b0:6e6:6b5b:e559 with SMTP id 6a1803df08f44-6eb3f32cddfmr68568466d6.34.1742582178357; Fri, 21 Mar 2025 11:36:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1742582178; cv=none; d=google.com; s=arc-20240605; b=dSZW+oGlXZtSwf8SDQUKApCeO2fxKcA3KJF/6jQyeiPt3js56O3pPcL6VyXfEzxtGb EGfZNZ4VZoJKzbCkrS7fN0OgX+yOVUL1BrcxnPC6We/v79TPwrxGiR/LMNq8S096ntVm D6GfX8LrBdc2ae2cbHS0aEYIG0mmP74q0fj2p8AFfInEi8Sc+//akR87UwQekG7MhNPb r5Hnv/1ntVIhnLv2S5jCSrUpgu66S8UUT3zXF6zZx50tgDQfHoIehJd/lViZICDu8ftH NsOLBAl31pDwH9VlF6nsg9UzwEff8Nf3N+EvFwbOa6BS1sbbfsNNKqzVFAO8jLMKk0lg czBA== 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=fpmvkEmhJiK6Q/6HWo04Dj+mqs1gWrmUxMp9dj9JYoI=; fh=pxc2vfqRvz8IqcHDxZ+VnIrHduOiQvZlq8ruv8fG00Q=; b=fo7/LpagEujJyD8T7dQr++aWWv8G69oqLi9vq0WFKewFSrpkEg+v5qM2W0TMHRrIcK ZNtPYKC9gBoMXTL64MqsDQEixt7HH7bRBbUgipordn6Xd85vahBWcrlyEvxTSty1BOVg QixAYYNjhjZxghP4BiM7I1yd8vMAXQMIVbgEBkK0xBTysBRxP41Tlv2OXCICesrQZ1OD y/Z1Z90us2SzJItjpO1SpneEI0TcT9LOrBeUar1dmjHA1DrDEd5YkBEYwZfY//riBw8b n0Iv56GXJQR2UmItO4NZC4NbLvwVths7hyHb6bnTx/BiFOxHphakmFp55tMZZEeIQmu7 SwKg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tsHzD5Zx; 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-6eb3ef56423si23328166d6.147.2025.03.21.11.36.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 21 Mar 2025 11:36:18 -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=tsHzD5Zx; 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 1tvhDD-0007qX-0J; Fri, 21 Mar 2025 14:35:19 -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 1tvhDB-0007pZ-7N for qemu-devel@nongnu.org; Fri, 21 Mar 2025 14:35:17 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tvhD8-0006n7-6Z for qemu-devel@nongnu.org; Fri, 21 Mar 2025 14:35:16 -0400 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-3912fdddf8fso2223488f8f.1 for ; Fri, 21 Mar 2025 11:35:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1742582113; x=1743186913; 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=fpmvkEmhJiK6Q/6HWo04Dj+mqs1gWrmUxMp9dj9JYoI=; b=tsHzD5ZxIeo4YD2VEqSATlEmL9+sJeqM+tQBNxKJakDXzzDPJPdjHGsLcKC+QO+yPF VGFopN9fCtC2B+WtwaWM7UbondDcyAegq31fJTij7VHP7PuyXMmuSmEAsb0GESB6b1LE eoZZsYdcrqBy34Kp0Z6/TJhAGrMmCo+gDAdesl+4Z8AkEnLsZAhcS7W5y5RWL7F+mzir +dHZoqhADu8Gq5bZzWHmbOv26Kd3rwiU0GQOXZr1IqR780gWNAlTi9XX8kJp8yrhWl5q HLPAz3pbID7oDCV1yKgNe4IzcZahrifIS7/9MMy+Hc8q/qdJ/WPFFIjKsq8ozEMSm4rm 9TeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742582113; x=1743186913; 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=fpmvkEmhJiK6Q/6HWo04Dj+mqs1gWrmUxMp9dj9JYoI=; b=dS22qxktkpA9+MyMCIvbBtwS4Eqjbw2ex3dXboqne6yHkTbT3hs242C9mG/C/26Whv +YMuKPFF6Ljuh98kQavisTOWe6WTjpjVGdGwzk8XHk6/Y/6gRiYZ78cBgVWDsJZ+hqoG 9NRysq5j9VRy5Dy64UpDqIypjznmy/yFpw8MocPx3MHL8owR+OpMlc7CDltNPsoNsW76 37nWfLSfL5G/Pbdkzj7Pe9p6XHWUozzf6shuJtSUvpLZNYrqwt7kCFjHWlsTtNS94UGQ YsPlfc64QJ2iEBMQJsw+D6JBAD5FRvG4PsFWv1M7xOJpjMnx/oxWvDq8EBMmp3B1yvHO d/LA== X-Forwarded-Encrypted: i=1; AJvYcCW536Td9uo1vIN23mBFt1CXE6+RhmDZ1EjKakait766HuaSmiZhfjfWIwdtfmcojU1oLYU/ireLA+xz@nongnu.org X-Gm-Message-State: AOJu0YypIO8iS90MLp0ef+q32uuFdFvV1SJJbBtnfK1OdJdN35WB/OA9 TbmcImidhNjyv3kkm8uTXz2/LAxoMmefgf4rkRvBKqKHwiwY6wRWmUAEVug2fQY= X-Gm-Gg: ASbGnctbokUfxcsJk/EKuPVPYBLEPNKExcBi1hyqyo86xEtHDmMsP+7rc4Meb8OLm2d K2ajdi13Oim/z4ICMgEEoKslD42eVlVrKI9oB211PE7vkzL2YkuPGBy1i8Nvu2s5n9UeatgiV8q 6vyWL0c+gc9yze283sf5F8o0E0P9o6mSDfzHmVvvYHfkhezmnu7sSCFY9HO5roPxbA2D4NMBRPj 2sJR0jcrQISk8DZ4/m4RzQs55hXBTKAg+M1RE1klN3IYL1QL3ax1k6IJMh0bFXyQy/EweZa35Mo 4LwXIH3/100bKSNPVi/G3JLDQ/6WmFhjYzqSht1KUQb/ffjV1KChgS97cNqJwXwMnjPE8XBdIxh WAPr5OJmH3DWYCVdzG3k= X-Received: by 2002:a05:6000:154d:b0:390:f025:9e85 with SMTP id ffacd0b85a97d-39979586dc7mr7784421f8f.21.1742582112507; Fri, 21 Mar 2025 11:35:12 -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-3997f99540bsm3013201f8f.2.2025.03.21.11.35.11 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 21 Mar 2025 11:35:11 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: Richard Henderson , qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Anton Johansson , Pierrick Bouvier , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH-for-10.1 v2 4/4] tcg: Convert TARGET_SUPPORTS_MTTCG to TCGCPUOps::mttcg_supported field Date: Fri, 21 Mar 2025 19:34:49 +0100 Message-ID: <20250321183450.3970-5-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250321183450.3970-1-philmd@linaro.org> References: <20250321183450.3970-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=philmd@linaro.org; helo=mail-wr1-x431.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 Instead of having a compile-time TARGET_SUPPORTS_MTTCG definition, have each target set the 'mttcg_supported' field in the TCGCPUOps structure. Since so far we only emulate one target architecture at a time, tcg_init_machine() gets whether MTTCG is supported via the &first_cpu global. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Anton Johansson Reviewed-by: Pierrick Bouvier --- docs/devel/multi-thread-tcg.rst | 2 +- configs/targets/aarch64-softmmu.mak | 1 - configs/targets/alpha-softmmu.mak | 1 - configs/targets/arm-softmmu.mak | 1 - configs/targets/hppa-softmmu.mak | 1 - configs/targets/i386-softmmu.mak | 1 - configs/targets/loongarch64-softmmu.mak | 1 - configs/targets/microblaze-softmmu.mak | 1 - configs/targets/microblazeel-softmmu.mak | 1 - configs/targets/mips-softmmu.mak | 1 - configs/targets/mipsel-softmmu.mak | 1 - configs/targets/or1k-softmmu.mak | 1 - configs/targets/ppc64-softmmu.mak | 1 - configs/targets/riscv32-softmmu.mak | 1 - configs/targets/riscv64-softmmu.mak | 1 - configs/targets/s390x-softmmu.mak | 1 - configs/targets/sparc-softmmu.mak | 1 - configs/targets/sparc64-softmmu.mak | 1 - configs/targets/x86_64-softmmu.mak | 1 - configs/targets/xtensa-softmmu.mak | 1 - configs/targets/xtensaeb-softmmu.mak | 1 - include/accel/tcg/cpu-ops.h | 8 ++++++++ include/exec/poison.h | 1 - accel/tcg/tcg-all.c | 7 ++----- target/alpha/cpu.c | 1 + target/arm/cpu.c | 1 + target/arm/tcg/cpu-v7m.c | 1 + target/avr/cpu.c | 1 + target/hexagon/cpu.c | 1 + target/hppa/cpu.c | 1 + target/i386/tcg/tcg-cpu.c | 1 + target/loongarch/cpu.c | 1 + target/m68k/cpu.c | 1 + target/microblaze/cpu.c | 1 + target/mips/cpu.c | 1 + target/openrisc/cpu.c | 1 + target/ppc/cpu_init.c | 1 + target/riscv/tcg/tcg-cpu.c | 1 + target/rx/cpu.c | 1 + target/s390x/cpu.c | 1 + target/sh4/cpu.c | 1 + target/sparc/cpu.c | 1 + target/tricore/cpu.c | 1 + target/xtensa/cpu.c | 1 + 44 files changed, 31 insertions(+), 27 deletions(-) diff --git a/docs/devel/multi-thread-tcg.rst b/docs/devel/multi-thread-tcg.rst index 14a2a9dc7b5..da9a1530c9f 100644 --- a/docs/devel/multi-thread-tcg.rst +++ b/docs/devel/multi-thread-tcg.rst @@ -30,7 +30,7 @@ user-space thread. This is enabled by default for all FE/BE combinations where the host memory model is able to accommodate the guest (TCGCPUOps::guest_default_memory_order & ~TCG_TARGET_DEFAULT_MO is zero) and the guest has had the required work done to support this safely -(TARGET_SUPPORTS_MTTCG). +(TCGCPUOps::mttcg_supported). System emulation will fall back to the original round robin approach if: diff --git a/configs/targets/aarch64-softmmu.mak b/configs/targets/aarch64-softmmu.mak index 82cb72cb83d..5dfeb35af90 100644 --- a/configs/targets/aarch64-softmmu.mak +++ b/configs/targets/aarch64-softmmu.mak @@ -1,6 +1,5 @@ TARGET_ARCH=aarch64 TARGET_BASE_ARCH=arm -TARGET_SUPPORTS_MTTCG=y TARGET_KVM_HAVE_GUEST_DEBUG=y TARGET_XML_FILES= gdb-xml/aarch64-core.xml gdb-xml/aarch64-fpu.xml gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-vfp3.xml gdb-xml/arm-vfp-sysregs.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-profile.xml gdb-xml/arm-m-profile-mve.xml gdb-xml/aarch64-pauth.xml # needed by boot.c diff --git a/configs/targets/alpha-softmmu.mak b/configs/targets/alpha-softmmu.mak index 89f3517aca0..5275076e50d 100644 --- a/configs/targets/alpha-softmmu.mak +++ b/configs/targets/alpha-softmmu.mak @@ -1,3 +1,2 @@ TARGET_ARCH=alpha -TARGET_SUPPORTS_MTTCG=y TARGET_LONG_BITS=64 diff --git a/configs/targets/arm-softmmu.mak b/configs/targets/arm-softmmu.mak index afc64f5927b..6a5a8eda949 100644 --- a/configs/targets/arm-softmmu.mak +++ b/configs/targets/arm-softmmu.mak @@ -1,5 +1,4 @@ TARGET_ARCH=arm -TARGET_SUPPORTS_MTTCG=y TARGET_XML_FILES= gdb-xml/arm-core.xml gdb-xml/arm-vfp.xml gdb-xml/arm-vfp3.xml gdb-xml/arm-vfp-sysregs.xml gdb-xml/arm-neon.xml gdb-xml/arm-m-profile.xml gdb-xml/arm-m-profile-mve.xml # needed by boot.c TARGET_NEED_FDT=y diff --git a/configs/targets/hppa-softmmu.mak b/configs/targets/hppa-softmmu.mak index 63ca74ed5e6..ea331107a08 100644 --- a/configs/targets/hppa-softmmu.mak +++ b/configs/targets/hppa-softmmu.mak @@ -1,4 +1,3 @@ TARGET_ARCH=hppa TARGET_BIG_ENDIAN=y -TARGET_SUPPORTS_MTTCG=y TARGET_LONG_BITS=64 diff --git a/configs/targets/i386-softmmu.mak b/configs/targets/i386-softmmu.mak index 5dd89217560..e9d89e8ab41 100644 --- a/configs/targets/i386-softmmu.mak +++ b/configs/targets/i386-softmmu.mak @@ -1,5 +1,4 @@ TARGET_ARCH=i386 -TARGET_SUPPORTS_MTTCG=y TARGET_KVM_HAVE_GUEST_DEBUG=y TARGET_KVM_HAVE_RESET_PARKED_VCPU=y TARGET_XML_FILES= gdb-xml/i386-32bit.xml diff --git a/configs/targets/loongarch64-softmmu.mak b/configs/targets/loongarch64-softmmu.mak index 351341132f6..fc44c54233d 100644 --- a/configs/targets/loongarch64-softmmu.mak +++ b/configs/targets/loongarch64-softmmu.mak @@ -1,7 +1,6 @@ TARGET_ARCH=loongarch64 TARGET_BASE_ARCH=loongarch TARGET_KVM_HAVE_GUEST_DEBUG=y -TARGET_SUPPORTS_MTTCG=y TARGET_XML_FILES= gdb-xml/loongarch-base32.xml gdb-xml/loongarch-base64.xml gdb-xml/loongarch-fpu.xml gdb-xml/loongarch-lsx.xml gdb-xml/loongarch-lasx.xml # all boards require libfdt TARGET_NEED_FDT=y diff --git a/configs/targets/microblaze-softmmu.mak b/configs/targets/microblaze-softmmu.mak index 99a33ed44a8..23457d0ae65 100644 --- a/configs/targets/microblaze-softmmu.mak +++ b/configs/targets/microblaze-softmmu.mak @@ -1,6 +1,5 @@ TARGET_ARCH=microblaze TARGET_BIG_ENDIAN=y -TARGET_SUPPORTS_MTTCG=y # needed by boot.c TARGET_NEED_FDT=y TARGET_XML_FILES=gdb-xml/microblaze-core.xml gdb-xml/microblaze-stack-protect.xml diff --git a/configs/targets/microblazeel-softmmu.mak b/configs/targets/microblazeel-softmmu.mak index 52cdeae1a28..c82c509623d 100644 --- a/configs/targets/microblazeel-softmmu.mak +++ b/configs/targets/microblazeel-softmmu.mak @@ -1,5 +1,4 @@ TARGET_ARCH=microblaze -TARGET_SUPPORTS_MTTCG=y # needed by boot.c TARGET_NEED_FDT=y TARGET_XML_FILES=gdb-xml/microblaze-core.xml gdb-xml/microblaze-stack-protect.xml diff --git a/configs/targets/mips-softmmu.mak b/configs/targets/mips-softmmu.mak index b62a0882499..c9588066b8d 100644 --- a/configs/targets/mips-softmmu.mak +++ b/configs/targets/mips-softmmu.mak @@ -1,4 +1,3 @@ TARGET_ARCH=mips TARGET_BIG_ENDIAN=y -TARGET_SUPPORTS_MTTCG=y TARGET_LONG_BITS=32 diff --git a/configs/targets/mipsel-softmmu.mak b/configs/targets/mipsel-softmmu.mak index 620ec681785..90e09bdc3e5 100644 --- a/configs/targets/mipsel-softmmu.mak +++ b/configs/targets/mipsel-softmmu.mak @@ -1,3 +1,2 @@ TARGET_ARCH=mips -TARGET_SUPPORTS_MTTCG=y TARGET_LONG_BITS=32 diff --git a/configs/targets/or1k-softmmu.mak b/configs/targets/or1k-softmmu.mak index adfddb1a8ac..0e47d9878b0 100644 --- a/configs/targets/or1k-softmmu.mak +++ b/configs/targets/or1k-softmmu.mak @@ -1,5 +1,4 @@ TARGET_ARCH=openrisc -TARGET_SUPPORTS_MTTCG=y TARGET_BIG_ENDIAN=y # needed by boot.c and all boards TARGET_NEED_FDT=y diff --git a/configs/targets/ppc64-softmmu.mak b/configs/targets/ppc64-softmmu.mak index 7cee0e97f43..74572864b36 100644 --- a/configs/targets/ppc64-softmmu.mak +++ b/configs/targets/ppc64-softmmu.mak @@ -1,7 +1,6 @@ TARGET_ARCH=ppc64 TARGET_BASE_ARCH=ppc TARGET_BIG_ENDIAN=y -TARGET_SUPPORTS_MTTCG=y TARGET_KVM_HAVE_GUEST_DEBUG=y TARGET_XML_FILES= gdb-xml/power64-core.xml gdb-xml/power-fpu.xml gdb-xml/power-altivec.xml gdb-xml/power-spe.xml gdb-xml/power-vsx.xml # all boards require libfdt diff --git a/configs/targets/riscv32-softmmu.mak b/configs/targets/riscv32-softmmu.mak index c828066ce6b..db55275b868 100644 --- a/configs/targets/riscv32-softmmu.mak +++ b/configs/targets/riscv32-softmmu.mak @@ -1,6 +1,5 @@ TARGET_ARCH=riscv32 TARGET_BASE_ARCH=riscv -TARGET_SUPPORTS_MTTCG=y TARGET_XML_FILES= gdb-xml/riscv-32bit-cpu.xml gdb-xml/riscv-32bit-fpu.xml gdb-xml/riscv-64bit-fpu.xml gdb-xml/riscv-32bit-virtual.xml # needed by boot.c TARGET_NEED_FDT=y diff --git a/configs/targets/riscv64-softmmu.mak b/configs/targets/riscv64-softmmu.mak index 09f613d24a0..2bdd4a62cd2 100644 --- a/configs/targets/riscv64-softmmu.mak +++ b/configs/targets/riscv64-softmmu.mak @@ -1,6 +1,5 @@ TARGET_ARCH=riscv64 TARGET_BASE_ARCH=riscv -TARGET_SUPPORTS_MTTCG=y TARGET_KVM_HAVE_GUEST_DEBUG=y TARGET_XML_FILES= gdb-xml/riscv-64bit-cpu.xml gdb-xml/riscv-32bit-fpu.xml gdb-xml/riscv-64bit-fpu.xml gdb-xml/riscv-64bit-virtual.xml gdb-xml/riscv-32bit-cpu.xml gdb-xml/riscv-32bit-virtual.xml # needed by boot.c diff --git a/configs/targets/s390x-softmmu.mak b/configs/targets/s390x-softmmu.mak index 5242ebe7c2e..76dd5de6584 100644 --- a/configs/targets/s390x-softmmu.mak +++ b/configs/targets/s390x-softmmu.mak @@ -1,6 +1,5 @@ TARGET_ARCH=s390x TARGET_BIG_ENDIAN=y -TARGET_SUPPORTS_MTTCG=y TARGET_KVM_HAVE_GUEST_DEBUG=y TARGET_XML_FILES= gdb-xml/s390x-core64.xml gdb-xml/s390-acr.xml gdb-xml/s390-fpr.xml gdb-xml/s390-vx.xml gdb-xml/s390-cr.xml gdb-xml/s390-virt.xml gdb-xml/s390-virt-kvm.xml gdb-xml/s390-gs.xml TARGET_LONG_BITS=64 diff --git a/configs/targets/sparc-softmmu.mak b/configs/targets/sparc-softmmu.mak index 78c2e25bd13..57801faf1fc 100644 --- a/configs/targets/sparc-softmmu.mak +++ b/configs/targets/sparc-softmmu.mak @@ -1,4 +1,3 @@ TARGET_ARCH=sparc TARGET_BIG_ENDIAN=y -TARGET_SUPPORTS_MTTCG=y TARGET_LONG_BITS=32 diff --git a/configs/targets/sparc64-softmmu.mak b/configs/targets/sparc64-softmmu.mak index f7bab97a002..2504e31ae33 100644 --- a/configs/targets/sparc64-softmmu.mak +++ b/configs/targets/sparc64-softmmu.mak @@ -1,5 +1,4 @@ TARGET_ARCH=sparc64 TARGET_BASE_ARCH=sparc TARGET_BIG_ENDIAN=y -TARGET_SUPPORTS_MTTCG=y TARGET_LONG_BITS=64 diff --git a/configs/targets/x86_64-softmmu.mak b/configs/targets/x86_64-softmmu.mak index 1ceefde1313..5619b2bc686 100644 --- a/configs/targets/x86_64-softmmu.mak +++ b/configs/targets/x86_64-softmmu.mak @@ -1,6 +1,5 @@ TARGET_ARCH=x86_64 TARGET_BASE_ARCH=i386 -TARGET_SUPPORTS_MTTCG=y TARGET_KVM_HAVE_GUEST_DEBUG=y TARGET_KVM_HAVE_RESET_PARKED_VCPU=y TARGET_XML_FILES= gdb-xml/i386-64bit.xml diff --git a/configs/targets/xtensa-softmmu.mak b/configs/targets/xtensa-softmmu.mak index 65845df4ffa..2a9797338a6 100644 --- a/configs/targets/xtensa-softmmu.mak +++ b/configs/targets/xtensa-softmmu.mak @@ -1,3 +1,2 @@ TARGET_ARCH=xtensa -TARGET_SUPPORTS_MTTCG=y TARGET_LONG_BITS=32 diff --git a/configs/targets/xtensaeb-softmmu.mak b/configs/targets/xtensaeb-softmmu.mak index f1f789d6971..5204729af8b 100644 --- a/configs/targets/xtensaeb-softmmu.mak +++ b/configs/targets/xtensaeb-softmmu.mak @@ -1,4 +1,3 @@ TARGET_ARCH=xtensa TARGET_BIG_ENDIAN=y -TARGET_SUPPORTS_MTTCG=y TARGET_LONG_BITS=32 diff --git a/include/accel/tcg/cpu-ops.h b/include/accel/tcg/cpu-ops.h index 5fd299cefb6..31e63b8a663 100644 --- a/include/accel/tcg/cpu-ops.h +++ b/include/accel/tcg/cpu-ops.h @@ -19,6 +19,14 @@ #include "tcg/tcg-mo.h" struct TCGCPUOps { + /** + * mttcg_supported: multi-threaded TCG is supported + * + * Target (TCG frontend) supports: + * - atomic instructions + * - memory ordering primitives (barriers) + */ + bool mttcg_supported; /** * @guest_default_memory_order: default barrier that is required diff --git a/include/exec/poison.h b/include/exec/poison.h index 8ed04b31083..6df627868c6 100644 --- a/include/exec/poison.h +++ b/include/exec/poison.h @@ -35,7 +35,6 @@ #pragma GCC poison TARGET_HAS_BFLT #pragma GCC poison TARGET_NAME -#pragma GCC poison TARGET_SUPPORTS_MTTCG #pragma GCC poison TARGET_BIG_ENDIAN #pragma GCC poison BSWAP_NEEDED diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c index f83f9b9d79e..18577148c19 100644 --- a/accel/tcg/tcg-all.c +++ b/accel/tcg/tcg-all.c @@ -41,6 +41,7 @@ #include "hw/boards.h" #include "system/tcg.h" #endif +#include "accel/tcg/cpu-ops.h" #include "internal-common.h" #include "cpu-param.h" @@ -91,11 +92,7 @@ static int tcg_init_machine(MachineState *ms) #else unsigned max_cpus = ms->smp.max_cpus; #endif -#ifdef TARGET_SUPPORTS_MTTCG - bool mttcg_supported = true; -#else - bool mttcg_supported = false; -#endif + bool mttcg_supported = first_cpu->cc->tcg_ops->mttcg_supported; /* FIXME avoid first_cpu */ tcg_allowed = true; diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c index e5e14976f51..2bad59a48a4 100644 --- a/target/alpha/cpu.c +++ b/target/alpha/cpu.c @@ -239,6 +239,7 @@ static const TCGCPUOps alpha_tcg_ops = { .synchronize_from_tb = alpha_cpu_synchronize_from_tb, .restore_state_to_opc = alpha_restore_state_to_opc, + .mttcg_supported = true, /* Alpha processors have a weak memory model */ .guest_default_memory_order = 0, diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 8b9f2acf82b..a332d9a5148 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -2675,6 +2675,7 @@ static const TCGCPUOps arm_tcg_ops = { .debug_excp_handler = arm_debug_excp_handler, .restore_state_to_opc = arm_restore_state_to_opc, + .mttcg_supported = true, /* ARM processors have a weak memory model */ .guest_default_memory_order = 0, diff --git a/target/arm/tcg/cpu-v7m.c b/target/arm/tcg/cpu-v7m.c index df6b7198944..7069a7a2ca8 100644 --- a/target/arm/tcg/cpu-v7m.c +++ b/target/arm/tcg/cpu-v7m.c @@ -238,6 +238,7 @@ static const TCGCPUOps arm_v7m_tcg_ops = { .debug_excp_handler = arm_debug_excp_handler, .restore_state_to_opc = arm_restore_state_to_opc, + .mttcg_supported = true, /* ARM processors have a weak memory model */ .guest_default_memory_order = 0, diff --git a/target/avr/cpu.c b/target/avr/cpu.c index 24e52e28f44..9bc921c1cb2 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, + .mttcg_supported = false, .guest_default_memory_order = 0, }; diff --git a/target/hexagon/cpu.c b/target/hexagon/cpu.c index 34734b0edb0..7bcf297998f 100644 --- a/target/hexagon/cpu.c +++ b/target/hexagon/cpu.c @@ -324,6 +324,7 @@ 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_supported = false, /* MTTCG not yet supported: require strict ordering */ .guest_default_memory_order = TCG_MO_ALL, }; diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c index 997bd69db19..31f29a95ac0 100644 --- a/target/hppa/cpu.c +++ b/target/hppa/cpu.c @@ -257,6 +257,7 @@ static const TCGCPUOps hppa_tcg_ops = { .synchronize_from_tb = hppa_cpu_synchronize_from_tb, .restore_state_to_opc = hppa_restore_state_to_opc, + .mttcg_supported = true, /* PA-RISC 1.x processors have a strong memory model. */ /* * ??? While we do not yet implement PA-RISC 2.0, those processors have diff --git a/target/i386/tcg/tcg-cpu.c b/target/i386/tcg/tcg-cpu.c index 4a76c475971..62d36880ceb 100644 --- a/target/i386/tcg/tcg-cpu.c +++ b/target/i386/tcg/tcg-cpu.c @@ -129,6 +129,7 @@ static const TCGCPUOps x86_tcg_ops = { .need_replay_interrupt = x86_need_replay_interrupt, #endif /* !CONFIG_USER_ONLY */ + .mttcg_supported = true, /* * The x86 has a strong memory model with some store-after-load re-ordering */ diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c index c39ff056157..460d05b1ee5 100644 --- a/target/loongarch/cpu.c +++ b/target/loongarch/cpu.c @@ -869,6 +869,7 @@ static const TCGCPUOps loongarch_tcg_ops = { .synchronize_from_tb = loongarch_cpu_synchronize_from_tb, .restore_state_to_opc = loongarch_restore_state_to_opc, + .mttcg_supported = true, .guest_default_memory_order = 0, #ifndef CONFIG_USER_ONLY diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c index e96b379e266..4c94f031b13 100644 --- a/target/m68k/cpu.c +++ b/target/m68k/cpu.c @@ -593,6 +593,7 @@ static const TCGCPUOps m68k_tcg_ops = { .translate_code = m68k_translate_code, .restore_state_to_opc = m68k_restore_state_to_opc, + .mttcg_supported = false, /* MTTCG not yet supported: require strict ordering */ .guest_default_memory_order = TCG_MO_ALL, diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c index 4b9ef6e52c4..5604c2a34a0 100644 --- a/target/microblaze/cpu.c +++ b/target/microblaze/cpu.c @@ -432,6 +432,7 @@ static const TCGCPUOps mb_tcg_ops = { .synchronize_from_tb = mb_cpu_synchronize_from_tb, .restore_state_to_opc = mb_restore_state_to_opc, + .mttcg_supported = true, /* MicroBlaze is always in-order. */ .guest_default_memory_order = TCG_MO_ALL, diff --git a/target/mips/cpu.c b/target/mips/cpu.c index 5ddc9bbb829..eee604e9254 100644 --- a/target/mips/cpu.c +++ b/target/mips/cpu.c @@ -554,6 +554,7 @@ static const TCGCPUOps mips_tcg_ops = { .synchronize_from_tb = mips_cpu_synchronize_from_tb, .restore_state_to_opc = mips_restore_state_to_opc, + .mttcg_supported = TARGET_LONG_BITS == 32, .guest_default_memory_order = 0, #if !defined(CONFIG_USER_ONLY) diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c index 6a878aaadd8..1a6ca405a0c 100644 --- a/target/openrisc/cpu.c +++ b/target/openrisc/cpu.c @@ -248,6 +248,7 @@ static const TCGCPUOps openrisc_tcg_ops = { .synchronize_from_tb = openrisc_cpu_synchronize_from_tb, .restore_state_to_opc = openrisc_restore_state_to_opc, + .mttcg_supported = true, .guest_default_memory_order = 0, #ifndef CONFIG_USER_ONLY diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c index 28fbbb8d3c1..ed79cc1a6b7 100644 --- a/target/ppc/cpu_init.c +++ b/target/ppc/cpu_init.c @@ -7490,6 +7490,7 @@ static const TCGCPUOps ppc_tcg_ops = { .translate_code = ppc_translate_code, .restore_state_to_opc = ppc_restore_state_to_opc, + .mttcg_supported = TARGET_LONG_BITS == 64, .guest_default_memory_order = 0, #ifdef CONFIG_USER_ONLY diff --git a/target/riscv/tcg/tcg-cpu.c b/target/riscv/tcg/tcg-cpu.c index 5ccd7b9dc07..f26cfae6cdb 100644 --- a/target/riscv/tcg/tcg-cpu.c +++ b/target/riscv/tcg/tcg-cpu.c @@ -140,6 +140,7 @@ static const TCGCPUOps riscv_tcg_ops = { .synchronize_from_tb = riscv_cpu_synchronize_from_tb, .restore_state_to_opc = riscv_restore_state_to_opc, + .mttcg_supported = true, .guest_default_memory_order = 0, #ifndef CONFIG_USER_ONLY diff --git a/target/rx/cpu.c b/target/rx/cpu.c index 6a24e7e9136..4bcbc22d3ad 100644 --- a/target/rx/cpu.c +++ b/target/rx/cpu.c @@ -213,6 +213,7 @@ static const TCGCPUOps rx_tcg_ops = { .cpu_exec_halt = rx_cpu_has_work, .do_interrupt = rx_cpu_do_interrupt, + .mttcg_supported = false, /* MTTCG not yet supported: require strict ordering */ .guest_default_memory_order = TCG_MO_ALL, }; diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index 12fd853c00a..7ca34002d37 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -361,6 +361,7 @@ static const TCGCPUOps s390_tcg_ops = { .do_unaligned_access = s390x_cpu_do_unaligned_access, #endif /* !CONFIG_USER_ONLY */ + .mttcg_supported = true, /* * The z/Architecture has a strong memory model with some * store-after-load re-ordering. diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c index ce9ed75107a..b796bac8afd 100644 --- a/target/sh4/cpu.c +++ b/target/sh4/cpu.c @@ -267,6 +267,7 @@ static const TCGCPUOps superh_tcg_ops = { .synchronize_from_tb = superh_cpu_synchronize_from_tb, .restore_state_to_opc = superh_restore_state_to_opc, + .mttcg_supported = false, /* MTTCG not yet supported: require strict ordering */ .guest_default_memory_order = TCG_MO_ALL, diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index 39bd0c42855..2ae7173c0bc 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -1005,6 +1005,7 @@ static const TCGCPUOps sparc_tcg_ops = { .synchronize_from_tb = sparc_cpu_synchronize_from_tb, .restore_state_to_opc = sparc_restore_state_to_opc, + .mttcg_supported = true, /* * From Oracle SPARC Architecture 2015: * diff --git a/target/tricore/cpu.c b/target/tricore/cpu.c index e0a48065948..aea1f211516 100644 --- a/target/tricore/cpu.c +++ b/target/tricore/cpu.c @@ -179,6 +179,7 @@ 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_supported = false, /* MTTCG not yet supported: require strict ordering */ .guest_default_memory_order = TCG_MO_ALL, }; diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c index dd9061ba469..8cc987f8408 100644 --- a/target/xtensa/cpu.c +++ b/target/xtensa/cpu.c @@ -237,6 +237,7 @@ static const TCGCPUOps xtensa_tcg_ops = { .debug_excp_handler = xtensa_breakpoint_handler, .restore_state_to_opc = xtensa_restore_state_to_opc, + .mttcg_supported = true, /* Xtensa processors have a weak memory model */ .guest_default_memory_order = 0,