From nobody Sat Nov 15 14:09:41 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1751453476; cv=none; d=zohomail.com; s=zohoarc; b=KwYwr72esueV5rlKkNH9zE5TW++IZ8nSLs54z4tWlo5pkDIPpf2sgn4zi2dpehCuhDj9bf5OT9ZBlnED9oeLSg/9s0hnzi7pxf5loxdBi48Z2uC7v7FfRYG7/Epw7pKy36sMgh3XjapfFmHUK8NvCfnZRzILXeOsJhgUC4gFA9o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751453476; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=D4wxQdFgaAl/kwo8ASXJ9vsmD0ZBYPLir6xKV4La3T8=; b=mjH+lRPUwfjM90RuNm5gDT8lH4vkdNN+PwubTNo9Pr/jz69YRcItEHNLKhA4doEK7KYmdp74jep0Ti37cKwmuDs4NR1xbn78/YlwGKj2i319MxPkXPCfwVa8YRg5Mr3ovd0JvPVsiRzSaAuteuzFfn/Ev2fp8Co6y7cUyCU+fOk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 175145347640211.051210075426866; Wed, 2 Jul 2025 03:51:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWv2c-0000AL-El; Wed, 02 Jul 2025 06:50:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWv2X-0008WJ-PY for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:50:10 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWv2P-0002oH-Bu for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:50:09 -0400 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-3a4ef2c2ef3so3718700f8f.2 for ; Wed, 02 Jul 2025 03:49:59 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4538233c05csm225289715e9.5.2025.07.02.03.49.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jul 2025 03:49:56 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id D930D5F8CC; Wed, 02 Jul 2025 11:49:55 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751453398; x=1752058198; 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=D4wxQdFgaAl/kwo8ASXJ9vsmD0ZBYPLir6xKV4La3T8=; b=r/NsE/FEoLkYY1p/+97sekE3NLKOWpWgfSLcmvAOXXxrV1H+HZtfcQRm7po5Efi3hG kIDnp0p0azIxaN601tmoToZHUvVrWEwd68qAs3T9p/VDm4JbqkbATFaOO3C40DVblKPk PoEDbICy9gpTImy8QzdJ4sRsGW1r0uFaJM/vqEA40UuebP0Bag4TWPjiOzNAsG81LNwv +5JKU0sOSbNi+6cscfUgptODIQiKo3LloI4TEkg/VOal+pfhvDmO1wyDwiGHnyTjTbZU HYXOluCu6iQ/mrES0VyRuZgNJ8AJ3yr60kwFVrxuNg8zrWF5neYLgKeBiJtDcWlBq6dL Qedg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751453398; x=1752058198; 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=D4wxQdFgaAl/kwo8ASXJ9vsmD0ZBYPLir6xKV4La3T8=; b=izB6WoNS7SycMCM0CpKJ7ltT9Thh79f0q9yPIdHPdn0i0PhY0Jzl3O8q5pkZqdzwz9 kZbWXtJn5bNq7b9lc4ySr/1epbxWYppot/YtBFLph8apCvE5fCxTXtxWi7q9Z3W+mhDx qU+nwB+OFedZsYsvjfuFircg4LQaGdZtKnyTu4JVujaUuuy7pvky6D36yLSDh5c7gUfQ 7mQXSSTKvURZKWd10X4Jniow/+lMI0d8mE7Jm2H0edRBZXuz54xpTYzuc5vag4YcpIHN +SR3PKGUqb/D1resTd3keA7qFEWTZt9d4/e4FIV9PpYn+aWxZ95CwoA5M4xF5imwPRuW DYjg== X-Gm-Message-State: AOJu0YwgqPVCfCplyU8ot1n1Va8jfsrodU+sy9wgP38lGUW3cMmqhHpn kue73P6700AaxfguSwlLtkzHplat4nNPodUFuUb/Sf11kehacmLDCEznm3OxskGMzCY= X-Gm-Gg: ASbGnctacQZ3WymhFS9GzErydWmsBMyh7PXd2OCtF+m1qG9ZP8Kapr9VVyR1NRmgb+3 PQE0LkRTV1OSoLs3nxlbuHbI6tW4FNWHkHTOZxOi8XXksLQWT9e0IQ28BWMKeSKpfxDOKppzfmg uCi2QznqKS+vXo3MQXjvWJfEgtTC9csZmvr2vu3GF0gLSXljJpk4gzNQQzpqy1D7xOQHl6e6tog ceW77zDwcStJhm+sIMtpM07UYbwpyVEdZ/d1/H9nRVXqRlFDH1p/gMn744Zc2Dm2PVwU52sf9CL UnGjWszlit8wwpdpkKR9xWKlSHeQ4PI6hlL8Fbp0l330FJ1Iry2pOYRyMomxmnY= X-Google-Smtp-Source: AGHT+IHiJmd1PHb0EgKL3rPDnUOVIqSxfmiwnBfb52dpavbdPWpjQmsbhlKFJuuYXfVHE1AzL3IA5A== X-Received: by 2002:a05:6000:480b:b0:3a3:648d:aa84 with SMTP id ffacd0b85a97d-3b1fdc20ce5mr1758366f8f.5.1751453398332; Wed, 02 Jul 2025 03:49:58 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Huth , qemu-s390x@nongnu.org (open list:S390 general arch...) Subject: [PULL 01/15] gitlab: mark s390x-system to allow failures Date: Wed, 2 Jul 2025 11:49:41 +0100 Message-ID: <20250702104955.3778269-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250702104955.3778269-1-alex.bennee@linaro.org> References: <20250702104955.3778269-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42c.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=unavailable 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751453478439116600 The system tests (usually qos-test or migration-test) prove to be very susceptible on the s390x runners. Although we have boosted memory and virtual CPUs on the runners problems persist. For now mark test as allow_failure so the its clear on the CI UI when checking test results. Signed-off-by: Alex Benn=C3=A9e Message-ID: <20250627112512.1880708-2-alex.bennee@linaro.org> diff --git a/.gitlab-ci.d/custom-runners/ubuntu-22.04-s390x.yml b/.gitlab-c= i.d/custom-runners/ubuntu-22.04-s390x.yml index ca374acb8c..e62ff1763f 100644 --- a/.gitlab-ci.d/custom-runners/ubuntu-22.04-s390x.yml +++ b/.gitlab-ci.d/custom-runners/ubuntu-22.04-s390x.yml @@ -31,7 +31,9 @@ ubuntu-22.04-s390x-all-system: timeout: 75m rules: - if: '$CI_PROJECT_NAMESPACE =3D=3D "qemu-project" && $CI_COMMIT_BRANCH = =3D~ /^staging/' + allow_failure: true - if: "$S390X_RUNNER_AVAILABLE" + allow_failure: true script: - mkdir build - cd build --=20 2.47.2 From nobody Sat Nov 15 14:09:41 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1751453542; cv=none; d=zohomail.com; s=zohoarc; b=axEKSpMfKE8voVDjDhfBlHaAV5yeazp0VYUXbm6TaGR0nMxgNdqDuRkb0mUfyJt5dnE8C0b9oFCGtFDV0LuwsnjxGtvZu1zHs2N9bcjhyRsulB9VqNUx0VnsxIuMKth6rgM1H0/7yOEewOJ3cEL1dm+LgajDpABn6FCi6sNNQug= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751453542; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=DQDGpu2DK2e5jYtAk3+B2u316yUnK6jEtaDaYh1M9uM=; b=j49C91cFg40TY4g8bkT7suXNkXzbYJN9to4Gr319LU2Yk7nDo7Zazf5RCFyGCe25ZgCyo2ZuhTw0tEQSETjcQ7RxfjKK7JsN6oE+qqfXmKW3HveS1VdRxu6vHXA+ihZAaE6PzVPfjCPQusVrs/usduabNNbb50e0ff7580dG3AU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1751453542536264.7623995953346; Wed, 2 Jul 2025 03:52:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWv2b-00007X-EI; Wed, 02 Jul 2025 06:50:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWv2U-0008VH-QT for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:50:07 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWv2O-0002o0-05 for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:50:06 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-4538a2fc7ffso44870125e9.0 for ; Wed, 02 Jul 2025 03:49:59 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a88c7fb67dsm16071010f8f.35.2025.07.02.03.49.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jul 2025 03:49:56 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id F097C5F8D6; Wed, 02 Jul 2025 11:49:55 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751453397; x=1752058197; 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=DQDGpu2DK2e5jYtAk3+B2u316yUnK6jEtaDaYh1M9uM=; b=uxOw+j9FukRiZox/oJAjeEbWyyvyy7IoG3kz8lwEnPE9Adagw+QY21HhdaiBMUVPf6 rSKj/vwL3UepZnLmyt1xU2ujHt3urGBDYx7aiOLS4W0xshV2+QdGlZPfMvbXQYHQ6d/A /Fi+VJVtu5EPGGihZYKh50IlRO0JB4pz9YbcmT3qaSk5ubiApenpZG2SrLmT2HhAlk8v ZJM8LyGv6FC5aqC3zzSZig8yi0uCROBUzTh52aGa4IMA1G9B0hPMMo/dumd57iEv7OIC ZmIIE/rYuOMx+csixFdQ6QbIjd6GKEySxiAaZo9jYcPmMz0jGfYTst5/chP6XR7RXQVg VQBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751453397; x=1752058197; 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=DQDGpu2DK2e5jYtAk3+B2u316yUnK6jEtaDaYh1M9uM=; b=FpXnptgTgo0cjaqRae6d4HVlL9haF8zSHCgJmqHX74k7c0nhkWCLtveybx+nspo8pg xGQjQ368iwTlotilD1wa8ZntG8gTvOhHxRS5EtMPqeGDRSgwv2mCrnFHLR1cXaNRSO0L LgUbRHoZLa+fZw6hAUbcrS+ucDaJsl3UHzzRHqZ8oUL6YpijIcPlr3bjZ6+NPxBK35ep I4lcLTI+dstf4AepcmesigoUB9dGXiuVQ16kGw0st8XFSrv7sTV4UT5YB4pbnGUitrqi vOOWyIchYqfKVDIiQMenytt2MN/K+UyAUjxpzNwUDbNN6uytyeFAPhSeiiK64FYWuqA8 nBGA== X-Gm-Message-State: AOJu0Yxn/sD8DcU5hU6MzcTlaMx1Is1BcFlcWNi0IK8LnzuZsdcsA++D /T3klgvVifXt6hWyWSqr8kopoQbvhKnjy6suQd8u0Nmh+jmQpHX+Um/dSTvqZj4ja2U= X-Gm-Gg: ASbGnctzgDCq6W/nLku6FgEoegvOu7wY//6L0vvnSqxnvZCRuIp+OddqhofkcBC+FV/ RISo2KgIrjDhbUaTyWODylEp17ek2PkE2/x67OtOhXU1LirzsR2OWhJlJuSaNITCmZsI0UJZuDz 7qu8dVvPK+KHSW6SdfYdu+GBCnKvBWqo+Ny4/04S5w0+9PlpXppnegY0L8uacaklNqVHCDpEvLC //7Z2wWuYN+w77xUiGUrsaYBAK3fvXhqOqSA1Z5U7yNQ0vzbEovC9KlgiRr2tK/B6qbPBeA5GR1 l6XzbzuhDX9xq/aOowHhYtAXDQ48IUOh+RME1GRXVIxyQEWcZGovrk7Q7E4/mkg= X-Google-Smtp-Source: AGHT+IG35Lq9GVUwjVqutJmVlIZPd4qpsF9g4eWdlLENhMgRhfxJh0ha/WjnxOIkNpjyjbTJzsb4BQ== X-Received: by 2002:a05:600c:609a:b0:453:10c1:cb21 with SMTP id 5b1f17b1804b1-454a3c25487mr24137365e9.8.1751453397516; Wed, 02 Jul 2025 03:49:57 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Gustavo Romero , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Thomas Huth , =?UTF-8?q?Alex=20Benn=C3=A9e?= , qemu-arm@nongnu.org (open list:ARM PCI Hotplug) Subject: [PULL 02/15] tests/functional: Add PCI hotplug test for aarch64 Date: Wed, 2 Jul 2025 11:49:42 +0100 Message-ID: <20250702104955.3778269-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250702104955.3778269-1-alex.bennee@linaro.org> References: <20250702104955.3778269-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 autolearn=unavailable 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751453543534116600 From: Gustavo Romero Add a functional test, aarch64_hotplug_pci, to exercise PCI hotplug and hot-unplug on arm64. Signed-off-by: Gustavo Romero Reviewed-by: Daniel P. Berrang=C3=A9 Acked-by: Thomas Huth Message-ID: <20250528203137.1654964-1-gustavo.romero@linaro.org> [AJB: trimmed boilerplate for checkpatch, simplified invocations] Signed-off-by: Alex Benn=C3=A9e Message-ID: <20250627112512.1880708-3-alex.bennee@linaro.org> diff --git a/MAINTAINERS b/MAINTAINERS index d1672fda8d..850588fb64 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2089,6 +2089,12 @@ S: Supported F: include/hw/pci/pcie_doe.h F: hw/pci/pcie_doe.c =20 +ARM PCI Hotplug +M: Gustavo Romero +L: qemu-arm@nongnu.org +S: Supported +F: tests/functional/test_aarch64_hotplug_pci.py + ACPI/SMBIOS M: Michael S. Tsirkin M: Igor Mammedov diff --git a/tests/functional/meson.build b/tests/functional/meson.build index e9f19d54a2..53721c97ec 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -83,6 +83,7 @@ tests_aarch64_system_quick =3D [ tests_aarch64_system_thorough =3D [ 'aarch64_aspeed_ast2700', 'aarch64_aspeed_ast2700fc', + 'aarch64_hotplug_pci', 'aarch64_imx8mp_evk', 'aarch64_raspi3', 'aarch64_raspi4', diff --git a/tests/functional/test_aarch64_hotplug_pci.py b/tests/functiona= l/test_aarch64_hotplug_pci.py new file mode 100755 index 0000000000..c9bb7f1d97 --- /dev/null +++ b/tests/functional/test_aarch64_hotplug_pci.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python3 +# +# The test hotplugs a PCI device and checks it on a Linux guest. +# +# Copyright (c) 2025 Linaro Ltd. +# +# Author: +# Gustavo Romero +# +# SPDX-License-Identifier: GPL-2.0-or-later + +from qemu_test import LinuxKernelTest, Asset, exec_command_and_wait_for_pa= ttern +from qemu_test import BUILD_DIR + +class HotplugPCI(LinuxKernelTest): + + ASSET_KERNEL =3D Asset( + ('https://ftp.debian.org/debian/dists/stable/main/installer-arm64/' + '20230607+deb12u11/images/netboot/debian-installer/arm64/linux'), + 'd92a60392ce1e379ca198a1a820899f8f0d39a62d047c41ab79492f81541a9d9= ') + + ASSET_INITRD =3D Asset( + ('https://ftp.debian.org/debian/dists/stable/main/installer-arm64/' + '20230607+deb12u11/images/netboot/debian-installer/arm64/initrd.g= z'), + '9f817f76951f3237bca8216bee35267bfb826815687f4b2fcdd5e6c2a917790c= ') + + def test_hotplug_pci(self): + + self.set_machine('virt') + + self.vm.add_args('-m', '512M', + '-cpu', 'cortex-a57', + '-append', + 'console=3DttyAMA0,115200 init=3D/bin/sh', + '-device', + 'pcie-root-port,bus=3Dpcie.0,chassis=3D1,slot=3D1= ,id=3Dpcie.1', + '-bios', + self.build_file('pc-bios', 'edk2-aarch64-code.fd'= )) + + # BusyBox prompt + prompt =3D "~ #" + self.launch_kernel(self.ASSET_KERNEL.fetch(), + self.ASSET_INITRD.fetch(), + wait_for=3Dprompt) + + # Check for initial state: 2 network adapters, lo and enp0s1. + exec_command_and_wait_for_pattern(self, + 'ls /sys/class/net | wc -l', + '2') + + # Hotplug one network adapter to the root port, i.e. pcie.1 bus. + self.vm.cmd('device_add', + driver=3D'virtio-net-pci', + bus=3D'pcie.1', + addr=3D0, + id=3D'na') + # Wait for the kernel to recognize the new device. + self.wait_for_console_pattern('virtio-pci') + self.wait_for_console_pattern('virtio_net') + + # Check if there is a new network adapter. + exec_command_and_wait_for_pattern(self, + 'ls /sys/class/net | wc -l', + '3') + + self.vm.cmd('device_del', id=3D'na') + exec_command_and_wait_for_pattern(self, + 'ls /sys/class/net | wc -l', + '2') + +if __name__ =3D=3D '__main__': + LinuxKernelTest.main() --=20 2.47.2 From nobody Sat Nov 15 14:09:41 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1751453539; cv=none; d=zohomail.com; s=zohoarc; b=GwQRtM1yAi2VhucwsXQYCcrx8+DXUfI7ItdnBj1741Y0ZGW6mqBSIbyS5/Fo6vUIRaK5i0w/vYKtrUH4R5N4tb7GdbhDA3z2/CIFm6JxQF6jLsXGutX1R77tUeitquoIk/HRIJmdmbPZme+wXPR9Q7YjOpNF8EDVB+cX5ei4Ay8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751453539; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=mRCp3ySVNCc5vKTsGg2A8ACZ7tFKQgIdG5HQy6KJhQ4=; b=kg/TbxG9K9X17Af6xKxSQ9N9Qev/D2/hlGCQz2STyrYQiBIn//UdY+1HNwIZfpZJqzR3JyyeORnAAGYL+Lv6IdXpJ2B77uEimV8Efmy85UpseTxpKJsxMkDy6Yh1plciPt8mvSg/WYsqtCq8SCkPwYh42X/RvdZRpsVnHykTsq8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1751453539011254.0360175433758; Wed, 2 Jul 2025 03:52:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWv2b-00009O-FQ; Wed, 02 Jul 2025 06:50:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWv2U-0008VG-QV for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:50:07 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWv2P-0002p3-V0 for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:50:06 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-453066fad06so45122375e9.2 for ; Wed, 02 Jul 2025 03:50:01 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a88c7e6f74sm15718218f8f.3.2025.07.02.03.49.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jul 2025 03:49:56 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 123595F8D7; Wed, 02 Jul 2025 11:49:56 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751453400; x=1752058200; 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=mRCp3ySVNCc5vKTsGg2A8ACZ7tFKQgIdG5HQy6KJhQ4=; b=YebtxBMcUBN9Hz2MWOVDB4hAOW2DdFkXmj0wYnu48Hj9pLrWCNuiilFNuO0ScpeYkl Xil2j/5LONCrN+4xPknMa8AuPv4WT8IrrsvRaKO64kxN/1YCW1MF7TUs+5urLyF0GLea J+xG7X7nxGXnxq5XM67sXWYqqc1dGM3fLrVZPEHfpctKDQhp2iEdjD9pZszKE4i3+LRe 5Qzt5CBvEia5vfs66MFD0nK1Hd3N6mpr0qRh0Eouh31OwCd9vK20rI24g29tsQQccQ1t NiP7WcZkyoLiWiDSWpirZj28H1IUhleOBx61l+c8yOI32oxYHK3ki6ipS8p4LtkK2QKn 9cuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751453400; x=1752058200; 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=mRCp3ySVNCc5vKTsGg2A8ACZ7tFKQgIdG5HQy6KJhQ4=; b=goXJPQdlv3f4DYES+Q4gn0BCiAWrfiyp+IEmYLGGYjqMMLOuGymTDoS0Z3dscq6Mvi CVCQl2KdGVDrbDa4UzvNdZZGWxgW+Knc+dw5IU1FI3sxkoLHsN/lhPoewBTXcmVU6Fxi GBCV/AMB0o5uX7S2yNT1507IM1Naee/VmIXV1me0v9c2P9H1mvJRN9pNqCiOB6vPXmMg MI/JILLSwgft9qxbMlK8mpAl2DUJ0aXz6NnCi/cEBBvKRSKd2T+GyyvpZ+wNI98oaB+S GT1wTuhSInyd7egC3o+OSazM2McrtE0zYFcBPEqlMWUz34WaafvwHZiT6Bgtt3V9JYPy 1Big== X-Gm-Message-State: AOJu0YxeEitiGgi+C0x1heof55VdY7tcM5eNs4znT5HWJVa4R5zmA31U a0aPgP9HF1RWlxmMuwB/+Na9xy3xEufK9z7KVx/PGEJd0TgppThLghekRR41SpqRSkY= X-Gm-Gg: ASbGncvq53ZUNZ8MJ5tD/qI1NJYnBC9JRDiZd6eDf9OabESkgJ2bu6nYQ7nMKgZbXx8 bSPntBQ+TM4rb0GFwj+merPf3hMJ3vaZcxhhhX3bdcIFbbU8t2oRh35sgI945frz+7dC+r7U47u Lmq4n3cEJAfAxJpClrruFsu9HHCAXM5rKFml/A3UGJ7SBmJVGwv83ZjDzJkx76H7kg+viPdMC8b 9rN+B9mwqaV/rm4SRbPjiGSiLaYtgWNjDZy//AFnzXeBgaD8T35dYinwPQVjTNCUhMHqvZaWzHL yKO2mVKWynITVavKFl5ci/tNQUrbntMmgOEpl/rpOxBGucPG2pSELF71HJkrENg= X-Google-Smtp-Source: AGHT+IFyV3qq2lI5cmScOe11u7GU6tNj5UEGI87FuPg4XOip5rEQzoOALvCTExHwbYhpyvcCOFFuRQ== X-Received: by 2002:a05:6000:188c:b0:3a5:2653:7322 with SMTP id ffacd0b85a97d-3b1fdc2249amr1687289f8f.3.1751453400014; Wed, 02 Jul 2025 03:50:00 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Pierrick Bouvier , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PULL 03/15] semihosting/uaccess: Remove uses of target_ulong type Date: Wed, 2 Jul 2025 11:49:43 +0100 Message-ID: <20250702104955.3778269-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250702104955.3778269-1-alex.bennee@linaro.org> References: <20250702104955.3778269-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751453539458116600 From: Philippe Mathieu-Daud=C3=A9 Replace target_ulong by vaddr or size_t types to match cpu_memory_rw_debug() prototype in "exec/cpu-common.h": > int cpu_memory_rw_debug(CPUState *cpu, vaddr addr, > void *ptr, size_t len, > bool is_write); Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Pierrick Bouvier Reviewed-by: Richard Henderson Message-ID: <20250526095213.14113-2-philmd@linaro.org> Signed-off-by: Alex Benn=C3=A9e Message-ID: <20250627112512.1880708-4-alex.bennee@linaro.org> diff --git a/include/semihosting/uaccess.h b/include/semihosting/uaccess.h index 6bc90b12d6..2093a49827 100644 --- a/include/semihosting/uaccess.h +++ b/include/semihosting/uaccess.h @@ -15,9 +15,9 @@ #endif =20 #include "exec/cpu-common.h" -#include "exec/cpu-defs.h" #include "exec/tswap.h" #include "exec/page-protection.h" +#include "exec/vaddr.h" =20 /** * get_user_u64: @@ -89,8 +89,8 @@ * * The returned pointer should be freed using uaccess_unlock_user(). */ -void *uaccess_lock_user(CPUArchState *env, target_ulong addr, - target_ulong len, bool copy); +void *uaccess_lock_user(CPUArchState *env, vaddr addr, + size_t len, bool copy); /** * lock_user: * @@ -103,7 +103,7 @@ void *uaccess_lock_user(CPUArchState *env, target_ulong= addr, * * The returned string should be freed using uaccess_unlock_user(). */ -char *uaccess_lock_user_string(CPUArchState *env, target_ulong addr); +char *uaccess_lock_user_string(CPUArchState *env, vaddr addr); /** * uaccess_lock_user_string: * @@ -112,10 +112,10 @@ char *uaccess_lock_user_string(CPUArchState *env, tar= get_ulong addr); #define lock_user_string(p) uaccess_lock_user_string(env, p) =20 void uaccess_unlock_user(CPUArchState *env, void *p, - target_ulong addr, target_ulong len); + vaddr addr, size_t len); #define unlock_user(s, args, len) uaccess_unlock_user(env, s, args, len) =20 -ssize_t uaccess_strlen_user(CPUArchState *env, target_ulong addr); +ssize_t uaccess_strlen_user(CPUArchState *env, vaddr addr); #define target_strlen(p) uaccess_strlen_user(env, p) =20 #endif /* SEMIHOSTING_SOFTMMU_UACCESS_H */ diff --git a/semihosting/uaccess.c b/semihosting/uaccess.c index 4554844e15..ff944d8c2f 100644 --- a/semihosting/uaccess.c +++ b/semihosting/uaccess.c @@ -14,8 +14,8 @@ #include "exec/tlb-flags.h" #include "semihosting/uaccess.h" =20 -void *uaccess_lock_user(CPUArchState *env, target_ulong addr, - target_ulong len, bool copy) +void *uaccess_lock_user(CPUArchState *env, vaddr addr, + size_t len, bool copy) { void *p =3D malloc(len); if (p && copy) { @@ -27,7 +27,7 @@ void *uaccess_lock_user(CPUArchState *env, target_ulong a= ddr, return p; } =20 -ssize_t uaccess_strlen_user(CPUArchState *env, target_ulong addr) +ssize_t uaccess_strlen_user(CPUArchState *env, vaddr addr) { int mmu_idx =3D cpu_mmu_index(env_cpu(env), false); size_t len =3D 0; @@ -75,7 +75,7 @@ ssize_t uaccess_strlen_user(CPUArchState *env, target_ulo= ng addr) } } =20 -char *uaccess_lock_user_string(CPUArchState *env, target_ulong addr) +char *uaccess_lock_user_string(CPUArchState *env, vaddr addr) { ssize_t len =3D uaccess_strlen_user(env, addr); if (len < 0) { @@ -85,7 +85,7 @@ char *uaccess_lock_user_string(CPUArchState *env, target_= ulong addr) } =20 void uaccess_unlock_user(CPUArchState *env, void *p, - target_ulong addr, target_ulong len) + vaddr addr, size_t len) { if (len) { cpu_memory_rw_debug(env_cpu(env), addr, p, len, 1); --=20 2.47.2 From nobody Sat Nov 15 14:09:41 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1751453477; cv=none; d=zohomail.com; s=zohoarc; b=V5yqVcUltMT4HIl2iB5VcePcaw9RG5AZBT7g2eNOPl6/iJSQQyCXpnOrT2rd3pB32ZKnV/UnEV+1ueReg43BW7mRMLH3aRCVQF/78/IkXUgFbYChG+mv+6IM9/zX1AsShyZXmV3bfOy19f8968X8/3H0tcx5U+fRgkn4J9lBRwc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751453477; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=9LuknGbyHpYfn5Myg53J+fZFSmGacyw10WuAzgbETa8=; b=EjhJJHrDitkawrgtL0MPT1WgQA5SyMuUULyP03Obd2pRf/x0/go4nPM1v/X/viU1NaYfoW6cvqTVLpovJZVADVhmq+x9nfBWXhqXvtjqpLiFhBAzCRuv4VJFQsllAyN1A2DKyNkE1h6e0xNF8rqvDON16eLXCTXTH9Jijrilsx8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1751453477934134.587588793863; Wed, 2 Jul 2025 03:51:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWv2c-0000AP-Sl; Wed, 02 Jul 2025 06:50:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWv2Y-00005S-QC for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:50:11 -0400 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWv2R-0002pa-Jp for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:50:10 -0400 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-451e2f0d9c2so46926735e9.1 for ; Wed, 02 Jul 2025 03:50:02 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4538a3fe587sm198289805e9.19.2025.07.02.03.49.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jul 2025 03:49:59 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 2729D5F8D8; Wed, 02 Jul 2025 11:49:56 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751453401; x=1752058201; 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=9LuknGbyHpYfn5Myg53J+fZFSmGacyw10WuAzgbETa8=; b=TWyTxuMd+pU7NDqN/CTIVl8wbnKKKilkIV2ofSGDGsIlkepgParw3t4walqVj5Fb+c TKLvXjsbdchtSUjYK1P6uuWvJB0wA8jxNVx599vHJtN11hfaJneHw8bKgh5v7mst2XEF A+WW8DK2+DigtKH+iaFo4phcUMppsAVXQaLwkKvmzidyp/fKRIyIdpry4e7H0aXaHeWK QavUZ0G7EibswXBOCL2k2QAi4VFlCpvl1+kxMxReOQAahkIHHt8+1WbmKudQmAg9U1L9 Oe/MEWgRYfng3KPZdKIPICDM5ceqwH9NapHLDbgtVZxSQqq+ul1mA/sOyVPe5eOe8kVi 3uVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751453401; x=1752058201; 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=9LuknGbyHpYfn5Myg53J+fZFSmGacyw10WuAzgbETa8=; b=q7eRcnJ05L7df+O0chZ9NC47aMJlE11YuAnHl7f8ky4LYU495xwRRhTDUtvpWUkYSb i/ZHXKr3FPRHPev9CS1xJIqBQ1vE4mxpHaA9NXCxe1kcwkm62u9K+1G9bp/NgUCnm9qt Ku9QEq7UM4UQmOsATQ/xFbDungSssS2o7xuZn3tW6uXLYCctd/nHAPCJ4cw8OfQePgAC VTm8EPtpxiRt9/O3vMpkPN1abL//HVeRIUWF7mh8DO2A+IVF1z6bDTxQ6u/AD7y217hJ lPvNR85YGxHfVnD9M3tfr/emG+sMccHEjkoVRJISOVcReMqR/gKKYYLsPEvLbe/n7+7O +NNw== X-Gm-Message-State: AOJu0YxHVpgkPQLZ/SLzW9bfthSxxzbmaZCU1uwtcAI47em7xGZYEN8p EKh+aWw6ygWaxwOtaB5NT8+bqt3pcisr/OVQD7u25oyb/8Jkxq79FRobkpg3ugeyjtc= X-Gm-Gg: ASbGncu+/FA80Lt0mfMIInkLJ3s4jaSmoqGKZS2tHv0pNEwSYzIAa9nnps1dditigRH P7ODv8v7orbOARZBrjB34CL71Qbnu79onNenqh08iUgVhqKrV+6PSzH6HtwI/Z7a5BEa1KUmM+h kGMoBzlzRq1eA7rHU2AW+PAeotBrpkQp0Ov4u6SnpdbJK7YuJUain2rS8vm/Fkn5G0nMuiKpQgE vAyemV9OMDGLS3V1XkjbHdB4wt+Z5XG2E6iE1UuRdX+Se/2wIp1thnorSH/1DTbg6f4Du8ZGW9n N9yZz3ErrIpCpk98PZ7hqAd+SmCa+eyi+yjNL0YcZFczBMvZU9aIxRcLzCiKmu8= X-Google-Smtp-Source: AGHT+IEsjrWtmcCnvAD5zctHpHTklmnGzvRgDlBJdn66TZJxZrpgpJ4wgn0i2dC/SobHEHoMGkvjeQ== X-Received: by 2002:a05:600c:8b10:b0:453:7713:476c with SMTP id 5b1f17b1804b1-454a3c17edfmr20859765e9.2.1751453401606; Wed, 02 Jul 2025 03:50:01 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PULL 04/15] semihosting/uaccess: Compile once Date: Wed, 2 Jul 2025 11:49:44 +0100 Message-ID: <20250702104955.3778269-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250702104955.3778269-1-alex.bennee@linaro.org> References: <20250702104955.3778269-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x331.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, TVD_SPACE_RATIO=0.001, T_SPF_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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751453478457116600 From: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Message-ID: <20250526095213.14113-3-philmd@linaro.org> Signed-off-by: Alex Benn=C3=A9e Message-ID: <20250627112512.1880708-5-alex.bennee@linaro.org> diff --git a/semihosting/meson.build b/semihosting/meson.build index f3d38dda91..b1ab2506c6 100644 --- a/semihosting/meson.build +++ b/semihosting/meson.build @@ -3,15 +3,12 @@ specific_ss.add(when: 'CONFIG_SEMIHOSTING', if_true: file= s( 'syscalls.c', )) =20 -specific_ss.add(when: ['CONFIG_SEMIHOSTING', 'CONFIG_SYSTEM_ONLY'], if_tru= e: files( - 'uaccess.c', -)) - common_ss.add(when: 'CONFIG_SEMIHOSTING', if_false: files('stubs-all.c')) user_ss.add(when: 'CONFIG_SEMIHOSTING', if_true: files('user.c')) system_ss.add(when: 'CONFIG_SEMIHOSTING', if_true: files( 'config.c', 'console.c', + 'uaccess.c', ), if_false: files( 'stubs-system.c', )) --=20 2.47.2 From nobody Sat Nov 15 14:09:41 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1751453528; cv=none; d=zohomail.com; s=zohoarc; b=didU1SpR3qqPWCeFV11LEBJOWPeyxNZfJ8+Ke7tnJtRDqvg9KvbTwvzZ4ns0B8CNDjZ0ZfWIoW06EEN/XuTkF4Kbt9j7/2XJcJllw6k9mn75Bpsd0+0wmweGHpt3lHZ1ob42BD/bXzO/vZxhYAQ9vEnJ65yE+sL4vaR0DuH9vqE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751453528; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=qecS0tIoe0ls7nw8T86Ife3RJh0yHDOjkyPB/fpRPNc=; b=ZJOVQkPIXqbVUgXsYm9U8bK8W1js9zTlSzZTMQIQ3fEmp4uSokUSs87dicjc2CPw7vgW0EiLQ6x6nxhQ36fgDQ222rQ5sEoQULdhvf40K5g4303pBbQwClcRGYS2hus6ONkvR7N1GS2fW8JbWc9JhWUp84nrxy16OSuQA2bCoqU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 175145352853477.02769438160169; Wed, 2 Jul 2025 03:52:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWv2b-00009H-Ek; Wed, 02 Jul 2025 06:50:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWv2W-0008Vy-ET for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:50:10 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWv2S-0002qj-9S for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:50:08 -0400 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-3a575a988f9so4356955f8f.0 for ; Wed, 02 Jul 2025 03:50:03 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a88c7e7386sm15587399f8f.20.2025.07.02.03.49.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jul 2025 03:50:00 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 3DECE5F8DB; Wed, 02 Jul 2025 11:49:56 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751453402; x=1752058202; 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=qecS0tIoe0ls7nw8T86Ife3RJh0yHDOjkyPB/fpRPNc=; b=CRgHTwLi1KyGrAlJeuj/7GeaLxpxGiaya/KTLik6QDyxEA2krQ4ywr62VllKd2UyO5 yxXPnqRxcbs1CXp4UQsc8XgPXZv1wWwfNbNI96YMgcE9fkqxfmvLV5+lDMu5d95Qt5+2 UwRMBp5pXBJWsKPeHa+0As1fEMMsyPSuPrNWqnl3E+m4HCvpTY7cLcZa3AbO4ez2ecn1 hW0KYwZ0bKcHIhBR374GGMbROPMkUw+YdF+fycHqY/a77G+Wdw49sCxyJDaw8sYQHNi9 UVspaCcGJxXiQkVkUViChpKsHa3RHSGzboc+N9wuV9/JahDvdU1BOaASN8bXm7RTCS7Q 1egQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751453402; x=1752058202; 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=qecS0tIoe0ls7nw8T86Ife3RJh0yHDOjkyPB/fpRPNc=; b=mEGqm3KSrdrxzdZbmgVPN8MSYZpBmmUYj6dEQ/2oKbAmm/gz1o8+zQHgXHj5CaA3Tf rNKduYTe8XtEdQojlv9jJDOigpveJeZiOYkD4ZfanZD/1x/sGpXbg0BO9dWvB+FdJ5TL zARVccuBCm1Zeb34te2S/RhOUjA65gMYUlGnrXSRrMgpft991PojJ8J6kz3qenpy267I d1wri2PdD71IuHyCrQK+hY4mZJkQ41ypFfBuc8WS8qE9xv4iEYTiMXRTMaeaLI11VpTt eiO15ddAI3YdOj0sBqZas9Y54bAKimPY6fW3l/+L6TM8rTqJQyXC8pvaU9CUBs6qYvxk InhQ== X-Gm-Message-State: AOJu0YwgNnsn4Lo1EitjprqJdH7P2s2gyYK+ZK8d2R4nY8719VWLtlk5 g5Oiv/t6EGPK1UH5sssQBFbaVOrRMtkoHqIokRnLjkV/lhQnX+whwUguKd1P5x6N3TM= X-Gm-Gg: ASbGnctRrdwYX+uzBoodsUpQ0ImAMJzlK9Zb/i2SHWHBMZ+fKH4gktfl0euXIoxFui7 e480XY4/7/XQbV3qlkiQyhL7FH3d6TTnsshZiVuEqzUwiWt/bf55YB83xV7jsSPbjAS8Yu12bAi lCuiQzT87v1jalMrmvr2km9sds8ydlV7FC0mrWIBPE56rpSE9SX18CxsMUxIznZaTKqJ56WZfsf k3gvL42J8fsLDUTXYSpmH7t3bZZcYUSqYO0uVgLBtCN/Ipz51yYDbceXJuavIlvijgPvkcVLjZN hDWS3fWOHithnU5cIhRzPjG95GXfMT6GmWyuLGpr6912nkojg/EzUh1FBM+ypTY= X-Google-Smtp-Source: AGHT+IFL2PE2AJ+xQCUS2fVQcN1lbEsCtdeFS0mWYSdYW6d9/wuxiYjI4L3FmsLxYxqrArG2Fj9seQ== X-Received: by 2002:a05:6000:25c8:b0:3a5:2f23:376f with SMTP id ffacd0b85a97d-3b1fe1e7861mr1690602f8f.13.1751453402426; Wed, 02 Jul 2025 03:50:02 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Rowan Hart , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Julian Ganz , Pierrick Bouvier , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 05/15] gdbstub: Expose gdb_write_register function to consumers of gdbstub Date: Wed, 2 Jul 2025 11:49:45 +0100 Message-ID: <20250702104955.3778269-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250702104955.3778269-1-alex.bennee@linaro.org> References: <20250702104955.3778269-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42f.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751453529204116600 From: Rowan Hart This patch exposes the gdb_write_register function from gdbstub/gdbstub.c via the exec/gdbstub.h header file to support use in plugins to write register contents. Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Julian Ganz Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart Message-ID: <20250624175351.440780-2-rowanbhart@gmail.com> Signed-off-by: Alex Benn=C3=A9e Message-ID: <20250627112512.1880708-6-alex.bennee@linaro.org> diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h index 0675b0b646..a16c0051ce 100644 --- a/include/exec/gdbstub.h +++ b/include/exec/gdbstub.h @@ -124,6 +124,20 @@ const GDBFeature *gdb_find_static_feature(const char *= xmlname); */ int gdb_read_register(CPUState *cpu, GByteArray *buf, int reg); =20 +/** + * gdb_write_register() - Write a register associated with a CPU. + * @cpu: The CPU associated with the register. + * @buf: The buffer that the register contents will be set to. + * @reg: The register's number returned by gdb_find_feature_register(). + * + * The size of @buf must be at least the size of the register being + * written. + * + * Return: The number of written bytes, or 0 if an error occurred (for + * example, an unknown register was provided). + */ +int gdb_write_register(CPUState *cpu, uint8_t *mem_buf, int reg); + /** * typedef GDBRegDesc - a register description from gdbstub */ diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index def0b7e877..dd5fb5667c 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -535,7 +535,7 @@ int gdb_read_register(CPUState *cpu, GByteArray *buf, i= nt reg) return 0; } =20 -static int gdb_write_register(CPUState *cpu, uint8_t *mem_buf, int reg) +int gdb_write_register(CPUState *cpu, uint8_t *mem_buf, int reg) { GDBRegisterState *r; =20 --=20 2.47.2 From nobody Sat Nov 15 14:09:41 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1751453551; cv=none; d=zohomail.com; s=zohoarc; b=OTbWOzGpWPq9/CDG9H0OLrFJkYWkU9aUtGP8tzc91d3IahoVK8Q1r/RK3mao9RoqQIWzQXcDvctVqSdLLsXsuNHMyVPCbL7qWqPf6dSxhJYKpLv2hzNfg/GLrOaZSaRyffpO9uW0VJiJFmvn1Uf8wdLZKoR9x14IR1IFaLAv9xk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751453551; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=kaLVJH5otwR+otl8BtaHu4M3HmdksGlIfafwyt6VO9Q=; b=MB4ZFHRLUWKHr0xLoZkUdLpxdZ6ocj0w35w6yaBiEJ7qgqjo8PEEebe2jPbmS+U0W6mxxJjO4wjAACrLlVJ0wm0mWDZhvYDDivHYEPO57FN7OkRADWnSrnto/XKOk60KEGUy6W1IKbEJFXnkECirzceK6BPDrRspi4lcY7LOWTw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1751453551105687.0269424407788; Wed, 2 Jul 2025 03:52:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWv2e-0000DI-3j; Wed, 02 Jul 2025 06:50: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 1uWv2Z-000065-Ud for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:50:12 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWv2U-00031a-TV for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:50:11 -0400 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-3a50fc819f2so4728867f8f.2 for ; Wed, 02 Jul 2025 03:50:06 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4538f2fec5fsm173621235e9.40.2025.07.02.03.49.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jul 2025 03:50:00 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 593025F8DC; Wed, 02 Jul 2025 11:49:56 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751453405; x=1752058205; 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=kaLVJH5otwR+otl8BtaHu4M3HmdksGlIfafwyt6VO9Q=; b=IgRJiOBlPLJ1I/YSK+K0CXg7NpOF6KRNUg1BTqBdRo4y/ywoUhE5oUwNSUSA9106pG SIYXuYBiKMfEyrAPwgyTzlLcguKFYjXUZfIUbQkPJFTyjBbHlKNWI8hhZb1Zw4enLpZJ TLz/JRiNxQtk2BZQDuzDXva0as/q1wfBd71Rv2FoPqoUwMO3oNXPjP1iNSgHuaBzalDB xeASBlAKPC+Ocde29gN4+87pfshthoYaHpL4wd6X3dL/r93H2miEXmuWgusVnrDdbbiu N1UIgL0q5IrPiqe6uNINxxA3R3EjJ3qEag0kcBG0du4YG2cBkHxZLhvcrYl16FtEREbz Xvdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751453405; x=1752058205; 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=kaLVJH5otwR+otl8BtaHu4M3HmdksGlIfafwyt6VO9Q=; b=g9G07sLnAF10//hTB/G3c0NQCuXa7kvq3779Tkv2V+VbEiDkXxhACglYFafLxej4fh pNgKJJcvGk01QVTx0FXPH9oTdwVS1sxvNKNm7sjcnX/8Lr3ko3RLhG1gj89oWLgyQHuH OevrpuSe6DRQRHPnquZmeu+UpRY2vQkyxrWNABvs2fp8yb+Z7ZlkkucWLtwc7H25qdZB jx+xq49ynohDJ/JE2T6AST0HwIkLtC1jqzqqrsnMXf6xIltQpHDs2qX/lSqTpBy9ISdD yYSFKO/idneY+uMJY/sAmLzvy4uVoBTnvafTD8h3GD0VMGKAYu3kSzQsw/D4DlTvFFEE WgeQ== X-Gm-Message-State: AOJu0Yx6Ak+H4Ya9vum2/dIEEaaAmuUw1Hnmh1tfzNkzeBDf4HWIH3YI v8iLc9m7GaBwox+pCIwhn7uCcKYPD76Thua6efSfS+7llhUokT+SCp6dmMcfaOQFF28= X-Gm-Gg: ASbGncvN6GjvlXlrAHM2O3GudEmFmrbFnJ/ylMYhYLyjd9PHTo7vqxZ4xOxMKiSep7f pqLPmlxAbeQcYMULOMAsaQDkAELCTLaDZ/WcyVxAJCkvlbu8N5Os8QJvS3my7n53B0PMyQ3g7bS pCSbqj+y6dOPGH5wYLitewu63K8lrROhEFbJRlM6YDYLhfYjG9wueL8Wilo6Y2vitXXex4Y/mxk 1yfKo8OdueWe8zxLbs/S1sBBr99AEX0roGbC3bRX8T8XH5SLokG39XrdOaf325F6H7e1qPijWYQ j4mIUuMIur/l5UlrzgJ9XnDxubBNBfuwkDRN1AVWU4NgGf1RS6B6UJalKXg+t/M= X-Google-Smtp-Source: AGHT+IGc9umVJPo23eo45L18kx7azIwjJrTQ1i6krJLRzAx+GNxtnYVM4q0KYSWxGw/aQHouIzI2vw== X-Received: by 2002:a05:6000:2582:b0:3a5:52d4:5b39 with SMTP id ffacd0b85a97d-3b1fd74c462mr1743386f8f.8.1751453404980; Wed, 02 Jul 2025 03:50:04 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Rowan Hart , Pierrick Bouvier , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Alexandre Iooss , Mahmoud Mandour Subject: [PULL 06/15] plugins: Add register write API Date: Wed, 2 Jul 2025 11:49:46 +0100 Message-ID: <20250702104955.3778269-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250702104955.3778269-1-alex.bennee@linaro.org> References: <20250702104955.3778269-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x435.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751453551630116600 From: Rowan Hart This patch adds a function to the plugins API to allow plugins to write register contents. It also moves the qemu_plugin_read_register function so all the register-related functions are grouped together in the file. Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart Message-ID: <20250624175351.440780-3-rowanbhart@gmail.com> Signed-off-by: Alex Benn=C3=A9e Message-ID: <20250627112512.1880708-7-alex.bennee@linaro.org> diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h index 3a850aa216..cfe1692ecb 100644 --- a/include/qemu/qemu-plugin.h +++ b/include/qemu/qemu-plugin.h @@ -871,7 +871,8 @@ struct qemu_plugin_register; /** * typedef qemu_plugin_reg_descriptor - register descriptions * - * @handle: opaque handle for retrieving value with qemu_plugin_read_regis= ter + * @handle: opaque handle for retrieving value with qemu_plugin_read_regis= ter or + * writing value with qemu_plugin_write_register * @name: register name * @feature: optional feature descriptor, can be NULL */ @@ -893,6 +894,41 @@ typedef struct { QEMU_PLUGIN_API GArray *qemu_plugin_get_registers(void); =20 +/** + * qemu_plugin_read_register() - read register for current vCPU + * + * @handle: a @qemu_plugin_reg_handle handle + * @buf: A GByteArray for the data owned by the plugin + * + * This function is only available in a context that register read access = is + * explicitly requested via the QEMU_PLUGIN_CB_R_REGS flag. + * + * Returns the size of the read register. The content of @buf is in target= byte + * order. On failure returns -1. + */ +QEMU_PLUGIN_API +int qemu_plugin_read_register(struct qemu_plugin_register *handle, + GByteArray *buf); + +/** + * qemu_plugin_write_register() - write register for current vCPU + * + * @handle: a @qemu_plugin_reg_handle handle + * @buf: A GByteArray for the data owned by the plugin + * + * This function is only available in a context that register write access= is + * explicitly requested via the QEMU_PLUGIN_CB_RW_REGS flag. + * + * The size of @buf must be at least the size of the requested register. + * Attempting to write a register with @buf smaller than the register size + * will result in a crash or other undesired behavior. + * + * Returns the number of bytes written. On failure returns 0. + */ +QEMU_PLUGIN_API +int qemu_plugin_write_register(struct qemu_plugin_register *handle, + GByteArray *buf); + /** * qemu_plugin_read_memory_vaddr() - read from memory using a virtual addr= ess * @@ -915,22 +951,6 @@ QEMU_PLUGIN_API bool qemu_plugin_read_memory_vaddr(uint64_t addr, GByteArray *data, size_t len); =20 -/** - * qemu_plugin_read_register() - read register for current vCPU - * - * @handle: a @qemu_plugin_reg_handle handle - * @buf: A GByteArray for the data owned by the plugin - * - * This function is only available in a context that register read access = is - * explicitly requested via the QEMU_PLUGIN_CB_R_REGS flag. - * - * Returns the size of the read register. The content of @buf is in target= byte - * order. On failure returns -1. - */ -QEMU_PLUGIN_API -int qemu_plugin_read_register(struct qemu_plugin_register *handle, - GByteArray *buf); - /** * qemu_plugin_scoreboard_new() - alloc a new scoreboard * diff --git a/plugins/api.c b/plugins/api.c index 3c9d4832e9..6514f2c76a 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -433,6 +433,25 @@ GArray *qemu_plugin_get_registers(void) return create_register_handles(regs); } =20 +int qemu_plugin_read_register(struct qemu_plugin_register *reg, GByteArray= *buf) +{ + g_assert(current_cpu); + + return gdb_read_register(current_cpu, buf, GPOINTER_TO_INT(reg) - 1); +} + +int qemu_plugin_write_register(struct qemu_plugin_register *reg, + GByteArray *buf) +{ + g_assert(current_cpu); + + if (buf->len =3D=3D 0 || qemu_plugin_get_cb_flags() !=3D QEMU_PLUGIN_C= B_RW_REGS) { + return -1; + } + + return gdb_write_register(current_cpu, buf->data, GPOINTER_TO_INT(reg)= - 1); +} + bool qemu_plugin_read_memory_vaddr(uint64_t addr, GByteArray *data, size_t= len) { g_assert(current_cpu); @@ -453,13 +472,6 @@ bool qemu_plugin_read_memory_vaddr(uint64_t addr, GByt= eArray *data, size_t len) return true; } =20 -int qemu_plugin_read_register(struct qemu_plugin_register *reg, GByteArray= *buf) -{ - g_assert(current_cpu); - - return gdb_read_register(current_cpu, buf, GPOINTER_TO_INT(reg) - 1); -} - struct qemu_plugin_scoreboard *qemu_plugin_scoreboard_new(size_t element_s= ize) { return plugin_scoreboard_new(element_size); --=20 2.47.2 From nobody Sat Nov 15 14:09:41 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1751453531; cv=none; d=zohomail.com; s=zohoarc; b=h8Qo/cvI7SYp4FJX6qOgaZgrHWDYwTCYiBB0QKf0ljFQJ5vjfTcPZDJ9lIV2nio2gfkT/L3meAaVfngRBa2M0JK5MJQ4vGWMp95KqJDm2CISkPpy3SwiCTFs0gOGBHD4DL45/QufLiy0CixSkZCkaFgCznMe1LdElWxpY6/0xKI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751453531; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=9uKeRyX0ZAy/lXFW0B3T0haqZQUnDaXH59uMD4XA+u4=; b=SOACPXUVJU7Rg5spBpIhRCZDXzeZKtq4H/7s3GZ+k5YQkLxFio//MY3HKc1Q0Qbs0NURcXg+IcrGXtdPdv9EZZftvIz/O/4GtobvszAhUD1IvGsN0X5xc+lYu1zEVJ4BVrTqa3U3MPYTeaTXmxrzm9wmefmx08nO391ZNru2RHs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 175145353162391.75458289798303; Wed, 2 Jul 2025 03:52:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWv2f-0000Ds-2o; Wed, 02 Jul 2025 06:50: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 1uWv2c-0000Ad-HA for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:50:14 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWv2U-00031N-Ve for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:50:14 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-451d54214adso47416785e9.3 for ; Wed, 02 Jul 2025 03:50:05 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4538a3a57c2sm194174645e9.12.2025.07.02.03.49.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jul 2025 03:50:00 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 72B785F8E1; Wed, 02 Jul 2025 11:49:56 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751453404; x=1752058204; 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=9uKeRyX0ZAy/lXFW0B3T0haqZQUnDaXH59uMD4XA+u4=; b=Da05rEhNrjT5AUcinXJk64b1kLBKbwyBSypqvHML4dFIeggFpCwvwT8PnPH059EiWa 9BZGO/Q0FYlc4kROHduEz9htjSe/GFLm9DcIHJP+rsUXNz8Gy3wt1xUIRaEqhY/ZFl0y xVAH0sxFm+NKT4pLRQ9wb9//wRmYGDqCzzBYKNyMg5nQmDPnHtVXRg5oPdq5qA/oc3TW bS4x7tbwz1DOCzrSZABWj4yjOY7gGhdfYtZEydBwQRQJJ4xi6iVMBmO2zjnj5/fiv5xg 0enw5QcPtqnWU6YPHvA7aqvrPAkGoo3gV4V3acse1PHk/crFiKggc58FjX6K7OctzXh9 e/6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751453404; x=1752058204; 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=9uKeRyX0ZAy/lXFW0B3T0haqZQUnDaXH59uMD4XA+u4=; b=tdFL1bM5yUW0p7zx8QWqwuIjAbT0RUDG9NE+Pgiej3ePHSl5e54dQ+YVcNjPUJwIVQ iORpjzEYBxm7A5LpPOM+QKbW7tCXLgYMt6fb+Dt5Zk39hnzWHVyzfaxlaO2EMTnb22jz MKUoWxnaELUE6+f6TnVaDvNQAdXheWmMt9hqSPa6dbxp45AJHuf053x2CAktwZdGlmGH +gmLCnQBSAqisl8fnVQqLgpZSG/X81QUym8vKKP7f0HoZW6H8rBbMr0gpPgpsMFHGfs2 9B/s8MeW7CK9tkp0N2SSPp/XGSkj/Ehe1KX+fHB170gjAmq6hUIqJzqBBOJlAbiHOt7w NYow== X-Gm-Message-State: AOJu0YxUF6lwSwAXVcT87Js/zQxdi3czU/nEqwsv1kHsx4r0YmpXtF6R MCQTfpONp3b7lKik3BYhdvkNl9RoCSFT9JcEwPCl5x9jY02pOxQwEivusMoczF71VOU= X-Gm-Gg: ASbGncsi1/yFmtWDwr65hpE5tuTDUgmmmgJHaBnfQInalV3xRXdbSXZAw7QaL87xezP 5OGXhauKx185/q9CM3feUz5NErU0m7zJ35zNo5nmPOpJbZTPMg60ltDUNETByGbp9AxEO4W3ycs ePcWV3n9F/+K9q+C9ovKu0b5r0N8ft1ARsaeq+GCwZaAJYNIOzjV82z6I8TNkUIWS0qgOG+0JVQ IIVECf7PNRn+yGGDsCg3BCPTHTPsOY9lHp9knsTYkrcREZdhceNje+rlrF1hQJeis5qziHh81KT 5vZJQiS/8F4OKniZbCFG9yJoeewIajEfmo6NkIyJbjj1TkoxysoOkUF1P3yEhh0= X-Google-Smtp-Source: AGHT+IFZN53NjaTDrtkLw2Lr3YjyPouU5qDA5YbmWeaI9ecXrNko70BS1hquRBq6vTITc1cy6AZMbg== X-Received: by 2002:a05:600c:8588:b0:442:f956:53f9 with SMTP id 5b1f17b1804b1-454a37a0cd4mr19918415e9.18.1751453404301; Wed, 02 Jul 2025 03:50:04 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Rowan Hart , Pierrick Bouvier , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson , Paolo Bonzini , Eduardo Habkost , Marcel Apfelbaum , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Yanan Wang , Zhao Liu , Alexandre Iooss , Mahmoud Mandour Subject: [PULL 07/15] plugins: Add enforcement of QEMU_PLUGIN_CB flags in register R/W callbacks Date: Wed, 2 Jul 2025 11:49:47 +0100 Message-ID: <20250702104955.3778269-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250702104955.3778269-1-alex.bennee@linaro.org> References: <20250702104955.3778269-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32a.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751453533617116600 From: Rowan Hart This patch adds functionality to enforce the requested QEMU_PLUGIN_CB_ flags level passed when registering a callback function using the plugins API. Each time a callback is about to be invoked, a thread-local variable will be updated with the level that callback requested. Then, called API functions (in particular, the register read and write API) will call qemu_plugin_get_cb_flags() to check the level is at least the level they require. Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart Message-ID: <20250624175351.440780-4-rowanbhart@gmail.com> Signed-off-by: Alex Benn=C3=A9e Message-ID: <20250627112512.1880708-8-alex.bennee@linaro.org> diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 33296a1c08..162a56a5da 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -368,6 +368,7 @@ typedef struct CPUNegativeOffsetState { GArray *plugin_mem_cbs; uint64_t plugin_mem_value_low; uint64_t plugin_mem_value_high; + int32_t plugin_cb_flags; #endif IcountDecr icount_decr; bool can_do_io; diff --git a/include/qemu/plugin.h b/include/qemu/plugin.h index 9726a9ebf3..f355c7cb8a 100644 --- a/include/qemu/plugin.h +++ b/include/qemu/plugin.h @@ -209,6 +209,21 @@ void qemu_plugin_user_prefork_lock(void); */ void qemu_plugin_user_postfork(bool is_child); =20 +enum qemu_plugin_cb_flags tcg_call_to_qemu_plugin_cb_flags(int flags); + +static inline void qemu_plugin_set_cb_flags(CPUState *cpu, + enum qemu_plugin_cb_flags flag= s) +{ + assert(cpu); + cpu->neg.plugin_cb_flags =3D flags; +} + +static inline enum qemu_plugin_cb_flags qemu_plugin_get_cb_flags(void) +{ + assert(current_cpu); + return current_cpu->neg.plugin_cb_flags; +} + #else /* !CONFIG_PLUGIN */ =20 static inline void qemu_plugin_add_opts(void) diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h index cfe1692ecb..9c9ebf6ce0 100644 --- a/include/qemu/qemu-plugin.h +++ b/include/qemu/qemu-plugin.h @@ -254,9 +254,6 @@ typedef struct { * @QEMU_PLUGIN_CB_NO_REGS: callback does not access the CPU's regs * @QEMU_PLUGIN_CB_R_REGS: callback reads the CPU's regs * @QEMU_PLUGIN_CB_RW_REGS: callback reads and writes the CPU's regs - * - * Note: currently QEMU_PLUGIN_CB_RW_REGS is unused, plugins cannot change - * system register state. */ enum qemu_plugin_cb_flags { QEMU_PLUGIN_CB_NO_REGS, @@ -901,7 +898,12 @@ GArray *qemu_plugin_get_registers(void); * @buf: A GByteArray for the data owned by the plugin * * This function is only available in a context that register read access = is - * explicitly requested via the QEMU_PLUGIN_CB_R_REGS flag. + * explicitly requested via the QEMU_PLUGIN_CB_R_REGS flag, if called insi= de a + * callback that can be registered with a qemu_plugin_cb_flags argument. T= his + * function can also be used in any callback context that does not use a f= lags + * argument, such as in a callback registered with + * qemu_plugin_register_vcpu_init_cb(), except for callbacks registered wi= th + * qemu_plugin_register_atexit_cb() and qemu_plugin_register_flush_cb(). * * Returns the size of the read register. The content of @buf is in target= byte * order. On failure returns -1. @@ -916,8 +918,13 @@ int qemu_plugin_read_register(struct qemu_plugin_regis= ter *handle, * @handle: a @qemu_plugin_reg_handle handle * @buf: A GByteArray for the data owned by the plugin * - * This function is only available in a context that register write access= is - * explicitly requested via the QEMU_PLUGIN_CB_RW_REGS flag. + * This function is only available in a context that register read access = is + * explicitly requested via the QEMU_PLUGIN_CB_RW_REGS flag, if called ins= ide a + * callback that can be registered with a qemu_plugin_cb_flags argument. T= his + * function can also be used in any callback context that does not use a f= lags + * argument, such as in a callback registered with + * qemu_plugin_register_vcpu_init_cb(), except for callbacks registered wi= th + * qemu_plugin_register_atexit_cb() and qemu_plugin_register_flush_cb(). * * The size of @buf must be at least the size of the requested register. * Attempting to write a register with @buf smaller than the register size diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c index c1da753894..9920381a84 100644 --- a/accel/tcg/plugin-gen.c +++ b/accel/tcg/plugin-gen.c @@ -117,10 +117,20 @@ static TCGv_i32 gen_cpu_index(void) static void gen_udata_cb(struct qemu_plugin_regular_cb *cb) { TCGv_i32 cpu_index =3D gen_cpu_index(); + enum qemu_plugin_cb_flags cb_flags =3D + tcg_call_to_qemu_plugin_cb_flags(cb->info->flags); + TCGv_i32 flags =3D tcg_constant_i32(cb_flags); + TCGv_i32 clear_flags =3D tcg_constant_i32(QEMU_PLUGIN_CB_NO_REGS); + tcg_gen_st_i32(flags, tcg_env, + offsetof(CPUState, neg.plugin_cb_flags) - sizeof(CPUState)); tcg_gen_call2(cb->f.vcpu_udata, cb->info, NULL, tcgv_i32_temp(cpu_index), tcgv_ptr_temp(tcg_constant_ptr(cb->userp))); + tcg_gen_st_i32(clear_flags, tcg_env, + offsetof(CPUState, neg.plugin_cb_flags) - sizeof(CPUState)); tcg_temp_free_i32(cpu_index); + tcg_temp_free_i32(flags); + tcg_temp_free_i32(clear_flags); } =20 static TCGv_ptr gen_plugin_u64_ptr(qemu_plugin_u64 entry) @@ -173,10 +183,20 @@ static void gen_udata_cond_cb(struct qemu_plugin_cond= itional_cb *cb) tcg_gen_ld_i64(val, ptr, 0); tcg_gen_brcondi_i64(cond, val, cb->imm, after_cb); TCGv_i32 cpu_index =3D gen_cpu_index(); + enum qemu_plugin_cb_flags cb_flags =3D + tcg_call_to_qemu_plugin_cb_flags(cb->info->flags); + TCGv_i32 flags =3D tcg_constant_i32(cb_flags); + TCGv_i32 clear_flags =3D tcg_constant_i32(QEMU_PLUGIN_CB_NO_REGS); + tcg_gen_st_i32(flags, tcg_env, + offsetof(CPUState, neg.plugin_cb_flags) - sizeof(CPUState)); tcg_gen_call2(cb->f.vcpu_udata, cb->info, NULL, tcgv_i32_temp(cpu_index), tcgv_ptr_temp(tcg_constant_ptr(cb->userp))); + tcg_gen_st_i32(clear_flags, tcg_env, + offsetof(CPUState, neg.plugin_cb_flags) - sizeof(CPUState)); tcg_temp_free_i32(cpu_index); + tcg_temp_free_i32(flags); + tcg_temp_free_i32(clear_flags); gen_set_label(after_cb); =20 tcg_temp_free_i64(val); @@ -210,12 +230,22 @@ static void gen_mem_cb(struct qemu_plugin_regular_cb = *cb, qemu_plugin_meminfo_t meminfo, TCGv_i64 addr) { TCGv_i32 cpu_index =3D gen_cpu_index(); + enum qemu_plugin_cb_flags cb_flags =3D + tcg_call_to_qemu_plugin_cb_flags(cb->info->flags); + TCGv_i32 flags =3D tcg_constant_i32(cb_flags); + TCGv_i32 clear_flags =3D tcg_constant_i32(QEMU_PLUGIN_CB_NO_REGS); + tcg_gen_st_i32(flags, tcg_env, + offsetof(CPUState, neg.plugin_cb_flags) - sizeof(CPUState)); tcg_gen_call4(cb->f.vcpu_mem, cb->info, NULL, tcgv_i32_temp(cpu_index), tcgv_i32_temp(tcg_constant_i32(meminfo)), tcgv_i64_temp(addr), tcgv_ptr_temp(tcg_constant_ptr(cb->userp))); + tcg_gen_st_i32(clear_flags, tcg_env, + offsetof(CPUState, neg.plugin_cb_flags) - sizeof(CPUState)); tcg_temp_free_i32(cpu_index); + tcg_temp_free_i32(flags); + tcg_temp_free_i32(clear_flags); } =20 static void inject_cb(struct qemu_plugin_dyn_cb *cb) diff --git a/plugins/api.c b/plugins/api.c index 6514f2c76a..3f04399c26 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -437,6 +437,10 @@ int qemu_plugin_read_register(struct qemu_plugin_regis= ter *reg, GByteArray *buf) { g_assert(current_cpu); =20 + if (qemu_plugin_get_cb_flags() =3D=3D QEMU_PLUGIN_CB_NO_REGS) { + return -1; + } + return gdb_read_register(current_cpu, buf, GPOINTER_TO_INT(reg) - 1); } =20 diff --git a/plugins/core.c b/plugins/core.c index eb9281fe54..c6e9ef1478 100644 --- a/plugins/core.c +++ b/plugins/core.c @@ -15,6 +15,7 @@ #include "qemu/lockable.h" #include "qemu/option.h" #include "qemu/plugin.h" +#include "qemu/qemu-plugin.h" #include "qemu/queue.h" #include "qemu/rcu_queue.h" #include "qemu/rcu.h" @@ -266,7 +267,9 @@ static void qemu_plugin_vcpu_init__async(CPUState *cpu,= run_on_cpu_data unused) plugin_grow_scoreboards__locked(cpu); qemu_rec_mutex_unlock(&plugin.lock); =20 + qemu_plugin_set_cb_flags(cpu, QEMU_PLUGIN_CB_RW_REGS); plugin_vcpu_cb__simple(cpu, QEMU_PLUGIN_EV_VCPU_INIT); + qemu_plugin_set_cb_flags(cpu, QEMU_PLUGIN_CB_NO_REGS); } =20 void qemu_plugin_vcpu_init_hook(CPUState *cpu) @@ -279,7 +282,9 @@ void qemu_plugin_vcpu_exit_hook(CPUState *cpu) { bool success; =20 + qemu_plugin_set_cb_flags(cpu, QEMU_PLUGIN_CB_RW_REGS); plugin_vcpu_cb__simple(cpu, QEMU_PLUGIN_EV_VCPU_EXIT); + qemu_plugin_set_cb_flags(cpu, QEMU_PLUGIN_CB_NO_REGS); =20 assert(cpu->cpu_index !=3D UNASSIGNED_CPU_INDEX); qemu_rec_mutex_lock(&plugin.lock); @@ -367,6 +372,7 @@ void plugin_register_dyn_cb__udata(GArray **arr, static TCGHelperInfo info[3] =3D { [QEMU_PLUGIN_CB_NO_REGS].flags =3D TCG_CALL_NO_RWG, [QEMU_PLUGIN_CB_R_REGS].flags =3D TCG_CALL_NO_WG, + [QEMU_PLUGIN_CB_RW_REGS].flags =3D 0, /* * Match qemu_plugin_vcpu_udata_cb_t: * void (*)(uint32_t, void *) @@ -396,6 +402,7 @@ void plugin_register_dyn_cond_cb__udata(GArray **arr, static TCGHelperInfo info[3] =3D { [QEMU_PLUGIN_CB_NO_REGS].flags =3D TCG_CALL_NO_RWG, [QEMU_PLUGIN_CB_R_REGS].flags =3D TCG_CALL_NO_WG, + [QEMU_PLUGIN_CB_RW_REGS].flags =3D 0, /* * Match qemu_plugin_vcpu_udata_cb_t: * void (*)(uint32_t, void *) @@ -434,6 +441,7 @@ void plugin_register_vcpu_mem_cb(GArray **arr, static TCGHelperInfo info[3] =3D { [QEMU_PLUGIN_CB_NO_REGS].flags =3D TCG_CALL_NO_RWG, [QEMU_PLUGIN_CB_R_REGS].flags =3D TCG_CALL_NO_WG, + [QEMU_PLUGIN_CB_RW_REGS].flags =3D 0, /* * Match qemu_plugin_vcpu_mem_cb_t: * void (*)(uint32_t, qemu_plugin_meminfo_t, uint64_t, void *) @@ -473,7 +481,9 @@ void qemu_plugin_tb_trans_cb(CPUState *cpu, struct qemu= _plugin_tb *tb) QLIST_FOREACH_SAFE_RCU(cb, &plugin.cb_lists[ev], entry, next) { qemu_plugin_vcpu_tb_trans_cb_t func =3D cb->f.vcpu_tb_trans; =20 + qemu_plugin_set_cb_flags(cpu, QEMU_PLUGIN_CB_RW_REGS); func(cb->ctx->id, tb); + qemu_plugin_set_cb_flags(cpu, QEMU_PLUGIN_CB_NO_REGS); } } =20 @@ -498,7 +508,9 @@ qemu_plugin_vcpu_syscall(CPUState *cpu, int64_t num, ui= nt64_t a1, uint64_t a2, QLIST_FOREACH_SAFE_RCU(cb, &plugin.cb_lists[ev], entry, next) { qemu_plugin_vcpu_syscall_cb_t func =3D cb->f.vcpu_syscall; =20 + qemu_plugin_set_cb_flags(cpu, QEMU_PLUGIN_CB_RW_REGS); func(cb->ctx->id, cpu->cpu_index, num, a1, a2, a3, a4, a5, a6, a7,= a8); + qemu_plugin_set_cb_flags(cpu, QEMU_PLUGIN_CB_NO_REGS); } } =20 @@ -520,7 +532,9 @@ void qemu_plugin_vcpu_syscall_ret(CPUState *cpu, int64_= t num, int64_t ret) QLIST_FOREACH_SAFE_RCU(cb, &plugin.cb_lists[ev], entry, next) { qemu_plugin_vcpu_syscall_ret_cb_t func =3D cb->f.vcpu_syscall_ret; =20 + qemu_plugin_set_cb_flags(cpu, QEMU_PLUGIN_CB_RW_REGS); func(cb->ctx->id, cpu->cpu_index, num, ret); + qemu_plugin_set_cb_flags(cpu, QEMU_PLUGIN_CB_NO_REGS); } } =20 @@ -528,14 +542,18 @@ void qemu_plugin_vcpu_idle_cb(CPUState *cpu) { /* idle and resume cb may be called before init, ignore in this case */ if (cpu->cpu_index < plugin.num_vcpus) { + qemu_plugin_set_cb_flags(cpu, QEMU_PLUGIN_CB_RW_REGS); plugin_vcpu_cb__simple(cpu, QEMU_PLUGIN_EV_VCPU_IDLE); + qemu_plugin_set_cb_flags(cpu, QEMU_PLUGIN_CB_NO_REGS); } } =20 void qemu_plugin_vcpu_resume_cb(CPUState *cpu) { if (cpu->cpu_index < plugin.num_vcpus) { + qemu_plugin_set_cb_flags(cpu, QEMU_PLUGIN_CB_RW_REGS); plugin_vcpu_cb__simple(cpu, QEMU_PLUGIN_EV_VCPU_RESUME); + qemu_plugin_set_cb_flags(cpu, QEMU_PLUGIN_CB_NO_REGS); } } =20 @@ -615,9 +633,13 @@ void qemu_plugin_vcpu_mem_cb(CPUState *cpu, uint64_t v= addr, switch (cb->type) { case PLUGIN_CB_MEM_REGULAR: if (rw & cb->regular.rw) { + qemu_plugin_set_cb_flags(cpu, + tcg_call_to_qemu_plugin_cb_flags(cb->regular.info->fla= gs)); + cb->regular.f.vcpu_mem(cpu->cpu_index, make_plugin_meminfo(oi, rw), vaddr, cb->regular.userp); + qemu_plugin_set_cb_flags(cpu, QEMU_PLUGIN_CB_NO_REGS); } break; case PLUGIN_CB_INLINE_ADD_U64: @@ -760,3 +782,14 @@ void plugin_scoreboard_free(struct qemu_plugin_scorebo= ard *score) g_array_free(score->data, TRUE); g_free(score); } + +enum qemu_plugin_cb_flags tcg_call_to_qemu_plugin_cb_flags(int flags) +{ + if (flags & TCG_CALL_NO_RWG) { + return QEMU_PLUGIN_CB_NO_REGS; + } else if (flags & TCG_CALL_NO_WG) { + return QEMU_PLUGIN_CB_R_REGS; + } else { + return QEMU_PLUGIN_CB_RW_REGS; + } +} --=20 2.47.2 From nobody Sat Nov 15 14:09:41 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1751453542; cv=none; d=zohomail.com; s=zohoarc; b=e2hnnkXkLd58tEes1XfkXMSMZW4hKjwWNUKO8KrGerlyxL68tJzKzTSpt7xYR37uNIAQPjb8U7Vt96AIsDU+yCjFdxG8N35nlQ2gufcm/q1KFNhyKYEolJwi0iesH6pOWkcRYszd9wE20BuwcHdBnMgC6DA0S6KiiDnv7xuq0Pg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751453542; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=jz2+qC8xETuWCBtFi38dLbw9y0bYYX3IVoNM5Sk2/QI=; b=lQRJ9D1gatGULAEin6DSNtjMTbUsO6qWheR8ccd+opZwgo3jdICmEIie5prt6y1fbSTWIkSJqv9emhDSA9kEpWw6DBvl7/B+leR02JqoT/Y1lpG8cP6fcIDRo/wqLS9kHzgfp511ETJVuJLFxcZxYPwq7kk3nEAH4cc6FW2cGcg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1751453542344271.8485216785409; Wed, 2 Jul 2025 03:52:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWv2f-0000Dt-2V; Wed, 02 Jul 2025 06:50: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 1uWv2Y-0008WN-0F for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:50:10 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWv2T-0002yG-EG for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:50:09 -0400 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-3a4ef2c2ef3so3718781f8f.2 for ; Wed, 02 Jul 2025 03:50:04 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4538233c5fasm228963525e9.8.2025.07.02.03.49.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jul 2025 03:50:00 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 8A80B5F8F1; Wed, 02 Jul 2025 11:49:56 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751453403; x=1752058203; 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=jz2+qC8xETuWCBtFi38dLbw9y0bYYX3IVoNM5Sk2/QI=; b=YTJP2iD49CJ/iBImNCJNqBLIE//E/3HANbrmO77s/xRxRr1O/5y/ra9f3/bKe+tsaM gVsMoqXlEaj5OC6FqgkLMv39JdoS0iDhvIu+QZLm825aywvIKZ11zjiV1fQgL4G6wLRJ hoZsrf9mXZtvErteWTVxYmvBMK+nW/eDPIHAX8GDZYlwfIb1eZeo72kvsOIRvdnST2H1 W7lfpEx1SEFXnbxGSJuRkf8Vxbt5RlocrXlU+q05MJqRF06UZFe8+qQ8EYn8nLfkpQeS s36hDWNItjagY7RzJOLYMhsMs8NMWLiBehC7Vbn1uTojE+SIcR9/t4dO8VXjwCKJ1WTd BeBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751453403; x=1752058203; 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=jz2+qC8xETuWCBtFi38dLbw9y0bYYX3IVoNM5Sk2/QI=; b=Q47+GuRNm4Xb1igVhw5XtLbw4lNT7vLaYMyctdV8S9kBAFNNTz5Jb3h0Mj2ndGNUZR HiOm8LPaSWjtAaGT60DZNQV4v1xC03J9EeDdgjh2eLmyb5JJhdohnOYdVzfYdQVH1A4G f5b1k0+pkqxvU1jeHEspo8Xj+VEGNJuegYy7D53e/Sm/xPgHTLh0r2iTQwnj/PgRkoWF E3Rjrk+Lav8FmxQPVoczoPi/uCttZ26LovUBj4PZOOB8xC7OqoHMrJ8kL7aNQl31w6xR VSSZqNfs+Ax2ntU47HajGF6RguvSCdwBW5dVxpKcTi3nLAlQ3RLuNJp13ZoA+71Y/tgH BskQ== X-Gm-Message-State: AOJu0YyZCT4CXhDGKjaEBCqRDYYEHVn8mxEp9ui6vmNiYsmYEth0eWYJ IOWj9zf8kSKKVc4j+J5IYzVdaRREUO8SLQFyJXay8EwKFbbpS0mYiyNQVT6/qKow9wpqk7JYg2F kga4RZIY= X-Gm-Gg: ASbGncu/VEVMLRxC3PGRaBjGKLAlkOgGlHLETpxcHwfPN0bUrefDCSHHqVt3/gGUG1O v2TfxxqLPZdPe/cwm63qbgSWzgch/NpA9EDB78bnOdWqM92sP540Awr8dfDfK1U3jogdfVkmBbA xIVXG5U1iwrj8rdeiopR924qg0ouKrBaUitOvPq9YKiucv6wt05iVBGFm8AwJvo6v/zETM8u6do OZZPCAjOG7TtPS9Jor1nO1ToFJClAEHrHJSBe6SgbQQwNuHCJNPzd58FUy3GjxlQzVwXCpMx0K/ +/g7P+PdjV9UdUjaAjLMPJpKaWXNr9aeuxazCVoImnbonLgeauUAiCJcJ/vSIDA= X-Google-Smtp-Source: AGHT+IElRmRP6XMVnFdIGIqOEMoFQ5CenYNciLrHyT1/0xG9B0kLhD+AsoftRwW6CGX9VVsk9556Fw== X-Received: by 2002:a05:6000:4a09:b0:3ab:27f9:e51 with SMTP id ffacd0b85a97d-3b200582cadmr1618013f8f.31.1751453403380; Wed, 02 Jul 2025 03:50:03 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Rowan Hart , Pierrick Bouvier , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Alexandre Iooss , Mahmoud Mandour Subject: [PULL 08/15] plugins: Add memory virtual address write API Date: Wed, 2 Jul 2025 11:49:48 +0100 Message-ID: <20250702104955.3778269-9-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250702104955.3778269-1-alex.bennee@linaro.org> References: <20250702104955.3778269-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42c.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751453543469116600 From: Rowan Hart This patch adds functions to the plugins API to allow reading and writing memory via virtual addresses. These functions only permit doing so on the current CPU, because there is no way to ensure consistency if plugins are allowed to read or write to other CPUs that aren't currently in the context of the plugin. Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart Message-ID: <20250624175351.440780-5-rowanbhart@gmail.com> Signed-off-by: Alex Benn=C3=A9e Message-ID: <20250627112512.1880708-9-alex.bennee@linaro.org> diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h index 9c9ebf6ce0..4167c46c2a 100644 --- a/include/qemu/qemu-plugin.h +++ b/include/qemu/qemu-plugin.h @@ -958,6 +958,27 @@ QEMU_PLUGIN_API bool qemu_plugin_read_memory_vaddr(uint64_t addr, GByteArray *data, size_t len); =20 +/** + * qemu_plugin_write_memory_vaddr() - write to memory using a virtual addr= ess + * + * @addr: A virtual address to write to + * @data: A byte array containing the data to write + * + * The contents of @data will be written to memory starting at the virtual + * address @addr. + * + * This function does not guarantee consistency of writes, nor does it ens= ure + * that pending writes are flushed either before or after the write takes = place, + * so callers should take care to only call this function in vCPU context = (i.e. + * in callbacks) and avoid depending on the existence of data written usin= g this + * function which may be overwritten afterward. + * + * Returns true on success and false on failure. + */ +QEMU_PLUGIN_API +bool qemu_plugin_write_memory_vaddr(uint64_t addr, + GByteArray *data); + /** * qemu_plugin_scoreboard_new() - alloc a new scoreboard * diff --git a/plugins/api.c b/plugins/api.c index 3f04399c26..1f64a9ea64 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -476,6 +476,24 @@ bool qemu_plugin_read_memory_vaddr(uint64_t addr, GByt= eArray *data, size_t len) return true; } =20 +bool qemu_plugin_write_memory_vaddr(uint64_t addr, GByteArray *data) +{ + g_assert(current_cpu); + + if (data->len =3D=3D 0) { + return false; + } + + int result =3D cpu_memory_rw_debug(current_cpu, addr, data->data, + data->len, true); + + if (result < 0) { + return false; + } + + return true; +} + struct qemu_plugin_scoreboard *qemu_plugin_scoreboard_new(size_t element_s= ize) { return plugin_scoreboard_new(element_size); --=20 2.47.2 From nobody Sat Nov 15 14:09:41 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1751453528; cv=none; d=zohomail.com; s=zohoarc; b=dDiw31+mK3VhGIAySny51yYnE7wc0Uj/UjdUx6EUrlbFY1D/r7my8aAhAtEFd9RbcrmJPRivTMqWvRFvCZyWukh6WynXz49O3zcveyLlaGYiH77f3gTNCJ8S/GmVVbirotgz1JsnrEkVPqaSp689tI0AVs+aQkhog1E6vtUbHFY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751453528; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=f8Jt4664qtDHEeSxPHU9UkVhjqAuRPFvBiOKbwQQWMA=; b=PhPT7GRaIyT/OI4EVVLGQqTgOLJECUYSo1MWvyPTkCohtoqaZZcUFF71B0GEEEzS0JaqKBD3mbbEu7EwQh/agd8RaXliDb5TQ07+Pbvbp0vQwGnj1tDeu0GA6D5rNvCjrHVvscyn6CModa8Qlq0HtGgO60UamR4+X5OyGrgkejw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1751453528192467.8963342379467; Wed, 2 Jul 2025 03:52:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWv33-0000LD-AT; Wed, 02 Jul 2025 06:50:41 -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 1uWv2f-0000E4-Et for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:50:17 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWv2Y-000337-02 for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:50:16 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-4537deebb01so22459045e9.0 for ; Wed, 02 Jul 2025 03:50:09 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a892e52c8esm15896903f8f.55.2025.07.02.03.49.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jul 2025 03:50:01 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id A40EF5F8F3; Wed, 02 Jul 2025 11:49:56 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751453407; x=1752058207; 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=f8Jt4664qtDHEeSxPHU9UkVhjqAuRPFvBiOKbwQQWMA=; b=qLKy24eWgw47gkk/+syakXFHKhj8FxvAAtvq3HHIil6OBx5tCSd/5wVamPW2zVGaPD hknRiRLatcihFjhWIqBFhKFYZFFf0NJOSCs7s+9oo1jjYu4dzy00M6tcyRboKWylQAR7 6yhT9/F/BjMWPmGjuVgWy0pO+17J+0cpam/wTxyHVoVPw1NP6VE71LNQIGkvl2QFuUbq WpWYO91XVqbqHfGQpvmtXik98y4xP22to8RPDna8Vxws3r5D4fTFFKAY6WBcayetJo0g nBqMslCPpy/Bctab/k+QpK8hZ1MUUwDjU3IMuUp1/V8F+IXo8PU7UEkiykyyly8vjhMW T2hQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751453407; x=1752058207; 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=f8Jt4664qtDHEeSxPHU9UkVhjqAuRPFvBiOKbwQQWMA=; b=pNa2Jf+5cUWh0Se8jIY72rjXgk0NqcyyC6LwZD4AMfUr1QofnJdBhV6nMY5vnK0W7c HDdytjXIztuAKcqn8DTYn4cb+4h67JIBLIcfNJU6sPces/nFbc7IyzNQ4VSV6RCtZM4g zgaWc6kXMnAxfmdGaqcyMjSxs1sRlv3mRordIrbETUObkU1qeHPZDNfFgq90BAeeu50y rfFiGjVq4nyAedpmkx5jYYLxfGTH+gi+FrqVGRnTFLrqpJP6yxovilk2XcNOiA+gqdWi 68GF229EbDlg4BBKi6gvKnssgU9Bg6cxnQvgTEbm2+FQf5xXYUheT0PbADnvvHZvPlKy goVQ== X-Gm-Message-State: AOJu0YzMjITB9/LJWWfLfGMwyNK/q4H/YzpBCZM8yT163guiQ3PUXdQs 3D2qGTupVLIZ11JWoSoKcJMgPRO2oS4dQjOMp4qJOh6rteZTvsbffjk8GnmxTQuTuIc= X-Gm-Gg: ASbGncu1s5OQi8+r1mrgAUcEfyedvSZ4DKYUkK7Ggvcqap8lm118R1nQ0Cc4OHJYP9h tlIizi2bxD2CZT2+jQ6pOr/IPr8vxKmBjubB8XEWkgZmFV8oqDv14lJRz+1AnJTNsuYBXi1Aztn +zO0XITkEA8T9oEYz5ZYT4jyt4PTs/PySc/mIjXrFT1SaXrtOkrUHlJiq+vdXLpXG+ONaMxkmY/ 2L5dt/yOowV88iPxbxISXAl+IHXBWJb/V044HlonhCM91avWbRWKg9I0wpGpkAxvBVBM83kXCvq s35Ptr/CliBCBOIxCZVCwFsrrXJ+y6icBimbpflFLrhyEamFIyAF/ruNqpNlmkY= X-Google-Smtp-Source: AGHT+IFndxrKL7X6ads3DLMFkGs3Aq94lOpasul1bQQbT2bg7g5DLoKAOQfRngOVbi/6zH4+oaKLvQ== X-Received: by 2002:a05:6000:200e:b0:3a3:7cbd:39b1 with SMTP id ffacd0b85a97d-3b1ff527396mr1909268f8f.24.1751453406598; Wed, 02 Jul 2025 03:50:06 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Rowan Hart , Pierrick Bouvier , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Alexandre Iooss , Mahmoud Mandour Subject: [PULL 09/15] plugins: Add memory hardware address read/write API Date: Wed, 2 Jul 2025 11:49:49 +0100 Message-ID: <20250702104955.3778269-10-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250702104955.3778269-1-alex.bennee@linaro.org> References: <20250702104955.3778269-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x332.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751453529572116600 From: Rowan Hart This patch adds functions to the plugins API to allow plugins to read and write memory via hardware addresses. The functions use the current address space of the current CPU in order to avoid exposing address space information to users. A later patch may want to add a function to permit a specified address space, for example to facilitate architecture-specific plugins that want to operate on them, for example reading ARM secure memory. Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart Message-ID: <20250624175351.440780-6-rowanbhart@gmail.com> Signed-off-by: Alex Benn=C3=A9e Message-ID: <20250627112512.1880708-10-alex.bennee@linaro.org> diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h index 4167c46c2a..5eecdccc67 100644 --- a/include/qemu/qemu-plugin.h +++ b/include/qemu/qemu-plugin.h @@ -979,6 +979,99 @@ QEMU_PLUGIN_API bool qemu_plugin_write_memory_vaddr(uint64_t addr, GByteArray *data); =20 +/** + * enum qemu_plugin_hwaddr_operation_result - result of a memory operation + * + * @QEMU_PLUGIN_HWADDR_OPERATION_OK: hwaddr operation succeeded + * @QEMU_PLUGIN_HWADDR_OPERATION_ERROR: unexpected error occurred + * @QEMU_PLUGIN_HWADDR_OPERATION_DEVICE_ERROR: error in memory device + * @QEMU_PLUGIN_HWADDR_OPERATION_ACCESS_DENIED: permission error + * @QEMU_PLUGIN_HWADDR_OPERATION_INVALID_ADDRESS: address was invalid + * @QEMU_PLUGIN_HWADDR_OPERATION_INVALID_ADDRESS_SPACE: invalid address sp= ace + */ +enum qemu_plugin_hwaddr_operation_result { + QEMU_PLUGIN_HWADDR_OPERATION_OK, + QEMU_PLUGIN_HWADDR_OPERATION_ERROR, + QEMU_PLUGIN_HWADDR_OPERATION_DEVICE_ERROR, + QEMU_PLUGIN_HWADDR_OPERATION_ACCESS_DENIED, + QEMU_PLUGIN_HWADDR_OPERATION_INVALID_ADDRESS, + QEMU_PLUGIN_HWADDR_OPERATION_INVALID_ADDRESS_SPACE, +}; + +/** + * qemu_plugin_read_memory_hwaddr() - read from memory using a hardware ad= dress + * + * @addr: The physical address to read from + * @data: A byte array to store data into + * @len: The number of bytes to read, starting from @addr + * + * @len bytes of data is read from the current memory space for the current + * vCPU starting at @addr and stored into @data. If @data is not large eno= ugh to + * hold @len bytes, it will be expanded to the necessary size, reallocatin= g if + * necessary. @len must be greater than 0. + * + * This function does not ensure writes are flushed prior to reading, so + * callers should take care when calling this function in plugin callbacks= to + * avoid attempting to read data which may not yet be written and should u= se + * the memory callback API instead. + * + * This function is only valid for softmmu targets. + * + * Returns a qemu_plugin_hwaddr_operation_result indicating the result of = the + * operation. + */ +QEMU_PLUGIN_API +enum qemu_plugin_hwaddr_operation_result +qemu_plugin_read_memory_hwaddr(uint64_t addr, GByteArray *data, size_t len= ); + +/** + * qemu_plugin_write_memory_hwaddr() - write to memory using a hardware ad= dress + * + * @addr: A physical address to write to + * @data: A byte array containing the data to write + * + * The contents of @data will be written to memory starting at the hardware + * address @addr in the current address space for the current vCPU. + * + * This function does not guarantee consistency of writes, nor does it ens= ure + * that pending writes are flushed either before or after the write takes = place, + * so callers should take care when calling this function in plugin callba= cks to + * avoid depending on the existence of data written using this function wh= ich + * may be overwritten afterward. In addition, this function requires that = the + * pages containing the address are not locked. Practically, this means th= at you + * should not write instruction memory in a current translation block insi= de a + * callback registered with qemu_plugin_register_vcpu_tb_trans_cb. + * + * You can, for example, write instruction memory in a current translation= block + * in a callback registered with qemu_plugin_register_vcpu_tb_exec_cb, alt= hough + * be aware that the write will not be flushed until after the translation= block + * has finished executing. In general, this function should be used to wr= ite + * data memory or to patch code at a known address, not in a current trans= lation + * block. + * + * This function is only valid for softmmu targets. + * + * Returns a qemu_plugin_hwaddr_operation_result indicating the result of = the + * operation. + */ +QEMU_PLUGIN_API +enum qemu_plugin_hwaddr_operation_result +qemu_plugin_write_memory_hwaddr(uint64_t addr, GByteArray *data); + +/** + * qemu_plugin_translate_vaddr() - translate virtual address for current v= CPU + * + * @vaddr: virtual address to translate + * @hwaddr: pointer to store the physical address + * + * This function is only valid in vCPU context (i.e. in callbacks) and is = only + * valid for softmmu targets. + * + * Returns true on success and false on failure. + */ +QEMU_PLUGIN_API +bool qemu_plugin_translate_vaddr(uint64_t vaddr, uint64_t *hwaddr); + /** * qemu_plugin_scoreboard_new() - alloc a new scoreboard * diff --git a/plugins/api.c b/plugins/api.c index 1f64a9ea64..eac04cc1f6 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -39,6 +39,7 @@ #include "qemu/main-loop.h" #include "qemu/plugin.h" #include "qemu/log.h" +#include "system/memory.h" #include "tcg/tcg.h" #include "exec/gdbstub.h" #include "exec/target_page.h" @@ -494,6 +495,102 @@ bool qemu_plugin_write_memory_vaddr(uint64_t addr, GB= yteArray *data) return true; } =20 +enum qemu_plugin_hwaddr_operation_result +qemu_plugin_read_memory_hwaddr(hwaddr addr, GByteArray *data, size_t len) +{ +#ifdef CONFIG_SOFTMMU + if (len =3D=3D 0) { + return QEMU_PLUGIN_HWADDR_OPERATION_ERROR; + } + + g_assert(current_cpu); + + + int as_idx =3D cpu_asidx_from_attrs(current_cpu, MEMTXATTRS_UNSPECIFIE= D); + AddressSpace *as =3D cpu_get_address_space(current_cpu, as_idx); + + if (as =3D=3D NULL) { + return QEMU_PLUGIN_HWADDR_OPERATION_INVALID_ADDRESS_SPACE; + } + + g_byte_array_set_size(data, len); + MemTxResult res =3D address_space_rw(as, addr, + MEMTXATTRS_UNSPECIFIED, data->data, + data->len, false); + + switch (res) { + case MEMTX_OK: + return QEMU_PLUGIN_HWADDR_OPERATION_OK; + case MEMTX_ERROR: + return QEMU_PLUGIN_HWADDR_OPERATION_DEVICE_ERROR; + case MEMTX_DECODE_ERROR: + return QEMU_PLUGIN_HWADDR_OPERATION_INVALID_ADDRESS; + case MEMTX_ACCESS_ERROR: + return QEMU_PLUGIN_HWADDR_OPERATION_ACCESS_DENIED; + default: + return QEMU_PLUGIN_HWADDR_OPERATION_ERROR; + } +#else + return QEMU_PLUGIN_HWADDR_OPERATION_ERROR; +#endif +} + +enum qemu_plugin_hwaddr_operation_result +qemu_plugin_write_memory_hwaddr(hwaddr addr, GByteArray *data) +{ +#ifdef CONFIG_SOFTMMU + if (data->len =3D=3D 0) { + return QEMU_PLUGIN_HWADDR_OPERATION_ERROR; + } + + g_assert(current_cpu); + + int as_idx =3D cpu_asidx_from_attrs(current_cpu, MEMTXATTRS_UNSPECIFIE= D); + AddressSpace *as =3D cpu_get_address_space(current_cpu, as_idx); + + if (as =3D=3D NULL) { + return QEMU_PLUGIN_HWADDR_OPERATION_INVALID_ADDRESS_SPACE; + } + + MemTxResult res =3D address_space_rw(as, addr, + MEMTXATTRS_UNSPECIFIED, data->data, + data->len, true); + switch (res) { + case MEMTX_OK: + return QEMU_PLUGIN_HWADDR_OPERATION_OK; + case MEMTX_ERROR: + return QEMU_PLUGIN_HWADDR_OPERATION_DEVICE_ERROR; + case MEMTX_DECODE_ERROR: + return QEMU_PLUGIN_HWADDR_OPERATION_INVALID_ADDRESS; + case MEMTX_ACCESS_ERROR: + return QEMU_PLUGIN_HWADDR_OPERATION_ACCESS_DENIED; + default: + return QEMU_PLUGIN_HWADDR_OPERATION_ERROR; + } +#else + return QEMU_PLUGIN_HWADDR_OPERATION_ERROR; +#endif +} + +bool qemu_plugin_translate_vaddr(uint64_t vaddr, uint64_t *hwaddr) +{ +#ifdef CONFIG_SOFTMMU + g_assert(current_cpu); + + uint64_t res =3D cpu_get_phys_page_debug(current_cpu, vaddr); + + if (res =3D=3D (uint64_t)-1) { + return false; + } + + *hwaddr =3D res | (vaddr & ~TARGET_PAGE_MASK); + + return true; +#else + return false; +#endif +} + struct qemu_plugin_scoreboard *qemu_plugin_scoreboard_new(size_t element_s= ize) { return plugin_scoreboard_new(element_size); --=20 2.47.2 From nobody Sat Nov 15 14:09:41 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1751453494; cv=none; d=zohomail.com; s=zohoarc; b=DxStSNC/j4eEGOb+pHY3OSr2SRt1EYy9N9Q8pFmv0OxOz5S+WvSGUcWghTGi3vJtMBRX+HBir8Np+eFx1NPydCao6g9YMFutozsHFs30W2faldZWAm8i8Dn2twVywCAJHjQ2WNJVg/bdzPvHTGCCD5fTV12i99M27kjHvp3Pkq4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751453494; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Rk0FNmkluSOyigMHJWnPKlXjmy4Hc5fY1wkF0CxDkc8=; b=Y22uw2kyy3WXGGDR9O+yI59bgtAfL/YhnZgnqKUATcYjFQYLLMDEjoC0s7TZOm4s7Xml/RsVVdWPdC2QXgD3ZZ9C2HDbzeiv2UVB4MyPALrZuoywOo+En5hOfOkCRYXuldAbBob/Eiyzm0gWoGSy9xyUVWM9QsV1W49tCMecXqA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1751453494472778.0268279309431; Wed, 2 Jul 2025 03:51:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWv2e-0000DZ-Ba; Wed, 02 Jul 2025 06:50: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 1uWv2a-000068-1C for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:50:12 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWv2W-00032I-97 for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:50:11 -0400 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-3a522224582so3502376f8f.3 for ; Wed, 02 Jul 2025 03:50:07 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a88c80b516sm15375280f8f.41.2025.07.02.03.49.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jul 2025 03:50:01 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id B65BF5F8F9; Wed, 02 Jul 2025 11:49:56 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751453406; x=1752058206; 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=Rk0FNmkluSOyigMHJWnPKlXjmy4Hc5fY1wkF0CxDkc8=; b=lm7/ArpdIhfImUFzGEruT7daUs7M0ycSR456O5J9+LSziXXg6t2lPnT9+djQN6Asbs ARYqOd69TJ7UjNKaGkUIXmR9WcNP/oI1o7wfsnX5kYOHliH3slUWOeFydNwf1k/2mMHm qglUH/1HNCqQrq5qXmFuUbS8i8Rl24flWNgxRNDMzulhMwp5QS4yoNuUwYfF/SVcPT1a 0NbKij7B/W5QXT9nnkPagCXaN17bpbbU6+06XxSUxwnUDw+OkHkFehBrwhzcP5e2QIEa oFz9jHcxT5NPg1M2QDSu1sO6K6ddUh9XWdGsJNZbCbpFGXTbMQ7F6D7q0nGWpTbLykNs f1lQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751453406; x=1752058206; 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=Rk0FNmkluSOyigMHJWnPKlXjmy4Hc5fY1wkF0CxDkc8=; b=iin8r/AoaaQ3wN+lNLUn7beDPCfIAdK8rNpI7BJN+VkSxts2ViI2tkw+en7+TnO4Ww 2DOfykl5YQRFziu2uFJjZn489fl2PLgJus+sGp8BCbTR8/ji9Iokf4YwWTDbsmSeG0Gb ZKXqGL1uRGDXnQUYmOSUJ0TdlVJuUCVPfUkqxGaeTBvTw3yb0M2UyFHxtyISsNs3+fBE WLj2bddre4eKYbYLyUcZao7Wzg2XZuNENjHorkOiuy1GBOl+vlDgjCXKbcHiZXiVNTXz PDVX7gsoXKq2ZWpDTDf8kDfdXB36VKYbfG2O+O3+EYfSeKqsOyVejtu8zixRAD7fO4rE iWnA== X-Gm-Message-State: AOJu0Yz2ttRrAW3e/sqUMqR3EIGVYx9AziUC2Fo/aDqA3w3MDkfzDtwB 2c1BbhqqQ0XjhHPbDD+Wi0mFwyLV6RaoZ04wItf1C/zRS7Wq6OwmWJ+3UVLmqJnEn3c= X-Gm-Gg: ASbGncs/dxeAUvGiLa3fVwCB9mjJ+bQ7uy7qmwc6TLqc94z2cSSsWjGTc9aSsapYiJz T7Tv0KYia2V5pzwc6Emh+IIEEtnXcOCf9MdiJMdrptwchNOGuP4i3BnNNhFkMuJdG4B9jHppKM4 l4xplLJXAaMYBfffSjbJgu4KrALo09b01pA03n/a1odyZtvtMp9WlvG2oUaS0WtlujkZKos7KOJ FixwL0+zDf1STPXnbpL5gklnUOgy3mhpgU+/xaPGWdInlnlWyZut6+Qc6NUOYS8D+AKZtqfgYG5 cWrwphSin86dqD0Ai5ycT5Vsc+pYtIYI5+8o7aUzueia+L3n38WXTwCmZBkToDw= X-Google-Smtp-Source: AGHT+IEA6NwdDoo5tr2dxfPFZgnFN2ppuvLwTIZBVQQh3e8R8+JsacxaEBn7SR0+Q+u9iy08/W18mA== X-Received: by 2002:a05:6000:2d02:b0:3a5:1410:71c0 with SMTP id ffacd0b85a97d-3b2000b0826mr1262431f8f.38.1751453405856; Wed, 02 Jul 2025 03:50:05 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Rowan Hart , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , Richard Henderson , Eduardo Habkost Subject: [PULL 10/15] tests/tcg: Remove copy-pasted notes and from i386 and add x86_64 system tests to tests Date: Wed, 2 Jul 2025 11:49:50 +0100 Message-ID: <20250702104955.3778269-11-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250702104955.3778269-1-alex.bennee@linaro.org> References: <20250702104955.3778269-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42f.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751453496847116600 From: Rowan Hart The x86_64-softmmu Makefile seems to have been copy-pasted from the i386 Makefile at some point in the past. Cleaning up a vestigial unused variable and removing some outdated comments. Signed-off-by: Rowan Hart Message-ID: <20250624175351.440780-7-rowanbhart@gmail.com> Signed-off-by: Alex Benn=C3=A9e Message-ID: <20250627112512.1880708-11-alex.bennee@linaro.org> diff --git a/tests/tcg/x86_64/Makefile.softmmu-target b/tests/tcg/x86_64/Ma= kefile.softmmu-target index ef6bcb4dc7..d3e09708a5 100644 --- a/tests/tcg/x86_64/Makefile.softmmu-target +++ b/tests/tcg/x86_64/Makefile.softmmu-target @@ -1,13 +1,11 @@ # -# x86 system tests -# -# This currently builds only for i386. The common C code is built -# with standard compiler flags however so we can support both by -# adding additional boot files for x86_64. +# x86_64 system tests # =20 -I386_SYSTEM_SRC=3D$(SRC_PATH)/tests/tcg/i386/system X64_SYSTEM_SRC=3D$(SRC_PATH)/tests/tcg/x86_64/system +X64_SYSTEM_TESTS=3D$(patsubst $(X64_SYSTEM_SRC)/%.c, %, $(wildcard $(X64_S= YSTEM_SRC)/*.c)) + +VPATH+=3D$(X64_SYSTEM_SRC) =20 # These objects provide the basic boot code and helper functions for all t= ests CRT_OBJS=3Dboot.o @@ -18,7 +16,7 @@ LDFLAGS=3D-Wl,-T$(LINK_SCRIPT) -Wl,-melf_x86_64 CFLAGS+=3D-nostdlib -ggdb -O0 $(MINILIB_INC) LDFLAGS+=3D-static -nostdlib $(CRT_OBJS) $(MINILIB_OBJS) -lgcc =20 -TESTS+=3D$(MULTIARCH_TESTS) +TESTS+=3D$(MULTIARCH_TESTS) $(X64_SYSTEM_TESTS) EXTRA_RUNS+=3D$(MULTIARCH_RUNS) =20 # building head blobs --=20 2.47.2 From nobody Sat Nov 15 14:09:41 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1751453527; cv=none; d=zohomail.com; s=zohoarc; b=fn47RiYelNEEpx4bjuxjbSl6y8a15Qf/KMLjQusrv3lImGoaE1rj+dQf739Q7kE3X/lnSfjT58I/Dl4ihzxEp/KrhjY6IGm45klSKmBZp2JVd7CXrhFqJyRN+gRFa/W7WV27+oCFIXxtOrVpnXJjtpTCe+bAYjaMmVWT2ZyL7Sw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751453527; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ga+r7yAjZ91S5TYW9IwIwF6TbkVAcOYP9gO9+s32MWY=; b=SMF4CUCrlRlNjrmakM2udERZMd102EJt6ycZAPvRwC4GZciKW6tj0Ui1SnS5AKUnd132KpxGHNlBuGwvjrYsgu50pn9ZhQs/AOy23E9ljxjFgrXoVA1k07EDuwkdmqHvr3OnmN01cx7QkBiiCIDGGSCBz37BEdL1Fc17N1hptHw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1751453527741746.2233309232039; Wed, 2 Jul 2025 03:52:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWv2g-0000Fl-GZ; Wed, 02 Jul 2025 06:50: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 1uWv2e-0000Df-Ix for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:50:16 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWv2Z-00033f-P5 for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:50:16 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-4538a2fc7ffso44871385e9.0 for ; Wed, 02 Jul 2025 03:50:10 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4538a3fe0d6sm194246525e9.25.2025.07.02.03.50.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jul 2025 03:50:05 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id D39BC5F8FC; Wed, 02 Jul 2025 11:49:56 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751453409; x=1752058209; 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=ga+r7yAjZ91S5TYW9IwIwF6TbkVAcOYP9gO9+s32MWY=; b=gOIy0CZ2eznjUwIAkU3kZHjrx897jrlUuv+F1mbnOzW03KJQRyDZNJYNQpY9J8rSfQ b4u+/04UQ/7EqqzB0q5Izm8bdSvLtn8Nc8tyAE/9HSqh9T5MRzd5QE6byF199fCXwbZM Z4Fn0iHIPDRJ+2tdNGnAyW6N0bd0OPH5cJUCzO4dn84zOE7TEf1DQKTWpaR371zmhxOs GYXrFDFXxC4hRxVHtq+8WqcmZ0a/Vh47LFJbKnpm2fE9c7xzZ+Bcf0cp2Ny0lIAGTx4x EYN82SOkPi+Ka3nHVNw2Bp9vyGxSSbycpmbVnBBE1QOLgCDJ5SuA6ShSEFpVA1Goz3/H R2rQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751453409; x=1752058209; 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=ga+r7yAjZ91S5TYW9IwIwF6TbkVAcOYP9gO9+s32MWY=; b=wmv4F/7uwocnd7Lk+n1P9jOKTwBZ2EyuoxMoOoA605G6AjpsrPQKt48gPRizo9E4pA vOInHyABo3C5e+emdSs1cKqPdKhz20lVTLKNPV/iDpCLJEXqz3SIpjJpQgueY5K52C7P 17/u7SVzbljdaCWJpZEmrGv6O24h+Wuarci1U5ju6XNALoBAZOLUGCsxknG5LKS9aVI3 yOs5Ue584bWlvTonqrIqtgFliSiyezO3UnqZpU4TSAjZzf2XoT6Yp+gwyjHhB7RTV5Y8 ItP7ex5tvx4fYr6rlzJvnPOE4dHONWPChreblIxYptWLRlcGN/YqtbT93CT8fn5SVjeP zhgA== X-Gm-Message-State: AOJu0YzSM8oFZnh6ZWUL7qn9VUkA9Y2LUNpWaCmkefc9sOcbaW8ou/ex 52E8pxDx61tA0e7SfYJWOO5N8uqYgE9fOtiGyAtNJhAmVHjjb8x3HQ7l8zthjkDEji0= X-Gm-Gg: ASbGncu+fEFw5AZEIR8XuXuEotRA6jhfZf+BDiRD5+JNIjsxGMuTKb3FcdRfdfOxnEL 0gQzhp6Db1tVH4iW8n3ggfaXp+79k7tF/mzcHTPY09SDs5u2EvZGFtNF7Q2HUWZQOJPWuQD2zu9 DuRJs93HLe3XjZDYGZsq0hXCRShuNKtLTWN8CnZdOuzms50xRQKES5y5pUeZsA6974rWnQKRG53 7mPsdKgh3Yv3zAhROpKYYc7ACZJ2meFxir+RWhjLhHZj0/Ib11Ss8ArDCF3zX7PWTMOFrWvfIZB Tkz6JhEoTas2cTDXpT0g/frqTY6XT/wNvB+dsa++NwAfWnJ1tbz/t4Dbt9Tx6sY= X-Google-Smtp-Source: AGHT+IHOlwq7FgtCHB+a4B7ziT7LjROuWgILOCXT3hcrZmBwfrHefX1WwHAYiBuHEw9js4dYxHz6PQ== X-Received: by 2002:a05:600c:8884:b0:453:69dc:2621 with SMTP id 5b1f17b1804b1-454a3c5527cmr16590965e9.12.1751453408383; Wed, 02 Jul 2025 03:50:08 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Rowan Hart , Pierrick Bouvier , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alexandre Iooss , Mahmoud Mandour , Paolo Bonzini , Richard Henderson , Eduardo Habkost Subject: [PULL 11/15] plugins: Add patcher plugin and test Date: Wed, 2 Jul 2025 11:49:51 +0100 Message-ID: <20250702104955.3778269-12-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250702104955.3778269-1-alex.bennee@linaro.org> References: <20250702104955.3778269-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x335.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751453529609116600 From: Rowan Hart This patch adds a plugin that exercises the virtual and hardware memory read-write API functions added in a previous patch. The plugin takes a target and patch byte sequence, and will overwrite any instruction matching the target byte sequence with the patch. Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart Message-ID: <20250624175351.440780-8-rowanbhart@gmail.com> [AJB: tweak Makefile, use uintptr_t for pointer stuffing] Signed-off-by: Alex Benn=C3=A9e Message-ID: <20250627112512.1880708-12-alex.bennee@linaro.org> diff --git a/tests/tcg/plugins/patch.c b/tests/tcg/plugins/patch.c new file mode 100644 index 0000000000..111c5c1f16 --- /dev/null +++ b/tests/tcg/plugins/patch.c @@ -0,0 +1,251 @@ +/* + * SPDX-License-Identifier: GPL-2.0-or-later + * + * This plugin patches instructions matching a pattern to a different + * instruction as they execute + * + */ + +#include "glib.h" +#include "glibconfig.h" + +#include +#include +#include + +QEMU_PLUGIN_EXPORT int qemu_plugin_version =3D QEMU_PLUGIN_VERSION; + +static bool use_hwaddr; +static GByteArray *target_data; +static GByteArray *patch_data; + +/** + * Parse a string of hexadecimal digits into a GByteArray. The string must= be + * even length + */ +static GByteArray *str_to_bytes(const char *str) +{ + size_t len =3D strlen(str); + + if (len =3D=3D 0 || len % 2 !=3D 0) { + return NULL; + } + + GByteArray *bytes =3D g_byte_array_new(); + char byte[3] =3D {0}; + guint8 value =3D 0; + + for (size_t i =3D 0; i < len; i +=3D 2) { + byte[0] =3D str[i]; + byte[1] =3D str[i + 1]; + value =3D (guint8)g_ascii_strtoull(byte, NULL, 16); + g_byte_array_append(bytes, &value, 1); + } + + return bytes; +} + +static void patch_hwaddr(unsigned int vcpu_index, void *userdata) +{ + uintptr_t addr =3D (uintptr_t) userdata; + g_autoptr(GString) str =3D g_string_new(NULL); + g_string_printf(str, "patching: @0x%" + PRIxPTR "\n", + addr); + qemu_plugin_outs(str->str); + + enum qemu_plugin_hwaddr_operation_result result =3D + qemu_plugin_write_memory_hwaddr(addr, patch_data); + + + if (result !=3D QEMU_PLUGIN_HWADDR_OPERATION_OK) { + g_autoptr(GString) errmsg =3D g_string_new(NULL); + g_string_printf(errmsg, "Failed to write memory: %d\n", result); + qemu_plugin_outs(errmsg->str); + return; + } + + GByteArray *read_data =3D g_byte_array_new(); + + result =3D qemu_plugin_read_memory_hwaddr(addr, read_data, + patch_data->len); + + qemu_plugin_outs("Reading memory...\n"); + + if (result !=3D QEMU_PLUGIN_HWADDR_OPERATION_OK) { + g_autoptr(GString) errmsg =3D g_string_new(NULL); + g_string_printf(errmsg, "Failed to read memory: %d\n", result); + qemu_plugin_outs(errmsg->str); + return; + } + + if (memcmp(patch_data->data, read_data->data, patch_data->len) !=3D 0)= { + qemu_plugin_outs("Failed to read back written data\n"); + } + + qemu_plugin_outs("Success!\n"); + + return; +} + +static void patch_vaddr(unsigned int vcpu_index, void *userdata) +{ + uintptr_t addr =3D (uintptr_t) userdata; + uint64_t hwaddr =3D 0; + if (!qemu_plugin_translate_vaddr(addr, &hwaddr)) { + qemu_plugin_outs("Failed to translate vaddr\n"); + return; + } + g_autoptr(GString) str =3D g_string_new(NULL); + g_string_printf(str, "patching: @0x%" + PRIxPTR " hw: @0x%" PRIx64 "\n", + addr, hwaddr); + qemu_plugin_outs(str->str); + + qemu_plugin_outs("Writing memory (vaddr)...\n"); + + if (!qemu_plugin_write_memory_vaddr(addr, patch_data)) { + qemu_plugin_outs("Failed to write memory\n"); + return; + } + + qemu_plugin_outs("Reading memory (vaddr)...\n"); + + g_autoptr(GByteArray) read_data =3D g_byte_array_new(); + + if (!qemu_plugin_read_memory_vaddr(addr, read_data, patch_data->len)) { + qemu_plugin_outs("Failed to read memory\n"); + return; + } + + if (memcmp(patch_data->data, read_data->data, patch_data->len) !=3D 0)= { + qemu_plugin_outs("Failed to read back written data\n"); + } + + qemu_plugin_outs("Success!\n"); + + return; +} + +/* + * Callback on translation of a translation block. + */ +static void vcpu_tb_trans_cb(qemu_plugin_id_t id, struct qemu_plugin_tb *t= b) +{ + g_autoptr(GByteArray) insn_data =3D g_byte_array_new(); + uintptr_t addr =3D 0; + + for (size_t i =3D 0; i < qemu_plugin_tb_n_insns(tb); i++) { + struct qemu_plugin_insn *insn =3D qemu_plugin_tb_get_insn(tb, i); + uint64_t vaddr =3D qemu_plugin_insn_vaddr(insn); + + if (use_hwaddr) { + uint64_t hwaddr =3D 0; + if (!qemu_plugin_translate_vaddr(vaddr, &hwaddr)) { + qemu_plugin_outs("Failed to translate vaddr\n"); + continue; + } + /* + * As we cannot emulate 64 bit systems on 32 bit hosts we + * should never see the top bits set, hence we can safely + * cast to uintptr_t. + */ + g_assert(hwaddr <=3D UINTPTR_MAX); + addr =3D (uintptr_t) hwaddr; + } else { + g_assert(vaddr <=3D UINTPTR_MAX); + addr =3D (uintptr_t) vaddr; + } + + g_byte_array_set_size(insn_data, qemu_plugin_insn_size(insn)); + qemu_plugin_insn_data(insn, insn_data->data, insn_data->len); + + if (insn_data->len >=3D target_data->len && + !memcmp(insn_data->data, target_data->data, + MIN(target_data->len, insn_data->len))) { + if (use_hwaddr) { + qemu_plugin_register_vcpu_tb_exec_cb(tb, patch_hwaddr, + QEMU_PLUGIN_CB_NO_REG= S, + (void *) addr); + } else { + qemu_plugin_register_vcpu_tb_exec_cb(tb, patch_vaddr, + QEMU_PLUGIN_CB_NO_REG= S, + (void *) addr); + } + } + } +} + +static void usage(void) +{ + fprintf(stderr, "Usage: ,target=3D,patch=3D" + "[,use_hwaddr=3Dtrue|false]"); +} + +/* + * Called when the plugin is installed + */ +QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id, + const qemu_info_t *info, int ar= gc, + char **argv) +{ + + use_hwaddr =3D true; + target_data =3D NULL; + patch_data =3D NULL; + + if (argc > 4) { + usage(); + return -1; + } + + for (size_t i =3D 0; i < argc; i++) { + char *opt =3D argv[i]; + g_auto(GStrv) tokens =3D g_strsplit(opt, "=3D", 2); + if (g_strcmp0(tokens[0], "use_hwaddr") =3D=3D 0) { + if (!qemu_plugin_bool_parse(tokens[0], tokens[1], &use_hwaddr)= ) { + fprintf(stderr, + "Failed to parse boolean argument use_hwaddr\n"); + return -1; + } + } else if (g_strcmp0(tokens[0], "target") =3D=3D 0) { + target_data =3D str_to_bytes(tokens[1]); + if (!target_data) { + fprintf(stderr, + "Failed to parse target bytes.\n"); + return -1; + } + } else if (g_strcmp0(tokens[0], "patch") =3D=3D 0) { + patch_data =3D str_to_bytes(tokens[1]); + if (!patch_data) { + fprintf(stderr, "Failed to parse patch bytes.\n"); + return -1; + } + } else { + fprintf(stderr, "Unknown argument: %s\n", tokens[0]); + usage(); + return -1; + } + } + + if (!target_data) { + fprintf(stderr, "target argument is required\n"); + usage(); + return -1; + } + + if (!patch_data) { + fprintf(stderr, "patch argument is required\n"); + usage(); + return -1; + } + + if (target_data->len !=3D patch_data->len) { + fprintf(stderr, "Target and patch data must be the same length\n"); + return -1; + } + + qemu_plugin_register_vcpu_tb_trans_cb(id, vcpu_tb_trans_cb); + + return 0; +} diff --git a/tests/tcg/x86_64/system/patch-target.c b/tests/tcg/x86_64/syst= em/patch-target.c new file mode 100644 index 0000000000..8c2b6f4ba7 --- /dev/null +++ b/tests/tcg/x86_64/system/patch-target.c @@ -0,0 +1,22 @@ +/* + * SPDX-License-Identifier: GPL-2.0-or-later + * + * This test target increments a value 100 times. The patcher converts the + * inc instruction to a nop, so it only increments the value once. + * + */ +#include + +int main(void) +{ + ml_printf("Running test...\n"); + unsigned int x =3D 0; + for (int i =3D 0; i < 100; i++) { + asm volatile ( + "inc %[x]" + : [x] "+a" (x) + ); + } + ml_printf("Value: %d\n", x); + return 0; +} diff --git a/tests/tcg/Makefile.target b/tests/tcg/Makefile.target index 95ff76ea44..af68f11664 100644 --- a/tests/tcg/Makefile.target +++ b/tests/tcg/Makefile.target @@ -151,7 +151,12 @@ ifeq ($(CONFIG_PLUGIN),y) PLUGIN_SRC=3D$(SRC_PATH)/tests/tcg/plugins PLUGIN_LIB=3D../plugins VPATH+=3D$(PLUGIN_LIB) -PLUGINS=3D$(patsubst %.c, lib%.so, $(notdir $(wildcard $(PLUGIN_SRC)/*.c))) +# Some plugins need to be disabled for all tests to avoid exponential expl= osion. +# For example, libpatch.so only needs to run against the arch-specific pat= ch +# target test, so we explicitly run it in the arch-specific Makefile. +DISABLE_PLUGINS=3Dlibpatch.so +PLUGINS=3D$(filter-out $(DISABLE_PLUGINS), \ + $(patsubst %.c, lib%.so, $(notdir $(wildcard $(PLUGIN_SRC)/*.c)))) =20 # We need to ensure expand the run-plugin-TEST-with-PLUGIN # pre-requistes manually here as we can't use stems to handle it. We diff --git a/tests/tcg/plugins/meson.build b/tests/tcg/plugins/meson.build index 029342282a..61a007d9e7 100644 --- a/tests/tcg/plugins/meson.build +++ b/tests/tcg/plugins/meson.build @@ -1,6 +1,6 @@ t =3D [] if get_option('plugins') - foreach i : ['bb', 'empty', 'inline', 'insn', 'mem', 'reset', 'syscall'] + foreach i : ['bb', 'empty', 'inline', 'insn', 'mem', 'reset', 'syscall',= 'patch'] if host_os =3D=3D 'windows' t +=3D shared_module(i, files(i + '.c') + '../../../contrib/plugins/= win32_linker.c', include_directories: '../../../include/qemu', diff --git a/tests/tcg/x86_64/Makefile.softmmu-target b/tests/tcg/x86_64/Ma= kefile.softmmu-target index d3e09708a5..3e30ca9307 100644 --- a/tests/tcg/x86_64/Makefile.softmmu-target +++ b/tests/tcg/x86_64/Makefile.softmmu-target @@ -33,3 +33,12 @@ memory: CFLAGS+=3D-DCHECK_UNALIGNED=3D1 =20 # Running QEMU_OPTS+=3D-device isa-debugcon,chardev=3Doutput -device isa-debug-exit,= iobase=3D0xf4,iosize=3D0x4 -kernel + +ifeq ($(CONFIG_PLUGIN),y) +run-plugin-patch-target-with-libpatch.so: \ + PLUGIN_ARGS=3D$(COMMA)target=3Dffc0$(COMMA)patch=3D9090$(COMMA)use_hwaddr= =3Dtrue +run-plugin-patch-target-with-libpatch.so: \ + CHECK_PLUGIN_OUTPUT_COMMAND=3D$(X64_SYSTEM_SRC)/validate-patch.py $@.out +run-plugin-patch-target-with-libpatch.so: patch-target libpatch.so +EXTRA_RUNS+=3Drun-plugin-patch-target-with-libpatch.so +endif diff --git a/tests/tcg/x86_64/system/validate-patch.py b/tests/tcg/x86_64/s= ystem/validate-patch.py new file mode 100755 index 0000000000..700950eae5 --- /dev/null +++ b/tests/tcg/x86_64/system/validate-patch.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python3 +# +# validate-patch.py: check the patch applies +# +# This program takes two inputs: +# - the plugin output +# - the binary output +# +# Copyright (C) 2024 +# +# SPDX-License-Identifier: GPL-2.0-or-later + +import sys +from argparse import ArgumentParser + +def main() -> None: + """ + Process the arguments, injest the program and plugin out and + verify they match up and report if they do not. + """ + parser =3D ArgumentParser(description=3D"Validate patch") + parser.add_argument('test_output', + help=3D"The output from the test itself") + parser.add_argument('plugin_output', + help=3D"The output from plugin") + args =3D parser.parse_args() + + with open(args.test_output, 'r') as f: + test_data =3D f.read() + with open(args.plugin_output, 'r') as f: + plugin_data =3D f.read() + if "Value: 1" in test_data: + sys.exit(0) + else: + sys.exit(1) + +if __name__ =3D=3D "__main__": + main() + --=20 2.47.2 From nobody Sat Nov 15 14:09:41 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1751453495; cv=none; d=zohomail.com; s=zohoarc; b=ThEw4FcQitE8MrEBm/Qab8NikhbEFwtSQUE/l4Y/6ZV+mcoo89Sq34Isqo2b8tVRDU4Q+0y4F8fACDXRGZFa92QM2NjqXmfIZVmSj3D0KOvBUVwprw+LNwILe6V4GLjtMg91B3h/z9FXMHXMqlQqX3PG4viOUrYjDLK33kysj3U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751453495; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=q++VT0w3BFey6U6AhyjA4yt6pGOWJ3/ulMKQuhSNA98=; b=gg0qAFqGVMl7UckFGvPa0iH3UyR9Lxn+15SYXQqySYjH1oCrvjebvcTKv7USvF55dgHCoQ63nYj9ZErNlBuIMkjqkeEjHANTm1I6NSUPeUFvBEUq0Yn/h1GNvaoG1D8ZxsUK40Ok5lnb1TzNc2Tz+oNFgdtS4dLDk1oz7SHDcJo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1751453495983144.21511449362674; Wed, 2 Jul 2025 03:51:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWv2m-0000I3-NC; Wed, 02 Jul 2025 06:50:24 -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 1uWv2a-00007u-Gf for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:50:12 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWv2X-00033J-E3 for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:50:12 -0400 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-3a4ef2c2ef3so3718866f8f.2 for ; Wed, 02 Jul 2025 03:50:08 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a88c7e7524sm15875522f8f.12.2025.07.02.03.50.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jul 2025 03:50:05 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id ED5675F920; Wed, 02 Jul 2025 11:49:56 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751453407; x=1752058207; 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=q++VT0w3BFey6U6AhyjA4yt6pGOWJ3/ulMKQuhSNA98=; b=yOIA684x3l6VLvKapzputBqtce1QnWy9/zyHSsxi2FH9Ow5gx6aqRSmVDcE/caj2MF bmSdJgWkGtQ8cYONYa6eFGkpswVVuyl2Okh9FrJSdw0yHY/ypVkUpLt3Gr/ea3ns9Zue ek1bLh+K1maTOHT57j9mXXsNYJoOUF+c5UKRLC++cYBSggaim3c/c0CcHBbz9xtbv2ia Zc3NUqMFSo5TATRi9UalflDiKlE91J2UH21Qehocj1JWOU3x9AhH2ddv+utuv61IJDhE +mD0NqAh/H6IrpoVqiWwGMSPKv2fdVeZAim8E0LnO5WSORpBpW5WWHAgxPtr68uD6M8f 7fHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751453407; x=1752058207; 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=q++VT0w3BFey6U6AhyjA4yt6pGOWJ3/ulMKQuhSNA98=; b=kNYVY08uHLzCkV2JLvMQOiOeHVKiPuCue+V4eILJPM+xtHCRp5CDXl7Jp4DuOxhbfa zAveR8lUZe72biSroD4yQ5K4NHuLo5SYTKdxBDvQVzBdGpKTfV8WBcbm3tWc0+F9eFNd FlLKCSgHV3H/voQyi32/sbzmiXXS8i723dbR6u7KgKx1I4V6DiTHHp8YVoF7wtQdjfw1 8hTk0/BB3+NjVG/U2fTRFX0r+UIXyb7VRnGusPHdP2NMiA1ERtwyN8nMQXYdnyDe0kTV S2uWw/fSd2hqtMU4pIDvXszgIEzyK297tFiuAFVUwLclB5n+KE2WekyWdIUCida0ytUy LYlw== X-Gm-Message-State: AOJu0YyYuyc4nrh33kKoSAVxxDByEOLq38XzImu6Mmc2jgmCMLjvEcjU m6Z0NPcRahgWRVgf45iw3IWfUP8RiEUGqyHW0nReEeFZNCb7yPh84qwu8NkXG/Ps5Ps= X-Gm-Gg: ASbGncvj22ggtiE4DsCLA4VYvsaFYTZVe/4I0O1xIXkhngx8ngJYzW37R1btN/VVSnm yviyQ4DVmWUh3qeVo91GoFN9eklR1DvzhlwzGcv2wMIVZJVh/S2bLIPVFQuWTvMAPKX7pu/ZrVl cjgQgYvrWdqWunIS8P4UrMrR4xDGiUGjjv/vFYuT6vvP3+Uu6/QiNGdjxsvcKR3qNLnQivvHyKm Lwjqmnl4XnJ4LChzMzakgMwFQQkKN/TmMT43torGb7ZHeBNCJQD1WGmKr9lbd1x6Duq6aECep1f YgDpQuIAd/+CiR+ooVAUI+s/+HohMHa7dCNUtewuT+aBS6tpYPL40jQi4IAJF4c= X-Google-Smtp-Source: AGHT+IHVLEGL587OfhzH6iNK19Nin8MJi0iVFaFH5SJHBg6G/0g/rQcWk0XxYtPPymc3rHzfuZWMTw== X-Received: by 2002:a05:6000:70b:b0:3a5:24a9:a5d3 with SMTP id ffacd0b85a97d-3b1fe6b70e7mr1576185f8f.17.1751453407477; Wed, 02 Jul 2025 03:50:07 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Rowan Hart , Pierrick Bouvier , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PULL 12/15] plugins: Update plugin version and add notes Date: Wed, 2 Jul 2025 11:49:52 +0100 Message-ID: <20250702104955.3778269-13-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250702104955.3778269-1-alex.bennee@linaro.org> References: <20250702104955.3778269-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751453496775116600 From: Rowan Hart This patch updates the plugin version to gate new APIs and adds notes describing what has been added. Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart Message-ID: <20250624175351.440780-9-rowanbhart@gmail.com> Signed-off-by: Alex Benn=C3=A9e Message-ID: <20250627112512.1880708-13-alex.bennee@linaro.org> diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h index 5eecdccc67..c450106af1 100644 --- a/include/qemu/qemu-plugin.h +++ b/include/qemu/qemu-plugin.h @@ -65,11 +65,18 @@ typedef uint64_t qemu_plugin_id_t; * * version 4: * - added qemu_plugin_read_memory_vaddr + * + * version 5: + * - added qemu_plugin_write_memory_vaddr + * - added qemu_plugin_read_memory_hwaddr + * - added qemu_plugin_write_memory_hwaddr + * - added qemu_plugin_write_register + * - added qemu_plugin_translate_vaddr */ =20 extern QEMU_PLUGIN_EXPORT int qemu_plugin_version; =20 -#define QEMU_PLUGIN_VERSION 4 +#define QEMU_PLUGIN_VERSION 5 =20 /** * struct qemu_info_t - system information for plugins --=20 2.47.2 From nobody Sat Nov 15 14:09:41 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1751453510; cv=none; d=zohomail.com; s=zohoarc; b=DN/I48CLzjGGu9GCJcBDZBbg4cxAeImU7t4ZO+rHYmU2iQABnDZlGjEgrT52w/t8saJGsWmb3PtwyUMC0wtPw/3bvUkQ7p7l9UXBMY2Sr28zVFXzjF8B+Lm20v6kr7x3XqXtrjYomSHQ0oZcdb5eMmqX2kRXmEZLujg5Bmj2Ue4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751453510; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=h/APTWbGW7rZ8FBTlao+ogZlUyv21mF4KMebEL0i1Uo=; b=J6m7Ht58BwzM4uN0IPAowj8de1c4hh8IRze7iVsR+SXMdpdjIWRuM5nLOHlMHSSM1VtvsZwHLZZqy0ErX+neFPmOimEZ9iTP0OwHy5OKnbC/LqmT21kw2icD0WTmq+7RaS1TFWmTedfx7UijjVZJFvZRRLhwpFygr4tBhxiz8r8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1751453510652490.76952159832194; Wed, 2 Jul 2025 03:51:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWv2h-0000GM-Fb; Wed, 02 Jul 2025 06:50: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 1uWv2f-0000En-Q0 for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:50:17 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWv2a-00034U-Qh for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:50:17 -0400 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-451dbe494d6so45357195e9.1 for ; Wed, 02 Jul 2025 03:50:12 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-453b35309casm29327895e9.1.2025.07.02.03.50.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jul 2025 03:50:06 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 0E1025F926; Wed, 02 Jul 2025 11:49:57 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751453411; x=1752058211; 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=h/APTWbGW7rZ8FBTlao+ogZlUyv21mF4KMebEL0i1Uo=; b=N82fNRHLyet3rbJ/Can7Ngy2qJp2dkQuLnGtmNqe3rhCXRkJP0eQn6zDUgaa3Rd741 d3tmOs3n4iBU6/E0sh48/ChvLlVNMjnCbxfkzP41u4UX/CpXeInh4wg6xYGPDKONI1+R kWRM5f4jVGfad/x10nInq6IguVMO04SK1PkyHKM8RVfKsBKhuykwMyK1qVQJ4jW86zp/ BtIbo2iwTq6PLP38aJLXIN+cY0nk6Jhd7ME8xGXXhH+LqoCFFrwhB9obfDvMZZr/0L57 PV7kKomM1o3Yhm3KNCJ1l/RPjbCScLPDa2OlGtBNFJoJHH5LJ0chTA0EJNYD5OsHgKga ORhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751453411; x=1752058211; 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=h/APTWbGW7rZ8FBTlao+ogZlUyv21mF4KMebEL0i1Uo=; b=fKa4/o4Em5ZqkbBw1UhsHjJcxinuwLZ6w2KKcvyivoqW+CpH3yAC7XCjOypiTgHsvE MsELuUABuoL1SOA2VStBQrMuAEM/F2usBL+7VrlTLPtfaIWmdbCzzwLdiPRF/cXWHJoK E9lw647vkXy4bu73iWq6/PI6v5xxOBRZzN99I1Hkt5SAtUcm/Gz+zfUewOu0B49Xe+Cc s0eWa+LR3ZAZE3WIR2eQfiuszmHHvyN7H/Og5/dV3tfEJYnR5pp3+Y8L0l1/wgFTFW5k smpn4vMlSsHF1IPpFUKSxfpN1WRSAq8aiH2XDOvX7D+j7twDHQOtgw6l4lM7IlLAsC+B clPw== X-Gm-Message-State: AOJu0Yx8gmf6g8i0RtoIUXMGWQEQ3QIdZgRT+VjPT9GToEPxu0yiQYH0 /VrkAD0r76AF5G6rFw+wJAuKXeTYm+WV7okpwSE+1LnMYcYWauYgYKB4Fjgi6yJ0e54= X-Gm-Gg: ASbGncu5uSaOuQpthDn6l7PRc1ok4bx17IDJOKV3Ap95pftkurLr1pVLi6kTmjsRpaD cl/1g9wC7e63EFna9J9Myf8BikXFWxV4TU1kYSF6kSKKa1iET2mypQNNsMyPqP54Sf9yzcFLIMS BQcX5p617WRr8S78PxhrO8M2+4PWNJETxf6O0dUmWw1the1rnn7GRlELdaH5Xw2XECIESk/KL4r kXPmxAQOLCCBafOpJ4Ek42ILlgZNQ2fp7V2bOupbwzspYpRR9QpWMF8JCNC/jSA4DNXy+jWwwjz 4Wumf2p1mfxFgovHrWbOW4/2gNdYQJi6R+8UYvFHTF0FvsMTFGnrJmjpfpq0vQk= X-Google-Smtp-Source: AGHT+IELRRvoVnBIi82ZAKHIbZuX3UcAh5YiEqUP2YbQBXGgK2S/mAVejazCouJnEcyINOJdCBt5jg== X-Received: by 2002:a05:600c:c096:b0:442:e109:3027 with SMTP id 5b1f17b1804b1-454a3a312a6mr17196265e9.24.1751453410837; Wed, 02 Jul 2025 03:50:10 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Markus Armbruster , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 13/15] MAINTAINERS: add myself to virtio-gpu for Odd Fixes Date: Wed, 2 Jul 2025 11:49:53 +0100 Message-ID: <20250702104955.3778269-14-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250702104955.3778269-1-alex.bennee@linaro.org> References: <20250702104955.3778269-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x334.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, T_SPF_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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751453511120116600 Seeing as I've taken a few patches to here now I might as well put myself forward to maintain virtio-gpu. I've marked it as Odd Fixes as it is not my core focus. If someone with more GPU experience comes forward we can always update again. Reviewed-by: Markus Armbruster Message-ID: <20250603110204.838117-8-alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Alex Benn=C3=A9e Message-ID: <20250627112512.1880708-14-alex.bennee@linaro.org> diff --git a/MAINTAINERS b/MAINTAINERS index 850588fb64..52f0164edf 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2684,7 +2684,8 @@ F: hw/display/ramfb*.c F: include/hw/display/ramfb.h =20 virtio-gpu -S: Orphan +M: Alex Benn=C3=A9e +S: Odd Fixes F: hw/display/virtio-gpu* F: hw/display/virtio-vga.* F: include/hw/virtio/virtio-gpu.h --=20 2.47.2 From nobody Sat Nov 15 14:09:41 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1751453495; cv=none; d=zohomail.com; s=zohoarc; b=H9SZs34y0NxbnjmP+4KMn1CJPYadGAezaE+fFKASRjEJ3T1sdNZF90LPkTKVO8MhChj6r30QXG8gaJdnbNRo65Po50Hg660h/ofTSdbOfwRupaDj06TVQvNih4DaTVBd7egRIUEcdRFMkSgk95VaQJj5nLcX1BRM2elxfUlNfz0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751453495; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=HLr3MJ/hu5ri+yIW2Higb0CF3yMxJGbnYgVNVmgIUMg=; b=Mjz3+4rnJmtq6ObY7a1qncvzjx8tb3UlnX+Q0tN1ATQ80pY7BYmWvyxwrOtrBTgOFHwO32jwnWLt+UhHN2VwVtW0xW2/zx0+xwzqj56s7/DtX1z52MXEXHH1t9E1/n9cuLaGz9r5sq2qdVm0rT3MSfs0JT4SqBiTgBGCuOt+1VA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1751453495575624.3439623019306; Wed, 2 Jul 2025 03:51:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWv2f-0000FS-VU; Wed, 02 Jul 2025 06:50: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 1uWv2c-0000AI-B7 for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:50:14 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWv2a-000343-AK for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:50:14 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-4538bc1cffdso40869775e9.0 for ; Wed, 02 Jul 2025 03:50:10 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4538a421434sm197069495e9.37.2025.07.02.03.50.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jul 2025 03:50:06 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 2375D5F930; Wed, 02 Jul 2025 11:49:57 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751453409; x=1752058209; 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=HLr3MJ/hu5ri+yIW2Higb0CF3yMxJGbnYgVNVmgIUMg=; b=fdGlJZBuY/I1zfRM8VUHZm/PFTTtespxyzHgu4ODTKAYsV4F2cxb+Tf08HOIWRd2Jk j5rxizpLsXTYGttmmG24NuYDfVvTMMctK9sQ+x8GIOLjBxyeK3904DwNdBu2AhQEPx25 LSA4H16iSmAGG6BruI+efdrFWP2Syk1XzrCj8SqMaKuwBwYJFu7e1Me29Q0SQUApfsso C7Lp+a6iggnMWO/cYJafqTTs2GT0pTlW/LrWH2md2MqRdMKzJugF6gJVQ2XtgcNiOzht FnVFz1iBlI0DiMGW0B+2xgJ9BxHocXW6Q9Vl6w3xtEedp02J8RySQwa+SHsKosdJbfT3 lpyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751453409; x=1752058209; 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=HLr3MJ/hu5ri+yIW2Higb0CF3yMxJGbnYgVNVmgIUMg=; b=S3TAw36C+FPcYY0jRbJCqYMRMju6MdvTXbL3qqNHzSxODA6a57H4B5XO24/F9/Mc9L 6D6eVYmDJxphx2s7m3SxMDtRv7R5PyrBmEAv/O4R3VbzoqAGykeZpfyE8/hQizanEYLX YK3tDcfJvsY2xIYelAmjYga+Re5zbpMdJmbhYzJeMew8TbmgmyYyWcZRsw9gNeCB9TwF w1t5Bp3FFU26TRp/kCY/bbr0NQMRV2u5d7l+7llQln/RuCeQBsjjNw5HGPvAKXoaPNNI JaZFKP2SvJAVwahYknpj4wNoPON6luG+fWLrMCIKgrNFaSxtiZrKqlLMygt1e34UDkon QrWQ== X-Gm-Message-State: AOJu0Yzv99DYbiDoAAjCZ5t1v1/7wV2VYAm+CpyGgSKoZ+GBPq1fOvfA fL/lgDOrKkdNdrJbDLM3I5TG9I236Tebn30ahEn3HKurQ7guhyiOXA8ZC9KU+1KiwSc= X-Gm-Gg: ASbGncvOhomNApyYw2RuSZtH+hFOzfgAqvpK7MEH688KuC1/4GIP5HdJYw1+06aMH3I TXAH//90rMSM6jJjp2n63SEXNRV79X/bEvQr3PJ53vw90+F8lAttOr6WZ7+yEbBqVkJQIm5KRux RYw98+vRDtfRSNr96F30yf51GGm+l3fk6GyGgHN9TymVpw8/N5IGVmFVNTQTXTPo1bhHAQ0YIHV w5TyJqL9y2UeetJ43BCag1SUGNeMblF4B3RBOK1U3CB0iljAixUnH/YQ+6MEzK0Y3yWIdHhAi9r BqydkK7GcVPj2vqNuYuhV8g2bmoxGVx2+oT0BC4j11PH8ZwN6xqXPx+hcmoen1QTu1A7FcTpkQ= = X-Google-Smtp-Source: AGHT+IFV5QZz2b/4vbp9zwoolcs4zGqIScmWHWo2keKkDQZ0sEdgKUJtI1Lgm0KD00/Rh/B+FRY8Vg== X-Received: by 2002:a05:600c:4e86:b0:453:c39:d0c6 with SMTP id 5b1f17b1804b1-454a3737eccmr20557885e9.32.1751453409352; Wed, 02 Jul 2025 03:50:09 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Akihiko Odaki , Dmitry Osipenko , Markus Armbruster , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" Subject: [PULL 14/15] MAINTAINERS: add Akihiko and Dmitry as reviewers Date: Wed, 2 Jul 2025 11:49:54 +0100 Message-ID: <20250702104955.3778269-15-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250702104955.3778269-1-alex.bennee@linaro.org> References: <20250702104955.3778269-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751453496761116600 Thanks for volunteering to help. Cc: Akihiko Odaki Cc: Dmitry Osipenko Reviewed-by: Markus Armbruster Reviewed-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Michael S. Tsirkin Message-ID: <20250603110204.838117-9-alex.bennee@linaro.org> Signed-off-by: Alex Benn=C3=A9e Message-ID: <20250627112512.1880708-15-alex.bennee@linaro.org> diff --git a/MAINTAINERS b/MAINTAINERS index 52f0164edf..3932a6e56f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2685,6 +2685,8 @@ F: include/hw/display/ramfb.h =20 virtio-gpu M: Alex Benn=C3=A9e +R: Akihiko Odaki +R: Dmitry Osipenko S: Odd Fixes F: hw/display/virtio-gpu* F: hw/display/virtio-vga.* --=20 2.47.2 From nobody Sat Nov 15 14:09:41 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1751453992; cv=none; d=zohomail.com; s=zohoarc; b=Uaj1SfSgrLPNe+/J/MdIabTxJOV9qilPLq6yoatYAleJjSsjIPhYTXEMiN+0lnH2ZAGwQ157DX2OJI57jJBt+cH9iUqFt7r99o9VtUOZoyYWFqhza42JNxPbkxdM4/jHSAiABWyZiW+v/74rM4W+lCqmODipvx3xEV5XbQnvWRk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751453992; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=AzVknBoggUzvrFjLbxqW22UiKdqh6179CfLQfmp2lsQ=; b=eSFhWrXectO/j3F7RLyJSyfbq81BPvU9wLE8qKU6pJ0Mgmpir37L7cEWZeZ96pONr6Fw66aHSI02RMdW5HpPa4wjqWDvqBpYGvSjqXdlhJPoIVvCDVaO5zjff+npiZiJlCYrPIOHkMXmJfpyM6PurS2KEi9jTk9EJ8O2l43rlHk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1751453992131792.403649751468; Wed, 2 Jul 2025 03:59:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWvAw-0001Nj-Aj; Wed, 02 Jul 2025 06:58:50 -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 1uWvAu-0001NK-UP for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:58:48 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWvAt-00056T-3z for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:58:48 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-450cf214200so35298325e9.1 for ; Wed, 02 Jul 2025 03:58:45 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-453a1914d10sm85103655e9.4.2025.07.02.03.58.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jul 2025 03:58:42 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 369135F936; Wed, 02 Jul 2025 11:49:57 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751453924; x=1752058724; 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=AzVknBoggUzvrFjLbxqW22UiKdqh6179CfLQfmp2lsQ=; b=fmkf6hDwir7WDU4V1T2YM7Mzev1yHE0+q1Kza3dFDQwi7YC+Ja1RhXjNb5btke0xEP m53nGcIOzjV+hzTLfJxCEmgDQjyb43v+MjS/sDuzG57NkcaeK+Rz96ERT/G4nSnpV1wA HiyPOAhoVpOsunOajRNJ+PJYuW/2NcoqMTKt7U4GbrLH9i0u4ljx1idMZIIT2KTJF4NO OSVVzmX4Qw8HhGTKslrYtsxyyhg6UkV+ntqZ5RGBL3chbnl5MZOFRh98yHMGffldE/kx SkUvfHP2ZrPei0ddaNjIUYu9SaDBZ86G6RbinfEMwTJaFuucBSmPI+x2EdA/JoCC9FWd Nx1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751453924; x=1752058724; 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=AzVknBoggUzvrFjLbxqW22UiKdqh6179CfLQfmp2lsQ=; b=DNC5cBo933AKizoTHjBpIRVG1k9C8KN0iVdcvWJgri2mm47jodhMmr3+LgYO3CGwUf XBnKRrOoyd/EoEAuMXCGmZ0muHYkrXmNo7ui3b+MCWWY2k41mSCZlQ4xR3qOidcC18XJ DLPPMTn95V7zIy6YAr1jimtIoGDExvBdifUUAZy+wHwgARfrel+wgxrq+lRz8NZ7NSq/ 0PKmkEoQ/NAgiaVH3U96GpXkdffXI4AIUgF4vMwgCQnWM0MyEC4QvNzDv62W+ikJFjAT aBJ9Ylk8qdWFiRjvJum8BwZyRswee22SgUt1xPa1SmkKDRYqrsuyFZlN8+y/ibNmHqUU KXFw== X-Gm-Message-State: AOJu0YzuZjhTu31VZ6RFdOaFwyVJ9Jl7aeCYTXp7360goo7dvKYNGBnT WNBLjf9Y9AfP+hFg2xr0zYIvjsPMYNZg78sLnIUDRQG1CQ8p0vmKNq3E5yIo2fpxkXs= X-Gm-Gg: ASbGncuJ1Ky7isI0VeNUfH44uQKflK8My0s34F0RCQ9/5RVQEzWf/lO1vtLwnH2Ekrk zg2xiYa/0euAVxrhITtOBLxL+YeXHeuuf/24PHtEGCMpPUBD7qEgdWZo7kdjBwqsPr2NcFatM3/ Mfn4IwL8LGqox2S7mfhgR91KWEOKQUfYX4MflAIWJG+bWSUsaTYjKIKI53KleHPgW2GTGeLUWzM WmgniOam7+KQqpnyrE/oslazBPpNXwB5TiODEZNMPzr0q3tCrebVuwFzR7jE2UEC1OnNjgn5vPA bC1r8zDimg+43Tx39qmJE7SOab9HN8mNm3SmRh79fXwEU0VeOba12devxXRRwLs= X-Google-Smtp-Source: AGHT+IH4hsey9RMBeln4M932+vNmEuXhJS1tsfEx9ImiADM/cG498BhURof73Z5fsUXBNkYfOlgIEg== X-Received: by 2002:a05:600c:c09b:b0:442:cd03:3e2 with SMTP id 5b1f17b1804b1-454a36dd959mr21034115e9.2.1751453923545; Wed, 02 Jul 2025 03:58:43 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Yiwei Zhang , qemu-stable@nongnu.org, Dmitry Osipenko , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Akihiko Odaki , "Michael S. Tsirkin" Subject: [PULL 15/15] virtio-gpu: support context init multiple timeline Date: Wed, 2 Jul 2025 11:49:55 +0100 Message-ID: <20250702104955.3778269-16-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250702104955.3778269-1-alex.bennee@linaro.org> References: <20250702104955.3778269-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32a.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751453993643116600 From: Yiwei Zhang Venus and later native contexts have their own fence context along with multiple timelines within. Fences wtih VIRTIO_GPU_FLAG_INFO_RING_IDX in the flags must be dispatched to be created on the target context. Fence signaling also has to be handled on the specific timeline within that target context. Before this change, venus fencing is completely broken if the host driver doesn't support implicit fencing with external memory objects. Frames can go backwards along with random artifacts on screen if the host driver doesn't attach an implicit fence to the render target. The symptom could be hidden by certain guest wsi backend that waits on a venus native VkFence object for the actual payload with limited present modes or under special configs. e.g. x11 mailbox or xwayland. After this change, everything related to venus fencing starts making sense. Confirmed this via guest and host side perfetto tracing. Cc: qemu-stable@nongnu.org Fixes: 94d0ea1c1928 ("virtio-gpu: Support Venus context") Signed-off-by: Yiwei Zhang Reviewed-by: Dmitry Osipenko Message-Id: <20250518152651.334115-1-zzyiwei@gmail.com> [AJB: remove version history from commit message] Tested-by: Dmitry Osipenko Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Akihiko Odaki Message-ID: <20250627112512.1880708-16-alex.bennee@linaro.org> diff --git a/hw/display/virtio-gpu-virgl.c b/hw/display/virtio-gpu-virgl.c index 145a0b3879..94ddc01f91 100644 --- a/hw/display/virtio-gpu-virgl.c +++ b/hw/display/virtio-gpu-virgl.c @@ -970,6 +970,15 @@ void virtio_gpu_virgl_process_cmd(VirtIOGPU *g, } =20 trace_virtio_gpu_fence_ctrl(cmd->cmd_hdr.fence_id, cmd->cmd_hdr.type); +#if VIRGL_VERSION_MAJOR >=3D 1 + if (cmd->cmd_hdr.flags & VIRTIO_GPU_FLAG_INFO_RING_IDX) { + virgl_renderer_context_create_fence(cmd->cmd_hdr.ctx_id, + VIRGL_RENDERER_FENCE_FLAG_MERG= EABLE, + cmd->cmd_hdr.ring_idx, + cmd->cmd_hdr.fence_id); + return; + } +#endif virgl_renderer_create_fence(cmd->cmd_hdr.fence_id, cmd->cmd_hdr.type); } =20 @@ -983,6 +992,11 @@ static void virgl_write_fence(void *opaque, uint32_t f= ence) * the guest can end up emitting fences out of order * so we should check all fenced cmds not just the first one. */ +#if VIRGL_VERSION_MAJOR >=3D 1 + if (cmd->cmd_hdr.flags & VIRTIO_GPU_FLAG_INFO_RING_IDX) { + continue; + } +#endif if (cmd->cmd_hdr.fence_id > fence) { continue; } @@ -997,6 +1011,29 @@ static void virgl_write_fence(void *opaque, uint32_t = fence) } } =20 +#if VIRGL_VERSION_MAJOR >=3D 1 +static void virgl_write_context_fence(void *opaque, uint32_t ctx_id, + uint32_t ring_idx, uint64_t fence_id= ) { + VirtIOGPU *g =3D opaque; + struct virtio_gpu_ctrl_command *cmd, *tmp; + + QTAILQ_FOREACH_SAFE(cmd, &g->fenceq, next, tmp) { + if (cmd->cmd_hdr.flags & VIRTIO_GPU_FLAG_INFO_RING_IDX && + cmd->cmd_hdr.ctx_id =3D=3D ctx_id && cmd->cmd_hdr.ring_idx =3D= =3D ring_idx && + cmd->cmd_hdr.fence_id <=3D fence_id) { + trace_virtio_gpu_fence_resp(cmd->cmd_hdr.fence_id); + virtio_gpu_ctrl_response_nodata(g, cmd, VIRTIO_GPU_RESP_OK_NOD= ATA); + QTAILQ_REMOVE(&g->fenceq, cmd, next); + g_free(cmd); + g->inflight--; + if (virtio_gpu_stats_enabled(g->parent_obj.conf)) { + trace_virtio_gpu_dec_inflight_fences(g->inflight); + } + } + } +} +#endif + static virgl_renderer_gl_context virgl_create_context(void *opaque, int scanout_idx, struct virgl_renderer_gl_ctx_param *params) @@ -1031,11 +1068,18 @@ static int virgl_make_context_current(void *opaque,= int scanout_idx, } =20 static struct virgl_renderer_callbacks virtio_gpu_3d_cbs =3D { +#if VIRGL_VERSION_MAJOR >=3D 1 + .version =3D 3, +#else .version =3D 1, +#endif .write_fence =3D virgl_write_fence, .create_gl_context =3D virgl_create_context, .destroy_gl_context =3D virgl_destroy_context, .make_current =3D virgl_make_context_current, +#if VIRGL_VERSION_MAJOR >=3D 1 + .write_context_fence =3D virgl_write_context_fence, +#endif }; =20 static void virtio_gpu_print_stats(void *opaque) --=20 2.47.2