From patchwork Sun Apr 28 22:14:27 2024 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: 792923 Delivered-To: patch@linaro.org Received: by 2002:adf:cc13:0:b0:346:15ad:a2a with SMTP id x19csp1423482wrh; Sun, 28 Apr 2024 15:16:05 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXRD7D6jYnlClGxa2Rkr68Q1AHxwSJYYU4B+EPJrcAMJQLG+EnK7NA4KZk30aH0cIf2+UnLkPw+3PR1jqzdLRaU X-Google-Smtp-Source: AGHT+IFm1qlezGPesd4LWaLpfgVVgMnwULq3gyy4LaaPXPT8xWAeUjfl9zzO5HW9DGyWrNSOehuC X-Received: by 2002:a05:622a:1811:b0:43a:e984:81b with SMTP id t17-20020a05622a181100b0043ae984081bmr1514765qtc.8.1714342565568; Sun, 28 Apr 2024 15:16:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714342565; cv=none; d=google.com; s=arc-20160816; b=Q9Papsg66bthSFw8D/rioVhJ6qLFGNbxMiM7TLWvwasfhbgQKgSa88OwYuF0fKFI6n NW/x2yxcOGCQpa6Nm0q+U/OkyaygvvlkebDEKrUKTmM9MBaZFrVHCjhyrmQzD1xQATWD CGN4OZmnhg1GQbbrulaaYWGuqh7TltgYJvyXFjb0DpDxn1N05HJjBMGbxtdljfj2qBnP lV94LG/3+3doOQuGja+BM5va+j1yN+QFcTe0FZ7RFnrwOPd80OL+s/Yc+Hr4xOCqjrbK hRcP+i9Wsh3/Nqfvj8OyPxzuGE9KEL4280jLzPrWMkCDTnaI6ohTyznCvc/xGEx9SS9E /xGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=Rnpe0rzeTKHAYN20E0T7xpdwaTDLO7bZVPKy5KYEFKE=; fh=+kTJNlX4d/Ktp/5WO5d77IkVGYcQ7tiev+NqB54rN/Q=; b=QrBUV7B5KHd0A+EV/en5Iqwf+kp4H13dgtr0Ro+bEmEyaNzsiuVUDTkiWdzkoDYCEv Y83uT7o39Ya5tok7uiW4R1Da6hfexPi71C3kBwuzh46B/hRnLNoiXye6FIS14NK9vYQg iFupmFf2l/QIxepXFBlXfpzOJW+N+ka0tlRrYh1xFtR5ULmghhpLOyq5NoS9MQD2kf7Q ebhnr498BuBTozzD/bmVw+dIQ640ZVaSvrj0RbEbvrd73zWYXiK3sIfMnwLHV4cA4o3c 6V8rZCmLSKDveiVF/ulkzZH9lvewSmmFtkjvvR+g0LtLRyvmOfYwaLN8xP5BqTmyHgsC bXuw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pFpi7ltF; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ex11-20020a05622a518b00b0043a668cb055si8440166qtb.183.2024.04.28.15.16.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Apr 2024 15:16:05 -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=pFpi7ltF; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s1Cnm-0005uP-6H; Sun, 28 Apr 2024 18:15:18 -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 1s1CnY-0005sr-6K for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:15:07 -0400 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s1CnV-0005JA-Ib for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:15:03 -0400 Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-56e1baf0380so4781887a12.3 for ; Sun, 28 Apr 2024 15:15:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714342499; x=1714947299; 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=Rnpe0rzeTKHAYN20E0T7xpdwaTDLO7bZVPKy5KYEFKE=; b=pFpi7ltFCaGsfWZJQzF2PuegYqBVbdG3Ho//XCbh1BZKdqDd1bT+3oFHHMMiGGJVcE 8oMz5UQypZhLOki/FGamnKvNH67M56sz+YvKSgLycBtCMYa/cOiuGIrzCfVJ4fgT47hn JLoseqMGwoJZepsGE8pVAp9iGRXUMVvsPPu1RbB9BB8uhk2lPx5jUK+kAcYEe0hcWvuQ sqL4Gpu81LNaeHpUOqEnr87kFvfYDnS7wyKZVgvqe9AcWbVKNXPzznA2quVznwN9G9Xl JJn2WMtEtTIWtqt+Wa8UnjVZgQeX16l6UZMnbHlvPnrBxlt98VtGf56160Ik6BLwmcUN gZ/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714342499; x=1714947299; 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=Rnpe0rzeTKHAYN20E0T7xpdwaTDLO7bZVPKy5KYEFKE=; b=nGd+WxacJNaMKSv5A7/Sz8p/RuIB6wwHtAFT6PnUSt1ziw+seetXO97Ni91EAtGWvR d4wRVb+Tbut5fIczyYwRmO5VHjFVJj2iurUJIh/p5JEWd+gEMYw9CisFA27i6G+DUzuD oc+ImKC10rKjq9Onee/ySGn37jXJW1MaLtK1fnB7NIQK2WZh/BxqaLCTpjbGAtmBrS2B GeNt6VB1mVrZLwfW5ztZTcXknX5+591PUPyazfSscqMsOM0Sk+4Cnp77ZpCnFvFLWdiA I9X/e81kLNr4GxmC+p+0QsShrfKuRZJhxuDyC2r2pjiUqMqK4n1HBET4Hey2+LtjlYTF tXLQ== X-Gm-Message-State: AOJu0Yw+Gx/GXNP3fPKu6JqJ/MBsUPeFBvUzo+Kb9xBA8N7GoUItMadw JMnGZLrtYWrzMp9r3OwZxNYKf7ldlrLBMulxOBIbpnfhKThBx+J6gJG4NpvLbiCZFa8mQpXY04v X X-Received: by 2002:a50:c056:0:b0:572:7ea0:66ca with SMTP id u22-20020a50c056000000b005727ea066camr1119043edd.36.1714342498614; Sun, 28 Apr 2024 15:14:58 -0700 (PDT) Received: from m1x-phil.lan ([176.176.142.130]) by smtp.gmail.com with ESMTPSA id c7-20020a0564021f8700b0057000ecadb0sm12458847edc.8.2024.04.28.15.14.57 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 28 Apr 2024 15:14:58 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Anton Johansson , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 01/24] exec/user: Move 'thunk.h' from 'exec/user' to 'user' Date: Mon, 29 Apr 2024 00:14:27 +0200 Message-ID: <20240428221450.26460-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240428221450.26460-1-philmd@linaro.org> References: <20240428221450.26460-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::529; envelope-from=philmd@linaro.org; helo=mail-ed1-x529.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 Keep all user emulation headers under the same user/ directory. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- bsd-user/qemu.h | 2 +- include/{exec => }/user/thunk.h | 8 ++++++-- linux-user/user-internals.h | 2 +- linux-user/thunk.c | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) rename include/{exec => }/user/thunk.h (97%) diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index 63ee07d534..e562adde65 100644 --- a/bsd-user/qemu.h +++ b/bsd-user/qemu.h @@ -26,7 +26,7 @@ extern char **environ; -#include "exec/user/thunk.h" +#include "user/thunk.h" #include "target_arch.h" #include "syscall_defs.h" #include "target_syscall.h" diff --git a/include/exec/user/thunk.h b/include/user/thunk.h similarity index 97% rename from include/exec/user/thunk.h rename to include/user/thunk.h index 2ebfecf58e..b97def8d53 100644 --- a/include/exec/user/thunk.h +++ b/include/user/thunk.h @@ -17,8 +17,12 @@ * License along with this library; if not, see . */ -#ifndef THUNK_H -#define THUNK_H +#ifndef USER_THUNK_H +#define USER_THUNK_H + +#ifndef CONFIG_USER_ONLY +#error Cannot include this header from system emulation +#endif #include "cpu.h" #include "exec/user/abitypes.h" diff --git a/linux-user/user-internals.h b/linux-user/user-internals.h index ce11d9e21c..5c7f173ceb 100644 --- a/linux-user/user-internals.h +++ b/linux-user/user-internals.h @@ -18,7 +18,7 @@ #ifndef LINUX_USER_USER_INTERNALS_H #define LINUX_USER_USER_INTERNALS_H -#include "exec/user/thunk.h" +#include "user/thunk.h" #include "exec/exec-all.h" #include "exec/tb-flush.h" #include "qemu/log.h" diff --git a/linux-user/thunk.c b/linux-user/thunk.c index 071aad4b5f..3cd19e79c6 100644 --- a/linux-user/thunk.c +++ b/linux-user/thunk.c @@ -20,7 +20,7 @@ #include "qemu/log.h" #include "qemu.h" -#include "exec/user/thunk.h" +#include "user/thunk.h" //#define DEBUG From patchwork Sun Apr 28 22:14:28 2024 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: 792937 Delivered-To: patch@linaro.org Received: by 2002:adf:cc13:0:b0:346:15ad:a2a with SMTP id x19csp1423958wrh; Sun, 28 Apr 2024 15:17:57 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXjPjvlt/vy6v1h+DzfqKYUTHT0s6G/cOju3nLj2Qc1JaS+7ivmn8kRBv4cvJf3DMBYXuMzuq2ZGTcPj5JlktwA X-Google-Smtp-Source: AGHT+IGiRXBetoZcu722zlhaf8vr48550cYshzt11L7al/hYMEOu3+xrhCW0fHZNdhvI16lRTKFG X-Received: by 2002:a05:622a:1392:b0:43a:f821:5a8d with SMTP id o18-20020a05622a139200b0043af8215a8dmr479259qtk.9.1714342677637; Sun, 28 Apr 2024 15:17:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714342677; cv=none; d=google.com; s=arc-20160816; b=eEvqUkDGtPqpmrtlllmuWrFDuyJoVYL5m836Q/Bskp59E3OlTDexLawT156Vj9zZMu TVkDtZvnEZxp99h0ZiqH+5uL/zk9P18ALUenZgiFdyN31zZWb8OjvrusGquMtH+Y1k0q E+YpqMpfGRwWgdo1jUha90tDWS1nReWeiBnLNrMrm1YrecP8yQ80McbhTAuDXyHObjt+ nYzuvuidrVvKXloI99+oWQzM3HCVpidgHWBwp7MzDQaZndfiEIl/wr0vAROjPu2paxKk OuaXsFkvurmhaBZKD7fzQ1e9GotWuUllF2xHSy/EMo9RU9QW2hOAxtQHCWM6qR4vlnw5 TQWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=LCSb64QUO6bStXSl37yEjpM4xadVVio6bpX5EBZUn28=; fh=+kTJNlX4d/Ktp/5WO5d77IkVGYcQ7tiev+NqB54rN/Q=; b=OKIoA+u52Y/72qTX0P5FinkLAs/T6bSwnV/3fi4hTJ/zy2WCbczV5URmt/FNQSVlXL iGOx8M0mycTC+r3hKKb74TJMpDYcmY0AyObaJmN4h9fHnxu7Hwm9qy74SdP7EjDfpxTi CE3p9d7oYpk2POhzbFI7HkOtnxaP6Exqh//dGcOkuwd2FaM1nNJSN/wI1KfmvDhqg0xB 5oJWjG9m97614agX8U9FNtK90xZnK+qi8FVlZTZvCThPxB5Stcman656rIJbS55sxIYu xhOhDHUAZYVtnn7FPrsshnLYlLrSm4vKemfYLhIq2J1C6SBGoxtXHc+jYJamqwXp6G/l 3QuA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=byFahhmL; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u19-20020a05622a199300b0043ac8615dbasi2560650qtc.407.2024.04.28.15.17.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Apr 2024 15:17:57 -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=byFahhmL; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s1Cnm-0005ub-Dd; Sun, 28 Apr 2024 18:15:18 -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 1s1Cnc-0005tL-50 for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:15:13 -0400 Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s1Cna-0005UD-7R for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:15:07 -0400 Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-51967f75729so4451556e87.0 for ; Sun, 28 Apr 2024 15:15:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714342504; x=1714947304; 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=LCSb64QUO6bStXSl37yEjpM4xadVVio6bpX5EBZUn28=; b=byFahhmLXmvc8mW1hPRycUEzGe/axojwrkT8Mj7SGhZTGFNBAYhp3QmS65bjtqDMAb MHi8d6MEDmchk3SkmHEtlglngmD0Wj97BZSzTWL8BkfVzgJjKAt7oofx4GdR0bXQYUQU 2ujzKk9APcjgTn9u3HJhL+3H/i/5V13yqvDbUTpp3P//UO/YiLbztdyJJZi/LB1pInXy kmAAfqqQfcvytqi4LI5Z7PLfFEq4oi8Xl9G/2/tN+JHe8jxVyLjVlLlyg4RA8VDCwy9Q +emYvXEtE7arAjCZlBXv3+VHOluNpoWiT4C/4kt0O4G6tLf/Q4Kq1ooU7/PYibK/BK12 uKQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714342504; x=1714947304; 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=LCSb64QUO6bStXSl37yEjpM4xadVVio6bpX5EBZUn28=; b=CWPCB3J6X7l2UAP6OAyPdh5pzy0pzCJQMbh1uw/KhyHYzO2fybe6m1HyELZKVKnBym PwgDkVDdbRm+t7J7YiAgll+e6WK2WvV2mhw0Otj3IMDF0wpikDokRDBWJS7uPwHlsGre IBagFp6ZPuFEeeTya2vkc7sH/l2rE9+/l0w432lctJZtbp0aOAkKmC3Uu38/b2Q6mscX Q3MvoXmoSE5TsJ3fYtDDX3igyBoLjGuGfQWV/wWPglqZ8tBuY0F8qoyQAMjLH9pwm7re kIRWd0qK4sHtoA1uiR2QzlfhOkvHvLI3C18eTX1WHDuL8p6ssmSFwTegRZXtLJBZYrPo tdqA== X-Gm-Message-State: AOJu0YzFQ/Oy6f5GlfFse+vI/oTuveCQ1T5tosYxsph+gtHILravfIm3 2rRgFXxjIHl9abvCPRIP70n8Uglbjbz8wmMuTz6WVRC3mGQ5ExrAqY3BFMX3jOsngo0JYEZSkYB p X-Received: by 2002:a19:7508:0:b0:51b:ac8d:3ba3 with SMTP id y8-20020a197508000000b0051bac8d3ba3mr4962843lfe.19.1714342504019; Sun, 28 Apr 2024 15:15:04 -0700 (PDT) Received: from m1x-phil.lan ([176.176.142.130]) by smtp.gmail.com with ESMTPSA id z12-20020a170906270c00b00a55895c7f50sm11648411ejc.151.2024.04.28.15.15.02 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 28 Apr 2024 15:15:03 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Anton Johansson , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 02/24] coverity: Update user emulation regexp Date: Mon, 29 Apr 2024 00:14:28 +0200 Message-ID: <20240428221450.26460-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240428221450.26460-1-philmd@linaro.org> References: <20240428221450.26460-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::129; envelope-from=philmd@linaro.org; helo=mail-lf1-x129.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 All user emulation headers are now under include/user/. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- scripts/coverity-scan/COMPONENTS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/coverity-scan/COMPONENTS.md b/scripts/coverity-scan/COMPONENTS.md index 91be8d1c36..1537e49cd5 100644 --- a/scripts/coverity-scan/COMPONENTS.md +++ b/scripts/coverity-scan/COMPONENTS.md @@ -121,7 +121,7 @@ usb ~ (/qemu)?(/hw/usb/.*|/include/hw/usb/.*) user - ~ (/qemu)?(/linux-user/.*|/bsd-user/.*|/user-exec\.c|/thunk\.c|/include/exec/user/.*) + ~ (/qemu)?(/linux-user/.*|/bsd-user/.*|/user-exec\.c|/thunk\.c|/include/user/.*) util ~ (/qemu)?(/util/.*|/include/qemu/.*) From patchwork Sun Apr 28 22:14:29 2024 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: 792919 Delivered-To: patch@linaro.org Received: by 2002:adf:cc13:0:b0:346:15ad:a2a with SMTP id x19csp1423433wrh; Sun, 28 Apr 2024 15:15:53 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUuYuuwwULuMXFURXPeX4GgGMvDvQrL0zLF3fGL/nF2RvlCuBgas0orwEHi4UWGOt1fH+e7jBv7Khxz5BNhcyJJ X-Google-Smtp-Source: AGHT+IFFqDmiAKb+ptSyOmuwd1iiAubDbt39X+uMoJfLk9Q0XLLmtV09sX8vSK9BCnqop2EIrEQo X-Received: by 2002:a05:6358:2c83:b0:186:249a:c8de with SMTP id l3-20020a0563582c8300b00186249ac8demr9831932rwm.5.1714342552788; Sun, 28 Apr 2024 15:15:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714342552; cv=none; d=google.com; s=arc-20160816; b=vZhYghnZ9JmQeejNfFcU03sQBtw0dKcBewBkukalKnSzj54vcV7fMdpkazQnk1ydRo roYaXkd6Sdm8P6lZEcgQUoK6AQCOxQd0RrigEMPwrR7GJYV5BaoY/UvMJfMuDmEkBqDL IB51O+PzjN8KS9X/z/KsFE+8f0m7HarWxIYYexvfwzWpISOFDTkDkc+ujoQDKzgrkah6 evv+an3dLIlGTOVpiwzIzZhWaXAG6pWRRjkHj98FOLTTQppOuLES79MRkf5rHegGUuT/ BHhdSz2X844q6MLhNzy5vqukaqTIxPrDp7asUS6jLv6KPydt493zmpoz4TCXsOw/AuhF kEeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=EC394qSuW4mbz7HKeTozfqIySzPWTIg+XxWvBDEtDQ0=; fh=+kTJNlX4d/Ktp/5WO5d77IkVGYcQ7tiev+NqB54rN/Q=; b=D9oHek6HAXX1oz0T213GBpdc3Y3yXK5QEaRZFcD9DWh+4UOhKP17NSMEWIQG66GXHd 3l6N3FGi5AADhU4YErsdbfyygeMw+7neAaO+BgfDQG+47xpTTZSd8/ZgYkAgvq5AIQ5g Xg0mhwHKvMj+PV4iqIvKk2N5QQ/j75DEFc0LbGbJxwIbAD/3pYUB800k0MMzsLjCb7IH +qxz6Tz6jIbCmFfo/K03LgDA1IZDrpmk+A/cx3Imyxl6Xb+jMZIb1YvDXy4IFF4SDmZp Rvfll4Eu0HCRlVVWYuzXwcRmha0N9fIkC1lYK/xzCfTHeex8WlQBAKJlUwZOl0u+E2hx 8A+g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TGhJZcce; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id fv27-20020a05622a4a1b00b00439755df2d0si21378831qtb.620.2024.04.28.15.15.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Apr 2024 15:15:52 -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=TGhJZcce; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s1Cnm-0005ug-Qt; Sun, 28 Apr 2024 18:15:18 -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 1s1Cni-0005tf-GY for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:15:15 -0400 Received: from mail-lf1-x12c.google.com ([2a00:1450:4864:20::12c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s1Cng-0005Ul-Mj for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:15:14 -0400 Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-516d4d80d00so4881409e87.0 for ; Sun, 28 Apr 2024 15:15:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714342509; x=1714947309; 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=EC394qSuW4mbz7HKeTozfqIySzPWTIg+XxWvBDEtDQ0=; b=TGhJZcceXRQ6GrFka5EFRsFF3/gwKlkQPugCLG/NT/cXvmFwBI6J3VVjwFti5PU/t2 lSfSDSC1+WOUcIfZId5NtwSrMin1a20CmX6sahHVR//wNWmpNJpChDjUebFLrVrJmHmv e4QNw99KXpZb8IqID65aRgmFu4r+zZfOzYJuOIGyqGdVcnJXo9mfB8NOc2DaR6Ioyc32 AkwQr1hxLTod22KShMY3N1Iaux6YtH22vDUwFknUo1uC/MwwRGQJJ+8OeXkItNcTN6Wm 1XdVkGafy1n/BrPHlsdsy72LOkgw9AVt7Am/a3p/5agP1NUAZSDKv/lwRYLGjcymPgJi WMaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714342509; x=1714947309; 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=EC394qSuW4mbz7HKeTozfqIySzPWTIg+XxWvBDEtDQ0=; b=flVICcaZh36qiICKarBAI2shQwpkSiA2H//QkZISW0TnYsiTUaTCpCW2Fx/QaQ5C3G Bwf0F4nk2JohMrpdQlYD1mJJ5ZcSRVKBqRCl1y78zSn5hYRpFzXB6FnGlTanPh8jKI35 XCEGnh6pPmPksCejEUoyV5Qpfv4UjxzfTJtdEKjOwpQxBBgaUaF9yg3jWZX09elUoDkh OWZPkpXLiw4BisRo3h0XgPN02FQU2VxHQwvA9SsadhzdXFNjtsfiH+SXxrlHX/Ki2yCX 9BS3/JayEh+xGimcJLtzKcjwYO0Z7vw3BoCpYIGqpSiGSwL3eauP22iK+c6p3o3Zetra d8TQ== X-Gm-Message-State: AOJu0YyzFDZ84iszfSHfaQLTNAWNyHfEI/zZWyrtFTndBAgfe5Yc6fUy +CUCNtylsjzlRXuLbRFF6/kpAYxbOYKbBnYA0kxV4b9NHkymBt9rRRJ1YUDJ0IQUKd47pv3msAY 6 X-Received: by 2002:a05:6512:3983:b0:518:d5c5:7276 with SMTP id j3-20020a056512398300b00518d5c57276mr6961240lfu.58.1714342509485; Sun, 28 Apr 2024 15:15:09 -0700 (PDT) Received: from m1x-phil.lan ([176.176.142.130]) by smtp.gmail.com with ESMTPSA id i21-20020a170906091500b00a5216df5d25sm13117569ejd.3.2024.04.28.15.15.08 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 28 Apr 2024 15:15:09 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Anton Johansson , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 03/24] accel/tcg: Move user definition of cpu_interrupt() to user-exec.c Date: Mon, 29 Apr 2024 00:14:29 +0200 Message-ID: <20240428221450.26460-4-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240428221450.26460-1-philmd@linaro.org> References: <20240428221450.26460-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12c; envelope-from=philmd@linaro.org; helo=mail-lf1-x12c.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 Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- accel/tcg/translate-all.c | 9 --------- accel/tcg/user-exec.c | 8 ++++++++ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 83cc14fbde..fdf6d8ac19 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -644,15 +644,6 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr) cpu_loop_exit_noexc(cpu); } -#else /* CONFIG_USER_ONLY */ - -void cpu_interrupt(CPUState *cpu, int mask) -{ - g_assert(bql_locked()); - cpu->interrupt_request |= mask; - qatomic_set(&cpu->neg.icount_decr.u16.high, -1); -} - #endif /* CONFIG_USER_ONLY */ /* diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c index ca27746fe4..f49435df9d 100644 --- a/accel/tcg/user-exec.c +++ b/accel/tcg/user-exec.c @@ -24,6 +24,7 @@ #include "qemu/bitops.h" #include "qemu/rcu.h" #include "exec/cpu_ldst.h" +#include "qemu/main-loop.h" #include "exec/translate-all.h" #include "exec/page-protection.h" #include "exec/helper-proto.h" @@ -38,6 +39,13 @@ __thread uintptr_t helper_retaddr; //#define DEBUG_SIGNAL +void cpu_interrupt(CPUState *cpu, int mask) +{ + g_assert(bql_locked()); + cpu->interrupt_request |= mask; + qatomic_set(&cpu->neg.icount_decr.u16.high, -1); +} + /* * Adjust the pc to pass to cpu_restore_state; return the memop type. */ From patchwork Sun Apr 28 22:14:30 2024 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: 792920 Delivered-To: patch@linaro.org Received: by 2002:adf:cc13:0:b0:346:15ad:a2a with SMTP id x19csp1423461wrh; Sun, 28 Apr 2024 15:16:01 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVxU6Ly1cslmokbhG4u1QIJFUa5rISXRqJMq+x7hi4AFO7FEghuBr3BdDf9s7T35918g6kcc8aXsoIBrCXxaJme X-Google-Smtp-Source: AGHT+IFAoj+5w+MWGXwmLVp/ib6LMHWo2Bs8uP6cCg6zK58QDdnDK/EKBHFwHzgf16tgnOdnIQLn X-Received: by 2002:a05:6214:c67:b0:6a0:ca29:1954 with SMTP id t7-20020a0562140c6700b006a0ca291954mr2774220qvj.46.1714342561639; Sun, 28 Apr 2024 15:16:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714342561; cv=none; d=google.com; s=arc-20160816; b=wo3xMr9AT41G1HCVFXr8tH2Ap3JEM4P8axhkSPgcweyZa27MWSENMqqLDoyhYMVeYt Faqj8Xa1vez2TRZ4aVplMz/vhHYk8LrXwMnPBhBIXvjoaZoDL5Sz7f0O6356z4xRlv5s 4Pdt0OazcHSCSPJkBL/LlzpAXQgVZZijY8Lbv0tAXrBtGLi3xzfdD8Vkcp9ZnLJSCJDO FDKztQEO17Uo2VQO6s44weNar+1yuErZdIzfgAxmVkrE+GUOCUwjFuVf6H8qtfH87hkb PULdKSMuTG7/zmvqWJT3DxQ6CwRZJDvNT15POuaOkHiwljVgIrxzXpYsDGlEM5WyOED5 FSSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=X+LV9oUMRwRHrcXmsm53k8GPuSzrV4FPRLpNCNB4qFc=; fh=+kTJNlX4d/Ktp/5WO5d77IkVGYcQ7tiev+NqB54rN/Q=; b=LrAXtWbS2o0H0KjsNHPrPEre75M17YSCv0v8AsPQvJn9GfeB0oGWknVbHT0Q0aC6Xk XFR4OQmtfvMhZ2n2keaTb9Vo8qzZzkESpx509EtiX6hOUau+YqXG+T6BOkwjXtDwsmif UcrUUQMBmR0VfZG6lTLlZ3k1nStN0esj870LkYtbkGM2mgXu7h7Ye8PVSWzlaXMfksV+ YNj7DkdQL6JCqAB7oCXTw5gSBXpU9tJXDwLGrDOKS3s7FWOALDjrT9y0jPqOsoVwCTnC sAc6KcW0o1MH0fTcAWF5xRmQSZuTmFDW6L84YKG63ymsJhxgB0pjQiIHLFDI+Ljq2JVP KEGQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yW7nXVE9; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f14-20020a0562141d2e00b006a0cd99b70fsi1418402qvd.325.2024.04.28.15.16.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Apr 2024 15:16:01 -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=yW7nXVE9; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s1Cnq-0005w0-I3; Sun, 28 Apr 2024 18:15:22 -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 1s1Cnm-0005uj-TI for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:15:18 -0400 Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s1Cnl-0005V5-5N for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:15:18 -0400 Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-51dc5c0ffdbso263357e87.2 for ; Sun, 28 Apr 2024 15:15:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714342515; x=1714947315; 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=X+LV9oUMRwRHrcXmsm53k8GPuSzrV4FPRLpNCNB4qFc=; b=yW7nXVE9UMSNgdIQVYPeILGvKoPj0qqrAemeG/1sGD3dGCVxwk67N82wuHNfZB4yoh euAdsB+ptQGSUeNv04Dft729nhIkch2IwAlTf6ZfJf1wZOGCerRP04ey2oEWNZpAVHK9 G+uepxaQ6qlfr84u1KM8dSrfmaU1Jl0UOxLlryZlqItkYDlP2GYSMUdqaDs7hOLKd4Qr 2pamaXiCP5QAAlymKeDHauXFneqAMjWt/2P4QjiVqWcOFGMRG/xrxXEzGPa5MGmW5ho6 +as35t2gDImrhAbjzI9aCuuRzvNztgKgxv4D9SaycyEze9qSf+0pFZQepLphuwzkY5RH jQkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714342515; x=1714947315; 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=X+LV9oUMRwRHrcXmsm53k8GPuSzrV4FPRLpNCNB4qFc=; b=rZJ2nPcPxeVjXDx1YuBe+exWghG4UjGiP3DiStrQiC7h4p5wToWRMRkjhczUjY1BI8 R+CWLPm5X87Oc8ya2UHv1SvrO3fpJ8dD7tTMCmgjRIPxx1fI4WzhZ4wVM6MZTINl3Bve wWFc3zupFcg1FsfuxjQMGrSD+d09XG1dFfr/t3HHBWtwOPpld5ZgLlCEjVohE6N2D96L qKWk5dE2o/QCR/+VG/JNvoNQiEc8tBez4ufzbNVjNQDukpmzVhRWfW7tpgyBetilRoIh 49uP2VGclF6nhgEAi4sQUfCz1Nz/+0KbNymfp9YHggvGEOMl8faCcEcvuipMVb51UF6+ J7aA== X-Gm-Message-State: AOJu0Yyu1TygjS7zICoFTjtYisumDvXL7A1TwRcyaxPJQoAS7Li5VX7g ItH1NiqP8vQhsTIPIGktYvJDJK7ScI2Bw+alFliZ8kEk0YxNicSJ6MKbkCgIBEi5VzVJIGmhy9v D X-Received: by 2002:a05:6512:130c:b0:51d:3fe4:c3cc with SMTP id x12-20020a056512130c00b0051d3fe4c3ccmr2919256lfu.0.1714342514869; Sun, 28 Apr 2024 15:15:14 -0700 (PDT) Received: from m1x-phil.lan ([176.176.142.130]) by smtp.gmail.com with ESMTPSA id eb16-20020a170907281000b00a58764e6c45sm7413730ejc.173.2024.04.28.15.15.13 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 28 Apr 2024 15:15:14 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Anton Johansson , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 04/24] accel/tcg: Duplicate cpu_exit() for user / system Date: Mon, 29 Apr 2024 00:14:30 +0200 Message-ID: <20240428221450.26460-5-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240428221450.26460-1-philmd@linaro.org> References: <20240428221450.26460-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::131; envelope-from=philmd@linaro.org; helo=mail-lf1-x131.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 will introduce a per-accelerator vCPU exit() handler for system emulation. Duplicate cpu_exit() because the handler won't be accessible from user emulation. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- accel/tcg/user-exec.c | 8 ++++++++ hw/core/cpu-common.c | 8 -------- system/cpus.c | 8 ++++++++ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c index f49435df9d..404d8a145c 100644 --- a/accel/tcg/user-exec.c +++ b/accel/tcg/user-exec.c @@ -46,6 +46,14 @@ void cpu_interrupt(CPUState *cpu, int mask) qatomic_set(&cpu->neg.icount_decr.u16.high, -1); } +void cpu_exit(CPUState *cpu) +{ + qatomic_set(&cpu->exit_request, 1); + /* Ensure cpu_exec will see the exit request after TCG has exited. */ + smp_wmb(); + qatomic_set(&cpu->neg.icount_decr.u16.high, -1); +} + /* * Adjust the pc to pass to cpu_restore_state; return the memop type. */ diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c index 9b3efba82f..cbafc79033 100644 --- a/hw/core/cpu-common.c +++ b/hw/core/cpu-common.c @@ -78,14 +78,6 @@ void cpu_reset_interrupt(CPUState *cpu, int mask) } } -void cpu_exit(CPUState *cpu) -{ - qatomic_set(&cpu->exit_request, 1); - /* Ensure cpu_exec will see the exit request after TCG has exited. */ - smp_wmb(); - qatomic_set(&cpu->neg.icount_decr.u16.high, -1); -} - static int cpu_common_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg) { return 0; diff --git a/system/cpus.c b/system/cpus.c index 68d161d96b..e0530ad603 100644 --- a/system/cpus.c +++ b/system/cpus.c @@ -419,6 +419,14 @@ void run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data) do_run_on_cpu(cpu, func, data, &bql); } +void cpu_exit(CPUState *cpu) +{ + qatomic_set(&cpu->exit_request, 1); + /* Ensure cpu_exec will see the exit request after TCG has exited. */ + smp_wmb(); + qatomic_set(&cpu->neg.icount_decr.u16.high, -1); +} + static void qemu_cpu_stop(CPUState *cpu, bool exit) { g_assert(qemu_cpu_is_self(cpu)); From patchwork Sun Apr 28 22:14:31 2024 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: 792927 Delivered-To: patch@linaro.org Received: by 2002:adf:cc13:0:b0:346:15ad:a2a with SMTP id x19csp1423603wrh; Sun, 28 Apr 2024 15:16:32 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW587NQQN+Rp7jqyDFdynNp6xyGItLsHPpR4qRD9crG8rBazK7NsYrSk2enK/Xf0ykWnAZN02nbx4Moby3EyylZ X-Google-Smtp-Source: AGHT+IFJcd/TUZUtLzAa9qpBP6h2m6CvxTSs9JP/1dF0pbT4olaAP3jc9svGKEGTbMZPbFp1GogI X-Received: by 2002:a05:6808:1a95:b0:3c8:4d1c:1a04 with SMTP id bm21-20020a0568081a9500b003c84d1c1a04mr10408964oib.23.1714342592312; Sun, 28 Apr 2024 15:16:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714342592; cv=none; d=google.com; s=arc-20160816; b=OpedI+2wkVjbYkO916mtTxNmXwnkL88BOLR+BJPFVhewN/H8FtO5KMVVzJANlBsGo5 tWUy6Jn1XqhK4+tKLdsXqSROvNsqZCKaTWl3VMr0m7YUXw/PSncs0nHHbzIREtxgM7b5 t6Gtfe15q5fWhTYZvhRlpizIdbAFfdUjlof43Alo0BseDu3+MUmTQQldcJPWkyZ0bZ1A dl00uSDhe1hF0nWmGQ0uE5T+T5Cg/0gh1BcyVSwaPPd7xpVUd1RUFG3oponJEGYH5Mc2 s4ABH6M3ZKbMrQJrdmZ7/sHRKn0D5A6EQ6PM5z3e8bvic0y5sM9tJQRYqFDcPSvAAkmv AtFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=8v4uzifmPKK2kwYtF4RlyiCCqgElOLg1I89Ov9YYN+0=; fh=+kTJNlX4d/Ktp/5WO5d77IkVGYcQ7tiev+NqB54rN/Q=; b=nf2UM4+uZ32R7pohhRGRk0FMXO6nhnEw2m/feVFJfWMy5Hb1pvsVV2fvEtpXzrZKOi Vj/NF9oB47/zgB+YmKX8hICMXRmNYQycQeND+3ud9bEXjRvTfFvELuariZdrON2QcEnd c2nZ6bMZnpt7Rm5pA3GVNIkQkUnJdRiUMwIltSiwNMs4sFJ8EvR+mcOsK6OOVZmam36k amEb7gMaItBIFOhNOiUV4RvPUEfryfB/Xr+Hk+j7JTR8eRumYEO+345YiQjBNxe4DAg/ AuyTfHz7agXJj7n8n6Dk96aOWriT8nrRWAGZxhoTbHjKYCxdDWjIR5mfF2IJsbp07UxV eOMg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=C2cmvPTu; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id jf13-20020a0562142a4d00b0069b1cd7d957si24752395qvb.120.2024.04.28.15.16.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Apr 2024 15:16:32 -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=C2cmvPTu; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s1Cnt-0005zT-7A; Sun, 28 Apr 2024 18:15:25 -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 1s1Cnr-0005wN-Gm for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:15:23 -0400 Received: from mail-ed1-x532.google.com ([2a00:1450:4864:20::532]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s1Cnp-0005WY-SB for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:15:23 -0400 Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-572229f196cso3881194a12.2 for ; Sun, 28 Apr 2024 15:15:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714342520; x=1714947320; 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=8v4uzifmPKK2kwYtF4RlyiCCqgElOLg1I89Ov9YYN+0=; b=C2cmvPTuRfq81zmyBIQduUjo+HBntyMzxFZsmZGgd1qrfKayaLxLsJiG1H1WzO3twq QDpPewKItEjMzok8lKjhnuIt3o7yyCv5aYtSgDF2EC6WZ4+nS1ULIpLcSt32+uzwWZq3 jyR5vvfv+jie8Wwzghenws4FrZvQtmkPafxQFVPKOccwqUkEaH1FS6kdE5Nkg8tjYLi1 yPO2s9WW8dDDBN4VnLxITxL4zhOKhU+/39x4bzkpCZ7PyozgY50mcuhI6I/iCHGhb41g qneyNpVXRAH7bSHblwdBfStI16f3OGGUOEP7mdK1dYYf7FPzmOR98Y17tBCh0bs452eR lN2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714342520; x=1714947320; 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=8v4uzifmPKK2kwYtF4RlyiCCqgElOLg1I89Ov9YYN+0=; b=UdXJQ/g8Xxjo7NOVNKF6lnMpUPQ0BPW9jo6LB9Br8AMrOtLnpSy4p6eW6MphEonc56 0K6gwX6VhhRFLCpQ7bQQqPLeb2WbSP6nONaJl0G1a6DYHSj/7SqDWlZuyGgtB0lWi6TL SOaBFspPFaFrQGzZurUOZiWCWLGeOtEkNnp0f4doyMbvzXI/fOUhe0fjOpGesmmsQQP1 PvYbhsT2nBhqckmXyeHIfB/iISSc7OYqJqxyP396JeCNU38cOWMmGfjNrRF3+N5d/s6B 0UwBBTFQz3NiHienAeRJ086d9qbHOpX4wNxSLERSxh1Gas6RNU/OWHNxBMtcIFVpp0G6 UyuQ== X-Gm-Message-State: AOJu0Yws1rDAaVZLcx8P1vCbc+v69GgznIQWYSS9bxRHWsBG/PXMboGR dIlwKgxa8e0bcCXjG1xzF8sdHOTOIfU2f4J6pPMQmEj9N5dAebBScrZjc0jj8m0SNN/+RwoTepy A X-Received: by 2002:a50:f68f:0:b0:571:be31:500b with SMTP id d15-20020a50f68f000000b00571be31500bmr5553084edn.25.1714342520316; Sun, 28 Apr 2024 15:15:20 -0700 (PDT) Received: from m1x-phil.lan ([176.176.142.130]) by smtp.gmail.com with ESMTPSA id fg4-20020a056402548400b005727e798b5bsm759122edb.63.2024.04.28.15.15.19 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 28 Apr 2024 15:15:19 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Anton Johansson , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 05/24] accel/tcg: Extract tcg_cpu_exit() from cpu_exit() Date: Mon, 29 Apr 2024 00:14:31 +0200 Message-ID: <20240428221450.26460-6-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240428221450.26460-1-philmd@linaro.org> References: <20240428221450.26460-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::532; envelope-from=philmd@linaro.org; helo=mail-ed1-x532.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 Extract tcg_cpu_exit() from the user cpu_exit() implementation. In few commits we will re-use it in the system one (via a per-accel handler). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- accel/tcg/internal-common.h | 2 ++ accel/tcg/translate-all.c | 7 +++++++ accel/tcg/user-exec.c | 4 +--- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/accel/tcg/internal-common.h b/accel/tcg/internal-common.h index ead53cb8a5..df317e7496 100644 --- a/accel/tcg/internal-common.h +++ b/accel/tcg/internal-common.h @@ -24,4 +24,6 @@ static inline bool cpu_in_serial_context(CPUState *cs) return !tcg_cflags_has(cs, CF_PARALLEL) || cpu_in_exclusive_context(cs); } +void tcg_cpu_exit(CPUState *cpu); + #endif diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index fdf6d8ac19..b67adce20e 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -663,3 +663,10 @@ void tcg_flush_jmp_cache(CPUState *cpu) qatomic_set(&jc->array[i].tb, NULL); } } + +void tcg_cpu_exit(CPUState *cpu) +{ + /* Ensure cpu_exec will see the exit request after TCG has exited. */ + smp_wmb(); + qatomic_set(&cpu->neg.icount_decr.u16.high, -1); +} diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c index 404d8a145c..d7e5f00c97 100644 --- a/accel/tcg/user-exec.c +++ b/accel/tcg/user-exec.c @@ -49,9 +49,7 @@ void cpu_interrupt(CPUState *cpu, int mask) void cpu_exit(CPUState *cpu) { qatomic_set(&cpu->exit_request, 1); - /* Ensure cpu_exec will see the exit request after TCG has exited. */ - smp_wmb(); - qatomic_set(&cpu->neg.icount_decr.u16.high, -1); + tcg_cpu_exit(cpu); } /* From patchwork Sun Apr 28 22:14:32 2024 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: 792921 Delivered-To: patch@linaro.org Received: by 2002:adf:cc13:0:b0:346:15ad:a2a with SMTP id x19csp1423466wrh; Sun, 28 Apr 2024 15:16:02 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWmnmhDaeCS6s31WgLbMGyshJlRe3RA5RCdrhN6av0/vJLQnuHkkS3hvSSdoHudHNdcMilrOCfP4X41LG/FIP4R X-Google-Smtp-Source: AGHT+IHmVWYZd+ohaw4OmMqEe/tvAcnnxTF2yJOD1BuGcruhHJ6Z2Aa+gWE3GIyHfS3ShASH+0eF X-Received: by 2002:a05:6214:1256:b0:6a0:7d91:19cf with SMTP id r22-20020a056214125600b006a07d9119cfmr11340497qvv.57.1714342562464; Sun, 28 Apr 2024 15:16:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714342562; cv=none; d=google.com; s=arc-20160816; b=jh1j5KQ6BKXADFx8i4Qol/AKnS/RyZUU084iTmbIyKSISngmT+GcAfcxlpyI9xsFPB nmGyG1erQ8+FI1Cy21Ce19cQeAiqHxQyxbOHg/nrTZmbTshDEo1M9HCYQ3lBbW+EetkW Dg27jgxkMGtH0H2zMnPT7W+KZA9tGsmmybfYPI1ddoKRFmHew1GnrRDfW71plOSgvhI2 gOXS5+4Be3powsvGZ0S2jjyxAb8JiXDgMP2Kc3obUsagDFyYtPou050EgBGzifrKVAgQ Nd+b65ZO+EvrGv/P9eiD42ubz/7ra/Mg5910iNJUQ4qS2o37+1db6/gXl+IOb8dyWI3P 79nA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=4RJjHdtnEQClT/5V8x7FhF0J3whe1EfuKPVVZmDDkK4=; fh=+kTJNlX4d/Ktp/5WO5d77IkVGYcQ7tiev+NqB54rN/Q=; b=FBlG6qC2oeUGTgr0UF7ArYZ0d7w1+GVZilLa/kEi0XXgIFP/i85VIFmrI7wCAsPWBZ 5eV0hG6lAcWcXAcPyM5tfX+zmH9USYydSqLbZJGf+x15pf5pb8IVU2BOMl7oj9EvUD9f PJcKOq1j0bPlD+gi8iIaiXhKqOF7J+MXTuYOdIX6J6LbOKv1xHgiJrr6Ymqy7eZJ/SLr Vj/TbTp8XCMXrewk6VByXEwJqNGQhjJMWhysPmZGG7QAs60XC062VW4uz4ZoBDHQBQ98 MTDttUf5u6HG6emicwvyC4WcsAIbqZ0MRuen8eBKZIP32nmPhYppDy9+Lg5ikT5YaKzR W04g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nqaQx9c8; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id jt4-20020a05621427e400b006a090534d3fsi12940673qvb.56.2024.04.28.15.16.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Apr 2024 15:16:02 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nqaQx9c8; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s1Cnz-00066F-0q; Sun, 28 Apr 2024 18:15:31 -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 1s1Cnx-00061i-O6 for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:15:29 -0400 Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s1Cnw-0005ZZ-1w for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:15:29 -0400 Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-56e56ee8d5cso4652304a12.2 for ; Sun, 28 Apr 2024 15:15:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714342525; x=1714947325; 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=4RJjHdtnEQClT/5V8x7FhF0J3whe1EfuKPVVZmDDkK4=; b=nqaQx9c8dKopl/2s57gcVSfaY0ANk2drDnDypALID2sgAxalETfImiGpRnvq27Ma8Q Yap+nbKr/5lFa/jFf2CEEFDMVU0HZL2C68QByCJpps08tVhmtgebDQJY+clBdFDP/KEg rQLt100pGDt1ImHf3+zlGUFDQ+EIVThDKUNZ33HQwBVlV2/5iX+87RWUrTizXEr1Z51P BG/rVcMP78iU3Bg5V0h154VSSuL5vfHKq1pkXGQGosOtKGcPX5203yEmP1o5/KytQ++6 l3yKKlYzSGt+8NxfVfsEQ4bofTIdHkif2D6CE9N7Aj8JGTIHQL1+sAQTaGwxGrsFcRs8 FDpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714342525; x=1714947325; 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=4RJjHdtnEQClT/5V8x7FhF0J3whe1EfuKPVVZmDDkK4=; b=M/18YXuUU8LCg+yArJUBNY7J/ZeVUEyAxol7pJwki+n1gX6QgJsSEB6vgLkvoKaABo KLCIgNczmqc0uMYWxAfZcHLTgdaLti/Q4+fDVuPDxZOqaH6/sRdhCCIjmhaBC74QdZUN iihjjSY0hNEe1vKUz82xDoMq4DZ8OUHF5GZuF+2EkkE4fMCSybO/HG97TLRzNWp0/ssm VtSR04505+ANfCU99YrJSk4Qs2igG1F86J7srXt/+qsz5hAsMEMagfxY6+aqsoslZ+2t qe+/xUDVZc1FpXFWFpP8jCXl7n9XN2HLbwuuG0Y3LJrdVZJEqM1hrEHDt8bieApguzfm tRiw== X-Gm-Message-State: AOJu0YyOGFGvtbulPI6RgsRVmjFC2ztPqYKtpyJKRZHytQgEqnoj13ta mlmnU5VLTQW0KvA4ZjahXKeYd+wKHUwZXTct9AwbADFicWQ9J68j/12llY7/mVjJYG1gKDGyWTx H X-Received: by 2002:a50:bb6f:0:b0:56d:b687:5a45 with SMTP id y102-20020a50bb6f000000b0056db6875a45mr6453066ede.1.1714342525576; Sun, 28 Apr 2024 15:15:25 -0700 (PDT) Received: from m1x-phil.lan ([176.176.142.130]) by smtp.gmail.com with ESMTPSA id b17-20020a056402139100b00572047bf766sm8479321edv.51.2024.04.28.15.15.24 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 28 Apr 2024 15:15:25 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Anton Johansson , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 06/24] accel: Introduce AccelOpsClass::exit_vcpu_thread() handler Date: Mon, 29 Apr 2024 00:14:32 +0200 Message-ID: <20240428221450.26460-7-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240428221450.26460-1-philmd@linaro.org> References: <20240428221450.26460-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52f; envelope-from=philmd@linaro.org; helo=mail-ed1-x52f.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 Introduce a per-accelerator handler that can be call when a vCPU exits. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- include/sysemu/accel-ops.h | 1 + system/cpus.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/include/sysemu/accel-ops.h b/include/sysemu/accel-ops.h index ef91fc28bb..35dfb7e266 100644 --- a/include/sysemu/accel-ops.h +++ b/include/sysemu/accel-ops.h @@ -35,6 +35,7 @@ struct AccelOpsClass { void (*create_vcpu_thread)(CPUState *cpu); /* MANDATORY NON-NULL */ void (*kick_vcpu_thread)(CPUState *cpu); bool (*cpu_thread_is_idle)(CPUState *cpu); + void (*exit_vcpu_thread)(CPUState *cpu); void (*synchronize_post_reset)(CPUState *cpu); void (*synchronize_post_init)(CPUState *cpu); diff --git a/system/cpus.c b/system/cpus.c index e0530ad603..d0d585e8b9 100644 --- a/system/cpus.c +++ b/system/cpus.c @@ -425,6 +425,9 @@ void cpu_exit(CPUState *cpu) /* Ensure cpu_exec will see the exit request after TCG has exited. */ smp_wmb(); qatomic_set(&cpu->neg.icount_decr.u16.high, -1); + if (cpus_accel->exit_vcpu_thread) { + cpus_accel->exit_vcpu_thread(cpu); + } } static void qemu_cpu_stop(CPUState *cpu, bool exit) From patchwork Sun Apr 28 22:14:33 2024 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: 792928 Delivered-To: patch@linaro.org Received: by 2002:adf:cc13:0:b0:346:15ad:a2a with SMTP id x19csp1423592wrh; Sun, 28 Apr 2024 15:16:31 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVJ5B49iZNZIHTCzQHTQXVFaR+R12vjBBJ2taYXs/gUYmGWsejlMfGjLJtrRjV40KMFYmVKOou2aAgx6teewVGF X-Google-Smtp-Source: AGHT+IExhuseJZfeJeCxoCj1dMubiZ865gj7RZhFl3cg5cWijFECFIpt2tqRaQC7v/Ndr0qHoMq6 X-Received: by 2002:a05:620a:460b:b0:790:e856:81e0 with SMTP id br11-20020a05620a460b00b00790e85681e0mr4944909qkb.43.1714342590930; Sun, 28 Apr 2024 15:16:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714342590; cv=none; d=google.com; s=arc-20160816; b=H3jlbCae/LqEOMmoYPIMSZTxaphXcQhc23dI4+MfDUohwPT0JFl+FcsKbqMn+H6/iG fSd2G/ZM2AXocOfzgMFT1gqKHAPG22gCbuzU4WCoaAg8OY2bg2LGlM742SzYk9yNfWLs PhMjMXFZgu0xlRSh9X8Y4t6hE/5Hn7oDmuNUP/KTMU/1wGCwP1PjG2hHxvClSJkuC6wf xEsMw/DLxtsNAFxXSYyQzxsY26u8C7cCoPcogExEjF7w1F5X7NQwp+PXxD5IumP1rJzp kO4qwh47Z9owCTU4khWfTrTLnH2IFa78PdCrzrlWzAx9g/edrvBWTAaNnq8VszBDokAo f6hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=k0P/VtJjh42zf7hktk88GWMfGQHzmvaE6RmKFsHTdzk=; fh=+kTJNlX4d/Ktp/5WO5d77IkVGYcQ7tiev+NqB54rN/Q=; b=WR7OihnP2bOJfyKmBbz8cVQtNVhsogfVuq9bxmzx3MQP9ldn4auV2RRduQl9atl3c8 IklREyx4fZQ2JRWQgm+pj/AAbP5oylHOmYlx9jIRy9RiWWuPRGg2IKERA8qbe9IrhvQ9 sXwG9nY9urp00tNafa1goLAtCC/H8aNV94IDlh7a5WeIFHWeZknfQ3x1stz8jsWoGGlB i9xTX0/KDpxzX6jrOemRAeE/RbH5HWYZZIypKhp9UdwPluf0Pka/mYHIneneTSZVna6A jULZWROPtcCLhK7z7pM5XXZif5gcU0xTR2f2gpZR/xU92j8uVONVCbdbB9+PHlBJNdNG G0VA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=azwa6ccv; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g16-20020a05620a109000b0078f1bd893d5si21191605qkk.592.2024.04.28.15.16.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Apr 2024 15:16:30 -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=azwa6ccv; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s1Co4-0006K3-To; Sun, 28 Apr 2024 18:15:36 -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 1s1Co3-0006HS-B8 for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:15:35 -0400 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s1Co1-0005bO-0r for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:15:35 -0400 Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-a58872c07d8so868551466b.0 for ; Sun, 28 Apr 2024 15:15:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714342531; x=1714947331; 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=k0P/VtJjh42zf7hktk88GWMfGQHzmvaE6RmKFsHTdzk=; b=azwa6ccv7KJnDz85n7WCXjG1j1YOcrW3SUdFBuFU5cRzDxM28Gwd598JE03ii381G4 dVpaH7aMDMBboR+ZwotgNCTyWd8RpyMXkgCcnQ34uNTEzLLlkLKvE32Ds/zU2Xjte/WP r3dl22KBHLFuLUbxxoVFMsVlaUxoSlRAPGx2DVzAwgj7qgG1K1Tj6NDiIXPUqVsN/7JX jD0OeZqPK/NxZSg7rq/NlscJuWA/E/wYQMPqRaV6zVzg+mE4VG/MNyI67LfConaj1SUX lxv+tbkJajlEM98mTbS5z5qEttyggYuTKx2xlahxpPqASGlJeYZq3MEI8JeulhX5ILfI s/dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714342531; x=1714947331; 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=k0P/VtJjh42zf7hktk88GWMfGQHzmvaE6RmKFsHTdzk=; b=FTg37rtvsSdxGJEuWffyuADwntHlxlA2rM1s/VnyesIwgsIoT8rhr85tsxXDdRH7SR 4UinuBVdPm4I6tnTE9mBYjiCCje0mzTFCpHCkyYxcHaa4zZibuSOSgJ+IkQFuryij0PH OJhRp+bz9s7SFAZyU6CcBmszEYyJb8scWBgsvQmT6he1VsRUCxM5ME3zMdJ9Dtmt+9jy 5bZnTBzF9chgRyK6urSFhpbdTshKka+4/+l1qAPXqqy8UwIOt1qa2MyTS6EA90GtKSRn JWM7xfoVRfP6d9xz8ViRnZ+hqCBF1K15nAUz7bPZKFvUWEAs4np3wNCZBMi5ALI4vN0r fnQA== X-Gm-Message-State: AOJu0Yxjwuvli3Ked//lfaXR87tIknaJKKlOJXW23j1QdoHvx2sb38AF 2RLfbroyWrz8dVqWO0595zLkky8PDZ+gErPW+duN/gQjCrfOOqyM+DUfG06n5hAO0e9HGFhqg5z M X-Received: by 2002:a17:906:e17:b0:a58:921a:970d with SMTP id l23-20020a1709060e1700b00a58921a970dmr7426286eji.6.1714342530907; Sun, 28 Apr 2024 15:15:30 -0700 (PDT) Received: from m1x-phil.lan ([176.176.142.130]) by smtp.gmail.com with ESMTPSA id g10-20020a1709067c4a00b00a4e5866448bsm13044579ejp.155.2024.04.28.15.15.29 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 28 Apr 2024 15:15:30 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Anton Johansson , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 07/24] accel/tcg: Implement AccelOpsClass::exit_vcpu_thread() handler Date: Mon, 29 Apr 2024 00:14:33 +0200 Message-ID: <20240428221450.26460-8-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240428221450.26460-1-philmd@linaro.org> References: <20240428221450.26460-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::633; envelope-from=philmd@linaro.org; helo=mail-ej1-x633.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org The TCG-specific code from the system generic cpu_exit() is equivalent of tcg_cpu_exit(). Define the AccelOpsClass exit_vcpu_thread() handler to it, making cpu_exit() generic. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- accel/tcg/tcg-accel-ops.c | 2 ++ system/cpus.c | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c index 7ac5f0c974..56bbad9fcd 100644 --- a/accel/tcg/tcg-accel-ops.c +++ b/accel/tcg/tcg-accel-ops.c @@ -43,6 +43,7 @@ #include "tcg-accel-ops-mttcg.h" #include "tcg-accel-ops-rr.h" #include "tcg-accel-ops-icount.h" +#include "internal-common.h" /* common functionality among all TCG variants */ @@ -218,6 +219,7 @@ static void tcg_accel_ops_init(AccelOpsClass *ops) } } + ops->exit_vcpu_thread = tcg_cpu_exit; ops->cpu_reset_hold = tcg_cpu_reset_hold; ops->supports_guest_debug = tcg_supports_guest_debug; ops->insert_breakpoint = tcg_insert_breakpoint; diff --git a/system/cpus.c b/system/cpus.c index d0d585e8b9..3e86b488d3 100644 --- a/system/cpus.c +++ b/system/cpus.c @@ -422,9 +422,6 @@ void run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data) void cpu_exit(CPUState *cpu) { qatomic_set(&cpu->exit_request, 1); - /* Ensure cpu_exec will see the exit request after TCG has exited. */ - smp_wmb(); - qatomic_set(&cpu->neg.icount_decr.u16.high, -1); if (cpus_accel->exit_vcpu_thread) { cpus_accel->exit_vcpu_thread(cpu); } From patchwork Sun Apr 28 22:14:34 2024 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: 792922 Delivered-To: patch@linaro.org Received: by 2002:adf:cc13:0:b0:346:15ad:a2a with SMTP id x19csp1423473wrh; Sun, 28 Apr 2024 15:16:03 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUFlwfG0pqDZndyJHW+FF5OOXpZCXWXOfeANtCopnT0tjN9NFP6DvChIRR+YUF3hJpH1w9hX4u7m3df6t/nduEp X-Google-Smtp-Source: AGHT+IGS9tX3OwKz7bTB+LRt3fqYZBTCaZ5EXI7Q5lBUjCGY6JDt0D7PzlKmNParH2tasDLYAJ9D X-Received: by 2002:a05:6214:2a8f:b0:6a0:b905:96ed with SMTP id jr15-20020a0562142a8f00b006a0b90596edmr7188040qvb.43.1714342563193; Sun, 28 Apr 2024 15:16:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714342563; cv=none; d=google.com; s=arc-20160816; b=LLcx0eZMAX0qBoYv7aqZ3NUhuFWHhKUvfifAaTU2fwdzjro8XlDv4BvR7MCZ0IHzco UCA6jwrQsl4qWhcKxASz3kup9bKOSw7vnOVUp8w7jVx6KSsITbUnwiPJrqjCZMZ5Gct/ 85WjBzL7gPHQ8jFAHGFu3qk437v0FIrjTDNnrdUPGgHRiFZKQa43/km10jc6QDZmWmoB C12PyPNQT7yU6C7ED9GBHBdly4aVtK9qUNpEU5/cSe9rQ6W38FwuDVUPj829nqLb/SBf Zc771rf7ewJX5+FvTDTyVfAJes/3OSdPNXl6AjTkj3TQd/p41HX9QLIGJlByS1MeE4t3 1RLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=aM0sC9LJo3MsBrKnxAqhq0R7PzMkuVnjASQsrgigLYU=; fh=+kTJNlX4d/Ktp/5WO5d77IkVGYcQ7tiev+NqB54rN/Q=; b=V+rWesIcLpjaGG7H1uZZo02tuhGXBOkrY9NuXvWn6D0wtMqqU9WBoI3kkW4rI+COaC kYHjD8C9PGhtQoDnuUzQu55lBIcJvvHarxdKP2KaoDNoD0gcSdFNB24ZoFhbdMZ4hkRN yn3VlCitO9xMLwAgWFt1JQXKX8Z1KOdzgcXf5yJkfpaHXRJc7fOuRQ7cGyNRwkiDWs69 SEvt8kuk/H/VSEEDtZYXX9PA3uovj7y3rPfeSnYG9XD0bAc7ODeAxfNeTGG/pEwduZyR BDoNO2yWK+t8BU/5CW0Pcp/CBECqXLma+hHhbtVqZbK3gEwMH6rC+Z0Nl3JzCBa3LEq6 khAg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oGvccj9m; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q12-20020ad45cac000000b006a0cb20e2e4si1791980qvh.20.2024.04.28.15.16.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Apr 2024 15:16:03 -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=oGvccj9m; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s1CoC-0006XM-Tc; Sun, 28 Apr 2024 18:15:45 -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 1s1CoB-0006ND-6d for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:15:43 -0400 Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s1Co6-0005dI-Bp for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:15:42 -0400 Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-571bddddbc2so4569653a12.1 for ; Sun, 28 Apr 2024 15:15:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714342536; x=1714947336; 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=aM0sC9LJo3MsBrKnxAqhq0R7PzMkuVnjASQsrgigLYU=; b=oGvccj9mJPJpAulNIuJ7a/8dKMkX+oiCbVypgMMTzEyI0kjK1mYSCfPHvbWXfG2D22 yvYtiOipzfUD3HKRL9mCXqVY9qGoaIHsP+HEtCYq39oEvQ9h8x7L2Nq3SsL9286LdrnA 062Z23vqm9K572nj5NBTxX5Om+yHXsYDaODUOnm/u475XbtnSh3oTbiF1Bj731jZ22Ra LaKXnFhpDjx0QMlkHwgcrf7TR6wmpA4w/KaLTjMMpBRdXnYrqELTqo07NuK7bCwwGWRI 3/24LOdt0H1bUH8qVl560UxFYQCir+B4P6qC+gu2ubrRQXG/3Bv0lXRC4Zr+pCL0z2K1 fgBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714342536; x=1714947336; 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=aM0sC9LJo3MsBrKnxAqhq0R7PzMkuVnjASQsrgigLYU=; b=E5t31NO1puLC3L6Dti1exvdo9vBwESOrFarjgbhijQj1KCCsiSUfkfp43sQBbjCo2I cEyYCgLt/h5AoMA3wgFlTLIVbYDLCdlt7oCcCDUAYempLaURJ5/ii99FSwE/gol+wxFe fHNpuCTYzXPzXFofxLsH2EQGulPPndVkh2oGnhj2nFgqtuJlH9XoflRYMn+B58V5y8Um n3HtfSZ+qhSgHlqeNVTumDvW0BCJCnKvdZCHs+VMwe65VqjL6nuxokGi8eHWXKVKTX5L 9Z6p+4vOy0k6/kaCvnf+F+1s4MuCwf0InTr7+QjVP6/6AZujJAY9tIM7B03GESO6+x6F WjuQ== X-Gm-Message-State: AOJu0Yy1n+RGAbfumtukBRrdu2MEyqaNzAheRwa2sSZ1zsir9wUXQslF hpZu3b9EuRpVr3zQsR4y/7ylHdTzjJxRXlVBKvkYMtY9fgIQWuYIrSI68eRKOUlo6srDk5GPxMR P X-Received: by 2002:a17:906:3811:b0:a55:99f4:549f with SMTP id v17-20020a170906381100b00a5599f4549fmr6071347ejc.48.1714342536203; Sun, 28 Apr 2024 15:15:36 -0700 (PDT) Received: from m1x-phil.lan ([176.176.142.130]) by smtp.gmail.com with ESMTPSA id kx18-20020a170907775200b00a57e2d39d56sm7731187ejc.223.2024.04.28.15.15.35 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 28 Apr 2024 15:15:35 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Anton Johansson , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 08/24] user: Forward declare TaskState type definition Date: Mon, 29 Apr 2024 00:14:34 +0200 Message-ID: <20240428221450.26460-9-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240428221450.26460-1-philmd@linaro.org> References: <20240428221450.26460-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52d; envelope-from=philmd@linaro.org; helo=mail-ed1-x52d.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_PASS=-0.001, T_SPF_HELO_TEMPERROR=0.01 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 Forward declare TaskState in "qemu/typedefs.h" so we can use it in generic headers like "hw/cpu/core.h". Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- bsd-user/qemu.h | 4 ++-- include/qemu/typedefs.h | 1 + linux-user/qemu.h | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index e562adde65..be57374b41 100644 --- a/bsd-user/qemu.h +++ b/bsd-user/qemu.h @@ -76,7 +76,7 @@ struct emulated_sigtable { /* * NOTE: we force a big alignment so that the stack stored after is aligned too */ -typedef struct TaskState { +struct TaskState { pid_t ts_tid; /* tid (or pid) of this task */ struct TaskState *next; @@ -114,7 +114,7 @@ typedef struct TaskState { /* This thread's sigaltstack, if it has one */ struct target_sigaltstack sigaltstack_used; -} __attribute__((aligned(16))) TaskState; +} __attribute__((aligned(16))); static inline TaskState *get_task_state(CPUState *cs) { diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h index 50c277cf0b..36f2825725 100644 --- a/include/qemu/typedefs.h +++ b/include/qemu/typedefs.h @@ -134,6 +134,7 @@ typedef struct SHPCDevice SHPCDevice; typedef struct SSIBus SSIBus; typedef struct TCGCPUOps TCGCPUOps; typedef struct TCGHelperInfo TCGHelperInfo; +typedef struct TaskState TaskState; typedef struct TranslationBlock TranslationBlock; typedef struct VirtIODevice VirtIODevice; typedef struct Visitor Visitor; diff --git a/linux-user/qemu.h b/linux-user/qemu.h index 4777856b52..16d9f6ae8c 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -95,7 +95,7 @@ struct emulated_sigtable { target_siginfo_t info; }; -typedef struct TaskState { +struct TaskState { pid_t ts_tid; /* tid (or pid) of this task */ #ifdef TARGET_ARM # ifdef TARGET_ABI32 @@ -158,7 +158,7 @@ typedef struct TaskState { /* Start time of task after system boot in clock ticks */ uint64_t start_boottime; -} TaskState; +}; static inline TaskState *get_task_state(CPUState *cs) { From patchwork Sun Apr 28 22:14:35 2024 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: 792925 Delivered-To: patch@linaro.org Received: by 2002:adf:cc13:0:b0:346:15ad:a2a with SMTP id x19csp1423560wrh; Sun, 28 Apr 2024 15:16:24 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXazini2mzKDWThhZs+RdKGXVVkNcerUgIi0N0pavaFfs3KTNrJwgZzhEmXJ9O0nm7DUNE1My5TfoqIXSwWf/Xx X-Google-Smtp-Source: AGHT+IEBQk5nXZ304NBSOM3b6f6CPDS7OJEPhvpByhYv/oQyhhT1TDOOSZfm/1wAdCwWiRhyCShf X-Received: by 2002:a05:620a:935c:b0:790:f577:30cd with SMTP id sg28-20020a05620a935c00b00790f57730cdmr1262099qkn.20.1714342584740; Sun, 28 Apr 2024 15:16:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714342584; cv=none; d=google.com; s=arc-20160816; b=P4N+geAZdMucp4joZrUleGELTs33V/85C8kbSqWAndZwQmqYo71QBMpEGjTxserWZC 59bTltML9DYKv+1pot+K+MWjbOKaXXJ+Fo+UfPkB5CFzvC079bhYYJGGxEY35Frkawzq ZNBeQ3X4CeXpF11nNoQFE4DeLnjfjbQCBF72LPB2oAmKFZ25DYhqwrNuL8dxDEY7aIzY s3LCBIR8hjdegrMyXV+FI3cIxs+ppm3yUEkGNaY+YdrZVlL/hqqxAJrSXNTDsrnLCSoy 0n0/MG4Hjj/Rk0k56AH3I1kZTD7UrFtJLCkILpItMhTSkMW/RRNEZlpTmSWJzmLd4RZa lkWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=ZwA4gGr9bUP88hrZk3uOFR181roNW8nQo5hO4TYpEMY=; fh=+kTJNlX4d/Ktp/5WO5d77IkVGYcQ7tiev+NqB54rN/Q=; b=iMSohf/ULTCiJQfrvkvjkIJcY5AMm4A01qxHlMhCitYD+foZXqn3PMbehL8Bcj6dki vA6S1+aBM1UCHfZRomLL/LYgYSBKE9R2G3Jwt2W2xlHv+R9l18hbvJAsfBlkUAKnGdlL O2skxWQ3LrYaY4uCZ6LmPLDvpJjCMCo2AYUEDXEsTRuUwtb9Ve2TLGQjwpNU6jRBbFLo FEq9IghiLHMiEvZEgoIdR5UK525iEzPehiIU/i8LOB3hSY3fSPiFgFi6z5uNVsMOrSQ+ qb0EfKOad3mK4JTnBiQmm7NGOQhhzhEeCASRmtWgInepGzeUIlb3NR2jORHVGlNBLlJ5 YWKA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GwmuzJS9; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id wh1-20020a05620a56c100b0078d69b785a3si24607291qkn.739.2024.04.28.15.16.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Apr 2024 15:16:24 -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=GwmuzJS9; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s1CoK-0006vB-Up; Sun, 28 Apr 2024 18:15:53 -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 1s1CoC-0006Zc-Ul for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:15:45 -0400 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s1CoB-0005dW-77 for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:15:44 -0400 Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-a5557e3ebcaso642111066b.1 for ; Sun, 28 Apr 2024 15:15:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714342541; x=1714947341; 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=ZwA4gGr9bUP88hrZk3uOFR181roNW8nQo5hO4TYpEMY=; b=GwmuzJS9O3ErjeWe35HY0JngSNYtfVGOvx1spgMRk8KlCjUOcczp2tuw/wuTd9T7nF YsOKaZ2gmInwTbbMQFqAmjMHB3tZn+LA4YRxZB9ZR876tRC5V2YdhVXWCiZiN2WslPTi pmTDdlmPKLLIash+XcVySpFq8Fcqst1by0++dZLyCMPhH5hEPgl73NCYS3pCMg92pqdF xkYO7kH5kF0sNVu2LH9vDDhFXZAie6rOlzyL6AdnqhoVXMGn4MkHjHDPvBkEKvQWar6c HEWeUINaAoxThU4SR6V2k8LFSheHl6TvwJ83NRViW7D56SHWgkqx3MoSrZASWwLNq6HN jTwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714342541; x=1714947341; 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=ZwA4gGr9bUP88hrZk3uOFR181roNW8nQo5hO4TYpEMY=; b=OA7oJ1ZwGKU7QnTlBJDVDNMD5a9YdE008gsIMHoqC5jdkEwTUgP2b6tzkPxanvp4Sp m+a7vXYpTaILoYp1OFTrK+tA3p3zUubVDQFo/2hu4Zq/kAYrz/ZpHDVA08QsG8hVJwju 0YE59eSQBQZjOorVnhADC0z3+IS3CAYGY/YznBK3zuh48i1q08n5BdnBi4+TNr736RCk mw3uQqrhnG7PJM4pEIcXWeRRC0M/KWrg26/F4VjR19BaZsxxM+ljUbEiH8wIcM2t+axL Z3+pKU8Rb9frjnfZIKWrZb+eGDVLSZdajrtU2qTmwfv95fX6Lpd7Egfyk8gsvtcGTT0c Bl5g== X-Gm-Message-State: AOJu0Yzjz/rf0Rw/QbGsvL+XglsaAYcRxL3WUOW4uHlVNLhA3TxzrhCr MzV+y3g48fK9ff3smLKi07XFrnlFGqoJJFu4o7x0TWVz78Sn/JRyrurGLOmrtZfKMholTQwZtLC H X-Received: by 2002:a17:906:16da:b0:a58:7e28:b6bc with SMTP id t26-20020a17090616da00b00a587e28b6bcmr7246359ejd.17.1714342541564; Sun, 28 Apr 2024 15:15:41 -0700 (PDT) Received: from m1x-phil.lan ([176.176.142.130]) by smtp.gmail.com with ESMTPSA id bv19-20020a170906b1d300b00a58eabf6082sm2011450ejb.199.2024.04.28.15.15.40 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 28 Apr 2024 15:15:41 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Anton Johansson , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 09/24] user: Declare get_task_state() once in 'accel/tcg/vcpu-state.h' Date: Mon, 29 Apr 2024 00:14:35 +0200 Message-ID: <20240428221450.26460-10-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240428221450.26460-1-philmd@linaro.org> References: <20240428221450.26460-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::635; envelope-from=philmd@linaro.org; helo=mail-ej1-x635.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 While each user emulation implentation defines its own TaskState structure, both use the same get_task_state() declaration, in particular in common code (such gdbstub). Declare the method once in "accel/tcg/vcpu-state.h". Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- accel/tcg/vcpu-state.h | 18 ++++++++++++++++++ bsd-user/qemu.h | 6 +----- linux-user/qemu.h | 6 +----- 3 files changed, 20 insertions(+), 10 deletions(-) create mode 100644 accel/tcg/vcpu-state.h diff --git a/accel/tcg/vcpu-state.h b/accel/tcg/vcpu-state.h new file mode 100644 index 0000000000..e407d914df --- /dev/null +++ b/accel/tcg/vcpu-state.h @@ -0,0 +1,18 @@ +/* + * SPDX-FileContributor: Philippe Mathieu-Daudé + * SPDX-FileCopyrightText: 2023 Linaro Ltd. + * SPDX-License-Identifier: GPL-2.0-or-later + */ +#ifndef ACCEL_TCG_VCPU_STATE_H +#define ACCEL_TCG_VCPU_STATE_H + +#include "hw/core/cpu.h" + +#ifdef CONFIG_USER_ONLY +static inline TaskState *get_task_state(const CPUState *cs) +{ + return cs->opaque; +} +#endif + +#endif diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index be57374b41..65fe95fed1 100644 --- a/bsd-user/qemu.h +++ b/bsd-user/qemu.h @@ -36,6 +36,7 @@ extern char **environ; #include "exec/gdbstub.h" #include "exec/page-protection.h" #include "qemu/clang-tsa.h" +#include "accel/tcg/vcpu-state.h" #include "qemu-os.h" /* @@ -116,11 +117,6 @@ struct TaskState { struct target_sigaltstack sigaltstack_used; } __attribute__((aligned(16))); -static inline TaskState *get_task_state(CPUState *cs) -{ - return cs->opaque; -} - void stop_all_tasks(void); extern const char *interp_prefix; extern const char *qemu_uname_release; diff --git a/linux-user/qemu.h b/linux-user/qemu.h index 16d9f6ae8c..515af82d8b 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -8,6 +8,7 @@ #include "syscall_defs.h" #include "target_syscall.h" +#include "accel/tcg/vcpu-state.h" /* * This is the size of the host kernel's sigset_t, needed where we make @@ -160,11 +161,6 @@ struct TaskState { uint64_t start_boottime; }; -static inline TaskState *get_task_state(CPUState *cs) -{ - return cs->opaque; -} - abi_long do_brk(abi_ulong new_brk); int do_guest_openat(CPUArchState *cpu_env, int dirfd, const char *pathname, int flags, mode_t mode, bool safe); From patchwork Sun Apr 28 22:14:36 2024 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: 792924 Delivered-To: patch@linaro.org Received: by 2002:adf:cc13:0:b0:346:15ad:a2a with SMTP id x19csp1423542wrh; Sun, 28 Apr 2024 15:16:20 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVKvKeNvf1iCHx4yABiJ/AHLsWIlbXD0K7lpvmjGweR9q//yKic+taHuL7+0CjPSv2LswdFx0IjDpKvD8V26/JM X-Google-Smtp-Source: AGHT+IFBgQOQ+pTy754p3rP0NO2qoxziQAaNGnnQruT8C8YJr13J9189qqrs2R6aUuNEcVFWEYVk X-Received: by 2002:ad4:5be2:0:b0:6a0:a541:79f6 with SMTP id k2-20020ad45be2000000b006a0a54179f6mr10391146qvc.56.1714342580095; Sun, 28 Apr 2024 15:16:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714342580; cv=none; d=google.com; s=arc-20160816; b=MT6mCuDMT1UmVhVC6vtvvZtwcYCIYPdpa/cf5EhvvPKyJ1VlE6GQ6y9+C3+LON7WVA FAz7tCvAn+9Ij/ufRaiNzWvlT/sPptlWk9mXi4Ls0OMpr2Gnlj2w6zf0aqyn0baTaqLV 0Qwq5uU8d01yseiM935rZRq5lO6SASjVxwFje+/EgIvCHu6s5xREQ9b8MLS0vYiWbGE0 Vei1RO04O1w4Fy9xdhvHE+W6lKdpL0e/b29EDRiRFzP+36ml57qsCrOa4F6HGXYpzbjP A3qDkdPyRJuIgtydy22i+h3QGoDTo8npFwPPSCBKNUAK1CTO4UIKYYV0v0S5uyLl6fN3 VNgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=dbxYPWieuKJ2V2McIsSIqfnAs5Fqc2GnHDeEOuheOAc=; fh=+kTJNlX4d/Ktp/5WO5d77IkVGYcQ7tiev+NqB54rN/Q=; b=FeZ+fcWq6bzamfi86YfvwqUVxsVsLePXaKMWLN+NLzrazSp8MZ0Rlvh84ifDaYSg8S /SQE6oVWSEXFRDu3qdLCTbZOqEjzG23zPkk4UwiMOzgNNCYA9c4HZfSju4/GxdfapHVR bL92WPKR373d3YPjNAW/K62t+4LNecUA0CTwlCms+C1B5knGAB62BPPeVOl90nUcPT4E Yx5Bj+9qjr+yBjCLIEwGwOyXsmsKQJJMvbNEkCzkCQGftHVkaFMIR4BYrpM1dxUmGuXV iS2wP+irBdvbwPx6kR26xVPmgSO8ftTkfbTZleG6nuMwMWlCPUuPYQM+t87hQgoBMXPE XHHw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aS4Chf2z; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c2-20020ad45ae2000000b0069b6b410474si25798186qvh.126.2024.04.28.15.16.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Apr 2024 15:16:20 -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=aS4Chf2z; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s1CoS-00076N-D8; Sun, 28 Apr 2024 18:16:00 -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 1s1CoJ-0006vl-1z for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:15:52 -0400 Received: from mail-lf1-x130.google.com ([2a00:1450:4864:20::130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s1CoG-0005du-V0 for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:15:50 -0400 Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-51abf1a9332so5257278e87.3 for ; Sun, 28 Apr 2024 15:15:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714342547; x=1714947347; 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=dbxYPWieuKJ2V2McIsSIqfnAs5Fqc2GnHDeEOuheOAc=; b=aS4Chf2zyBKHi8X7HDPOdG0ZonpyDhjIbPSEesnxJFVUG90ytN3ZJCFEfhtj1n20iR 6l+2cNKb++1WP5Qx2NYHzXQu1clqyVHeP9OW2XpZqXBYUYcUlFw5xT4c/cFC3vv3WIRu V5MvBuGxTamhhU4KPRe1wTn4ALjxT0zTHONmcZPqEd+e1VCQnqhN/55m5YXEemcLOupG fw6Vy7SkztZXZ+tAGdvS6ZopC2glczExsNIogooU1PhTCWuYuR8yndT30Y2OMMfD7TDQ VxOT6TM5mD2m7Zx2D+bKE2xAx7xEBD8wiaSVEv7z6UIhDj+fsVGmt+yJTSszHq7iOPBw tGuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714342547; x=1714947347; 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=dbxYPWieuKJ2V2McIsSIqfnAs5Fqc2GnHDeEOuheOAc=; b=M6bU3i3tLarmhYbKvYaM5SkiCWAEzC2At8ZUlmmfv4bMQSNjLHlm9doXkzcu4k9rin kgiH4LoSPFK1AjIdTFpW+JMJgpokw363zeiKcwsRHnT5U6SngSvYK+3v6nzJEeGwleRF mu9AweU/8T+sIspzDPd265uxnqUABh8znWGqTg3wljj9JN6BrQHibrqn7mN78HaceteB yUVUkigIeiz7HFYXFr/6fcbgr9smrR1GrlS0t7LoRyeKxf5KjczcBjj46pQnYziK8fP4 2l/nKqaUTpBd5vqlY8kczx4gcC/nTJ3a8ZRwuD2j16ctiTHLTl8VHr6U/gpV6x8ztcex upBg== X-Gm-Message-State: AOJu0Yy5LOW+xu3w5bD6HVJdxm//GC2j3S+pP7WNMIWGDlihL+sEXWP+ EJT4fAyDw3ZleoT4YhSyO5K7V4r2MIPEs0atnfu4HRE7tGDH9nPsmeCS/5kKSj8YyTntrlxPj0C j X-Received: by 2002:a19:6909:0:b0:51d:1258:349a with SMTP id e9-20020a196909000000b0051d1258349amr2509865lfc.2.1714342546978; Sun, 28 Apr 2024 15:15:46 -0700 (PDT) Received: from m1x-phil.lan ([176.176.142.130]) by smtp.gmail.com with ESMTPSA id v19-20020a170906339300b00a5592a12fe2sm10905821eja.128.2024.04.28.15.15.45 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 28 Apr 2024 15:15:46 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Anton Johansson , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 10/24] user: Use get_task_state() helper Date: Mon, 29 Apr 2024 00:14:36 +0200 Message-ID: <20240428221450.26460-11-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240428221450.26460-1-philmd@linaro.org> References: <20240428221450.26460-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::130; envelope-from=philmd@linaro.org; helo=mail-lf1-x130.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 Get the TaskState pointer calling get_task_state(). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- gdbstub/gdbstub.c | 3 ++- gdbstub/user-target.c | 4 ++-- linux-user/syscall.c | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index 9c2b8b5d0a..b3574997ea 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -32,6 +32,7 @@ #include "exec/gdbstub.h" #include "gdbstub/syscalls.h" #ifdef CONFIG_USER_ONLY +#include "accel/tcg/vcpu-state.h" #include "gdbstub/user.h" #else #include "hw/cpu/cluster.h" @@ -1661,7 +1662,7 @@ static void handle_query_supported(GArray *params, void *user_ctx) #if defined(CONFIG_USER_ONLY) #if defined(CONFIG_LINUX) - if (gdbserver_state.c_cpu->opaque) { + if (get_task_state(gdbserver_state.c_cpu)) { g_string_append(gdbserver_state.str_buf, ";qXfer:auxv:read+"); } g_string_append(gdbserver_state.str_buf, ";QCatchSyscalls+"); diff --git a/gdbstub/user-target.c b/gdbstub/user-target.c index 6646684a4c..a9c6c64512 100644 --- a/gdbstub/user-target.c +++ b/gdbstub/user-target.c @@ -216,7 +216,7 @@ void gdb_handle_query_offsets(GArray *params, void *user_ctx) { TaskState *ts; - ts = gdbserver_state.c_cpu->opaque; + ts = get_task_state(gdbserver_state.c_cpu); g_string_printf(gdbserver_state.str_buf, "Text=" TARGET_ABI_FMT_lx ";Data=" TARGET_ABI_FMT_lx @@ -252,7 +252,7 @@ void gdb_handle_query_xfer_auxv(GArray *params, void *user_ctx) offset = get_param(params, 0)->val_ul; len = get_param(params, 1)->val_ul; - ts = gdbserver_state.c_cpu->opaque; + ts = get_task_state(gdbserver_state.c_cpu); saved_auxv = ts->info->saved_auxv; auxv_len = ts->info->auxv_len; diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 1b42e80f9a..b9b5a387b3 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -6463,7 +6463,7 @@ static abi_long do_prctl(CPUArchState *env, abi_long option, abi_long arg2, case PR_GET_TID_ADDRESS: { - TaskState *ts = env_cpu(env)->opaque; + TaskState *ts = get_task_state(env_cpu(env)); return put_user_ual(ts->child_tidptr, arg2); } @@ -8124,7 +8124,7 @@ static int open_self_maps_2(void *opaque, target_ulong guest_start, static int open_self_maps_1(CPUArchState *env, int fd, bool smaps) { struct open_self_maps_data d = { - .ts = env_cpu(env)->opaque, + .ts = get_task_state(env_cpu(env)), .host_maps = read_self_maps(), .fd = fd, .smaps = smaps From patchwork Sun Apr 28 22:14:37 2024 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: 792930 Delivered-To: patch@linaro.org Received: by 2002:adf:cc13:0:b0:346:15ad:a2a with SMTP id x19csp1423638wrh; Sun, 28 Apr 2024 15:16:40 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX2S9+NvywO1Yi4hyEsDpzQk+kraH+ViB+lAArCDA3l/JvjjKUS+gJhteUKPjM8VHW5dukCjflAqECwEJ+4Xn8h X-Google-Smtp-Source: AGHT+IHRd09FnNDV8+7FPippIbpUICqDBhKBs/+XE+tf3Wcl3zIlV+UPrBHuaFLnBADSUqwLWnUk X-Received: by 2002:a05:6808:2a86:b0:3c8:4227:4fb4 with SMTP id fc6-20020a0568082a8600b003c842274fb4mr8868533oib.15.1714342599997; Sun, 28 Apr 2024 15:16:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714342599; cv=none; d=google.com; s=arc-20160816; b=aUVUiNXg8ZDT/vnmAzLOxtET4+lfgzXL1w++IhZ6kdJs0ID6oXGO9du5/mdPTaRZWA m2MFn3K6MnVLrObSlA492EmxRKDmllE4NJYcXkVS9IItSSSomJYpQcrJd5VK3IVHwnbB QEugECX7TX5yslImUfAtlPYQv/ad86LiqULODPAdkJ9TYoTTuVMzCQklUEHmUzT4AnXp ljGNuIh3Hs4UVM2EWnr0PlqwUbu2P/MqInsJ0EOCspHSvOSZWR5nrCdwfGaS0I+3S31m 2Qwo7VKGmYSSPfN8Tci71uNL/BPFDeTK/QuTLH8AQfDdY1lqWfT8KnwOOXIIL/Sr48b/ sy/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=6pl64tl5YQ1s8CCdAHkFJJC3DjPcNFHytDHp/sUwDIA=; fh=+kTJNlX4d/Ktp/5WO5d77IkVGYcQ7tiev+NqB54rN/Q=; b=eERZQWorhlhQYFNzEOGYyrxLfMapw6kuBUBkbc5C9ANJsRv8eBkh6tYpGDrPM09JP5 oWX0yrKy0OHrHvXdy16bU04KbnoekzXM6y0INq8llc76kB3fO3l+qJGxsG9du8S1/mwY yHiKi/SaOgNf70FONq1QCpJUS4JRwh/iW76SHiLudHq1puKhZFN3wIC5VjwugQeRUQa3 K3Eb4S+jQaLQJF2UkZP/GWGtx0hNMuJtN3LnbUPPaofy5ykseyANfHaux+QZyslSVOCR HrPIEBOmEYO4vEJ0KIrUyaB+UHn0C5aD1OzA09AjQ/4xZTSOW2w6jD/SdULaTFI1TiVA WOqA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qlLWQJnR; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f12-20020ae9ea0c000000b0078d6b577edfsi24058863qkg.728.2024.04.28.15.16.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Apr 2024 15:16:39 -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=qlLWQJnR; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s1CoT-00077d-7O; Sun, 28 Apr 2024 18:16: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 1s1CoO-00072R-26 for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:15:57 -0400 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s1CoM-0005eD-9T for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:15:55 -0400 Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-a58e787130fso204938966b.0 for ; Sun, 28 Apr 2024 15:15:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714342552; x=1714947352; 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=6pl64tl5YQ1s8CCdAHkFJJC3DjPcNFHytDHp/sUwDIA=; b=qlLWQJnReeS3YoeLxcTzzR9/4lIi/DsT/X+cjlHOgJqRHTftSDXM4zRkZiXPgg44Zj BeYLfZyotro96WdQFUeSIffRC72cdYzO3u2CkR0ZzOJQFJRzSbtTtbE+VYQGlyfUvJUY bun6VLkH+OCy0xHV1FffE9m00ouXHhr5O527XZLPmJC5GEMp/+wWqCUenZtpHLarfd3S lrv0H7V0GJ3w4fu26uzOPLOLTZSPzNBAYurehLskolgeTWYZ6dONd9lBgKMrh2OgF0F9 +68WBpbGIgtT26rIMerABRLwTSmjVRchV60HyIByzPc5aQ+cFXvdd1o5RL4N2bwCK+2J ki/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714342552; x=1714947352; 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=6pl64tl5YQ1s8CCdAHkFJJC3DjPcNFHytDHp/sUwDIA=; b=Pma81riL/7NV8pl2lkL7wiQdUgR99cQ4NKZC3atQHMMaJPCLev1m+rn9muEJmf+y9g TKPk45fXtNub5asDQ0degOa3ErfEXXIwNwG6z/6HwbWIbx4x7geztQv51k6+r3NpfArU JgqbYFfG5FYrvR+PpCy4sOnNu73kVKrQdLnzOu3UrUUpWl7BRasFnHfcCPEk2RPIO7AK JOygNXLkwQ86L9qY05239Gu4+EySbrAjFttAc89YksHj+Fxf/YIiOrWkUJXxypMmoBOc 8ki/cI91p8KtJSXpTQbIk6S9DvDVYR1zkBbYnMoW6OlOVHoDue5vz6+LJyWVFyPvQtrj 11kw== X-Gm-Message-State: AOJu0YwUFBg40Ue3vWVZDYpcHPRQMR1hJRnKl7kRNlcRgVF9xME7Jwsb yJYGPZiPJA/p+3IKyjGjipRnyLl64qtk8CD4jUOwlKpNTLvY5vXwk3R7l4vkvydawQuYWpfpHBi t X-Received: by 2002:a17:906:a216:b0:a58:bf24:edc7 with SMTP id r22-20020a170906a21600b00a58bf24edc7mr7487607ejy.20.1714342552492; Sun, 28 Apr 2024 15:15:52 -0700 (PDT) Received: from m1x-phil.lan ([176.176.142.130]) by smtp.gmail.com with ESMTPSA id bi10-20020a170906a24a00b00a54c12de34dsm13120778ejb.188.2024.04.28.15.15.51 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 28 Apr 2024 15:15:52 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Anton Johansson , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 11/24] accel/tcg: Allocate per-vCPU accel state in create_vcpu_thread() Date: Mon, 29 Apr 2024 00:14:37 +0200 Message-ID: <20240428221450.26460-12-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240428221450.26460-1-philmd@linaro.org> References: <20240428221450.26460-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::636; envelope-from=philmd@linaro.org; helo=mail-ej1-x636.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 Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- accel/tcg/vcpu-state.h | 7 +++++++ accel/tcg/tcg-accel-ops-mttcg.c | 2 ++ accel/tcg/tcg-accel-ops-rr.c | 2 ++ 3 files changed, 11 insertions(+) diff --git a/accel/tcg/vcpu-state.h b/accel/tcg/vcpu-state.h index e407d914df..d0dd1bbff8 100644 --- a/accel/tcg/vcpu-state.h +++ b/accel/tcg/vcpu-state.h @@ -8,6 +8,13 @@ #include "hw/core/cpu.h" +/** + * AccelCPUState: + */ +struct AccelCPUState { + /* Empty */ +}; + #ifdef CONFIG_USER_ONLY static inline TaskState *get_task_state(const CPUState *cs) { diff --git a/accel/tcg/tcg-accel-ops-mttcg.c b/accel/tcg/tcg-accel-ops-mttcg.c index c552b45b8e..767b321a0d 100644 --- a/accel/tcg/tcg-accel-ops-mttcg.c +++ b/accel/tcg/tcg-accel-ops-mttcg.c @@ -35,6 +35,7 @@ #include "tcg/startup.h" #include "tcg-accel-ops.h" #include "tcg-accel-ops-mttcg.h" +#include "accel/tcg/vcpu-state.h" typedef struct MttcgForceRcuNotifier { Notifier notifier; @@ -135,6 +136,7 @@ void mttcg_start_vcpu_thread(CPUState *cpu) char thread_name[VCPU_THREAD_NAME_SIZE]; g_assert(tcg_enabled()); + cpu->accel = g_new0(AccelCPUState, 1); tcg_cpu_init_cflags(cpu, current_machine->smp.max_cpus > 1); cpu->thread = g_new0(QemuThread, 1); diff --git a/accel/tcg/tcg-accel-ops-rr.c b/accel/tcg/tcg-accel-ops-rr.c index 894e73e52c..419b94f786 100644 --- a/accel/tcg/tcg-accel-ops-rr.c +++ b/accel/tcg/tcg-accel-ops-rr.c @@ -36,6 +36,7 @@ #include "tcg-accel-ops.h" #include "tcg-accel-ops-rr.h" #include "tcg-accel-ops-icount.h" +#include "accel/tcg/vcpu-state.h" /* Kick all RR vCPUs */ void rr_kick_vcpu_thread(CPUState *unused) @@ -314,6 +315,7 @@ void rr_start_vcpu_thread(CPUState *cpu) static QemuThread *single_tcg_cpu_thread; g_assert(tcg_enabled()); + cpu->accel = g_new0(AccelCPUState, 1); tcg_cpu_init_cflags(cpu, false); if (!single_tcg_cpu_thread) { From patchwork Sun Apr 28 22:14:38 2024 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: 792934 Delivered-To: patch@linaro.org Received: by 2002:adf:cc13:0:b0:346:15ad:a2a with SMTP id x19csp1423883wrh; Sun, 28 Apr 2024 15:17:34 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVBgN6kxPsUaeaP7kzE+wkG0n6Qt5oPt6ju4nGafH3KIx6s9KtH0IiKVvZWz3/5xsGY2zjhOO17lS13KlPs857p X-Google-Smtp-Source: AGHT+IEEMMreyfRGl/8m8BFnAkdnoTAhd9xBVJAWFZP1R1MFa563W3eUp63W8W2TI7WF3Uyehix0 X-Received: by 2002:a05:620a:2290:b0:790:6e28:17e5 with SMTP id o16-20020a05620a229000b007906e2817e5mr8693612qkh.55.1714342654381; Sun, 28 Apr 2024 15:17:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714342654; cv=none; d=google.com; s=arc-20160816; b=tP1/k/dcNqOEM+NC69O/s00pDZoxCszCZW7dQnZTtHQujGq4t3Nv31KENdsKQjIvun y2vsZrXEd34Vzzhod+Edc71I8xBBH25SNYX0p8oNs7hKFr+ay7VR1LLzqo2irsNapNXh hFDTSu9Ol05Zd2K3Xi7SJjcsg4S2ejCs7u7Mwv8qbfoqvyWT8DRCWZ3sn9wgs9509QET hsW7AdGtx9U4w57QD0ex0amCK2TKCgQFzBg+pyOkaqRrC6bQx3JLEjhLISrH/UVJW1eV L8Zgd5WslDZFWc0KiAZUtqhtaan8wb55BJqqVCvSLpDmLUyEHp4dyP7oR358ygEnzRie iulA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=D1rpAj6pG3Iu5Z1qjdM7/D8i4CzaRkhAeVl3d7RMB7A=; fh=+kTJNlX4d/Ktp/5WO5d77IkVGYcQ7tiev+NqB54rN/Q=; b=qxeUZuTF3MYZLYcHg+/BpO+pL7qm8lnzY/I9IgK5RgWa/MTRarCle1sDKBCkI6YKtZ DGJTEujeZE8hcmfe8TlXd023IBWlL2NK/sCTEjBRSFOjaQWXuW+nsk6ZLaA7ZFOzMNeL HhUC1AL6+jKZZ6hTtfggp8ADFBC0jgqFg617ImLC65II/fkCIy+Krbh/gMg2+AkqyDNL QYJyg+ShKKP+g2M3FHXrqJabfNzIitRxlw/1Z8UWU9CuzVRdYlktZ9RTR/QL1y0oAuoW IcZKvuymkonpoeD8v+lhFI+93RbDcYntbXr4oxZA1GMRuH0MPCOdnKQ2VSMrSnWwQhwk CqGw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="U/5fcXoU"; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f12-20020ae9ea0c000000b0078d6b577edfsi24060462qkg.728.2024.04.28.15.17.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Apr 2024 15:17:34 -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="U/5fcXoU"; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s1CoW-0007T1-Cu; Sun, 28 Apr 2024 18:16:04 -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 1s1CoU-0007GR-3i for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:16:02 -0400 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s1CoS-0005eX-8i for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:16:01 -0400 Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-51d62b0ecb7so1141231e87.3 for ; Sun, 28 Apr 2024 15:15:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714342558; x=1714947358; 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=D1rpAj6pG3Iu5Z1qjdM7/D8i4CzaRkhAeVl3d7RMB7A=; b=U/5fcXoUOKOPnspc0RX0xjPZE/g7ygw6nVeyohJcJ4m7gRBLSQzb/1x/qFJ/nanZC6 tTRx9+r+r17mlxbtLgPxMn5hEUoIKLd2VnB9SUf8jUxPYW9ROSCmge1F5gd5nba+AMdi zur/t74X/3oCeJ079QIgMtNFsJSsa1sVmR3BnbsezCnA9oqHE22Ff4lomST7T6YBQv5L Ok/WqooFRhRaarYM8ZGVXpc0BossbirYVJPCBfREPIT+X4t1LaScFfxYgrtCDDhuAFtY KtGKKXIc577SElHUGnzU1kiyuJHit+wIL7lRyRoRZdUxXF4FWThtdBMsevFuEq/lB0CE GlCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714342558; x=1714947358; 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=D1rpAj6pG3Iu5Z1qjdM7/D8i4CzaRkhAeVl3d7RMB7A=; b=jx1BYyyjWvxnTP/O4YPlwjhVzbZpAinOFTFVx9knURCnU5sfwWT8bsKBtDhApGJJoJ hS3G/nMo6rqXNi+tOc7eXqVY16VE7YIjW2w4pBChUzIrxGw5Gv890t7XarCFPAtF+rUM I0cEM0ey6LcQ4AwtD49eFQ5UGf4feye9DeqSuphBB2UpHFVEBDR+eJb/9ALP64XshnYy ARwNS41ONykmpSvOIlhA51vNd/82OMpe2rskkSrNBf3SROW5D64d5UAkwderzOa7rirZ H0AKNRCkXZ0pngzcs40OE3+f3uOWGa4/nwWaSm6BrOPj2gwUTGXkhDvQfypK0MoF+Imo Y/eQ== X-Gm-Message-State: AOJu0YxACsDDsr/RnbrXQfeyNA87oH9jBaUqQyXE7iohMju68Xq0McLr Vbuh2Bzv+x6DU4L+lkBDmbsKqqwJej06eCqsfb+I/oGa50m7ysEceVzV3EW7Dn5lFEAhX5ViSn6 e X-Received: by 2002:a05:6512:3196:b0:51d:3675:6a06 with SMTP id i22-20020a056512319600b0051d36756a06mr3815783lfe.66.1714342557839; Sun, 28 Apr 2024 15:15:57 -0700 (PDT) Received: from m1x-phil.lan ([176.176.142.130]) by smtp.gmail.com with ESMTPSA id l18-20020a170906645200b00a55bb18e3d7sm8230871ejn.168.2024.04.28.15.15.56 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 28 Apr 2024 15:15:57 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Anton Johansson , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 12/24] accel/tcg: Move TaskState from CPUState to TCG AccelCPUState Date: Mon, 29 Apr 2024 00:14:38 +0200 Message-ID: <20240428221450.26460-13-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240428221450.26460-1-philmd@linaro.org> References: <20240428221450.26460-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12b; envelope-from=philmd@linaro.org; helo=mail-lf1-x12b.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 TaskState is specific to TCG user emulation, move it to AccelCPUState. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- accel/tcg/vcpu-state.h | 6 ++++-- include/hw/core/cpu.h | 2 -- bsd-user/main.c | 2 +- linux-user/main.c | 2 +- linux-user/syscall.c | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/accel/tcg/vcpu-state.h b/accel/tcg/vcpu-state.h index d0dd1bbff8..cf8e3acef9 100644 --- a/accel/tcg/vcpu-state.h +++ b/accel/tcg/vcpu-state.h @@ -12,13 +12,15 @@ * AccelCPUState: */ struct AccelCPUState { - /* Empty */ +#ifdef CONFIG_USER_ONLY + TaskState *ts; +#endif }; #ifdef CONFIG_USER_ONLY static inline TaskState *get_task_state(const CPUState *cs) { - return cs->opaque; + return cs->accel->ts; } #endif diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 46b99a7ea5..9b99d8e8fe 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -490,8 +490,6 @@ struct CPUState { QTAILQ_HEAD(, CPUWatchpoint) watchpoints; CPUWatchpoint *watchpoint_hit; - void *opaque; - /* In order to avoid passing too many arguments to the MMIO helpers, * we store some rarely used information in the CPU context. */ diff --git a/bsd-user/main.c b/bsd-user/main.c index 29a629d877..1ce4b0b6e4 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -590,7 +590,7 @@ int main(int argc, char **argv) init_task_state(ts); ts->info = info; ts->bprm = &bprm; - cpu->opaque = ts; + cpu->accel->ts = ts; target_set_brk(info->brk); syscall_init(); diff --git a/linux-user/main.c b/linux-user/main.c index 94e4c47f05..5f7f03f4b0 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -949,7 +949,7 @@ int main(int argc, char **argv, char **envp) /* build Task State */ ts->info = info; ts->bprm = &bprm; - cpu->opaque = ts; + cpu->accel->ts = ts; task_settid(ts); fd_trans_init(); diff --git a/linux-user/syscall.c b/linux-user/syscall.c index b9b5a387b3..49db3052aa 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -6594,7 +6594,7 @@ static int do_fork(CPUArchState *env, unsigned int flags, abi_ulong newsp, cpu_clone_regs_child(new_env, newsp, flags); cpu_clone_regs_parent(env, flags); new_cpu = env_cpu(new_env); - new_cpu->opaque = ts; + new_cpu->accel->ts = ts; ts->bprm = parent_ts->bprm; ts->info = parent_ts->info; ts->signal_mask = parent_ts->signal_mask; From patchwork Sun Apr 28 22:14:39 2024 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: 792926 Delivered-To: patch@linaro.org Received: by 2002:adf:cc13:0:b0:346:15ad:a2a with SMTP id x19csp1423593wrh; Sun, 28 Apr 2024 15:16:31 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXbGfxoIxXIppMUGskZllh8z8JyRcQOlsPBL5c7kJy5vBfun1U+lp3eOZd8GuOpRvt9U7T+PUo4CsHdNDly5PrO X-Google-Smtp-Source: AGHT+IGCDo1G0aZ68eVRMLBV9aM6wfzl96qS3WzMXXwTwPK+Wy5y+7QV7JMGhj70jqeQNB5bWLtP X-Received: by 2002:a05:6358:6e87:b0:17e:6a5b:4d3a with SMTP id q7-20020a0563586e8700b0017e6a5b4d3amr9828645rwm.8.1714342590984; Sun, 28 Apr 2024 15:16:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714342590; cv=none; d=google.com; s=arc-20160816; b=gdFelPNxJmBj1X6FktW7HScD67JxXAP/c5wcNwqIP21CvjYRyk1pfmFtDPuDsWiyks kHJjGMbMF6NmMztmok32WqXCa7XR7LC9lmWaM/inKLAVC0gvT1wcYFrWYJ3KNBfNuuqS Qo9XNf0xjZ/P081oTfv/tMvShVZp+MjneYX5fvRmZiIBhe/4Dnxnxl0/XcWKIiPHICDa csZE36tkz/2ikbjX84TbQ1zIYt95blyGoRpwz5sHXdBCBeiYZUlsjZIr8Cd6FxB0XAEq zZMyzZXybhmDetv1ZwS9aICsed6F0fk0bLJOyHQrPzTECijJ3Ig+aPrbcIa5PeScQ/PF zLFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=wMrSi6a9YnmKRxRGwae1/x8KkxNfv7crj6dkQDrCI20=; fh=+kTJNlX4d/Ktp/5WO5d77IkVGYcQ7tiev+NqB54rN/Q=; b=B4KrXrAm0dkpgs5EK1Q4gZ8sLaIfHS80PyNIBjSOPDD0wsWcJSmAJhrAYoU/5rYUw+ k22NeA+gYog/q7ONn8uhwW5RwihzJLx9Ts0UX3yDhQwjFcbE/U5Iyb09Eejnx8wpTwpq Lxk69D4os+cc7az/3wTn7h1DmD7IbnVA/h8wQ2MNZXJ1Rys0KiX2cV6lDOf1pOHrKsAv FiCEU/n2gWf2QFNfEO1nWCv8Ezh0Bre6JU7EpDZcvBS30OMMN/uDO0E7Hs4a9kU7veCA IyXr49JNgNscY5CaZcnKSQLiz8Mtufcup6vvq6aeXUy88O//Hn4Sm25evUtOFw8D368O KIfg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pTRk8nm6; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 9-20020a0562140dc900b006a08e93d5b7si13299682qvt.295.2024.04.28.15.16.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Apr 2024 15:16:30 -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=pTRk8nm6; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s1Coj-00085r-9m; Sun, 28 Apr 2024 18:16:20 -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 1s1CoY-0007r2-TS for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:16:07 -0400 Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s1CoX-0005er-7V for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:16:06 -0400 Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-56e37503115so3952395a12.1 for ; Sun, 28 Apr 2024 15:16:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714342563; x=1714947363; 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=wMrSi6a9YnmKRxRGwae1/x8KkxNfv7crj6dkQDrCI20=; b=pTRk8nm6qeMSzBaTgfaEUxgPkHoySIiAGJ9INtt4Uw7g+QL/PlE5s1AwG3RbRiK30K J5uUM8lu2gI8HORSy7+xBRVcVPyhlS62x1xsaUobfjlBq+F54PxrukuDIxj+tPEttql8 4ZkB5jxPW0AMA3gJeh9TRf0t62FEzFacYbXDXjZU6akrHRqOKSYb7G6G6loOGR6HNBUi 1VN270hTkyV3nn61c+xAwEwNIQKOTHSYr0pIuiJdbLneyZ2fjaWG4lr9O7JtQx7VorAP AH3A+2P9dmGEV1kYjb0ex71JdmVMfJjuyDZoez53hp7RRaFgNmGRypi6cY1UDfMPRcnj T6ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714342563; x=1714947363; 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=wMrSi6a9YnmKRxRGwae1/x8KkxNfv7crj6dkQDrCI20=; b=NyXrd1I6IHcZvfZAW8/XnTDXSNyVz8otySLn9r5zalt9bclr0HELCZrePZoOIh/Ngw prqPEHnLQBxxuqk+q4M9g02zlXg+uRbDbS0Yu5jiMbm1vf0pfURX3nTe14M3Szo65al/ xmAZoZ46y1mjYVzZVcQ1q001nuAxCEOan61XjaJi8G/TmIwiZyMRt5b15TojMTOnI/Hs 3Ht80nk9UpNdFkfCnkIksmxeDr8pWs4GHNL0kSlDdvzoL9I/L0UwFcqnKYfLR+5XX56P miLjLZ58lsIaJIAtbK1NZQzn6oWNJ/Dwbi5YDkhcYuMS9wluF1XLqDwVYG/cgQU+g0W4 782A== X-Gm-Message-State: AOJu0Yw3fNj/NpACU7dpTeWuLntRfaPQiSsYoxWTRuswbNLVfT0tlSJh HKYopoGS7YDLfdJ3AJdNhjycbatYA/HdEdEuOJYDHNr1aPsuL4FrMQ755nnieZ1gtKrxCCngZDw 7 X-Received: by 2002:a17:906:11d2:b0:a58:e789:8eb7 with SMTP id o18-20020a17090611d200b00a58e7898eb7mr2697411eja.74.1714342563336; Sun, 28 Apr 2024 15:16:03 -0700 (PDT) Received: from m1x-phil.lan ([176.176.142.130]) by smtp.gmail.com with ESMTPSA id bb6-20020a1709070a0600b00a55b020a821sm9253199ejc.13.2024.04.28.15.16.02 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 28 Apr 2024 15:16:02 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Anton Johansson , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 13/24] accel/tcg: Update CPUNegativeOffsetState::can_do_io field documentation Date: Mon, 29 Apr 2024 00:14:39 +0200 Message-ID: <20240428221450.26460-14-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240428221450.26460-1-philmd@linaro.org> References: <20240428221450.26460-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52e; envelope-from=philmd@linaro.org; helo=mail-ed1-x52e.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 The @can_do_io field got moved from CPUState to CPUNegativeOffsetState in commit 464dacf609 ("accel/tcg: Move can_do_io to CPUNegativeOffsetState"). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- include/hw/core/cpu.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 9b99d8e8fe..beb37342e9 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -338,9 +338,10 @@ typedef union IcountDecr { } u16; } IcountDecr; -/* - * Elements of CPUState most efficiently accessed from CPUArchState, - * via small negative offsets. +/** + * CPUNegativeOffsetState: Elements of CPUState most efficiently accessed + * from CPUArchState, via small negative offsets. + * @can_do_io: True if memory-mapped IO is allowed. */ typedef struct CPUNegativeOffsetState { CPUTLB tlb; @@ -400,7 +401,6 @@ struct qemu_work_item; * @crash_occurred: Indicates the OS reported a crash (panic) for this CPU * @singlestep_enabled: Flags for single-stepping. * @icount_extra: Instructions until next timer event. - * @neg.can_do_io: True if memory-mapped IO is allowed. * @cpu_ases: Pointer to array of CPUAddressSpaces (which define the * AddressSpaces this CPU has) * @num_ases: number of CPUAddressSpaces in @cpu_ases From patchwork Sun Apr 28 22:14:40 2024 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: 792929 Delivered-To: patch@linaro.org Received: by 2002:adf:cc13:0:b0:346:15ad:a2a with SMTP id x19csp1423604wrh; Sun, 28 Apr 2024 15:16:32 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX5c/7PJvBuNS5QonI6svJCAh7Cd4jTxRyKukrDRZM9gGSG3fxKC0xMkh7GohlKT3MM7v6lw3LAOZ7n63Vbpa0l X-Google-Smtp-Source: AGHT+IGGIvC0XwQGtAQqFdes+/IkebDLzCI5cL1noCkQq1nMruUVqMuNk8e/7ZufYDsnEteuxjGi X-Received: by 2002:a05:6808:1a0d:b0:3c7:493a:e6ec with SMTP id bk13-20020a0568081a0d00b003c7493ae6ecmr12812611oib.3.1714342592422; Sun, 28 Apr 2024 15:16:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714342592; cv=none; d=google.com; s=arc-20160816; b=TKy3R+pKd5L276NmJmH0eBAt2vi2BD2gzqkbpxT+Y6Cz55LQuDE1pQeHjA28iSFPxu NznbaI46D6CQFnjFq3Ddq3xFQ0poAYOVa7VKrhsXnhTMBjU6rYzyCTNbk+JmRkPtGEss 6JYSZS0WFg2BUTpFk4MW6X1W9WuZktODEPjLgo2OpInkeaacrSqo+wNNz6HnXzUQa1O6 IiZc3phSqXmX+79JBALnR+0lKEWMm6F+9cSfnVJuYgrIf4qq2EORl75ugffBsTQyThM5 t/7vpvWsK2+OxPks8yPVyJXnVbOAGfwn9bc2WtOR6jBWFwt4tVkfojPajEzNd3OcIeX3 tgaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=KhMcuO2jMQJAbbwElnMhrHO7OE3zltzzXLVSHanA6Q0=; fh=+kTJNlX4d/Ktp/5WO5d77IkVGYcQ7tiev+NqB54rN/Q=; b=bcjosvTxYkWIBuDMPvwM30neUKO3P+QkgKa6ZFhC6Jon/YS91Ks+nYf2reNDEobUci 3TrQDd2K2AVtDELxu/SDDtgti0/7JZK55MnHS5TFYUx9W5i+sKdR5eCYtkDSXSXMf5T5 wTK1AE4pVPHqdLRi8srTRBEgqNHpaEmwb5umEr2xOmJXffAv8xJ4oF5bNQ0zZpW9LGLt V4gTVHVDy+RapG1CISr9OaKLuegitidgSjnOitAex0OcpC0yLBYyfyiOLZu8ENkpB9ES 9sGgCUoNo8bjBGya7ReSByaMSgF1VSfMtCQy3jZn+qiiGCPo06hCqnrj/6Yf3wczet0H GNMw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eftI45vf; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c7-20020a37e107000000b0078d6021f9b6si24386327qkm.545.2024.04.28.15.16.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Apr 2024 15:16:32 -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=eftI45vf; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s1Cot-0008Rv-OW; Sun, 28 Apr 2024 18:16:27 -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 1s1Cof-0008B4-Gm for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:16:16 -0400 Received: from mail-ej1-x629.google.com ([2a00:1450:4864:20::629]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s1Cod-0005fY-Lh for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:16:13 -0400 Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-a58e2740cd7so241836166b.1 for ; Sun, 28 Apr 2024 15:16:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714342568; x=1714947368; 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=KhMcuO2jMQJAbbwElnMhrHO7OE3zltzzXLVSHanA6Q0=; b=eftI45vfnyvYf/1+jlGaxzH0eePPlrwogJLcMSJgE1BWZqQ7ulLVRyRlxm1kuGZgqG MjmTe5h/dBOsAyt/HWeBdE3NUKtKKXaLji0Azc17Tnr6emh75GsvVK+PuwO2p6hTPqAS g9l2adyA84xLoAzlaW3r00qZ1yq7C76lFISzij97MMjEEmCki8l3OG/iUE+xLrS/3DjB DBhlsN/8Y+V6f1Vwxbr0WBoTZbKRCSC/64X4Lzm5cuk9/0HtUioBRbfEInbmhGq/gnXa 9pC440YzNySHbGdrG7xSocYr5DpxMRP+MOtCyNBQ9Drj6xcbewT6z5aYIqu4hpaaR5sa TQ0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714342568; x=1714947368; 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=KhMcuO2jMQJAbbwElnMhrHO7OE3zltzzXLVSHanA6Q0=; b=VRCbymkC08Usbc/uZVk1hsrpxUJj2cJQJNuuqQnOw2RZjMasgSGhCn3wsijl/E8zLO qfjtpL8HaXfzTIyfnk222lDkRi+4c5DIlL4LrEtUQTwDkDs4jGzrUQ8tDMKRjnTtYtPu 1M4LyOVNMGuW5qoAUu4Iq7GJPVbYCZ/NC5AlZoB8OFO8zWXZqR73gCc56WZP9ygRALNf HyZMYi3qSD2f5CtdG3QIN3jHJSc9i2cWCg7m3K7Rs0EuaxifaVB3DikTRXrg5/NrvtpK fwqK+p6e8SXa/+R5YtR7K1/5rOdhMIb4H/yszDXlVg/rly9lu48gDzqgkXtO/3yq7U0+ YfAg== X-Gm-Message-State: AOJu0YzeI4mvnQ0C21VgrUqVh+GPN/yR5GRY/cBui8LpDpMGLg+Cl0vr QPQfryxdGHRTWaxWYBboigI4jqjmy7RUm4dicZUZZLlGGrYD9Y2yIIVRw9kXQNKcZviJm+BethA s X-Received: by 2002:a17:906:4945:b0:a58:e3d5:87bd with SMTP id f5-20020a170906494500b00a58e3d587bdmr4719333ejt.26.1714342568692; Sun, 28 Apr 2024 15:16:08 -0700 (PDT) Received: from m1x-phil.lan ([176.176.142.130]) by smtp.gmail.com with ESMTPSA id i8-20020a170906264800b00a52433f0907sm13199806ejc.37.2024.04.28.15.16.07 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 28 Apr 2024 15:16:08 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Anton Johansson , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 14/24] accel/tcg: Move plugin fields to CPUNegativeOffsetState Date: Mon, 29 Apr 2024 00:14:40 +0200 Message-ID: <20240428221450.26460-15-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240428221450.26460-1-philmd@linaro.org> References: <20240428221450.26460-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::629; envelope-from=philmd@linaro.org; helo=mail-ej1-x629.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 Signed-off-by: Philippe Mathieu-Daudé --- include/hw/core/cpu.h | 22 ++++++++++------------ include/qemu/plugin.h | 2 +- accel/tcg/plugin-gen.c | 8 +++++--- hw/core/cpu-common.c | 2 +- plugins/core.c | 8 ++++---- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index beb37342e9..ef8b85b6fe 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -342,9 +342,18 @@ typedef union IcountDecr { * CPUNegativeOffsetState: Elements of CPUState most efficiently accessed * from CPUArchState, via small negative offsets. * @can_do_io: True if memory-mapped IO is allowed. + * @plugin_mem_cbs: active plugin memory callbacks + * @plugin_state: per-CPU plugin state */ typedef struct CPUNegativeOffsetState { CPUTLB tlb; +#ifdef CONFIG_PLUGIN + /* + * The callback pointer are accessed via TCG (see gen_empty_mem_helper). + */ + GArray *plugin_mem_cbs; + CPUPluginState *plugin_state; +#endif IcountDecr icount_decr; bool can_do_io; } CPUNegativeOffsetState; @@ -416,8 +425,6 @@ struct qemu_work_item; * @kvm_fd: vCPU file descriptor for KVM. * @work_mutex: Lock to prevent multiple access to @work_list. * @work_list: List of pending asynchronous work. - * @plugin_mem_cbs: active plugin memory callbacks - * @plugin_state: per-CPU plugin state * @ignore_memory_transaction_failures: Cached copy of the MachineState * flag of the same name: allows the board to suppress calling of the * CPU do_transaction_failed hook function. @@ -508,15 +515,6 @@ struct CPUState { /* Use by accel-block: CPU is executing an ioctl() */ QemuLockCnt in_ioctl_lock; -#ifdef CONFIG_PLUGIN - /* - * The callback pointer stays in the main CPUState as it is - * accessed via TCG (see gen_empty_mem_helper). - */ - GArray *plugin_mem_cbs; - CPUPluginState *plugin_state; -#endif - /* TODO Move common fields from CPUArchState here. */ int cpu_index; int cluster_index; @@ -1120,7 +1118,7 @@ void cpu_watchpoint_remove_all(CPUState *cpu, int mask); static inline bool cpu_plugin_mem_cbs_enabled(const CPUState *cpu) { #ifdef CONFIG_PLUGIN - return !!cpu->plugin_mem_cbs; + return !!cpu->neg.plugin_mem_cbs; #else return false; #endif diff --git a/include/qemu/plugin.h b/include/qemu/plugin.h index 41db748eda..99a32446e9 100644 --- a/include/qemu/plugin.h +++ b/include/qemu/plugin.h @@ -229,7 +229,7 @@ void qemu_plugin_add_dyn_cb_arr(GArray *arr); static inline void qemu_plugin_disable_mem_helpers(CPUState *cpu) { - cpu->plugin_mem_cbs = NULL; + cpu->neg.plugin_mem_cbs = NULL; } /** diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c index cd78ef94a1..3766870108 100644 --- a/accel/tcg/plugin-gen.c +++ b/accel/tcg/plugin-gen.c @@ -178,7 +178,7 @@ static void gen_empty_mem_helper(void) TCGv_ptr ptr = tcg_temp_ebb_new_ptr(); tcg_gen_movi_ptr(ptr, 0); - tcg_gen_st_ptr(ptr, tcg_env, offsetof(CPUState, plugin_mem_cbs) - + tcg_gen_st_ptr(ptr, tcg_env, offsetof(CPUState, neg.plugin_mem_cbs) - offsetof(ArchCPU, env)); tcg_temp_free_ptr(ptr); } @@ -634,7 +634,8 @@ void plugin_gen_disable_mem_helpers(void) return; } tcg_gen_st_ptr(tcg_constant_ptr(NULL), tcg_env, - offsetof(CPUState, plugin_mem_cbs) - offsetof(ArchCPU, env)); + offsetof(CPUState, neg.plugin_mem_cbs) - + offsetof(ArchCPU, env)); } static void plugin_gen_tb_udata(const struct qemu_plugin_tb *ptb, @@ -871,7 +872,8 @@ bool plugin_gen_tb_start(CPUState *cpu, const DisasContextBase *db, { bool ret = false; - if (test_bit(QEMU_PLUGIN_EV_VCPU_TB_TRANS, cpu->plugin_state->event_mask)) { + if (test_bit(QEMU_PLUGIN_EV_VCPU_TB_TRANS, + cpu->neg.plugin_state->event_mask)) { struct qemu_plugin_tb *ptb = tcg_ctx->plugin_tb; int i; diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c index cbafc79033..3e00ea94be 100644 --- a/hw/core/cpu-common.c +++ b/hw/core/cpu-common.c @@ -213,7 +213,7 @@ static void cpu_common_realizefn(DeviceState *dev, Error **errp) /* Plugin initialization must wait until the cpu start executing code */ #ifdef CONFIG_PLUGIN if (tcg_enabled()) { - cpu->plugin_state = qemu_plugin_create_vcpu_state(); + cpu->neg.plugin_state = qemu_plugin_create_vcpu_state(); async_run_on_cpu(cpu, qemu_plugin_vcpu_init__async, RUN_ON_CPU_NULL); } #endif diff --git a/plugins/core.c b/plugins/core.c index 09c98382f5..1286a18f09 100644 --- a/plugins/core.c +++ b/plugins/core.c @@ -55,7 +55,7 @@ struct qemu_plugin_ctx *plugin_id_to_ctx_locked(qemu_plugin_id_t id) static void plugin_cpu_update__async(CPUState *cpu, run_on_cpu_data data) { - bitmap_copy(cpu->plugin_state->event_mask, + bitmap_copy(cpu->neg.plugin_state->event_mask, &data.host_ulong, QEMU_PLUGIN_EV_MAX); tcg_flush_jmp_cache(cpu); } @@ -396,7 +396,7 @@ qemu_plugin_vcpu_syscall(CPUState *cpu, int64_t num, uint64_t a1, uint64_t a2, struct qemu_plugin_cb *cb, *next; enum qemu_plugin_event ev = QEMU_PLUGIN_EV_VCPU_SYSCALL; - if (!test_bit(ev, cpu->plugin_state->event_mask)) { + if (!test_bit(ev, cpu->neg.plugin_state->event_mask)) { return; } @@ -418,7 +418,7 @@ void qemu_plugin_vcpu_syscall_ret(CPUState *cpu, int64_t num, int64_t ret) struct qemu_plugin_cb *cb, *next; enum qemu_plugin_event ev = QEMU_PLUGIN_EV_VCPU_SYSCALL_RET; - if (!test_bit(ev, cpu->plugin_state->event_mask)) { + if (!test_bit(ev, cpu->neg.plugin_state->event_mask)) { return; } @@ -496,7 +496,7 @@ void exec_inline_op(struct qemu_plugin_dyn_cb *cb, int cpu_index) void qemu_plugin_vcpu_mem_cb(CPUState *cpu, uint64_t vaddr, MemOpIdx oi, enum qemu_plugin_mem_rw rw) { - GArray *arr = cpu->plugin_mem_cbs; + GArray *arr = cpu->neg.plugin_mem_cbs; size_t i; if (arr == NULL) { From patchwork Sun Apr 28 22:14:41 2024 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: 792942 Delivered-To: patch@linaro.org Received: by 2002:adf:cc13:0:b0:346:15ad:a2a with SMTP id x19csp1424202wrh; Sun, 28 Apr 2024 15:18:51 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUpzAJOSeBo+JhM8IlKZagvpjcM7E6P6DxvrTErmcF5kxIPro+LMnZzUK55OwLF/wWpDrBPAmlF7AUBvPCVDk21 X-Google-Smtp-Source: AGHT+IE0yr9AMz6LPxbcAtV5jzWEsX907PZyWsipabSRu6I1mpv8QheZz2zxsbMDYx0aTYyZvfW1 X-Received: by 2002:a05:6359:65cc:b0:181:601f:d8f with SMTP id ym12-20020a05635965cc00b00181601f0d8fmr12576394rwb.2.1714342731373; Sun, 28 Apr 2024 15:18:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714342731; cv=none; d=google.com; s=arc-20160816; b=TH/RLXRQSFs8Z1oEA51JReraQh6RbPjxNCx6BFQDgsq1FFJDS+nqhxxKlXUVaVFfkb TL9SI0yK2U7tHm3kV1IvIE7NfULNNSmKQSe/c2YboKshKtNOUchc/M65SZNq1Qq7PJGl lUk6O0rBFWVBy/XPInaXJB243rNPdPFnm8MxUNGUOila/wNbpiEJc/YefWJYLNajWRVf W/Svli+vP+W2VI2ReHKrEr2zBAcneZS+KXjErSmIalIr03oAkXX9Z8JLKcC9QVB1g0h+ sLtkcn0K9Nj3Yumwk1dclNteCOHk/9mXbGcp+1fQTED4UKd8ILx9YFNzT0gVDZQn6m6P y5dQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=h6EbUiH0Q23M0FjKSUv3qw/noMjcf2vJ04Bs/jaSM9I=; fh=+kTJNlX4d/Ktp/5WO5d77IkVGYcQ7tiev+NqB54rN/Q=; b=O0rRdpo5e3pFPa3TLXwtMcd0HETxhEMdJB6ttSf2SiYo/sPZPnmDabziI1BaulqAaS Z1ccyWuYRerevWHj9WMD4aheMTWVjjyTSimeC3KAbobwx4jac1vJgiMW54BA7a+FTc6x Uvx9eOgVVkpiG4B6s8GeZRzSoNhd1ZvEwgQbTWuMxBXCdbx5Wf4TMlUMcCS0wtqI52Jc E5CbkLniwFpn39EeQemciBU0qXtcgcHdHJMKNiZlqPrGzeTOJ0P06cq2Mz6ZPkX8OcYV xxyjEeRUjuenVjBNR+0U2gW2CQ9o3/ZzEFZXAlaatg+i5iUVkx0Dy2oBYPvUC4qV74GR Cp4A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="FbGoi/44"; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id m2-20020ad45dc2000000b006a0b85bc31csi4671060qvh.303.2024.04.28.15.18.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Apr 2024 15:18:51 -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="FbGoi/44"; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s1Cov-0000HN-4Z; Sun, 28 Apr 2024 18:16:29 -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 1s1Col-0008Fh-Nc for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:16:22 -0400 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s1Coh-0005fy-RE for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:16:17 -0400 Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-a58ebdd8b64so112212566b.0 for ; Sun, 28 Apr 2024 15:16:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714342574; x=1714947374; 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=h6EbUiH0Q23M0FjKSUv3qw/noMjcf2vJ04Bs/jaSM9I=; b=FbGoi/44IKm7FwtF0l2gYiXnMQlnd6VEBLjOGqyueS2HoA1wVcZ0sv+s5wTembXKdB mIRgRwFpZuSHn8lL6KNWhjswy17JNDfh7owq9maHhSk0OTlCZ/ZbbcmoG+lfG3X4hy1P QsS6qcaawu5u4UogpM00i8rFjcrcuBTqTLFgjUo+A20J7mEJYTeUYgou26IlQJol/YKh jCtwLaHaTGQhbnn3cNQeh6fGHnuodrfqWpGqwRfw5hxE91ZmVj9OkKmiDSIHOIfR+nTz 2JbURZdP6V1xkT6oRBwZQjVRbuzeTbDAeXJfPKEIkkDFGoAqtWHNeQ3eq8E4mkF4+xw3 DP1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714342574; x=1714947374; 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=h6EbUiH0Q23M0FjKSUv3qw/noMjcf2vJ04Bs/jaSM9I=; b=QkqSgTLdFsxHOVzxifRvTy+9jKkvQW8X+dLTXhJD/pyKrG+jl9GvEljMUQXE9/1sDw uiCiuekYGq4WMjxwGixgCuJj0ASFXGe5zUw2xkjH1+3nfbo9c8lLS2uu7ZKa+tbUWt5X 7srWehsXjXo9JjrMWtbfLYo7i+PYfkJE0yS9a+Nv7VpIa7XcqoqZ+i2K4AibGFxdOvNx 3JqaOMUPb02twNSlvbYYdU9Sp2X4vCva3uzlM5+LoAUqAyISSEKeTyS/Pkz7CxOe6lHT MgRcvG8KvnhBOAfr75lGIvB0IS5NMsozR8bdL0xTIv6lgG2Tk4iSPzB6WqoMFumik004 HKlg== X-Gm-Message-State: AOJu0Yyugdjk1gjOmg+qockZNUdFu6hKTAjvCAVTFYgQFdbsSfeMbUEA j5sDTVRFDf6/56TNO7wsgw6vwxocmkDUPocJlKMxzAy6csEj1bwMQaocOJtHsAhcS+/Dp21DTMl S X-Received: by 2002:a17:906:470d:b0:a52:5925:2a31 with SMTP id y13-20020a170906470d00b00a5259252a31mr5118406ejq.29.1714342574107; Sun, 28 Apr 2024 15:16:14 -0700 (PDT) Received: from m1x-phil.lan ([176.176.142.130]) by smtp.gmail.com with ESMTPSA id dq16-20020a170907735000b00a524318c380sm13190910ejc.80.2024.04.28.15.16.13 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 28 Apr 2024 15:16:13 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Anton Johansson , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 15/24] accel/tcg: Restrict IcountDecr and CPUTLB to TCG Date: Mon, 29 Apr 2024 00:14:41 +0200 Message-ID: <20240428221450.26460-16-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240428221450.26460-1-philmd@linaro.org> References: <20240428221450.26460-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62c; envelope-from=philmd@linaro.org; helo=mail-ej1-x62c.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 IcountDecr union, the CPUTLB* structures and the "exec/tlb-common.h" header are only required for TCG. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Reviewed-by: Richard Henderson --- include/exec/tlb-common.h | 4 ++++ include/hw/core/cpu.h | 9 ++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/include/exec/tlb-common.h b/include/exec/tlb-common.h index dc5a5faa0b..a529c9f056 100644 --- a/include/exec/tlb-common.h +++ b/include/exec/tlb-common.h @@ -19,6 +19,10 @@ #ifndef EXEC_TLB_COMMON_H #define EXEC_TLB_COMMON_H 1 +#ifndef CONFIG_TCG +#error Can only include this header with TCG +#endif + #define CPU_TLB_ENTRY_BITS 5 /* Minimalized TLB entry for use by TCG fast path. */ diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index ef8b85b6fe..dc28920bcc 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -27,7 +27,6 @@ #include "exec/vaddr.h" #include "exec/memattrs.h" #include "exec/mmu-access-type.h" -#include "exec/tlb-common.h" #include "qapi/qapi-types-run-state.h" #include "qemu/bitmap.h" #include "qemu/rcu_queue.h" @@ -256,6 +255,9 @@ typedef struct CPUTLBEntryFull { } extra; } CPUTLBEntryFull; +#ifdef CONFIG_TCG +#include "exec/tlb-common.h" + /* * Data elements that are per MMU mode, minus the bits accessed by * the TCG fast path. @@ -311,11 +313,9 @@ typedef struct CPUTLBCommon { * negative offsets are at the end of the struct. */ typedef struct CPUTLB { -#ifdef CONFIG_TCG CPUTLBCommon c; CPUTLBDesc d[NB_MMU_MODES]; CPUTLBDescFast f[NB_MMU_MODES]; -#endif } CPUTLB; /* @@ -337,6 +337,7 @@ typedef union IcountDecr { #endif } u16; } IcountDecr; +#endif /** * CPUNegativeOffsetState: Elements of CPUState most efficiently accessed @@ -346,6 +347,7 @@ typedef union IcountDecr { * @plugin_state: per-CPU plugin state */ typedef struct CPUNegativeOffsetState { +#ifdef CONFIG_TCG CPUTLB tlb; #ifdef CONFIG_PLUGIN /* @@ -356,6 +358,7 @@ typedef struct CPUNegativeOffsetState { #endif IcountDecr icount_decr; bool can_do_io; +#endif } CPUNegativeOffsetState; struct KVMState; From patchwork Sun Apr 28 22:14:42 2024 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: 792941 Delivered-To: patch@linaro.org Received: by 2002:adf:cc13:0:b0:346:15ad:a2a with SMTP id x19csp1424164wrh; Sun, 28 Apr 2024 15:18:43 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVNl1/0grpYArD6FHuRzz+b3H1gDvzL/tBIMAtyhWHaIxlKbtiKxQhXo4RGkKjyiY54HFEDO2rOT/RLBQPk0NhZ X-Google-Smtp-Source: AGHT+IGj6rRn4MpWyMusfNRK8EoTaikkaY+E0pj1yHv2KRcpY/iTr3Dg5WwY/UJA8RPd/XdmfUhv X-Received: by 2002:a05:622a:1452:b0:43a:df5e:b66e with SMTP id v18-20020a05622a145200b0043adf5eb66emr1708394qtx.35.1714342723331; Sun, 28 Apr 2024 15:18:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714342723; cv=none; d=google.com; s=arc-20160816; b=ifkbyDsMdrwdr6HIqgV237WuiTuD9kSlOkTWCjrJDK8BsxgQ1lW9IkAytKYYy88JT/ Nay+7qqPfNlEmsWDicsbK63hZaTsWzLHin/HU4ANQa/xqAhg7GH2hjQZVViJqWxa0Hi1 Dtfj/OHePCv25JNiiQY5EqOfgZHODuzhIRdOarXt0bXHhVXVSfBhW/hrUJYJIQiTxlj8 PYtOP/TWXW3QtW3bm7G/wc9MReTYugla+6Ha3bJSf7K4DAVyyoMY/CRQKEAGbQw4wP0n sf++domjjyJvBgtOQomAMswMX1rN3sStgQgrSzUSmvA4qWDvABqUTIKcddCpmHWeD/Dv pAlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=PypuXO6MWd/PfirCZaShH9WcvTwY8whCrxRa/JQC3P4=; fh=+kTJNlX4d/Ktp/5WO5d77IkVGYcQ7tiev+NqB54rN/Q=; b=muGQ+ioljMeG0GXJk1/63bBGZfAsdsiEsKzXgvj0v4iQQ0XkqF6WwGUDnkHOL1kAM/ dxYVYkk83zwnaC7fp7xMbxje70bEEpsuLORmtOt72RSn4/o5u5i//+ywgYPPcaofEURs b/6sgqdiCM+rUT7fDsQ3/IgGyCvqaWZZU7+sLH9/PeeaRIcijDC4ftdHInO0EOBGptN+ dU5GisjhiX6DeqdzlVyrS6YN/2xQc0uZpH38uUVUc+WEy1RAiRX9uciM3Fm4wMCte6RX JjxwW4jEe6nu7rObdz9FJq3zypqcNvxOlbyByLG+JBibP5+CsD0BJSXUffZocbCUlHfv xvFA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=abTo3YuY; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s8-20020a05622a1a8800b0043a4b3c72e4si9080845qtc.0.2024.04.28.15.18.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Apr 2024 15:18:43 -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=abTo3YuY; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s1Cov-0000Qr-VW; Sun, 28 Apr 2024 18:16:30 -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 1s1Coq-0008Ll-Bs for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:16:26 -0400 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s1Con-0005gJ-Lx for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:16:24 -0400 Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-51ae315bb20so4597020e87.1 for ; Sun, 28 Apr 2024 15:16:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714342579; x=1714947379; 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=PypuXO6MWd/PfirCZaShH9WcvTwY8whCrxRa/JQC3P4=; b=abTo3YuYWw+YAlOP0zWar9BxvRWC6PdOcEUILhuYME4gM0gXwalr2J0rq6SuEt+U14 4XBfLM82UtDTcwYFM32wOuzzej5A4NAxZZb4N6s5Uf+fAsRpLYO5MDrjObDEp+W1IAIW TKdnOZmJF96fNDOncCHqEkPsQuhSqw51M8RKFVPePFwxKd6OigwLyAPzG++V75gi3vpN gdL3MwoZ/FyZb1T9AGANsB/JcDBbWITY5de+nXohueliHw1L13nhMMInltHSR0x05tRR O9TOwUALf6/UOFYP9IuNDopN9CJPrrn7IFBp08qBeKfOzPZExUEAlQ78jFVhZRjFGSMd lj5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714342579; x=1714947379; 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=PypuXO6MWd/PfirCZaShH9WcvTwY8whCrxRa/JQC3P4=; b=vVXEKJ1tx60wcpNUEo7b/NvBh/ZDPLWqKx0+NU1xK0ezxw0dPHHYJ70Ugz7ZPPkueh 1/Bakiq7oLDE/yXRKVVXNlxdtS2V3qO20qVP+umxzGhV0SqVkK7vvGEuNskCZiLgX0Za JhBv2JeMAKOiPBrDLGha5po6EQGtrbErMVxYBjKYgwNDuIx+RONCH3O99It088Hb1R+V 6StcDBRl8Bu+KFQsmffxaxgH5XALyxyCQ4v6o0/7ERlr+3MputzWU7JJYVvlIqdJM/X+ 2lQnZSOKex6fOc882Jll195ciQNHUwEwzgiZbjxAElDS7+rWCAGFF01DzXLCjh/YGraR qppw== X-Gm-Message-State: AOJu0Yw9iacTMf60frI5MKqT7hTWcK8vsJD735g7f2GT8p9v9KM1fsYX sWgMU+wj9aHY+fj8ZkFKcSuTiv4FSipshl1W69aeoEW8p8BHD20432o9UAPyMG7k7FTqb8o2HIL V X-Received: by 2002:a05:6512:238c:b0:51d:682d:c2ab with SMTP id c12-20020a056512238c00b0051d682dc2abmr2555020lfv.32.1714342579509; Sun, 28 Apr 2024 15:16:19 -0700 (PDT) Received: from m1x-phil.lan ([176.176.142.130]) by smtp.gmail.com with ESMTPSA id q10-20020a170906388a00b00a46aba003eesm13129504ejd.215.2024.04.28.15.16.18 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 28 Apr 2024 15:16:19 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Anton Johansson , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 16/24] accel/tcg: Move @jmp_env from CPUState to TCG AccelCPUState Date: Mon, 29 Apr 2024 00:14:42 +0200 Message-ID: <20240428221450.26460-17-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240428221450.26460-1-philmd@linaro.org> References: <20240428221450.26460-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12a; envelope-from=philmd@linaro.org; helo=mail-lf1-x12a.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 @jmp_env is specific to TCG accelerator, move it to its AccelCPUState. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- accel/tcg/internal-common.h | 1 + accel/tcg/tcg-accel-ops.h | 1 + accel/tcg/vcpu-state.h | 2 ++ include/hw/core/cpu.h | 1 - accel/tcg/cpu-exec-common.c | 2 +- accel/tcg/cpu-exec.c | 6 +++--- 6 files changed, 8 insertions(+), 5 deletions(-) diff --git a/accel/tcg/internal-common.h b/accel/tcg/internal-common.h index df317e7496..e2c80bc7ff 100644 --- a/accel/tcg/internal-common.h +++ b/accel/tcg/internal-common.h @@ -11,6 +11,7 @@ #include "exec/cpu-common.h" #include "exec/translation-block.h" +#include "accel/tcg/vcpu-state.h" extern int64_t max_delay; extern int64_t max_advance; diff --git a/accel/tcg/tcg-accel-ops.h b/accel/tcg/tcg-accel-ops.h index 44c4079972..ed41a087a3 100644 --- a/accel/tcg/tcg-accel-ops.h +++ b/accel/tcg/tcg-accel-ops.h @@ -13,6 +13,7 @@ #define TCG_ACCEL_OPS_H #include "sysemu/cpus.h" +#include "accel/tcg/vcpu-state.h" void tcg_cpu_destroy(CPUState *cpu); int tcg_cpu_exec(CPUState *cpu); diff --git a/accel/tcg/vcpu-state.h b/accel/tcg/vcpu-state.h index cf8e3acef9..cb06f0412b 100644 --- a/accel/tcg/vcpu-state.h +++ b/accel/tcg/vcpu-state.h @@ -12,6 +12,8 @@ * AccelCPUState: */ struct AccelCPUState { + sigjmp_buf jmp_env; + #ifdef CONFIG_USER_ONLY TaskState *ts; #endif diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index dc28920bcc..6d3716f619 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -477,7 +477,6 @@ struct CPUState { int64_t icount_budget; int64_t icount_extra; uint64_t random_seed; - sigjmp_buf jmp_env; QemuMutex work_mutex; QSIMPLEQ_HEAD(, qemu_work_item) work_list; diff --git a/accel/tcg/cpu-exec-common.c b/accel/tcg/cpu-exec-common.c index bc9b1a260e..ec45482305 100644 --- a/accel/tcg/cpu-exec-common.c +++ b/accel/tcg/cpu-exec-common.c @@ -38,7 +38,7 @@ void cpu_loop_exit(CPUState *cpu) cpu->neg.can_do_io = true; /* Undo any setting in generated code. */ qemu_plugin_disable_mem_helpers(cpu); - siglongjmp(cpu->jmp_env, 1); + siglongjmp(cpu->accel->jmp_env, 1); } void cpu_loop_exit_restore(CPUState *cpu, uintptr_t pc) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 9af66bc191..46ad16f911 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -553,7 +553,7 @@ static void cpu_exec_longjmp_cleanup(CPUState *cpu) * support such a thing. We'd have to properly register unwind info * for the JIT for EH, rather that just for GDB. * - * Alternative 2: Set and restore cpu->jmp_env in tb_gen_code to + * Alternative 2: Set and restore cpu->accel->jmp_env in tb_gen_code to * capture the cpu_loop_exit longjmp, perform the cleanup, and * jump again to arrive here. */ @@ -577,7 +577,7 @@ void cpu_exec_step_atomic(CPUState *cpu) uint32_t flags, cflags; int tb_exit; - if (sigsetjmp(cpu->jmp_env, 0) == 0) { + if (sigsetjmp(cpu->accel->jmp_env, 0) == 0) { start_exclusive(); g_assert(cpu == current_cpu); g_assert(!cpu->running); @@ -1038,7 +1038,7 @@ cpu_exec_loop(CPUState *cpu, SyncClocks *sc) static int cpu_exec_setjmp(CPUState *cpu, SyncClocks *sc) { /* Prepare setjmp context for exception handling. */ - if (unlikely(sigsetjmp(cpu->jmp_env, 0) != 0)) { + if (unlikely(sigsetjmp(cpu->accel->jmp_env, 0) != 0)) { cpu_exec_longjmp_cleanup(cpu); } From patchwork Sun Apr 28 22:14:43 2024 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: 792931 Delivered-To: patch@linaro.org Received: by 2002:adf:cc13:0:b0:346:15ad:a2a with SMTP id x19csp1423716wrh; Sun, 28 Apr 2024 15:16:55 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX8YZGEGqlQ/Z5j46KScdeuPxb8aXuVrVt3zlZJ1K4yH48lP3qJtKEOy1G3fl65WTStjr7GsVEH3dKbXQUy0KOU X-Google-Smtp-Source: AGHT+IEDYqhLOkwgIGdsEwIC5BushYel8dWReFjtw3ROwGUBRkxY5HCsjKOTA9v1tnImN2JcCbVm X-Received: by 2002:a54:4899:0:b0:3c6:951:11f7 with SMTP id r25-20020a544899000000b003c6095111f7mr9745636oic.35.1714342615479; Sun, 28 Apr 2024 15:16:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714342615; cv=none; d=google.com; s=arc-20160816; b=dScGc1PoRIcOnjr0mXa+VutnJ8YgoJYXliHBwSaL/dFBvjNSVyfsQF+AqkiA052KOC 5ocX9R/wjw/9rlOejnlV6OGmufJBunR3ZO+CFPoAuE2TYUOGh58A0INPPmyNnyvw2ovw pC3UKzxPlUIpL3Ap3GcSqHYYO6RTslvxdOfmC8AOXfmn+9L1NRRn3cN3PHzCAQ1V53As FL0f/TtLWD+FqATSe9BdWjSgEltY9Yni/VQOJDJhjhqiMfh4B+aN4OOrQ5w9jLGNjvmC uXZFpW71BrfvfB/fB6M25pwDA5Kj7MdpPLz6M1+6CVBpfuRJafIC58/Vhv9euJKM4w2y M0eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=bxBbrax01pE31M/V9b7kPXje3fQe3SttCsF8VW1iSMw=; fh=+kTJNlX4d/Ktp/5WO5d77IkVGYcQ7tiev+NqB54rN/Q=; b=ezvjmAg9EyJRvMoka80GjsT1fWZJVs09NfHbDRt96r1oWGafxifIKkFFxUPf0j8uiO 0AR88jCLu3jsaTQg6/ZeBOQNdXbQtfnTWDI9cxIAcaa3NXS5qYuGT36ppzhXNfJncryr oC6/L5zbnNCIXrrySsNCwb1GIgOs+Cmd0xLqGDYasx/0weQ0kNAiwRoa1O3BoEqQEaQ0 Fc+e3Q5/4tfg+sPD5ckBZttQiYB/g75uEnag2mPTffFHpjk4Z+Lbxf2WShoMy+RBld7x MXaaPZA5DZiLn1E27KsNffi232jlSwPmpQ2ToRQl5rbtrVU0j3J3QClkLtnKt56jvFHe 8jHA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sn7uLHoV; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bk42-20020a05620a1a2a00b00790ec346a87si2684774qkb.606.2024.04.28.15.16.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Apr 2024 15:16: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=sn7uLHoV; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s1Cp8-0000gm-3i; Sun, 28 Apr 2024 18:16:43 -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 1s1Cov-0000Nn-IQ for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:16:29 -0400 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s1Cot-0005gr-Jf for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:16:29 -0400 Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-5723edf0ae5so3973282a12.0 for ; Sun, 28 Apr 2024 15:16:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714342585; x=1714947385; 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=bxBbrax01pE31M/V9b7kPXje3fQe3SttCsF8VW1iSMw=; b=sn7uLHoVIuJ7f5oGukIKrFwHZAui5vBKajxuxUrmf2hJp3jlRAc4xGzzIiS3VrdYQE CmrXP1//rEC270A3qxz4d+ZO9Qt8da4hzucOFJqAHM6P8qYzGg1Masg+jx4X91HR3kZB V04i2yeenLVy3clcFn8FVqRHDPalz5ILqccuDjpabGsNeGgyhjTerFeQTL2E7zYNI80o t/x2iSi+3YDVIIMFDtpnVru3cm+ENcVmg1AD6lncLDKCKGcN2DJ4lwVp2w1amlJ2EkaM fbkdnMaxOGx5fG7tHJJm+txf0JrnPwXgDK+H+1PPvKinGoEc4yTyNn0nVBTjAXfuRfmo MIXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714342585; x=1714947385; 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=bxBbrax01pE31M/V9b7kPXje3fQe3SttCsF8VW1iSMw=; b=L7S1kZAsTSnN1GDLJH7UuqhJbNYsW6hhnyhe/3JNypSGR9uv6wMhZw7WJ2Z3Za/OTA MPmTuU4dGIiKdxss7mRzX2mFeCx7hOBD5gqXfJmTP8BRVhsV/O7+tUjPvJe+gXCugngL L61EszkUvTtsKJqMhnhGMYHgPjFycnHMXICU7m/s0C82ur1Z0HNk2ko6s7LyuL3jFHQd DzyL9wr5o2EZnRQrFMWF+cZULqoRCL15JnzT2uGdN+SA8Ag70UH+Mt5H3XexNzyw/Po0 RzbFGXVbij1I7h61Jp5HgvrsXhHRxjw0waquOs2KXjhTg6sHY1ptLNpBhoHMu42IJQAP 52ag== X-Gm-Message-State: AOJu0Yw7ntkbdczSxGPS/4En9UZ9S98vTtfqIotpfQZuF4StgITEOant 5NLFySrfCxB5JpcvdfAwqgPKBwO/lzjv1qbJBhroxACqpa8KHNYRT49w7eK4XLDY1iaQO4BYVQ3 I X-Received: by 2002:a50:d51c:0:b0:572:7e54:a970 with SMTP id u28-20020a50d51c000000b005727e54a970mr1592309edi.39.1714342584946; Sun, 28 Apr 2024 15:16:24 -0700 (PDT) Received: from m1x-phil.lan ([176.176.142.130]) by smtp.gmail.com with ESMTPSA id 29-20020a50875d000000b00572872bf891sm143283edv.52.2024.04.28.15.16.23 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 28 Apr 2024 15:16:24 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Anton Johansson , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 17/24] accel/tcg: Move @mem_io_pc from CPUState to TCG AccelCPUState Date: Mon, 29 Apr 2024 00:14:43 +0200 Message-ID: <20240428221450.26460-18-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240428221450.26460-1-philmd@linaro.org> References: <20240428221450.26460-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::535; envelope-from=philmd@linaro.org; helo=mail-ed1-x535.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 @mem_io_pc is specific to TCG system emulation, move it to AccelCPUState. Signed-off-by: Philippe Mathieu-Daudé --- accel/tcg/vcpu-state.h | 3 +++ include/hw/core/cpu.h | 2 -- accel/tcg/cputlb.c | 2 +- accel/tcg/tcg-accel-ops.c | 1 + hw/core/cpu-common.c | 1 - hw/misc/mips_itu.c | 3 ++- target/i386/helper.c | 3 ++- 7 files changed, 9 insertions(+), 6 deletions(-) diff --git a/accel/tcg/vcpu-state.h b/accel/tcg/vcpu-state.h index cb06f0412b..d1f989c625 100644 --- a/accel/tcg/vcpu-state.h +++ b/accel/tcg/vcpu-state.h @@ -10,12 +10,15 @@ /** * AccelCPUState: + * @mem_io_pc: Host Program Counter at which the memory was accessed. */ struct AccelCPUState { sigjmp_buf jmp_env; #ifdef CONFIG_USER_ONLY TaskState *ts; +#else + uintptr_t mem_io_pc; #endif }; diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 6d3716f619..4df9bfeba9 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -423,7 +423,6 @@ struct qemu_work_item; * @gdb_num_g_regs: Number of registers in GDB 'g' packets. * @node: QTAILQ of CPUs sharing TB cache. * @opaque: User data. - * @mem_io_pc: Host Program Counter at which the memory was accessed. * @accel: Pointer to accelerator specific state. * @kvm_fd: vCPU file descriptor for KVM. * @work_mutex: Lock to prevent multiple access to @work_list. @@ -502,7 +501,6 @@ struct CPUState { /* In order to avoid passing too many arguments to the MMIO helpers, * we store some rarely used information in the CPU context. */ - uintptr_t mem_io_pc; /* Only used in KVM */ int kvm_fd; diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index cdb3e12dfb..e9d6faf78f 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1383,7 +1383,7 @@ io_prepare(hwaddr *out_offset, CPUState *cpu, hwaddr xlat, section = iotlb_to_section(cpu, xlat, attrs); mr_offset = (xlat & TARGET_PAGE_MASK) + addr; - cpu->mem_io_pc = retaddr; + cpu->accel->mem_io_pc = retaddr; if (!cpu->neg.can_do_io) { cpu_io_recompile(cpu, retaddr); } diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c index 56bbad9fcd..dfa0357558 100644 --- a/accel/tcg/tcg-accel-ops.c +++ b/accel/tcg/tcg-accel-ops.c @@ -89,6 +89,7 @@ static void tcg_cpu_reset_hold(CPUState *cpu) qatomic_set(&cpu->neg.icount_decr.u32, 0); cpu->neg.can_do_io = true; + cpu->accel->mem_io_pc = 0; } /* mask must never be zero, except for A20 change call */ diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c index 3e00ea94be..21151f5634 100644 --- a/hw/core/cpu-common.c +++ b/hw/core/cpu-common.c @@ -117,7 +117,6 @@ static void cpu_common_reset_hold(Object *obj, ResetType type) cpu->interrupt_request = 0; cpu->halted = cpu->start_powered_off; - cpu->mem_io_pc = 0; cpu->icount_extra = 0; cpu->exception_index = -1; cpu->crash_occurred = false; diff --git a/hw/misc/mips_itu.c b/hw/misc/mips_itu.c index f8acfb3ee2..aa11548e71 100644 --- a/hw/misc/mips_itu.c +++ b/hw/misc/mips_itu.c @@ -26,6 +26,7 @@ #include "hw/misc/mips_itu.h" #include "hw/qdev-properties.h" #include "target/mips/cpu.h" +#include "accel/tcg/vcpu-state.h" #define ITC_TAG_ADDRSPACE_SZ (ITC_ADDRESSMAP_NUM * 8) /* Initialize as 4kB area to fit all 32 cells with default 128B grain. @@ -185,7 +186,7 @@ void block_thread_and_exit(ITCStorageCell *c) c->blocked_threads |= 1ULL << current_cpu->cpu_index; current_cpu->halted = 1; current_cpu->exception_index = EXCP_HLT; - cpu_loop_exit_restore(current_cpu, current_cpu->mem_io_pc); + cpu_loop_exit_restore(current_cpu, current_cpu->accel->mem_io_pc); } /* ITC Bypass View */ diff --git a/target/i386/helper.c b/target/i386/helper.c index 48d1513a35..6c188ea94c 100644 --- a/target/i386/helper.c +++ b/target/i386/helper.c @@ -30,6 +30,7 @@ #include "qemu/log.h" #ifdef CONFIG_TCG #include "tcg/insn-start-words.h" +#include "accel/tcg/vcpu-state.h" // ??? #endif void cpu_sync_avx_hflag(CPUX86State *env) @@ -518,7 +519,7 @@ static inline target_ulong get_memio_eip(CPUX86State *env) uint64_t data[TARGET_INSN_START_WORDS]; CPUState *cs = env_cpu(env); - if (!cpu_unwind_state_data(cs, cs->mem_io_pc, data)) { + if (!cpu_unwind_state_data(cs, cs->accel->mem_io_pc, data)) { return env->eip; } From patchwork Sun Apr 28 22:14:44 2024 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: 792932 Delivered-To: patch@linaro.org Received: by 2002:adf:cc13:0:b0:346:15ad:a2a with SMTP id x19csp1423767wrh; Sun, 28 Apr 2024 15:17:05 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXfphNTLSiImZG3yV/1ribZsTj0yRWTCQn2yfGs/FMiAbcVook7aWMpToGzMxcF8EVFZHhGZXZC2IjQuMGtkbhR X-Google-Smtp-Source: AGHT+IHLh2JeKBKQ2+RMZoDobGJZIFa4JdzutK8AjdA70sT6lm51C8ENPeDTvUcmCJ8Hz6hpdlyf X-Received: by 2002:a37:e218:0:b0:790:5e4a:1b02 with SMTP id g24-20020a37e218000000b007905e4a1b02mr5700758qki.11.1714342625327; Sun, 28 Apr 2024 15:17:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714342625; cv=none; d=google.com; s=arc-20160816; b=IYxh6ZtfseyWIqyggXe0QRbZRXcKKxX/TtMHO20cVLM/gn+IIj2eYln8z0Hs1ewLu0 IPYuNlAEL7uh/hcdjp8752N724Egkj7jXVt4ABruapsZc60ih3o3/jxt4i3m/+nApQQp WjMXQQ6xzfuPdcJLMF48qCigwM3giaFjp6JwSh0dZAwTFWGD60zWESnubAEBPSkMljVN lr+80gZqSMkcxOouKAZpqes//7djwXBI/zOJiTKg5pYDReJ/9xDzedsXIw2SdGgxPBYl kLsNEjV2LzSp0Qse9Ntj2SEADmLuWkrFz4dJyGNJmUy5ucn6L0ABy9yyNvHbapUBd/gB O8cA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=G+FNp2PkYoVTOnMYxz45GqXiz7MbjGTG7zrwBtJ7b14=; fh=+kTJNlX4d/Ktp/5WO5d77IkVGYcQ7tiev+NqB54rN/Q=; b=IGssh1VbmIw558ePmZH0Q+uVEZ6lB9Dvv/oMDTbCYZ9ssi2exsWsxyyMC72GuzH56a X1oEtNx7T+qN9zjckNkz8nVi0BSkiRyWAmRbUgYY0zfCSZIB4aZ4e+eHUtpN7ICkr2hq TjcnjLdiRGCOJlnRLw3zMdgx175BYwCeAUg+YFncPtZpnuQhi5eMowX2cGWhhMtbkokb s4muiGXUp9enuwLHwK/cuQVqwJOb30jwB8qGKqIXEbxgl5hD7uln0zwpL7vOs7p05tVm 2jh1oE+nTiqKk/4bUqy8SdVWla8iiIKtYe0vYJD/OXCaxo0BPM0jj/VhFdzDB08iJtTP qzow==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=STX+chon; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id pj21-20020a05620a1d9500b0078d63f17fe7si24735524qkn.468.2024.04.28.15.17.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Apr 2024 15:17:05 -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=STX+chon; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s1CpQ-0001Nn-F0; Sun, 28 Apr 2024 18:17:00 -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 1s1Cp0-0000ut-Jn for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:16:40 -0400 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s1Coy-0005hX-C2 for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:16:34 -0400 Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-56e6acb39d4so4580040a12.1 for ; Sun, 28 Apr 2024 15:16:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714342590; x=1714947390; 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=G+FNp2PkYoVTOnMYxz45GqXiz7MbjGTG7zrwBtJ7b14=; b=STX+chonLN0LeaWIo5R0JnMxPUpyMfK3HyCt0+R5eYzHFv9JKTTTPo9cZNOsVtO/2b wlPD31jX+lwKANKB+bcTGK8IOJpKSq3ES2zI5tm3KBNCAtk2sxZu5WFL5rpCKTyyOF6Z C+gcraikrXobVM7WTlsnH7LRTc2UMaoJNCOc/Gmf+NTCYN0mCkyDxMEXlfktsD/0iNya gzwW8Ax/x2otf/GvLZ4WePh9kyLvz7m3z1jLqwY+TgA3+BAgNrA++6cYC9AfZLiDSGYl NkqDYdOyGcOa7T6KPHOt3p1b0sQMjEhFzthiH42tgmaeesckDcz/1nCCOjHsRD5LAJ29 QYew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714342590; x=1714947390; 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=G+FNp2PkYoVTOnMYxz45GqXiz7MbjGTG7zrwBtJ7b14=; b=wXjkft3I+HHeQNzGufUHHxVxULgrF8rq0JUipbfHrNPghBu6GkSLHMDyVE/fclS8i/ X1ltRkVjZtg45sZzrB47Lk2zDN0sbJOoMsqMexGevP2V3ixn6qq0Xo88S3Jh/iik3qjq HWJ9WfoobNILBFujsN6dyIRliLoCTHGI6Cq6phwt0yYcp28YaeFZb6K4ZMvz+DFOQ3a6 Z4Su0e4ChA1O+WDp5ewucOk4V4wsEZTmJi1/qTV26mUjRbqeqNbwF99Z18S8/Uv1XN+d srOiff7p2w3aVo0nnR5iOQ2BLx74krqkIF7DHd7EHmNxFlqpKW9rBDJw0n+mdp5XR7qv RAJA== X-Gm-Message-State: AOJu0Yzj16uGrL4yJYhO67h1oD/BwpU8XOGWz/L53y9+0M+Mr9+4TtXc lnKz2OgkFDD1XYCvsIM7CoF5FgY1URItG39951A6pYiFFxd+qFg02ZO+r9o318mUr5l9aCPh/lb q X-Received: by 2002:a50:8d42:0:b0:571:be3a:e904 with SMTP id t2-20020a508d42000000b00571be3ae904mr5563105edt.8.1714342590271; Sun, 28 Apr 2024 15:16:30 -0700 (PDT) Received: from m1x-phil.lan ([176.176.142.130]) by smtp.gmail.com with ESMTPSA id y20-20020a056402271400b00572300f0768sm5331190edd.79.2024.04.28.15.16.29 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 28 Apr 2024 15:16:29 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Anton Johansson , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 18/24] accel/tcg: Move @cflags_next_tb from CPUState to TCG AccelCPUState Date: Mon, 29 Apr 2024 00:14:44 +0200 Message-ID: <20240428221450.26460-19-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240428221450.26460-1-philmd@linaro.org> References: <20240428221450.26460-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::534; envelope-from=philmd@linaro.org; helo=mail-ed1-x534.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 @cflags_next_tb is specific to TCG accelerator, move it to its AccelCPUState. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- accel/tcg/vcpu-state.h | 2 ++ include/hw/core/cpu.h | 1 - accel/tcg/cpu-exec.c | 12 ++++++------ accel/tcg/tb-maint.c | 4 ++-- accel/tcg/tcg-accel-ops.c | 1 + accel/tcg/translate-all.c | 2 +- accel/tcg/watchpoint.c | 5 +++-- hw/core/cpu-common.c | 1 - 8 files changed, 15 insertions(+), 13 deletions(-) diff --git a/accel/tcg/vcpu-state.h b/accel/tcg/vcpu-state.h index d1f989c625..79e1490631 100644 --- a/accel/tcg/vcpu-state.h +++ b/accel/tcg/vcpu-state.h @@ -13,6 +13,8 @@ * @mem_io_pc: Host Program Counter at which the memory was accessed. */ struct AccelCPUState { + uint32_t cflags_next_tb; + sigjmp_buf jmp_env; #ifdef CONFIG_USER_ONLY diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 4df9bfeba9..a8b4ae25f1 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -469,7 +469,6 @@ struct CPUState { bool crash_occurred; bool exit_request; int exclusive_context_count; - uint32_t cflags_next_tb; /* updates protected by BQL */ uint32_t interrupt_request; int singlestep_enabled; diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 46ad16f911..55235d3e5e 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -720,7 +720,7 @@ static inline bool cpu_handle_exception(CPUState *cpu, int *ret) if (replay_has_exception() && cpu->neg.icount_decr.u16.low + cpu->icount_extra == 0) { /* Execute just one insn to trigger exception pending in the log */ - cpu->cflags_next_tb = (curr_cflags(cpu) & ~CF_USE_ICOUNT) + cpu->accel->cflags_next_tb = (curr_cflags(cpu) & ~CF_USE_ICOUNT) | CF_NOIRQ | 1; } #endif @@ -783,7 +783,7 @@ static inline bool icount_exit_request(CPUState *cpu) if (!icount_enabled()) { return false; } - if (cpu->cflags_next_tb != -1 && !(cpu->cflags_next_tb & CF_USE_ICOUNT)) { + if (!(cpu->accel->cflags_next_tb == -1 || cpu->accel->cflags_next_tb & CF_USE_ICOUNT)) { return false; } return cpu->neg.icount_decr.u16.low + cpu->icount_extra == 0; @@ -797,7 +797,7 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, * skip checking here. Any pending interrupts will get picked up * by the next TB we execute under normal cflags. */ - if (cpu->cflags_next_tb != -1 && cpu->cflags_next_tb & CF_NOIRQ) { + if (cpu->accel->cflags_next_tb != -1 && cpu->accel->cflags_next_tb & CF_NOIRQ) { return false; } @@ -947,7 +947,7 @@ static inline void cpu_loop_exec_tb(CPUState *cpu, TranslationBlock *tb, if (insns_left > 0 && insns_left < tb->icount) { assert(insns_left <= CF_COUNT_MASK); assert(cpu->icount_extra == 0); - cpu->cflags_next_tb = (tb->cflags & ~CF_COUNT_MASK) | insns_left; + cpu->accel->cflags_next_tb = (tb->cflags & ~CF_COUNT_MASK) | insns_left; } #endif } @@ -979,11 +979,11 @@ cpu_exec_loop(CPUState *cpu, SyncClocks *sc) * have CF_INVALID set, -1 is a convenient invalid value that * does not require tcg headers for cpu_common_reset. */ - cflags = cpu->cflags_next_tb; + cflags = cpu->accel->cflags_next_tb; if (cflags == -1) { cflags = curr_cflags(cpu); } else { - cpu->cflags_next_tb = -1; + cpu->accel->cflags_next_tb = -1; } if (check_for_breakpoints(cpu, pc, &cflags)) { diff --git a/accel/tcg/tb-maint.c b/accel/tcg/tb-maint.c index 19ae6793f3..2d5faca9fd 100644 --- a/accel/tcg/tb-maint.c +++ b/accel/tcg/tb-maint.c @@ -1084,7 +1084,7 @@ bool tb_invalidate_phys_page_unwind(tb_page_addr_t addr, uintptr_t pc) if (current_tb_modified) { /* Force execution of one insn next time. */ CPUState *cpu = current_cpu; - cpu->cflags_next_tb = 1 | CF_NOIRQ | curr_cflags(current_cpu); + cpu->accel->cflags_next_tb = 1 | CF_NOIRQ | curr_cflags(current_cpu); return true; } return false; @@ -1154,7 +1154,7 @@ tb_invalidate_phys_page_range__locked(struct page_collection *pages, if (current_tb_modified) { page_collection_unlock(pages); /* Force execution of one insn next time. */ - current_cpu->cflags_next_tb = 1 | CF_NOIRQ | curr_cflags(current_cpu); + current_cpu->accel->cflags_next_tb = 1 | CF_NOIRQ | curr_cflags(current_cpu); mmap_unlock(); cpu_loop_exit_noexc(current_cpu); } diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c index dfa0357558..5429e2d219 100644 --- a/accel/tcg/tcg-accel-ops.c +++ b/accel/tcg/tcg-accel-ops.c @@ -90,6 +90,7 @@ static void tcg_cpu_reset_hold(CPUState *cpu) qatomic_set(&cpu->neg.icount_decr.u32, 0); cpu->neg.can_do_io = true; cpu->accel->mem_io_pc = 0; + cpu->accel->cflags_next_tb = -1; } /* mask must never be zero, except for A20 change call */ diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index b67adce20e..3a8199a761 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -631,7 +631,7 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr) * operations only (which execute after completion) so we don't * double instrument the instruction. */ - cpu->cflags_next_tb = curr_cflags(cpu) | CF_MEMI_ONLY | n; + cpu->accel->cflags_next_tb = curr_cflags(cpu) | CF_MEMI_ONLY | n; if (qemu_loglevel_mask(CPU_LOG_EXEC)) { vaddr pc = cpu->cc->get_pc(cpu); diff --git a/accel/tcg/watchpoint.c b/accel/tcg/watchpoint.c index d3aab11458..0a40bfdc85 100644 --- a/accel/tcg/watchpoint.c +++ b/accel/tcg/watchpoint.c @@ -26,6 +26,7 @@ #include "sysemu/replay.h" #include "hw/core/tcg-cpu-ops.h" #include "hw/core/cpu.h" +#include "accel/tcg/vcpu-state.h" /* * Return true if this watchpoint address matches the specified @@ -100,7 +101,7 @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len, */ if (!cpu->neg.can_do_io) { /* Force execution of one insn next time. */ - cpu->cflags_next_tb = 1 | CF_NOIRQ | curr_cflags(cpu); + cpu->accel->cflags_next_tb = 1 | CF_NOIRQ | curr_cflags(cpu); cpu_loop_exit_restore(cpu, ra); } /* @@ -132,7 +133,7 @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len, cpu_loop_exit(cpu); } else { /* Force execution of one insn next time. */ - cpu->cflags_next_tb = 1 | CF_NOIRQ | curr_cflags(cpu); + cpu->accel->cflags_next_tb = 1 | CF_NOIRQ | curr_cflags(cpu); mmap_unlock(); cpu_loop_exit_noexc(cpu); } diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c index 21151f5634..684422991c 100644 --- a/hw/core/cpu-common.c +++ b/hw/core/cpu-common.c @@ -120,7 +120,6 @@ static void cpu_common_reset_hold(Object *obj, ResetType type) cpu->icount_extra = 0; cpu->exception_index = -1; cpu->crash_occurred = false; - cpu->cflags_next_tb = -1; cpu_exec_reset_hold(cpu); } From patchwork Sun Apr 28 22:14:45 2024 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: 792933 Delivered-To: patch@linaro.org Received: by 2002:adf:cc13:0:b0:346:15ad:a2a with SMTP id x19csp1423800wrh; Sun, 28 Apr 2024 15:17:12 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW5CohInQSInz9iJJ2fq3CXrYSjzytBbmdhmvvtPd4Hqe987gROiIe63rOSEp2JoEbIaQJluXsIZ0UYCcjDOaCb X-Google-Smtp-Source: AGHT+IHEXirIww39tbuwdhmO3VGadkpefL94Q8JIhtl/Nss7rPCx7huyuo7ak5R8JDupPBS7HLP4 X-Received: by 2002:a05:620a:2e4:b0:790:9e84:9b75 with SMTP id a4-20020a05620a02e400b007909e849b75mr13417528qko.12.1714342632610; Sun, 28 Apr 2024 15:17:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714342632; cv=none; d=google.com; s=arc-20160816; b=dmDTWnlp8HcDEQEdSjCX08O/FjjjQk66gcAT/1/QZu9/YfZAis/s7ZunlO2qpUlAFN RW20aRYxOIx/H13KLN9bTL+xR14Wt+AL1fHCw/RdfUidb4ie4Q5W6Tx+aezmevDLdqWL 89YxyNavcYLu60inCXJNDZYun7frEgLAqu6yzZz+JMtU5jb7H4C9AADW6tOVg/W6PI2j rKbg1YBs0yK0fn6AD0Jsg4SjQXGD152ZQjUOM5j9fbnzdT0OwV2Ewd6AZeAb1T07xUvc CyLwJsl9UBmKQOJZI1jG5y9Gnze2e9LWia6PwpslvDDWd0CLQJhWPNB9E3Yj02yuHMs8 il/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=ToTLt6YxD1s2pYbiLl6kqeNVfIHsdKCMcl6fReELYBM=; fh=+kTJNlX4d/Ktp/5WO5d77IkVGYcQ7tiev+NqB54rN/Q=; b=vMHomX7XPUxntUAf2PK3B37QAboNNoRRnnrdB7KxF3Cg6DEDuTW9lNJ4ViCsylwi61 6bdgZhoH9PqHD1ZEWsyx7KGbKkEYRWz/Tk7XIvyRw/7hFgeVlvdlVFh2GEiPp2uuO4FZ jduNoCVvCloTXOtApkVHXA3QrkByUXTPcQfp35abZihyXSsQGA2nnf3qydx5Nmbn8GCl HCtP0m7nQC+xb+vSjQD0/0mooB2+PTX8mHWYKvH2fAz1z6t4VGZZrtgyV7NcqL97Ilz+ 2yjOLIMlFhvSq9XiyEFE8YTwEMe8v7w5lG/agAHsHOIMc1SJaaNb7QmjBq1BYR9jKPK8 bRBQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=j0IgXlv+; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id l24-20020a37f518000000b00790f7c9301esi594470qkk.377.2024.04.28.15.17.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Apr 2024 15:17:12 -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=j0IgXlv+; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s1CpU-0001iF-Io; Sun, 28 Apr 2024 18:17:05 -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 1s1Cp5-0000x9-Bw for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:16:42 -0400 Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s1Cp3-0005ik-F7 for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:16:39 -0400 Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-5708d8beec6so4685502a12.0 for ; Sun, 28 Apr 2024 15:16:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714342596; x=1714947396; 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=ToTLt6YxD1s2pYbiLl6kqeNVfIHsdKCMcl6fReELYBM=; b=j0IgXlv+9XI93ElGBoTxjjsUw7buP4n6n/PmiESG9GtIq1+W6Ng6EgmPh+8MPDz7Cb QHdvwvITKOX2QByBY7dM1JW+i/+iHArR8n7M6RHegpQMTlh+D/gS8WDXFjbroMyN2ZF/ dviqUdcpThITpIPkzo+H3pZVqD/Vhme/fWl0I5JR8iuFZMPsTuuJuFods4Pu9bHVCXcj dJ/c5XKHw5DIgO4DSOZPOJqK5sfZyjHqa+fT/vHbm7VQ6mf7cpDyNRaxqnm8z5MTfedX zxOknwUJ+Q7n9k/DnFLGxqCbpQEmkJCAwl56Gpb72dutrwhwUJ5ATe3bI/VfbHVVMHVT txdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714342596; x=1714947396; 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=ToTLt6YxD1s2pYbiLl6kqeNVfIHsdKCMcl6fReELYBM=; b=Bl2BRYWzTm/xT0PY7tiS6gVxUGfelCXDNHQMtzLbr2VOYa3gcV+TKmAL7RhCHA2Y7m aYhp1fccPmmEsN1W7c25v8ztFcUMycD5oYc0ij4a1gALy98FNzjDEzoXAxt543SBes5u /nCFDWKUnp4H+WG9BhUJY2QmYwx0KeI4GkXYyHvS2YvMh8xfOAYEW3g+ODNfRzcvDlII 08q16zhgRbT9r9Qe6ofNqR8Bhp9g6MqK/SHBmyuV7QeRVLFYG0mBZpqYvGU3CPpdI+DI DVOlQ11NVwazxc580yc2X5hD75FYTUv1344Io8kVFhktxoCW1/f1OYAT/bh5lCutc/Am JH2A== X-Gm-Message-State: AOJu0YxLwy7jG/8MvOBK/7Bse8pMVGHz+vmuSNQa9OegeXqdD7Sesh2X DerpzYQLj3v+qKlpnh4oqALADEvTbLE7IIfhUGRHXl1yegx5tL+4XPQpIbUwWJbSjv3r8QfXPyR 0 X-Received: by 2002:a17:906:3905:b0:a55:a1d4:84f5 with SMTP id f5-20020a170906390500b00a55a1d484f5mr6751423eje.43.1714342595724; Sun, 28 Apr 2024 15:16:35 -0700 (PDT) Received: from m1x-phil.lan ([176.176.142.130]) by smtp.gmail.com with ESMTPSA id fy7-20020a170906b7c700b00a55b1253fe5sm9144596ejb.194.2024.04.28.15.16.34 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 28 Apr 2024 15:16:35 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Anton Johansson , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 19/24] accel/tcg: Move @iommu_notifiers from CPUState to TCG AccelCPUState Date: Mon, 29 Apr 2024 00:14:45 +0200 Message-ID: <20240428221450.26460-20-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240428221450.26460-1-philmd@linaro.org> References: <20240428221450.26460-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52e; envelope-from=philmd@linaro.org; helo=mail-ed1-x52e.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 @iommu_notifiers is specific to TCG system emulation, move it to AccelCPUState. Restrict TCG specific code in system/physmem.c, adding an empty stub for tcg_register_iommu_notifier(). Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- accel/tcg/vcpu-state.h | 3 +++ include/hw/core/cpu.h | 3 --- system/physmem.c | 37 ++++++++++++++++++++++++++++--------- 3 files changed, 31 insertions(+), 12 deletions(-) diff --git a/accel/tcg/vcpu-state.h b/accel/tcg/vcpu-state.h index 79e1490631..2d09dc3857 100644 --- a/accel/tcg/vcpu-state.h +++ b/accel/tcg/vcpu-state.h @@ -21,6 +21,9 @@ struct AccelCPUState { TaskState *ts; #else uintptr_t mem_io_pc; + + /* track IOMMUs whose translations we've cached in the TCG TLB */ + GArray *iommu_notifiers; #endif }; diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index a8b4ae25f1..9e192f739a 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -539,9 +539,6 @@ struct CPUState { /* Used for user-only emulation of prctl(PR_SET_UNALIGN). */ bool prctl_unalign_sigbus; - /* track IOMMUs whose translations we've cached in the TCG TLB */ - GArray *iommu_notifiers; - /* * MUST BE LAST in order to minimize the displacement to CPUArchState. */ diff --git a/system/physmem.c b/system/physmem.c index 44e477a1a5..1e003e42bb 100644 --- a/system/physmem.c +++ b/system/physmem.c @@ -27,6 +27,8 @@ #include "qemu/madvise.h" #ifdef CONFIG_TCG +#include "exec/translate-all.h" +#include "accel/tcg/vcpu-state.h" #include "hw/core/tcg-cpu-ops.h" #endif /* CONFIG_TCG */ @@ -578,6 +580,8 @@ MemoryRegion *flatview_translate(FlatView *fv, hwaddr addr, hwaddr *xlat, return mr; } +#ifdef CONFIG_TCG + typedef struct TCGIOMMUNotifier { IOMMUNotifier n; MemoryRegion *mr; @@ -614,17 +618,20 @@ static void tcg_register_iommu_notifier(CPUState *cpu, TCGIOMMUNotifier *notifier = NULL; int i; - for (i = 0; i < cpu->iommu_notifiers->len; i++) { - notifier = g_array_index(cpu->iommu_notifiers, TCGIOMMUNotifier *, i); + for (i = 0; i < cpu->accel->iommu_notifiers->len; i++) { + notifier = g_array_index(cpu->accel->iommu_notifiers, + TCGIOMMUNotifier *, i); if (notifier->mr == mr && notifier->iommu_idx == iommu_idx) { break; } } - if (i == cpu->iommu_notifiers->len) { + if (i == cpu->accel->iommu_notifiers->len) { /* Not found, add a new entry at the end of the array */ - cpu->iommu_notifiers = g_array_set_size(cpu->iommu_notifiers, i + 1); + cpu->accel->iommu_notifiers = g_array_set_size(cpu->accel->iommu_notifiers, + i + 1); notifier = g_new0(TCGIOMMUNotifier, 1); - g_array_index(cpu->iommu_notifiers, TCGIOMMUNotifier *, i) = notifier; + g_array_index(cpu->accel->iommu_notifiers, + TCGIOMMUNotifier *, i) = notifier; notifier->mr = mr; notifier->iommu_idx = iommu_idx; @@ -656,19 +663,31 @@ void tcg_iommu_free_notifier_list(CPUState *cpu) int i; TCGIOMMUNotifier *notifier; - for (i = 0; i < cpu->iommu_notifiers->len; i++) { - notifier = g_array_index(cpu->iommu_notifiers, TCGIOMMUNotifier *, i); + for (i = 0; i < cpu->accel->iommu_notifiers->len; i++) { + notifier = g_array_index(cpu->accel->iommu_notifiers, + TCGIOMMUNotifier *, i); memory_region_unregister_iommu_notifier(notifier->mr, ¬ifier->n); g_free(notifier); } - g_array_free(cpu->iommu_notifiers, true); + g_array_free(cpu->accel->iommu_notifiers, true); } void tcg_iommu_init_notifier_list(CPUState *cpu) { - cpu->iommu_notifiers = g_array_new(false, true, sizeof(TCGIOMMUNotifier *)); + cpu->accel->iommu_notifiers = g_array_new(false, true, + sizeof(TCGIOMMUNotifier *)); } +#else + +static void tcg_register_iommu_notifier(CPUState *cpu, + IOMMUMemoryRegion *iommu_mr, + int iommu_idx) +{ +} + +#endif + /* Called from RCU critical section */ MemoryRegionSection * address_space_translate_for_iotlb(CPUState *cpu, int asidx, hwaddr orig_addr, From patchwork Sun Apr 28 22:14:46 2024 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: 792935 Delivered-To: patch@linaro.org Received: by 2002:adf:cc13:0:b0:346:15ad:a2a with SMTP id x19csp1423908wrh; Sun, 28 Apr 2024 15:17:43 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVceRpTmofd0LQ3V8uKvMQ64bCkgFBvhlTIBaB4WHehVAi8jmGuvf68tjS2o2uQ9fw832PCAhhFJJLZdjUeFbto X-Google-Smtp-Source: AGHT+IGje0mpqRrEVhSbo7RSfBjUMl+p9e4EBK5FlBErpNaaJZiVPO+aXI0EGwMN94FpOB3oHKrs X-Received: by 2002:a05:620a:2089:b0:790:cf88:be5d with SMTP id e9-20020a05620a208900b00790cf88be5dmr3787068qka.40.1714342663684; Sun, 28 Apr 2024 15:17:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714342663; cv=none; d=google.com; s=arc-20160816; b=NkhpfrwmH26Taib9oN55yi5jRMgWg6Q3tz7Iqf4Dr2eMDt6A1H0Mq5H9YjzN9tqhO+ 5JOikZ9O5jhvEfuFjLoiWQc3fKzG+9tG3oC3qCyrFzhbact1zjNqSjlOQBinBSH7X5Ib oPqgKdkqGP+2UuaHOSzrSLhztwD8y+x77vqCYlsm55vQPDuhMJHmgbtvWRNzbreMTmHQ iYRKCkuoW/EMNsdkkNN6N0Qz8cuc2gwYZvyteWh+YKTZDO5UII5NS0oHpTlxjNUpmH8y RuMVR3fVVrtuBgRR+XUvZgycny0nzrK5FmN0QLp/Z2itT+LjA2JWlIhnzV46B3/UWdEd wSqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=Evb3eGbBZdxVTABj6hS8iE4A57Mw0jsMC3hyjWh5Exw=; fh=+kTJNlX4d/Ktp/5WO5d77IkVGYcQ7tiev+NqB54rN/Q=; b=HEBvuFJKJIdYn/EKUb0mbg8aqaxnJCjbyz1u4spE0Lr6VKwAXcDg0HIdr9Qz4eFkqQ noYl4AodOqKjqMOzIYxgUNImBROLczN573zlQFb2g1zDnbAyAMGkGXA7k/xY0MzyUhg0 xYQ6UA0bDuEZB+WDIv5Vo4p7ZQJqo5DVUD5OTuoaQTxZJWj8axVeDzn4Rgcv8HdHGVPh fRZGwOOZbNZoQV4hCokqrayoasYhle+jQKvwv4JETtI/3Skyg7yS8fknWY6y6pVZB1tW 5XZPar/7IW6qwunqWMpscQiVn+rhrBGojnIRA+HAASoB7kSmKaIereEN2mGsgN7dvT3v fGbA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="vubWJ/k7"; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id l10-20020ae9f00a000000b0078ec3de3e17si24561776qkg.527.2024.04.28.15.17.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Apr 2024 15:17:43 -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="vubWJ/k7"; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s1CpZ-00024y-EK; Sun, 28 Apr 2024 18:17:09 -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 1s1CpC-00018E-8k for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:16:49 -0400 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s1Cp9-0005k0-Rl for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:16:45 -0400 Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-572229f196cso3881524a12.2 for ; Sun, 28 Apr 2024 15:16:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714342601; x=1714947401; 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=Evb3eGbBZdxVTABj6hS8iE4A57Mw0jsMC3hyjWh5Exw=; b=vubWJ/k7ZEL9sjKMVKwAaB7XZjHjj8KGdwNigR3+3KTTZTA3bjaWElBlfPAwMm54Cl wXTKHg+RcogNC3YOHwlI3UIo8Kt/kmKAwOw/5EJI/tkeETkW9YxY6xO996/JcherWH+X GGMxwdx0Y1ScoMAZPK+xBtlCYLmKW11Wx+6WF/81V/dIlK94NHiydiNw2ybGlrE/PiWv 2lNuWsIQayrZyQbdQmxVhH/RistpYa/YIhmR3iRhv2tzULSNdOs482uGcM215g6s7XSS GRBxXVY+FbAv2D2yeDLOXAXJ4LUAC7dycp74Ola04G8JcIPbCy+bPWSkZCJP8Cet42L7 btyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714342601; x=1714947401; 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=Evb3eGbBZdxVTABj6hS8iE4A57Mw0jsMC3hyjWh5Exw=; b=NVbG/xfsDhekUuC9jGVWV/Z9wgRMhtWJ5IHIEz+EYHJ1U0bOv63RReS4u40ycqrNPA TXB2xVCEtjl9SkwGy3PDqipz5OhEt+xDzqbqEbg9PopeQShWDPTH2e3X8Weor3E2y2sQ v/ZatdGGJMi1U2xy1SjXNKZYDwWE90fww28Msxoz/o3bF/VcwRKLAmgbYkLqL0w4gQvx TT9+2ru6rEDsCtZBKvV118yBUL9u/A0wzEOH+6rCJV+RAcZfF9JTB1a9Rfto5fWVpbDn ztVfOnudxyzEcd3t10y2j3EwYFC+m8jBtmquUcqe5dLbL2d/IseUaRdZqkcbWHy7kjmb jcuA== X-Gm-Message-State: AOJu0YywVloTqp8GRnwCqNQmhm10+LaraZs+VrV9Ts5kxG9Adtj8SYrC Qdap+4Ys+QfWgad5ryv+vBo8ZRsV6M9DQIsRdHCYJVbtZHXh5nBhJoUXs6kJwuoeS2MyPf0JkJx U X-Received: by 2002:a50:9f43:0:b0:572:3fe4:18b5 with SMTP id b61-20020a509f43000000b005723fe418b5mr4572654edf.32.1714342601075; Sun, 28 Apr 2024 15:16:41 -0700 (PDT) Received: from m1x-phil.lan ([176.176.142.130]) by smtp.gmail.com with ESMTPSA id p19-20020a05640210d300b00572033ec969sm8495254edu.60.2024.04.28.15.16.40 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 28 Apr 2024 15:16:40 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Anton Johansson , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 20/24] accel/tcg: Move @tb_jmp_cache from CPUState to TCG AccelCPUState Date: Mon, 29 Apr 2024 00:14:46 +0200 Message-ID: <20240428221450.26460-21-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240428221450.26460-1-philmd@linaro.org> References: <20240428221450.26460-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::534; envelope-from=philmd@linaro.org; helo=mail-ed1-x534.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 @tb_jmp_cache is specific to TCG accelerator, move it to its AccelCPUState. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- accel/tcg/tb-jmp-cache.h | 4 ++-- accel/tcg/vcpu-state.h | 2 ++ include/hw/core/cpu.h | 2 -- include/qemu/typedefs.h | 1 - accel/tcg/cpu-exec.c | 7 +++---- accel/tcg/cputlb.c | 2 +- accel/tcg/tb-maint.c | 2 +- accel/tcg/translate-all.c | 5 +++-- 8 files changed, 12 insertions(+), 13 deletions(-) diff --git a/accel/tcg/tb-jmp-cache.h b/accel/tcg/tb-jmp-cache.h index 184bb3e3e2..c3a505e394 100644 --- a/accel/tcg/tb-jmp-cache.h +++ b/accel/tcg/tb-jmp-cache.h @@ -22,12 +22,12 @@ * non-NULL value of 'tb'. Strictly speaking pc is only needed for * CF_PCREL, but it's used always for simplicity. */ -struct CPUJumpCache { +typedef struct CPUJumpCache { struct rcu_head rcu; struct { TranslationBlock *tb; vaddr pc; } array[TB_JMP_CACHE_SIZE]; -}; +} CPUJumpCache; #endif /* ACCEL_TCG_TB_JMP_CACHE_H */ diff --git a/accel/tcg/vcpu-state.h b/accel/tcg/vcpu-state.h index 2d09dc3857..5b31c801d8 100644 --- a/accel/tcg/vcpu-state.h +++ b/accel/tcg/vcpu-state.h @@ -7,6 +7,7 @@ #define ACCEL_TCG_VCPU_STATE_H #include "hw/core/cpu.h" +#include "tb-jmp-cache.h" /** * AccelCPUState: @@ -16,6 +17,7 @@ struct AccelCPUState { uint32_t cflags_next_tb; sigjmp_buf jmp_env; + CPUJumpCache tb_jmp_cache; #ifdef CONFIG_USER_ONLY TaskState *ts; diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 9e192f739a..99709270fa 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -484,8 +484,6 @@ struct CPUState { AddressSpace *as; MemoryRegion *memory; - CPUJumpCache *tb_jmp_cache; - GArray *gdb_regs; int gdb_num_regs; int gdb_num_g_regs; diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h index 36f2825725..daf9009332 100644 --- a/include/qemu/typedefs.h +++ b/include/qemu/typedefs.h @@ -44,7 +44,6 @@ typedef struct CPUAddressSpace CPUAddressSpace; typedef struct CPUArchState CPUArchState; typedef struct CPUPluginState CPUPluginState; typedef struct CpuInfoFast CpuInfoFast; -typedef struct CPUJumpCache CPUJumpCache; typedef struct CPUState CPUState; typedef struct CPUTLBEntryFull CPUTLBEntryFull; typedef struct DeviceListener DeviceListener; diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 55235d3e5e..8f8e1fa948 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -261,7 +261,7 @@ static inline TranslationBlock *tb_lookup(CPUState *cpu, vaddr pc, tcg_debug_assert(!(cflags & CF_INVALID)); hash = tb_jmp_cache_hash_func(pc); - jc = cpu->tb_jmp_cache; + jc = &cpu->accel->tb_jmp_cache; tb = qatomic_read(&jc->array[hash].tb); if (likely(tb && @@ -1004,7 +1004,7 @@ cpu_exec_loop(CPUState *cpu, SyncClocks *sc) * for the fast lookup */ h = tb_jmp_cache_hash_func(pc); - jc = cpu->tb_jmp_cache; + jc = &cpu->accel->tb_jmp_cache; jc->array[h].pc = pc; qatomic_set(&jc->array[h].tb, tb); } @@ -1083,7 +1083,6 @@ bool tcg_exec_realizefn(CPUState *cpu, Error **errp) tcg_target_initialized = true; } - cpu->tb_jmp_cache = g_new0(CPUJumpCache, 1); tlb_init(cpu); #ifndef CONFIG_USER_ONLY tcg_iommu_init_notifier_list(cpu); @@ -1101,5 +1100,5 @@ void tcg_exec_unrealizefn(CPUState *cpu) #endif /* !CONFIG_USER_ONLY */ tlb_destroy(cpu); - g_free_rcu(cpu->tb_jmp_cache, rcu); + g_free_rcu(&cpu->accel->tb_jmp_cache, rcu); } diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index e9d6faf78f..964dacaf44 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -156,7 +156,7 @@ static void tlb_window_reset(CPUTLBDesc *desc, int64_t ns, static void tb_jmp_cache_clear_page(CPUState *cpu, vaddr page_addr) { - CPUJumpCache *jc = cpu->tb_jmp_cache; + CPUJumpCache *jc = &cpu->accel->tb_jmp_cache; int i, i0; if (unlikely(!jc)) { diff --git a/accel/tcg/tb-maint.c b/accel/tcg/tb-maint.c index 2d5faca9fd..83758648f2 100644 --- a/accel/tcg/tb-maint.c +++ b/accel/tcg/tb-maint.c @@ -888,7 +888,7 @@ static void tb_jmp_cache_inval_tb(TranslationBlock *tb) uint32_t h = tb_jmp_cache_hash_func(tb->pc); CPU_FOREACH(cpu) { - CPUJumpCache *jc = cpu->tb_jmp_cache; + CPUJumpCache *jc = &cpu->accel->tb_jmp_cache; if (qatomic_read(&jc->array[h].tb) == tb) { qatomic_set(&jc->array[h].tb, NULL); diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 3a8199a761..ca1e193633 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -652,13 +652,14 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr) */ void tcg_flush_jmp_cache(CPUState *cpu) { - CPUJumpCache *jc = cpu->tb_jmp_cache; + CPUJumpCache *jc; /* During early initialization, the cache may not yet be allocated. */ - if (unlikely(jc == NULL)) { + if (unlikely(cpu->accel == NULL)) { return; } + jc = &cpu->accel->tb_jmp_cache; for (int i = 0; i < TB_JMP_CACHE_SIZE; i++) { qatomic_set(&jc->array[i].tb, NULL); } From patchwork Sun Apr 28 22:14:47 2024 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: 792940 Delivered-To: patch@linaro.org Received: by 2002:adf:cc13:0:b0:346:15ad:a2a with SMTP id x19csp1424133wrh; Sun, 28 Apr 2024 15:18:40 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWQF39u9msrc3XzE14xjOeYvG6pmkT9lPLOL89my+pcQHWjCFXP+3EfA1ooqTkBCYRVU/nTJrx2D6sAwOmwZh8r X-Google-Smtp-Source: AGHT+IFziv8Hfqt4qCB3YvSEWEW6u08aanfAT1cfndaShennVHbeuZA45bZ+Vt3BZLZIKw0C1ns/ X-Received: by 2002:a25:b107:0:b0:ddd:72ab:233e with SMTP id g7-20020a25b107000000b00ddd72ab233emr10126165ybj.54.1714342720245; Sun, 28 Apr 2024 15:18:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714342720; cv=none; d=google.com; s=arc-20160816; b=fak5Kp2KOmNRmUb4qvufAMKE6ECANeoa9S8m0ahnbTohhrYqQe6A4myGDrjLYUydFG onj9HPtw+IZ5p4OIa2rDsNeHbziiOhZfpknpEPAhkLrQL10ukcO0yPHo9h+vPg/HYav2 p2X1Xmnq8x79HFS8N369t5/u2WcKOGE2Fif/RiHXtc3kdsZ/ncnoWZyRYlq0ayZ+jaiN byqjazJx74eZNDo2sRQwy2iL6+ja2dZWh1L3TsfUhM3lyS/U8+Cs5jFwKAUgkrZLn2Gm qPnSe3pH/acjvAnR4z525hbgNQBa/1Ls1xYy/y8LGorXm5QDSE5V/00bhMGH6h7sXcDp xbjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=XKYG6Le200XvNAWzyHkVzuEjCu+nWrYe1aCCZD9ag2M=; fh=y+XQBUx1DD4aqQI9TeOqCWnJd/r/Md9YyjUjvbiHAAE=; b=ks6cKLv8ZjUL9N89WHL2EKliqUxyof/okj563H0R1dMkaip+To5WgXa94Ftf/JItAM YYkt7rOW0u8WUqDc0tGu9Cz42Tgp8uWOAZGBWbGZDhFmmW7rTkQ5k9GaYO4j670ETEMs Tr6BDjpclQjm7bQs91dUn5xDAlpXGsWKQkvdWEPqBPc5UsbS+WqrJuFJL/NCI4/jd3TF euUUI8dMwVDoNfyzrTfimB6fjYwDe8oZhb3MAEFaweMywDLcYbLz+McyOg+5ofIdkqZX 8Qb3D02CtmKhLpUOUEmtPZabw0uUt4dXoLfrgMGBDGjFCobI8HfMX5htHAa0dsfgKK9C 4EIQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=m7Qsuf+0; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id m2-20020a05622a118200b0043afc0e1441si134683qtk.420.2024.04.28.15.18.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Apr 2024 15:18: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=m7Qsuf+0; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s1Cph-0002wu-1S; Sun, 28 Apr 2024 18:17:17 -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 1s1CpI-0001AY-DI for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:16:55 -0400 Received: from mail-lj1-x22f.google.com ([2a00:1450:4864:20::22f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s1CpE-0005kV-ON for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:16:51 -0400 Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2d858501412so49509581fa.0 for ; Sun, 28 Apr 2024 15:16:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714342606; x=1714947406; 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=XKYG6Le200XvNAWzyHkVzuEjCu+nWrYe1aCCZD9ag2M=; b=m7Qsuf+08TAattbkToLBo+0zrvdAtTmS2kB4Ec5hR5H4Q6XM40msQuqDJ+UFILXKzI ajyvCumOTkNt3yudzmUgF7EzOFiImTXTXMBjBJ/ln4FzX+eqXU0IezbiBQ5LGw6c/Y+B sG0Fya7gBS9+XukDP48KMQrQ7ClJu7O/e5HpRFfqcv6GtvvMRzv8L/iqSLTbqwKEUTqh Zc1yFXxnhBGThZPbW8oXC6m1j2kOqTUZIJGD0Me22y42lbMdMHjyb5Ru+2SfyhkBAdf1 pJQRm4BI/9MNbnK7zGe5DErvivMKSovuzdJ6EzO1UOJmLsa68gpGSo8lSgXXRLiBZtSx huUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714342606; x=1714947406; 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=XKYG6Le200XvNAWzyHkVzuEjCu+nWrYe1aCCZD9ag2M=; b=tJuk39V7q2rR4IqToY2MvjPZwpCnn3cL7AzcfkOiDfhewUrSarsFPgvQp09NqrBChN RM0OgGh5RWHoH8WbmuGy63w/OJuszdB48B2E/gSwlQzIqDvVgjljIAK3YhXdlQ++Tc8q 6zeTSZX0p0Dm7d7JG3ULyKYQZvYAL0JfC4Oi4D6EHL4bZShPUCeozilvrngerC4S0Y7s VPcXcyyDDvIPtx+NhBAtBMnwUwmQAsA9Oam867+dQLe77YH4uMf202/CSm5JhDYxtnHL 4pKAM/WxJoie670ZEn8aWDvOaJfElTJr+hT7/pMJ0vXG/t/Rc4H2zJrAQmipNtWRyfnU xh+w== X-Gm-Message-State: AOJu0YySt44M8h8ulJm9eoFgBHw8qtMdHcvKUjAqyHLfrV4pEq8f2xQH 6xE9Pha0UrBJw8WHkXC/VBlFO5FLmfM7blUm9Bx0coQGpwwmy46spTtjWdhjPkTFYrkT9UhlIl8 c X-Received: by 2002:a05:651c:550:b0:2df:c0b8:2dd6 with SMTP id q16-20020a05651c055000b002dfc0b82dd6mr3365860ljp.21.1714342606395; Sun, 28 Apr 2024 15:16:46 -0700 (PDT) Received: from m1x-phil.lan ([176.176.142.130]) by smtp.gmail.com with ESMTPSA id g4-20020a50ee04000000b005727ea3026asm719486eds.6.2024.04.28.15.16.45 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 28 Apr 2024 15:16:45 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Anton Johansson , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , Ilya Leoshkevich Subject: [PATCH 21/24] accel/tcg: Remove NULL check in tcg_flush_jmp_cache() Date: Mon, 29 Apr 2024 00:14:47 +0200 Message-ID: <20240428221450.26460-22-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240428221450.26460-1-philmd@linaro.org> References: <20240428221450.26460-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22f; envelope-from=philmd@linaro.org; helo=mail-lj1-x22f.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 I /think/ this check added in commit 4e4fa6c12d ("accel/tcg: Complete cpu initialization before registration") is now unnecessary, but I don't have the WASM reproducer mentioned in: https://lore.kernel.org/qemu-devel/20221027141856.w5umjgklawgu7pqv@heavy/ to confirm. Ilya, do you mind testing? If so, we could squash this with the previous patch. Cc: Ilya Leoshkevich Signed-off-by: Philippe Mathieu-Daudé --- accel/tcg/translate-all.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index ca1e193633..9b02f21b23 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -652,14 +652,8 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr) */ void tcg_flush_jmp_cache(CPUState *cpu) { - CPUJumpCache *jc; + CPUJumpCache *jc = &cpu->accel->tb_jmp_cache; - /* During early initialization, the cache may not yet be allocated. */ - if (unlikely(cpu->accel == NULL)) { - return; - } - - jc = &cpu->accel->tb_jmp_cache; for (int i = 0; i < TB_JMP_CACHE_SIZE; i++) { qatomic_set(&jc->array[i].tb, NULL); } From patchwork Sun Apr 28 22:14:48 2024 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: 792936 Delivered-To: patch@linaro.org Received: by 2002:adf:cc13:0:b0:346:15ad:a2a with SMTP id x19csp1423934wrh; Sun, 28 Apr 2024 15:17:51 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVihPnrasN6omZd22w2UEU/JLNxeNTtug8KUSwmGCGk/xnCCqHCTV6Rj3Bwk4ScrS+QkEtxTmjnJbJlT/ojfBsW X-Google-Smtp-Source: AGHT+IHwgsKqr8SAw7h/zBZchWGw6bC6L1q7lXfZ6GUQITN1isrGOzaAyxwI4laay8OPsNYq0fZe X-Received: by 2002:a05:622a:59c8:b0:43a:d899:79bd with SMTP id gc8-20020a05622a59c800b0043ad89979bdmr2699317qtb.33.1714342671452; Sun, 28 Apr 2024 15:17:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714342671; cv=none; d=google.com; s=arc-20160816; b=JYZVDGXGDBRrQ3R3mTfSuMPozMDPVlK0ujHzTXrFQJ+AgIYaRlzUS1LqRVYV16gEIQ xwlM0ZvAAW1ibLwZnFGGYS946g1a3a4KD02gijvzzJzoQj8RIxjoj5m9qCNxCK3Ksz3J AewS4DcHVYqRIe7lox8NFl62VemHBXHisp04JKOWrMxB9ayV8AI0N7MtdKjNSRb+nHWn kijRWYFUGkE92tfoLbdbDBnC/NmPAIOHKhVIidomvrJ13095Z7foDpNk5yGvhvaDw6K3 +7Ja554CRkNZBr9UbELzv7gDrzN22F+Rv3OpFvEjgVhjKr1Ho3//UacvZCtqYNQoSxkL 3XqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=2r4cMzC8fAIXHZrDpn9ChefhEHuCDQQD/B5vfBV0XzY=; fh=+kTJNlX4d/Ktp/5WO5d77IkVGYcQ7tiev+NqB54rN/Q=; b=UyRQA6CiQP4TN9O4mOdBxUPOnDsfiLuTQ7fS7Xr4uVvI9v4OM4PG2atR4OMjxbBNd9 r2SKZP4Ry4kJ1ltu/ulrCbL2Ohw0JmjpWL61RibEY3S3SFWr34j8QxVxpABbY3ax1IMk /F45h+ZMcoxUC6YQzdBCWTW+2pffmy/spHNm2ppnfsR0nHyRRYF7DdrxC9AdjyFNw0xk G0E2tDl+YwP1VlZLwpDTLKvkVeApbWoiFwSCXo9FOT85rmrgZFjne/MJSmLgEZtnw7Ud +vwgsvU4YHmgiCI5fyCFvEzPtAWD08+Du4Tk/xm29SoEoX6kVWLOuSz15YSOHrlfjJQd P+bw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cTtwYmhe; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bs22-20020ac86f16000000b00439e77baa55si15365241qtb.134.2024.04.28.15.17.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Apr 2024 15:17:51 -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=cTtwYmhe; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s1Cpg-0002PO-Hh; Sun, 28 Apr 2024 18:17:16 -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 1s1CpY-00021p-62 for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:17:08 -0400 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s1CpJ-0005l0-Gf for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:17:07 -0400 Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-a58e787130fso205008966b.0 for ; Sun, 28 Apr 2024 15:16:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714342612; x=1714947412; 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=2r4cMzC8fAIXHZrDpn9ChefhEHuCDQQD/B5vfBV0XzY=; b=cTtwYmhe6kS3kdz/zzUQk8QxI00CKNbgYLhHf8Yk1kA+4lSdGUPGjv7NL5QiUxBBbx 1WzPhJuOzayVoRfmJx1/Eslzq+S/KilZIsxEoWA1bsUgiT3C1sFtDvUAQRwjzRQrUX1A Skm5dMfbBuYHnCD6CbS8wKKD/Heg5U37hGqeT0A39oHq558iXsiekxX92+9dQzZiod0O DKczK4DRKwyoFzNFLBNvNa8fwpXGAQyyCWrxJxlxxZ3130C9WE2nHnqmZGAnD8yY5HXg G7/hfDWpKD7XzBhQDyUU20Yxi4QqEKmHzzaRBV4PR8K5mev+V7Zy0iaC/5eO3dgwzDO9 /trQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714342612; x=1714947412; 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=2r4cMzC8fAIXHZrDpn9ChefhEHuCDQQD/B5vfBV0XzY=; b=SP2ItJGANIC43TbcF/LxI1/7qUz6iu+SMXzzDM8XUtTRIbMD64phftjNwEYrOOYfOi NIIXEnaf25yQFV8nEaxbnXyeU3LeowJHnjv2O5auKufga1vTVzOaH47xreOENfVV5K7L ztT7hz+ttvjZIrwcMX/hCX/hREmtmtH34f6r66U+nnx4K2nzASBnV7y8ZxLhfbiqdI6x j7dsRwgLHKvpOPLVLCR2d9vcEZGwkAA/pd8ELcKtex3key/AYZGMPFMfUz9Zapsu/XBW CBfrqnSl1rl6jY7GHosnKs6raeJYSRxXWjlG6NqJ7opjknBH7BExqI4gig2xKAyFeM5F uq8Q== X-Gm-Message-State: AOJu0Yz6eyjRT/v6s0gAjC3bEWGqlnJ0MtH4LVsHKRkg1fL7rwCdp1UR j9HhJImujKap71i6Ab02z0i00K2aeAjOUBdMvfVS6VJn8KziweELGwTDFFw7/K+Vtc/Obk++WwG K X-Received: by 2002:a17:907:a49:b0:a58:c550:a102 with SMTP id be9-20020a1709070a4900b00a58c550a102mr9594611ejc.29.1714342611791; Sun, 28 Apr 2024 15:16:51 -0700 (PDT) Received: from m1x-phil.lan ([176.176.142.130]) by smtp.gmail.com with ESMTPSA id gr13-20020a170906e2cd00b00a4e696e613esm7984526ejb.153.2024.04.28.15.16.50 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 28 Apr 2024 15:16:51 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Anton Johansson , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 22/24] accel/tcg: Move @tcg_cflags from CPUState to TCG AccelCPUState Date: Mon, 29 Apr 2024 00:14:48 +0200 Message-ID: <20240428221450.26460-23-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240428221450.26460-1-philmd@linaro.org> References: <20240428221450.26460-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::633; envelope-from=philmd@linaro.org; helo=mail-ej1-x633.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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 @tcg_cflags is specific to TCG accelerator, move it to its AccelCPUState. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- accel/tcg/vcpu-state.h | 2 ++ include/hw/core/cpu.h | 4 +--- accel/tcg/cpu-exec.c | 6 +++--- linux-user/main.c | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/accel/tcg/vcpu-state.h b/accel/tcg/vcpu-state.h index 5b31c801d8..1cdca0e0d4 100644 --- a/accel/tcg/vcpu-state.h +++ b/accel/tcg/vcpu-state.h @@ -11,9 +11,11 @@ /** * AccelCPUState: + * @cflags: Pre-computed cflags for this cpu. * @mem_io_pc: Host Program Counter at which the memory was accessed. */ struct AccelCPUState { + uint32_t cflags; uint32_t cflags_next_tb; sigjmp_buf jmp_env; diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 99709270fa..f6bafa090a 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -396,9 +396,8 @@ struct qemu_work_item; * to a cluster this will be UNASSIGNED_CLUSTER_INDEX; otherwise it will * be the same as the cluster-id property of the CPU object's TYPE_CPU_CLUSTER * QOM parent. - * Under TCG this value is propagated to @tcg_cflags. + * Under TCG this value is propagated to @accel->cflags. * See TranslationBlock::TCG CF_CLUSTER_MASK. - * @tcg_cflags: Pre-computed cflags for this cpu. * @nr_cores: Number of cores within this CPU package. * @nr_threads: Number of threads within this CPU core. * @running: #true if CPU is currently running (lockless). @@ -515,7 +514,6 @@ struct CPUState { /* TODO Move common fields from CPUArchState here. */ int cpu_index; int cluster_index; - uint32_t tcg_cflags; uint32_t halted; int32_t exception_index; diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 8f8e1fa948..84fd041aec 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -149,17 +149,17 @@ static void init_delay_params(SyncClocks *sc, const CPUState *cpu) bool tcg_cflags_has(CPUState *cpu, uint32_t flags) { - return cpu->tcg_cflags & flags; + return cpu->accel->cflags & flags; } void tcg_cflags_set(CPUState *cpu, uint32_t flags) { - cpu->tcg_cflags |= flags; + cpu->accel->cflags |= flags; } uint32_t curr_cflags(CPUState *cpu) { - uint32_t cflags = cpu->tcg_cflags; + uint32_t cflags = cpu->accel->cflags; /* * Record gdb single-step. We should be exiting the TB by raising diff --git a/linux-user/main.c b/linux-user/main.c index 5f7f03f4b0..8be06627da 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -241,7 +241,7 @@ CPUArchState *cpu_copy(CPUArchState *env) /* Reset non arch specific state */ cpu_reset(new_cpu); - new_cpu->tcg_cflags = cpu->tcg_cflags; + new_cpu->accel->cflags = cpu->accel->cflags; memcpy(new_env, env, sizeof(CPUArchState)); #if defined(TARGET_I386) || defined(TARGET_X86_64) new_env->gdt.base = target_mmap(0, sizeof(uint64_t) * TARGET_GDT_ENTRIES, From patchwork Sun Apr 28 22:14:49 2024 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: 792938 Delivered-To: patch@linaro.org Received: by 2002:adf:cc13:0:b0:346:15ad:a2a with SMTP id x19csp1424065wrh; Sun, 28 Apr 2024 15:18:23 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWIwUYzBXQWYJWi8zXWfxb35m2BXVuZ5kcxYkeRC2YCNvWbRgv268o2BMDY9/Gkbf3mNcXx/YnC0dSl4L8leBtV X-Google-Smtp-Source: AGHT+IFCY07SbBuk7XmtAc139RZTYg/mgI7WX13iiSYm0RAl1qZq5lpagj38kSqQdJPl7mzQkFQm X-Received: by 2002:a05:620a:4910:b0:78e:5148:b04f with SMTP id vy16-20020a05620a491000b0078e5148b04fmr8850018qkn.61.1714342703070; Sun, 28 Apr 2024 15:18:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714342703; cv=none; d=google.com; s=arc-20160816; b=gCJnjSpXNX0yWOqvOfVQfZWE581WKkW6lqsbW4OOr7fKZwUl0jzIsT4wr66OeIcQRW snPiNi/soOs6+0r/C88dDQRymMiJ86+5h2MNdmnRj7V7ExQy5wQRcrUP0TnA98Ab9TUm ubqRyuwJPH5u1/xX0XzgFinrvyDe72zy2FFAlk8gvuVy0OHkA42pdyOWUaklHb5Odnw5 A4n5/ewXHd9zlzZY/zOx/FL5SrOYdrhbca6Qd/0IttrH/JsTqf3ERFv1R8mgbIQIPzz/ OIv1fMpCEhV+7tkSBxFSo5kRmtrZGyrN5Xh2wiAroXM0NwhetS2DTOXSsXQfVs/cvgWq vfzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=5RHFpScpX3RBz3SndWvBFhPouPtIMynd6+ol800GYZ0=; fh=+kTJNlX4d/Ktp/5WO5d77IkVGYcQ7tiev+NqB54rN/Q=; b=qTc7cg0SifsYKwKuzRy3yVLr2WbES+wLMcPtAH0pOBS7D5FF7an5WSMpMs62JoIYns Cpc2PobCKz5kut+u44OM8BWut4PjLykbOgoLhlJKf9228aOKpBQxJTuYlIkhjtLcMaEZ JSEGPy4UOlHodSpkx8wK2vffsZk39kBfslk5T/E2Z0NT+Y1x016m/dmG07Z4nY3w8v23 TqsmbfZKxgwJMhVXELJ35HRlWiAb0mZ3iEYmkhGFetWpXLIaVj+Ta3sYvXaluPjApWO+ Ck9D45FkTzdQG+cteLOGwk5oihc4D+y1ez4fcKge2OGr1qHJFE0g1/nwUty4P4nscLDo WyaQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PQosyhLw; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id yf13-20020a05620a3bcd00b0078d699ba683si24352801qkn.635.2024.04.28.15.18.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Apr 2024 15:18:23 -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=PQosyhLw; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s1Cpi-0002ze-4r; Sun, 28 Apr 2024 18:17:18 -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 1s1CpS-0001iB-Jk for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:17:03 -0400 Received: from mail-ej1-x62e.google.com ([2a00:1450:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s1CpP-0005lb-P8 for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:17:02 -0400 Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-a4702457ccbso513924066b.3 for ; Sun, 28 Apr 2024 15:16:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714342617; x=1714947417; 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=5RHFpScpX3RBz3SndWvBFhPouPtIMynd6+ol800GYZ0=; b=PQosyhLwrUJQFw01doa4zBCubWS7sveYWpp4LU4PUcHrajtJrajymsHrWcGcafuTyL Q29c1MylxnA+H+4rY3THl7j3cKPLYKQH4qssxo7q35otlPZghoNNMyY3RV2knd7H1NJd 1f2senut0CBmij0aWfYobLayFKLUJ52USWq0PtZsmC6cARxKWckzm2RhdsW0Ow9q3bWw o9mg98anh0DsXy/xd+jTB3XqA8u5GOfSuvNmCaSkGpF74wg7LDjcNf2qzuFyP9i50Jqd n3peO6jYEWTa9Guvo5Sxk4GM5Y/Wpg5lhoKabJ5G527sz5j1HRkwccUCX1qzdwCIv/5L FbPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714342617; x=1714947417; 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=5RHFpScpX3RBz3SndWvBFhPouPtIMynd6+ol800GYZ0=; b=kYRLSVUKHsS35e9odez6MsHHMrJj7ZDjmK9y23Jl3xnD/LmdxWqgNMC76riYkmT0xJ /IjDPEYMVfIR9U2LZftcuy7B4TuJbv2aOQNYfw1WFyHf9OjOSAehmsyv5Vs/ps6Mv0oc NsnV71cvOC096G8yr13k5MvxdrsFL6sJS1JAbn0T22vKyBdIWaKmTXPqb57JU2TzYUpx xsAHqCBCwFkxx5lfftNfKhFVmJdcCQtH67UW2qdg2uvoZCPuK1ridOvG6avaIuwWsY6L CFkHHq48GOy51MqnZRYyPA3j38cfZVSvuzRI6Loeo4k++cZHc+8TRNp83QreyUWnvx44 wy2w== X-Gm-Message-State: AOJu0Yz0V/szhKMiot3XzXoAOcCeYXxmZthDeupWpnfNmbOkLeYw8frk NuUjizWBG6rL6vPcR9tCgCN+N9geNQ6Mlvm7ujKj251CUTSk1D+wq63vYkb1T7lTs5kriC9z11X s X-Received: by 2002:a17:906:2bcd:b0:a58:cd39:d154 with SMTP id n13-20020a1709062bcd00b00a58cd39d154mr4272888ejg.11.1714342617110; Sun, 28 Apr 2024 15:16:57 -0700 (PDT) Received: from m1x-phil.lan ([176.176.142.130]) by smtp.gmail.com with ESMTPSA id p2-20020a170906614200b00a588e0e0d9bsm5903912ejl.93.2024.04.28.15.16.56 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 28 Apr 2024 15:16:56 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Anton Johansson , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 23/24] accel/tcg: Restrict icount to system emulation Date: Mon, 29 Apr 2024 00:14:49 +0200 Message-ID: <20240428221450.26460-24-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240428221450.26460-1-philmd@linaro.org> References: <20240428221450.26460-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62e; envelope-from=philmd@linaro.org; helo=mail-ej1-x62e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org So far we don't support icount on user emulation. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- accel/tcg/cpu-exec.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 84fd041aec..1f618f6c2e 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -780,6 +780,9 @@ static inline bool cpu_handle_exception(CPUState *cpu, int *ret) static inline bool icount_exit_request(CPUState *cpu) { +#if defined(CONFIG_USER_ONLY) + return false; +#else if (!icount_enabled()) { return false; } @@ -787,6 +790,7 @@ static inline bool icount_exit_request(CPUState *cpu) return false; } return cpu->neg.icount_decr.u16.low + cpu->icount_extra == 0; +#endif } static inline bool cpu_handle_interrupt(CPUState *cpu, @@ -801,12 +805,14 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, return false; } +#if !defined(CONFIG_USER_ONLY) /* Clear the interrupt flag now since we're processing * cpu->interrupt_request and cpu->exit_request. * Ensure zeroing happens before reading cpu->exit_request or * cpu->interrupt_request (see also smp_wmb in cpu_exit()) */ qatomic_set_mb(&cpu->neg.icount_decr.u16.high, 0); +#endif /* !CONFIG_USER_ONLY */ if (unlikely(qatomic_read(&cpu->interrupt_request))) { int interrupt_request; From patchwork Sun Apr 28 22:14:50 2024 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: 792939 Delivered-To: patch@linaro.org Received: by 2002:adf:cc13:0:b0:346:15ad:a2a with SMTP id x19csp1424129wrh; Sun, 28 Apr 2024 15:18:39 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV9+Y9BxqgjRobSpJrTAMn+o3Jlm8iu7+edmv06wBnN+7embfC8J4g4z95oq93G6TOzh9GWWv3UcaVyUJShjPKe X-Google-Smtp-Source: AGHT+IHL7roMmN/xmwulT1FVRhg4YNcEvgWH99Mu/bJ/QzO9IZewHa5bD3OTwEUsD/j/TqBGgY0J X-Received: by 2002:a05:6870:8903:b0:238:f752:b1f with SMTP id i3-20020a056870890300b00238f7520b1fmr8783314oao.59.1714342719535; Sun, 28 Apr 2024 15:18:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1714342719; cv=none; d=google.com; s=arc-20160816; b=oj7wxxyl15kIzRYiF39+VMYcnY7DpkVm3UQGXkEfeEA5+DOzYf2cWE6wfPi3loamOC dJYo8epDP7GScFpL6Dm5cG0rSTgHV8wOVSnIF85lR1ZMccLFYoV+71WbyMwhqxEwS0Sk 2Mjy2XsKM94vu1O0wG/ln2QYMkIsImimeqRquAKUw1MlMEMfZNtfYIpHL1mlwyDJgUWP ahR8gzEvyL1MZzLFlHi0S7hUjtj1pqjuCxQpc8ZuGMhGCUnCd024nAuAmIFbGH5vpk9b vjtrWtvRMVD/vzVY0oKK3xAm1JOKmcYuS9l6EM7JxtonHXbaxPnxkriVc/12HzMuadBU Rfcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=mpu8mPAjAI54fYmowTzJbxJYPBAzCYm8H+IKimQD/FY=; fh=+kTJNlX4d/Ktp/5WO5d77IkVGYcQ7tiev+NqB54rN/Q=; b=tTO+0/X1Q8jp181H3zj7uGIacJo6f98XngzSSe5R44NLajhWCNAZCH2xo4RGBK4C+C q5ca/t+bewa1j5FiAvsMv3CzkViLPC1d7vKOD1emPKHglEBnsMdjl824Szv7kzXb0QVh gCj0GbYL88HbaTPVS4NpIz0Axj1YMYi4ZZNF+elzszbJaIevtt6pAgqQywPRHozkQgGG PiUb798sNTebk6FJToQhNCI4Ag20AdqmDkI+t7I8F0RGiaCUWWYgbjZ+XpQuauZX63dK fgRYejDT9umCmWgZFQ3Q9C8l0JbtReyfewYpIDOOqkMFhYCRwwtYfL8MuGgEvmB/1qF8 DrNw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KctTi4IB; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c1-20020a37e101000000b0078d6ee9092csi25557328qkm.372.2024.04.28.15.18.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Apr 2024 15:18:39 -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=KctTi4IB; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s1Cpj-00032u-0p; Sun, 28 Apr 2024 18:17: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 1s1CpX-000206-Nj for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:17:07 -0400 Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s1CpU-0005m7-6A for qemu-devel@nongnu.org; Sun, 28 Apr 2024 18:17:06 -0400 Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-571ba432477so3938538a12.1 for ; Sun, 28 Apr 2024 15:17:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714342622; x=1714947422; 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=mpu8mPAjAI54fYmowTzJbxJYPBAzCYm8H+IKimQD/FY=; b=KctTi4IBZASaVwv0A9QM64WDZHYKgIdPdKWpYl5yAKHYeuyPKYwS6arsZQoBatPFMS 4699Mk1iQkMy0BKUU8x4jg4sGN757uZ9sAOhVq7DnFFfnQRWF+zkf88GQpZo4imRGox7 dE35Gj4ySrb6yYJ66Wv9h162ZGSXpVb9y99VjZifPOMEHX0Od30sovTh/EBnp+xjNIB0 nfsmFaozkdwza3tihgeJ7Ov70xEWVIxwPXBbTOvnAHK8HgCkQEeUgjwT90b5GsOuB+nc qchAX7OBtbm6JPdnXEUiZZLuX5rMM1NZ+Zh2Y7SAZv58vbp8mKKXpE/RCWEXAG6VMnlo chLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714342622; x=1714947422; 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=mpu8mPAjAI54fYmowTzJbxJYPBAzCYm8H+IKimQD/FY=; b=S317ynJ+Cl2cVqqhBAWhe+SLDv4qAsHCxBb8uoA1g4CsqrU1Eem5NRRcP5VtyrWtem gdb8g0B/r6FVvnPlIQhazSQWn8dn0f1Kfcbslr0Uv9k7fqN7TLlcjiOMi+1ukASbLWnJ WBoFBfwkpw2fo9euDUvEm3CQ4uDbUJW6Ki2rHYlRRCHCD7JdSTe75dZgPFYiP37+Jhy7 VAkv6xE2fh58I3qV6cQ6Zh9nmYEgNqeTTJTsHzBTjULd31HXAV5bNFkwiG1gQ3Uzmyva ThlqZsbWX57EE5yllrF/axKjA4XT5/j1v59U/4MQySRSBpbPUruABRfRk18dHVZpf/gQ Z9pg== X-Gm-Message-State: AOJu0YyuZvZTiScpKrHHUxhbdd/wZLVaKP1RpHvoHGu0eq0BdiYGkMOK 7nkWH1mg5xRTxF+IENvCIU2IVhXFk9YVkMWuRwy/tAOEyuo3m8BB1ScHtacOqKQgjai/alPhEHN x X-Received: by 2002:a05:6402:1cb8:b0:572:5310:4ae1 with SMTP id cz24-20020a0564021cb800b0057253104ae1mr4462942edb.0.1714342622584; Sun, 28 Apr 2024 15:17:02 -0700 (PDT) Received: from m1x-phil.lan ([176.176.142.130]) by smtp.gmail.com with ESMTPSA id o12-20020aa7dd4c000000b005704419f56csm12398431edw.86.2024.04.28.15.17.01 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 28 Apr 2024 15:17:02 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Anton Johansson , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= Subject: [PATCH 24/24] accel/tcg: Move icount fields from CPUState to TCG AccelCPUState Date: Mon, 29 Apr 2024 00:14:50 +0200 Message-ID: <20240428221450.26460-25-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240428221450.26460-1-philmd@linaro.org> References: <20240428221450.26460-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52d; envelope-from=philmd@linaro.org; helo=mail-ed1-x52d.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 Both @icount_budget and @icount_extra fields are specific to TCG accelerator, move them to its AccelCPUState. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- accel/tcg/vcpu-state.h | 4 ++++ include/hw/core/cpu.h | 3 --- accel/tcg/cpu-exec.c | 14 +++++++------- accel/tcg/icount-common.c | 7 ++++--- accel/tcg/tcg-accel-ops-icount.c | 14 +++++++------- accel/tcg/tcg-accel-ops.c | 1 + hw/core/cpu-common.c | 1 - 7 files changed, 23 insertions(+), 21 deletions(-) diff --git a/accel/tcg/vcpu-state.h b/accel/tcg/vcpu-state.h index 1cdca0e0d4..9bb8afac57 100644 --- a/accel/tcg/vcpu-state.h +++ b/accel/tcg/vcpu-state.h @@ -12,6 +12,7 @@ /** * AccelCPUState: * @cflags: Pre-computed cflags for this cpu. + * @icount_extra: Instructions until next timer event. * @mem_io_pc: Host Program Counter at which the memory was accessed. */ struct AccelCPUState { @@ -24,6 +25,9 @@ struct AccelCPUState { #ifdef CONFIG_USER_ONLY TaskState *ts; #else + int64_t icount_budget; + int64_t icount_extra; + uintptr_t mem_io_pc; /* track IOMMUs whose translations we've cached in the TCG TLB */ diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index f6bafa090a..bdcb09b464 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -411,7 +411,6 @@ struct qemu_work_item; * @unplug: Indicates a pending CPU unplug request. * @crash_occurred: Indicates the OS reported a crash (panic) for this CPU * @singlestep_enabled: Flags for single-stepping. - * @icount_extra: Instructions until next timer event. * @cpu_ases: Pointer to array of CPUAddressSpaces (which define the * AddressSpaces this CPU has) * @num_ases: number of CPUAddressSpaces in @cpu_ases @@ -471,8 +470,6 @@ struct CPUState { /* updates protected by BQL */ uint32_t interrupt_request; int singlestep_enabled; - int64_t icount_budget; - int64_t icount_extra; uint64_t random_seed; QemuMutex work_mutex; diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 1f618f6c2e..7c21542e52 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -74,7 +74,7 @@ static void align_clocks(SyncClocks *sc, CPUState *cpu) return; } - cpu_icount = cpu->icount_extra + cpu->neg.icount_decr.u16.low; + cpu_icount = cpu->accel->icount_extra + cpu->neg.icount_decr.u16.low; sc->diff_clk += icount_to_ns(sc->last_cpu_icount - cpu_icount); sc->last_cpu_icount = cpu_icount; @@ -125,7 +125,7 @@ static void init_delay_params(SyncClocks *sc, CPUState *cpu) sc->realtime_clock = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL_RT); sc->diff_clk = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) - sc->realtime_clock; sc->last_cpu_icount - = cpu->icount_extra + cpu->neg.icount_decr.u16.low; + = cpu->accel->icount_extra + cpu->neg.icount_decr.u16.low; if (sc->diff_clk < max_delay) { max_delay = sc->diff_clk; } @@ -718,7 +718,7 @@ static inline bool cpu_handle_exception(CPUState *cpu, int *ret) if (cpu->exception_index < 0) { #ifndef CONFIG_USER_ONLY if (replay_has_exception() - && cpu->neg.icount_decr.u16.low + cpu->icount_extra == 0) { + && cpu->neg.icount_decr.u16.low + cpu->accel->icount_extra == 0) { /* Execute just one insn to trigger exception pending in the log */ cpu->accel->cflags_next_tb = (curr_cflags(cpu) & ~CF_USE_ICOUNT) | CF_NOIRQ | 1; @@ -789,7 +789,7 @@ static inline bool icount_exit_request(CPUState *cpu) if (!(cpu->accel->cflags_next_tb == -1 || cpu->accel->cflags_next_tb & CF_USE_ICOUNT)) { return false; } - return cpu->neg.icount_decr.u16.low + cpu->icount_extra == 0; + return cpu->neg.icount_decr.u16.low + cpu->accel->icount_extra == 0; #endif } @@ -941,9 +941,9 @@ static inline void cpu_loop_exec_tb(CPUState *cpu, TranslationBlock *tb, /* Ensure global icount has gone forward */ icount_update(cpu); /* Refill decrementer and continue execution. */ - int32_t insns_left = MIN(0xffff, cpu->icount_budget); + int32_t insns_left = MIN(0xffff, cpu->accel->icount_budget); cpu->neg.icount_decr.u16.low = insns_left; - cpu->icount_extra = cpu->icount_budget - insns_left; + cpu->accel->icount_extra = cpu->accel->icount_budget - insns_left; /* * If the next tb has more instructions than we have left to @@ -952,7 +952,7 @@ static inline void cpu_loop_exec_tb(CPUState *cpu, TranslationBlock *tb, */ if (insns_left > 0 && insns_left < tb->icount) { assert(insns_left <= CF_COUNT_MASK); - assert(cpu->icount_extra == 0); + assert(cpu->accel->icount_extra == 0); cpu->accel->cflags_next_tb = (tb->cflags & ~CF_COUNT_MASK) | insns_left; } #endif diff --git a/accel/tcg/icount-common.c b/accel/tcg/icount-common.c index 8d3d3a7e9d..ff503f8e96 100644 --- a/accel/tcg/icount-common.c +++ b/accel/tcg/icount-common.c @@ -38,6 +38,7 @@ #include "sysemu/cpu-timers.h" #include "sysemu/cpu-throttle.h" #include "sysemu/cpu-timers-internal.h" +#include "accel/tcg/vcpu-state.h" /* * ICOUNT: Instruction Counter @@ -71,8 +72,8 @@ static void icount_enable_adaptive(void) */ static int64_t icount_get_executed(CPUState *cpu) { - return (cpu->icount_budget - - (cpu->neg.icount_decr.u16.low + cpu->icount_extra)); + return (cpu->accel->icount_budget - + (cpu->neg.icount_decr.u16.low + cpu->accel->icount_extra)); } /* @@ -83,7 +84,7 @@ static int64_t icount_get_executed(CPUState *cpu) static void icount_update_locked(CPUState *cpu) { int64_t executed = icount_get_executed(cpu); - cpu->icount_budget -= executed; + cpu->accel->icount_budget -= executed; qatomic_set_i64(&timers_state.qemu_icount, timers_state.qemu_icount + executed); diff --git a/accel/tcg/tcg-accel-ops-icount.c b/accel/tcg/tcg-accel-ops-icount.c index 9e1ae66f65..75073ec23f 100644 --- a/accel/tcg/tcg-accel-ops-icount.c +++ b/accel/tcg/tcg-accel-ops-icount.c @@ -112,16 +112,16 @@ void icount_prepare_for_run(CPUState *cpu, int64_t cpu_budget) * asynchronously by cpu_exit/cpu_interrupt/tcg_handle_interrupt */ g_assert(cpu->neg.icount_decr.u16.low == 0); - g_assert(cpu->icount_extra == 0); + g_assert(cpu->accel->icount_extra == 0); replay_mutex_lock(); - cpu->icount_budget = MIN(icount_get_limit(), cpu_budget); - insns_left = MIN(0xffff, cpu->icount_budget); + cpu->accel->icount_budget = MIN(icount_get_limit(), cpu_budget); + insns_left = MIN(0xffff, cpu->accel->icount_budget); cpu->neg.icount_decr.u16.low = insns_left; - cpu->icount_extra = cpu->icount_budget - insns_left; + cpu->accel->icount_extra = cpu->accel->icount_budget - insns_left; - if (cpu->icount_budget == 0) { + if (cpu->accel->icount_budget == 0) { /* * We're called without the BQL, so must take it while * we're calling timer handlers. @@ -139,8 +139,8 @@ void icount_process_data(CPUState *cpu) /* Reset the counters */ cpu->neg.icount_decr.u16.low = 0; - cpu->icount_extra = 0; - cpu->icount_budget = 0; + cpu->accel->icount_extra = 0; + cpu->accel->icount_budget = 0; replay_account_executed_instructions(); diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c index 5429e2d219..86bc82b891 100644 --- a/accel/tcg/tcg-accel-ops.c +++ b/accel/tcg/tcg-accel-ops.c @@ -89,6 +89,7 @@ static void tcg_cpu_reset_hold(CPUState *cpu) qatomic_set(&cpu->neg.icount_decr.u32, 0); cpu->neg.can_do_io = true; + cpu->accel->icount_extra = 0; cpu->accel->mem_io_pc = 0; cpu->accel->cflags_next_tb = -1; } diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c index 684422991c..6dc94b1eaf 100644 --- a/hw/core/cpu-common.c +++ b/hw/core/cpu-common.c @@ -117,7 +117,6 @@ static void cpu_common_reset_hold(Object *obj, ResetType type) cpu->interrupt_request = 0; cpu->halted = cpu->start_powered_off; - cpu->icount_extra = 0; cpu->exception_index = -1; cpu->crash_occurred = false;