From nobody Sat Nov 15 12:15:02 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=1751453075; cv=none; d=zohomail.com; s=zohoarc; b=UmDgiiEKYqskLAW5vRr+Qxfo6n66U3o04cSvu6LVM87DNDxwm7XWQ73TJy6u8yZfhwat4HN1klC6Owqdvcvo5Fn0JDJlTlpk4Q3JUrxGUdt6Ok1Ok52upm6WuH2tindNiL5HieWyIE+f94cCL0Qu98Ep5eO2immbZXAEz/vbb+g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751453075; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=D4wxQdFgaAl/kwo8ASXJ9vsmD0ZBYPLir6xKV4La3T8=; b=DUWVJYrcXSuBxNsUC0Vq7iS0sHDLvtll6lTvgFInsUmqGJqR4nVa/DDae8qJvQfNjhvLircwAvql1uxowXV9uTFis8B/22OtHuCkn3Qb7PkMHxmfU+ir8M+SmaEPwkg2EqzP4UKaEo5WimjnX2ALfnKsND5vn4oogVsoHXSwZwA= 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 1751453075305626.8283408483028; Wed, 2 Jul 2025 03:44:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWuwZ-0006fv-HX; Wed, 02 Jul 2025 06:44:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWuwR-0006e0-Gg for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:43:52 -0400 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWuwI-0001IQ-59 for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:43:51 -0400 Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-ae0ccfd5ca5so603056966b.3 for ; Wed, 02 Jul 2025 03:43:40 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ae353c6bea1sm1055953866b.146.2025.07.02.03.43.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jul 2025 03:43:37 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id D20005F8CC; Wed, 02 Jul 2025 11:43:36 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751453018; x=1752057818; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=D4wxQdFgaAl/kwo8ASXJ9vsmD0ZBYPLir6xKV4La3T8=; b=Mqa6EyXsNXj82/gbQboh9HEgxi5tjk5VLYSdrV3FI83gkmVier5gjPA11QgTthIvXz mNV+iGRk0vSD/X1v4yahYDaFH3r3TsYGBnrOlNxkJwgNUq4zQ+Anv0OuA14AF0k7iryy Z0Fd0MHC6FSNywuAN28yZE/sZjAXaEdNHbhZY8FrV93W9QXVo2UtH7XmbYGWa0j/ZMQH L/6qmczRqiL0xA4lVLOlz35JQYTzyygorqvtJpPjTgCscG4g0qzVkhMJp/fP0yYllohB ffk4HBDnnaJlFbEZwHIxmz64PnCup3wWxB5TK/NX0lM6L7DPi766fC/NBqKhFvdWUePC 8deg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751453018; x=1752057818; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=D4wxQdFgaAl/kwo8ASXJ9vsmD0ZBYPLir6xKV4La3T8=; b=uCs8WNTSiFNzV9SM+nUfA4O1EiRt1cuwtJoHg0YDclvXcA0Gd345um6JIaIgrpHmNy FS87MhFlSXugTZNSxPh29XnbTKlNu9F+QOTaFTu6EM/o4h9BOwFWyiNafswVF+GkN5Qs fjeIsUBEFrn7G4r5jwhYQcKGQMe9Mvs1ZDr1afMB38s+M8tSvfbSWf2Tc3MlU/mG0dc6 m+O0uM1jFdM4E+VtoVc4vY+eSOTuhTzx21xS7Juq9nCuLLV6UIsNo3ibJA/qUK5rqBDf X3XZOE1HEe6An6Ar+IlRvBJJYVN1yKAp5Aed4WXjmlr92lEi7tuoExlT1CcQ8DwmPW8+ J7dQ== X-Gm-Message-State: AOJu0Yxa0IIA7/Wgx1ZabFTP8IudWiRqtdqz8HiDEDKZjnz7g/qCfOBk 1WwE5O9fvrsESt/U44mK5ttDQ2ocbO+u2LS4M9uojyYdHvu1stUG0zZy/8VpDKhCIFgyhhnLJm3 7104QeKc= X-Gm-Gg: ASbGncvdxowJJf+cNBaxj2boCli6KzQoYK7tKj6Jevyh2i5gOPnhDOqeFaG6Cni3xkg BkZ4R151DvnMZq5F0gg5fTxQzAE20BRXdeJ1B2E33Z3rh5ynQ1kOW4nKezERfxv+bBOclQ5sO1C 9YTxbMABRl4ekqEiXZttoS51uaHxkL/nCeirskZwZD7dhxJpsDfw4kMswXtVHINqEKbdBQ1DXxi 8TSFzNHghc9vedclIQRDhAWl4Kl8orDFYRySXVy/mqEBD+ai9UgCcVSY2UzUE5l/JuXig1lBMdk d+bkqlifwkRx1dJzXgqHq7vmxeO5UYhy4rqiTm1/hHDd5b4x9aQ7krYYjYM9Ixs+C81lQbk3gA= = X-Google-Smtp-Source: AGHT+IGhizsv7EuZB/OZ4VjjrIeCLCYCs86E2WG6PyvB5pniwtCqfq4oSAE21h7HXux0SoluE0y2CQ== X-Received: by 2002:a17:907:96a8:b0:ae3:6390:6acc with SMTP id a640c23a62f3a-ae3c2c02390mr253811266b.27.1751453018328; Wed, 02 Jul 2025 03:43:38 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Huth , qemu-s390x@nongnu.org (open list:S390 general arch...) Subject: [PULL 01/15] gitlab: mark s390x-system to allow failures Date: Wed, 2 Jul 2025 11:43:22 +0100 Message-ID: <20250702104336.3775206-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250702104336.3775206-1-alex.bennee@linaro.org> References: <20250702104336.3775206-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::62d; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x62d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751453075873116600 The system tests (usually qos-test or migration-test) prove to be very susceptible on the s390x runners. Although we have boosted memory and virtual CPUs on the runners problems persist. For now mark test as allow_failure so the its clear on the CI UI when checking test results. Signed-off-by: Alex Benn=C3=A9e Message-ID: <20250627112512.1880708-2-alex.bennee@linaro.org> diff --git a/.gitlab-ci.d/custom-runners/ubuntu-22.04-s390x.yml b/.gitlab-c= i.d/custom-runners/ubuntu-22.04-s390x.yml index ca374acb8c..e62ff1763f 100644 --- a/.gitlab-ci.d/custom-runners/ubuntu-22.04-s390x.yml +++ b/.gitlab-ci.d/custom-runners/ubuntu-22.04-s390x.yml @@ -31,7 +31,9 @@ ubuntu-22.04-s390x-all-system: timeout: 75m rules: - if: '$CI_PROJECT_NAMESPACE =3D=3D "qemu-project" && $CI_COMMIT_BRANCH = =3D~ /^staging/' + allow_failure: true - if: "$S390X_RUNNER_AVAILABLE" + allow_failure: true script: - mkdir build - cd build --=20 2.47.2 From nobody Sat Nov 15 12:15:02 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=1751453173; cv=none; d=zohomail.com; s=zohoarc; b=UAgZm8tiS98wKXpa+f8gdyDFURlocf7fi2W75Ubrsb7dD6QJjvy9cRDYCL4qPceAFfLT6/1Jrta8zEUt3c4unP5+gcCekJJSxNzYz/tD2fcfPI3xzMfnoS6mvP8aog61VLsLo0F8c87QuS/lm4wBd5tUyFcPEvDZ0GbBjsh/sNg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751453173; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=DQDGpu2DK2e5jYtAk3+B2u316yUnK6jEtaDaYh1M9uM=; b=BDm8y45Ir7j3BBqByJEY+bK8cSXtrKFj5RILNJYE9pnL2Y8NMuAGLuAJggwfXh/rLrJDgzNGLmKWHz8y5MgosIU8mj4PMxtcK4gtA+CrG03tV6jAMcuQC4uYKNNQPNTmA3QRIm377rBDtsC839N3V1xnCvDo20TCGdA6TdXpyJM= 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 1751453173775349.0760509673503; Wed, 2 Jul 2025 03:46:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWuwO-0006dD-Kk; Wed, 02 Jul 2025 06:43: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 1uWuwM-0006cv-UM for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:43:47 -0400 Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWuwI-0001IU-4Q for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:43:46 -0400 Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-60bf5a08729so8793195a12.0 for ; Wed, 02 Jul 2025 03:43:40 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-60e26b7ac4esm3334924a12.7.2025.07.02.03.43.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jul 2025 03:43:37 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id EBD875F8D6; Wed, 02 Jul 2025 11:43:36 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751453019; x=1752057819; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DQDGpu2DK2e5jYtAk3+B2u316yUnK6jEtaDaYh1M9uM=; b=xu8lbEXdQdC/vuPNdP6cvlETjepLf0GzjgG65Aa6y+Vl4M9MPU0J3UzQv/Yq3W+/DF oHwrGBw3dR3VMzwReVieLSQhhriwNqHrR9UkLSxb4ECJ/lVHn3ajyIMV7NZdjO9hcrC/ D7FyIImelv1YsgctYwrNL25araUgx2a9cdPYIAscD8Pv9sUFAm7+9Rki7xjjF97mKm/t utvRygeyg9jBwAALpuH+UEXe7js/Z2Soe9F/BW4/NP1Gs0Iv+3nMNT6Xj1aASnl/in0d aOrAdjtnmVVkrMa3FubbLOKNA2gc8Wm/3jA9cQ7ayBdnOmGynjhGAnsYzm20gJeEFaBd d0kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751453019; x=1752057819; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DQDGpu2DK2e5jYtAk3+B2u316yUnK6jEtaDaYh1M9uM=; b=PD1oC68GmSlnxJHF2bHVgZN//QkKGVRqMVuyxH7qvSmB9rWqbxIWB9mV0QFY8727c4 0c5eaTMDeiCJMQ+xyelPLUCiprvxsivfIwAuIlQ06EptmE+UB1OdYhzrqSejVVhvfRk6 ks2NFItj23xUnpPZh/K6VPpUaW1eUqwe1cjiwhTGFtqMVX7Xp4X2ObNCvSj8u2jYALCX 78VLDAM14E6tGT4spXs8IUdpoP0qdSxnoeO19uRuT93X1S4U0G5MuPNGVC2Ut+DSqSM1 PR7V6C54YOxMeHpxlw4Q3L0n2c5mabHbIcGwdwUCVpDC+Z3mYtyG1u/oYoSAKIOBxW/K esjg== X-Gm-Message-State: AOJu0YxYBa0F4rvUPzKxpZZrUHoqNDvmgny5Kbi4ge/VCZ5gfF22NMLZ Hw9wVcXi7pE25cemg83Q9AEvH+qhr8wlRfY4uGJBvn9YT40RDI/cayfNtKO+oI+LX66jq5jQ+wS kiHb5eFE= X-Gm-Gg: ASbGncsJkF+e73WETLo8/x/CKFry3eG0JUSeEqZLw/eqxAIZQxfpyj0VYz2FgzjIwAe aQu/gN8bXezfQeJ3gonLUxAmXLmjyOeIkI+2gxLp/bGj0hCt6gbqKEmCXKa7F7rx6ncYYJ2rMmn 8LSc8SrQpYX//GT62GWXq0NHo8S5qu88nZFE8cZzVUvFVeYxqugwZIbwuBfiXCW35iQpOsS379J ZXjgrKnfefekNAllGECEx6cT+J54kMit+n0Bd4EtXTKCCzTUXGsMV7Vruwq+L2ckS80QtIcJw/x N+JD6VFpTpxAf8xy76bFrm5H5XyPxu87h4orXnOz18ZQyiaIYz+iFOPOi8pMdE8= X-Google-Smtp-Source: AGHT+IG5og/5E02tihARqc9HyJXY3wkpj6R46Fll9yI854HL55n8yzIa/O8HY0AqHuDJj/oUnYkgOg== X-Received: by 2002:a05:6402:354b:b0:608:493a:cccf with SMTP id 4fb4d7f45d1cf-60e52e3be80mr2052923a12.30.1751453018991; Wed, 02 Jul 2025 03:43:38 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Gustavo Romero , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Thomas Huth , =?UTF-8?q?Alex=20Benn=C3=A9e?= , qemu-arm@nongnu.org (open list:ARM PCI Hotplug) Subject: [PULL 02/15] tests/functional: Add PCI hotplug test for aarch64 Date: Wed, 2 Jul 2025 11:43:23 +0100 Message-ID: <20250702104336.3775206-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250702104336.3775206-1-alex.bennee@linaro.org> References: <20250702104336.3775206-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::52e; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x52e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751453175115116600 From: Gustavo Romero Add a functional test, aarch64_hotplug_pci, to exercise PCI hotplug and hot-unplug on arm64. Signed-off-by: Gustavo Romero Reviewed-by: Daniel P. Berrang=C3=A9 Acked-by: Thomas Huth Message-ID: <20250528203137.1654964-1-gustavo.romero@linaro.org> [AJB: trimmed boilerplate for checkpatch, simplified invocations] Signed-off-by: Alex Benn=C3=A9e Message-ID: <20250627112512.1880708-3-alex.bennee@linaro.org> diff --git a/MAINTAINERS b/MAINTAINERS index d1672fda8d..850588fb64 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2089,6 +2089,12 @@ S: Supported F: include/hw/pci/pcie_doe.h F: hw/pci/pcie_doe.c =20 +ARM PCI Hotplug +M: Gustavo Romero +L: qemu-arm@nongnu.org +S: Supported +F: tests/functional/test_aarch64_hotplug_pci.py + ACPI/SMBIOS M: Michael S. Tsirkin M: Igor Mammedov diff --git a/tests/functional/meson.build b/tests/functional/meson.build index e9f19d54a2..53721c97ec 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -83,6 +83,7 @@ tests_aarch64_system_quick =3D [ tests_aarch64_system_thorough =3D [ 'aarch64_aspeed_ast2700', 'aarch64_aspeed_ast2700fc', + 'aarch64_hotplug_pci', 'aarch64_imx8mp_evk', 'aarch64_raspi3', 'aarch64_raspi4', diff --git a/tests/functional/test_aarch64_hotplug_pci.py b/tests/functiona= l/test_aarch64_hotplug_pci.py new file mode 100755 index 0000000000..c9bb7f1d97 --- /dev/null +++ b/tests/functional/test_aarch64_hotplug_pci.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python3 +# +# The test hotplugs a PCI device and checks it on a Linux guest. +# +# Copyright (c) 2025 Linaro Ltd. +# +# Author: +# Gustavo Romero +# +# SPDX-License-Identifier: GPL-2.0-or-later + +from qemu_test import LinuxKernelTest, Asset, exec_command_and_wait_for_pa= ttern +from qemu_test import BUILD_DIR + +class HotplugPCI(LinuxKernelTest): + + ASSET_KERNEL =3D Asset( + ('https://ftp.debian.org/debian/dists/stable/main/installer-arm64/' + '20230607+deb12u11/images/netboot/debian-installer/arm64/linux'), + 'd92a60392ce1e379ca198a1a820899f8f0d39a62d047c41ab79492f81541a9d9= ') + + ASSET_INITRD =3D Asset( + ('https://ftp.debian.org/debian/dists/stable/main/installer-arm64/' + '20230607+deb12u11/images/netboot/debian-installer/arm64/initrd.g= z'), + '9f817f76951f3237bca8216bee35267bfb826815687f4b2fcdd5e6c2a917790c= ') + + def test_hotplug_pci(self): + + self.set_machine('virt') + + self.vm.add_args('-m', '512M', + '-cpu', 'cortex-a57', + '-append', + 'console=3DttyAMA0,115200 init=3D/bin/sh', + '-device', + 'pcie-root-port,bus=3Dpcie.0,chassis=3D1,slot=3D1= ,id=3Dpcie.1', + '-bios', + self.build_file('pc-bios', 'edk2-aarch64-code.fd'= )) + + # BusyBox prompt + prompt =3D "~ #" + self.launch_kernel(self.ASSET_KERNEL.fetch(), + self.ASSET_INITRD.fetch(), + wait_for=3Dprompt) + + # Check for initial state: 2 network adapters, lo and enp0s1. + exec_command_and_wait_for_pattern(self, + 'ls /sys/class/net | wc -l', + '2') + + # Hotplug one network adapter to the root port, i.e. pcie.1 bus. + self.vm.cmd('device_add', + driver=3D'virtio-net-pci', + bus=3D'pcie.1', + addr=3D0, + id=3D'na') + # Wait for the kernel to recognize the new device. + self.wait_for_console_pattern('virtio-pci') + self.wait_for_console_pattern('virtio_net') + + # Check if there is a new network adapter. + exec_command_and_wait_for_pattern(self, + 'ls /sys/class/net | wc -l', + '3') + + self.vm.cmd('device_del', id=3D'na') + exec_command_and_wait_for_pattern(self, + 'ls /sys/class/net | wc -l', + '2') + +if __name__ =3D=3D '__main__': + LinuxKernelTest.main() --=20 2.47.2 From nobody Sat Nov 15 12:15:02 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=1751453083; cv=none; d=zohomail.com; s=zohoarc; b=HAk0EUkyB9ru6F+261VcygnoN/5J47DH5OPojnsRDX8v8gVVDKyLqzC8Ty1OdpaG0Yje2u5fCGs8bMx0R/8zaRPS3EOd6sR5lIylfemlZzMsxDEJuUPf//pq0M0n0LmHUeI2jL+X2MwK1x3Gu2kaBGMwcWG/K3GdQPvrOFgLm9c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751453083; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=mRCp3ySVNCc5vKTsGg2A8ACZ7tFKQgIdG5HQy6KJhQ4=; b=JPYxPhgVxYWrWeLRAwsD/zhQL6eei0EuJfK4sf9XSKnQ1+tbo6AxvdNPa/6HURNsvFL1+7CKTAgwS17bxGHYcwudzIdOkDkHJazgxGzcwzSX30MfxQLmiS/dg8ol/lf+ZeaG3E+9a+HaNbPZI6O5sx6C+vTRkY6eo/8gFDE1xWs= 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 1751453083351236.91317419508857; Wed, 2 Jul 2025 03:44:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWuwZ-0006fw-H1; Wed, 02 Jul 2025 06:44:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWuwT-0006eO-GR for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:43:53 -0400 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWuwJ-0001Iw-My for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:43:52 -0400 Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-ae3cd8fdd77so16555866b.1 for ; Wed, 02 Jul 2025 03:43:43 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ae353ca2edcsm1039338966b.180.2025.07.02.03.43.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jul 2025 03:43:37 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 0CD9F5F8D7; Wed, 02 Jul 2025 11:43:37 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751453021; x=1752057821; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mRCp3ySVNCc5vKTsGg2A8ACZ7tFKQgIdG5HQy6KJhQ4=; b=rHa0HiIv7FjYuHQCV2TW3sXvjozR8GoNo5NR1srXsqB4yL++MiXIIw5MjJ63mKqiPl 6uFUmIhhlV5qme/MoNOkNMTzX+gTClHx8GXV24kPquxOn92FOC0/u+Du5eH+N+p1NXKo o8Hn5uioKp3UQgvkO8UHm6N3h15SjKPtrfhuEvQcSyWo8Zi+rUX0NPDeXkIj/mp2da+i d2yP7bscDvCz8IKDDzlXDs9A7WTOa7W7l7O2xoC91XFyLEcZGCzRDkt/IXvKwCNKHvcO c8+JSdzo8dTt7wtusnvLWhgdV0vtfKJU+dFJXbHXB4XYfTgbHOMmTOsdwutIM9zAoDzH oHlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751453021; x=1752057821; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mRCp3ySVNCc5vKTsGg2A8ACZ7tFKQgIdG5HQy6KJhQ4=; b=tslN/PLf13rrPZzKK4OfGonMLZ/UV70LzkQUUZlymhf7nUXegL91bnCQhsnjbTTmYJ fcouFalx//9iRUt0tYxuUxaiTuCuvsRBMp3iPrjAmPBe68DOLq69N0Yulf8IFq09Ll4x WtmuYnwsSS40zNr+NKgFqdqt14gkqKICSMu/ociH1cPqVsLkTDWUpK3rbxMTlbTmCKoH ICcZ3SCi3Dp0O7ABU0ai9lnw5YVrcWpdXnbjchAQtBZGmBoFRgcA4VWHG+FCw4/lnXzS I2bgmHCByzzhnNE711i965SWPg8wCWBDkEqGeJKuTRcm9npk2qazghSLHUb7EBD8saLC NWag== X-Gm-Message-State: AOJu0Yxnp+zGe9Aj9PSj4Hcu4GeNFNmEKprx54iA56lqIieusNu4Jirb 4+ZkpycKhcCn1qE9Y3o57kD66uEB4ZZbhWCtYvalMLUhbgAucV2+3ryK/DhT9nJG9wg= X-Gm-Gg: ASbGncu1lAjARqMh1luHcaG1oIMESWO6yK+dy3vVGlCj/L1wWDPvJFoBoFVZp25sg2R tNm7ipod3VuTzz58OHudzNC/8r38cFrFvgBDg12sTH6yTkwtTyXqqfSB966MBir996rBc3rJwrS 5GDpD8Tl6ob3EBZFDsh95BGhjPp+qAPbyWJoTmXMO1Uy+/0JGqYiyy7SMixfY0kffHCPIK8bmyz dglphjO/1K7CNxwM2ENYy6XFhwiy5bSLAvactqsF7IBqwteAVXnThr2jNYOPlDtO9W/b+RFO5YC kLB4t7Bo1Y2rqxdlCmoOzSLLfgNiN2uPPXToR873D3Ctvs6EPcZxWu/tVbyHpQw= X-Google-Smtp-Source: AGHT+IHdgLSlbvcgbAwAFGmSlhOmB1J/6bXqPJe3eb2nEDYCtD3AyNrAwV3YwOtXV/cdiskkjN64nA== X-Received: by 2002:a17:906:4fc7:b0:ae0:9fdf:25e8 with SMTP id a640c23a62f3a-ae3c2ca3ebamr212404666b.47.1751453021552; Wed, 02 Jul 2025 03:43:41 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Pierrick Bouvier , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PULL 03/15] semihosting/uaccess: Remove uses of target_ulong type Date: Wed, 2 Jul 2025 11:43:24 +0100 Message-ID: <20250702104336.3775206-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250702104336.3775206-1-alex.bennee@linaro.org> References: <20250702104336.3775206-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::62f; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x62f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751453083846116600 From: Philippe Mathieu-Daud=C3=A9 Replace target_ulong by vaddr or size_t types to match cpu_memory_rw_debug() prototype in "exec/cpu-common.h": > int cpu_memory_rw_debug(CPUState *cpu, vaddr addr, > void *ptr, size_t len, > bool is_write); Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Pierrick Bouvier Reviewed-by: Richard Henderson Message-ID: <20250526095213.14113-2-philmd@linaro.org> Signed-off-by: Alex Benn=C3=A9e Message-ID: <20250627112512.1880708-4-alex.bennee@linaro.org> diff --git a/include/semihosting/uaccess.h b/include/semihosting/uaccess.h index 6bc90b12d6..2093a49827 100644 --- a/include/semihosting/uaccess.h +++ b/include/semihosting/uaccess.h @@ -15,9 +15,9 @@ #endif =20 #include "exec/cpu-common.h" -#include "exec/cpu-defs.h" #include "exec/tswap.h" #include "exec/page-protection.h" +#include "exec/vaddr.h" =20 /** * get_user_u64: @@ -89,8 +89,8 @@ * * The returned pointer should be freed using uaccess_unlock_user(). */ -void *uaccess_lock_user(CPUArchState *env, target_ulong addr, - target_ulong len, bool copy); +void *uaccess_lock_user(CPUArchState *env, vaddr addr, + size_t len, bool copy); /** * lock_user: * @@ -103,7 +103,7 @@ void *uaccess_lock_user(CPUArchState *env, target_ulong= addr, * * The returned string should be freed using uaccess_unlock_user(). */ -char *uaccess_lock_user_string(CPUArchState *env, target_ulong addr); +char *uaccess_lock_user_string(CPUArchState *env, vaddr addr); /** * uaccess_lock_user_string: * @@ -112,10 +112,10 @@ char *uaccess_lock_user_string(CPUArchState *env, tar= get_ulong addr); #define lock_user_string(p) uaccess_lock_user_string(env, p) =20 void uaccess_unlock_user(CPUArchState *env, void *p, - target_ulong addr, target_ulong len); + vaddr addr, size_t len); #define unlock_user(s, args, len) uaccess_unlock_user(env, s, args, len) =20 -ssize_t uaccess_strlen_user(CPUArchState *env, target_ulong addr); +ssize_t uaccess_strlen_user(CPUArchState *env, vaddr addr); #define target_strlen(p) uaccess_strlen_user(env, p) =20 #endif /* SEMIHOSTING_SOFTMMU_UACCESS_H */ diff --git a/semihosting/uaccess.c b/semihosting/uaccess.c index 4554844e15..ff944d8c2f 100644 --- a/semihosting/uaccess.c +++ b/semihosting/uaccess.c @@ -14,8 +14,8 @@ #include "exec/tlb-flags.h" #include "semihosting/uaccess.h" =20 -void *uaccess_lock_user(CPUArchState *env, target_ulong addr, - target_ulong len, bool copy) +void *uaccess_lock_user(CPUArchState *env, vaddr addr, + size_t len, bool copy) { void *p =3D malloc(len); if (p && copy) { @@ -27,7 +27,7 @@ void *uaccess_lock_user(CPUArchState *env, target_ulong a= ddr, return p; } =20 -ssize_t uaccess_strlen_user(CPUArchState *env, target_ulong addr) +ssize_t uaccess_strlen_user(CPUArchState *env, vaddr addr) { int mmu_idx =3D cpu_mmu_index(env_cpu(env), false); size_t len =3D 0; @@ -75,7 +75,7 @@ ssize_t uaccess_strlen_user(CPUArchState *env, target_ulo= ng addr) } } =20 -char *uaccess_lock_user_string(CPUArchState *env, target_ulong addr) +char *uaccess_lock_user_string(CPUArchState *env, vaddr addr) { ssize_t len =3D uaccess_strlen_user(env, addr); if (len < 0) { @@ -85,7 +85,7 @@ char *uaccess_lock_user_string(CPUArchState *env, target_= ulong addr) } =20 void uaccess_unlock_user(CPUArchState *env, void *p, - target_ulong addr, target_ulong len) + vaddr addr, size_t len) { if (len) { cpu_memory_rw_debug(env_cpu(env), addr, p, len, 1); --=20 2.47.2 From nobody Sat Nov 15 12:15:02 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=1751453172; cv=none; d=zohomail.com; s=zohoarc; b=C2R10TAoA+qG4agwqU4taKDLKLFkhPDBOsUgTa23+cZUPeBuTHW4nteMpc7C2T6+KB81M5VnSDuT9uPmpvLPUKET76h4VH+LChKD6CN89ysjBZBs+V5sIPXjf0gHXO4XQ94xLuypERmgaWL3eS/hnb/2PA9mNxPJE1wiGH/h3rI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751453172; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=9LuknGbyHpYfn5Myg53J+fZFSmGacyw10WuAzgbETa8=; b=GAWJjypy7jiiGK7MELgFF60g04cLtcEyWGsLvz9UU6VKYq7CAqgoo89UzvkRqZa2xlDSebhthUmF0ZeWuLQ+DUdFM+hoAPBAE0VC5mBY1lFLQx9u3LuesrlfcfT0JaUps3Hzty/EP0K4gKMcd1Lm9YBaYcCfLpaxRCdGCe6XUr0= 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 175145317267472.24606686635593; Wed, 2 Jul 2025 03:46:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWuwe-0006h9-9g; Wed, 02 Jul 2025 06:44:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWuwU-0006ev-Qa for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:43:55 -0400 Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWuwK-0001J1-EA for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:43:54 -0400 Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-6088d856c6eso12323871a12.0 for ; Wed, 02 Jul 2025 03:43:43 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ae35776d0ebsm1042583466b.155.2025.07.02.03.43.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jul 2025 03:43:38 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 25FA05F8D8; Wed, 02 Jul 2025 11:43:37 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751453022; x=1752057822; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9LuknGbyHpYfn5Myg53J+fZFSmGacyw10WuAzgbETa8=; b=QP7fEqBvXrGeZYODn0r+t1b0nkxIjB+sgs33h/uNjmn0KMZxMkVPTsbQ0c/lgP9VZr KOLvqKO2H6Z7PqCq9uZBL/6lZ0lm2jh5mbcX4m5TMeSIrDygsahmhrDG/BUWP6b7H3oX XAyva7VUIVYjbGm4sIsmtE4BWkuYHHI9r7//fkGkfHZdTyZLfPbWQHDxNyEiWBFb4g09 ZJ6+VeA9hJySW3BhbCabsalfKE3Gs+4QGQ1P0zrstskYahyRRXgoxFiMKrVgmqDfJSSt DVt2k5NM/iIIIaTO2gIIYmpfTgBZrMy4df2jlg7JNGNMUeANi12UXywo3dx2cljTkBS2 Mpaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751453022; x=1752057822; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9LuknGbyHpYfn5Myg53J+fZFSmGacyw10WuAzgbETa8=; b=q/2wh1qcjU2GiicU21JmVOiDMuoiQlWQFV7FPEVvmXDafj+f2TnAb/JONgw0vo7FDh hJqz4ZGl4RaZ+n7fdLD749FbUPqhKStEdsNa8a37QNmPoKYUEBnpJAYAJcy1HSmacoUY i9MDbnNvoOTBwPu4E+3Qc6WQCBTe4ZlIcXhYy/575ZQVB5mSJj0+LXO+OblAn2KZZs9I mWlu8bVkLpxs0jAMf+uFG5w9QkOpk0r+aVJ3hLMqUT8o+Z4zY6uNAfmrgk6bISIQEnnR 9NrkEJ4j5JEMDlwss2/FDm7ZA+qDvXr0TJii6JQiUTMKICCXfXfo/sYNlPMS+WzBNlmP xyeQ== X-Gm-Message-State: AOJu0YxBK5MqvOu+GyE27h2YhiDYID/3s64q6zFNiTc7Dbhehv0LMysq tQibJ3oNCKPQl95abvOw+3dPX6eJk9NxIuimg9GCJnfdOh0qmq+vFBFhLeV75B8XQwY= X-Gm-Gg: ASbGncvc4/6l7HUW2xdURlQm8Kni1vF/cmijUkEeaaHPNLc7mx7PtnixiAj4Mw+LK80 RzhfA1aK8smoY6W8IkzFojhuujwzx9NDGHgmL4vPpQjU+JWh84YrLDahaoiEdW388bVeoNXrizH 2HT76eD1iZRC+FfBzFIs69WdOSpw7vFUom0XqtkQowGeuqT3Xz9Ta+E8stgVqrKqI7l4N5sP2QS ciQqKNBfzOjd50pdfyoZAc5MXXMieJtQoHSO6P4Op+NuU3GVLWYVVYEAnhoeOTnl90AeRbvQ6Nj BGEuCzG0cesQ0EuGVlApFFYdb92V9XNS/ePsC6H/inh9jYadtLoa4glmpjWWqaSCw8HNm6nvwA= = X-Google-Smtp-Source: AGHT+IF0tOnMmKf/ocwsM5eet0OQrJ62ChLN6abOD8xCYaRNWgEBvFHfyii7SnXtpoTf2ZHtLACezA== X-Received: by 2002:a17:907:1ca3:b0:ae3:6d27:5246 with SMTP id a640c23a62f3a-ae3c2ce1f13mr218559766b.48.1751453022319; Wed, 02 Jul 2025 03:43:42 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PULL 04/15] semihosting/uaccess: Compile once Date: Wed, 2 Jul 2025 11:43:25 +0100 Message-ID: <20250702104336.3775206-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250702104336.3775206-1-alex.bennee@linaro.org> References: <20250702104336.3775206-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::52d; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x52d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, TVD_SPACE_RATIO=0.001, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751453174950116600 From: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Message-ID: <20250526095213.14113-3-philmd@linaro.org> Signed-off-by: Alex Benn=C3=A9e Message-ID: <20250627112512.1880708-5-alex.bennee@linaro.org> diff --git a/semihosting/meson.build b/semihosting/meson.build index f3d38dda91..b1ab2506c6 100644 --- a/semihosting/meson.build +++ b/semihosting/meson.build @@ -3,15 +3,12 @@ specific_ss.add(when: 'CONFIG_SEMIHOSTING', if_true: file= s( 'syscalls.c', )) =20 -specific_ss.add(when: ['CONFIG_SEMIHOSTING', 'CONFIG_SYSTEM_ONLY'], if_tru= e: files( - 'uaccess.c', -)) - common_ss.add(when: 'CONFIG_SEMIHOSTING', if_false: files('stubs-all.c')) user_ss.add(when: 'CONFIG_SEMIHOSTING', if_true: files('user.c')) system_ss.add(when: 'CONFIG_SEMIHOSTING', if_true: files( 'config.c', 'console.c', + 'uaccess.c', ), if_false: files( 'stubs-system.c', )) --=20 2.47.2 From nobody Sat Nov 15 12:15:02 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=1751453203; cv=none; d=zohomail.com; s=zohoarc; b=Um3YWDjfkmGn+a4T1R3GXdznAGMsRqRN/KuMWMItJeWlbQXUXMH3Dlnbtddi4wbqyUoRRwTavUxGI/vSihNzkNfe8g1GJ6ua6jLayddGKTneZhnKNh6/VnAUTM5AD1pVnRCMsAT4l1rC2RXiMEOvplM81qKC/dHm+cTXht0NISM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751453203; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=qecS0tIoe0ls7nw8T86Ife3RJh0yHDOjkyPB/fpRPNc=; b=h+MG4oyfwAik65GoCdib8Gd/sJWiKVP0QhsEvBKi1t08uyAkp6RDp2SBmJWxhWhEtiP9wqNGzvBILwaqXlve0DdwJqKQo2NZJP7TbEp9eGI/eZkN84XI8Lp/oIwL7V8LYu1ssKIl25PKWBJ9Q2B7wYCJkPFQmG2EfBVYfMPkTN8= 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 1751453203576562.9355517782055; Wed, 2 Jul 2025 03:46:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWuwj-0006ir-FU; Wed, 02 Jul 2025 06:44:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWuwX-0006g2-Jr for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:43:59 -0400 Received: from mail-ed1-x52a.google.com ([2a00:1450:4864:20::52a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWuwP-0001Jc-Ae for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:43:57 -0400 Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-60c51860bf5so11214363a12.1 for ; Wed, 02 Jul 2025 03:43:48 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-60c8321a08fsm8757433a12.78.2025.07.02.03.43.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jul 2025 03:43:41 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 3EF6C5F8DB; Wed, 02 Jul 2025 11:43:37 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751453024; x=1752057824; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qecS0tIoe0ls7nw8T86Ife3RJh0yHDOjkyPB/fpRPNc=; b=itPZdPCv72aKkdPH7jgkwwE9ZGDYQx5pS/051e0ch0Blmp9MMCXhArhi4tYsrqnpdk tqR/Zpa2kSD0f5yW1GQ9apcKeZcAhYWEJFEXzF+s742APbvheu0TaiB90Bwh5vlVBSWj 7Js5LO8b2O4P179rN7p1vsmDH1dgKw1CglG6pfoPmcOZCy+45cWSctknPMo5Drbbz+hr s1K2bAzQGFYk3wsIMvgTivj7H0FhxwDhGYqgjqZtxhqq/OmjWsioMdBIVlItMuNUusR9 W+lJirjAwuZO5ff1+65JsCFjhhiQzxTFFjQ4NPBdKck2k7FtVZVLd6ds9oWd+FbPmtSQ Rp5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751453024; x=1752057824; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qecS0tIoe0ls7nw8T86Ife3RJh0yHDOjkyPB/fpRPNc=; b=kLW4q+ZPwysfn/Z2XVnNbRdscihivUNdYniS6hIKFRnjzKSXa2yvalEParELL/7QKQ EHzmtu6wEW6nhmhBkO+ET5Nx2qFgoBfwrvNHfzjlrJLu4hCIKwVQjU7F8S7OCt9+zhYd vvXltmrAEaXZe1i0cScDPazE6cmC2UsVBMSJ1T9b+nrYC52QmvFRWZeN4XI8FaKmh9/q wfaxK1kA+bmymW+p6yRxd2LIcOsAr1Nl52Waekq0jCODrbrRqT1XA703aE/7S3aCHn4n 2EcP/Wfao1R2KddQ1AWab7p4kOdEYe5zvNUnxL7lXafUwqjW1mFi2BqM7hI4UmBm3NTU Uewg== X-Gm-Message-State: AOJu0Yw+Ih2Sd1VnVG65zg+Yjl9NrNpAShdApiuPGk5pKgbLlmPj8hGy CaJqRboAdcSDQriFhEqmdYUCrNDChl98afSVVUmKrLD/rmX/k7Gtj0Fva98pVBP/itU= X-Gm-Gg: ASbGncsMjvRpTb483YFCXpi3pW4ffZjWSceDQDrNAOJbLpnOIbyqeW770KI5Mi/wleb UPsYdmtEtyysdjFqGYgGCNfWjpB+XPstk+OWL4Btay3hATrp26zVxg6F5mkRzfW8ldlI7gZaKE1 BrAe9kTndHVGDbibWTpLsmdlKDgI9ZQiZ51Au6LPvAe696RSbAcwZIB2klYkJuDuMCoR7URgc2z wuJ/nuwGbxktQSZP3wFnN8cgiffYO+oim/SoG1frJh1BGrDcNqNc9Wt50NecS+a/IOk6k+f4ms0 AHjLad5F8CMMaWG/PWqv61GFI/su82l75ho1CIeU98/tNVnkynkXLu5us11y9VU= X-Google-Smtp-Source: AGHT+IGKFxBc0IKymfZi5lAnMERXh0IK39138Ys1k2mAGPuaM7raXlDl5uXk0t2RD2aR7HbSKEKSAA== X-Received: by 2002:a05:6402:2685:b0:60c:461e:7199 with SMTP id 4fb4d7f45d1cf-60e52cd31d5mr1816202a12.9.1751453024506; Wed, 02 Jul 2025 03:43:44 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Rowan Hart , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Julian Ganz , Pierrick Bouvier , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 05/15] gdbstub: Expose gdb_write_register function to consumers of gdbstub Date: Wed, 2 Jul 2025 11:43:26 +0100 Message-ID: <20250702104336.3775206-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250702104336.3775206-1-alex.bennee@linaro.org> References: <20250702104336.3775206-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::52a; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x52a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, T_SPF_HELO_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751453205522116600 From: Rowan Hart This patch exposes the gdb_write_register function from gdbstub/gdbstub.c via the exec/gdbstub.h header file to support use in plugins to write register contents. Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Julian Ganz Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart Message-ID: <20250624175351.440780-2-rowanbhart@gmail.com> Signed-off-by: Alex Benn=C3=A9e Message-ID: <20250627112512.1880708-6-alex.bennee@linaro.org> diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h index 0675b0b646..a16c0051ce 100644 --- a/include/exec/gdbstub.h +++ b/include/exec/gdbstub.h @@ -124,6 +124,20 @@ const GDBFeature *gdb_find_static_feature(const char *= xmlname); */ int gdb_read_register(CPUState *cpu, GByteArray *buf, int reg); =20 +/** + * gdb_write_register() - Write a register associated with a CPU. + * @cpu: The CPU associated with the register. + * @buf: The buffer that the register contents will be set to. + * @reg: The register's number returned by gdb_find_feature_register(). + * + * The size of @buf must be at least the size of the register being + * written. + * + * Return: The number of written bytes, or 0 if an error occurred (for + * example, an unknown register was provided). + */ +int gdb_write_register(CPUState *cpu, uint8_t *mem_buf, int reg); + /** * typedef GDBRegDesc - a register description from gdbstub */ diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index def0b7e877..dd5fb5667c 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -535,7 +535,7 @@ int gdb_read_register(CPUState *cpu, GByteArray *buf, i= nt reg) return 0; } =20 -static int gdb_write_register(CPUState *cpu, uint8_t *mem_buf, int reg) +int gdb_write_register(CPUState *cpu, uint8_t *mem_buf, int reg) { GDBRegisterState *r; =20 --=20 2.47.2 From nobody Sat Nov 15 12:15:02 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=1751453171; cv=none; d=zohomail.com; s=zohoarc; b=Aenyw8WxYz80crj1Z10qvUXY6CN4OW5CaUuES6ZkbEEaE+5TbUyNfs53ncF63umKnCUvCzqpTJ4hsfL376cEtg/HYsTvPZ+N7OZBGGw6yXNA+zWhBV2eCfH78mCe0bGRF9hkTOpNLGPzmpceNVdupnGq6UQbhSyFE5e9W98Dr08= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751453171; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=kaLVJH5otwR+otl8BtaHu4M3HmdksGlIfafwyt6VO9Q=; b=Wrsq0JQO6D246OSzjc1uqbATIRODF8zzdSXZDDkVTUI5miPtWk9vL2IdYK4bWMo0kr6koOH+9ZHlVqLk0GZdUo+JaDLi+FZnpBUawH8i7+0cZyLgfubAUMcoDLJE7uKCl3PnjipksnFcuJg2/PinZdWgTSp2MqCPYVhGuE2bhbg= 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 1751453171537462.7294486414652; Wed, 2 Jul 2025 03:46:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWuwl-0006kv-Q1; Wed, 02 Jul 2025 06:44:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWuwU-0006eQ-HJ for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:43:55 -0400 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWuwL-0001JM-Pf for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:43:52 -0400 Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-ade76b8356cso812972766b.2 for ; Wed, 02 Jul 2025 03:43:45 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ae353c6beb8sm1060962966b.132.2025.07.02.03.43.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jul 2025 03:43:41 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 58BBB5F8DC; Wed, 02 Jul 2025 11:43:37 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751453024; x=1752057824; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kaLVJH5otwR+otl8BtaHu4M3HmdksGlIfafwyt6VO9Q=; b=U0I/Pjw4yQ+qGpnQ00Um23qEiFY2d76dZWe4YSdq7lR4fZOg8+YhCAfEIXqUPvOHIy M6HqpMGLnftFNBbf7SKAtcgF7mcKMi7FK6H7lUsJ2VfWc/SBO4vQWqLjirc4rZK0OOSc oMSQ8R7FADGrzePvfE1vKBn3H5h8JEOeLIVNX3u9HPniGYSPyy+LjIDuca3bWaGZ/G3X k+a/WXGt9QEig9qLktnplwnPDXyiRBf2Hz5hOnqi6ixz6DwetiKKC0mvupuutjwsSjLk zqIoih9/Ee5WglvFVzu0+XmWDCX0hibBM1THSZt6H29cRrmXBM1yrsTbCKG7rOs/yw/q 4C+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751453024; x=1752057824; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kaLVJH5otwR+otl8BtaHu4M3HmdksGlIfafwyt6VO9Q=; b=CuggZoOQ42CLAIPipI6KS1WxoxgYw3wV9pGEFpHON5lktxkJEnGpWk6XF607AsPQBJ KRBhOim3m1RWd/2yJDJoJEGdriGp6u8cxdW6FlY65ek6nDaV69p0H5ZZqkMmqtWj+2HN kRkmfh29U7hmA/L8iJxkOAhndxy5HEMzh0pB9+TWg8gATzhxuAr1N5TVocbOre2d3fXv LlDkWF081ly9XsIpI9ZKxVeL11EEW1Laux/lEYvjWoiSxZjjuwWY/zczOaJ5RnV/DZos GBuZS4mwTNaY+MyNag7iHDojPOcAis8EVMpH+E8UmOwI7Xbdba3d/T0RdciJDhTZ638X TlXw== X-Gm-Message-State: AOJu0YwPVEGUhFsR/mSRFF5IKUy+wbzegDtfm0W48GcjHfnTsd9SZIQh ANGUlgan8MZZnPGCEtUxAbv2cFGcQza3oKKw/C4jhMRwy/aCgk+8/2GUzmUnRKU+m/I= X-Gm-Gg: ASbGncueipyyiHRH1sm25YkYh3r35LPoMZWM85sg9A3uPgnX6spKWdp/dgAYj69rARr HZxDwdBCcz/trYThxNvcXGe8W+H8C/EQZcHbuqSZ10xGXB6yO701YACLU++9m2p3ehzyDXo4OLY WP226aBgCHtxBzefIKjbr51bgO76hi1mCuxbctWW/LSO+AfdRLqVvjkaELcISNyeJSWUqnLNsAJ Xy2c+Akss6+1LI3P0KWZsy6S/SQXJMG0qj2hH1vk6yOkeqN1+Qyy75Wr41vmXvmv2Nve3t5IJO9 Rjdt6SRGHCdGjeTX2Mu93gBxSxVGgOI0utQ6nmAIigFc5TPogXeUIAS86qpDeSg= X-Google-Smtp-Source: AGHT+IGfG0hqmHObkpn85ZZexJNP5SCrV/mcs4v1eRzc/oedO5BMRQv7ZewlZzWk+d4N2IIgF9fuRQ== X-Received: by 2002:a17:906:dc93:b0:ae3:b22c:2ee3 with SMTP id a640c23a62f3a-ae3c2dc4229mr235042366b.31.1751453023745; Wed, 02 Jul 2025 03:43:43 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Rowan Hart , Pierrick Bouvier , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Alexandre Iooss , Mahmoud Mandour Subject: [PULL 06/15] plugins: Add register write API Date: Wed, 2 Jul 2025 11:43:27 +0100 Message-ID: <20250702104336.3775206-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250702104336.3775206-1-alex.bennee@linaro.org> References: <20250702104336.3775206-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::633; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x633.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751453173222116600 From: Rowan Hart This patch adds a function to the plugins API to allow plugins to write register contents. It also moves the qemu_plugin_read_register function so all the register-related functions are grouped together in the file. Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart Message-ID: <20250624175351.440780-3-rowanbhart@gmail.com> Signed-off-by: Alex Benn=C3=A9e Message-ID: <20250627112512.1880708-7-alex.bennee@linaro.org> diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h index 3a850aa216..cfe1692ecb 100644 --- a/include/qemu/qemu-plugin.h +++ b/include/qemu/qemu-plugin.h @@ -871,7 +871,8 @@ struct qemu_plugin_register; /** * typedef qemu_plugin_reg_descriptor - register descriptions * - * @handle: opaque handle for retrieving value with qemu_plugin_read_regis= ter + * @handle: opaque handle for retrieving value with qemu_plugin_read_regis= ter or + * writing value with qemu_plugin_write_register * @name: register name * @feature: optional feature descriptor, can be NULL */ @@ -893,6 +894,41 @@ typedef struct { QEMU_PLUGIN_API GArray *qemu_plugin_get_registers(void); =20 +/** + * qemu_plugin_read_register() - read register for current vCPU + * + * @handle: a @qemu_plugin_reg_handle handle + * @buf: A GByteArray for the data owned by the plugin + * + * This function is only available in a context that register read access = is + * explicitly requested via the QEMU_PLUGIN_CB_R_REGS flag. + * + * Returns the size of the read register. The content of @buf is in target= byte + * order. On failure returns -1. + */ +QEMU_PLUGIN_API +int qemu_plugin_read_register(struct qemu_plugin_register *handle, + GByteArray *buf); + +/** + * qemu_plugin_write_register() - write register for current vCPU + * + * @handle: a @qemu_plugin_reg_handle handle + * @buf: A GByteArray for the data owned by the plugin + * + * This function is only available in a context that register write access= is + * explicitly requested via the QEMU_PLUGIN_CB_RW_REGS flag. + * + * The size of @buf must be at least the size of the requested register. + * Attempting to write a register with @buf smaller than the register size + * will result in a crash or other undesired behavior. + * + * Returns the number of bytes written. On failure returns 0. + */ +QEMU_PLUGIN_API +int qemu_plugin_write_register(struct qemu_plugin_register *handle, + GByteArray *buf); + /** * qemu_plugin_read_memory_vaddr() - read from memory using a virtual addr= ess * @@ -915,22 +951,6 @@ QEMU_PLUGIN_API bool qemu_plugin_read_memory_vaddr(uint64_t addr, GByteArray *data, size_t len); =20 -/** - * qemu_plugin_read_register() - read register for current vCPU - * - * @handle: a @qemu_plugin_reg_handle handle - * @buf: A GByteArray for the data owned by the plugin - * - * This function is only available in a context that register read access = is - * explicitly requested via the QEMU_PLUGIN_CB_R_REGS flag. - * - * Returns the size of the read register. The content of @buf is in target= byte - * order. On failure returns -1. - */ -QEMU_PLUGIN_API -int qemu_plugin_read_register(struct qemu_plugin_register *handle, - GByteArray *buf); - /** * qemu_plugin_scoreboard_new() - alloc a new scoreboard * diff --git a/plugins/api.c b/plugins/api.c index 3c9d4832e9..6514f2c76a 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -433,6 +433,25 @@ GArray *qemu_plugin_get_registers(void) return create_register_handles(regs); } =20 +int qemu_plugin_read_register(struct qemu_plugin_register *reg, GByteArray= *buf) +{ + g_assert(current_cpu); + + return gdb_read_register(current_cpu, buf, GPOINTER_TO_INT(reg) - 1); +} + +int qemu_plugin_write_register(struct qemu_plugin_register *reg, + GByteArray *buf) +{ + g_assert(current_cpu); + + if (buf->len =3D=3D 0 || qemu_plugin_get_cb_flags() !=3D QEMU_PLUGIN_C= B_RW_REGS) { + return -1; + } + + return gdb_write_register(current_cpu, buf->data, GPOINTER_TO_INT(reg)= - 1); +} + bool qemu_plugin_read_memory_vaddr(uint64_t addr, GByteArray *data, size_t= len) { g_assert(current_cpu); @@ -453,13 +472,6 @@ bool qemu_plugin_read_memory_vaddr(uint64_t addr, GByt= eArray *data, size_t len) return true; } =20 -int qemu_plugin_read_register(struct qemu_plugin_register *reg, GByteArray= *buf) -{ - g_assert(current_cpu); - - return gdb_read_register(current_cpu, buf, GPOINTER_TO_INT(reg) - 1); -} - struct qemu_plugin_scoreboard *qemu_plugin_scoreboard_new(size_t element_s= ize) { return plugin_scoreboard_new(element_size); --=20 2.47.2 From nobody Sat Nov 15 12:15:02 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=1751453153; cv=none; d=zohomail.com; s=zohoarc; b=WZkynUZTZgqwf7eVRO4ZgOgRoVMlrUjdJGgjTFPsOj3tXq6w01QCDl0/jdN4XVWdf5tbDk6bUO9pb0cQ0apLkr7JXsMAP9cQjeXIM1gSuOsR0rDsTMdagA54tXk4tijjiixzdH7FgFV9exM978qaXFtgRLDurs/t7bVZsomhtaU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751453153; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=9uKeRyX0ZAy/lXFW0B3T0haqZQUnDaXH59uMD4XA+u4=; b=dFXLMZNcmvOcpknhnKj+lpx+vhsVPxt2xZpGDunwSY0gaaENDUFIOMwSjLstYNetwvjzi1GoR0Nb3iywPrLk9MYMzw3P9J28GJMZSmx3P+dg4KxZlJzQuoJlM7DdiPeqwu/EiCEXYnnqbNEmpmxmfUgQxOs5UXMAYFUWs4StJs4= 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 175145315318161.84939384793563; Wed, 2 Jul 2025 03:45:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWuwi-0006hf-Vd; Wed, 02 Jul 2025 06:44:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWuwZ-0006g6-HZ for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:44:01 -0400 Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWuwO-0001Jg-Q7 for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:43:58 -0400 Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-ae0de0c03e9so999816966b.2 for ; Wed, 02 Jul 2025 03:43:47 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ae353ca20f3sm1070440866b.175.2025.07.02.03.43.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jul 2025 03:43:42 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 7E4905F8E1; Wed, 02 Jul 2025 11:43:37 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751453026; x=1752057826; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9uKeRyX0ZAy/lXFW0B3T0haqZQUnDaXH59uMD4XA+u4=; b=mDF7m/Z8TCyx02eidqiOz4JPw+S9gDWhqdRJmXmoasL9f+B+zCPwZjrZi4OoD71YxY zsaelsTfuukOwNbNNIXM8coBfOHjyzs1Gfuh25FeNle8Qlu8gHsXn1bFZIBgT3X2AfXE mgckfx4H/RLb+eCCAk5CKq5heeyLaTZRWtwc6cAbBE2BDNM5+Robhmd7rb+yzLsyQPta Ox1MbWND1fKsytbS7QTmSIKCs0kEI9oPCXht+xqvgc7iXeJj89pdGL9/RShJPaykc+zf vBLjaFjYE142oihplzjp8yI2bSEc7/2TN7Zsv9mwHXU+ONIHiQ73i133vGj7Lg+I7GGz +j9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751453026; x=1752057826; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9uKeRyX0ZAy/lXFW0B3T0haqZQUnDaXH59uMD4XA+u4=; b=ihqikOUhGgcrSR92bQ6631clXRjL4DtaMPXSwaExRHie9fu4jMMbByc5A0yqslJqiV kPBX5TSCGgWxDrgdiPz1lXiYzGn8j3wQgQp5UKOfYdq6M78E4fqYqRR8Ek3fIqhQ0Jx3 0URHqEj/+E/ELWqhKMyEGb82y5nev/Nxns8Jor5BSQMfpXBC/ttDiYapjCDZEOgAiZUo ToCmOO/bboIC8YLHIPNU9OI/aGDOmzEhBh1yDbB1YgPsHBykmPXYlDkggTBcEpmZRjA0 zw9KmJiBzZGQkq14IKd2qvJ6OPFsRasKmuoslLuVTeWHvVdUIlppITbwvJ1u0xeHbJCk pG8g== X-Gm-Message-State: AOJu0YyGLF9bH7wg4G1SIA6uxkkRaii0tYOq8NyAuvR3uy7MvI/1FUqG yMME+FYy8FFWmrNPKGnQEduczeIDQTA5jmzx2U+TMIuHEwPFpEOsA4W3CNj0NzT+6Qs= X-Gm-Gg: ASbGncsvgzWLN/FSCVvjE0tdQoko32H6UgEZp0OVDiRo6Sf4he9QSuEuwhOhZpZPUB6 bMkeb6sS82Gq8EC4uo6FUJ58jkpyGTORKE+WuRfMutq7Fcv+o1PrHEk6e6kBFXVSnxn1kICX0vC /ag1G7XrNofrCsrvum4QyZi9c3/RJrKW+lNfGuFRGP6H7bgLLrv8pdR7RCGpEXkOXjNwkbPplX4 p8Aq7LT7ZK8NLpGgfNz5Z1F/lF3UBVCK1ptA7Zslk3ILQwMBmSrsFNRqybZ3PnCrBSdRW06+fZe 4aL55GcQG9kzBHUuYMFCZB1dL9jGC2JumZPS8gPcJQMbQ1hCZ6nMYqCD1BNWc+E= X-Google-Smtp-Source: AGHT+IH08KFyt1QrH+kWtQvTlOQoKGsQ2Xb2L01kSAiyaU+f8b9RE8MU6HrFItjp7jUitTOdrT0Etg== X-Received: by 2002:a17:907:9495:b0:ae3:6cc8:e431 with SMTP id a640c23a62f3a-ae3c2db00cemr238437366b.57.1751453025500; Wed, 02 Jul 2025 03:43:45 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Rowan Hart , Pierrick Bouvier , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson , Paolo Bonzini , Eduardo Habkost , Marcel Apfelbaum , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Yanan Wang , Zhao Liu , Alexandre Iooss , Mahmoud Mandour Subject: [PULL 07/15] plugins: Add enforcement of QEMU_PLUGIN_CB flags in register R/W callbacks Date: Wed, 2 Jul 2025 11:43:28 +0100 Message-ID: <20250702104336.3775206-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250702104336.3775206-1-alex.bennee@linaro.org> References: <20250702104336.3775206-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::632; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x632.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: 1751453155078116600 From: Rowan Hart This patch adds functionality to enforce the requested QEMU_PLUGIN_CB_ flags level passed when registering a callback function using the plugins API. Each time a callback is about to be invoked, a thread-local variable will be updated with the level that callback requested. Then, called API functions (in particular, the register read and write API) will call qemu_plugin_get_cb_flags() to check the level is at least the level they require. Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart Message-ID: <20250624175351.440780-4-rowanbhart@gmail.com> Signed-off-by: Alex Benn=C3=A9e Message-ID: <20250627112512.1880708-8-alex.bennee@linaro.org> diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 33296a1c08..162a56a5da 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -368,6 +368,7 @@ typedef struct CPUNegativeOffsetState { GArray *plugin_mem_cbs; uint64_t plugin_mem_value_low; uint64_t plugin_mem_value_high; + int32_t plugin_cb_flags; #endif IcountDecr icount_decr; bool can_do_io; diff --git a/include/qemu/plugin.h b/include/qemu/plugin.h index 9726a9ebf3..f355c7cb8a 100644 --- a/include/qemu/plugin.h +++ b/include/qemu/plugin.h @@ -209,6 +209,21 @@ void qemu_plugin_user_prefork_lock(void); */ void qemu_plugin_user_postfork(bool is_child); =20 +enum qemu_plugin_cb_flags tcg_call_to_qemu_plugin_cb_flags(int flags); + +static inline void qemu_plugin_set_cb_flags(CPUState *cpu, + enum qemu_plugin_cb_flags flag= s) +{ + assert(cpu); + cpu->neg.plugin_cb_flags =3D flags; +} + +static inline enum qemu_plugin_cb_flags qemu_plugin_get_cb_flags(void) +{ + assert(current_cpu); + return current_cpu->neg.plugin_cb_flags; +} + #else /* !CONFIG_PLUGIN */ =20 static inline void qemu_plugin_add_opts(void) diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h index cfe1692ecb..9c9ebf6ce0 100644 --- a/include/qemu/qemu-plugin.h +++ b/include/qemu/qemu-plugin.h @@ -254,9 +254,6 @@ typedef struct { * @QEMU_PLUGIN_CB_NO_REGS: callback does not access the CPU's regs * @QEMU_PLUGIN_CB_R_REGS: callback reads the CPU's regs * @QEMU_PLUGIN_CB_RW_REGS: callback reads and writes the CPU's regs - * - * Note: currently QEMU_PLUGIN_CB_RW_REGS is unused, plugins cannot change - * system register state. */ enum qemu_plugin_cb_flags { QEMU_PLUGIN_CB_NO_REGS, @@ -901,7 +898,12 @@ GArray *qemu_plugin_get_registers(void); * @buf: A GByteArray for the data owned by the plugin * * This function is only available in a context that register read access = is - * explicitly requested via the QEMU_PLUGIN_CB_R_REGS flag. + * explicitly requested via the QEMU_PLUGIN_CB_R_REGS flag, if called insi= de a + * callback that can be registered with a qemu_plugin_cb_flags argument. T= his + * function can also be used in any callback context that does not use a f= lags + * argument, such as in a callback registered with + * qemu_plugin_register_vcpu_init_cb(), except for callbacks registered wi= th + * qemu_plugin_register_atexit_cb() and qemu_plugin_register_flush_cb(). * * Returns the size of the read register. The content of @buf is in target= byte * order. On failure returns -1. @@ -916,8 +918,13 @@ int qemu_plugin_read_register(struct qemu_plugin_regis= ter *handle, * @handle: a @qemu_plugin_reg_handle handle * @buf: A GByteArray for the data owned by the plugin * - * This function is only available in a context that register write access= is - * explicitly requested via the QEMU_PLUGIN_CB_RW_REGS flag. + * This function is only available in a context that register read access = is + * explicitly requested via the QEMU_PLUGIN_CB_RW_REGS flag, if called ins= ide a + * callback that can be registered with a qemu_plugin_cb_flags argument. T= his + * function can also be used in any callback context that does not use a f= lags + * argument, such as in a callback registered with + * qemu_plugin_register_vcpu_init_cb(), except for callbacks registered wi= th + * qemu_plugin_register_atexit_cb() and qemu_plugin_register_flush_cb(). * * The size of @buf must be at least the size of the requested register. * Attempting to write a register with @buf smaller than the register size diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c index c1da753894..9920381a84 100644 --- a/accel/tcg/plugin-gen.c +++ b/accel/tcg/plugin-gen.c @@ -117,10 +117,20 @@ static TCGv_i32 gen_cpu_index(void) static void gen_udata_cb(struct qemu_plugin_regular_cb *cb) { TCGv_i32 cpu_index =3D gen_cpu_index(); + enum qemu_plugin_cb_flags cb_flags =3D + tcg_call_to_qemu_plugin_cb_flags(cb->info->flags); + TCGv_i32 flags =3D tcg_constant_i32(cb_flags); + TCGv_i32 clear_flags =3D tcg_constant_i32(QEMU_PLUGIN_CB_NO_REGS); + tcg_gen_st_i32(flags, tcg_env, + offsetof(CPUState, neg.plugin_cb_flags) - sizeof(CPUState)); tcg_gen_call2(cb->f.vcpu_udata, cb->info, NULL, tcgv_i32_temp(cpu_index), tcgv_ptr_temp(tcg_constant_ptr(cb->userp))); + tcg_gen_st_i32(clear_flags, tcg_env, + offsetof(CPUState, neg.plugin_cb_flags) - sizeof(CPUState)); tcg_temp_free_i32(cpu_index); + tcg_temp_free_i32(flags); + tcg_temp_free_i32(clear_flags); } =20 static TCGv_ptr gen_plugin_u64_ptr(qemu_plugin_u64 entry) @@ -173,10 +183,20 @@ static void gen_udata_cond_cb(struct qemu_plugin_cond= itional_cb *cb) tcg_gen_ld_i64(val, ptr, 0); tcg_gen_brcondi_i64(cond, val, cb->imm, after_cb); TCGv_i32 cpu_index =3D gen_cpu_index(); + enum qemu_plugin_cb_flags cb_flags =3D + tcg_call_to_qemu_plugin_cb_flags(cb->info->flags); + TCGv_i32 flags =3D tcg_constant_i32(cb_flags); + TCGv_i32 clear_flags =3D tcg_constant_i32(QEMU_PLUGIN_CB_NO_REGS); + tcg_gen_st_i32(flags, tcg_env, + offsetof(CPUState, neg.plugin_cb_flags) - sizeof(CPUState)); tcg_gen_call2(cb->f.vcpu_udata, cb->info, NULL, tcgv_i32_temp(cpu_index), tcgv_ptr_temp(tcg_constant_ptr(cb->userp))); + tcg_gen_st_i32(clear_flags, tcg_env, + offsetof(CPUState, neg.plugin_cb_flags) - sizeof(CPUState)); tcg_temp_free_i32(cpu_index); + tcg_temp_free_i32(flags); + tcg_temp_free_i32(clear_flags); gen_set_label(after_cb); =20 tcg_temp_free_i64(val); @@ -210,12 +230,22 @@ static void gen_mem_cb(struct qemu_plugin_regular_cb = *cb, qemu_plugin_meminfo_t meminfo, TCGv_i64 addr) { TCGv_i32 cpu_index =3D gen_cpu_index(); + enum qemu_plugin_cb_flags cb_flags =3D + tcg_call_to_qemu_plugin_cb_flags(cb->info->flags); + TCGv_i32 flags =3D tcg_constant_i32(cb_flags); + TCGv_i32 clear_flags =3D tcg_constant_i32(QEMU_PLUGIN_CB_NO_REGS); + tcg_gen_st_i32(flags, tcg_env, + offsetof(CPUState, neg.plugin_cb_flags) - sizeof(CPUState)); tcg_gen_call4(cb->f.vcpu_mem, cb->info, NULL, tcgv_i32_temp(cpu_index), tcgv_i32_temp(tcg_constant_i32(meminfo)), tcgv_i64_temp(addr), tcgv_ptr_temp(tcg_constant_ptr(cb->userp))); + tcg_gen_st_i32(clear_flags, tcg_env, + offsetof(CPUState, neg.plugin_cb_flags) - sizeof(CPUState)); tcg_temp_free_i32(cpu_index); + tcg_temp_free_i32(flags); + tcg_temp_free_i32(clear_flags); } =20 static void inject_cb(struct qemu_plugin_dyn_cb *cb) diff --git a/plugins/api.c b/plugins/api.c index 6514f2c76a..3f04399c26 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -437,6 +437,10 @@ int qemu_plugin_read_register(struct qemu_plugin_regis= ter *reg, GByteArray *buf) { g_assert(current_cpu); =20 + if (qemu_plugin_get_cb_flags() =3D=3D QEMU_PLUGIN_CB_NO_REGS) { + return -1; + } + return gdb_read_register(current_cpu, buf, GPOINTER_TO_INT(reg) - 1); } =20 diff --git a/plugins/core.c b/plugins/core.c index eb9281fe54..c6e9ef1478 100644 --- a/plugins/core.c +++ b/plugins/core.c @@ -15,6 +15,7 @@ #include "qemu/lockable.h" #include "qemu/option.h" #include "qemu/plugin.h" +#include "qemu/qemu-plugin.h" #include "qemu/queue.h" #include "qemu/rcu_queue.h" #include "qemu/rcu.h" @@ -266,7 +267,9 @@ static void qemu_plugin_vcpu_init__async(CPUState *cpu,= run_on_cpu_data unused) plugin_grow_scoreboards__locked(cpu); qemu_rec_mutex_unlock(&plugin.lock); =20 + qemu_plugin_set_cb_flags(cpu, QEMU_PLUGIN_CB_RW_REGS); plugin_vcpu_cb__simple(cpu, QEMU_PLUGIN_EV_VCPU_INIT); + qemu_plugin_set_cb_flags(cpu, QEMU_PLUGIN_CB_NO_REGS); } =20 void qemu_plugin_vcpu_init_hook(CPUState *cpu) @@ -279,7 +282,9 @@ void qemu_plugin_vcpu_exit_hook(CPUState *cpu) { bool success; =20 + qemu_plugin_set_cb_flags(cpu, QEMU_PLUGIN_CB_RW_REGS); plugin_vcpu_cb__simple(cpu, QEMU_PLUGIN_EV_VCPU_EXIT); + qemu_plugin_set_cb_flags(cpu, QEMU_PLUGIN_CB_NO_REGS); =20 assert(cpu->cpu_index !=3D UNASSIGNED_CPU_INDEX); qemu_rec_mutex_lock(&plugin.lock); @@ -367,6 +372,7 @@ void plugin_register_dyn_cb__udata(GArray **arr, static TCGHelperInfo info[3] =3D { [QEMU_PLUGIN_CB_NO_REGS].flags =3D TCG_CALL_NO_RWG, [QEMU_PLUGIN_CB_R_REGS].flags =3D TCG_CALL_NO_WG, + [QEMU_PLUGIN_CB_RW_REGS].flags =3D 0, /* * Match qemu_plugin_vcpu_udata_cb_t: * void (*)(uint32_t, void *) @@ -396,6 +402,7 @@ void plugin_register_dyn_cond_cb__udata(GArray **arr, static TCGHelperInfo info[3] =3D { [QEMU_PLUGIN_CB_NO_REGS].flags =3D TCG_CALL_NO_RWG, [QEMU_PLUGIN_CB_R_REGS].flags =3D TCG_CALL_NO_WG, + [QEMU_PLUGIN_CB_RW_REGS].flags =3D 0, /* * Match qemu_plugin_vcpu_udata_cb_t: * void (*)(uint32_t, void *) @@ -434,6 +441,7 @@ void plugin_register_vcpu_mem_cb(GArray **arr, static TCGHelperInfo info[3] =3D { [QEMU_PLUGIN_CB_NO_REGS].flags =3D TCG_CALL_NO_RWG, [QEMU_PLUGIN_CB_R_REGS].flags =3D TCG_CALL_NO_WG, + [QEMU_PLUGIN_CB_RW_REGS].flags =3D 0, /* * Match qemu_plugin_vcpu_mem_cb_t: * void (*)(uint32_t, qemu_plugin_meminfo_t, uint64_t, void *) @@ -473,7 +481,9 @@ void qemu_plugin_tb_trans_cb(CPUState *cpu, struct qemu= _plugin_tb *tb) QLIST_FOREACH_SAFE_RCU(cb, &plugin.cb_lists[ev], entry, next) { qemu_plugin_vcpu_tb_trans_cb_t func =3D cb->f.vcpu_tb_trans; =20 + qemu_plugin_set_cb_flags(cpu, QEMU_PLUGIN_CB_RW_REGS); func(cb->ctx->id, tb); + qemu_plugin_set_cb_flags(cpu, QEMU_PLUGIN_CB_NO_REGS); } } =20 @@ -498,7 +508,9 @@ qemu_plugin_vcpu_syscall(CPUState *cpu, int64_t num, ui= nt64_t a1, uint64_t a2, QLIST_FOREACH_SAFE_RCU(cb, &plugin.cb_lists[ev], entry, next) { qemu_plugin_vcpu_syscall_cb_t func =3D cb->f.vcpu_syscall; =20 + qemu_plugin_set_cb_flags(cpu, QEMU_PLUGIN_CB_RW_REGS); func(cb->ctx->id, cpu->cpu_index, num, a1, a2, a3, a4, a5, a6, a7,= a8); + qemu_plugin_set_cb_flags(cpu, QEMU_PLUGIN_CB_NO_REGS); } } =20 @@ -520,7 +532,9 @@ void qemu_plugin_vcpu_syscall_ret(CPUState *cpu, int64_= t num, int64_t ret) QLIST_FOREACH_SAFE_RCU(cb, &plugin.cb_lists[ev], entry, next) { qemu_plugin_vcpu_syscall_ret_cb_t func =3D cb->f.vcpu_syscall_ret; =20 + qemu_plugin_set_cb_flags(cpu, QEMU_PLUGIN_CB_RW_REGS); func(cb->ctx->id, cpu->cpu_index, num, ret); + qemu_plugin_set_cb_flags(cpu, QEMU_PLUGIN_CB_NO_REGS); } } =20 @@ -528,14 +542,18 @@ void qemu_plugin_vcpu_idle_cb(CPUState *cpu) { /* idle and resume cb may be called before init, ignore in this case */ if (cpu->cpu_index < plugin.num_vcpus) { + qemu_plugin_set_cb_flags(cpu, QEMU_PLUGIN_CB_RW_REGS); plugin_vcpu_cb__simple(cpu, QEMU_PLUGIN_EV_VCPU_IDLE); + qemu_plugin_set_cb_flags(cpu, QEMU_PLUGIN_CB_NO_REGS); } } =20 void qemu_plugin_vcpu_resume_cb(CPUState *cpu) { if (cpu->cpu_index < plugin.num_vcpus) { + qemu_plugin_set_cb_flags(cpu, QEMU_PLUGIN_CB_RW_REGS); plugin_vcpu_cb__simple(cpu, QEMU_PLUGIN_EV_VCPU_RESUME); + qemu_plugin_set_cb_flags(cpu, QEMU_PLUGIN_CB_NO_REGS); } } =20 @@ -615,9 +633,13 @@ void qemu_plugin_vcpu_mem_cb(CPUState *cpu, uint64_t v= addr, switch (cb->type) { case PLUGIN_CB_MEM_REGULAR: if (rw & cb->regular.rw) { + qemu_plugin_set_cb_flags(cpu, + tcg_call_to_qemu_plugin_cb_flags(cb->regular.info->fla= gs)); + cb->regular.f.vcpu_mem(cpu->cpu_index, make_plugin_meminfo(oi, rw), vaddr, cb->regular.userp); + qemu_plugin_set_cb_flags(cpu, QEMU_PLUGIN_CB_NO_REGS); } break; case PLUGIN_CB_INLINE_ADD_U64: @@ -760,3 +782,14 @@ void plugin_scoreboard_free(struct qemu_plugin_scorebo= ard *score) g_array_free(score->data, TRUE); g_free(score); } + +enum qemu_plugin_cb_flags tcg_call_to_qemu_plugin_cb_flags(int flags) +{ + if (flags & TCG_CALL_NO_RWG) { + return QEMU_PLUGIN_CB_NO_REGS; + } else if (flags & TCG_CALL_NO_WG) { + return QEMU_PLUGIN_CB_R_REGS; + } else { + return QEMU_PLUGIN_CB_RW_REGS; + } +} --=20 2.47.2 From nobody Sat Nov 15 12:15:02 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=1751453147; cv=none; d=zohomail.com; s=zohoarc; b=drL+k1udHaZkbsyURVxzhuntW+k5AP//bvElM1M6TWxe7spK/KnbjfU4HJS3KwB6wMSTDuHElfTYNcHAHnrs5pGovIawml35CpBuLGvt19P7KKWn+Jm4bSrwx8LsRyPGBfzdlJX6Tchx06BOH8SAJsYiK4gOTF75rdruj/P7PFg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751453147; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=jz2+qC8xETuWCBtFi38dLbw9y0bYYX3IVoNM5Sk2/QI=; b=nBBAXRnQj3gFH54cs6z/ZAVbLMsJWOgzIg7QpuPR69iVN3ZY5lBk+vPFhzLHq5deVMqYFUQsIpluVEueG/ex4J68QNuxo/eZy9CxbVqu5DC0qLFVTdsT1O5RGsphmFr4/s9PgeF+Efnouyb75tDkALto3onv3p8WtsD55VvLYfE= 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 1751453147596842.3573313597051; Wed, 2 Jul 2025 03:45:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWuwl-0006kC-CV; Wed, 02 Jul 2025 06:44:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWuwY-0006g8-Mo for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:43:59 -0400 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWuwR-0001KT-1q for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:43:58 -0400 Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-6097d144923so13717720a12.1 for ; Wed, 02 Jul 2025 03:43:50 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-60c8292076csm8710186a12.32.2025.07.02.03.43.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jul 2025 03:43:42 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 97CB35F8F1; Wed, 02 Jul 2025 11:43:37 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751453029; x=1752057829; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jz2+qC8xETuWCBtFi38dLbw9y0bYYX3IVoNM5Sk2/QI=; b=o/iimxjJLB6zvjtrKVVvHkSd7vAQnIQr3Pz+pJc0WN22s0QhUcdwN3LnQWRGLhrRxr nF9K/efIF3QDI0OVFqqr42bcDSi14qwIKuovXvufBHZutp0eJWm//2trScmiEsEMHEc/ tKAj22N5YPX3q44/asm3i1Ym2NG7NTay7d495EQMWqo2kEGhCOhJdPQnwyjuLDkSCHO4 L6zGKmZDxdBHYkvR3CCP8CBhD/bYPYaImpvG8JWKh9grhVW+dN712dO+c7ZlQ1vk5J9l ymbWfPYeLpuAgXwCrn+TwFoOmCqlB6AbAMDX+ywi9Lu69Wu/B7nc1Ftue0r0Tjj9tsiN +9YQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751453029; x=1752057829; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jz2+qC8xETuWCBtFi38dLbw9y0bYYX3IVoNM5Sk2/QI=; b=EmxDYUWtbX1+QdtleYGgUqx0tUKKJvRk87m8s44eXBfSDJo/iOEehlFQgZm8x64yGH 7oGj6s0RC1Odu/NOFpU6LlJ4WXV6iIRz55rO79aCb+mdALmY03+31RdXkm2d6GiX5o7A 9a+ZFiBEOvwmqQ3L8F25rOR57Ru0k4xmMVvR2sIUsl8UTXmBtd+/nhi/B45zehuuljNc Qua0OiHqrypa0BWaAXlPwD+UHtcdVLL9QWFAZAGUgToatP3zywkcx8LQjE+dVJHFsqjE 5bj41Qo59ZiAysU+DYj3vNJ/mRFGve3D24MOvzxJAWddZzXdPey5teygTkiZ1/L0lLZB rypg== X-Gm-Message-State: AOJu0Yxi5TEnYAAArwMv26bru9B7+ZXW8w10+8Eij1rF+evBOMNWpfn1 /+LVwJrrAUX3vHMn7UvEecvkTcq35ILDy5cUbnXs1RCE2h5bX+O4boIJdvAurFMNN60= X-Gm-Gg: ASbGncuHO5HbiN95270zGKXNSt03A0pvCkvHylhgN53rR6Kb3FewXHZ+D+SywmTu48C q4j31/66bSXtuZ6+ZaplTcES7h9d8JwgLeTIX3C5pQA3Q9ZY+Fy+OyiyO2LioRjOfNrrLUKzKht rPfQd91EpY7EaCI8CnGD7YCpQynsysakK+YHMZXmTfw7KYp1U0l9mYagm3TNQFmNQEbVia3nwJY S4eA7yHHKIYpn4mUMthoShn6zL0RV6Eg/zfBObRq2VE9wD2iuMwJgqqcXsNNeUf5pncfk2G7tXY zWSHBB0xAkhGeYbPrEEAab7cNlELvLv3xR6wuYX4+jjDK/ZoXV710xESTd5/mZs= X-Google-Smtp-Source: AGHT+IEWtBw0UfgHdFmYSDqnUEUJZwm8dm1g74p/VYPFonJoYROlca2QAaOwLA/bBEpbTVU33M+fwg== X-Received: by 2002:a05:6402:51d3:b0:608:f816:1f88 with SMTP id 4fb4d7f45d1cf-60e544eda9amr1975753a12.6.1751453028768; Wed, 02 Jul 2025 03:43:48 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Rowan Hart , Pierrick Bouvier , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Alexandre Iooss , Mahmoud Mandour Subject: [PULL 08/15] plugins: Add memory virtual address write API Date: Wed, 2 Jul 2025 11:43:29 +0100 Message-ID: <20250702104336.3775206-9-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250702104336.3775206-1-alex.bennee@linaro.org> References: <20250702104336.3775206-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::534; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x534.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751453148926116600 From: Rowan Hart This patch adds functions to the plugins API to allow reading and writing memory via virtual addresses. These functions only permit doing so on the current CPU, because there is no way to ensure consistency if plugins are allowed to read or write to other CPUs that aren't currently in the context of the plugin. Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart Message-ID: <20250624175351.440780-5-rowanbhart@gmail.com> Signed-off-by: Alex Benn=C3=A9e Message-ID: <20250627112512.1880708-9-alex.bennee@linaro.org> diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h index 9c9ebf6ce0..4167c46c2a 100644 --- a/include/qemu/qemu-plugin.h +++ b/include/qemu/qemu-plugin.h @@ -958,6 +958,27 @@ QEMU_PLUGIN_API bool qemu_plugin_read_memory_vaddr(uint64_t addr, GByteArray *data, size_t len); =20 +/** + * qemu_plugin_write_memory_vaddr() - write to memory using a virtual addr= ess + * + * @addr: A virtual address to write to + * @data: A byte array containing the data to write + * + * The contents of @data will be written to memory starting at the virtual + * address @addr. + * + * This function does not guarantee consistency of writes, nor does it ens= ure + * that pending writes are flushed either before or after the write takes = place, + * so callers should take care to only call this function in vCPU context = (i.e. + * in callbacks) and avoid depending on the existence of data written usin= g this + * function which may be overwritten afterward. + * + * Returns true on success and false on failure. + */ +QEMU_PLUGIN_API +bool qemu_plugin_write_memory_vaddr(uint64_t addr, + GByteArray *data); + /** * qemu_plugin_scoreboard_new() - alloc a new scoreboard * diff --git a/plugins/api.c b/plugins/api.c index 3f04399c26..1f64a9ea64 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -476,6 +476,24 @@ bool qemu_plugin_read_memory_vaddr(uint64_t addr, GByt= eArray *data, size_t len) return true; } =20 +bool qemu_plugin_write_memory_vaddr(uint64_t addr, GByteArray *data) +{ + g_assert(current_cpu); + + if (data->len =3D=3D 0) { + return false; + } + + int result =3D cpu_memory_rw_debug(current_cpu, addr, data->data, + data->len, true); + + if (result < 0) { + return false; + } + + return true; +} + struct qemu_plugin_scoreboard *qemu_plugin_scoreboard_new(size_t element_s= ize) { return plugin_scoreboard_new(element_size); --=20 2.47.2 From nobody Sat Nov 15 12:15:02 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=1751453139; cv=none; d=zohomail.com; s=zohoarc; b=HeRih0aR4LtI8D5Hci3IJmTEmxr/Mg7JOz+D3w87sKCSjnO43o4bH03ofrON/ckeXFkcnM7kse4ei/ckpvmBKM3w72WMsr8sRDJ7GqikO3RJq1HXaLy6/l1Dt3o9fRGa7eoi1FFOdVNTLTMylIQn6gOg9nQbboYIWKbK/QEQYMo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751453139; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=f8Jt4664qtDHEeSxPHU9UkVhjqAuRPFvBiOKbwQQWMA=; b=LGRZfjenIbBc8cjT6/3/rvmd0y/Sl5zePp7soA+2gD/HMCm6c8PGx6nfyIsZJdAKcSuOpdXLSnsJ+gEUlTRoqII0WTX7kEmng9t51Aq7CxvzC48x2BEg+zoF8mtWwIAtd/S088q4tVfLlmpkpI48xL6vTCH2jHU4ooUzoyWuGao= 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 175145313975221.08548304857277; Wed, 2 Jul 2025 03:45:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWuwm-0006lr-QV; Wed, 02 Jul 2025 06:44:12 -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 1uWuwe-0006hP-Ns for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:44:05 -0400 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWuwR-0001Jw-6O for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:44:03 -0400 Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-ae35f36da9dso859961866b.0 for ; Wed, 02 Jul 2025 03:43:48 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ae353659fdesm1064493566b.69.2025.07.02.03.43.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jul 2025 03:43:42 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id AF6555F8F3; Wed, 02 Jul 2025 11:43:37 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751453027; x=1752057827; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=f8Jt4664qtDHEeSxPHU9UkVhjqAuRPFvBiOKbwQQWMA=; b=UdsvrR1xlZ7zPgC0qVtswAUAc93LlAlUxcMSVI19KB1AUwid/0HPGZ94Yle+bBK31j NMFh73VvA93RaWWjrlth0JdHYGTd9/ddbZmVAIZJMWaxQq9eN+jsoF8u48geFa0zQox/ A9Qxe67rsJVw/y/okacBLgPaz6kHK+4LiK1PhYN05xv2LTucyNlWwIZFd0yHeXfs+rIv WVmSDSpmeCy1Od2s3d+FOBxWloLrQNh3Zw5SWfjPEsvjjFAwl5y1gI+YpG0aIsK3uPEO 0NwYd6PvE7MXpsvMII0oEqs1PGTVGS9bZLPU5kFnWXb1LJwDkoxcLwGz1hXLchY2mtuJ IrPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751453027; x=1752057827; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=f8Jt4664qtDHEeSxPHU9UkVhjqAuRPFvBiOKbwQQWMA=; b=CdxZXY613avgUAFlqMSGN3bMhnBs50HLrKrhZWM2m1np3VizsG8FTBljVtzUylQevQ bE8v+R4Nre0KnanzhWZdXIfXeVDBgaqXVMDe/CrTkfBh79DjY7sZ8KOWd03/fCOsBBoT S3l+UBaa8MD7F7lwt2uCHWmrEkWOPBqcD6JcCry4zBPSMJtFkO7WSAWOg4m/KfjfCCYV dnTGiDVNJh06UO1oxQzXOtqGOUQOIYH79mS6AyGX5nwiP29wdgYukFqckRVnBOa5VvMr jdoGiz2nCphMc36GdP9VUCglS6Xfk1/v4m0kWl4M+XbKpMsGAgzLNeF1o56NC81uHF0n mPmA== X-Gm-Message-State: AOJu0YzFVer2pZgL3cm7sxcHOPgo9Kzlh7Uut88KNRrNRKfYEx0DDCXc Sj3P5zqqWo4kxLruLNBIYFm0LVEYJkvQH1ZNuydYIdUzxyDoxjj9iA7/7E7ANMT+ba0IsJcoED5 7rKQPfxw= X-Gm-Gg: ASbGnctC69hz5BVu6pUojPcFHSKuC4bMskUnUFXmwcl5a5b70BoxDuvP77Xc2ACLTL/ JhG3ByHOAUgr9Qjm8Rz0M2zZ+6alcCR3pdF6AfMFLspiJegArnFJh7NNV/OkQ82wCXe9NqC/SE8 5Vqw0lWftrgjGpTIH9Ej8hnpGjti+ATddOvXsxB6/BwqDaS82cGM5pIfl+TpKB7CySZw66nPAVA ReeJSDhEpupC150F26nugXsBImm7+8rfe4LhA0zV3u6+2++KQ0CmPyVhmU5T4/h4YF0D7k4XnSA yeIONkF1CQXAyWb65IdRH+F1t5/4MTUIZ6mvPkOlKixaj+3UpUjIUhacQrUinnVRrv04TQE5EQ= = X-Google-Smtp-Source: AGHT+IEgwdF3E8PekXYu26dmtcPgYMLJk1M2I5aa/cyngx5k+BHob4iPED2fxkH0QZBYQNqXdvLqGA== X-Received: by 2002:a17:907:da5:b0:ae3:61e8:c6a8 with SMTP id a640c23a62f3a-ae3c29672ffmr237896266b.0.1751453027219; Wed, 02 Jul 2025 03:43:47 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Rowan Hart , Pierrick Bouvier , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Alexandre Iooss , Mahmoud Mandour Subject: [PULL 09/15] plugins: Add memory hardware address read/write API Date: Wed, 2 Jul 2025 11:43:30 +0100 Message-ID: <20250702104336.3775206-10-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250702104336.3775206-1-alex.bennee@linaro.org> References: <20250702104336.3775206-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::630; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x630.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751453141048116600 From: Rowan Hart This patch adds functions to the plugins API to allow plugins to read and write memory via hardware addresses. The functions use the current address space of the current CPU in order to avoid exposing address space information to users. A later patch may want to add a function to permit a specified address space, for example to facilitate architecture-specific plugins that want to operate on them, for example reading ARM secure memory. Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart Message-ID: <20250624175351.440780-6-rowanbhart@gmail.com> Signed-off-by: Alex Benn=C3=A9e Message-ID: <20250627112512.1880708-10-alex.bennee@linaro.org> diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h index 4167c46c2a..5eecdccc67 100644 --- a/include/qemu/qemu-plugin.h +++ b/include/qemu/qemu-plugin.h @@ -979,6 +979,99 @@ QEMU_PLUGIN_API bool qemu_plugin_write_memory_vaddr(uint64_t addr, GByteArray *data); =20 +/** + * enum qemu_plugin_hwaddr_operation_result - result of a memory operation + * + * @QEMU_PLUGIN_HWADDR_OPERATION_OK: hwaddr operation succeeded + * @QEMU_PLUGIN_HWADDR_OPERATION_ERROR: unexpected error occurred + * @QEMU_PLUGIN_HWADDR_OPERATION_DEVICE_ERROR: error in memory device + * @QEMU_PLUGIN_HWADDR_OPERATION_ACCESS_DENIED: permission error + * @QEMU_PLUGIN_HWADDR_OPERATION_INVALID_ADDRESS: address was invalid + * @QEMU_PLUGIN_HWADDR_OPERATION_INVALID_ADDRESS_SPACE: invalid address sp= ace + */ +enum qemu_plugin_hwaddr_operation_result { + QEMU_PLUGIN_HWADDR_OPERATION_OK, + QEMU_PLUGIN_HWADDR_OPERATION_ERROR, + QEMU_PLUGIN_HWADDR_OPERATION_DEVICE_ERROR, + QEMU_PLUGIN_HWADDR_OPERATION_ACCESS_DENIED, + QEMU_PLUGIN_HWADDR_OPERATION_INVALID_ADDRESS, + QEMU_PLUGIN_HWADDR_OPERATION_INVALID_ADDRESS_SPACE, +}; + +/** + * qemu_plugin_read_memory_hwaddr() - read from memory using a hardware ad= dress + * + * @addr: The physical address to read from + * @data: A byte array to store data into + * @len: The number of bytes to read, starting from @addr + * + * @len bytes of data is read from the current memory space for the current + * vCPU starting at @addr and stored into @data. If @data is not large eno= ugh to + * hold @len bytes, it will be expanded to the necessary size, reallocatin= g if + * necessary. @len must be greater than 0. + * + * This function does not ensure writes are flushed prior to reading, so + * callers should take care when calling this function in plugin callbacks= to + * avoid attempting to read data which may not yet be written and should u= se + * the memory callback API instead. + * + * This function is only valid for softmmu targets. + * + * Returns a qemu_plugin_hwaddr_operation_result indicating the result of = the + * operation. + */ +QEMU_PLUGIN_API +enum qemu_plugin_hwaddr_operation_result +qemu_plugin_read_memory_hwaddr(uint64_t addr, GByteArray *data, size_t len= ); + +/** + * qemu_plugin_write_memory_hwaddr() - write to memory using a hardware ad= dress + * + * @addr: A physical address to write to + * @data: A byte array containing the data to write + * + * The contents of @data will be written to memory starting at the hardware + * address @addr in the current address space for the current vCPU. + * + * This function does not guarantee consistency of writes, nor does it ens= ure + * that pending writes are flushed either before or after the write takes = place, + * so callers should take care when calling this function in plugin callba= cks to + * avoid depending on the existence of data written using this function wh= ich + * may be overwritten afterward. In addition, this function requires that = the + * pages containing the address are not locked. Practically, this means th= at you + * should not write instruction memory in a current translation block insi= de a + * callback registered with qemu_plugin_register_vcpu_tb_trans_cb. + * + * You can, for example, write instruction memory in a current translation= block + * in a callback registered with qemu_plugin_register_vcpu_tb_exec_cb, alt= hough + * be aware that the write will not be flushed until after the translation= block + * has finished executing. In general, this function should be used to wr= ite + * data memory or to patch code at a known address, not in a current trans= lation + * block. + * + * This function is only valid for softmmu targets. + * + * Returns a qemu_plugin_hwaddr_operation_result indicating the result of = the + * operation. + */ +QEMU_PLUGIN_API +enum qemu_plugin_hwaddr_operation_result +qemu_plugin_write_memory_hwaddr(uint64_t addr, GByteArray *data); + +/** + * qemu_plugin_translate_vaddr() - translate virtual address for current v= CPU + * + * @vaddr: virtual address to translate + * @hwaddr: pointer to store the physical address + * + * This function is only valid in vCPU context (i.e. in callbacks) and is = only + * valid for softmmu targets. + * + * Returns true on success and false on failure. + */ +QEMU_PLUGIN_API +bool qemu_plugin_translate_vaddr(uint64_t vaddr, uint64_t *hwaddr); + /** * qemu_plugin_scoreboard_new() - alloc a new scoreboard * diff --git a/plugins/api.c b/plugins/api.c index 1f64a9ea64..eac04cc1f6 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -39,6 +39,7 @@ #include "qemu/main-loop.h" #include "qemu/plugin.h" #include "qemu/log.h" +#include "system/memory.h" #include "tcg/tcg.h" #include "exec/gdbstub.h" #include "exec/target_page.h" @@ -494,6 +495,102 @@ bool qemu_plugin_write_memory_vaddr(uint64_t addr, GB= yteArray *data) return true; } =20 +enum qemu_plugin_hwaddr_operation_result +qemu_plugin_read_memory_hwaddr(hwaddr addr, GByteArray *data, size_t len) +{ +#ifdef CONFIG_SOFTMMU + if (len =3D=3D 0) { + return QEMU_PLUGIN_HWADDR_OPERATION_ERROR; + } + + g_assert(current_cpu); + + + int as_idx =3D cpu_asidx_from_attrs(current_cpu, MEMTXATTRS_UNSPECIFIE= D); + AddressSpace *as =3D cpu_get_address_space(current_cpu, as_idx); + + if (as =3D=3D NULL) { + return QEMU_PLUGIN_HWADDR_OPERATION_INVALID_ADDRESS_SPACE; + } + + g_byte_array_set_size(data, len); + MemTxResult res =3D address_space_rw(as, addr, + MEMTXATTRS_UNSPECIFIED, data->data, + data->len, false); + + switch (res) { + case MEMTX_OK: + return QEMU_PLUGIN_HWADDR_OPERATION_OK; + case MEMTX_ERROR: + return QEMU_PLUGIN_HWADDR_OPERATION_DEVICE_ERROR; + case MEMTX_DECODE_ERROR: + return QEMU_PLUGIN_HWADDR_OPERATION_INVALID_ADDRESS; + case MEMTX_ACCESS_ERROR: + return QEMU_PLUGIN_HWADDR_OPERATION_ACCESS_DENIED; + default: + return QEMU_PLUGIN_HWADDR_OPERATION_ERROR; + } +#else + return QEMU_PLUGIN_HWADDR_OPERATION_ERROR; +#endif +} + +enum qemu_plugin_hwaddr_operation_result +qemu_plugin_write_memory_hwaddr(hwaddr addr, GByteArray *data) +{ +#ifdef CONFIG_SOFTMMU + if (data->len =3D=3D 0) { + return QEMU_PLUGIN_HWADDR_OPERATION_ERROR; + } + + g_assert(current_cpu); + + int as_idx =3D cpu_asidx_from_attrs(current_cpu, MEMTXATTRS_UNSPECIFIE= D); + AddressSpace *as =3D cpu_get_address_space(current_cpu, as_idx); + + if (as =3D=3D NULL) { + return QEMU_PLUGIN_HWADDR_OPERATION_INVALID_ADDRESS_SPACE; + } + + MemTxResult res =3D address_space_rw(as, addr, + MEMTXATTRS_UNSPECIFIED, data->data, + data->len, true); + switch (res) { + case MEMTX_OK: + return QEMU_PLUGIN_HWADDR_OPERATION_OK; + case MEMTX_ERROR: + return QEMU_PLUGIN_HWADDR_OPERATION_DEVICE_ERROR; + case MEMTX_DECODE_ERROR: + return QEMU_PLUGIN_HWADDR_OPERATION_INVALID_ADDRESS; + case MEMTX_ACCESS_ERROR: + return QEMU_PLUGIN_HWADDR_OPERATION_ACCESS_DENIED; + default: + return QEMU_PLUGIN_HWADDR_OPERATION_ERROR; + } +#else + return QEMU_PLUGIN_HWADDR_OPERATION_ERROR; +#endif +} + +bool qemu_plugin_translate_vaddr(uint64_t vaddr, uint64_t *hwaddr) +{ +#ifdef CONFIG_SOFTMMU + g_assert(current_cpu); + + uint64_t res =3D cpu_get_phys_page_debug(current_cpu, vaddr); + + if (res =3D=3D (uint64_t)-1) { + return false; + } + + *hwaddr =3D res | (vaddr & ~TARGET_PAGE_MASK); + + return true; +#else + return false; +#endif +} + struct qemu_plugin_scoreboard *qemu_plugin_scoreboard_new(size_t element_s= ize) { return plugin_scoreboard_new(element_size); --=20 2.47.2 From nobody Sat Nov 15 12:15:02 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=1751453179; cv=none; d=zohomail.com; s=zohoarc; b=KIRdcIdhdjKmPlQNp+M4D454AAlbATW6B1iagfDEShxBhPae0mtDdzt7ZtkEl45wEVG8wZEpT4tKQS9bpCPuhFxMQdmNc76LH8tYYFASLX54/iwk2v8vs0cOlNMnfO3epgwjX6p6/yMXpu4G6RrZXG3zrvRad7SZRFk7M9uWQUQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751453179; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Rk0FNmkluSOyigMHJWnPKlXjmy4Hc5fY1wkF0CxDkc8=; b=LyeDw+5zCMLgq9Q2ithjdrA8+HaPtdqtEbR9a/iVKGupMDjl6bBMsABBiAw4uDoOR3o2lklTWOGSv2+jsOtAVMTcelqn5N5hGz3ta46epM+yJn5cw2cicVMasjYMP5eIrFJDfE0KE7BYM/wHA7GHQLXQX/nRXqtkGrlZV3k2Tug= 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 1751453179216299.0143403516844; Wed, 2 Jul 2025 03:46:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWuwm-0006l0-7K; Wed, 02 Jul 2025 06:44:12 -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 1uWuwe-0006hT-EW for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:44:05 -0400 Received: from mail-ed1-x532.google.com ([2a00:1450:4864:20::532]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWuwP-0001Jn-OH for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:44:04 -0400 Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-607cf70b00aso13293619a12.2 for ; Wed, 02 Jul 2025 03:43:48 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ae353c01636sm1058476266b.105.2025.07.02.03.43.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jul 2025 03:43:42 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id C95625F8F9; Wed, 02 Jul 2025 11:43:37 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751453026; x=1752057826; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Rk0FNmkluSOyigMHJWnPKlXjmy4Hc5fY1wkF0CxDkc8=; b=KOUa1+9EfLifTdVwR9DOq3kJ5VB73LqBhYVKjtYpKyw2Qb4AX6x57pa6Zb+5deV7hy GMlatIIvETd/zN+HKqdq3q0XdhyuYuvRniqhCnKtYv5VUfGRqhWiwZVxksbz5iDVIH69 D4jNE2TgraUriucPW0bfAmeOcgnFPKrkAOxdDG8hGmmPNmIIqvtGb79gGMLYvR0+Ya4S 2hwBpaMEPXbsBMv3wgZMVPb0SZz602esbWQL0UZF/4w+fUbQxSolLXLczL36S1WfkyIH 0B0ZWFMxml3wdOV4Pn9QpGZkGIK5JCWkTZifNCZHjdRaz7pAPHAyBpCeHmf0e/aL5OGu /n4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751453026; x=1752057826; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Rk0FNmkluSOyigMHJWnPKlXjmy4Hc5fY1wkF0CxDkc8=; b=KazBrOqmtFkS45pa/seoJYk0IdwpRIC6NkiIfRppt4pTNJY+b8pZyBNgwlMLN1jziY t9cKlz4uWmjumtXgb+JLAnrxGbvXsgDnWSAYny10W8f9BYqUhJX5jn0pgB45Sh909YzU WriLO4CQNrE/vYYYdjtX5+jq917Ez4ycHbrDoRa6FgGRcaXuH8muQwsCL4E5meWC0nwz R9wmTcY7tCVZbNqn/M37MczLVRjzPVjIEtj/4LIdgrpVaSRbeHqBA2E4528nmgm/7B2X vD+WlHGSaUHpQ2iUrDjyGJHE82R81IMJchWHHbmNF/QCryC5dl1druFiXfS5BRBLtBMv UHZQ== X-Gm-Message-State: AOJu0YxDTsg0y7idtJWip/ZY/sTFcG3dT9IF3UfjQue/ouyxvlrvpUUl 0yrDNsQ3orlToakNKEHGET4HZjLsqmfG9G0rdaLvKF5uJBGcSJZVLtl9B2Dt3/vUSaguf0apVbr N2K99DsA= X-Gm-Gg: ASbGnctUhIV692n9G7AUfFcDaUz3G17nEk7V3s0lZMkI+pEzQP2FV86HQPpmTHm5wAZ /KGwoPaSLlGyjzFY4km6uQt81WZo6dKkrxBBDEO7LXjM4f0L/kJA+CAPpG0U+oTBMl8wlAPhtCd PKt7gBNHWARo7rCW2qsdMhN7uzgWrp/3fS/daQYOTxVMUajI9RsYxui9tybPykKnQT+z7lgJkLw PPp8auTCRCAAeMCs5SGTxS/v6cpaQlFNcCT475e8pOdDUoAUXpP2qickUru5NmPBVv4v/rHA4Jv x5c988qTob2PBAn+UgXm8L4v7ms7WQPcG+vNAGLRYqC8MgxZgJh+QG/0Qul8Xpw= X-Google-Smtp-Source: AGHT+IEBSnP7CCBc6N0n/h1gX7eVxO0DVKM0IabxgxDAwfRHrPC9wL6IME90E8+n2l2Dyn4hZixfpA== X-Received: by 2002:a17:907:2da5:b0:ae0:d38e:5852 with SMTP id a640c23a62f3a-ae3c2bd9b63mr226526766b.39.1751453026267; Wed, 02 Jul 2025 03:43:46 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Rowan Hart , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Paolo Bonzini , Richard Henderson , Eduardo Habkost Subject: [PULL 10/15] tests/tcg: Remove copy-pasted notes and from i386 and add x86_64 system tests to tests Date: Wed, 2 Jul 2025 11:43:31 +0100 Message-ID: <20250702104336.3775206-11-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250702104336.3775206-1-alex.bennee@linaro.org> References: <20250702104336.3775206-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::532; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x532.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, T_SPF_HELO_TEMPERROR=0.01, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751453181109116600 From: Rowan Hart The x86_64-softmmu Makefile seems to have been copy-pasted from the i386 Makefile at some point in the past. Cleaning up a vestigial unused variable and removing some outdated comments. Signed-off-by: Rowan Hart Message-ID: <20250624175351.440780-7-rowanbhart@gmail.com> Signed-off-by: Alex Benn=C3=A9e Message-ID: <20250627112512.1880708-11-alex.bennee@linaro.org> diff --git a/tests/tcg/x86_64/Makefile.softmmu-target b/tests/tcg/x86_64/Ma= kefile.softmmu-target index ef6bcb4dc7..d3e09708a5 100644 --- a/tests/tcg/x86_64/Makefile.softmmu-target +++ b/tests/tcg/x86_64/Makefile.softmmu-target @@ -1,13 +1,11 @@ # -# x86 system tests -# -# This currently builds only for i386. The common C code is built -# with standard compiler flags however so we can support both by -# adding additional boot files for x86_64. +# x86_64 system tests # =20 -I386_SYSTEM_SRC=3D$(SRC_PATH)/tests/tcg/i386/system X64_SYSTEM_SRC=3D$(SRC_PATH)/tests/tcg/x86_64/system +X64_SYSTEM_TESTS=3D$(patsubst $(X64_SYSTEM_SRC)/%.c, %, $(wildcard $(X64_S= YSTEM_SRC)/*.c)) + +VPATH+=3D$(X64_SYSTEM_SRC) =20 # These objects provide the basic boot code and helper functions for all t= ests CRT_OBJS=3Dboot.o @@ -18,7 +16,7 @@ LDFLAGS=3D-Wl,-T$(LINK_SCRIPT) -Wl,-melf_x86_64 CFLAGS+=3D-nostdlib -ggdb -O0 $(MINILIB_INC) LDFLAGS+=3D-static -nostdlib $(CRT_OBJS) $(MINILIB_OBJS) -lgcc =20 -TESTS+=3D$(MULTIARCH_TESTS) +TESTS+=3D$(MULTIARCH_TESTS) $(X64_SYSTEM_TESTS) EXTRA_RUNS+=3D$(MULTIARCH_RUNS) =20 # building head blobs --=20 2.47.2 From nobody Sat Nov 15 12:15:02 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=1751453192; cv=none; d=zohomail.com; s=zohoarc; b=iGgZ5IgaCEJc+penA/B5S+I3AeCBkiIMF0Pl4I8WNxGxQurOBr+JTf6Ea1Lb1XB7BpOm0nTNmmZJHjJK3wUG259FhuhHcGdlxuQRw/TIyEx0ym841Xmyr3gfJzyAl1pTicbs59D3idacQ1QHzgoHX56GkkUCrzDKitwH7hAbEgw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751453192; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ga+r7yAjZ91S5TYW9IwIwF6TbkVAcOYP9gO9+s32MWY=; b=gwa7vbsh+MYJ3HlwTgR8bPnSXYgEeuhtCmXMyzb3qLkrJK1VI+0wHunRbUDU0kMVTsrUE6qgk5f0102Tbi8y0Jeri85iDb0bikTVdE7DmG0WXis43QD9422DYRMaiVmR3n4Vr5DGiG/o9gBD5Hr1++ZjMJYF0e2P1/V4eWEeFa0= 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 1751453192164248.6007018545613; Wed, 2 Jul 2025 03:46:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWuwn-0006mJ-0X; Wed, 02 Jul 2025 06:44:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWuwe-0006hS-DZ for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:44:05 -0400 Received: from mail-ed1-x532.google.com ([2a00:1450:4864:20::532]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWuwT-0001L6-0c for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:44:04 -0400 Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-60bfcada295so7544652a12.1 for ; Wed, 02 Jul 2025 03:43:52 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-60c828bb118sm8924580a12.2.2025.07.02.03.43.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jul 2025 03:43:44 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id E92105F8FC; Wed, 02 Jul 2025 11:43:37 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751453031; x=1752057831; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ga+r7yAjZ91S5TYW9IwIwF6TbkVAcOYP9gO9+s32MWY=; b=LzAJZwrQoq8ehhCytfQOWetG6XcCtWlUj9jWRZ03kFQHr0wrj5lZ7hiCssj04av92F LOs9KO5IPKe05VSH2rTVIWUSM4/oukf0giQEmonDf+GzvydPZgp/4Ahu6t7uEGrnaGCI SG9EtXW//vZZXa5KJR/JlqoxTgQCnbQvy6c5Iq8Io7B+2PlW05skpC7Sb264tT25Seiz EfOqZjEvB1wQWSn8e5yBYs40OSEag7yJny/lLL2L20AtEU4581JgT84Z7EP72VUo2/4r c8xjWJ7KSCEekKzrfWHgS54vK7jRtOlt2nFl4Ka8ytwm8DBG9Y3NQKWLX5nF7YDEW3iV wpUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751453031; x=1752057831; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ga+r7yAjZ91S5TYW9IwIwF6TbkVAcOYP9gO9+s32MWY=; b=orLkd406kHpqCgInQU6JGyPFKjWsP2KFbFQcSg+H82a9p+tbSFuURxyOJVK3SXrFwX hTilLLyOmRsAOnL2YC7HVfaggZtJTCOOpJ9AfZnWtHUN1dSBLDJs+ju4oXnSmvZUsyEN iAT0fCac32JNYVJMrLMqBkRk9LuFtVu/AYhMYcqgy1vIPGav9HZousqF3CdnjTkviGFW L9LnRqWkp7suODnLZyJ6CKA+2lu7WvoQBGQzZjFkzmeBVRTEeX0SN9WEwuHXAV1Wvxhl dEqZMBQtYkPBAFSt3crlxl7EHtHbAV8BOeYB5eD/Z+X3drp5c2z+kh69DMlFMwM9AB0P jXbg== X-Gm-Message-State: AOJu0YxS+SEmkpLBvpWgVQZ1MHHnMd4MWsFLXlegPXKe5uTiIJPkui5m 4F12L4ICpng29g5pTIEz6WJioRB7qUQEIE53AMyb6n0twQjvwGjkU3Bhdv2hILzfbqM= X-Gm-Gg: ASbGncv573l+WnRVvwfai5LRWBhwKJNBcitn6xSpRHm+az4EIVKql3Q3OFmNSalAUj5 /QKg6yC58UrjL6DrMkw5GxqET5HJbqq23R8yPqR9Fut8TKjdyQBjB1z77sQviIwzUXwa2XEaXSK ar7a8PcyrCOhmg8yW8toXsGsrm8luRAc4EQQVABtgtBWlvdrN4u+Uc46w0tLreJ4fatBTTtL3o8 nR1z5x0Vd+zqzMTa2KTa6JDUEB6hMaI3Z/mkueQ3NcMkko0TblK8Y0SRyRAdxq93GBNo0bIN5r8 U+SPF0slYFsLTSBeBwv/C54Pn90sEOuifMsNfFiAcHfRTbJgEqRL/kWuQRfYFkQ= X-Google-Smtp-Source: AGHT+IGEFnHA06ATNYLWN4TZsbVql7hST4Kb1mlzYTnf0+Uwe1T+mSDSYoKkr51KvRXr/dsPJClnxg== X-Received: by 2002:a05:6402:2554:b0:60c:4220:5d8b with SMTP id 4fb4d7f45d1cf-60e52d02145mr2140596a12.17.1751453030845; Wed, 02 Jul 2025 03:43:50 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Rowan Hart , Pierrick Bouvier , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alexandre Iooss , Mahmoud Mandour , Paolo Bonzini , Richard Henderson , Eduardo Habkost Subject: [PULL 11/15] plugins: Add patcher plugin and test Date: Wed, 2 Jul 2025 11:43:32 +0100 Message-ID: <20250702104336.3775206-12-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250702104336.3775206-1-alex.bennee@linaro.org> References: <20250702104336.3775206-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::532; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x532.google.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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: 1751453193357116600 From: Rowan Hart This patch adds a plugin that exercises the virtual and hardware memory read-write API functions added in a previous patch. The plugin takes a target and patch byte sequence, and will overwrite any instruction matching the target byte sequence with the patch. Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart Message-ID: <20250624175351.440780-8-rowanbhart@gmail.com> [AJB: tweak Makefile, use uintptr_t for pointer stuffing] Signed-off-by: Alex Benn=C3=A9e Message-ID: <20250627112512.1880708-12-alex.bennee@linaro.org> diff --git a/tests/tcg/plugins/patch.c b/tests/tcg/plugins/patch.c new file mode 100644 index 0000000000..111c5c1f16 --- /dev/null +++ b/tests/tcg/plugins/patch.c @@ -0,0 +1,251 @@ +/* + * SPDX-License-Identifier: GPL-2.0-or-later + * + * This plugin patches instructions matching a pattern to a different + * instruction as they execute + * + */ + +#include "glib.h" +#include "glibconfig.h" + +#include +#include +#include + +QEMU_PLUGIN_EXPORT int qemu_plugin_version =3D QEMU_PLUGIN_VERSION; + +static bool use_hwaddr; +static GByteArray *target_data; +static GByteArray *patch_data; + +/** + * Parse a string of hexadecimal digits into a GByteArray. The string must= be + * even length + */ +static GByteArray *str_to_bytes(const char *str) +{ + size_t len =3D strlen(str); + + if (len =3D=3D 0 || len % 2 !=3D 0) { + return NULL; + } + + GByteArray *bytes =3D g_byte_array_new(); + char byte[3] =3D {0}; + guint8 value =3D 0; + + for (size_t i =3D 0; i < len; i +=3D 2) { + byte[0] =3D str[i]; + byte[1] =3D str[i + 1]; + value =3D (guint8)g_ascii_strtoull(byte, NULL, 16); + g_byte_array_append(bytes, &value, 1); + } + + return bytes; +} + +static void patch_hwaddr(unsigned int vcpu_index, void *userdata) +{ + uintptr_t addr =3D (uintptr_t) userdata; + g_autoptr(GString) str =3D g_string_new(NULL); + g_string_printf(str, "patching: @0x%" + PRIxPTR "\n", + addr); + qemu_plugin_outs(str->str); + + enum qemu_plugin_hwaddr_operation_result result =3D + qemu_plugin_write_memory_hwaddr(addr, patch_data); + + + if (result !=3D QEMU_PLUGIN_HWADDR_OPERATION_OK) { + g_autoptr(GString) errmsg =3D g_string_new(NULL); + g_string_printf(errmsg, "Failed to write memory: %d\n", result); + qemu_plugin_outs(errmsg->str); + return; + } + + GByteArray *read_data =3D g_byte_array_new(); + + result =3D qemu_plugin_read_memory_hwaddr(addr, read_data, + patch_data->len); + + qemu_plugin_outs("Reading memory...\n"); + + if (result !=3D QEMU_PLUGIN_HWADDR_OPERATION_OK) { + g_autoptr(GString) errmsg =3D g_string_new(NULL); + g_string_printf(errmsg, "Failed to read memory: %d\n", result); + qemu_plugin_outs(errmsg->str); + return; + } + + if (memcmp(patch_data->data, read_data->data, patch_data->len) !=3D 0)= { + qemu_plugin_outs("Failed to read back written data\n"); + } + + qemu_plugin_outs("Success!\n"); + + return; +} + +static void patch_vaddr(unsigned int vcpu_index, void *userdata) +{ + uintptr_t addr =3D (uintptr_t) userdata; + uint64_t hwaddr =3D 0; + if (!qemu_plugin_translate_vaddr(addr, &hwaddr)) { + qemu_plugin_outs("Failed to translate vaddr\n"); + return; + } + g_autoptr(GString) str =3D g_string_new(NULL); + g_string_printf(str, "patching: @0x%" + PRIxPTR " hw: @0x%" PRIx64 "\n", + addr, hwaddr); + qemu_plugin_outs(str->str); + + qemu_plugin_outs("Writing memory (vaddr)...\n"); + + if (!qemu_plugin_write_memory_vaddr(addr, patch_data)) { + qemu_plugin_outs("Failed to write memory\n"); + return; + } + + qemu_plugin_outs("Reading memory (vaddr)...\n"); + + g_autoptr(GByteArray) read_data =3D g_byte_array_new(); + + if (!qemu_plugin_read_memory_vaddr(addr, read_data, patch_data->len)) { + qemu_plugin_outs("Failed to read memory\n"); + return; + } + + if (memcmp(patch_data->data, read_data->data, patch_data->len) !=3D 0)= { + qemu_plugin_outs("Failed to read back written data\n"); + } + + qemu_plugin_outs("Success!\n"); + + return; +} + +/* + * Callback on translation of a translation block. + */ +static void vcpu_tb_trans_cb(qemu_plugin_id_t id, struct qemu_plugin_tb *t= b) +{ + g_autoptr(GByteArray) insn_data =3D g_byte_array_new(); + uintptr_t addr =3D 0; + + for (size_t i =3D 0; i < qemu_plugin_tb_n_insns(tb); i++) { + struct qemu_plugin_insn *insn =3D qemu_plugin_tb_get_insn(tb, i); + uint64_t vaddr =3D qemu_plugin_insn_vaddr(insn); + + if (use_hwaddr) { + uint64_t hwaddr =3D 0; + if (!qemu_plugin_translate_vaddr(vaddr, &hwaddr)) { + qemu_plugin_outs("Failed to translate vaddr\n"); + continue; + } + /* + * As we cannot emulate 64 bit systems on 32 bit hosts we + * should never see the top bits set, hence we can safely + * cast to uintptr_t. + */ + g_assert(hwaddr <=3D UINTPTR_MAX); + addr =3D (uintptr_t) hwaddr; + } else { + g_assert(vaddr <=3D UINTPTR_MAX); + addr =3D (uintptr_t) vaddr; + } + + g_byte_array_set_size(insn_data, qemu_plugin_insn_size(insn)); + qemu_plugin_insn_data(insn, insn_data->data, insn_data->len); + + if (insn_data->len >=3D target_data->len && + !memcmp(insn_data->data, target_data->data, + MIN(target_data->len, insn_data->len))) { + if (use_hwaddr) { + qemu_plugin_register_vcpu_tb_exec_cb(tb, patch_hwaddr, + QEMU_PLUGIN_CB_NO_REG= S, + (void *) addr); + } else { + qemu_plugin_register_vcpu_tb_exec_cb(tb, patch_vaddr, + QEMU_PLUGIN_CB_NO_REG= S, + (void *) addr); + } + } + } +} + +static void usage(void) +{ + fprintf(stderr, "Usage: ,target=3D,patch=3D" + "[,use_hwaddr=3Dtrue|false]"); +} + +/* + * Called when the plugin is installed + */ +QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id, + const qemu_info_t *info, int ar= gc, + char **argv) +{ + + use_hwaddr =3D true; + target_data =3D NULL; + patch_data =3D NULL; + + if (argc > 4) { + usage(); + return -1; + } + + for (size_t i =3D 0; i < argc; i++) { + char *opt =3D argv[i]; + g_auto(GStrv) tokens =3D g_strsplit(opt, "=3D", 2); + if (g_strcmp0(tokens[0], "use_hwaddr") =3D=3D 0) { + if (!qemu_plugin_bool_parse(tokens[0], tokens[1], &use_hwaddr)= ) { + fprintf(stderr, + "Failed to parse boolean argument use_hwaddr\n"); + return -1; + } + } else if (g_strcmp0(tokens[0], "target") =3D=3D 0) { + target_data =3D str_to_bytes(tokens[1]); + if (!target_data) { + fprintf(stderr, + "Failed to parse target bytes.\n"); + return -1; + } + } else if (g_strcmp0(tokens[0], "patch") =3D=3D 0) { + patch_data =3D str_to_bytes(tokens[1]); + if (!patch_data) { + fprintf(stderr, "Failed to parse patch bytes.\n"); + return -1; + } + } else { + fprintf(stderr, "Unknown argument: %s\n", tokens[0]); + usage(); + return -1; + } + } + + if (!target_data) { + fprintf(stderr, "target argument is required\n"); + usage(); + return -1; + } + + if (!patch_data) { + fprintf(stderr, "patch argument is required\n"); + usage(); + return -1; + } + + if (target_data->len !=3D patch_data->len) { + fprintf(stderr, "Target and patch data must be the same length\n"); + return -1; + } + + qemu_plugin_register_vcpu_tb_trans_cb(id, vcpu_tb_trans_cb); + + return 0; +} diff --git a/tests/tcg/x86_64/system/patch-target.c b/tests/tcg/x86_64/syst= em/patch-target.c new file mode 100644 index 0000000000..8c2b6f4ba7 --- /dev/null +++ b/tests/tcg/x86_64/system/patch-target.c @@ -0,0 +1,22 @@ +/* + * SPDX-License-Identifier: GPL-2.0-or-later + * + * This test target increments a value 100 times. The patcher converts the + * inc instruction to a nop, so it only increments the value once. + * + */ +#include + +int main(void) +{ + ml_printf("Running test...\n"); + unsigned int x =3D 0; + for (int i =3D 0; i < 100; i++) { + asm volatile ( + "inc %[x]" + : [x] "+a" (x) + ); + } + ml_printf("Value: %d\n", x); + return 0; +} diff --git a/tests/tcg/Makefile.target b/tests/tcg/Makefile.target index 95ff76ea44..af68f11664 100644 --- a/tests/tcg/Makefile.target +++ b/tests/tcg/Makefile.target @@ -151,7 +151,12 @@ ifeq ($(CONFIG_PLUGIN),y) PLUGIN_SRC=3D$(SRC_PATH)/tests/tcg/plugins PLUGIN_LIB=3D../plugins VPATH+=3D$(PLUGIN_LIB) -PLUGINS=3D$(patsubst %.c, lib%.so, $(notdir $(wildcard $(PLUGIN_SRC)/*.c))) +# Some plugins need to be disabled for all tests to avoid exponential expl= osion. +# For example, libpatch.so only needs to run against the arch-specific pat= ch +# target test, so we explicitly run it in the arch-specific Makefile. +DISABLE_PLUGINS=3Dlibpatch.so +PLUGINS=3D$(filter-out $(DISABLE_PLUGINS), \ + $(patsubst %.c, lib%.so, $(notdir $(wildcard $(PLUGIN_SRC)/*.c)))) =20 # We need to ensure expand the run-plugin-TEST-with-PLUGIN # pre-requistes manually here as we can't use stems to handle it. We diff --git a/tests/tcg/plugins/meson.build b/tests/tcg/plugins/meson.build index 029342282a..61a007d9e7 100644 --- a/tests/tcg/plugins/meson.build +++ b/tests/tcg/plugins/meson.build @@ -1,6 +1,6 @@ t =3D [] if get_option('plugins') - foreach i : ['bb', 'empty', 'inline', 'insn', 'mem', 'reset', 'syscall'] + foreach i : ['bb', 'empty', 'inline', 'insn', 'mem', 'reset', 'syscall',= 'patch'] if host_os =3D=3D 'windows' t +=3D shared_module(i, files(i + '.c') + '../../../contrib/plugins/= win32_linker.c', include_directories: '../../../include/qemu', diff --git a/tests/tcg/x86_64/Makefile.softmmu-target b/tests/tcg/x86_64/Ma= kefile.softmmu-target index d3e09708a5..3e30ca9307 100644 --- a/tests/tcg/x86_64/Makefile.softmmu-target +++ b/tests/tcg/x86_64/Makefile.softmmu-target @@ -33,3 +33,12 @@ memory: CFLAGS+=3D-DCHECK_UNALIGNED=3D1 =20 # Running QEMU_OPTS+=3D-device isa-debugcon,chardev=3Doutput -device isa-debug-exit,= iobase=3D0xf4,iosize=3D0x4 -kernel + +ifeq ($(CONFIG_PLUGIN),y) +run-plugin-patch-target-with-libpatch.so: \ + PLUGIN_ARGS=3D$(COMMA)target=3Dffc0$(COMMA)patch=3D9090$(COMMA)use_hwaddr= =3Dtrue +run-plugin-patch-target-with-libpatch.so: \ + CHECK_PLUGIN_OUTPUT_COMMAND=3D$(X64_SYSTEM_SRC)/validate-patch.py $@.out +run-plugin-patch-target-with-libpatch.so: patch-target libpatch.so +EXTRA_RUNS+=3Drun-plugin-patch-target-with-libpatch.so +endif diff --git a/tests/tcg/x86_64/system/validate-patch.py b/tests/tcg/x86_64/s= ystem/validate-patch.py new file mode 100755 index 0000000000..700950eae5 --- /dev/null +++ b/tests/tcg/x86_64/system/validate-patch.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python3 +# +# validate-patch.py: check the patch applies +# +# This program takes two inputs: +# - the plugin output +# - the binary output +# +# Copyright (C) 2024 +# +# SPDX-License-Identifier: GPL-2.0-or-later + +import sys +from argparse import ArgumentParser + +def main() -> None: + """ + Process the arguments, injest the program and plugin out and + verify they match up and report if they do not. + """ + parser =3D ArgumentParser(description=3D"Validate patch") + parser.add_argument('test_output', + help=3D"The output from the test itself") + parser.add_argument('plugin_output', + help=3D"The output from plugin") + args =3D parser.parse_args() + + with open(args.test_output, 'r') as f: + test_data =3D f.read() + with open(args.plugin_output, 'r') as f: + plugin_data =3D f.read() + if "Value: 1" in test_data: + sys.exit(0) + else: + sys.exit(1) + +if __name__ =3D=3D "__main__": + main() + --=20 2.47.2 From nobody Sat Nov 15 12:15:02 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=1751453130; cv=none; d=zohomail.com; s=zohoarc; b=aaew1kv/F3+vNxCphOXCzxmmuuvUeQz85LtXwb2q///QQBeT6C0AvTbhuCoeU1izbsLNGlJgNprlSwvf2WMp7XS/RbpMtDjAKgdtKPlUqcS48s2QgcUx1PSIcf0EkTEN56wjR2LuqqJL9Uad+cfEeQe/OHItV/kc9l1/BitiRZ8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751453130; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=q++VT0w3BFey6U6AhyjA4yt6pGOWJ3/ulMKQuhSNA98=; b=eD2rfR/3cnruJy94Svgup+mItz4VaJyS22zNN7bIrJzZ2QUpNnLot99Q9ux+driGoN8uJ6cBs2u3fNxEIy69LJx1tvU7rKBtdCgp/U7MZORB4yBE+M5gF0Ig+vsKcIwvG5/mKfmKQFg6tLnfSBt/Hus9XLgUxH4eNvSdciihSkI= 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 1751453130081628.5010172673668; Wed, 2 Jul 2025 03:45:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWuwk-0006jY-Rv; Wed, 02 Jul 2025 06:44:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWuwZ-0006gA-0H for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:43:59 -0400 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWuwS-0001KW-H7 for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:43:58 -0400 Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-ae0b2ead33cso1165978466b.0 for ; Wed, 02 Jul 2025 03:43:50 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ae353659f7dsm1032890666b.45.2025.07.02.03.43.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jul 2025 03:43:44 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 0D3B05F920; Wed, 02 Jul 2025 11:43:38 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751453029; x=1752057829; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=q++VT0w3BFey6U6AhyjA4yt6pGOWJ3/ulMKQuhSNA98=; b=Nu+M/P0/beZlN4U+AITXxBWEDWpKszoBubLChG3irC06ZQ2Z3moY4ZP447rwpX8TYz GcND8ZfD2dDb0ZbQsphHl9rUZe5L6BKSDfb2E370UPyGQVXupaFJ6KsSFxRRdbzSwrpY pp+xQl2wynCXZvUIxpaXtlHSV9IKK19VKuzZ29kaJClgyYxh6D+cIaKEi6k7llCGkasc v6OwzA8JrPaBovlN+MN0cXEOhUzLLj1XUI+UsgBOHMr6/ZT0kG8mY58KOG3yMXptvNWr A+teG7Z3zZqcdYsrw7kXyGyDByNwMCwppndVR8DO0U/TwRWy7pSRErGodN28IsnarwOP ddng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751453029; x=1752057829; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=q++VT0w3BFey6U6AhyjA4yt6pGOWJ3/ulMKQuhSNA98=; b=SUohac+68MPnE9/Sde3Un9EeKA1/hyaohZGsmAdpLje+VCEIZvmt1whfi53T5/lyfA Ei3EwdJy0JcPNGbdSYrDkk++PzqTIMyG6GRrwdbdU/GFIHMWW50wx2V2A/C7P1C+AmjP 7eZlVY+nI56oWclWFGe20DTGtduW0xbv5s9Jm2bMK06d6Pyz3Jl9Jh1xyHHhozr89UkG DDJ/c1+E3FTuLKLUQtjQqBs9qzjKv2E0D4VkCcUVpp0X+mde3AsOb1UQLPp72IkSq1B3 LioOuAyisL66CnjboMhoyV+3CTzHU3H06KbQQWLTBwNdZElqMQMFH0O0WfEG1GBv7PEL e56A== X-Gm-Message-State: AOJu0YwrFUG/NKU1+aIqBRc5X0KaN3485zhp8Fer57goU4XQTEC81jYy m2eTCCZDBpPWzdiGbnH9z6DxiQYxTUoAE5CS6nERjMY0+yCKSOyCr84nEInQHZsPx5A= X-Gm-Gg: ASbGncumsvsmUSO80YBKaTspzus3e4aMwV4Q+pYhpBdAdeFW47eoF3kWSMbu0116cOZ AIW06+6atmf+FKYLuYaypOz/QAyJkkYTQ1jDhUDkO15ftmPXLXbAsNwximggLnGaHTcq2me4bwX LXCz81haerohX+UF9tPgxgmlAl0uSYgZKblU3GVSOqDHfFVL/MBvow/+e25l81d4l5NWVbnolOz Z7mWV15gx44+BoRpGJVYe5yQFUJSL/tI2e2n1bfSil50xpzx4Eiq+CEMYy6D5s/MMNqsWr8Y/AP YfUfKbZXVB5+Nd1elYS0tdc2uLnfCn8XCLA8ZP07oeuX3yJ/ct0yR7TsjhnpWVZBuBzflJm28w= = X-Google-Smtp-Source: AGHT+IEBWm7rTIyqrHdAyQYZ4J4XKDZm37p+xdsk7L0kPRYVpscQTdfbeHl1fKUDlQYBdYQYOq/BaQ== X-Received: by 2002:a17:907:d643:b0:ae0:bf99:6c5d with SMTP id a640c23a62f3a-ae3c3c55d50mr172572266b.26.1751453029260; Wed, 02 Jul 2025 03:43:49 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Rowan Hart , Pierrick Bouvier , =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [PULL 12/15] plugins: Update plugin version and add notes Date: Wed, 2 Jul 2025 11:43:33 +0100 Message-ID: <20250702104336.3775206-13-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250702104336.3775206-1-alex.bennee@linaro.org> References: <20250702104336.3775206-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::62f; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x62f.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: 1751453134419116600 From: Rowan Hart This patch updates the plugin version to gate new APIs and adds notes describing what has been added. Reviewed-by: Pierrick Bouvier Signed-off-by: Rowan Hart Message-ID: <20250624175351.440780-9-rowanbhart@gmail.com> Signed-off-by: Alex Benn=C3=A9e Message-ID: <20250627112512.1880708-13-alex.bennee@linaro.org> diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h index 5eecdccc67..c450106af1 100644 --- a/include/qemu/qemu-plugin.h +++ b/include/qemu/qemu-plugin.h @@ -65,11 +65,18 @@ typedef uint64_t qemu_plugin_id_t; * * version 4: * - added qemu_plugin_read_memory_vaddr + * + * version 5: + * - added qemu_plugin_write_memory_vaddr + * - added qemu_plugin_read_memory_hwaddr + * - added qemu_plugin_write_memory_hwaddr + * - added qemu_plugin_write_register + * - added qemu_plugin_translate_vaddr */ =20 extern QEMU_PLUGIN_EXPORT int qemu_plugin_version; =20 -#define QEMU_PLUGIN_VERSION 4 +#define QEMU_PLUGIN_VERSION 5 =20 /** * struct qemu_info_t - system information for plugins --=20 2.47.2 From nobody Sat Nov 15 12:15:02 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=1751453168; cv=none; d=zohomail.com; s=zohoarc; b=DVHx1WVwzRYqAFoCBBlBfOV0KVQpNk54dcfVEgi6T+8Jkxn13fOVXR3yuRm4NOWe2Nbnvls/BGGHGj9qbL4cjFUsHsAvR2Tij1HOdQkk4COOLU7+vmi2AHpk2kWQJrK5S30Kuwu4564HeGMBdx5gfee4RA/IVIhEMk59QBKBO+g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751453168; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=h/APTWbGW7rZ8FBTlao+ogZlUyv21mF4KMebEL0i1Uo=; b=CfCzi2pasBOlqhvapkfAO9P87pWLUyepWFQhBsgt+otFTxGionNCPTp+waPQsCl22AbpHX8LVCiRWGWzSzUoESESRm6xbHD/A2yO5EX9jlCuM6HWJu581h4skUoxV7DIV/K4OWTATLcr+vqk7qXggNDVPcawxQ0+l0m55CTxIh0= 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 1751453168341138.8909485723368; Wed, 2 Jul 2025 03:46:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWuwq-0006nB-Cs; Wed, 02 Jul 2025 06:44:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWuwk-0006jl-01 for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:44:10 -0400 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWuwW-0001LM-1C for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:44:09 -0400 Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-60c4f796446so11257287a12.1 for ; Wed, 02 Jul 2025 03:43:53 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-60c831a037csm9250294a12.49.2025.07.02.03.43.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jul 2025 03:43:47 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 23E2A5F926; Wed, 02 Jul 2025 11:43:38 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751453032; x=1752057832; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=h/APTWbGW7rZ8FBTlao+ogZlUyv21mF4KMebEL0i1Uo=; b=tquqdmFEXOrD64QDeV+D7NEv8HnnfR/vsxqIcWZ0kORi5bt8b36OF2nXvGCAhQ6KGC FZgdwg+4zDZJ5G5aRWiZImzw+NnyOH6DJschQnDB5+kxPiBR8B/eIaViMUnPSi40h+PO NMn8kOS7RF4m5vwEo+gkDRWDjwAFypMjU2ocWUJwhS3U4IW/hsmGsR221mkJ4l+FrNwG V3+Fl3/LZytB3RciZCfMTa99LQnZAUKj/3Wc6UWsIOzfFr7/drvPJo8pk+TbvFovfG9B C2cH5Vf7X+jwtGhi9eIhLIIFfcQRhEjj6hmJHnKdlkedJMVbU0TRRVaGaKMPfEeANaXG VlcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751453032; x=1752057832; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=h/APTWbGW7rZ8FBTlao+ogZlUyv21mF4KMebEL0i1Uo=; b=IaEWM0j9qzbQrYCyAati5Q9cejKMVM4+89ZZV4UE3457kz6d56ttbNGBRWC3jGbKlt YjAXwNjNkq3cfCW2nvjA8L092uePCoi7WnL28UQiaTNOuY82xDEasri3aLGilPv6Wmbv xYP+RwijM19p0W1KciIJD3cXgZ5VtfgvwmhBm8DBxytRHN4n/YnZk1qiVDQCP31ohGOy 2Dlhr3fH9SmfoaDDnSgxu3f99SwrwSJGp0EJwiUaZInIOdYbxYzc1qksjaarl2uHzEEa e5R/KSSZ8xZuPB7OXeQgim6Jb7yVca6FxqXvsfvGcyLGN8TVFL/lPJREEwo83erNNyBQ FKJA== X-Gm-Message-State: AOJu0Yz9cI8EamFhqhmihO0XVQF3TWVcc28E4KZ1jPZaF0hhDntavf+P hmaib68DvPc2iW125TrJHdaexWA3CMwCwHQv1XKcXhFbdjgSmiG15r+b7R+XuB68wyY= X-Gm-Gg: ASbGncsdFriLqyPGCkaGLF7DiT+UlBe7ygaZrZiGfwOuyxmsayyRVM0mPyedgMfMJdJ 0voZ3wO87zbDXqgWpdyAl96fqRYa0VgVU19+OxU+kKNnA06lS5XhctwFei5lqwiGWSlykWd3D9S Lov10RFKhquSEUGM9Vhbta9csbbMLt7U43OH11bqO1eL+Ldlg/l+lBkQM1Rve78b2jON4VJ98h4 x4/LsV2Lyhf+OpuQomzMYvwlWTzSO4sdm/ZanwzDTwqNeSpEgsTpOH4OIPl41TOQFa2eQguNVnM v9w89XZuCiXKB3L8kP/AFcdMAI23GU74QD5YVVD1Y1APyvutp//VwMCZ/WqVmS0= X-Google-Smtp-Source: AGHT+IGzzoGLef2j1InBSp7Ldl4ec5QQIv5LCZ/8v9PEdNzOfjVJkkTPD5mthpk+7JUAc36IYOpb8w== X-Received: by 2002:a05:6402:274b:b0:609:7e19:f12c with SMTP id 4fb4d7f45d1cf-60e53619ac6mr1847639a12.24.1751453032476; Wed, 02 Jul 2025 03:43:52 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Markus Armbruster , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 13/15] MAINTAINERS: add myself to virtio-gpu for Odd Fixes Date: Wed, 2 Jul 2025 11:43:34 +0100 Message-ID: <20250702104336.3775206-14-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250702104336.3775206-1-alex.bennee@linaro.org> References: <20250702104336.3775206-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::535; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x535.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751453169005116600 Seeing as I've taken a few patches to here now I might as well put myself forward to maintain virtio-gpu. I've marked it as Odd Fixes as it is not my core focus. If someone with more GPU experience comes forward we can always update again. Reviewed-by: Markus Armbruster Message-ID: <20250603110204.838117-8-alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Alex Benn=C3=A9e Message-ID: <20250627112512.1880708-14-alex.bennee@linaro.org> diff --git a/MAINTAINERS b/MAINTAINERS index 850588fb64..52f0164edf 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2684,7 +2684,8 @@ F: hw/display/ramfb*.c F: include/hw/display/ramfb.h =20 virtio-gpu -S: Orphan +M: Alex Benn=C3=A9e +S: Odd Fixes F: hw/display/virtio-gpu* F: hw/display/virtio-vga.* F: include/hw/virtio/virtio-gpu.h --=20 2.47.2 From nobody Sat Nov 15 12:15:02 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=1751453243; cv=none; d=zohomail.com; s=zohoarc; b=OWbH6kcWn9bdUpv3mbRCp1gPQfKciLABngtzaE4wrBLujbq9KHh8oLVHQIQAl2xNDzZqDY3qjF9QIQwpibQjFy/Kov+TSZgQQKu+7C2jjx+Bg3pWgeTHL+r++r9/crcdm0gidpzG5WCMnZtOxB8+1hFBsiZNnetkjf9Rwv50G/M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751453243; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=HLr3MJ/hu5ri+yIW2Higb0CF3yMxJGbnYgVNVmgIUMg=; b=AKBSCzzRitHrkyr+qPARkxlEv8ttNZHcBmxNOXSyis+q0fmZ8PIYvcYmsvS0HUiZsKkoItZywpYaGKxroF8kM9C4VIgaucnON5IfTXSANRcpgPOXCIMSdLpPxGO0tAemxecyN4UysAMox1VI+1zDmfRq7z3/F8NpNWe4abEXGsw= 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 1751453243156291.14752867426773; Wed, 2 Jul 2025 03:47:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWuwo-0006mc-J5; Wed, 02 Jul 2025 06:44:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWuwe-0006hO-CQ for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:44:05 -0400 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWuwV-0001LD-2Q for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:44:03 -0400 Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-60768f080d8so8993591a12.1 for ; Wed, 02 Jul 2025 03:43:53 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ae353e8d978sm1048072666b.183.2025.07.02.03.43.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jul 2025 03:43:47 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 378735F930; Wed, 02 Jul 2025 11:43:38 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751453032; x=1752057832; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HLr3MJ/hu5ri+yIW2Higb0CF3yMxJGbnYgVNVmgIUMg=; b=O5PMxqy4iMSOkUClgCUw5CUpEb7QadPTLouK5ZC++umieIFNDF+Y7WsXwkiUVulpR9 DTUEQ6/4EUPaN3uGJcDdisLu0ZqfVVm8vRhtuTzXjZ2DFIW+G5bQFRCnvOD7jxXstTpd NMiRZNR2qsERnWAQ2GBBQ26yGI305DLU2l2iOnBXxQyCSHZIM8kul3qYCVTnj4Fe8M15 bv7uDMQ6/c76yUhfvC4e/B38pBRVHn4ZUNx9k+dr8vwW0BO/91AB5mb/SB+o2OckWAdo b/gxNfLMkF8srYc7Q1thpq0wsmIp8sREqX5m892r9jN5nF6VnjwI6lN4rD8xuhpnPsQE ETTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751453032; x=1752057832; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HLr3MJ/hu5ri+yIW2Higb0CF3yMxJGbnYgVNVmgIUMg=; b=AM+RU3M5VWnvlSv0PPVLWH5VWPxwRaGdHw4qJ5zEsHfkd/JHj36SK/vuAi0ayz/kv5 XI5L1zAgGhN6mnY6oeG2CSL1AEqNPW3vqfwjfo5kgQx9VPrJqO5EbGgXcjOu+oAABCR8 tdiiLtcD//cNpsQ6q//bOvp4YaL+i60lftOXEby+WBo46gJuafNvFUvjqihC0xCLrxud SWweemsAAXwJ3Xa1PIGrDgN4Ez8tLG8j1ndIu2eeZx2AC8GyEx/EaWiZDA25G8OIoubj uaMCHfaUULqk3QuFsvjcxbbDhfkyRdVFfcZIHwHWts6/AXMKFCXH+XA+wH1DjwCMr5VX zUsw== X-Gm-Message-State: AOJu0Yyk3Tp9W2cuBwN0Q1DUFZVqxPOGZWY7T0Vg6jDQ2BqFO6iTxATO x0PYfGQwe3pggnMjLlZ/v/C49fzMVG8pPd6rXxBeI1KBG1e9BeYIZewKz8f6STPncjQ= X-Gm-Gg: ASbGncv3UGRS3UlwbbIuACnbqtX5+iv8xISEPdl94J5BhuMSY25zcVRkUYDL5cOkcyT usv+pWJ7RnWFg6wWf0xZRe80P/LCURM4xloKGUrV9EsNcVMqYkuH7Jx4p0KuiB5iHsiGY4/unxN RKKOcv9p/LRk6XVp3SY8R2ZTVc+bKgNSgA/S5NWQgw7V7bFbgyy/zd/XYrz4ua31WYEQPxlrBRT iQfjaeUwyYbxSxJtD4F9qwf87W9+u3S3kLQhNhcc1QoAOQh0tZtB4PMK5tBBmuxU2hQwEv8F2tu 2tz8eIZxmHXq8cLwg1uX9ccXMNm9P94xef29/o32WJ5XA/uT1V5KluyeHcwpdQ5BblfMxar8tw= = X-Google-Smtp-Source: AGHT+IHY/tlr/4cJkuxKspkJDQ0GrrBOjNRqv8XZUAwe9Lpcxre88iXZoH6XyMBPGBCkiQQRL7AAvg== X-Received: by 2002:a17:906:dc8e:b0:ae3:aa8c:e8f with SMTP id a640c23a62f3a-ae3c2bf3c7fmr211376466b.2.1751453031571; Wed, 02 Jul 2025 03:43:51 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Akihiko Odaki , Dmitry Osipenko , Markus Armbruster , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" Subject: [PULL 14/15] MAINTAINERS: add Akihiko and Dmitry as reviewers Date: Wed, 2 Jul 2025 11:43:35 +0100 Message-ID: <20250702104336.3775206-15-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250702104336.3775206-1-alex.bennee@linaro.org> References: <20250702104336.3775206-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::535; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x535.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751453244066116600 Thanks for volunteering to help. Cc: Akihiko Odaki Cc: Dmitry Osipenko Reviewed-by: Markus Armbruster Reviewed-by: Philippe Mathieu-Daud=C3=A9 Acked-by: Michael S. Tsirkin Message-ID: <20250603110204.838117-9-alex.bennee@linaro.org> Signed-off-by: Alex Benn=C3=A9e Message-ID: <20250627112512.1880708-15-alex.bennee@linaro.org> diff --git a/MAINTAINERS b/MAINTAINERS index 52f0164edf..3932a6e56f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2685,6 +2685,8 @@ F: include/hw/display/ramfb.h =20 virtio-gpu M: Alex Benn=C3=A9e +R: Akihiko Odaki +R: Dmitry Osipenko S: Odd Fixes F: hw/display/virtio-gpu* F: hw/display/virtio-vga.* --=20 2.47.2 From nobody Sat Nov 15 12:15:02 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=1751453107; cv=none; d=zohomail.com; s=zohoarc; b=TBXLPDNMsyONdQdRVSgm7weasqAcYuK/wKHJMikeZDMllflVhnDwBvfRMiqM60SHiMZcn0pLVlQGb7HF9Eisw5AJcF6IjhLIaaf5dOm+NSUlW1x+RnJ3S6nl4v0zemQcthlCWZ/ib6mdZM/Ivg4zxC58ShgWgmvRKWUDrT9f2mg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751453107; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=AzVknBoggUzvrFjLbxqW22UiKdqh6179CfLQfmp2lsQ=; b=QSLQDr8xFG0PaEOzAaLCeQHg2urPqmQdOUo7CsMmJnmHofE8nK7bS6tiq6UyWH1B5HNjoObgEEsykTdvhFqIHS3gBVNjIT8P9AUnUM9JW0HfoFoTQQH6N8/rbQqLNBUvvmVjpPtrBPMlNlsZ6ImmWrcYhHJec/TOJZbkbF9VhDQ= 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 1751453107359381.2455364591109; Wed, 2 Jul 2025 03:45:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uWuwn-0006mY-Of; Wed, 02 Jul 2025 06:44:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uWuwi-0006ie-NO for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:44:08 -0400 Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uWuwX-0001M3-Bi for qemu-devel@nongnu.org; Wed, 02 Jul 2025 06:44:08 -0400 Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-60700a745e5so8555495a12.3 for ; Wed, 02 Jul 2025 03:43:55 -0700 (PDT) Received: from draig.lan ([185.126.160.19]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ae35365a0a8sm1061834066b.71.2025.07.02.03.43.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jul 2025 03:43:48 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 52D215F936; Wed, 02 Jul 2025 11:43:38 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1751453033; x=1752057833; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=AzVknBoggUzvrFjLbxqW22UiKdqh6179CfLQfmp2lsQ=; b=AQ0fUOa90HhWouVTT5SbVW/B4EdlWmZDmQ3FrSSIF5Yaa2KOtewHWpFbyXkT9zLOXb Yt95UHac/JtDOfNJK1Y9foHD2g2+9Mk3ArVl9t3C0EYZnMtpk/mbNDu/ez4nTdDsPgCi HPXi1KzrJH+Nc1C7o2rgs202N64YNYzPLOSCm0GwD9bv/EWbWc2G63W4D4IVkM2GHvn2 rGRAvbbste9p3IgMzQzIqQdXftTJdAClQdcDJ2g+zNVAbi1E5rE3qABpMeUjj6Wli8Gt ZEL4fA5gIx3TDjobAImEKvRZ8RJNRn8p34AhohVFuWnlU2SqUhAGW76H4KMVmqV17ZJ5 /0iA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751453033; x=1752057833; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AzVknBoggUzvrFjLbxqW22UiKdqh6179CfLQfmp2lsQ=; b=I+6J6yzwG8JeZPbuGuND4Qoc20ID7x4pXYKlSmkSq7DXW0krgpQU2cpJyxvwO/FrrD 9GJ+Ee9OTYN/albSrT1/YN86jAZUDvyxvlIyxVJgISZnXACjOVJXJUYq4ezi+vuK5CR8 qFcLhBNoA0OG3M+SIenRijDBD8Fmgkjlc9H8jKty1T+M/ktv3pXOMOOrgXwzfcNymtD9 qcPw5EhUWka+rtKmW5i3sOfH/Dxtfzb4qVRd6K1ukMp5AfcYQYam2M6y19MhEZHWWE3E diGyb1tY5oGBz4llZG4iOIIHwBzCkYxsaZ9pfZNyEo1xOjiM8GwekhSKnJNd7okwtXoL srWQ== X-Gm-Message-State: AOJu0YzPb2kqzrBZyGoQmtplvwPEJCqcpoGAHd2WdNZnKzH/ndqI8cNt jVQPEIhPxsfOVNfnkXJQFrdJ3Xu+/aIClPvMzw7SlpYY+rYjDKeytsLPItZBPg7lkmbIPatisZe hOhxOrkE= X-Gm-Gg: ASbGncuhgiah4h7epugdcnRFG3t0ePBsUpBcjg8lWXiZYQm97Nz+eOfACMv2p3+hi40 eOXojSXICiEjXSVn3m/uNZMawfHqIFKSGxyxYzd7GyHFwnmYGkHoi3fhdZNKrEiMLQKlFmI1vJJ iMplkv3jH7Ux9BTnKVVZwoLptwfv7OIwM1CgcdfRiLaSqdnbwMWlALVi4J7HrnbcvjhQcyuWBaw u0gDU0XUopm5WN4hwarmh075ZR05POPTi0IPBZT+2oISuZF8n0WcFCMK+R+2GVQPwD4l+kK+R7s cRTaSfrBiHQbf3rI3KkkChwjYd5854s89W+rVAFpD6vaA1FAqTNR5H7SO9Bo26s= X-Google-Smtp-Source: AGHT+IH7ShiqmakM4qtyLDjPBru+iBrjthojtCAOWJ1jWBXYue8dsSt7+DLFB3hYWaVGqPIDz3aAew== X-Received: by 2002:a17:907:7f26:b0:ae3:7218:27bd with SMTP id a640c23a62f3a-ae3c2a90895mr243664266b.7.1751453033339; Wed, 02 Jul 2025 03:43:53 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Yiwei Zhang , qemu-stable@nongnu.org, Dmitry Osipenko , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Akihiko Odaki , "Michael S. Tsirkin" Subject: [PULL 15/15] virtio-gpu: support context init multiple timeline Date: Wed, 2 Jul 2025 11:43:36 +0100 Message-ID: <20250702104336.3775206-16-alex.bennee@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250702104336.3775206-1-alex.bennee@linaro.org> References: <20250702104336.3775206-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::52f; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x52f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1751453111536116600 From: Yiwei Zhang Venus and later native contexts have their own fence context along with multiple timelines within. Fences wtih VIRTIO_GPU_FLAG_INFO_RING_IDX in the flags must be dispatched to be created on the target context. Fence signaling also has to be handled on the specific timeline within that target context. Before this change, venus fencing is completely broken if the host driver doesn't support implicit fencing with external memory objects. Frames can go backwards along with random artifacts on screen if the host driver doesn't attach an implicit fence to the render target. The symptom could be hidden by certain guest wsi backend that waits on a venus native VkFence object for the actual payload with limited present modes or under special configs. e.g. x11 mailbox or xwayland. After this change, everything related to venus fencing starts making sense. Confirmed this via guest and host side perfetto tracing. Cc: qemu-stable@nongnu.org Fixes: 94d0ea1c1928 ("virtio-gpu: Support Venus context") Signed-off-by: Yiwei Zhang Reviewed-by: Dmitry Osipenko Message-Id: <20250518152651.334115-1-zzyiwei@gmail.com> [AJB: remove version history from commit message] Tested-by: Dmitry Osipenko Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Akihiko Odaki Message-ID: <20250627112512.1880708-16-alex.bennee@linaro.org> diff --git a/hw/display/virtio-gpu-virgl.c b/hw/display/virtio-gpu-virgl.c index 145a0b3879..94ddc01f91 100644 --- a/hw/display/virtio-gpu-virgl.c +++ b/hw/display/virtio-gpu-virgl.c @@ -970,6 +970,15 @@ void virtio_gpu_virgl_process_cmd(VirtIOGPU *g, } =20 trace_virtio_gpu_fence_ctrl(cmd->cmd_hdr.fence_id, cmd->cmd_hdr.type); +#if VIRGL_VERSION_MAJOR >=3D 1 + if (cmd->cmd_hdr.flags & VIRTIO_GPU_FLAG_INFO_RING_IDX) { + virgl_renderer_context_create_fence(cmd->cmd_hdr.ctx_id, + VIRGL_RENDERER_FENCE_FLAG_MERG= EABLE, + cmd->cmd_hdr.ring_idx, + cmd->cmd_hdr.fence_id); + return; + } +#endif virgl_renderer_create_fence(cmd->cmd_hdr.fence_id, cmd->cmd_hdr.type); } =20 @@ -983,6 +992,11 @@ static void virgl_write_fence(void *opaque, uint32_t f= ence) * the guest can end up emitting fences out of order * so we should check all fenced cmds not just the first one. */ +#if VIRGL_VERSION_MAJOR >=3D 1 + if (cmd->cmd_hdr.flags & VIRTIO_GPU_FLAG_INFO_RING_IDX) { + continue; + } +#endif if (cmd->cmd_hdr.fence_id > fence) { continue; } @@ -997,6 +1011,29 @@ static void virgl_write_fence(void *opaque, uint32_t = fence) } } =20 +#if VIRGL_VERSION_MAJOR >=3D 1 +static void virgl_write_context_fence(void *opaque, uint32_t ctx_id, + uint32_t ring_idx, uint64_t fence_id= ) { + VirtIOGPU *g =3D opaque; + struct virtio_gpu_ctrl_command *cmd, *tmp; + + QTAILQ_FOREACH_SAFE(cmd, &g->fenceq, next, tmp) { + if (cmd->cmd_hdr.flags & VIRTIO_GPU_FLAG_INFO_RING_IDX && + cmd->cmd_hdr.ctx_id =3D=3D ctx_id && cmd->cmd_hdr.ring_idx =3D= =3D ring_idx && + cmd->cmd_hdr.fence_id <=3D fence_id) { + trace_virtio_gpu_fence_resp(cmd->cmd_hdr.fence_id); + virtio_gpu_ctrl_response_nodata(g, cmd, VIRTIO_GPU_RESP_OK_NOD= ATA); + QTAILQ_REMOVE(&g->fenceq, cmd, next); + g_free(cmd); + g->inflight--; + if (virtio_gpu_stats_enabled(g->parent_obj.conf)) { + trace_virtio_gpu_dec_inflight_fences(g->inflight); + } + } + } +} +#endif + static virgl_renderer_gl_context virgl_create_context(void *opaque, int scanout_idx, struct virgl_renderer_gl_ctx_param *params) @@ -1031,11 +1068,18 @@ static int virgl_make_context_current(void *opaque,= int scanout_idx, } =20 static struct virgl_renderer_callbacks virtio_gpu_3d_cbs =3D { +#if VIRGL_VERSION_MAJOR >=3D 1 + .version =3D 3, +#else .version =3D 1, +#endif .write_fence =3D virgl_write_fence, .create_gl_context =3D virgl_create_context, .destroy_gl_context =3D virgl_destroy_context, .make_current =3D virgl_make_context_current, +#if VIRGL_VERSION_MAJOR >=3D 1 + .write_context_fence =3D virgl_write_context_fence, +#endif }; =20 static void virtio_gpu_print_stats(void *opaque) --=20 2.47.2