From nobody Sat Nov 15 14:09:42 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=1751023707; cv=none; d=zohomail.com; s=zohoarc; b=CQr8miBIyExK/SMOE2C2Irmn0VIQ9Thp3MjNOWjhb1iagIOfsjd60xJ1QzlrNQxFBzOFluRdSBzshhhmFyoCV8obx3uZvRGgc2gY4rpEJrViul1ZCyBlFl9+R8QmdTc1N5/xLQbHpe5ANSI5uW2awbSZ1gcUZ24w+lKSCsU0yeA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751023707; 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=txtxvpFKqLbhHoA+0Zwk16dKiYOy0riI4nuHvojvgGs=; b=GpDgKoH7s3oG5GVYcsGhYqe2ayZwwueVy5geo3M0F3hMqNlaX7pokp9f+l3a31oVkxOs9Z2U5kXUWZt+xe0jLk6Lg0asBR+yUfHXPZVPHt139h73ssK8eKPWsvS8ZYKTUASf5SaDBXq6Y9HlQVqtC5bPCQyV0Reb+Mr3lbNgXxM= 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 1751023707976938.191018540122; Fri, 27 Jun 2025 04:28:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uV7DE-0005GJ-K0; Fri, 27 Jun 2025 07:25:44 -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 1uV7D1-00057W-7P for qemu-devel@nongnu.org; Fri, 27 Jun 2025 07:25:32 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uV7Cr-00078y-24 for qemu-devel@nongnu.org; Fri, 27 Jun 2025 07:25:23 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-4538bc1cffdso14228505e9.0 for ; Fri, 27 Jun 2025 04:25:20 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a892e5f8a0sm2478892f8f.96.2025.06.27.04.25.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Jun 2025 04:25:13 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 4616F5F860; Fri, 27 Jun 2025 12:25:12 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751023519; x=1751628319; 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=txtxvpFKqLbhHoA+0Zwk16dKiYOy0riI4nuHvojvgGs=; b=JGabJglUIZ6Ei/YISpdmEzMfk5LKZpz36KxcM2Mq8fI56aZx1pa0AcD8Y7mMBMShaQ UrumqKEZ7x3fBilT+wAkw94NPEGYz3g9MnscKkf0mbJEo0DkCPBcDqnKJvwi2LJU2Qtg i4/PrhLacGrnfsDEXU2zRxGwGkPdDWCbVgdGOGORfa5ezuBOlp0aIuvt2wH6iaHBThCv LrGTWjjyWKp8EZjW0fYDIbfJ6cvnzJzr0jd3iMQo5zBCsrApMRRNrk5vdAHZTOtWSZCr 5n9BCp3Q5VwzDjWFgJ1rTzXqXXSs3JPYAdZRZJHrR5R8hW0zCVaxVnt4B7zCAwJ8aaGD FUUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751023519; x=1751628319; 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=txtxvpFKqLbhHoA+0Zwk16dKiYOy0riI4nuHvojvgGs=; b=In69VWFg3xUofLqlpI9tZJ+P/+Eow26rzt3JbB+IZhmwUY5N6dPeiUJmRAsqamXv6J p/Wjxu4/XIt/AbuFOjq+2WXlUIxVkbp7qyMU3fljf6tdC1vtam+nUhvVV1s5QLybpPPy iAGeAuX9myjqAQ0teBSRcBSRw+dy73FlSXNg+RhQEJtTCa30ILeGYtZZMy+96NNYT6+h qjD58JxFLXhsKsDrY2LfGs7inPvbBdLO8es+wSK49D1aMUvDTLfa7EZ5DVsbFVQ32jNB kv1b4qUbI8FZNt08Zww6veMktR1hgJ307YA4LNkBd088vBwzSmimYUG7NNl1N9YZAPew 6i6g== X-Gm-Message-State: AOJu0Yz+ThaFrAixMOtf1gTr5JnR1o7JX+9uCzl42mz3z0RlbuUwX3Pg 3rWYNSkPsp52kmdduUYqoVrc/KKYVs73SthoDX767yDB+LJ5X6wBPjwyqXVG4MSdMNc= X-Gm-Gg: ASbGncsnlpW68oz9TW5q0HL4FXBd/MMqnbPBK/pn8oz5Y9Z1E8PSmyzGPOUGK7mPxoo b/Ck9C/yqH/8ggda4X52y8HaBtGbJ1445Ar2XQGUKgiFx427wHP/QRWn7FwqNNY4gIpnFSPxHgo AX6C72HbcnPTAztkbTfpLMUvDKxMok+XxtCXYDex9CoXXL7LITBBtVTqf0nuiOOrifA3r4Do+j+ Ar9legqvdZAlUmBMAlL6DSl70rmwuH/OhjcI5k6Ys05Nc+3VzuCV/TgftQ5w8l9FcylhbtbxSUr NXP/jkfFonF20OtWQ5p5HaZy4ZoN9AlnOHxniE70GFGoL7ysbmEDve/u0UncmMo= X-Google-Smtp-Source: AGHT+IEhVIm8vEHDZm6fAJOpOCs46al681NpBj7cp9gb0EZ9lFbDFa4bvgmk8nEGUiJqRym+ggXQ2g== X-Received: by 2002:a05:600c:3ba1:b0:450:d04e:22d6 with SMTP id 5b1f17b1804b1-4538ee565damr29613675e9.7.1751023519193; Fri, 27 Jun 2025 04:25:19 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Thomas Huth , qemu-arm@nongnu.org, Gustavo Romero , Dmitry Osipenko , Pierrick Bouvier , Mahmoud Mandour , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson , Paolo Bonzini , Yanan Wang , qemu-s390x@nongnu.org, Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Zhao Liu , Akihiko Odaki , Alexandre Iooss Subject: [PATCH 01/15] gitlab: mark s390x-system to allow failures Date: Fri, 27 Jun 2025 12:24:57 +0100 Message-ID: <20250627112512.1880708-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250627112512.1880708-1-alex.bennee@linaro.org> References: <20250627112512.1880708-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::32d; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32d.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: 1751023710084116600 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 --- .gitlab-ci.d/custom-runners/ubuntu-22.04-s390x.yml | 2 ++ 1 file changed, 2 insertions(+) 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:42 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=1751023692; cv=none; d=zohomail.com; s=zohoarc; b=aeNdIrG29Q4RSct2xzcJhZuMD7tcGjAPIJPjDC4QZwJ+vIzyWdFKl8jHVSMZ8LNf+ONBpKIvSRH87VZ5eZP100NaW5mO2zWfHroFYgkJhsXydMX3sO8Yb1YqjdVJMErX6w9UjkVbLyrHBIaXHzDlRS17GrB0gwDPi9+wK5iTY7M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751023692; 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=86d2/oAIEj3do6T300sHlZkco6pyNAgZUSH9/1Z5+kc=; b=GJT+cy8eaYcBlk59Qa+zTugj0OOPvpXXnsm9XTXX/r2Ln5xWXzLEnhhgANBaQbysy4ih0XnioYzFfgJzfv69p1+nx3A4f0QOhtL4DT+8KNyB8vGejeJy/FSwaL80gQWoX2suZyQ3UXldf3JgKLNL3n46h7o/pJQaQhjfEmBGLuk= 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 1751023692794485.2667733321373; Fri, 27 Jun 2025 04:28:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uV7D0-00056E-Vu; Fri, 27 Jun 2025 07:25:32 -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 1uV7Cr-00055J-7k for qemu-devel@nongnu.org; Fri, 27 Jun 2025 07:25:21 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uV7Cn-00077Y-2W for qemu-devel@nongnu.org; Fri, 27 Jun 2025 07:25:19 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-450cfb79177so11250665e9.0 for ; Fri, 27 Jun 2025 04:25:16 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4538233c4acsm76309695e9.1.2025.06.27.04.25.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Jun 2025 04:25:13 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 5E8DE5F886; Fri, 27 Jun 2025 12:25:12 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751023515; x=1751628315; 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=86d2/oAIEj3do6T300sHlZkco6pyNAgZUSH9/1Z5+kc=; b=qOgshlpv6em4iiXGxlgdhbI4+75yyk0JuJpNXj8JlRmZeot8l5HFLCmr2kLCuE6U4z x6iP3qBbb071sGpz1hRm3mVh1mtXUmTpLpJARrKcU3qSYOjzjn7KS8LJrX6Rd7GbZy+3 Y2CfM4uWYmTJPb8Th7W0iWWOXu2Yy80HISXmScevcclyh7uVn38HHrjvr+OsAZCClLaF GxIow+PansuaD1OQVLnOda8XRLgJZ6OC9kPlH8jo0JD4VexTnEszNT+yH5iLrSdLjUMf DId1G8J2leyLY2roSl/vEKlo+8Mrh0njlHY86YOeE0S16QNWuplI4kbGAnFmURVQHOa6 HZCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751023515; x=1751628315; 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=86d2/oAIEj3do6T300sHlZkco6pyNAgZUSH9/1Z5+kc=; b=jGgogUZsLj+Ta24762cCqW5jZSUZ/rA2Uq6rYMcoxU+wvjBKvaD6o1AKAEqlVufYtR eixhVjCB1Z5IJ1Q89Lzyyla4nUie34q9GfKA23mwnK3QhHL8nDB4WItUOxD2sDCUAxRc /yhdMkjINq3YknKpUL68AY5TwdiDpJSdlzGA2/4/NyvUbq98yJqnfBdpjKA4i3xFhHu/ PlLdOHq2HM0vYjkMD/Gt5OXJzXmQlbaUcDmYtkHdsizhofUqDht6PUrlu1TfCNvxufRE nRNCSztK7EQ8JJuISY7Xt4Asjz6JxBjxUHT5ZB2p8cGX5Plpg0ZXCg3LO+3PCppp+Aj7 4yaA== X-Gm-Message-State: AOJu0Yyem4KzfKFl0C4VHFSXKaDvppchEPRzxML3vgcFv+pAkrHC+8W7 UjzRDddC/3dNUVtwUj4YTJ3QpzHySOL0Ojpc9wyi7wtBwlBW4Wpn7fhrMN68sCVb96U= X-Gm-Gg: ASbGncuYzgE41tpzHAKXQgMQ78ZY5ah2unDp0GsAmFdTWO4JbxO1xsZrI/ctsWQx+J9 ptaNYhG4VAPwqUU8N6yUpiyXY/3XfEe/dPV+DgM88j28ip4lPu1fstcqMsCXRMntnfQ8IkR7wK/ A4Wsw8SnHhsUMjv6nnP5VzwO7ha7xn9G+La5pKGn4WFauh/OKf0qDRK10qCztaEtCTWCzFmgTfe XP3WffAa/tQiPGR8UcFyRWskesr+10F2dB916ZqxinbEmsJF+VAeGXSy0m2M0ANFPVpqkaCUeL8 WGsjo1XtULZF8aYvGfwjhUFamc5xYSWAJC9C86KStptHvqhgHePgxZp/YFhy7WFv5mr4rfUEpA= = X-Google-Smtp-Source: AGHT+IEW7UfHRVV7hKr54Lu4wdWzV+vFYwQox+EmqzSVp16j86D/AAIb3NiiVIqbbFHvgR8aj/UKmA== X-Received: by 2002:a05:600c:1d1a:b0:43c:fffc:7886 with SMTP id 5b1f17b1804b1-4538ee341afmr30891915e9.8.1751023514995; Fri, 27 Jun 2025 04:25:14 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Thomas Huth , qemu-arm@nongnu.org, Gustavo Romero , Dmitry Osipenko , Pierrick Bouvier , Mahmoud Mandour , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson , Paolo Bonzini , Yanan Wang , qemu-s390x@nongnu.org, Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Zhao Liu , Akihiko Odaki , Alexandre Iooss , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Subject: [PATCH 02/15] tests/functional: Add PCI hotplug test for aarch64 Date: Fri, 27 Jun 2025 12:24:58 +0100 Message-ID: <20250627112512.1880708-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250627112512.1880708-1-alex.bennee@linaro.org> References: <20250627112512.1880708-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::32b; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32b.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: 1751023696121116600 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 to keep checkpatch happy] Signed-off-by: Alex Benn=C3=A9e --- MAINTAINERS | 6 ++ tests/functional/meson.build | 1 + tests/functional/test_aarch64_hotplug_pci.py | 71 ++++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100755 tests/functional/test_aarch64_hotplug_pci.py diff --git a/MAINTAINERS b/MAINTAINERS index 27f4fe3f25..0a7c7f3770 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2082,6 +2082,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..25e40702b0 --- /dev/null +++ b/tests/functional/test_aarch64_hotplug_pci.py @@ -0,0 +1,71 @@ +#!/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') + self.vm.add_args('-cpu', 'cortex-a57') + self.vm.add_args('-append', + 'console=3DttyAMA0,115200 init=3D/bin/sh') + self.vm.add_args('-device', + 'pcie-root-port,bus=3Dpcie.0,chassis=3D1,slot=3D1= ,id=3Dpcie.1') + self.vm.add_args('-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 -l /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 -l /sys/class/net | wc -l', + '3') + + self.vm.cmd('device_del', id=3D'na') + exec_command_and_wait_for_pattern(self, + 'ls -l /sys/class/net | wc -l', + '2') + +if __name__ =3D=3D '__main__': + LinuxKernelTest.main() --=20 2.47.2 From nobody Sat Nov 15 14:09:42 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=1751023690; cv=none; d=zohomail.com; s=zohoarc; b=V24s4XRoi9CKoTYF0HYE9q0KeTAxR3DXkgTYS0Z4yZd3QQjb7iwvDMz2RVKnUqo3jZzZy9jLKtQWNMaePbnd8g9Ic2t+9jJbVITRyuO67ktXrF4WhqMCJmBkWwdpxf31KdlEcSuCnmNX11vxidSldQvnPSScOdoBl4RpNQy5TWQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751023690; 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=mFEb0bgv+2xGk9RmgZr4IJS3shLJx45QACChrHbJL0M=; b=Ncj4olbyhicdgFLZRfnJW7e8A2/I9QTsaXWoWz9enEMFcGzPpgOvr5a2El7gSXZdUI/RcQekcy8OckquezVnsy7KkWGK6fZeko+v3zRKL5GqYhXUgJnC8E2xnu1XTAmqgUWFq5N+NhYGie0M+yVN5I33oO7vMq/d+gUqY++luSo= 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 1751023690531115.20840930293798; Fri, 27 Jun 2025 04:28:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uV7DA-0005Aq-1z; Fri, 27 Jun 2025 07:25:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uV7Cr-00055L-9c for qemu-devel@nongnu.org; Fri, 27 Jun 2025 07:25:21 -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 1uV7Cn-00077t-NU for qemu-devel@nongnu.org; Fri, 27 Jun 2025 07:25:20 -0400 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-453608ed113so19764705e9.0 for ; Fri, 27 Jun 2025 04:25:17 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4538233c05csm77901285e9.5.2025.06.27.04.25.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Jun 2025 04:25:13 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 751FF5F889; Fri, 27 Jun 2025 12:25:12 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751023516; x=1751628316; 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=mFEb0bgv+2xGk9RmgZr4IJS3shLJx45QACChrHbJL0M=; b=JOv372kwf2xa92OfsjghTIAVDLabUBGLM42/hVfNqCtly8QJknYfCu4y2qbqRvD9x9 JpsTj/n6vvYjbKSOitCauX5tcYIzFZcLYEYFMoP2ZKzbw0VNaAyL1VCeU0njg+bdAUT3 k4odB6xPga9wgbTbDsvowEgNpopF0seDXhIwl4v2USXGnnUV8j3UbLahlbBbaBnf3ziW ydKIIZnK7eeCYWEW21Xxgu2ToVcFGRhtuiLZLbgTPDeGxP0LVfK0ZkCIwj08kjheWuB1 9EOLQsGEFIngeMQVuJYbDOw+OQn+AR8LuTMpkdvFj5lKyedIGdCXUQ68ChFNq/TS9s6l FiFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751023516; x=1751628316; 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=mFEb0bgv+2xGk9RmgZr4IJS3shLJx45QACChrHbJL0M=; b=Xf074khXjekaweDdaIVSFYpvD4Rfy86Y8okQZ0thJ6U8zP1rMt88iEFwrJDMPermBA FWBVvW7WiO3+//cKhfUUC7V1j43S1LnKNgIV/SEG5UqYxCHrnHMUwiER7t2PoG3jxAEh JxaFR/rDeXxolHjFCNXFwcjHJGMILpFYP8V/URRBOhcjpNHc4sofMo5PbCvFUvOB+Mzd hJg/8zDEAGxHiWnEXoORYitYBw3tbVOc2J8QZq/6LgjkC1OozOlMgx3hWS+cZKa9lJR1 hTg1vE0LtaO3wtPU8eckY5afNA+xlc5B83nXHTXTUmLdqk6X/Cgikl1XFaZYt4iIG023 Or4A== X-Gm-Message-State: AOJu0Yx+B1kBNfeBr1R0x0P6PMwufhPG0e6zFFtK2Nc836veOp1i1yf3 h4L2eumEbkn7quBPQyVxNasjmiSWk+KtPfVFLPCaj3awChBbnrCJheZsvBagCqFIgaI= X-Gm-Gg: ASbGncvfvZWjud8gIv20KohmdN2RNra20XddYjJZrxgt1gvk4e6CZyp8bbAoXIvRmwN ORmzcFHeShij5WPcnNRtznkSZA4d8OSkpMQ4FdFzoACeXPYmHeGhcZa8+GwcUSIuwEvXvhdG0PN dCh3W/I6vUuC4/PA9gz0hgaWUHBfSC9YBK9eOPBa3l4+XCXr9Kf+bJexH4BxaCykMEDe1nWEyOq Gf0+pcdMGk8onQY/Tf+M0ExB/mge6y93fLCq0NyioVJFfLPPHZwiFyI5vXqjJRpciHRdSHtlheD p+qtt3Hq1DPG2huD+clJwndTADGkHBHWfDe5eQNLKykkfKImD8GKNek+sHJleeQ= X-Google-Smtp-Source: AGHT+IESrMLOsO5v3Ll5bK0aV/YoVRqfvxfhpHS1NaRSAZ0R+zDjtml+XHBKyVWnq4JZ5pe3xhIIjw== X-Received: by 2002:a05:600c:1551:b0:450:cd25:e68f with SMTP id 5b1f17b1804b1-45390ac9011mr19595025e9.27.1751023515990; Fri, 27 Jun 2025 04:25:15 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Thomas Huth , qemu-arm@nongnu.org, Gustavo Romero , Dmitry Osipenko , Pierrick Bouvier , Mahmoud Mandour , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson , Paolo Bonzini , Yanan Wang , qemu-s390x@nongnu.org, Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Zhao Liu , Akihiko Odaki , Alexandre Iooss Subject: [PATCH 03/15] semihosting/uaccess: Remove uses of target_ulong type Date: Fri, 27 Jun 2025 12:24:59 +0100 Message-ID: <20250627112512.1880708-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250627112512.1880708-1-alex.bennee@linaro.org> References: <20250627112512.1880708-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, 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: 1751023692158116600 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 --- include/semihosting/uaccess.h | 12 ++++++------ semihosting/uaccess.c | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) 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:42 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=1751023709; cv=none; d=zohomail.com; s=zohoarc; b=jwF23XfDwHR2WNgTLdb9gebWR6EcA9fe3Ltom8yCd5+1qoVgUHj21+KxeVEpBSscv7Opwv3yQr//HQ0ae1J1ZijaUn4ivsg2/CiKehs2RBVv/pxy2UuDF95EmPtGIIaJE9qXSWC8D+R0/ZUC4c5umWE2VwcPRKxkJOCz98ZOXOs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751023709; 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=WJ9vXif3F4yHPbQYFiWo9MlpC4/NuUiREDS+hdYGJLY=; b=QnuYBCh3M9qJ7WPQdQFQTMyh0PzrzPzl/T/weJGu7p6RPhxEhiFtq5canmHewLiFcBFlgC09hvCNAg7+IlYplqWZc/CnCKB39Tl0WytolQvIDX8PZCCsHpN1GFBOEzQS6UWC44zshMQsGe4QHhHtBE9TKP4Lp1tq1jiA7Lstk0Q= 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 1751023709952634.8166282411383; Fri, 27 Jun 2025 04:28:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uV7DI-0005Jm-BX; Fri, 27 Jun 2025 07:25:48 -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 1uV7D1-00057Y-90 for qemu-devel@nongnu.org; Fri, 27 Jun 2025 07:25:32 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uV7Ct-00079b-Dk for qemu-devel@nongnu.org; Fri, 27 Jun 2025 07:25:25 -0400 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-3a6f2c6715fso2151772f8f.1 for ; Fri, 27 Jun 2025 04:25:21 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4538a4064b1sm48585015e9.29.2025.06.27.04.25.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Jun 2025 04:25:13 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 8B0BB5F8A6; Fri, 27 Jun 2025 12:25:12 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751023521; x=1751628321; 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=WJ9vXif3F4yHPbQYFiWo9MlpC4/NuUiREDS+hdYGJLY=; b=GKbQHWVs/QazYmv2cHG8gWbXN0/a/awKwUtgSD5Jxb9SssuPp2y4leBVdU6otxJUfq 8UZtu9XJ2o9qAPIy8RHyskPJ4jkCFje4g5T7+LJS+baeAzdDiieO82IYHlCkm1FVebhq GgEob7PIr9KgtW08Mqwn3Kt9N+04kA5GJ9mlL5FeAHlMs7cE6HvFx5NAXE0vTv4HROSU TFo9Fstt0D9CTZiipofLnEFEezTMkPu3SV6f+9Rhe/xCMxWvMaxcII6hVO31zNT7bVKq 7Ft0s7xY6ARbCUTGQUohDKOfsEpooWADDw76GdTv1k8pwGTNvS7gW+9ptsgqYSOkj5sB WBDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751023521; x=1751628321; 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=WJ9vXif3F4yHPbQYFiWo9MlpC4/NuUiREDS+hdYGJLY=; b=RE6sr7A8Wt5F+HySle0zvvgM52CO1iwyWaglHAR5JrkzSPZUeP4geqdv5x3VDh+DUU 09yIoF25SC625Qa+m5OwBY7rhu4eGtCG0FRUIIBcbpYS392TNvlPqRjU6pVB9gS7dPra Fjrtq7/8iSdtrNGAtdpQIAZ15JpiudJR4EO5tBPs0gisktE51THPZimrvyFGpH6GduKW 3uxv8lnlmR9dT6eisK6D6fNhuJV/9Hz9ofnJ84H65OMJpCmgwj8SgNESj1f1KfxMEq16 qgvGye9vvEBFDIoCRZjinQAiMfKDGtBbbTqtcWQTzKPEeX6LcSDh+cpvjVIzEsEWdA1G uTNQ== X-Gm-Message-State: AOJu0YzFWDazWtn4HpOgUPq7Ynsz9T5DrlID5XQzRKPgJXxVRTf0A6Fg YML3m5BTSJAwhshLXRJOCdxKqz50Vv5NlXyF5segaRUFgR18BNTSTrUQZ/sD8kavPr8= X-Gm-Gg: ASbGncuCrF3+58+6wD6FMoj9XWNjW3duzXV6/PCuFehlQQotNpO/5U6rrYROd7/24tn LQBA5z8NLZYqzI4etZhG5Y7d84e7eTYY1qUuQhYQbbdRQd/PajCNpTKgJeMHxcxDHJEGHUhA9iO pARVcGS3JOBifCuQ7vWIVqdBMjAMni+mjl0tvtmrQVd8NFhIRcglcMAAleERQI9V1+LNmx5I7P0 nCfZiO/ZG4Zn1p0CrxPyoosOeww/pYgW2gbWPFuJIGt7+X9OUa4Av73e7kql5ISFt8X313lSt5+ S3j7SZjVwM92xp9D675xnzvDARZrVGyRivbdWoIgppnketkI0b/N0kAVwA/v4gk= X-Google-Smtp-Source: AGHT+IGpXIpA4o2V1BK5q1lSKmxi5IbHRiOUfpiLFIH3/7TocXRRkBigzXG2Nn5prABUYaAtgIcopg== X-Received: by 2002:adf:cc13:0:b0:3a4:cfbf:519b with SMTP id ffacd0b85a97d-3a8fe5b32f2mr2196411f8f.44.1751023520611; Fri, 27 Jun 2025 04:25:20 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Thomas Huth , qemu-arm@nongnu.org, Gustavo Romero , Dmitry Osipenko , Pierrick Bouvier , Mahmoud Mandour , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson , Paolo Bonzini , Yanan Wang , qemu-s390x@nongnu.org, Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Zhao Liu , Akihiko Odaki , Alexandre Iooss Subject: [PATCH 04/15] semihosting/uaccess: Compile once Date: Fri, 27 Jun 2025 12:25:00 +0100 Message-ID: <20250627112512.1880708-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250627112512.1880708-1-alex.bennee@linaro.org> References: <20250627112512.1880708-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::42e; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, TVD_SPACE_RATIO=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: 1751023712006116600 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 --- semihosting/meson.build | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) 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:42 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=1751023700; cv=none; d=zohomail.com; s=zohoarc; b=aZ7eBcfEXNaqio4Lzx5ONjWiHRgbbdzPT1qCY8Pu3y+hVmH1KmOMaKvYz9U8lZjA20XjTiZ/zic1lCjmaRTYRpWR51NTd64rXzrhu6NT4iC4cAE8itrIz52Bg4c1xBOcTxOlRo9Yke0UcDRb3AHQmZWX/8/mLktiOLy6SgqulCI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751023700; 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=lgYISCMNkEKe+zFhK94dOEi+d176X9PjgGsBtgsVHM8=; b=KK0PA7UaW0FAXhZrC06SjSJolqJEd/eqLTpe+w9DDAWS4gHjV/h/Ur5acUAz9BZByKMyuCFIivvHzqK9A1NBdpo8FG+pJBWDDXsAzN5MPKz3fH8TamzlyHw52rOcMJri1vR8KQQhnuyRxRVdg3IoORcXt0gWPBBwSREnHEymJ7s= 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 17510237007181005.3098966365499; Fri, 27 Jun 2025 04:28:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uV7DD-0005FS-DM; Fri, 27 Jun 2025 07:25:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uV7D3-00057i-1b for qemu-devel@nongnu.org; Fri, 27 Jun 2025 07:25:37 -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 1uV7Cy-0007AC-R7 for qemu-devel@nongnu.org; Fri, 27 Jun 2025 07:25:32 -0400 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-3a4e742dc97so2055632f8f.0 for ; Fri, 27 Jun 2025 04:25:23 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a88c7e7814sm2422975f8f.8.2025.06.27.04.25.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Jun 2025 04:25:20 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id A21055F8B4; Fri, 27 Jun 2025 12:25:12 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751023522; x=1751628322; 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=lgYISCMNkEKe+zFhK94dOEi+d176X9PjgGsBtgsVHM8=; b=scZdlMiorYjIKz8MMTTbGIsq5f9voyELCEQeKE7ibCqiFxaXvnWuCS0l1AScEzSX5s mYwYenSUMYU4e87gKs0sK6ykAP/PEaeCFkIUydhzBNPM3ja+B/XCGvBP3wduolUZcaau oiSQR/uoBBBDANSHROQAZI5mWDz2EgiUqxkk2v0FqOEi8ZCYk6hyJJxTb0m2f5Jzhwhr j+XzDw494FH8p8Ex9Uoqs2q3jmRytSihzGLqjOkYGRwZGvRDV3CAgkrqEoCFvrZ62tKH k5pU/KY5Uxs2RNQizecqds1SWZKf0m+OAkI2cnTTQ3uzutrRiJgfi/e0XRl4/OZpAzml 6DYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751023522; x=1751628322; 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=lgYISCMNkEKe+zFhK94dOEi+d176X9PjgGsBtgsVHM8=; b=PKBv7ORnnnALtiuCG9Fbbu0pFdA+wlZi0u6r3yo5tX+Shzoypqg1pg/S2yrA9CLOBi c9tyAZ0VNmO3wPV+4tUdB/UKluMEVTvtJy8UIyRavmltPKmf0oghsLOkw3jKuLzBsFVQ /ULbft8JeD36vHffU358jiOYJcB9OioI3pzIZQSzv/0zs06LYEdlViyCLOyobWd9Gnx+ iGVk1B/OWhl4qjGdtOqnhDY7oOegr935WmeZSf2hfMjFICdR1EQ7pj6BpiHNQDVTKsKQ 3WEtqKVJOeeEiqPsM99um/S0W04Ou7i7/x9g6un/2+wy+RisJNMri7+AaghZbRS2OlVP 4UVA== X-Gm-Message-State: AOJu0YzX1eMFjZHdJF8SpUh3VNXXuUVCUdEToDM5CibDYoNU+qIeYYaM rraINQYR5kw5DpJSZC0nl9t8//eRg8kLBF/Qnnd+exU5UNQMm9GOQIWQSF83sMgVe2s= X-Gm-Gg: ASbGncsgkaJuCPQDNajS2k2IQ5P3iqlpNMirfkF4xsgwHglGK1zHy4wMHIEEwINh+tT Epy7sFg2v4TncIDmuZrSjDQ9dz0RsEubYIl9buDB6r01jWXTHZNmRA1acUv6dcQ+b/d/HyGS+p+ B6VLqavqGWJm2pVun1BB0dw1QcSmolEgIYr4N3e+jIvo//+av8LFiEWId5C3Mvs1YyZ8G3ufKhS VEwQs5J8tY+1GTyr5XllRTdxi7Rw6W3thX9EpIqPtILavcrnN426iZ/gIU7ZVnunbn8nVfbM9dT a0lFRSg8YmCaGoKSwVr4RVJNThj7X7MenaYaUhgbLna47pLQ5W7iKKSAa3jzLfw= X-Google-Smtp-Source: AGHT+IG1Yuizh7/5aajRPTyMcg43l/o7mD/5p8sVsb0rISmy/JFghhmmKS1N4AcSorRkdKAEzcJhpw== X-Received: by 2002:a05:6000:4411:b0:3a4:ce5c:5e8d with SMTP id ffacd0b85a97d-3a6f3152d16mr4125037f8f.20.1751023522420; Fri, 27 Jun 2025 04:25:22 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Thomas Huth , qemu-arm@nongnu.org, Gustavo Romero , Dmitry Osipenko , Pierrick Bouvier , Mahmoud Mandour , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson , Paolo Bonzini , Yanan Wang , qemu-s390x@nongnu.org, Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Zhao Liu , Akihiko Odaki , Alexandre Iooss , Rowan Hart , Julian Ganz Subject: [PATCH 05/15] gdbstub: Expose gdb_write_register function to consumers of gdbstub Date: Fri, 27 Jun 2025 12:25:01 +0100 Message-ID: <20250627112512.1880708-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250627112512.1880708-1-alex.bennee@linaro.org> References: <20250627112512.1880708-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: 1751023702013116600 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 --- include/exec/gdbstub.h | 14 ++++++++++++++ gdbstub/gdbstub.c | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) 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:42 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=1751023638; cv=none; d=zohomail.com; s=zohoarc; b=IDrQxCbWB62FU/AjpigwTa8kW4iakdyMA1SD1u0PHfrAYSNwIjXbwqvolKZb5oAhsPSiYkvnYvMflbADUCzci1mecy0iO6hpdC6OnUXKDVpg5epVTdPpuEPptjlgBPCnrc8Ox+PsGvPs8RYWVAWFOKU3Dcp7CEKLDp4ONOn21h8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751023638; 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=dfOydpti8CfNqtv6LkyLcOid8mAdomf3DMhRbN7UIJc=; b=KYKQqRBiLBW1Hmf+IfR9MVetXBH9fWqrVRlAQrMEji56RQw18Fn9+ZHl3naS6/dxvgMOe4U4Lj4BX7q36QjWYqZw1fGoppNTcO3dejfxHQ5Ixoll+Ji6ZMZSRJcn1aMr69CkvEtzcIoyXlNjb9k12z9wJr15pEXKh1yvkD1K+Jw= 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 1751023638156930.9887709460224; Fri, 27 Jun 2025 04:27:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uV7DL-0005Lx-OP; Fri, 27 Jun 2025 07:25:51 -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 1uV7D8-00059N-Rc for qemu-devel@nongnu.org; Fri, 27 Jun 2025 07:25:38 -0400 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uV7D2-0007CK-Na for qemu-devel@nongnu.org; Fri, 27 Jun 2025 07:25:37 -0400 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-3a4e742dc97so2055698f8f.0 for ; Fri, 27 Jun 2025 04:25:30 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a88c7fadf3sm2503596f8f.34.2025.06.27.04.25.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Jun 2025 04:25:20 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id BAD645F8BF; Fri, 27 Jun 2025 12:25:12 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751023529; x=1751628329; 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=dfOydpti8CfNqtv6LkyLcOid8mAdomf3DMhRbN7UIJc=; b=rLq6Icx/uK9YYGmldgyn9GCjCjgOB9cYGdJ3i6gFDsGn6x4ar/uf9clsqeWgjUKhBZ mBApW/LAJIMg+RMBEOR0OxzjunEpgNhDa5JNi2uuYfJAHjeeR6vpyebF1ib/+CEKQYHQ Cl6JWV0sKsx2eb0B6DI53/YiaIdgZcxhcfV5RmWYzpsJYhbrZ3zBpiH0vwXoHSiUBFII ZHTfRP60rt3+sGBBaHUfpgjxlhoDnMn4h3gAhtoVR8jm3rSNxVNbehSvg4Fk4LOAzXku mS/K5UJb60vPLqFbdCbyWJgFP5D+VBM73h6BA80TwwyUidkBbI2taGNu74gi175WSeWD 6k9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751023529; x=1751628329; 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=dfOydpti8CfNqtv6LkyLcOid8mAdomf3DMhRbN7UIJc=; b=UCkmwx6/HvE2zhiKSxX5fSwEWCJ3hpbO47n9lSXig+d5YmiNysjnvrC9lBPFgRs7IJ QxBlUS6/haPcX2NglCSpLPtULHmAx0yNX/RqmPFb38/nnjZ3l+P49ss3/rTKCyNJJNqK OT0XS0ubaqcRT2f23Z/iiUBYJTSCp9kLSBup7ui4i1KkDpcV5A8CQiJiwKUsCeTQHLzN Y8B91n/vNBUAqWRlIYRa3VHmh6YFIyLChh7LnoGGF+Yhr8D7f+AvfxEr4VdfYj33kKZX ENtQes5JOJ6at6GHSDjQTBSfrrvc7qElHMpzyT0S2FgV1w5QkYXJb5YWWL0512UJdtHH TGAA== X-Gm-Message-State: AOJu0YxE07lRMsqYIMaKIkbTcmZuBKE5Dnm1SmcgpeQPMkJheFsxTeXC Zgmz6YmqllBgcjpEfL6/RhTeL+62lrSv9h+PjKVs1mWlMRI/MMAaw+YqLNUbkj+La0o= X-Gm-Gg: ASbGncu27umlibvKvukla1pAcwJNptFum9PqhqocKd80esxKWBTIlN8RdFJ9wqtwERs voIt6J96ChQtzLhsTY4FYoBK9n1vWnUTwk5qXPeQXe9Tv70lTQKZTp7f0a5PcUCXnE+AFblHCTh 9HxIHr8ThvSJR1QQms7GRyEAlpnwSX/+pCXuFWPYTVLxiVNIfIDYpI3FueXtPfaeUbAAPLWeCs/ eJAVIZM5J3kwvx79G1BDD0yxVQD+yhGm+6HDFzHdO8Sk9Kd3APLySS7779VEeY7Qn2K5diAms/n mrtHAkFmT2V4zD1lTgRtRZQC/dbokMLC4iIOHLXu+RgBzQ/RDObLZSndMe63DD4= X-Google-Smtp-Source: AGHT+IFjBZvWRw8+uqQSHaxseQCWp6n8WgnqxYEoFR44hjTbWjnXoLmHeSXgdqZgMV9lBehu2F+sKA== X-Received: by 2002:a05:6000:4b0f:b0:3a5:281b:9fac with SMTP id ffacd0b85a97d-3a98b53f51emr2145050f8f.17.1751023529172; Fri, 27 Jun 2025 04:25:29 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Thomas Huth , qemu-arm@nongnu.org, Gustavo Romero , Dmitry Osipenko , Pierrick Bouvier , Mahmoud Mandour , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson , Paolo Bonzini , Yanan Wang , qemu-s390x@nongnu.org, Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Zhao Liu , Akihiko Odaki , Alexandre Iooss , Rowan Hart Subject: [PATCH 06/15] plugins: Add register write API Date: Fri, 27 Jun 2025 12:25:02 +0100 Message-ID: <20250627112512.1880708-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250627112512.1880708-1-alex.bennee@linaro.org> References: <20250627112512.1880708-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::42b; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751023639857116600 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 --- include/qemu/qemu-plugin.h | 54 ++++++++++++++++++++++++++------------ plugins/api.c | 26 +++++++++++++----- 2 files changed, 56 insertions(+), 24 deletions(-) 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:42 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=1751023689; cv=none; d=zohomail.com; s=zohoarc; b=C1XyBwRV6wVZSHRmWSdUeqJbMQR54a0tt0epdmLgtxxB4173lXAJjoWt8A61jKFmLIbDEMKfMMEU4V8uMJp2arspORQIII/RoRnIeb4VGVZBQ6EdhnT6c5nNYDmlITFhImJKtyWj2siGmKlzP81cbCI+F1/9Uw3kM1UWYkHrKtM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751023689; 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=SCusHnwa5nyO0S9XWtp+XWe3x2oagRSltZx4MHeSZR8=; b=MC5H7OHina29S/qfH4l+oU2+lnmF/0fG5S2Nz6K/kGLWObJL63aFLta6AXJzR4JbOmLfkJb+GmIxFRG3/S/Q+MVpci4XqCsMrwUnYaDUsRqiZCxJBWV+sqfzU8y/OqPPIOY+M66ezJovpU5nQV8CA4UdpuccY0qGh2Nf5wqx9zE= 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 1751023684742613.5882241822693; Fri, 27 Jun 2025 04:28:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uV7DG-0005I6-HB; Fri, 27 Jun 2025 07:25:46 -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 1uV7D5-00057u-En for qemu-devel@nongnu.org; Fri, 27 Jun 2025 07:25:38 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uV7D0-0007BJ-Si for qemu-devel@nongnu.org; Fri, 27 Jun 2025 07:25:34 -0400 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-3a50956e5d3so1593540f8f.1 for ; Fri, 27 Jun 2025 04:25:26 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a892e61f48sm2453487f8f.93.2025.06.27.04.25.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Jun 2025 04:25:20 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id D89315F905; Fri, 27 Jun 2025 12:25:12 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751023526; x=1751628326; 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=SCusHnwa5nyO0S9XWtp+XWe3x2oagRSltZx4MHeSZR8=; b=Ru/X+lKjYaUfZP8Z9jfXP6vE/psYsZl1dMeoxh4yw8Ct0bS6qwCpRHV5xQn59Q8ZM/ NKZs6nu+N++/lnjxsOw7bjsOcByqEX/wywVXSbwKGmDvbWhp5R14k2gp2JFWduRGLhiL fL/GNO+07PNwLxsCt1cmKiUTILzuhQmgtq1wrmv4Z8QvLpyAPqDJjVlN9lHT+C78J/s3 cPP2xMQJB1d/LHYQ5FkNO6XgHkiI8H0d9MWKfFi7f4HU1w9GgBN6xky8yESCBw6W0iSl LpwfRZcVIdcYRFaKR71fgfwMfycqpprmJ8T8WQ8G5jaUjsrQt9Ltn6+E9p/75ZDTfYd1 EUMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751023526; x=1751628326; 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=SCusHnwa5nyO0S9XWtp+XWe3x2oagRSltZx4MHeSZR8=; b=i3vPGDtKPLfUU7+w3wArrjCQU8oP59xJFGB/06Kr1e5QEb8ImRD0skZJfgVu4Mgb8f U5z7BDqoVW6C7MX5nwWJcxgbVeF0IHgouOJ6iRRMuN2Q8qvHfvnsm36Y+0XjbCkBvFRb 5IHg6xxp3bT++uuFMbKX9xDOulXKLmkteAUdqDeXYEQsQoyS+BYaCb+sQTqfY3dB5/fY UIZTxdMV+y3GY/NOI7Q5Y1mqADovy0WTcUfSYAVwU6eEVVkRZKJTBfKfNgX7MBC85s81 ROXT4HjODXOkvvvpD3l3g/ZzMapS099CAscwWQy1T5j8xTlTJyBcAI9X46mcfd4fwYSL X3CQ== X-Gm-Message-State: AOJu0Yyvr7/aLxc0l9As3wi+STIp4vQa5FG/Qhn+KkOK1gOp/GfHZFWd iQ6N0wTmR7k3KdE1+stUXjpu0hGtvuzZUmUB5UM62u242jcigE3wi4CXsUUxccmpnBo= X-Gm-Gg: ASbGncv2vfXmVn+Uw4feXwR9a+7t/mt7RCvyNLn9Yu0ywez7ISTE/HaoKIT/rf3QFRf Cb8gD4zU3QU4Y4m32/LhLemO1Hr7DQDkA1p93HgqBFHkonix1zxMx2U79/N1kLJ4EmwjyeUaDAw lOKW5d6thFj4upjlrpfYlepT4FzxN9RkYGBP/t9aVkPntkh0VASl6innDeg1ngOq3wXt8aZUl6f WsbbKAJuyltn/W8UrytcjzZiBem2TUzGz+oIsPWGhqoEuZV0Wi9gUk6La2I7/Sqp+GPT6t+uLA2 lzWwJok5N23xFCWJcnTFauZ0smOeqaDVaUO0Q5D9MD1jm+SCvel0e/CRuyK1DOo= X-Google-Smtp-Source: AGHT+IGEHdt98fdtykwxRxmpVJtvN0F7VHMmf49Klm7Iu+75UYmMWmh0N0xP8AleJerxaJXhMRVzzg== X-Received: by 2002:adf:fb82:0:b0:3a5:2923:8006 with SMTP id ffacd0b85a97d-3a90da747e9mr2110173f8f.25.1751023525711; Fri, 27 Jun 2025 04:25:25 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Thomas Huth , qemu-arm@nongnu.org, Gustavo Romero , Dmitry Osipenko , Pierrick Bouvier , Mahmoud Mandour , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson , Paolo Bonzini , Yanan Wang , qemu-s390x@nongnu.org, Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Zhao Liu , Akihiko Odaki , Alexandre Iooss , Rowan Hart Subject: [PATCH 07/15] plugins: Add enforcement of QEMU_PLUGIN_CB flags in register R/W callbacks Date: Fri, 27 Jun 2025 12:25:03 +0100 Message-ID: <20250627112512.1880708-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250627112512.1880708-1-alex.bennee@linaro.org> References: <20250627112512.1880708-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::42e; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751023692413116600 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 --- include/hw/core/cpu.h | 1 + include/qemu/plugin.h | 15 +++++++++++++++ include/qemu/qemu-plugin.h | 19 +++++++++++++------ accel/tcg/plugin-gen.c | 30 ++++++++++++++++++++++++++++++ plugins/api.c | 4 ++++ plugins/core.c | 33 +++++++++++++++++++++++++++++++++ 6 files changed, 96 insertions(+), 6 deletions(-) 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:42 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=1751023711; cv=none; d=zohomail.com; s=zohoarc; b=kKUNnz3zBFZvPUwHYMD28p83JuUh16oax2rOB14jncJ79Do83R6lhNccOdjDP8UOKzZTVZPuGOW2jDazFoAf04DPm/TRuWyK0V2i51twW9n1mBqY2ZTOHH4/VaMXrYLjXZ87Qf1q8juAt6D1IF7Gs3QcBRBoWhhSc2eBhSPzfYU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751023711; 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=r3YHCH9Vx9jwaVt/qjrhR+H7QrQ05OqcT22Iq4fVf7E=; b=RZ5GTXYaG1FJoGUL6VqteNe4AL2KccWjduGY3mh+u1W3nCf0euNxwVaL00HDrXEQ+O96qqFi9DIg/dCXgFuaqK2MzNKTSUULhqDDxRUGK5wb8NFpVtHP7iuM6gsJHgHbFZlsuJtv1HmoAUGU5p09UJFPYijWAbD/J30uqGjWX0U= 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 1751023711111297.99810883587054; Fri, 27 Jun 2025 04:28:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uV7DM-0005Ne-U0; Fri, 27 Jun 2025 07:25:52 -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 1uV7D8-00059H-SL for qemu-devel@nongnu.org; Fri, 27 Jun 2025 07:25:38 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uV7D1-0007C2-9K for qemu-devel@nongnu.org; Fri, 27 Jun 2025 07:25:37 -0400 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-3a522224582so993537f8f.3 for ; Fri, 27 Jun 2025 04:25:29 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4538233c749sm79308685e9.4.2025.06.27.04.25.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Jun 2025 04:25:20 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id F1D245F90B; Fri, 27 Jun 2025 12:25:12 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751023528; x=1751628328; 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=r3YHCH9Vx9jwaVt/qjrhR+H7QrQ05OqcT22Iq4fVf7E=; b=lJRc+Nx0P9y5CKGoBCi2jaXlzy9OBnvbQJsd4HYQ5l7h/bt2A4qM6vKmyVMLBPRw+3 V70BoJzE+uuwgh+jmvya0GJJK/pV2638RHN9CLUbN2Omw0suuZGiqFKtYMfcabb924W5 vKdiR4hEfFqkiIMfpmBrdS44dTnhzEAY0bCZqFVvkVhzNGFmdmPef9kX0rrK5igIs0Oc HRqy89J++YWEkewAu9RjW//t5SXIdoQlpovQvzr+aDn+UacT2WaRYV0nD9cXzlwLRR2N PJmNoYiWF6JEIJkRwiOg6ByjUGjlw7T2Pd3WeGxFhsfyjzSF07swmVTkZkbt+/e+A+Zy apNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751023528; x=1751628328; 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=r3YHCH9Vx9jwaVt/qjrhR+H7QrQ05OqcT22Iq4fVf7E=; b=GnvlcIS8AH7aq6Cv56c43QPcPisltw4KOAmBKRV6pFvpcdAu1TiNBm7jtX0RRtnOz8 CzKh1WJ+3G8CA2cuSuHxGhMuI6L2SNG1m6e1CC9b3N7E+lfPDdz61puBAq/vwmgyvOjm gRhHI4VJWtzhrdRSbcXUgnZs/nlGWD3U9bCdfOb1TIikfOoNGaQNrKC0dnISHQmkv5Jl XiYQpDyF7wnzuemKdbsGevTLuMptxc9frhW0/IDZH+lxrMElULJrAfbO//ONpFKItlpm 9toWpi8blN4EBbvs3QonCofrtpOrxd3HFlit0xR2VypxvjCpabQ1uu5O2++hLQq5cIyJ UgOg== X-Gm-Message-State: AOJu0YxAzxFs7p73C7SYCQr5sgAv39UkI4bAwIb3LD7CYCMY8E+FVWT4 7atoQzT5UdYtDvnTJEufewWrBjBGyNVHjEIllRujt8njFj/aamhO0YxZDoX8BpKAuD8= X-Gm-Gg: ASbGncuWMkDkdI/1uzhX+NBqmqjqb7/6auxcPb0SDtRO9drNmW2chB4BJkxXNTo8EPU Xv1sNPilgYzQm1YOe07sNQd05RVhaMb0xZtKRRkyS0VY+Vrki7JWo4GetfAfAjTxVzvpwM9fMra lmbZoFcHitiEW9Rq+nGVo/UB8dpzwbyeiA6W0ljpWfHARnvEyeKr1MiNEIZBbSYkvj2hrZ3WvkL +IambRI29Jq8wa16BdKfOBkwxnmiWDAGYtOXh0L6bw4UmXMVOAN0BIJg/7URu8YaYU0A4c/K40R 8GXtVJ73M6aldl26CdLRoche4fVs8WZuXKbjQ44NqN+G8jzGY+z4orVd9ME0PlU= X-Google-Smtp-Source: AGHT+IFa/ZXjmAHipUOjWD9OCrgHu9incO6kwvMWapD8dJJoXjz8oEhqlrh0ke3sYxDBetA4CtG82w== X-Received: by 2002:adf:ae02:0:b0:3a4:ed10:c14 with SMTP id ffacd0b85a97d-3a8fdff4355mr2084975f8f.14.1751023528271; Fri, 27 Jun 2025 04:25:28 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Thomas Huth , qemu-arm@nongnu.org, Gustavo Romero , Dmitry Osipenko , Pierrick Bouvier , Mahmoud Mandour , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson , Paolo Bonzini , Yanan Wang , qemu-s390x@nongnu.org, Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Zhao Liu , Akihiko Odaki , Alexandre Iooss , Rowan Hart Subject: [PATCH 08/15] plugins: Add memory virtual address write API Date: Fri, 27 Jun 2025 12:25:04 +0100 Message-ID: <20250627112512.1880708-9-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250627112512.1880708-1-alex.bennee@linaro.org> References: <20250627112512.1880708-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::430; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x430.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: 1751023712077116600 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 --- include/qemu/qemu-plugin.h | 21 +++++++++++++++++++++ plugins/api.c | 18 ++++++++++++++++++ 2 files changed, 39 insertions(+) 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:42 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=1751023710; cv=none; d=zohomail.com; s=zohoarc; b=YS3M+RKgO3NkXWSFsg5S6iiQ8bVml94Vd9o4QclIyvRNDZHnZ+iYWuSgrTFlhCOaiTvChCtLtwbLUZs3aYy7CzKJ3IMGIDzCjzu0zbDWAUQAKVtkKV1EhV3B1m0DQ1XsvMuz7VWH/TXAlemamUiyi08aQKHq7iUM5H1DkJA2vgU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751023710; 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=vROHPevQAjKQjmyvEQacY79ixj69L9SYFGqLI9RnS08=; b=Hjz1I7kSsfkwMoxXFHCw+XR9YhcCSdkWzpCW6I3zls9ojOdcMMFNQvIgcZXIso35Vp0ZRbvE0/F0hbk/5plAAdaqhbq9ZE7akIJzD+rCuGkg5M6X+bJRODNBTcpvNefnEltbIV/aFtsscKoNYXCuCVqOtO5Y+6gNyDvQa0OJLxw= 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 1751023710661657.8840007670967; Fri, 27 Jun 2025 04:28:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uV7DH-0005Ic-1A; Fri, 27 Jun 2025 07:25:47 -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 1uV7DB-0005DL-Ca for qemu-devel@nongnu.org; Fri, 27 Jun 2025 07:25:42 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uV7D4-0007Bu-4m for qemu-devel@nongnu.org; Fri, 27 Jun 2025 07:25:41 -0400 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-3a575a988f9so1224445f8f.0 for ; Fri, 27 Jun 2025 04:25:28 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a892e5f923sm2375104f8f.89.2025.06.27.04.25.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Jun 2025 04:25:20 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 141715F90D; Fri, 27 Jun 2025 12:25:13 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751023528; x=1751628328; 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=vROHPevQAjKQjmyvEQacY79ixj69L9SYFGqLI9RnS08=; b=h4aMOEA45hUtTpoE2tzQyHG7ytHYV81rVliLkLmIhBNQLWe7PoRU95B00CenKXCSP1 j+O0lRFe8vAyeVDUrkwQmp+yiGznBn6+HxDhY8ovTYtkOnpDT0qK5+1EePRQfwHIoPd0 i4R9oIi0FzUU4Blr2fT617bUEtVdmFWM3EodA7km/M3x9jOD94DUpz0S/z7P5JT2PRXE SLWOa5Zxefld+b8obZ5zQCvkbWpp8ZyytK5PNlLJaDHQJVXWaOa/WFquQdPqkJueaYOG q6/I4M6vya1X2V0xD5mJoGsAnQEYZpBAUSMy1IDIugcf3VZVMDx2yhyxixuIYojUxQxu t3RQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751023528; x=1751628328; 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=vROHPevQAjKQjmyvEQacY79ixj69L9SYFGqLI9RnS08=; b=Vzh9NmJqsg09ddzDJK9iW0J8CscY69F+M4/8jas13D/u7feZ8PDAQPvYFj6AxQ8zXN Lrgb+ZcE3CCncghYWE2eaB940LDlYg8Hi23DyklntH/vH64H+yrFB3Te7VsuAYWTWBHI Rl0iMzS8Qb4CvgM7Kq63fh4Gpd2aF148EIyWjbkZ8KyZPASziRzZ8VFDBUvmmYqfGRxv gCW9yCV5C/78BRl5ljC+AmBiASv8AYyE5v6NkXs9473qhkuN3DFh51VCcVt6Foh0/dfi BGBT3TiR8ysJOV2gKyTZgA9dSxKOwiUuapW0LYKh8iFpjG23Dritt/Q8CKZXMUQKtxIr QK+A== X-Gm-Message-State: AOJu0YwAgjNadiBc3iRGBf+UwG2zba/77gIXB6FMWIaL7nLqkgSuMrdf wjo/+mFvvTJmNGu77ho5fCUvW/NSv3ELbaaSOL+00W3jWOwzX++lfVc7RJvAc+8Avd8= X-Gm-Gg: ASbGncvdzHUhUZd3bNSOPO51VGRanVZ1HB6ZeROKKpJuLPmIcBreUoXS3IhXxi4wEyg fHE9CRc2CvVNG5pnknj5WfUq6/YHDJU6/nnZMUN/he8uV0E/RojMCmJIHxFKg+Qz1xNFUbg9RsZ fDshh7s2NVGsR/VsJ5XXJS7MkYUuHEsxxuPqY4PmC21TP5PFEwo8Nhsr2vbFZ7yh66OmNP5BIJY y+czCnIYRKkTHVFdQf4eiDObZt/pBOkVgaQASW9vlomVZQQTNmOQhlvQr4OasCUXBwxzHdmnjIu mydfmO4x3uTwYExdb6k0YGe4vpLZCFPIGmvcjB1HQvZrUCOX5zDdMgLRfcbI/ew= X-Google-Smtp-Source: AGHT+IEwAfzzqBy7KuhNDa32EnUVIIAT2vi+TZdLoLd8lRBCG6hZAaH6DNZ48SNGDzgaUV8usSCQkg== X-Received: by 2002:a05:6000:4105:b0:3a4:e665:ca5 with SMTP id ffacd0b85a97d-3a8fe89162dmr2206265f8f.23.1751023527484; Fri, 27 Jun 2025 04:25:27 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Thomas Huth , qemu-arm@nongnu.org, Gustavo Romero , Dmitry Osipenko , Pierrick Bouvier , Mahmoud Mandour , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson , Paolo Bonzini , Yanan Wang , qemu-s390x@nongnu.org, Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Zhao Liu , Akihiko Odaki , Alexandre Iooss , Rowan Hart Subject: [PATCH 09/15] plugins: Add memory hardware address read/write API Date: Fri, 27 Jun 2025 12:25:05 +0100 Message-ID: <20250627112512.1880708-10-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250627112512.1880708-1-alex.bennee@linaro.org> References: <20250627112512.1880708-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::431; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x431.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=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: 1751023712307116600 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 --- include/qemu/qemu-plugin.h | 93 ++++++++++++++++++++++++++++++++++++ plugins/api.c | 97 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 190 insertions(+) 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:42 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=1751023696; cv=none; d=zohomail.com; s=zohoarc; b=I5IUe/XYWVIfV4v4dr7I7j5rNiJJSkqKlKNDA1qGI9ZUd9CG2+cW1uqsjd9aRH1u44OGMmKuASEtmmfiKXTuSfb1/8f6s9vtvtjYDCeEpGmRMG7BmbkLSJbrLrETW5t+ZIiOnFKqAsWjy/MPT3ym4SwAbLzMrYc+V1RO7wCPsRQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751023696; 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=BRCrBeKLrs8DsS30KgrrqkaRkYENH2zMrIYSsPDQKi0=; b=UnWd2e3dnk7wLmNI8SQLE5/jtkaEGNdCQix5+GHnlSdYTr1BmgdnL6zA3y9z/yZUhsYaddQ7WyJTRDqXDV6QINB1JKDcpOln7+iTqeNnl7KuO0EHBQWhFmoTCx1k8/ukqReEHhkQ9tT9a8HRFX8MkEWrT8VnI8AxI4E9QDoJ4RU= 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 1751023696596712.5009078484507; Fri, 27 Jun 2025 04:28:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uV7DH-0005JA-HU; Fri, 27 Jun 2025 07:25:47 -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 1uV7DA-0005BW-B6 for qemu-devel@nongnu.org; Fri, 27 Jun 2025 07:25:40 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uV7D3-0007B4-Rs for qemu-devel@nongnu.org; Fri, 27 Jun 2025 07:25:39 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-453749af004so11383345e9.1 for ; Fri, 27 Jun 2025 04:25:25 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4538234be76sm77763245e9.15.2025.06.27.04.25.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Jun 2025 04:25:20 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 2B7E25F913; Fri, 27 Jun 2025 12:25:13 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751023525; x=1751628325; 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=BRCrBeKLrs8DsS30KgrrqkaRkYENH2zMrIYSsPDQKi0=; b=X50slnXsQtsAIsrq33EZcVAKQsWbujSp4B8VY4YcCcSa9564p4PTll+YLlJdJ2wbk0 BsJSWi25hqncaKXXyRi9mC1Y1hgcLpTGQKFEA2UiTECQNdPhRGEpIsi+CJNBaAspn4iJ 0+vPl/rfrqS+puJfujVwt2TgzNN0Uq+ntRnbivR48IxZi1j2dZ9B69LQazguCrCcxfrB h74uQkt+oSZJioXlqtyWc1GfJLrSgWlFNvMMzTXTfUJpjBFabys5j3gWOIwmJabModUW NhPDHCr5n8mP2xWuGLpqDC1w2yfnk0fO74FHid6B+b1ORMERSq0HTdsaT+stP2tYktVp DiXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751023525; x=1751628325; 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=BRCrBeKLrs8DsS30KgrrqkaRkYENH2zMrIYSsPDQKi0=; b=kj8iSpePVyGdUdGJIvpXuP0222A9dRAFQ6UZg0BFRcscDkGIyg80JMPC7j2V9zVMMw cauRhKWEAECAJBYy/qGXYSJFipgvSL1u75rzqUMxCKuEPK0WM6sopeeK/wfArMkQ5VY9 5v7pXOnItyj/4vmfgmDjXPRJ6X6J5fYmwD+PeU69w5BSlPHXVDkfr3NpzOr0/DOwnwjF ipexFNNlNf9kvHiHb/bEyaq42qvLQ6hgSTq+NgMKbhjHVDZjI+1YpvcIIvj8KX1Hmfwx KMDRZdYwZZU38qVHdsIe4MIECF326Mf5GfeIO5HHuAeEA2nBdCIxBpc4k1CZHrH+Tpd5 UaLw== X-Gm-Message-State: AOJu0YxzvW/jBIqXawsZSgUpX9c54yAn80noIdeLNMra6Zvw/rbsNHmV FqWun4TfGgKM/kvLDuoVWhIw5WOKnPMU9bmQuKPaxWO1NU/I0Sw+LRByCKoHJnwy+DQ= X-Gm-Gg: ASbGncumDVAVGLfZgfZ+6/nHL99RbjCXc/5cwYVWXRD8bi+3IkqvyEK5Ppcxn/2xJPe aSiMHuyJIg5qXbynGidNy9ScrLWbkXBWhK2LyG6/9ecYboeZQiguie6kLXH1kgH3/3ygBbmhECo UTYJrBpepM8YpJxwPkxfwxNeh1JsoJErUh6QWRNy1T46zBsnKFEgSGWVYng8BUl2AmUGyTMF1MF 2xrdU8O/Pc8RW4lE+2zP1vNlxG5D9omcjOdZWISGDF3UFzPbI8SQ6/CQuB2WKM9r4BvGMJcQPt4 Bnu5+s8PrUXSmsRudfqv+h+fEtwDbqIbmiinl69KtgeuAAH5Tc8xpOR3zgvCEVg= X-Google-Smtp-Source: AGHT+IFsoDlXQ2vIPAeoXJy4Ak1cL8SMceB4RlWERijQA67NOup5sudUbHmzEHitJXLDFSz2PoMBgQ== X-Received: by 2002:a05:600c:3ba2:b0:441:b00d:e9d1 with SMTP id 5b1f17b1804b1-4538ee15a09mr36800335e9.2.1751023524809; Fri, 27 Jun 2025 04:25:24 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Thomas Huth , qemu-arm@nongnu.org, Gustavo Romero , Dmitry Osipenko , Pierrick Bouvier , Mahmoud Mandour , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson , Paolo Bonzini , Yanan Wang , qemu-s390x@nongnu.org, Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Zhao Liu , Akihiko Odaki , Alexandre Iooss , Rowan Hart Subject: [PATCH 10/15] tests/tcg: Remove copy-pasted notes and from i386 and add x86_64 system tests to tests Date: Fri, 27 Jun 2025 12:25:06 +0100 Message-ID: <20250627112512.1880708-11-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250627112512.1880708-1-alex.bennee@linaro.org> References: <20250627112512.1880708-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::32f; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32f.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: 1751023697950116600 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 --- tests/tcg/x86_64/Makefile.softmmu-target | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) 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:42 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=1751023610; cv=none; d=zohomail.com; s=zohoarc; b=Y3zFhmsrgIlUiKTOFjJgB+6McgmF9grDW566ew/XBa5dzih46oWK4alAi9JAXCYJY5QavU/aV6vjSoSlE80CLXj+OuZJ5j8E8ScZnAPl4w4W6U1Bn6kumUNSiT0Q++Z9AEz19H4w1J2zmDKF2SdBQRriBedNnxhhHWZfAgf4k9A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751023610; 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=J6UmG/qOpQ+wr6fHJ9f8B6S5TAjmqDK30lDqng/ncfc=; b=IuW/FksPhlFwvkl0I0xJ/Crtrs1hcUKnU2qYBQxvvef3hShIoHCjsE9HT7g2xAEpBSSC0pzUInCG06ZbQVk2qOaCJ0MfuoXn/tUTKcRuNY0L9NJ++AFV22Nf5AfS4SOeaOwFrl98kIJPJh7xCfQjVBV3rUwRHRO9FS2ixpJbZHU= 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 175102361076127.413030489850485; Fri, 27 Jun 2025 04:26:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uV7DO-0005On-0N; Fri, 27 Jun 2025 07:25:54 -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 1uV7DB-0005Dc-Qy for qemu-devel@nongnu.org; Fri, 27 Jun 2025 07:25:42 -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 1uV7D4-0007DW-47 for qemu-devel@nongnu.org; Fri, 27 Jun 2025 07:25:41 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-453398e90e9so14751175e9.1 for ; Fri, 27 Jun 2025 04:25:32 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a88c800eaasm2489362f8f.37.2025.06.27.04.25.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Jun 2025 04:25:20 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 4CB6F5F914; Fri, 27 Jun 2025 12:25:13 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751023531; x=1751628331; 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=J6UmG/qOpQ+wr6fHJ9f8B6S5TAjmqDK30lDqng/ncfc=; b=UNjD4iGxtC5mZP9SqmI6aIXLPUkUcAmbqOgo864J6z96vjJ4Xj5tI/CfVbjQHDnw6z 6LR+avtJQaJYRApjLOvtpRaMMhKcMGNLx/WnwlKga5XqrlMFITwlGY3iwXIBBNDfFcli ilkHFtG8ffX1aUH4w2q/qf/ccz7/qTuyojhD05KVPOSYGZVVPprCtOeI2b+FAurZ4b+a IClkilreIigPsfrA5KVsmzMhfZlEjJck5d8PM11dl99zSZsLvfJLAEliDCTKFgu3cFSZ MiH7Hl6gxUFQ0PsRb6UENHDR4tQhT9idzqkC4go6U5XXG0fUFVEYGe00mW+Ifb596DeZ 6V5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751023531; x=1751628331; 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=J6UmG/qOpQ+wr6fHJ9f8B6S5TAjmqDK30lDqng/ncfc=; b=fNk8YashJLT7sXscOV5EKaLF04Ut8FGhatMN5Y3ZyQRa46R1Yy2oyS5qEo0+Mbhwc1 sC2b679torPfs+vZVE8/ff9CRE8fVBijvOdEdvfXzmVQsK+ZeFW2UOWA9exvfmdQNsNi IY/g6jeyHykuawVnu8es0E4MMummqNP+dtImtWn63UNrlfFqFMpDOSlgqZuR2nDRpAVz Rp88PDYgg0Rcz7SMisSIat4lNThI+1FlWpDW2PNHpsGbYoEmdvKi+eCuc0mzIk6Jchh0 9mcz3T3NtlT8lypfKMWWkzibV3X6SSJ+kPVqCWWnPOgMeLiD0vPAKVtUxxoAYJoTKemi +iFA== X-Gm-Message-State: AOJu0Yy8dinFtIoIUJadW4+YiXN6dVAhneH9pdq8JTdmP7ACAv9xsAsd JW8X0loW+DNU8je1qYH9rFNvsh9GlI6U8LPNBs+JD5MHmAoJUKNUbX2KlnjLYaR8uPM= X-Gm-Gg: ASbGncuIrIB6K3GpJLVySxuChg68FCgY5Le/sD1BNNuD0zKlruTkrMocPXhov0rKS1n jK9fIM3R0jUWAkBQJtJZwslDzASbP9L9McZ91cMgLQcElQVNuJQMBd33slPxIOIe/AOi62qP4/Q mnFHoY+RAONS1HXST9GvNKQutTZhZejhHBxTeezE4kUOp5KUuu1/MD71TG9VA5BwF1B4v5lLuLi WQ2jny4oVttkOt6xTRmjEAIpuADFFvibfdxOs/gfq+QBBomcD3RV/CQDXkJpzF4CrT1nK7YR7/+ 7t5CmGK7asfmVkD4zP/iughiiIQkszIWLNsrVlsHTpg4Z7HFW3siCVxToB3qI64= X-Google-Smtp-Source: AGHT+IH52oYny8bIzT97ubxSqX6q3JJ3jR+zRLAz207VK/d6uf3VquB537sEhM9gKizGFL93PY0uuA== X-Received: by 2002:a05:600c:34c8:b0:450:d012:df85 with SMTP id 5b1f17b1804b1-4538ee607edmr30762215e9.18.1751023531437; Fri, 27 Jun 2025 04:25:31 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Thomas Huth , qemu-arm@nongnu.org, Gustavo Romero , Dmitry Osipenko , Pierrick Bouvier , Mahmoud Mandour , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson , Paolo Bonzini , Yanan Wang , qemu-s390x@nongnu.org, Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Zhao Liu , Akihiko Odaki , Alexandre Iooss , Rowan Hart Subject: [PATCH 11/15] plugins: Add patcher plugin and test Date: Fri, 27 Jun 2025 12:25:07 +0100 Message-ID: <20250627112512.1880708-12-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250627112512.1880708-1-alex.bennee@linaro.org> References: <20250627112512.1880708-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=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: 1751023614293116600 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 --- tests/tcg/plugins/patch.c | 251 ++++++++++++++++++++++ tests/tcg/x86_64/system/patch-target.c | 22 ++ tests/tcg/Makefile.target | 7 +- tests/tcg/plugins/meson.build | 2 +- tests/tcg/x86_64/Makefile.softmmu-target | 9 + tests/tcg/x86_64/system/validate-patch.py | 39 ++++ 6 files changed, 328 insertions(+), 2 deletions(-) create mode 100644 tests/tcg/plugins/patch.c create mode 100644 tests/tcg/x86_64/system/patch-target.c create mode 100755 tests/tcg/x86_64/system/validate-patch.py 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:42 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=1751023641; cv=none; d=zohomail.com; s=zohoarc; b=PZKysLE9BjI0Sx5el29WSN9/dCAQqF2w3zxKp/0w0eqGY94C0j/OLkwmoI4zuC40KcF8r9xyBLTcmPieUypBwg/KrekAYEEJUUYlJ86zNDja+Rn/2xTiuXX5McPXE4eck2fmL21zynhm5zhYEIziA6ERBR4prZaTsi9OewTpy6E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751023641; 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=4Pd1RtgwCrG+l//FG3lAy5+Wn22Yz3H9EAA5DA65uK0=; b=jnV6RjSI0NquDMxcA7wfhTy17XMF3VhdVFRyYfc+WPwV4QZliWZ9bQe3T8XIndVZ14I4LpaJjjJ/yWtvAyFXWUSuTCamcxATgL0aUK7mHHdFf6aSqS3Og1VGvQaE096hlU6cjIDCbsm+rrnqufkoW+eO/ipXT2q7EDlOX8ieqTU= 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 1751023641767664.2353022265447; Fri, 27 Jun 2025 04:27:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uV7DJ-0005K9-Fh; Fri, 27 Jun 2025 07:25:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uV7DB-0005Dd-Sa for qemu-devel@nongnu.org; Fri, 27 Jun 2025 07:25:42 -0400 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uV7D4-0007BW-4b for qemu-devel@nongnu.org; Fri, 27 Jun 2025 07:25:41 -0400 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-451ebd3d149so11134335e9.2 for ; Fri, 27 Jun 2025 04:25:27 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a88c7e7524sm2482131f8f.12.2025.06.27.04.25.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Jun 2025 04:25:20 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 659D55F915; Fri, 27 Jun 2025 12:25:13 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751023527; x=1751628327; 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=4Pd1RtgwCrG+l//FG3lAy5+Wn22Yz3H9EAA5DA65uK0=; b=ndlTQTV7pNvgpQmt9BolABFa5rbXZI/z7qBPJxCSmywGijwQRgrXYnQp1LTNSq69Ji jWFd5isZcNwNrjhjHEWavUVCxlnl0mHgQsJPVd4qI/uMFfUDrV1UnHdwTJSy/Cj36MXP SFOKVhXaNif7NI9XBOFdPwHQlK7xTMmeUbT0CUx2pnAxnZuELOJwSh2SqP2r6yTOvVlQ aLVvDrdIodrUMpn4rJ6rLnohWvtqL1JNlmKTAQkG1h6yDjaNVPDOOMX48lciZQUjc38E U3qC2UmgrUBxdqbrIdNCn0giZ6seI7EkbN2fCc5Z9VLX+BCGSjv3nidlasf3jbMsZq9C ot9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751023527; x=1751628327; 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=4Pd1RtgwCrG+l//FG3lAy5+Wn22Yz3H9EAA5DA65uK0=; b=JCiB40vgKKyG9erjsL/W6eJn59DcXFnXj18CahsKeLD2mxeXiUB5i3UiP+3td7pmzk 3XsBqhBfigt2ayaoIlQyhm2FvVhT9ajbbphGs7OrV1/MRTeufA1laQlaVRig+J8Mpg5f vy77Ae8xgFJP3Czj8G9jNabuoZQUGni7GmdyqBICGfSAgzEGQ+pZdQTaz+Y3RAJR3Pgw 3629DfnUe8EA3RXuZ45zHC6m36Vsedu2Wdmv33VQPnzFL3HJ8VSupLeXj2BZ83YJUTS6 bgNaGDw1RV6W5ATnZ2Z8PQ1aEueSlSKQ4zWc5gL6fZD1bfs/RVtPPZehOtQU/CSE5Fa2 1p/Q== X-Gm-Message-State: AOJu0YyyA4ixN9nwt3DY9SkHxYpZvoOKC/0NxOf8nyMPWjCm8ScgAg+K dJbpGjAkorn6ESevg8pMyCKkL4KEr+Itc3Dmb4reL0nhSJQbdja9SOYYUIamFcfe8qg= X-Gm-Gg: ASbGncu695XLfboSNH25oMdHrmHbl244YCS7I6sAykmMhHIJKNIZx1P0EmfpTjw2oBS Mxe1qA5fSQXSa+YGNfXxVpiWFAXSg+r2lVXyeZBXsQthNZKw8VqPJvtbz6mDTV6n3KygWduDjfm TK/13jNgx+hEjC0MDUz8qQ83aRFmObpXVbLaT0jMHxReUCEACL84CilCJ05DvHMPmwObFDrswlP wiscmVd5rLDcxTadMJ/ny1b1e4AHlQp/VLSSMzvS8uGk4Lg5VsmHYml1DELtgiFwUgSR9UBWpmy EzSnToz5cDhgDucfKx0WK29Hja+f1HEB9KOuGtjQ5B7rdRx8zYnXWVJsZLUvg+A= X-Google-Smtp-Source: AGHT+IGI50QcJFlh3SbYPz0r/5GDHEhZSYpu/0k6p5YxZZZqqIN3/4FtwsI0M+Seu9z8EvJ7TCJNDg== X-Received: by 2002:a05:6000:196a:b0:3a4:f975:30f7 with SMTP id ffacd0b85a97d-3a900854644mr2640802f8f.56.1751023526698; Fri, 27 Jun 2025 04:25:26 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Thomas Huth , qemu-arm@nongnu.org, Gustavo Romero , Dmitry Osipenko , Pierrick Bouvier , Mahmoud Mandour , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson , Paolo Bonzini , Yanan Wang , qemu-s390x@nongnu.org, Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Zhao Liu , Akihiko Odaki , Alexandre Iooss , Rowan Hart Subject: [PATCH 12/15] plugins: Update plugin version and add notes Date: Fri, 27 Jun 2025 12:25:08 +0100 Message-ID: <20250627112512.1880708-13-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250627112512.1880708-1-alex.bennee@linaro.org> References: <20250627112512.1880708-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::32d; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32d.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: 1751023643746116600 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 --- include/qemu/qemu-plugin.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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:42 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=1751023696; cv=none; d=zohomail.com; s=zohoarc; b=k40VcmnrTjEMvDBLq2XhwRpwxFtbgN+SPgPouTSqFos0dm3ufBkGE5p15z7OK2OC673J6/4jl6Ybi7timQYlI7EI4/uKf0rWGj6oGV0E/NVlE8hXw6nzqs4ufr5kgMoms/LUVDiZxSFzhEjyYPykrjm2slNoxrrdYVjOYgnk2QQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751023696; 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=BidNnNLM1rUcFeA/dLJqRUtobHsgBklQOV2aV4NWhB0=; b=XeBqzBivGXiiPYIi781vkQcusU8W2KOrIZEsmw1ddvrC/FNdSmi0rvJhidy2AQ4/1CfgTTZ45pUBuc2BcMzk2o+5MZaf1Y80rTMsBy+r3pHyVm+56YQSl/LnEsOgmvBOSrS7Op5qQbnJnUDkabIUcnk5TgE4h1h4lOnFfYMUmqA= 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 1751023696602141.12708734910416; Fri, 27 Jun 2025 04:28:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uV7DL-0005LA-7B; Fri, 27 Jun 2025 07:25:51 -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 1uV7DD-0005F2-52 for qemu-devel@nongnu.org; Fri, 27 Jun 2025 07:25:43 -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 1uV7D6-0007Ek-LZ for qemu-devel@nongnu.org; Fri, 27 Jun 2025 07:25:42 -0400 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-3a52874d593so1637024f8f.0 for ; Fri, 27 Jun 2025 04:25:36 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45380d0f15esm69791405e9.1.2025.06.27.04.25.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Jun 2025 04:25:31 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 7C3C05F91C; Fri, 27 Jun 2025 12:25:13 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751023535; x=1751628335; 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=BidNnNLM1rUcFeA/dLJqRUtobHsgBklQOV2aV4NWhB0=; b=ZdgwYgkRipXAVAO0+3u952iR3sCnwqcGXcebw07XhK0OTfEEIA8JzvHGHUSMKaYIW6 RWjY/e+Jr41QIbB3LuOW+VcL0m01Jj+NV2pNqRwDnsz4Vq16FgBDr3lQ7+dD52JwnCne 5/szRgK8HLW5+lg0ycpUACxBMayjEkLC+7xxNDi3c+R/eV14tnVjeKR8ig1yO5dmjpe3 dME7RHCJAQq+7klgQG3l1kXeRJUOREwrX2wUOJaDIVMGD2WOPWfyjzKereHdnTcSB1cR MmE8s++kML/AGrA+JkkOe0HTwEzGUgLYcfSIOL7890hq4pjBFkQ8fSk0bQUvZyAMLZ0Q h2eQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751023535; x=1751628335; 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=BidNnNLM1rUcFeA/dLJqRUtobHsgBklQOV2aV4NWhB0=; b=mjYKJXOksBQXo2HfTp4WhH9M/5h2S6tGKvE+FtycToAIv9ozX0R0jZhD4pKbUnBPpA xeHNWDTMjl9WNHAQ0hwy8leQQF72xeBsXP6hUf9OLz6kI1RDYW4TD+HQ8EaqXXUQ+pIp KcJOC+ydLYpCkMMbtTZwebXL1mth2Tb8YrRLWx0cCHr4/5wY3L9aLtmxk+EyvmnQ2Lcz NnJ8G/1VjOggdeWB+lk5iMSnFL2kcqd34RyYsdm3/1+fii3stYkvhoJYJ1mUVq+WQ2F4 LPJOffWGIEKBKvVUQgSTdODlVAHWkiIMWooTLwKUcy0Wn1kikN1ZrVE/FVrp1EYkhSSn rWnA== X-Gm-Message-State: AOJu0Yzin+u1LBXagXpP4HGexbSi1wRf+LI9sUbWebeRk2JnKkERuf3N K/S3dmJX3eY38xilwVM6e3i+FYseln6Tou+9c+1bkMrBiM2mcWNdI3q+q2zFty4kz8Q= X-Gm-Gg: ASbGnctY829d0yxHtHWXeWJ7W7+m26sA4sMj1bfZPA4x4kuHyprJ4ZhC68yyqKo/LDn fG1HN5Knf6/NF/+SxJMsb8zK/vRyNapiqTbwloUBwYhGGJzTBpYW8StbBrRDWwxw7yiP3837HB0 W0gc+6V+u2Oo52Mws4txTusmjwfggZyfvO1gr6ZsDkSxeEbrBcPrfsduWkTyUkQeRr5OJhowboT CBv6xkqZwRfkFmM+EyL5SsrljBlCqIqunuEHzVuxtrFjJCu7bTK3pRZIQndJJbPVDvt4HkJ3J+4 Y3kQs5XJHjMT+XEhvHQJC0/T2oJxjrr432GsN6WAvrikHQqFG39WCOG8G9x1hCApjGgjQUUebg= = X-Google-Smtp-Source: AGHT+IGeZTzgPMyLh7NTsJQ2mZLboaEbGrxlWVe/A2OfF8W6yTae6W9vF4shOu0P8w8F6eQPrRJW9w== X-Received: by 2002:a5d:64e3:0:b0:3a4:f52f:d4a3 with SMTP id ffacd0b85a97d-3a8fed705ffmr2997155f8f.28.1751023534979; Fri, 27 Jun 2025 04:25:34 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Thomas Huth , qemu-arm@nongnu.org, Gustavo Romero , Dmitry Osipenko , Pierrick Bouvier , Mahmoud Mandour , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson , Paolo Bonzini , Yanan Wang , qemu-s390x@nongnu.org, Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Zhao Liu , Akihiko Odaki , Alexandre Iooss , Markus Armbruster Subject: [PATCH 13/15] MAINTAINERS: add myself to virtio-gpu for Odd Fixes Date: Fri, 27 Jun 2025 12:25:09 +0100 Message-ID: <20250627112512.1880708-14-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250627112512.1880708-1-alex.bennee@linaro.org> References: <20250627112512.1880708-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: 1751023697891116600 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 Signed-off-by: Alex Benn=C3=A9e Message-ID: <20250603110204.838117-8-alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- MAINTAINERS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 0a7c7f3770..0f96a8d956 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2677,7 +2677,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:42 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=1751023748; cv=none; d=zohomail.com; s=zohoarc; b=TC90SOHls0BAeIh0jzdDZwFovE/H+Rdxehqt2MUuhkZuIyhN/eiFrmNf2DBv59jdQJ6xD2F7LrPEsiXTuW1LPmu81yA75xe0hPW2SdbGX2Y+U1BtK1W8eD3IPDsBbFHYaGU1EX6+ZWD9LW1m+1wMArw8aVf546C5AqBhTnLeIeE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751023748; 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=QF6hdZWmESZx/oo7D4Z38KZfMJLBNKw+PdVmoS4LcNc=; b=hC/8B2WrJL8YmWcJykCcTnHMh1oLvTvNrgRcAqCDBOZWOz6dqkmKddYSLI9YwqbSpJ++hQDdKgSJgnQYgAXgNpiO0S2HJorqbDze3Ornvqh3Z8au0VUBgu0VT1nV/1EfgBnROQKnahd6RfwFtmarFLr4H+B7FeRHfwQ5foQKLMs= 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 1751023748508265.5611378847767; Fri, 27 Jun 2025 04:29:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uV7DN-0005OH-NJ; Fri, 27 Jun 2025 07:25:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uV7DC-0005Et-UZ for qemu-devel@nongnu.org; Fri, 27 Jun 2025 07:25:43 -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 1uV7D6-0007EG-3A for qemu-devel@nongnu.org; Fri, 27 Jun 2025 07:25:42 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-453749aef9eso7555445e9.3 for ; Fri, 27 Jun 2025 04:25:35 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45380705351sm70294515e9.0.2025.06.27.04.25.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Jun 2025 04:25:31 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 9447B5F91D; Fri, 27 Jun 2025 12:25:13 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751023534; x=1751628334; 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=QF6hdZWmESZx/oo7D4Z38KZfMJLBNKw+PdVmoS4LcNc=; b=IVS7drpofj61UQqc08ybulXbLTQtOap4QPQCDY6L73gPaPUOKRvgjBBNztVXFRHFdj 7jrHYN2egHiMAVVZ4GoL4SCQBMNaDdKH5TghXf+wEoEI2dqizwnXu0WkGC7tuQL6ZMic um/Draoow4jUmU9LywO30RAzwMPm5WskM3oE6sfd5pC9S4m/BFPje0Ss7RUDAAD0lZBz TsSyxGgBDOpoNI2w6fjBOiyRNgigPv9LtBGw9qYQeQEbCei51ZryUTLxb4u46RNTAM92 WI2SVqL24pCw4M3E0PMvcwucl+q8GNcC4nKQaY3d71uHxho3iDxJeFqQYc60FU1oZ7n2 Krcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751023534; x=1751628334; 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=QF6hdZWmESZx/oo7D4Z38KZfMJLBNKw+PdVmoS4LcNc=; b=Oq4cf9k56YwNOEq6GAtvVVeZKDurgYiskFH8rUw723QGBANPkCEj0kWgn4c0VOvcO8 7b6Y9uWf6cfyRW4MYhxQkZITsipvc1g/EDLM0hvn42p3yO9bvKFR55PFj3MBEm9BUvIC oPpm+JctpImgFXTpMyW8nKJAQIlizBiAgbck+KcLQUELUms7SCWxXjiLr/JpPvWG/I3s p2/Jm4tJeNUEz8hbAjXI4UR79BGi2olvJ83M8OiF1SIX8LOl9SW1yBa9Kk5tcML5cY9X UQm2kJv3F4a4V5WfsZWhoH4At8FBUMNJYf62psg5bJtcy6yZZRlrn84R3Bs1gJ75HzCg UtPg== X-Gm-Message-State: AOJu0YxXWhDmovmy/v7Yk+G6TZWpQaNlBU/qCpd1EHkQfjKgyZv70Dg9 aXlbOc+levcU5b3DE/z1T9fTTzodLu6ipCTy7d2oxLNYgqFsmsnc8QseoUIBurmrwCA= X-Gm-Gg: ASbGncs+/89prJ8CI8A86TLjwlo53npaj5FSwho298p4Ia9orCAwsiY3IDjD/pyvyIy fwGJ4d9Z1ZFy3KOjTFtRu0+yoiAKdzvgck0TWB58k+fOkU583x5IZH2nX9o1TgIbIsv5IYUa7mv zGLJQ/DrpV994EeYi3X+YzMzZIwMJc+JywMvoXYFxnjNVMX/FLcGuBxLYOKdcY66FJ/1qVBYOiK IKfAulLxqrK9fE8NkL3N8euLRhDxCxBdRRPZKLUX7i/Mo2er1z1ea9AafqdxEE75ucmszLqcay/ +qV85LVovEy8JatkL5QQY6ByJQayVecl92eji+km7r6+ZG83APkeoxJcbHDxgiQ= X-Google-Smtp-Source: AGHT+IGJf2WH30sWNSgwa0EBA8wpipWnFhJvCXFNSdBgRZn5W0Cs2ytvG1IbuXnhLzLQpznMYh1maA== X-Received: by 2002:a05:600c:4e11:b0:453:7713:546a with SMTP id 5b1f17b1804b1-4538f758197mr24870115e9.14.1751023534254; Fri, 27 Jun 2025 04:25:34 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Thomas Huth , qemu-arm@nongnu.org, Gustavo Romero , Dmitry Osipenko , Pierrick Bouvier , Mahmoud Mandour , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson , Paolo Bonzini , Yanan Wang , qemu-s390x@nongnu.org, Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Zhao Liu , Akihiko Odaki , Alexandre Iooss , Markus Armbruster Subject: [PATCH 14/15] MAINTAINERS: add Akihiko and Dmitry as reviewers Date: Fri, 27 Jun 2025 12:25:10 +0100 Message-ID: <20250627112512.1880708-15-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250627112512.1880708-1-alex.bennee@linaro.org> References: <20250627112512.1880708-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=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: 1751023750356116600 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 Signed-off-by: Alex Benn=C3=A9e Message-ID: <20250603110204.838117-9-alex.bennee@linaro.org> --- MAINTAINERS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 0f96a8d956..83719f1309 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2678,6 +2678,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:42 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=1751024027; cv=none; d=zohomail.com; s=zohoarc; b=A7CQNUCrt9V56TG41pEE3AKeo4uLnlZ4k5DtBQTjRA9m661m0Ipc9fnastXx80EQaf22rZm/34PIcIiez0bb1b5izrVU9GZ96NfT0m0OGWWlLtGzEV61Yv9FSely7h+PgTjEoVvmE3CuStPASvFymjdCbV8ORo8KaAKSe0PyFwE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751024027; 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=soWxuif64h/OC65E1QvfLFWlQOaNN3QDI4MloSvMEPg=; b=fxK0lvKETAuM+4m08ZFb4bcF+HlhDoVOCn7jN0XWQitllDedNhVrXfgFYdekSAnDMliZnbrI+NNiBJihXARJGtduWv6nMrlQc1LtWPKvEWK74oE/CvyYlrxK84jsUdlvyCjyoau7dlfHzUxpYmkGZis+NwfkGZnC0jpRbIXGcVU= 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 1751024027294959.7442743648451; Fri, 27 Jun 2025 04:33:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uV7Kk-0000Se-BD; Fri, 27 Jun 2025 07:33:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uV7KT-0000NF-2F for qemu-devel@nongnu.org; Fri, 27 Jun 2025 07:33:13 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uV7KP-0001Vr-63 for qemu-devel@nongnu.org; Fri, 27 Jun 2025 07:33:12 -0400 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-3a50fc819f2so1456530f8f.2 for ; Fri, 27 Jun 2025 04:33:08 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45380d0f15esm69934365e9.1.2025.06.27.04.33.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Jun 2025 04:33:04 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id AD1A35F924; Fri, 27 Jun 2025 12:25:13 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751023987; x=1751628787; 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=soWxuif64h/OC65E1QvfLFWlQOaNN3QDI4MloSvMEPg=; b=dcXLxxlNuF9/coLBX23SNN7ses5WPCmRExq/H8SGDGFjqnAgapEKPX3deD17byb7ls 7qlTXCfBQ0UoCXIzGbGL4BGLeyVOSGOm5Nn9Rh0++9z1yezCKR01a3/H4nSQeAIMyfgT rol7Jcr2Kkf91TZaeCE5NM/Y12oJChq8Sb2wgUzpi1mNxrHZ+3ck6dKbM3tcShQx3Aae 38D/+NDYqyKpaXiz8vZvIhxc0RDYm5/igcYBHY1v77eCbdtKzMXBbWY4FCSdwZu5Ntgv 3C/UKkB5Y0hKOo4NZBl+cAiNBdIAuxJPjDfYfH/bIQxzzMMgWmYoqleXiRuOHKq9V1zS nsyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751023987; x=1751628787; 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=soWxuif64h/OC65E1QvfLFWlQOaNN3QDI4MloSvMEPg=; b=ucLWO33JMGSAMMMGBbx1LbA+ZDm/s+a5Lq0+9xgQcR3VhIFxL7oWu8ST99yqgSg5Fe fnvHxrWXJzVtf2FfNSyCjyV2kBomgbkh/LsHcGGL36tRa981sXz/j1jrVmGoesV+oveO oNqwEj8FFPsgFUvq6YXjiSg5Q54kQ7FTLH5ld6QTNE/8TKKCmv14PtDWAij3cPMjA+kO VBOTzZOq78P+4YhVBpOKh317ULK0rHTcEnvThOEhmkca1gbtuJpqRUaCFFzOngNr2keD OMhZeo/WqUgAKxd7FqD5gODUr2pJmiwxbFG/awA8u74gCSvCa4ENg7beQQlxln/+0VEM YKhw== X-Gm-Message-State: AOJu0Yynb7aMGEufA60/JIcEsYFfsk1oJfOlExDTIxFXNKD5WsI+OxrM 6RtvfgEAF28aSowAOQWkgIRMfz+8EXQjPqkYgNR8jF8LqsVTrZyFlBArxMwSTWtXOiY= X-Gm-Gg: ASbGncsyIODX1gcQh7SAKcL1eIuN1dV2KyFZ0QOkyRyKJESw05vjZaXv6JLqygGs4N8 HuOXO7f1TuGwj7VkbokKd7cOJ13hj8ViN8tHvOOKVCUZuuo84yCpjD4vYEHE0vAwpklhw+F36WD nzEH9GbzbOZDfryvyWbof3ZW4k7hYdWceOvvJ9SbizIqSFlDXt5A3IOCoamBoQ3WrG5SVWL9IJZ TUlzGGSVtUE/xJRc5TuMJQdg7YfVxWzD+CUG1J9gs71VB8DFSx0L+/wpStBwDezRbVz72qmT870 Jv7PMn4u3u9q96xnZRaOBJCr1q4Em1ga95BpSVcYXZDTc6B5jNN6gnRnpggAMjmqKaf3161hrw= = X-Google-Smtp-Source: AGHT+IEraiR9fU256rtMKCUJ5oYR82VOMyqYS7B5g9SZnIsu9lH2V56HIcyhtm3ZWv1SvRrrM/2l/w== X-Received: by 2002:a05:6000:490a:b0:3a5:2949:6c38 with SMTP id ffacd0b85a97d-3a91846d660mr2762903f8f.52.1751023986998; Fri, 27 Jun 2025 04:33:06 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Thomas Huth , qemu-arm@nongnu.org, Gustavo Romero , Dmitry Osipenko , Pierrick Bouvier , Mahmoud Mandour , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson , Paolo Bonzini , Yanan Wang , qemu-s390x@nongnu.org, Eduardo Habkost , "Michael S. Tsirkin" , Marcel Apfelbaum , Zhao Liu , Akihiko Odaki , Alexandre Iooss , Yiwei Zhang , qemu-stable@nongnu.org Subject: [PATCH 15/15] virtio-gpu: support context init multiple timeline Date: Fri, 27 Jun 2025 12:25:11 +0100 Message-ID: <20250627112512.1880708-16-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250627112512.1880708-1-alex.bennee@linaro.org> References: <20250627112512.1880708-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::42a; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42a.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: 1751024030789116600 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 Message-ID: <20250603110204.838117-13-alex.bennee@linaro.org> --- hw/display/virtio-gpu-virgl.c | 44 +++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) 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