From nobody Sun Jul 26 11:53:26 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782422427; cv=none; d=zohomail.com; s=zohoarc; b=DJnLyNBgbBYSmgqAd/LriPCi7E/Bn5PD5AS40FDgSfgOjXXP16bly8zu+j3+LAhSrQRI0uBhqbwCxdetfH9zFbL9+yCqoaldTI5IaLaAoP5FOQAwTL006iNwzQYsTmZjPef8Ly2zifWpmAhxGxCOC4lgoTpkc4x9hq7kQzHDXZw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782422427; 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=9lPklvICYk46kVZkC0HSwMbSWR8J8MLaRWbDX9bXA3I=; b=iwwww1fAmeZrEgp4enVpTcIaj7cbqtBg9XP5GL7qq0P6Gd2vKeOVKysdA3jTvr5QBEtcuzZ7nImqyFwkbi7mI3+YbFuELCWP7HsjPLv/TD2ZjtLvUGIm8U5hKczoTcXgDkCM7wb04TIiEWEIsP2BxtmM5cttW6D05xZxtVkW6yQ= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1782422427920104.44145187865695; Thu, 25 Jun 2026 14:20:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wcrUC-00074L-7R; Thu, 25 Jun 2026 17:19:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrUA-00073s-88 for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:19:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrU8-0003Ec-RX for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:19:45 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-292-Dm3JqVaxMxmYYtOcvdSxlA-1; Thu, 25 Jun 2026 17:19:42 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id CA0F9180123C; Thu, 25 Jun 2026 21:19:40 +0000 (UTC) Received: from localhost (unknown [10.44.24.16]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 650B430001BE; Thu, 25 Jun 2026 21:19:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782422383; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9lPklvICYk46kVZkC0HSwMbSWR8J8MLaRWbDX9bXA3I=; b=JtTkXZYfIhim5cYV59oskMEQKrk49fTjKSbIu0/SDogr6NbM4HICzCm2A+Hw9sobp/VqLU AaGbT8k9XOMU33v7QxjyI3fCpHfc21S06Bz4AcnrApIIplatQYPlMj56ykN0ieNpblO8nz Zw8BGQucGyeVfy5G8WlyHwwQ+KEiXfk= X-MC-Unique: Dm3JqVaxMxmYYtOcvdSxlA-1 X-Mimecast-MFC-AGG-ID: Dm3JqVaxMxmYYtOcvdSxlA_1782422381 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 26 Jun 2026 01:19:02 +0400 Subject: [PATCH v2 01/39] vl: fix -monitor none prefix matching MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260626-qemu-no-hmp-v2-1-8af31bc54c61@redhat.com> References: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> In-Reply-To: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster X-Developer-Signature: v=1; a=openpgp-sha256; l=861; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=4usgVJ9P7SKQwWT543/6Z9zcURG29yQ9Ga9Ctlbj7b8=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqPZtc8NUExapB9DEEIqlvUwWMs5snCsRnPF8Ue pqUzh43J8qJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaj2bXAAKCRDa6OEJdZac 5QUlEACEY61v/hZTAkhqqwcr0AosfkdmkSqFynF3R0E7OILya3/Kr/5Eh4e6mJYcX1gFDUVA1Zr qqBiis04oATpq264iedvFplYF9TK1H3b4ukvgTyRFDKinQMn3RZ1Suottp0IFHCDgFffsDPGuGU YLnoybCVPPnN/6SzSn7Qj76gz+lQAy+2zkHYGkbmm1oKFHMS78cpKN09gQqhjyoVLds8CyX2+so GmlxsAZv95HanBNsEvT/WkSGVRomV/QjGIcIJkpBR2z3r0zkANp1kUOH8SKId5vsb6/jzIo/XQX NnQn+puBVaS/cfKA68gz/rJnLthxViGNeuKkpNOFLG9yuZpcmbWPmHDPkraVZEiYBuvnK1GNG1/ 6iql982Z0tyclYaSGmogb85KantHW1E/nx2Z2OF2/BhfTf2F0MS3NxVLaqxrEiu9wioKhundROM Twk+oClXwg6W8TjEAbUNiFbfgxjzgzDST6mxIYe87oIl1jwVg5OCrnXRWjnpTc0gDSHfm6rxU/n yY3RRCgxuuoeWhH5lwVuxoPV9iQDIdkFlFPdZCEXHdEPZrpFZhoaSDVCwUlegYVPeoor689+Vvb UYBsnzCU+owZ/pXIz697dUK5GUVJzGXriHX0U/gcVuPMgt+GxESWrD4J8JUVa9R8eLEG3sgLf04 ge5R3Q9CN/lyIkg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1782422435416158500 Use g_strcmp0() for exact match instead of strncmp() which would incorrectly treat any string starting with "none" as disabling the monitor. Fixes: 70e098af88f ("monitor: allow to disable the default monitor") Signed-off-by: Marc-Andr=C3=A9 Lureau --- system/vl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/vl.c b/system/vl.c index 1c0da7df293..dd7fe828118 100644 --- a/system/vl.c +++ b/system/vl.c @@ -3221,7 +3221,7 @@ void qemu_init(int argc, char **argv) } case QEMU_OPTION_monitor: default_monitor =3D 0; - if (strncmp(optarg, "none", 4)) { + if (g_strcmp0(optarg, "none")) { monitor_parse(optarg, "readline", false); } break; --=20 2.54.0 From nobody Sun Jul 26 11:53:26 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782422427; cv=none; d=zohomail.com; s=zohoarc; b=Tmexzp8uoL3ygPYAnC8VDNPQpMCXCdcUj3m5sI77AieKDp8w8BFW5JLTgEqEtYk9m+Wo9re1l1mXua9FQuj47YUYtmBXVo5zwkL+K8YSpz4VB5KWjMGRWe9dF9y1viw0Vdu5A8Ed/jG/pXM8OY5yhHbysD+XbfEvzJ+mBN3swXM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782422427; 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=t6V2yhuPz4/MMobnQleMLN8MR601RDdJGRR+/jNhYv4=; b=CxNPfm1MEyCA5NsfN6Gyo8qwD3LCX000BDirOH3cGTlR9bzp3PPRgs+S1yUDfn4nzgaa0TX2Le4WKkJD3nlqocNy2D+FnK4waat/6cYg9dxZxMfNfPHGxlNlgD6IJZJcoRNAOhH91Z+uaeXo9IYWhUJzSkvr1bGCWAw4CN2edAQ= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1782422427699269.57170568295317; Thu, 25 Jun 2026 14:20:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wcrUH-00075G-PL; Thu, 25 Jun 2026 17:19:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrUG-000756-NQ for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:19:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrUF-0003IL-7E for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:19:52 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-627-O9uP5e5uN6GllBALVIT58A-1; Thu, 25 Jun 2026 17:19:47 -0400 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3180A1955DA3; Thu, 25 Jun 2026 21:19:46 +0000 (UTC) Received: from localhost (unknown [10.44.24.16]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A506F414; Thu, 25 Jun 2026 21:19:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782422390; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=t6V2yhuPz4/MMobnQleMLN8MR601RDdJGRR+/jNhYv4=; b=C3JjswEWbP2pcaXDphsr0/tbYbDbTokC01oR0XJYlEOHIJXOABjBqvpxxHthmKkEDk0wDz v+k/yKz9NCLYXHg9KRLXCcWNBCB9KW7+PVKDVSiDd4NB5MTD4HEqQsuXZBu6ke7+2YJMJd J6Axf3/kckvsCPi9MU48ZE7PhtfpP3I= X-MC-Unique: O9uP5e5uN6GllBALVIT58A-1 X-Mimecast-MFC-AGG-ID: O9uP5e5uN6GllBALVIT58A_1782422386 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 26 Jun 2026 01:19:03 +0400 Subject: [PATCH v2 02/39] hmp: remove 'vcpu' argument from trace-event help MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260626-qemu-no-hmp-v2-2-8af31bc54c61@redhat.com> References: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> In-Reply-To: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=1735; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=4/VTl0XRiKNS2h2lRzLT/8mJB7AwUmWzwykGNJG/70k=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqPZtcO5xqUyq47qhCo7KEVhGTUJWnsqBkkWTtV feQlyB5KNWJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaj2bXAAKCRDa6OEJdZac 5Z5/D/4myA5Rje8n5zfrX2MLjyJD7KugFf9XzmRlGhQumV4/8Wk06LnCHwuBJZYu6PT50njfrKB GKpCTRGdhDLlBDAYIfndLEEnFipQrxUNQllM6QuQtd1fVzp9ezNXK6nFUhuNv4Lwdq4un+wSAD9 2A8zq6uGPEBbXA3SV6qGGfDkk4F090uAltfIzhAW47vg+0ElFRFpLO1HL5ZN5PGClJ3KJY2iZOq Gee3ihKvHByU1LCOA2fw6qxvheDBfyBB6DphzpYP1b7fdrBtYmmdouYJVEkZe6r8PUy2IzmUtNo s9EjuxWDexuYThd1M5maaTzrVyZrKri5UDqlVrqzxdoTR0STC3Oi3FlB0OPyZ+DHB2+1PBv9sFw /tH+1cl4DaQXBwOx6I/3q9n9i+qdE5qEdiLQKX1roJlfjgEanMyMpZJgIQgCRiyJb1dQAIuCef/ 57ysgEE6Wq+tm8R3opsFfFuFS1JRwXXppzmvcCrBYHY4ho6honow+orIS4RVqON/hmX5+568JKi PHs9dKPWO0SmiyKL0UIXFGRxj+xpyXMky6EVD/6i51pg6/0T+Q2DYP+mnIni8K+77KYl6FO29fs ndC8VReF7gIFnW4CgkjS8wPx/vCaom7KGJQiaCWi6NvNrozFw3ZcMKJMEU0OVl0TfyYCsUpHXjW sxSrgGuud5P6Daw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 8 X-Spam_score: 0.8 X-Spam_bar: / X-Spam_report: (0.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-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: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1782422430153158500 Fixes: 89aafcf2a793 ("trace: remove code that depends on setting vcpu") Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- hmp-commands-info.hx | 6 +++--- hmp-commands.hx | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx index 82134eb6c21..2695ff04ffc 100644 --- a/hmp-commands-info.hx +++ b/hmp-commands-info.hx @@ -587,10 +587,10 @@ ERST =20 { .name =3D "trace-events", - .args_type =3D "name:s?,vcpu:i?", - .params =3D "[name] [vcpu]", + .args_type =3D "name:s?", + .params =3D "[name]", .help =3D "show available trace-events & their state " - "(name: event name pattern; vcpu: vCPU to query, def= ault is any)", + "(name: event name pattern)", .cmd =3D hmp_info_trace_events, .command_completion =3D info_trace_events_completion, }, diff --git a/hmp-commands.hx b/hmp-commands.hx index 7ae2468a3d9..2b658bbbf28 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -299,10 +299,9 @@ ERST =20 { .name =3D "trace-event", - .args_type =3D "name:s,option:b,vcpu:i?", - .params =3D "name on|off [vcpu]", - .help =3D "changes status of a specific trace event " - "(vcpu: vCPU to set, default is all)", + .args_type =3D "name:s,option:b", + .params =3D "name on|off", + .help =3D "changes status of a specific trace event", .cmd =3D hmp_trace_event, .command_completion =3D trace_event_completion, }, --=20 2.54.0 From nobody Sun Jul 26 11:53:26 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782422427; cv=none; d=zohomail.com; s=zohoarc; b=dozI7E559Xltn4FNN8nUN4//AiEyW60trzf+of6GwxZPdVUYVXTV+XwdyyWzz2tuyePnkHRdEc5zXg9aSs/CVQ6BY5oMfG9G/Y9ZARQ2lk+vxkfvZJ+Uwqvr4NxR4jSxj6prVxRcTN9vU/85Hpum2fHkSyHGhhOY3ewaQdxVDGo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782422427; 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=Z5A1Fmm4M8RrXZPhjzR9sV3rAlzlNlgQH97VWILPurQ=; b=KVKZAOmudyHsEPC/zKMf17P5/ShtG5Bp1ymmzmhcW/AXrvLsOJkMgVnWEHdU+3/aTP4muuLsJYfPpjxH4YW6Qp18wwBleRz4pRGG00uO+f65g/s0pLMc+nTIjUxdLlrTd2QOBuk8salf4Qamf3Zxtyo7+vwj13iv9PUG56g+XIw= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1782422427699593.0314005884862; Thu, 25 Jun 2026 14:20:27 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wcrUM-00076H-B3; Thu, 25 Jun 2026 17:19:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrUJ-00075f-Nb for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:19:56 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrUI-0003Jc-Es for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:19:55 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-635-JC2LtsCaN_WP8CkV2cDGdw-1; Thu, 25 Jun 2026 17:19:52 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4BB301955E75; Thu, 25 Jun 2026 21:19:51 +0000 (UTC) Received: from localhost (unknown [10.44.24.16]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 150B630001BE; Thu, 25 Jun 2026 21:19:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782422393; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Z5A1Fmm4M8RrXZPhjzR9sV3rAlzlNlgQH97VWILPurQ=; b=gIdKKBU7mM9TMguidIeNZg8Uxigz17/Zv/jfqIlL28gNMFFiIFHgjwf3NzLU/DVxrKg2Hj STtFhGKzTS2Nd2je4boGEp5TNBSvRCL0R8MWglGzvyYnp3qMt4FhWsN+qyFwdB9IOpCI9M EcDRAZo1A+ZRtYLUUzcK5iob23WP/Ps= X-MC-Unique: JC2LtsCaN_WP8CkV2cDGdw-1 X-Mimecast-MFC-AGG-ID: JC2LtsCaN_WP8CkV2cDGdw_1782422391 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 26 Jun 2026 01:19:04 +0400 Subject: [PATCH v2 03/39] hmp: fix snapshot_blkdev argument type MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260626-qemu-no-hmp-v2-3-8af31bc54c61@redhat.com> References: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> In-Reply-To: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster X-Developer-Signature: v=1; a=openpgp-sha256; l=908; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=yDXBGsCbQ79WaynGZjlcFthvE1q8wujUNM91a5aZAIk=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqPZtcmwOe+nOLqWoVD3RAvrv+rwh+O3QzfPc60 q5khugOOH+JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaj2bXAAKCRDa6OEJdZac 5dfcD/9KxdZAWd+YMFBWFKf51N5uDKkDwXJ88MlCla4Ki1tuoSk1yWYxiMtiOz8QQDZkkaDE10j uoLjyu+MMEWJo6OGlwuNUJywHOfSdK/mcOjpbbg+ES5hhC8GCv2nP+E6dMj2vqAvHjaQiYRgeyY Li5p1BNwyBuXQQbm06RT8f+Obm9sSJioPIV7lQp9BcicgMbTOSOkzfyE3JekRZDGxXY9p3q/FA0 Kh//oxu4TgbCGwiR0GJ1foyDqyMmbd+TLBNZ7d3IPeZyiIemtReFhtivUq2QSWVaGWbbDoQ96Aw Jq5onWQp1sRhQqDuhwzXswXq/oiSu/uy6gKEas7pH4ADyBAcrQPG82OPuBvLaEN7vBGemprkoJ5 7wv8LS6LYcHwbzlPLdwxl8o/Clu6nXOrvofa58Pw+LVlE8pDYhYYYPq9i/cKZqPy8e5s5BUx2Y0 Co4rSKtDL9uG7IgX5BGAxAb0GYjjrcqLua3ueQb6BJAy6X3N8ReuufJ5WrndLIiZBMt4sZujSkk WZZrfTDyyB12iPFWkmU0HSPukkMVwCPVS4nl9faH8sjY4DlpPshJU60DfKepAnUAuoPjowBPasf fRhzaZt2sk1qmqEuyJ2/qCTRMynK11wfcdlXbkrEhKJczTNgVUpDdycDt9Rvantqpx5zS7G4Xmk bCgr1mwET2yu5SQ== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 8 X-Spam_score: 0.8 X-Spam_bar: / X-Spam_report: (0.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-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: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1782422430149158500 The `snapshot-file` argument for `snapshot_blkdev` is mandatory. Correct the `args_type` definition to reflect this. Fixes: 6106e2492fe ("qapi: Convert blockdev_snapshot_sync") Signed-off-by: Marc-Andr=C3=A9 Lureau --- hmp-commands.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hmp-commands.hx b/hmp-commands.hx index 2b658bbbf28..1e286b7c89d 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1168,7 +1168,7 @@ ERST =20 { .name =3D "snapshot_blkdev", - .args_type =3D "reuse:-n,device:B,snapshot-file:s?,format:s?", + .args_type =3D "reuse:-n,device:B,snapshot-file:s,format:s?", .params =3D "[-n] device [new-image-file] [format]", .help =3D "initiates a live snapshot\n\t\t\t" "of device. If a new image file is specified, the\n\= t\t\t" --=20 2.54.0 From nobody Sun Jul 26 11:53:26 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782422476; cv=none; d=zohomail.com; s=zohoarc; b=klRIxNjcxbvdgpkShIKslcDFFl7n0sRXpk8AzoXk/4yX5wCFB4TbObcJydpRwkyfVDOKF3NKksuE+rDhSRzG2rGKnjjRw8i29fffvhs/YO4Y479oOZwqCjFEA44TgiPtI67BT+sbGDcakZ3Yxflhi1pWAqI+ElpedHqBUYvWDXw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782422476; 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=LuCsShhTUcXkPvuRrIUWWf8+KME2pbEfuwyApeJAwTw=; b=j30RfzsU1Z7i+OAdAWuiZ34BbR6thBngkl7oUsxo+ywHB/3BUX+QoVDItJPqO1x3AcnaL+/sxZeAHtJryu/px9dzNeue/9pz+9SLT2JN8P4bLGaTMd1CyyFuXtTLuEd8bxVtZkixxjtgbQa79EOeMBZ0vJ9KrqkyXjiKze5sRAA= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1782422476512128.44395284387997; Thu, 25 Jun 2026 14:21:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wcrUT-000790-LM; Thu, 25 Jun 2026 17:20:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrUR-00077x-1d for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:20:03 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrUP-0003LS-1s for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:20:02 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-320-8yP761GOP2qCf44mxBZQmA-1; Thu, 25 Jun 2026 17:19:57 -0400 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 104311955F61; Thu, 25 Jun 2026 21:19:56 +0000 (UTC) Received: from localhost (unknown [10.44.24.16]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2580F31D2; Thu, 25 Jun 2026 21:19:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782422400; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LuCsShhTUcXkPvuRrIUWWf8+KME2pbEfuwyApeJAwTw=; b=WVm5r4at8jygmW1VN8s3gdxK1GAAqRoao+OqGraUyPK168IcKecCEx7sZRHGF6gFkjJcOo ndmkfDLcbkv8Frvs4sAmO1rGMHxDVQKyy7ugB/6uqNls0vd4KA4AqjvmD10e+HDf4db/PM hab1RKHdtLUrrXs2QYRytkwaITYe+98= X-MC-Unique: 8yP761GOP2qCf44mxBZQmA-1 X-Mimecast-MFC-AGG-ID: 8yP761GOP2qCf44mxBZQmA_1782422396 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 26 Jun 2026 01:19:05 +0400 Subject: [PATCH v2 04/39] target/i386: decouple cpu_x86_inject_mce() from Monitor MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260626-qemu-no-hmp-v2-4-8af31bc54c61@redhat.com> References: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> In-Reply-To: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=7700; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=SCYHVO5Eci/m8A7sFldyMKqE8fRanoK15i2XOoRQedw=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqPZtcAzY/BQ0Dl6XH/F4KELfqw0p6PaWO9tzWm vBHPw0KDnSJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaj2bXAAKCRDa6OEJdZac 5XfJEACCPkHdbvtwapvMW+1xGe5MCvbQQLK+nv8YC2jrJOo6J0m5XW8jkzuEX7bZvd/OV3AtuOe UrE5dJ5a7eWDS7jSl3qdrfULugjUbrrvhTwQ/oXyqskV/QNzcHPgjCyJkW9ASNf+7SU0H1SYAms vcaP4GGtko/1F2ErhlQp2SAqfiGz7ez2q7/1PTz3ugmnae3sbAXxBzRHZ2+OX9jX7NsPGnk40fo upjeHW+5+zosx5qeL9AMezujyRp2ggfQgDHrJd1uWXN/P0tzEkoY9DIvGjXKBj34FiBfXyqfijH DtHC4UVkN33EH3xpCy57M11q03+T0XDdsp3f7MII4Apf6kXhFO5445BIp1ebRNRDINDdweft0/r bGg8P3UehGRC6JKPmQPOfcbf3hY3GnRTGmGFxYQ7aiXqPh4BfPLatx+NA89afLz7IlWr3dEEVEU /sqF/kACKA1bGZVTLX9HbCn2L1kOs7zOOaGweC90rM/9rzJxEj0IeTThTDKsOs11eoc8xFglMkB tjojq4S5Y3elxdGEUehB10uME1BTm0rU3r+BmY65+BUAqqJg2F9zRsQFT3jsspJkAf6EEbUjocZ PQcdINYLYWJnPn2l1htOLp14Qt5W6exP+K9k/gF+O/t09wOzMBpYL7JKApDqzxKHKpYpK0NO+Z2 Avw07ZHhUOJA9vg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 8 X-Spam_score: 0.8 X-Spam_bar: / X-Spam_report: (0.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-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: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1782422477599158500 Replace monitor_printf() error reporting with the standard **errp pattern. Drop the Monitor *mon parameter and return bool to indicate success, improving the function usage from non-HMP contexts. Update the KVM MCE injection path and hmp_mce() accordingly. Notes: - we may want to print the error in KVM path too - multiple error prints are now accumulated with error hints Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- target/i386/cpu.h | 4 ++-- target/i386/helper.c | 49 ++++++++++++++++++++++++++++-------------------= -- target/i386/kvm/kvm.c | 4 ++-- target/i386/monitor.c | 6 ++++-- 4 files changed, 36 insertions(+), 27 deletions(-) diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 67e2ecf3251..a8b211cf6c9 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -2842,9 +2842,9 @@ void do_cpu_init(X86CPU *cpu); #define MCE_INJECT_BROADCAST 1 #define MCE_INJECT_UNCOND_AO 2 =20 -void cpu_x86_inject_mce(Monitor *mon, X86CPU *cpu, int bank, +bool cpu_x86_inject_mce(X86CPU *cpu, int bank, uint64_t status, uint64_t mcg_status, uint64_t add= r, - uint64_t misc, int flags); + uint64_t misc, int flags, Error **errp); =20 uint32_t cpu_cc_compute_all(CPUX86State *env1); =20 diff --git a/target/i386/helper.c b/target/i386/helper.c index 68362141621..10d4ac03072 100644 --- a/target/i386/helper.c +++ b/target/i386/helper.c @@ -18,6 +18,7 @@ */ =20 #include "qemu/osdep.h" +#include "qapi/error.h" #include "qapi/qapi-events-run-state.h" #include "cpu.h" #include "exec/cputlb.h" @@ -27,7 +28,6 @@ #ifndef CONFIG_USER_ONLY #include "system/hw_accel.h" #include "system/memory.h" -#include "monitor/monitor.h" #include "kvm/kvm_i386.h" #endif #include "qemu/log.h" @@ -381,7 +381,7 @@ out: } =20 typedef struct MCEInjectionParams { - Monitor *mon; + GString *err; int bank; uint64_t status; uint64_t mcg_status; @@ -428,9 +428,9 @@ static void do_inject_x86_mce(CPUState *cs, run_on_cpu_= data data) * reporting is disabled */ if ((cenv->mcg_cap & MCG_CTL_P) && cenv->mcg_ctl !=3D ~(uint64_t)0= ) { - monitor_printf(params->mon, - "CPU %d: Uncorrected error reporting disabled\n= ", - cs->cpu_index); + g_string_append_printf(params->err, + "CPU %d: Uncorrected error reporting disabled\n", + cs->cpu_index); return; } =20 @@ -439,10 +439,9 @@ static void do_inject_x86_mce(CPUState *cs, run_on_cpu= _data data) * reporting is disabled for the bank */ if (banks[0] !=3D ~(uint64_t)0) { - monitor_printf(params->mon, - "CPU %d: Uncorrected error reporting disabled f= or" - " bank %d\n", - cs->cpu_index, params->bank); + g_string_append_printf(params->err, + "CPU %d: Uncorrected error reporting disabled for bank %d\= n", + cs->cpu_index, params->bank); return; } =20 @@ -459,7 +458,7 @@ static void do_inject_x86_mce(CPUState *cs, run_on_cpu_= data data) if (need_reset) { emit_guest_memory_failure(MEMORY_FAILURE_ACTION_RESET, ar, recursive); - monitor_printf(params->mon, "%s", msg); + g_string_append_printf(params->err, "%s\n", msg); qemu_log_mask(CPU_LOG_RESET, "%s\n", msg); qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET); return; @@ -488,14 +487,16 @@ static void do_inject_x86_mce(CPUState *cs, run_on_cp= u_data data) emit_guest_memory_failure(MEMORY_FAILURE_ACTION_INJECT, ar, recursive); } =20 -void cpu_x86_inject_mce(Monitor *mon, X86CPU *cpu, int bank, +bool cpu_x86_inject_mce(X86CPU *cpu, int bank, uint64_t status, uint64_t mcg_status, uint64_t add= r, - uint64_t misc, int flags) + uint64_t misc, int flags, Error **errp) { + ERRP_GUARD(); CPUState *cs =3D CPU(cpu); CPUX86State *cenv =3D &cpu->env; + g_autoptr(GString) err =3D g_string_new(NULL); MCEInjectionParams params =3D { - .mon =3D mon, + .err =3D err, .bank =3D bank, .status =3D status, .mcg_status =3D mcg_status, @@ -506,21 +507,21 @@ void cpu_x86_inject_mce(Monitor *mon, X86CPU *cpu, in= t bank, unsigned bank_num =3D cenv->mcg_cap & 0xff; =20 if (!cenv->mcg_cap) { - monitor_printf(mon, "MCE injection not supported\n"); - return; + error_setg(errp, "MCE injection not supported"); + return false; } if (bank >=3D bank_num) { - monitor_printf(mon, "Invalid MCE bank number\n"); - return; + error_setg(errp, "Invalid MCE bank number"); + return false; } if (!(status & MCI_STATUS_VAL)) { - monitor_printf(mon, "Invalid MCE status code\n"); - return; + error_setg(errp, "Invalid MCE status code"); + return false; } if ((flags & MCE_INJECT_BROADCAST) && !cpu_x86_support_mca_broadcast(cenv)) { - monitor_printf(mon, "Guest CPU does not support MCA broadcast\n"); - return; + error_setg(errp, "Guest CPU does not support MCA broadcast"); + return false; } =20 run_on_cpu(cs, do_inject_x86_mce, RUN_ON_CPU_HOST_PTR(¶ms)); @@ -539,6 +540,12 @@ void cpu_x86_inject_mce(Monitor *mon, X86CPU *cpu, int= bank, run_on_cpu(other_cs, do_inject_x86_mce, RUN_ON_CPU_HOST_PTR(&p= arams)); } } + if (params.err->len) { + error_setg(errp, "Failed to inject MCE"); + error_append_hint(errp, "%s", params.err->str); + return false; + } + return true; } =20 static inline target_ulong get_memio_eip(CPUX86State *env) diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index 9e352882c8c..d01519ef2f3 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -747,8 +747,8 @@ static void kvm_mce_inject(X86CPU *cpu, hwaddr paddr, i= nt code) flags =3D 0; } =20 - cpu_x86_inject_mce(NULL, cpu, 9, status, mcg_status, paddr, - (MCM_ADDR_PHYS << 6) | 0xc, flags); + cpu_x86_inject_mce(cpu, 9, status, mcg_status, paddr, + (MCM_ADDR_PHYS << 6) | 0xc, flags, NULL); } =20 static void emit_hypervisor_memory_failure(MemoryFailureAction action, boo= l ar) diff --git a/target/i386/monitor.c b/target/i386/monitor.c index a536712c755..785a13dd710 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -580,6 +580,7 @@ void hmp_mce(Monitor *mon, const QDict *qdict) uint64_t addr =3D qdict_get_int(qdict, "addr"); uint64_t misc =3D qdict_get_int(qdict, "misc"); int flags =3D MCE_INJECT_UNCOND_AO; + Error *err =3D NULL; =20 if (qdict_get_try_bool(qdict, "broadcast", false)) { flags |=3D MCE_INJECT_BROADCAST; @@ -587,7 +588,8 @@ void hmp_mce(Monitor *mon, const QDict *qdict) cs =3D qemu_get_cpu(cpu_index); if (cs !=3D NULL) { cpu =3D X86_CPU(cs); - cpu_x86_inject_mce(mon, cpu, bank, status, mcg_status, addr, misc, - flags); + cpu_x86_inject_mce(cpu, bank, status, mcg_status, addr, misc, + flags, &err); + hmp_handle_error(mon, err); } } --=20 2.54.0 From nobody Sun Jul 26 11:53:26 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782422481; cv=none; d=zohomail.com; s=zohoarc; b=d8/QsyZttq6NHRIFPsWHuhFr6cV53HrZa4zsXB1fb49FVjhEPXWHPoOwi7JMDvHRXQ3zfOOMiosSTs5oFbwKIP8Fb9O9WIDd/cijqAwRj3XAwx1A+rN5d4B0V4i17MQ4QwrPEyay5ZOYhFnSgLXYBXcv9rXPykFYG9ytvdKhmVw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782422481; 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=1ZVJSLuYC67R7uydR6aDnrGkLmhgIMa9GeQ+BIvj5s8=; b=QQkZRHwI98qq9uz3D+FlX8aFsH6Y2QPywFKgv7eLsgwFPRwVta0l2Gis9AZly2keYUuOZtvVcqATPH80Ae0Dj70HerYd9QWOXwwlsPKephcs8ijkLJzFs1mn6GSW3go4j/+0k2alT7PjlHZy5fr4SZGbjjpDhU79eWVATvpXLNw= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1782422481538627.0901489914174; Thu, 25 Jun 2026 14:21:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wcrUX-0007Eq-T8; Thu, 25 Jun 2026 17:20:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrUV-0007AB-DF for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:20:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrUT-0003Y8-Ud for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:20:07 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-459-moBKdVgTPvKIv5fab8AZ0Q-1; Thu, 25 Jun 2026 17:20:02 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1EEEE186BF3F; Thu, 25 Jun 2026 21:20:01 +0000 (UTC) Received: from localhost (unknown [10.44.24.16]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id DC83B1800370; Thu, 25 Jun 2026 21:19:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782422405; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1ZVJSLuYC67R7uydR6aDnrGkLmhgIMa9GeQ+BIvj5s8=; b=cMmXTJXjXMqd7J1F6dnt6bExO5we8X2bqaQa4NhCm7izg8U4ha/XGmYNfg9F4TnN38mTwy Lvnj4rilJnTnSnhxQ88qpjY8ADcwuxwws+nfcVgnMRiCZFalEgYc2vB+knuYcYc5Sq6DJi 8TrmLL1vw4Yi9yB4NlnIQ5x2nVyPqmQ= X-MC-Unique: moBKdVgTPvKIv5fab8AZ0Q-1 X-Mimecast-MFC-AGG-ID: moBKdVgTPvKIv5fab8AZ0Q_1782422401 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 26 Jun 2026 01:19:06 +0400 Subject: [PATCH v2 05/39] target/i386: return an error for invalid CPU in hmp_mce() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260626-qemu-no-hmp-v2-5-8af31bc54c61@redhat.com> References: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> In-Reply-To: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=922; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=H8fyqVWjZ5ZUdHKFdi/uAxwk9XqORp2OV/LppjqTpm4=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqPZtcGKOJtbyurPliXIN15bNh78IFupowNsKw+ TBbfaEeqUiJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaj2bXAAKCRDa6OEJdZac 5R1WD/9QYU0Uubnb1BlzmUTe3cbz3Ei4U2fsv2Jh2DRVkFSXSADZaKottyOff8+vcv/TUc+Wyzv MqGTKtvUIvQJzuu1EWLUJLqc+cW11uSi2/MttpO6EltswNhKjzyd5RImoMBDbOYrOfkeezKjIIm rVmGmeT0Pa1hDWSQ6MbYWhbPca2A/si1uLdJWstyun3dMzx+ruVJokdo1/aheyx+swp3QCNkaMR KCCTO3FN8QCgpnQz+sNomX1nDemWDRl8WJ8OsPydHWo+SrQGWS4f1xkIeSQN+GlXYOSNJZwWHJe Ni5gYPrf5zKshe5OMFHTT/H0SJlm0Gs04liobhAfGJ91M0poAW7dwYrPSstd2JJGdGVBTPf1bVk XISR1Ph7zqJiE0jMqzYNwB4485Ll40Z6petcqGEU664SED2uJy1cNmBKJW+I0noQtfcCWW2cSWo XEPOCb/+ckWwJhWBTcuPteISwyT+NuAxu5PG5ns3uBxbaIZb3/cUjZD9DvVLIFDE+ZKo8JRpnjG uWgXNprt1ZxFHo3nr+o/OHjQ1d8DArgZ98zgtIdTPoRpT64/keNmXoxP8RxG3fUq6EowD4fw48W 2FH2EGveIzeaSolXpnceChPGHD8dXDqJGao4xl46xUYrWfAz4aq23qlTCrsidUYg++flbH9unkB RoqDch6PIkyF+rg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1782422483400158500 Rather than silently doing nothing. Suggested-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- target/i386/monitor.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/target/i386/monitor.c b/target/i386/monitor.c index 785a13dd710..9ed772e6d7f 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -586,10 +586,12 @@ void hmp_mce(Monitor *mon, const QDict *qdict) flags |=3D MCE_INJECT_BROADCAST; } cs =3D qemu_get_cpu(cpu_index); - if (cs !=3D NULL) { + if (cs) { cpu =3D X86_CPU(cs); cpu_x86_inject_mce(cpu, bank, status, mcg_status, addr, misc, flags, &err); - hmp_handle_error(mon, err); + } else { + error_setg(&err, "Invalid CPU %d", cpu_index); } + hmp_handle_error(mon, err); } --=20 2.54.0 From nobody Sun Jul 26 11:53:26 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782422439; cv=none; d=zohomail.com; s=zohoarc; b=HNq9eOdKR8H+Ky4YTo8nePkBBQ/hs0vaqDwJVOipJcPQju3mlpszunv9jZvbhAKaH6QZ3dCXRKYntTYSKfdxMmq3nN7IGCYL+XTCYQpBUUbbi50vkKJGbSgjPOu/jgercZdoml2J9VNjmy03A8HT95/3ZLHfROG6mzW4J5knAdk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782422439; 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=5lk5PsxmfKI4ipw2LeDsYFGtNcsYrczmHb6iHdJBDMo=; b=Yf1OzWfRQMAGLFiXDJpc66RwuY6nL0bBTmsb18xZcU3jWtD/Q4l2yx5JVlHXDCDCzHB1Oxf5rr8DjiPLwW0xlNzDevl515ytv0XAhqtZ2Vwwsh4A3fCHQjQzjcinMNCK/E/NzGwMSbuMFg71AUSs2Zb7L8YNh377SuzVqToaibo= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1782422439932112.65484503556684; Thu, 25 Jun 2026 14:20:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wcrUe-0007LL-3q; Thu, 25 Jun 2026 17:20:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrUd-0007Kz-3w for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:20:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrUb-0003Yx-I3 for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:20:14 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-588-4ytSTSrLONihun5tlrsCGQ-1; Thu, 25 Jun 2026 17:20:07 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 680D2195604F; Thu, 25 Jun 2026 21:20:06 +0000 (UTC) Received: from localhost (unknown [10.44.24.16]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3BEB9195608F; Thu, 25 Jun 2026 21:20:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782422412; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5lk5PsxmfKI4ipw2LeDsYFGtNcsYrczmHb6iHdJBDMo=; b=MMwTQ6EZnPewjN8XhyekASALVw43Jah0MeDW+XfnNt3s2MJZpAwmA4H0S1oBoPzQcPmZ9I 0ZUBo7dFzh5R6fWqhtmDjTLUXa7q92oZf9pf6Au37b4GeofSJ9srQ47aXMPiQXpBoWlF2s cyQpjqzpOJEGQuxXskt0Y+Kmjx9pvJ4= X-MC-Unique: 4ytSTSrLONihun5tlrsCGQ-1 X-Mimecast-MFC-AGG-ID: 4ytSTSrLONihun5tlrsCGQ_1782422406 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 26 Jun 2026 01:19:07 +0400 Subject: [PATCH v2 06/39] system: move gpa2hva() to system memory unit MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260626-qemu-no-hmp-v2-6-8af31bc54c61@redhat.com> References: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> In-Reply-To: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=4294; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=xbU9n85vt1Q6BmMlT6kkna9p34gfKGS1TjEpwIrEGVk=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqPZtc9E1Ydub1vyX387MtbeICFe+OwqKLZeLYm fCGDOdIg9OJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaj2bXAAKCRDa6OEJdZac 5QcID/0TlC/HiqI82KZcFK5hEPSDDMXw3QY5PilzcDeCAILIKnc2bAVYKULo6m3Sky79MgjlZlI 73W4DPhxMDvZ1CsfIdijtQTprgxbs998DNNNY3sDjY5Xh2Qx4gKPMjmZiGZZqr7V+6r06ZJDgE+ +Ljw1dHRVQSFx8AocL5RmxEcJTgyPbfvaKGbGFZb13jozzLIYjPmWGgh1lXw4Z5OrqkZcjzqqFH QlkDVzMS/eOI0LWHUoIIWMUgvy+nsR8LAz+iNgaugS4vvIsrGPqmkLcin+grexOCKEGn+kt2Vpn u0BSYXQqw9qksHIp8VsbUIvI67UeosJKgakkC+kR+ftGD2uWQc8tN2+Nu8eWnqXHmKb1xVloaz3 Zg+N4/tSK3VFGgF6N88islYaeDsNWp1lEqSJRDXE8WyQKhkrKctlm9dqIe3iV13C/3NqsFQ9zeY L31aQgLUd9AP1GprD7NmV15ARJyvZG2ZeRoHfM8JjXAd8Ns3KdVikFPpXwRsAvX/qXyy1eNxYCo 6w+5q86b8OdX58KD7SH73TpPtRELBVJDn4VED3kpegKQcu5iSs8D2TLgffWtxkiHnrABbS8lV58 tIZ7afFNigAd5x9U4oGvGd2LM2vkODNks7Wb7cVvncFHttnRcq/8GvMkTdiX6LmhWaPQPePtejf sTOlGthrI3C4ryg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 8 X-Spam_score: 0.8 X-Spam_bar: / X-Spam_report: (0.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-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: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1782422441315158500 The function is now used by SEV code path. Move it to physmem.c rather than hmp-cmds.c. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/monitor/monitor.h | 2 -- include/system/memory.h | 2 ++ monitor/hmp-cmds.c | 31 ------------------------------- system/physmem.c | 31 +++++++++++++++++++++++++++++++ 4 files changed, 33 insertions(+), 33 deletions(-) diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h index 55649a86641..17182e626a7 100644 --- a/include/monitor/monitor.h +++ b/include/monitor/monitor.h @@ -42,8 +42,6 @@ int monitor_get_cpu_index(Monitor *mon); int monitor_puts_locked(Monitor *mon, const char *str); void monitor_flush_locked(Monitor *mon); =20 -void *gpa2hva(MemoryRegion **p_mr, hwaddr addr, uint64_t size, Error **err= p); - void monitor_read_command(MonitorHMP *mon, int show_prompt); int monitor_read_password(MonitorHMP *mon, ReadLineFunc *readline_func, void *opaque); diff --git a/include/system/memory.h b/include/system/memory.h index 47a0e06fbf8..237b2b6aaee 100644 --- a/include/system/memory.h +++ b/include/system/memory.h @@ -2832,4 +2832,6 @@ bool ram_block_discard_is_required(void); void ram_block_add_cpr_blocker(RAMBlock *rb, Error **errp); void ram_block_del_cpr_blocker(RAMBlock *rb); =20 +void *gpa2hva(MemoryRegion **p_mr, hwaddr addr, uint64_t size, Error **err= p); + #endif diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index 443b8c785dc..521ab8a641c 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -709,37 +709,6 @@ void hmp_physical_memory_dump(Monitor *mon, const QDic= t *qdict) memory_dump(mon, count, format, size, addr, true); } =20 -void *gpa2hva(MemoryRegion **p_mr, hwaddr addr, uint64_t size, Error **err= p) -{ - Int128 gpa_region_size; - MemoryRegionSection mrs =3D memory_region_find(get_system_memory(), - addr, size); - - if (!mrs.mr) { - error_setg(errp, - "No memory is mapped at address 0x%" HWADDR_PRIx, addr); - return NULL; - } - - if (!memory_region_is_ram(mrs.mr) && !memory_region_is_romd(mrs.mr)) { - error_setg(errp, - "Memory at address 0x%" HWADDR_PRIx " is not RAM", addr= ); - memory_region_unref(mrs.mr); - return NULL; - } - - gpa_region_size =3D int128_make64(size); - if (int128_lt(mrs.size, gpa_region_size)) { - error_setg(errp, "Size of memory region at 0x%" HWADDR_PRIx - " exceeded.", addr); - memory_region_unref(mrs.mr); - return NULL; - } - - *p_mr =3D mrs.mr; - return qemu_map_ram_ptr(mrs.mr->ram_block, mrs.offset_within_region); -} - void hmp_gpa2hva(Monitor *mon, const QDict *qdict) { hwaddr addr =3D qdict_get_int(qdict, "addr"); diff --git a/system/physmem.c b/system/physmem.c index c21ea929153..d1db81db87b 100644 --- a/system/physmem.c +++ b/system/physmem.c @@ -4492,3 +4492,34 @@ void ram_block_del_cpr_blocker(RAMBlock *rb) { migrate_del_blocker(&rb->cpr_blocker); } + +void *gpa2hva(MemoryRegion **p_mr, hwaddr addr, uint64_t size, Error **err= p) +{ + Int128 gpa_region_size; + MemoryRegionSection mrs =3D memory_region_find(get_system_memory(), + addr, size); + + if (!mrs.mr) { + error_setg(errp, + "No memory is mapped at address 0x%" HWADDR_PRIx, addr); + return NULL; + } + + if (!memory_region_is_ram(mrs.mr) && !memory_region_is_romd(mrs.mr)) { + error_setg(errp, + "Memory at address 0x%" HWADDR_PRIx " is not RAM", addr= ); + memory_region_unref(mrs.mr); + return NULL; + } + + gpa_region_size =3D int128_make64(size); + if (int128_lt(mrs.size, gpa_region_size)) { + error_setg(errp, "Size of memory region at 0x%" HWADDR_PRIx + " exceeded.", addr); + memory_region_unref(mrs.mr); + return NULL; + } + + *p_mr =3D mrs.mr; + return qemu_map_ram_ptr(mrs.mr->ram_block, mrs.offset_within_region); +} --=20 2.54.0 From nobody Sun Jul 26 11:53:26 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782422534; cv=none; d=zohomail.com; s=zohoarc; b=evlcMfYDqbXChWONFCvbIoKo0fWNYoB4E3INpy5YTjCg/9pJZ+1T3PJ/b1otJraX0QoHXDuZJvg+y0Mie22ncZNYPBgaWOHBdGwClXRIFF71L7Y6lCX1RI6iyzdsw8QG6E/UFs67RTiH3omEfgRiFAIS53faIUpPa6+sEN58BXQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782422534; 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=ftVnIrg7IhvTgsH874VGkrhm8Pf1lWF5j+NY0pcecck=; b=BJm5zv4p8Zv1oB6TwKhB8HGNctJNSx9fNbT6NoGabLaHXM4vKvYTH01Wvh1uyjwvVXvEiEXplmwarWU6azulC9uY84XkjuiISExI7bD2U9h/6j98xC1FdAnsGdbwVAJsqrI2xZ6H6mJhGqPiszdO6eqZTDfptghvRiDYMPzcDLA= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1782422534035452.5106210367079; Thu, 25 Jun 2026 14:22:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wcrUg-0007MB-Be; Thu, 25 Jun 2026 17:20:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrUe-0007Lh-If for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:20:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrUd-0003ZZ-3Z for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:20:16 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-656-nT2W2dvrNk27tEmOmPjXuA-1; Thu, 25 Jun 2026 17:20:12 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A35E41955DE1; Thu, 25 Jun 2026 21:20:11 +0000 (UTC) Received: from localhost (unknown [10.44.24.16]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 63C5318001D2; Thu, 25 Jun 2026 21:20:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782422414; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ftVnIrg7IhvTgsH874VGkrhm8Pf1lWF5j+NY0pcecck=; b=anTbhioYza07X4g0ozDd5fOtxftg7KcKURWoW3vvcdn2rXwWWVIdaoueis4piYabRgrzUr 4rnOIAslGH88MpN5gaDQgbBzlx+2ZCydWY5R1le3uK1adQpWkAkfww7/yBpi3niYIDadSO ytpGp+Xre2SvfJMwj9i4SKLV1mDi4us= X-MC-Unique: nT2W2dvrNk27tEmOmPjXuA-1 X-Mimecast-MFC-AGG-ID: nT2W2dvrNk27tEmOmPjXuA_1782422411 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 26 Jun 2026 01:19:08 +0400 Subject: [PATCH v2 07/39] s390x: prevent crash if given invalid CPU# MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260626-qemu-no-hmp-v2-7-8af31bc54c61@redhat.com> References: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> In-Reply-To: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Eric Farman X-Developer-Signature: v=1; a=openpgp-sha256; l=679; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=0ZX8MI33C7olws3WyEP4w6WQCQONCzm0bGIQjW3TgEc=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqPZtcm3dbxAu36aCwW8dyDHFprKxcZ0n/08WEN ToYEk15V0CJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaj2bXAAKCRDa6OEJdZac 5Ql9D/9UOouZHotPPSPZXDFhFOTzTRPe5XAFoAMVPZxFO/xeO003zHrHr1KKbh+c8APAY3pvHsc 4L6DbT1gM6NWfKDV13ioicxB3jzWBPg/ZrmdTkaI/7DCUrqEY+ukamvxFDaDvULbzZMqzfw47TV SnndMZ8/tjsTyF2urupd6TO5pCqfffFxAPtuNBGWIX6hGMe/Juhcgu/xBGIn/sxGOaC+n5ipHI+ MuTn+RJVdyZZbO9n0Ihm2oiRfCt4ivoJ/5c2JYaQkVA4cW5LkKS/Wt3NZAAxpOENFYavEoXT2D/ Mq8t/6dx47O2bS+/ydhFg8bbGeb14i4fKQ+09BsZHpjRtemKQRBMXJcI0j1zv1o+VyDqcXH9T// jVCTdvVrhvpkRH9AWjCKstCf9NYptgeWVIGddMMUo4Wu1qT2A3bP6/Y3d+AG/bDFVje33maGb/K JrUznwVYZKRtprKTFTexMd74tnQvuRFpibdhhS9gQI9icxq+DOGnFTA0qb8Zcosz9kDCIlfDbqx AvzmCTordaJBIOtpG9c6aFXxbpZ4jj3R27/blo1xBFcVMBY+i16sSDmw9C8thnqiRrFZNZPFAf0 RKFgum1szry8tnXcNaWCGAQpQB//0RG3lZQD8CsQ5nbVb5s1TiI1dDqG6TnMvSoBvmBU7CmUjEV 1aCSCC77T9qQ2Rw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 8 X-Spam_score: 0.8 X-Spam_bar: / X-Spam_report: (0.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-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: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1782422535766158500 Reviewed-by: Eric Farman Signed-off-by: Marc-Andr=C3=A9 Lureau --- hw/s390x/s390-virtio-ccw.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index 25a9fa49554..d0fd894eb67 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -729,6 +729,11 @@ static void s390_nmi(NMIState *n, int cpu_index, Error= **errp) { CPUState *cs =3D qemu_get_cpu(cpu_index); =20 + if (!cs) { + error_setg(errp, "CPU %d does not exist", cpu_index); + return; + } + s390_cpu_restart(S390_CPU(cs)); } =20 --=20 2.54.0 From nobody Sun Jul 26 11:53:26 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782422439; cv=none; d=zohomail.com; s=zohoarc; b=btpHtI0r1R6PI6zLdHMgGrCytDi70h0v/d6MqzDpdT1AtDeOgpmNz4y+HzfPQR3rML6dRcpDLyWdxU+R4MbrFrA9GkN6pWHyBSRXqgZDdfUoSIro7mguoyrWdYFd148J/uzuWnks5LFS80tFpk8qhfjnBuQpsbM4n5RnVlY4a9E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782422439; 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=Yxvj36VhLZ4K4hFt17jHRxD7HzRdTAOS+0IhywHutVI=; b=JNZrbhDpCAlFCaiwvjVRopEBKlc+IvKNC8OPSpoxu1y7RA89p2fqJyS5KmYcdeUN4OqIxOKCH0Nsqgsh3OF5ZYElso+pbPRMk61jV49mVxq/9wKabhHp55/JpPdZ1IkcDXzdAeLXJNqlhKViFGfQ6y5+0iDdM+QZz3YNN7OYMIo= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17824224398191010.2186640823144; Thu, 25 Jun 2026 14:20:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wcrUz-0007kL-2r; Thu, 25 Jun 2026 17:20:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrUu-0007Yk-Rs for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:20:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrUh-0003aZ-HR for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:20:20 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-237-PwXXNHnxMkuczUCKXt8PdQ-1; Thu, 25 Jun 2026 17:20:17 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7E8CB187311E; Thu, 25 Jun 2026 21:20:16 +0000 (UTC) Received: from localhost (unknown [10.44.24.16]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8E164195608D; Thu, 25 Jun 2026 21:20:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782422418; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Yxvj36VhLZ4K4hFt17jHRxD7HzRdTAOS+0IhywHutVI=; b=RviXrf2/BXRqBK+nDha2/HKy1nc6YDydoDUNPEvGNZbuOo4lRCmxCT94Y1JM94eRK2UdCn wK2G4WNAKETn5SoknUk04e+H6xmWZ7haFAEPTF26dsVZki/UT+k944jVg5CMisvn765Nnf Jipen2sh6GUCxq1XaLe6OYkneZxY/uE= X-MC-Unique: PwXXNHnxMkuczUCKXt8PdQ-1 X-Mimecast-MFC-AGG-ID: PwXXNHnxMkuczUCKXt8PdQ_1782422416 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 26 Jun 2026 01:19:09 +0400 Subject: [PATCH v2 08/39] system: decouple qmp_inject_nmi() from Monitor MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260626-qemu-no-hmp-v2-8-8af31bc54c61@redhat.com> References: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> In-Reply-To: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster X-Developer-Signature: v=1; a=openpgp-sha256; l=1472; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=nniyeCdT7aYf3nKVdm9bUAQZLwv8F/CBtyNTOyMrLcI=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqPZtcmfYc+KcfExUEyy1vKZeWZEeewig0hbE5e Ad5s364QOyJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaj2bXAAKCRDa6OEJdZac 5XItD/4t/NqhJ8Fea89VYEj3wocoJTpDsmp27YHlGSUIGE8fKC7mR0wIIQnZ8omzWgaIf0dNZlp AsV0mmO4QOCdpsaeGuqF5Ttf8QOQqB1Pq6wlfCZE3IfUrn24dnPKhPvuXsWbsDHP4m1/+/DfqDl Pz4YgNl9UWwoI3JloLYohzPCQBgCY02hPsZ1W5MJXU1xgt95Gyh4ryXMp7sqKCVWsoR14iSY0mp gyo3V0txOE/MdTILl7eqDHQPCm+3cTBGoyQzySpxsIGvh6ozsDhW0Kf4brNtLoL1ea3CbqLCn7G uaD7gDc6OXjrk8+T5nlVQ11xaaBmhdNI1CM3FdjAxIFjDLH2N5XMz/pFlTW7AY9tsaPewcwSb04 T3hSx3XUJLNEnnfsMUE07lroZnKPGNWtmIwLymAnVAFZV3zyXLozqI0bxs3YV+ajWwtvfo2w4Zm 7Vw11Ni13q+yzuqJq41nTn0BIJFPrnahLVKnEKU3FcR2PM20q9+y07evMNZf71nU8+Zn3wqWMlL WkfTyML1O4bo1fxxTiURGBwQV8bAkL+f95HmpfVj7Ll4Vgba5EYDiaFnqPpOnP55FIBjAKzge1W mJSp8/lW6LxXhUMXQ8WVdjJylnHkN7VYHfHU/Vzs4mbW5ld4fclo1ZP3Y9E5Ca5JD/hQl8J4VwS +XP06clH8ksyz6A== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1782422441260158500 Use first_cpu directly instead of going through monitor_get_cpu_index(), as this is HMP-territory. QMP doesn't have a `cpu` command, we should add arguments instead when needed. Update the inject-nmi doc to accurately describe per-architecture NMI delivery. Signed-off-by: Marc-Andr=C3=A9 Lureau --- qapi/machine.json | 5 +++-- system/cpus.c | 7 +++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/qapi/machine.json b/qapi/machine.json index 685e4e29b87..03461f5f723 100644 --- a/qapi/machine.json +++ b/qapi/machine.json @@ -432,8 +432,9 @@ ## # @inject-nmi: # -# Injects a Non-Maskable Interrupt into the default CPU (x86/s390) or -# all CPUs (ppc64). The command fails when the guest doesn't support +# Injects a Non-Maskable Interrupt into the virtual machine. The NMI +# is delivered to all vCPUs (x86, hppa, ppc64) or to the first vCPU +# (s390). The command fails when the guest doesn't support # injecting. # # Since: 0.14 diff --git a/system/cpus.c b/system/cpus.c index 49f6daec3cd..6e3ef0afeca 100644 --- a/system/cpus.c +++ b/system/cpus.c @@ -915,6 +915,9 @@ exit: =20 void qmp_inject_nmi(Error **errp) { - nmi_monitor_handle(monitor_get_cpu_index(monitor_cur()), errp); + int cpu_index =3D UNASSIGNED_CPU_INDEX; + if (first_cpu) { + cpu_index =3D first_cpu->cpu_index; + } + nmi_monitor_handle(cpu_index, errp); } - --=20 2.54.0 From nobody Sun Jul 26 11:53:26 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782422443; cv=none; d=zohomail.com; s=zohoarc; b=ViH8PigzpM9/QZ0kquDF9iijoL23TDV+QVGPKoiUY423lpgMkdAZT9uqcSORWbOzbbQODo51bTdu+en9znYifAxTVE4vq+qBRbcyojRUabWdmq5fj3CtF++3Cjxj7haSZNQ/IdsbR0H+NVMrm1+nyY1nLRnCSvugeN0LiIGKeOM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782422443; 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=cUu2SICVtier0Tnb7CxJKyc/ewW3x183YcMpT+FJb+s=; b=R+iARfSuhoQoro4ubC9kB5095oj8QjkH7nM1ZVjge0flL7l1tmAyeGOA1eTg/sfZwyhR3YjrJ0UIb4ckqFE5Pzq+E/kq2cLpcdeTDF/DtJwuO0WYi6a5s3QT+K2hLJ3pn6UzOWHWFxQnvnOb1nrYDxVSVRmJUfDR9nHBc5Bk38Y= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1782422443581686.1344448652654; Thu, 25 Jun 2026 14:20:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wcrV0-0007pg-DN; Thu, 25 Jun 2026 17:20:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrUy-0007i0-5k for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:20:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrUw-0003br-FK for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:20:35 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-115-S6B5Y8wONFyNivgQo0OSPQ-1; Thu, 25 Jun 2026 17:20:22 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id BBC231955F3D; Thu, 25 Jun 2026 21:20:21 +0000 (UTC) Received: from localhost (unknown [10.44.24.16]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A09BB18001D2; Thu, 25 Jun 2026 21:20:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782422426; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cUu2SICVtier0Tnb7CxJKyc/ewW3x183YcMpT+FJb+s=; b=KpuPWKRhwKNnAhZSK+y8GXg9C9CSMosTN55SjXf6c3vM5BxvdjiUDUSoCYE2jeAbhjvlqP JyH91bB22ZU1gWmyOfumgDiH2O1DqpDF6gEuH44RgwxKbY7nPv22WM7pkmwuQQDKhDwL/Y ZWFqontIUtPYEch6ydgUgIZOQyqPof4= X-MC-Unique: S6B5Y8wONFyNivgQo0OSPQ-1 X-Mimecast-MFC-AGG-ID: S6B5Y8wONFyNivgQo0OSPQ_1782422421 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 26 Jun 2026 01:19:10 +0400 Subject: [PATCH v2 09/39] hmp: correct the nmi documentation MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260626-qemu-no-hmp-v2-9-8af31bc54c61@redhat.com> References: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> In-Reply-To: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster X-Developer-Signature: v=1; a=openpgp-sha256; l=606; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=+QRGJalote4uzB1iRMSKaDD99pTJJl2HI3yPBUU5DxI=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqPZtccs0ebQ/Y6z5gPnOj6TxyNXZU8KU56UBpF Yv97gBY0JyJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaj2bXAAKCRDa6OEJdZac 5UopD/9KR7pZXEmkbTaHozQy/3JB1sZJZmOv4NmV4FiC/J7iWrpg4OfTh4hBRmSFkLuNKs30nH3 kfcsWgEQGEJ9zhBbmNkIaFJCrpr0vcoABlV9FyxlgdRMySu62WVMItEzW+MnBkV4zpNmQcoVutD zJU8nk0Xlrze3h88IpoLx+YIm8uwl4r5FoigT3A6gXGQSyGZUQu5RA6ldJqEOfpl/Z5Mdf/5f1P vzymlG97Z4ch01ng3BV6TwV/x40qqBvxIAmjCal4uA3nxKNghf9yXMxqmsL5teLcjm3AbNleHrD Tex/HTV63bRIn0HPtDbWPWoWxFcB6il1DwAU5YFJPhxHiea57sXJ6pZrDysTJMklV78ziDf0PBs C8DRZ1IgNhbygmpqDxrC0N0FOt+G0pHhUUVB5hrI4T/Z/pSdLSnnfnIfqSEojh5WaTHmA4BozIE 5HFgUiTs9+fDFp1k86JltrHuarz200pdzT5ZTzvVfqztrFjPsJ8RyBMq4CyDeyHfqCxS0xHc73k UZMqak9D+9aXbpxxVLNhrHk9MosMHOd8Lhet7/JLyZYn34t+9qB1SImshEEl7y3UNzUjm7Q4RkF YA7YZIQgiAkbpt71v5OCugT5k97VcJqADLbPiM/gZdEbK0IQqoxSSazt4gnH/D/ggKzRZnRhdT0 hhS4ah1yKGvRI7Q== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 8 X-Spam_score: 0.8 X-Spam_bar: / X-Spam_report: (0.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-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: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1782422445615158500 Signed-off-by: Marc-Andr=C3=A9 Lureau --- hmp-commands.hx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hmp-commands.hx b/hmp-commands.hx index 1e286b7c89d..129052963c7 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -868,8 +868,9 @@ ERST .cmd =3D hmp_nmi, }, SRST -``nmi`` *cpu* - Inject an NMI on the default CPU (x86/s390) or all CPUs (ppc64). +``nmi`` + Inject an NMI on the associated monitor vCPU (``cpu`` command, on s390x)= or + all vCPUs (on other architectures). ERST =20 { --=20 2.54.0 From nobody Sun Jul 26 11:53:26 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782422443; cv=none; d=zohomail.com; s=zohoarc; b=dVr2jUxUP11i9JRp/V6+vdziPWQMFcd45N/rD9ZRRMVb0nKN6kzuMlcRTneV0SL5VZaCi3T4sMBdEdIRhTdbsXScsZFGI9lpvBs3PRVhqUlrrFWLhmvUq8YRpPgXWoFr0kE06T8hSU87vgiiOmT86EyP9z5gML6JHApaDYS7JrE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782422443; 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=tMyb34RvpzoZGbFF9JAsKhfXa/yG+uXFI7y0vzHVKyw=; b=L4drvJ4hhVPZLq9ysmLztu9lrz09tNagO6Iz+AVXONdM6ZhGwTXxHi5zg0brbsN47tYJ0gxms+zWmS97VgjgGHW7LOGJANegLDbHKP4Tpm+HKkHnUO4lC/5t//HCsXrzEN4+dJwX6YbjV4KGdKIIRrrAfsPhnbm7kTN571CsI5E= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1782422443677412.98893217317743; Thu, 25 Jun 2026 14:20:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wcrV1-0007wm-NA; Thu, 25 Jun 2026 17:20:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrUz-0007kh-2G for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:20:37 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrUw-0003cM-H9 for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:20:36 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-576-E59a4dRsNLKQ2KXIDvtFfg-1; Thu, 25 Jun 2026 17:20:27 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E66EA1800639; Thu, 25 Jun 2026 21:20:26 +0000 (UTC) Received: from localhost (unknown [10.44.24.16]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B1210195608D; Thu, 25 Jun 2026 21:20:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782422429; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tMyb34RvpzoZGbFF9JAsKhfXa/yG+uXFI7y0vzHVKyw=; b=gDuXywyqu0njuBoldlWojXhpFSy8VpvAdVGyZxTsVoAEAVIaDhYFJABeP7nGzKJPOcvuMd Kyix4/xFdwkgJZwhicKruaf3l/CT+1sSausAyiaLzpFgUXQ7mDaRk5BBVygYTo6VIoFkc8 pEFHRW6APhQdArXE+zNlBdXjYSWeiCw= X-MC-Unique: E59a4dRsNLKQ2KXIDvtFfg-1 X-Mimecast-MFC-AGG-ID: E59a4dRsNLKQ2KXIDvtFfg_1782422427 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 26 Jun 2026 01:19:11 +0400 Subject: [PATCH v2 10/39] monitor: move HMP-only fields from Monitor to MonitorHMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260626-qemu-no-hmp-v2-10-8af31bc54c61@redhat.com> References: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> In-Reply-To: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=5734; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=4vPwJLShkp9ORZeOYZ/tYvZiuQ1L55Jxsk+IAj+rfxY=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqPZtcfoRmpHQYbJkZfFddv8K1vq0Pj0ljy6TmW PDQQNASA8WJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaj2bXAAKCRDa6OEJdZac 5dZ0EACAnK9r7vHy346uLb4vBkWVgfx4Yjp82aq7gxvtm42rMUBnezHQl7EqD3vzmCiGVQ0xej+ /bFts7SAd84d4HZzwDAaGoUU2mYnu77q43vrtH3GrEHlGun1AqQEzeYNDT0G4TIFEOHUyYnCjZp IMRAvM30WVBUtMSsnRnlxkx7F50pFCtN7wlz0i+f1bmDnDfJnrd+F5p+f0Nt8havxhS0PdcP7I5 7GrER6k3W5DVK3cP8bUh02FyHWa4TWqUnX8GxzUgqyjBFysQ8I/LviDOIXISyI79LT9blZpFUHU 3VGy+NXkvZ6QGXphU0iRTaG3Hes2qg/okh/K0ChM7HqfjjLnazbs3IEJeMRnabzKtsAyJSOshe8 V2KlCsy/AFfmrg5j0rCwYu2R9tga2/6+X6pG37cBYLnEALdX2MubArCX9oDzVSahAExAPOTUlhq aGmRYR9/xjoKBbudGHhesoqHKYFTbdYaXgHjIIRH0IBMjrz1BWub3xtEZrA8CaDidiC570lEDPf UVD7NM2Ah7zLLzH5Zqx824NorE0yhvf+EOoXK39ERXL85krLNzaoHlN54GU2u1B8O3lcXb9fNfN zQLXWQmRbz6cykdWKR1YEevk8prCgywD0mezI0tvIWEjZdsH9sygRrslS31cg0nB2Xpln+JARpb 4fGNKThLD68HShg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1782422445705158500 mon_cpu_path and reset_seen are only used by HMP monitors; move them from the base Monitor struct into MonitorHMP to properly encapsulate HMP-specific state. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- monitor/monitor-internal.h | 4 ++-- monitor/hmp-cmds.c | 17 ++++++++++------- monitor/hmp.c | 5 +++-- monitor/monitor.c | 16 +++++++++++----- 4 files changed, 26 insertions(+), 16 deletions(-) diff --git a/monitor/monitor-internal.h b/monitor/monitor-internal.h index a5c4aba306e..e071ad3e2e8 100644 --- a/monitor/monitor-internal.h +++ b/monitor/monitor-internal.h @@ -108,7 +108,6 @@ struct Monitor { bool skip_flush; bool use_io_thread; =20 - char *mon_cpu_path; QTAILQ_ENTRY(Monitor) entry; =20 /* @@ -124,7 +123,6 @@ struct Monitor { GString *outbuf; guint out_watch; int mux_out; - int reset_seen; }; =20 struct MonitorHMP { @@ -138,6 +136,8 @@ struct MonitorHMP { * These members can be safely accessed without locks. */ ReadLineState *rs; + char *mon_cpu_path; + int reset_seen; }; =20 typedef struct { diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index 521ab8a641c..e7a02b1fddb 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -496,31 +496,34 @@ void hmp_dumpdtb(Monitor *mon, const QDict *qdict) /* Set the current CPU defined by the user. Callers must hold BQL. */ int monitor_set_cpu(Monitor *mon, int cpu_index) { + assert(!monitor_is_qmp(mon)); + MonitorHMP *hmp_mon =3D container_of(mon, MonitorHMP, common); CPUState *cpu; =20 cpu =3D qemu_get_cpu(cpu_index); if (cpu =3D=3D NULL) { return -1; } - g_free(mon->mon_cpu_path); - mon->mon_cpu_path =3D object_get_canonical_path(OBJECT(cpu)); + g_free(hmp_mon->mon_cpu_path); + hmp_mon->mon_cpu_path =3D object_get_canonical_path(OBJECT(cpu)); return 0; } =20 /* Callers must hold BQL. */ static CPUState *mon_get_cpu_sync(Monitor *mon, bool synchronize) { + MonitorHMP *hmp_mon =3D container_of(mon, MonitorHMP, common); CPUState *cpu =3D NULL; =20 - if (mon->mon_cpu_path) { - cpu =3D (CPUState *) object_resolve_path_type(mon->mon_cpu_path, + if (hmp_mon->mon_cpu_path) { + cpu =3D (CPUState *) object_resolve_path_type(hmp_mon->mon_cpu_pat= h, TYPE_CPU, NULL); if (!cpu) { - g_free(mon->mon_cpu_path); - mon->mon_cpu_path =3D NULL; + g_free(hmp_mon->mon_cpu_path); + hmp_mon->mon_cpu_path =3D NULL; } } - if (!mon->mon_cpu_path) { + if (!hmp_mon->mon_cpu_path) { if (!first_cpu) { return NULL; } diff --git a/monitor/hmp.c b/monitor/hmp.c index cc4390486e1..de8804af51a 100644 --- a/monitor/hmp.c +++ b/monitor/hmp.c @@ -1453,6 +1453,7 @@ static void monitor_read(void *opaque, const uint8_t = *buf, int size) static void monitor_event(void *opaque, QEMUChrEvent event) { Monitor *mon =3D opaque; + MonitorHMP *hmp_mon =3D container_of(mon, MonitorHMP, common); =20 switch (event) { case CHR_EVENT_MUX_IN: @@ -1467,7 +1468,7 @@ static void monitor_event(void *opaque, QEMUChrEvent = event) case CHR_EVENT_MUX_OUT: qemu_mutex_lock(&mon->mon_lock); if (!mon->mux_out) { - if (mon->reset_seen && !mon->suspend_cnt) { + if (hmp_mon->reset_seen && !mon->suspend_cnt) { monitor_puts_locked(mon, "\n"); } else { monitor_flush_locked(mon); @@ -1482,7 +1483,7 @@ static void monitor_event(void *opaque, QEMUChrEvent = event) monitor_printf(mon, "QEMU %s monitor - type 'help' for more " "information\n", QEMU_VERSION); qemu_mutex_lock(&mon->mon_lock); - mon->reset_seen =3D 1; + hmp_mon->reset_seen =3D 1; if (!mon->mux_out) { /* Suspend-resume forces the prompt to be printed. */ monitor_suspend(mon); diff --git a/monitor/monitor.c b/monitor/monitor.c index 00b93ed6124..2dec0e299af 100644 --- a/monitor/monitor.c +++ b/monitor/monitor.c @@ -541,12 +541,17 @@ static void monitor_accept_input(void *opaque) Monitor *mon =3D opaque; =20 qemu_mutex_lock(&mon->mon_lock); - if (!monitor_is_qmp(mon) && mon->reset_seen) { + if (!monitor_is_qmp(mon)) { MonitorHMP *hmp_mon =3D container_of(mon, MonitorHMP, common); assert(hmp_mon->rs); - readline_restart(hmp_mon->rs); + bool reset_seen =3D hmp_mon->reset_seen; + if (reset_seen) { + readline_restart(hmp_mon->rs); + } qemu_mutex_unlock(&mon->mon_lock); - readline_show_prompt(hmp_mon->rs); + if (reset_seen) { + readline_show_prompt(hmp_mon->rs); + } } else { qemu_mutex_unlock(&mon->mon_lock); } @@ -622,12 +627,13 @@ void monitor_data_init(Monitor *mon, bool is_qmp, boo= l skip_flush, =20 void monitor_data_destroy(Monitor *mon) { - g_free(mon->mon_cpu_path); qemu_chr_fe_deinit(&mon->chr, false); if (monitor_is_qmp(mon)) { monitor_data_destroy_qmp(container_of(mon, MonitorQMP, common)); } else { - readline_free(container_of(mon, MonitorHMP, common)->rs); + MonitorHMP *hmp_mon =3D container_of(mon, MonitorHMP, common); + readline_free(hmp_mon->rs); + g_free(hmp_mon->mon_cpu_path); } g_string_free(mon->outbuf, true); qemu_mutex_destroy(&mon->mon_lock); --=20 2.54.0 From nobody Sun Jul 26 11:53:26 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782422463; cv=none; d=zohomail.com; s=zohoarc; b=PPur3phCeVHuaNgYKphRMzgX5+LX22dYYJbEtHTx4oc3kbldGBZ/xxSlc3HdEkxgSpHLBNk02HT5HlNTQHewgaMEK/qgq7a9je+c1YdiDy6qdHX98YixyRH0tosHo7QsCr+iGcjrK2jwoQlUhOnFPOcaU3fjrsXQ1L/HBkH2abE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782422463; 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=Skr8Rm5X4C+gKnfD4thdT1isIvOXB74ElKgQq8XP8kY=; b=f+qx2d8exbpRfN6KiLRyEBwjZiRUizRr8a1jDkTmITVr2CSJX562twqIFwIaT3IKtB/0Wen1SASAeuRSnudaCJ+U2HrrCSiQ0sE/wGeQc+q1mCMWZPhVB0G3QyAlsQDHbpgr/mkSR6zssOI4NkOwiGCD1i0notlLxXJIRFROW9A= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17824224639721016.3540328737521; Thu, 25 Jun 2026 14:21:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wcrV3-00086g-Ua; Thu, 25 Jun 2026 17:20:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrV1-0007xv-RS for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:20:39 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrV0-0003ej-3Z for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:20:39 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-85-Ie8C82NMPDa_JCiMyJDJdQ-1; Thu, 25 Jun 2026 17:20:33 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2C970180266F; Thu, 25 Jun 2026 21:20:32 +0000 (UTC) Received: from localhost (unknown [10.44.24.16]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id EAC9A1956047; Thu, 25 Jun 2026 21:20:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782422437; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Skr8Rm5X4C+gKnfD4thdT1isIvOXB74ElKgQq8XP8kY=; b=PHOntaj15rteDetJCblN348p5B+VhFiGeuZx/zKqYodfCpuoNSJfzcOIRYcYc7d8LHkDd5 MjgxybwRiWYiTaKQ7UjV2kXWlV3DCXFCL3IlCJkZ+Xo15NKhqrjaSvYn2GDO24wV5smMEm NaKRj8iK7JiMOuOXGRF9uPH6STqMf9M= X-MC-Unique: Ie8C82NMPDa_JCiMyJDJdQ-1 X-Mimecast-MFC-AGG-ID: Ie8C82NMPDa_JCiMyJDJdQ_1782422432 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 26 Jun 2026 01:19:12 +0400 Subject: [PATCH v2 11/39] tests/functional: use query-version QMP command instead of HMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260626-qemu-no-hmp-v2-11-8af31bc54c61@redhat.com> References: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> In-Reply-To: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=1339; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=VABZ91CpDkSkDFI6s9a/Gj6b4iw29Q7c1h+yv62zR08=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqPZtc135UYWMo7NHuTPC3x/QuN88VfbT18Ijot 0uE0yt5j0CJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaj2bXAAKCRDa6OEJdZac 5Tk0EACr/r2lSUicHZJxdH8EiGrj8/HyEGTXC7qSZp1oMcinWfLPWs5o5Xff1yv0bpUiA83CHIN UiJLhJMH9SBhqV3kVlSMbCyAh96rMe8gF9xIJOlTHQoda1uohu9y0Td43dwbAYH2zxkrTgZHA51 /RYQk+wX43uXSdi6YeHzhQjrvlLjZ9IX6F66XGrzO99CDn6/UG4bTYCBMhR8FV+ss7H45WqHS3D sjEDVzwXzZzXcOUjTWJuc/dsGHpJrq8yn+jw6CyBv7iKSnkxq5cJqcJcIcPFAJ9HawzGgiZf8Uy /YoQ+U4lTFtk+zs4CXHkiPA1tT6lBbkt+1EmIerkq6Tjf28uqx1gS7a3gg67KzzTtpuMHtdCEs/ uQD17bkOY2vUVf/NxEXTgVV10buLYdfBAqxaOkhAWqS75PRqdjKYdNh5KKMNnS/c/X38eLTTmHi 8CWDsYuIycPihQi5dHvHoqX079EpfA/aAZ0PPEzj0HCMWHgDQRUtAXZEIJ7BNhLSVpk5ygC/Yoj OOpJLId7ZpLc8XWJcsCp2JCzIviXAimyY9AVLfLBXUwiEy/TrR8WLotkRS95cbUfxaKcDl9qbhD iWOOlbPgoXLDEq9lHbD7tuUt4KiKzbrn2GzVFkuAuXxmymTX4xxemFp+r9JLwGbKSFRHYR+d8Ic IIsLZP7onjnL8jg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1782422465776158500 Replace the human-monitor-command based version test with the native QMP query-version command, which returns structured version data. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- tests/functional/generic/test_version.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/functional/generic/test_version.py b/tests/functional/ge= neric/test_version.py index 3ab3b67f7e3..7764424826e 100755 --- a/tests/functional/generic/test_version.py +++ b/tests/functional/generic/test_version.py @@ -16,13 +16,15 @@ =20 class Version(QemuSystemTest): =20 - def test_qmp_human_info_version(self): + def test_qmp_query_version(self): self.set_machine('none') self.vm.add_args('-nodefaults') self.vm.launch() - res =3D self.vm.cmd('human-monitor-command', - command_line=3D'info version') - self.assertRegex(res, r'^(\d+\.\d+\.\d)') + res =3D self.vm.cmd('query-version') + version =3D res['qemu'] + self.assertIsInstance(version['major'], int) + self.assertIsInstance(version['minor'], int) + self.assertIsInstance(version['micro'], int) =20 if __name__ =3D=3D '__main__': QemuSystemTest.main() --=20 2.54.0 From nobody Sun Jul 26 11:53:26 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782422492; cv=none; d=zohomail.com; s=zohoarc; b=DrfUUoZw0H2Xyhs9zvTfn3UGz6Xvd1mUq4mSr0LGtIOzA1IMxcnS89Xr2UPziNYBt9ZGOPfGpjuJ4rU48KmJY2C8F+UcH1RiQefvHhjsKLGb9rK22+ZwT/H2zCrhqjnkoPm7f36XxfxYYteXdl0KTLLq/WJkIgj+0Z7eVlvJdJo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782422492; 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=HFZW4htD7KstfFIhfIJGqYLKdEI7sRcsvA10/+qg6Ps=; b=HkSK67TuO/5nkMLda6bQdGtvqoH/R0gV6aJ37FtqdTRSkS7pDtsonMvhTKDaRiEl3PyhxunQcgYnaciArvDu9JkNCrx8I3vSy7+81Os6uOsyiYTiHU0xD13Y4pSsHKYoORUAiZJ33Oymejob6jw1Gh26YrvSqZ/qcC/d/6P9Vak= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1782422492188368.367956575996; Thu, 25 Jun 2026 14:21:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wcrV9-0008P6-FG; Thu, 25 Jun 2026 17:20:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrV7-0008Ky-EG for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:20:45 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrV5-0003fK-EL for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:20:45 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-588-m6pFOMUfOC6STH7M3lEnZA-1; Thu, 25 Jun 2026 17:20:38 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DF6CE1801373; Thu, 25 Jun 2026 21:20:37 +0000 (UTC) Received: from localhost (unknown [10.44.24.16]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8DDC6195608D; Thu, 25 Jun 2026 21:20:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782422442; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HFZW4htD7KstfFIhfIJGqYLKdEI7sRcsvA10/+qg6Ps=; b=FE8rQjkuMtp59g2yyzUVhVsPcJlqBk3HNxWCWhU7s/NHrRMC3j+XanEglDbIhPTxK9ve98 fYaJ9/s6o79nHi6PusRfNOUB77il3MUd2NO1BPR9hH65lBZeFwTKtq1tq2d1ghVrGEKkr/ NvY1xtDybUqJhl9lm65aac+maJDRpUY= X-MC-Unique: m6pFOMUfOC6STH7M3lEnZA-1 X-Mimecast-MFC-AGG-ID: m6pFOMUfOC6STH7M3lEnZA_1782422438 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 26 Jun 2026 01:19:13 +0400 Subject: [PATCH v2 12/39] net/qapi: add x-query-usernet command MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260626-qemu-no-hmp-v2-12-8af31bc54c61@redhat.com> References: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> In-Reply-To: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster X-Developer-Signature: v=1; a=openpgp-sha256; l=3738; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=RVZlR73SwAw8gRicRiqQ2wSi7+LVPpMuKf/GFhWwXd0=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqPZtc3CJ3ll40uoAhMfUg5cMTnZvC2a/7fZtXW 8EXLOxHae+JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaj2bXAAKCRDa6OEJdZac 5RzsD/0YpdPhSvTS0dTMzvvcVob7AVbw220CQE3mWTSMOYhXMAwJCCYtuN7m5oiVoAwUghQvLAZ TmJv6Q3WI5/ppEE/j98GaZ4i0yj8p375NZ/ucreE1XiwCmPwC1CrWqBczzvulseYsGR+kgdmJoP 7RGQhumKYei0mFtV1n3uLDucJS/V/TayiMuiI0NKUKD/HChWeGsZE04ZzpRu0TRER5ZSOHgGswy 0eUfS3PA+daBKe2CtTOYjD14mk9hnMNdNT8oJP66gw9J7GSN1LJH4zWK83GreapMwMVe/05NDeX 1IjQg/VNe18FQfJNCyDmJCcjy8vUZl+OICBCJp8qBC7hhFQDmB2kZM2LkrwHnR8cMZLGs60Yd57 WSFtHP+9EyK6AiM8YAYW90b4DZd8CPCNvggyQKVi9dcmikiYafZrKmepsW3rFgQ2HY9GuOzwWer OK98UmK/1L56dNUbFIrEwrYicRYpxSRgn2aHrowz73iwS3zNFwPL145PvKF3GGJic8S8vdrXvQw 5CaYdzoy1z/bwHFqkejD/kI3vtCMA5sED5nvfJCBqNwJZXgeoDGq7oMI1S45A6t9kidPNJ4FQ8p qII3D2qjZiprry9kl6zWOqoxqMJ19F+iXB+kbSaL6q+D/nGzL92blagZPvvu+kGKQmWkGatBArV tjQ4HSOEiIpZerw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1782422493744158500 Add a QMP command to query user-mode network stack (slirp) connection states, providing a structured alternative to "info usernet" HMP. The new command returns a list of UsernetInfo, with hub-id, hub-name, and connection info for each slirp stack. It is marked unstable as it is meant for debugging. Rewrite hmp_info_usernet() as a thin wrapper over qmp_x_query_usernet() so the HMP and QMP paths share the same implementation. This is part of the effort to decouple HMP from QEMU core. Signed-off-by: Marc-Andre Lureau --- qapi/net.json | 44 ++++++++++++++++++++++++++++++++++++++++++++ net/slirp.c | 34 ++++++++++++++++++++++++++++------ 2 files changed, 72 insertions(+), 6 deletions(-) diff --git a/qapi/net.json b/qapi/net.json index 1a6382825c5..08ec7f37946 100644 --- a/qapi/net.json +++ b/qapi/net.json @@ -1261,3 +1261,47 @@ ## { 'event': 'NETDEV_VHOST_USER_DISCONNECTED', 'data': { 'netdev-id': 'str' } } + +## +# @UsernetInfo: +# +# Information about a user-mode network stack (slirp). +# +# @hub-id: The hub id, if available. +# +# @hub-name: The name of the hub. +# +# @info: Network information from slirp. +# +# Since: 11.1 +## +{ 'struct': 'UsernetInfo', + 'data': { + '*hub-id': 'int', + 'hub-name': 'str', + 'info': 'str' }, + 'if': 'CONFIG_SLIRP' } + +## +# @x-query-usernet: +# +# Query user-mode network stack connection states. +# +# Features: +# +# @unstable: This command is meant for debugging. +# +# Returns: list of user-mode network stack information. +# +# Since: 11.1 +# +# .. qmp-example:: +# +# -> { "execute": "x-query-usernet" } +# <- { "return": [ { "hub-id": 0, "hub-name": "vnet", +# "info": "..." } ] } +## +{ 'command': 'x-query-usernet', + 'returns': ['UsernetInfo'], + 'if': 'CONFIG_SLIRP', + 'features': [ 'unstable' ] } diff --git a/net/slirp.c b/net/slirp.c index 9e9941fe73e..517dd23be14 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -43,6 +43,7 @@ #include "system/system.h" #include "qemu/cutils.h" #include "qapi/error.h" +#include "qapi/qapi-commands-net.h" #include "qobject/qdict.h" #include "util.h" #include "migration/register.h" @@ -1200,18 +1201,39 @@ static int slirp_guestfwd(SlirpState *s, const char= *config_str, Error **errp) return -1; } =20 -void hmp_info_usernet(Monitor *mon, const QDict *qdict) +UsernetInfoList *qmp_x_query_usernet(Error **errp) { + UsernetInfoList *head =3D NULL, **tail =3D &head; SlirpState *s; =20 QTAILQ_FOREACH(s, &slirp_stacks, entry) { + UsernetInfo *ui =3D g_new0(UsernetInfo, 1); int id; - bool got_hub_id =3D net_hub_id_for_client(&s->nc, &id) =3D=3D 0; - char *info =3D slirp_connection_info(s->slirp); + + if (net_hub_id_for_client(&s->nc, &id) =3D=3D 0) { + ui->has_hub_id =3D true; + ui->hub_id =3D id; + } + ui->hub_name =3D g_strdup(s->nc.name); + ui->info =3D slirp_connection_info(s->slirp); + + QAPI_LIST_APPEND(tail, ui); + } + + return head; +} + +void hmp_info_usernet(Monitor *mon, const QDict *qdict) +{ + g_autoptr(UsernetInfoList) list =3D NULL; + UsernetInfoList *entry; + + list =3D qmp_x_query_usernet(&error_abort); + for (entry =3D list; entry; entry =3D entry->next) { + UsernetInfo *ui =3D entry->value; monitor_printf(mon, "Hub %d (%s):\n%s", - got_hub_id ? id : -1, - s->nc.name, info); - g_free(info); + ui->has_hub_id ? (int)ui->hub_id : -1, + ui->hub_name, ui->info); } } =20 --=20 2.54.0 From nobody Sun Jul 26 11:53:26 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782422467; cv=none; d=zohomail.com; s=zohoarc; b=eVPuMxJLwa5gaQ5xl2+9DDN9ljkuh4DWLoqqD+e51YjCRGZd9nUoDWrDUms3Xp5iy283kyNI4MCVGeARtwJF7skmiliBay4RbRAKLrSV3pas5adE0e9igBrTQvKb60GuQ8SBvDgV1Vk0AAC8ivwDqrKTAwnRyk8buK0SMUgGkic= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782422467; 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=iaRYlIVDmmEr7mjUP2HQlVLCLl/YXVWkvOhqZcPCbFw=; b=CQWqPDRiSyZlf3B1VoQ+CyPC+03sjX0URT+2oNgkCV9Dj27+AKsT0pPbeJNoVXaa6hwna6V+hv41Svu732lh/2kO+JBPk17aGPbWhcZVymODhSy9C4udwF0iR7aWNJaRNMmYamodm6afGaX0UhtaL9NvPAasDo+biOsGK8fahAo= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1782422467297797.5134421305426; Thu, 25 Jun 2026 14:21:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wcrVH-0000IP-LG; Thu, 25 Jun 2026 17:20:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrVC-00006T-54 for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:20:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrVA-0003gg-AO for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:20:49 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-275-qJ-RuNiqO1CyCK2uZZhzbA-1; Thu, 25 Jun 2026 17:20:44 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 68E681955F73; Thu, 25 Jun 2026 21:20:43 +0000 (UTC) Received: from localhost (unknown [10.44.24.16]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 33BC23000B52; Thu, 25 Jun 2026 21:20:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782422447; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iaRYlIVDmmEr7mjUP2HQlVLCLl/YXVWkvOhqZcPCbFw=; b=RDHdiomkqIDLIGfICA/PCPg+UBy2OhVNHWiZb8VKdxJACrV3yBusJL7t12XeMVjHbXEyOz ApH5ddG85Biy67IdWPN3asQTFd1wjtZ2WyuMGXpAJpNryiuDfqUXlBWGuYA09wKScbb4QB Uk2dgb2ks1esTK2uGdnggDFJL4BWcIM= X-MC-Unique: qJ-RuNiqO1CyCK2uZZhzbA-1 X-Mimecast-MFC-AGG-ID: qJ-RuNiqO1CyCK2uZZhzbA_1782422443 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 26 Jun 2026 01:19:14 +0400 Subject: [PATCH v2 13/39] python, tests: switch usernet queries from HMP to QMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260626-qemu-no-hmp-v2-13-8af31bc54c61@redhat.com> References: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> In-Reply-To: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster X-Developer-Signature: v=1; a=openpgp-sha256; l=3407; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=LoAZSMRv5Ty+H9JbaYaYBeWts8NBrOu4fzEPlV1z6CY=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqPZtcdKUFVnp8pcpJWIU+2uQf86R1F+LCPArZe Fn5vMQFT2CJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaj2bXAAKCRDa6OEJdZac 5dw8D/9pRB/wBwscvwvSgP6k2GjkiIIlZVYds0b4gN15bQdKdINMQbsX5w72Jc5tlkyJwjU6pBE 5AHE24lLA6hD3iVyBYMpRye2P76p8P0r7LAeOhXNtxeSqhr9fpeG4VH36uOXA/YpJy29e4nim/Q O460vy+371cd67dW7lPfDOxt0Ij9orda8H19GlcPcoJeyyRhBgJMW8eEphYYWZn1fFclwmnAsfD pvayrZ3P12q9rN3wTC15A3x6/vkUVjrTpabjxtBEA7Sur9m+6RZwC54ZVyDcfs1ahcbOBRmmKD7 QAdNh+n+OLQPtMY3X1tqy/OT4uWOfO7/9HMScU+c73HvhKxQsYKiev+f2EsVwcQwSUP+Ph5To0w 7+XpaOhnMQ/lwyKsphzLhfvGcX+c/mUe6LYInJWSIU0ZlsccVPPfIQIj1rbT1OD8TeeA/+KZAHT 7GtQVS6POXHrbRMY+Dp6lg19Z5uKhX1pyPhraMn41RtFQsSN3o/9q79rwbTZJ3ASPK4NvBan3s3 xEwhGBjhLxl25AmSBqUzcoIRWfbdR1wvNK/pBz7g2nwawOjqoRcGtRwy6kS6kRVmrqMs8TZvXKR 9oVl4Dgv0Qxb1/uNaLNmEp/ZCFlfBkeTgEIZe3gPNjDqSZKyYuVxvnL35ekxRq49yDu25eD1uEE EwOP1U677nrFnSw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 8 X-Spam_score: 0.8 X-Spam_bar: / X-Spam_report: (0.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-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: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1782422469786158500 Replace human-monitor-command "info usernet" calls with the structured x-query-usernet QMP command in get_usernet_hostfwd_port() and the VM test runner boot path. Since x-query-usernet returns a list of UsernetInfo entries, callers now iterate over the result and extract the port from each entry's "info" field. Also switch get_info_usernet_hostfwd_port() from split('\r\n') to splitlines(), since QMP strings use \n rather than the HMP monitor's \r\n line endings. Signed-off-by: Marc-Andre Lureau --- python/qemu/utils/__init__.py | 5 +++-- tests/functional/qemu_test/utils.py | 8 ++++++-- tests/vm/basevm.py | 13 ++++++++----- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/python/qemu/utils/__init__.py b/python/qemu/utils/__init__.py index be5daa83634..e32911d4c6d 100644 --- a/python/qemu/utils/__init__.py +++ b/python/qemu/utils/__init__.py @@ -46,10 +46,11 @@ def get_info_usernet_hostfwd_port(info_usernet_output: = str) -> Optional[int]: """ Returns the port given to the hostfwd parameter via info usernet =20 - :param info_usernet_output: output generated by hmp command "info user= net" + :param info_usernet_output: output generated by "info usernet" or + the "info" field from x-query-usernet :return: the port number allocated by the hostfwd option """ - for line in info_usernet_output.split('\r\n'): + for line in info_usernet_output.splitlines(): regex =3D r'TCP.HOST_FORWARD.*127\.0\.0\.1\s+(\d+)\s+10\.' match =3D re.search(regex, line) if match is not None: diff --git a/tests/functional/qemu_test/utils.py b/tests/functional/qemu_te= st/utils.py index 826c267785b..0992db49ab2 100644 --- a/tests/functional/qemu_test/utils.py +++ b/tests/functional/qemu_test/utils.py @@ -14,8 +14,12 @@ =20 =20 def get_usernet_hostfwd_port(vm): - res =3D vm.cmd('human-monitor-command', command_line=3D'info usernet') - return get_info_usernet_hostfwd_port(res) + res =3D vm.cmd('x-query-usernet') + for entry in res: + port =3D get_info_usernet_hostfwd_port(entry['info']) + if port is not None: + return port + return None =20 def pow2ceil(x): """ diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py index 9e879e966a3..198b04e8c37 100644 --- a/tests/vm/basevm.py +++ b/tests/vm/basevm.py @@ -312,12 +312,15 @@ def boot(self, img, extra_args=3D[]): self._guest =3D guest # Init console so we can start consuming the chars. self.console_init() - usernet_info =3D guest.cmd("human-monitor-command", - command_line=3D"info usernet") - self.ssh_port =3D get_info_usernet_hostfwd_port(usernet_info) + res =3D guest.cmd("x-query-usernet") + for entry in res: + port =3D get_info_usernet_hostfwd_port(entry['info']) + if port is not None: + self.ssh_port =3D port + break if not self.ssh_port: - raise Exception("Cannot find ssh port from 'info usernet':\n%s= " % \ - usernet_info) + raise Exception("Cannot find ssh port from" + " 'x-query-usernet': %s" % res) =20 def console_init(self, timeout =3D None): if timeout =3D=3D None: --=20 2.54.0 From nobody Sun Jul 26 11:53:26 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782422481; cv=none; d=zohomail.com; s=zohoarc; b=ZE2H5Y8DUX4KS0HRJlVRZXf84JsNiolvPPtXfEkREVm0dMdyXoXigDDcVel11PNOvQoTMboDLA5PjMCoS/b2j8GGN8kwA2gI57QuL4X59IC5D6EaOiIsN+tKHphmyQn4rEm7F+rNwLAAqIya/pRF+XJm5m3EAE9ldlXdrxVnY/Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782422481; 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=OSY4Du+wThReu2l3luDB3PBkWNSPdVplZPiWAY+h5N0=; b=MJB5M0GthVmQHGL3iKlxebqIoJ8y2fE8sdPcSH0KzD0MUKASxbSnQgMz0tD5ZTChDrlQTvkVY5sdqq4CVSJJUqbqftBiycUNZTyckZoztxeyjfJVL17VgFsHxB/9kFkX25miXFuAp0vEuj6ZZLAwlQP0uroHTtpKL/5cXAI4yAY= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1782422481927531.4147888132591; Thu, 25 Jun 2026 14:21:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wcrVT-0000tH-4V; Thu, 25 Jun 2026 17:21:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrVM-0000cV-Iv for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:21:00 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrVK-0003hX-3X for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:21:00 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-507-_oY5XN5AMbGW1FXRjkpKkw-1; Thu, 25 Jun 2026 17:20:49 -0400 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 77F671800366; Thu, 25 Jun 2026 21:20:48 +0000 (UTC) Received: from localhost (unknown [10.44.24.16]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 36E5F414; Thu, 25 Jun 2026 21:20:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782422452; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OSY4Du+wThReu2l3luDB3PBkWNSPdVplZPiWAY+h5N0=; b=TQdayiZ+UmtNGPmq2cVNfe7V48LxV9qmXk0Y4A/vA3C3Zr1f4LADA+Oq9MUFlebyioDDd/ KIphEyGi7DFlMoFr9SZAfy5O4I/WjipEan8/2+NLpHYzKT6KllWYXAAdhQlS63bSztrFav 1qudvXYtB0ndEgUppsHbyiNHxNGiM+c= X-MC-Unique: _oY5XN5AMbGW1FXRjkpKkw-1 X-Mimecast-MFC-AGG-ID: _oY5XN5AMbGW1FXRjkpKkw_1782422448 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 26 Jun 2026 01:19:15 +0400 Subject: [PATCH v2 14/39] tests/qtest/pnv: drop unnecessary -serial mon:stdio MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260626-qemu-no-hmp-v2-14-8af31bc54c61@redhat.com> References: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> In-Reply-To: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=1682; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=AvhBD7LC8S+UUVLOR6honVVMWXRDaIcekyjM+15DjDg=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqPZtdDPaAkj72s+CTx+lAtUfGpo/5ERUKWCTXd n++zzewLTOJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaj2bXQAKCRDa6OEJdZac 5RskEACWNGAJDsnrcCnremHbffnlY5u5gjDFMgQpYMzQ48XqvO8Ehml4Hn8y9BwZWoaHL6lJ79s OBtkT+TC6wfNXlmskUt75eRS1R5e76tf60ajImv03n4i/KkFQZX00433dmWzhhlftAoZyqtldOV Fjk/bnd5hOmhilfBxyEEFqZokYVo3D7LZnD4KzzXasZlNQ6qQh8JaMumOtQU3k5M2mhY0Cy11Po AohsX0726l0Jzq52myjUdUaptmZ9fcXvTmsEGLdIU6CJpGrUoElNj5TIeWxEEADLHudm0vQoNs9 v/Vq2nqVRUpuK1pj/Ztanmi9CD5w/SoYuddTWEUBJnhCarxNtYo1XDdTTy4FWgwM1UgxRpIEqlq sRNFYLf7to97FRhR5HzaQ5H4Vx2/Hi7Vvp41nti+oYBg1IZ/XlEQU+JSdiChG94fbIBTCsrpuTN mUBBdcDayZfUOMH9He9FikpghgOUCGjYco+s1YRYRqiWpR4qatwbgs+MKTdHPT/ffFmdNPrb7cB NwCG07eE0Arc+/dkoLQ+qXy86RdqpV6xdgkR0k68v8D2q6sZcCdKXlD0Ak8fhNzX++qbyEL7KuY WUgGu2VVhQHcyyfumV0j7EQzKMHp5TQRidt0rarWfbHujwtCVhA+NFoNXazbzINpOSnxluTfWVw +5egzcM9PyDiaqA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1782422483403158500 The pnv-xive2-test and pnv-host-i2c-test pass "-serial mon:stdio" but never use HMP commands. The "mon:" chardev prefix creates an HMP monitor mux, which fails when HMP is disabled. Other pnv tests (e.g. pnv-spi-seeprom-test) don't specify -serial at all. Drop the unnecessary -serial mon:stdio option. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- tests/qtest/pnv-host-i2c-test.c | 2 +- tests/qtest/pnv-xive2-test.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/qtest/pnv-host-i2c-test.c b/tests/qtest/pnv-host-i2c-tes= t.c index 51e613ebdcb..368d1a91401 100644 --- a/tests/qtest/pnv-host-i2c-test.c +++ b/tests/qtest/pnv-host-i2c-test.c @@ -415,7 +415,7 @@ static void test_host_i2c(const void *data) } =20 qts =3D qtest_initf("-M %s -smp %d,cores=3D1,threads=3D%d -nographic " - "-nodefaults -serial mon:stdio -S " + "-nodefaults -S " "-d guest_errors", machine, SMT, SMT); =20 diff --git a/tests/qtest/pnv-xive2-test.c b/tests/qtest/pnv-xive2-test.c index 5313d4ef18b..b4f4b601c2a 100644 --- a/tests/qtest/pnv-xive2-test.c +++ b/tests/qtest/pnv-xive2-test.c @@ -549,7 +549,7 @@ static void test_xive(void) QTestState *qts; =20 qts =3D qtest_initf("-M powernv10 -smp %d,cores=3D1,threads=3D%d -nogr= aphic " - "-nodefaults -serial mon:stdio -S " + "-nodefaults -S " "-d guest_errors -trace '*xive*'", SMT, SMT); init_xive(qts); --=20 2.54.0 From nobody Sun Jul 26 11:53:26 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782422519; cv=none; d=zohomail.com; s=zohoarc; b=TI54LXmB+GMa3v5M8bI4iYEOXlGxvkLODEo3PADLEx4SCB+X/V9jeTY1vk5mWwdq9/WFKDLweM7ok4ILTxsuwNN0zy1z1JDnwSQX8KvBZ6xdbpwbAUzIK4GxCVS9sMbaIY84/X4Aw8exx6QszT5s3TYTCZzAZwQvnrsPAZUo2Es= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782422519; 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=Rj62dwPwlt6J5YfC3tT9+7gzCNY1rF6F6nNec9xh4Gc=; b=bQx8+YwPj8YKSyKKDD49tu/SJMHGHzXUD+6M/aPcKAF7PMXfLrnSAUAnDFqqrcAfFAfmwXYRjq6PfjaN783Tbp+29KMuWxkxMb+8GBoZQHvyv5ukZ/0jGNHjluHab8J/NKi3vsL44pizljZORjlseyNuDEJL/mG9lUSKal4ZKIU= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17824225195411019.455587332293; Thu, 25 Jun 2026 14:21:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wcrVa-0001Hn-8H; Thu, 25 Jun 2026 17:21:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrVO-0000kX-V6 for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:21:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrVL-0003hj-QI for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:21:01 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-515-FkV_mNTiMtqu8eNr6UoDrw-1; Thu, 25 Jun 2026 17:20:54 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DD125180AEB4; Thu, 25 Jun 2026 21:20:53 +0000 (UTC) Received: from localhost (unknown [10.44.24.16]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 648EC1956047; Thu, 25 Jun 2026 21:20:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782422456; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Rj62dwPwlt6J5YfC3tT9+7gzCNY1rF6F6nNec9xh4Gc=; b=L7hBN6l4N1wdzVue4uRfxp7I0SU0G998FRpQUTdEh8k6W/CVWPzjkZIiglVvLpiId1Q74A V3/lloV3h0H51U4143uwr6XdeBz6tCagadI2+S3tLJXqA0yHsFbIhOLE9svF7CKLRh364A e3gLm/Zql8s8/vb2B0rMkPD85Tg/zFM= X-MC-Unique: FkV_mNTiMtqu8eNr6UoDrw-1 X-Mimecast-MFC-AGG-ID: FkV_mNTiMtqu8eNr6UoDrw_1782422454 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 26 Jun 2026 01:19:16 +0400 Subject: [PATCH v2 15/39] tests/qtest/qmp-test: don't depend on human-monitor-command MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260626-qemu-no-hmp-v2-15-8af31bc54c61@redhat.com> References: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> In-Reply-To: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster X-Developer-Signature: v=1; a=openpgp-sha256; l=1387; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=El52EsGFNCM8HmxNPKyL5nqBoHV5YFHr88LpAQg5+7o=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqPZtdi6mx7Z7R0pMG0yLIyf8BFVIcXuzCcDCBD jV3V5K3pNCJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaj2bXQAKCRDa6OEJdZac 5akID/4yeRTQfxAvGcH8s7c3MoiG7lbC5vWlZlAaFZyWp13tjNVKiV67N99XMRfXVOmll4/eY8T 3S5Tl8qkLFYxV3k1nSOMRlP6bt4M3kALTcXCHcuS9n2HrrQm7xe0XBVfS/C66fnAIqNwBZbcpwS pyR6Ae1DqRRTGH5SvW4H+F24wXT0OX2k/Gk6HNx12tf/dydjNgkIsUo7VsVheY/UdEiMzJWfsDo LxxmAdfuD1H37twN5q/Z4IgkfhJp9Cgz+4N0QZAt6Z5tHw5NnzDeYP9G42qe5QLsLjXxLU1kPxc M9gPgrVgnQlqK9XnredLW/Q+jhyZCI4YpvcRt5E8tUSqr03STM5ylkMlZDum1IlODHBDI0stjsE xJOABrJMOzXC4qxhk2HWFFMNbAVD+WhAMiTYVIPWCgV1+6wmuZBCCls7zExlDM4jguvn97r7stA dOCgnRzU6oikdKv0QPAbD11V5z944hntN6Zp6hRJLpFFIq5Au7uFUmTHlzY4XHcPsxYFWcIg6// pUgGKT0zpEzt/vnmZTqSfkdVrajMCrfAYbslbdRI2N9+WThZctTRh2wa0KfbJx/GhLxb76IpMA4 rkp/16hsBve2NUUhNJ8JYXFQAoHnKESaGIfOAVLGwvAaELZC7y/61ftgTAAbWCAxiBBPC02d90d 08k6ZYjUvrNX40g== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1782422521720158500 The test was using 'human-monitor-command' (which requires HMP) to verify that an integer 'id' is echoed back on failure. Replace with 'query-name' for the success case and 'block_resize' (missing required args) for the failure case, so the test works regardless of HMP availability. Signed-off-by: Marc-Andr=C3=A9 Lureau --- tests/qtest/qmp-test.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/qtest/qmp-test.c b/tests/qtest/qmp-test.c index edf08867874..03637b9e2d2 100644 --- a/tests/qtest/qmp-test.c +++ b/tests/qtest/qmp-test.c @@ -151,9 +151,14 @@ static void test_qmp_protocol(void) g_assert_cmpstr(qdict_get_try_str(resp, "id"), =3D=3D, "cookie#1"); qobject_unref(resp); =20 - /* Test command failure with 'id' */ - resp =3D qtest_qmp(qts, "{ 'execute': 'human-monitor-command', 'id': 2= }"); + /* Test integer 'id' is echoed back on success */ + resp =3D qtest_qmp(qts, "{ 'execute': 'query-name', 'id': 2 }"); g_assert_cmpint(qdict_get_int(resp, "id"), =3D=3D, 2); + qobject_unref(resp); + + /* Test integer 'id' is echoed back on failure */ + resp =3D qtest_qmp(qts, "{ 'execute': 'block_resize', 'id': 3 }"); + g_assert_cmpint(qdict_get_int(resp, "id"), =3D=3D, 3); qmp_expect_error_and_unref(resp, "GenericError"); =20 qtest_quit(qts); --=20 2.54.0 From nobody Sun Jul 26 11:53:26 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782422613; cv=none; d=zohomail.com; s=zohoarc; b=ZRxqowBTsHt9Ke/sZIMGnlEY4S49Vb3SqTjhEowi/To01SeM/wNClm3+DI+qwiCrt2x+6y7E5FQLQavNDdgpr5I5pQNHn9a9SB6dhqO118NkLjg9Eeii4Vj3c3HWa0jMmiIlodowKvJ0liNxFXfcf/QPtd7CkR1SusCXj6BcUfU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782422613; 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=/KXrbaP0o204oy3ffVboRa53QerResEIbZt37fxqg80=; b=aSFf7mMO8k5nY+MaRzAgX7Pxij4WCG3mbWb0ysgZOnviraT5WZcNp6cjFvG8NontaQerGUy6recDRV7jnZ2raXtvUbfzwoG9VWGn9dqSmE+TjCzc9EUPJTePaMXnwRL23Ql+4ogpz25lJOcYsopphjE1gTf5pAfiXStQm4bSi54= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1782422613348765.5604839733504; Thu, 25 Jun 2026 14:23:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wcrVe-0001VK-7c; Thu, 25 Jun 2026 17:21:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrVT-000128-Pk for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:21:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrVR-0003jY-HY for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:21:07 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-232-dLYVSm25PdO-8thD1xIxgQ-1; Thu, 25 Jun 2026 17:21:00 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 319DA1806C99; Thu, 25 Jun 2026 21:20:59 +0000 (UTC) Received: from localhost (unknown [10.44.24.16]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id F13AC195608D; Thu, 25 Jun 2026 21:20:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782422464; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/KXrbaP0o204oy3ffVboRa53QerResEIbZt37fxqg80=; b=TqxHYpNfbRCPxD6St16kBTN7CvCjNtM7VuAYbdtcRJDxi/DEedUDljP/8zfl56z2MAEM4T b24cEeN4twafcoos6zL6QKn/yL6BUJsfIMwRC7znxo4m2tc+jvfvBrnvzQebAT/MLwUa6O HjeLW0wsfkZWn8mw65HXgRWJhk1ATJE= X-MC-Unique: dLYVSm25PdO-8thD1xIxgQ-1 X-Mimecast-MFC-AGG-ID: dLYVSm25PdO-8thD1xIxgQ_1782422459 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 26 Jun 2026 01:19:17 +0400 Subject: [PATCH v2 16/39] tests/qtest/numa-test: replace HMP "info numa" with QMP query-cpus-fast MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260626-qemu-no-hmp-v2-16-8af31bc54c61@redhat.com> References: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> In-Reply-To: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster X-Developer-Signature: v=1; a=openpgp-sha256; l=3965; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=OFBar7k9p+yqwjSsR5ORXDxBcPwhkg3T4bV1GvhPOiU=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqPZtdmie45qhLGeZ3UmonR6JOCl9AdcrTVf4fX 2xkeh9b39+JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaj2bXQAKCRDa6OEJdZac 5RJkD/9luw9R0Vxe2UQR+VJ9Su0Ek28OlZ4qTimTgKN3BH3pSbJmOoazC7xQcZYLR5szZCSSPKL 57ye/dU8WWVxkpesBcSyw3IpFEFxcsP1MMY2LKXHu3eJgCuRz+XGCPdFxZt8OYJIRU1um5BGyti uPljuNktcVlFkviGYFifFGZbzCLxVf5Tj92uxGecr6dCGIjZpR/HcD34ApzL6rjBDqo+r0777Dl jXtL9pLCr0e/wtYIIjqZV3kjUXfTT5G59PEl+y9vh/WZ8YZKXiAoSlaXBbzKXxHwScfwHw4c2zr UeGmVkvmsyRdOevsHQhcN53uUQH125CFtxPRI2jIQ57rxBrFTTbQ3PMDYBCnq/SPvqspxVlaqnD PbhvReNIbm+40QnIIhUBY9RYvY7CGVoClUcICB9j8xWroIZQDEjhUVI7Ep3hnXQiEtZ+bAmlnIp X7ek7arKCwj10jrMam8/gPwitrL8avxCWaY/90K4Wh/wSOUyt71ACyqyMOWv1fa7xtFnGmZrsjm YA/AeikJmm8MhWQp9s2fgJY9cvfbQWLsogpDGkO+6VkDFzQN55ko09GOqnPUXQb+nJStuMwTG43 SnkJkBlG2HfG777l9A3okEvx/Ibt++8Dzo5TKHCSm8XVY6+u7J9obi6gpn0V1U2eu45vTnXN9Gx HRMoAUIkazpynVw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1782422616268158500 Convert the three test functions that relied on HMP "info numa" to use QMP "query-cpus-fast" instead, verifying each CPU's node-id through the structured response. Add a check_cpu_node() helper for the per-CPU assertions. Signed-off-by: Marc-Andr=C3=A9 Lureau --- tests/qtest/numa-test.c | 63 +++++++++++++++++++++++++++++++++++++++------= ---- 1 file changed, 51 insertions(+), 12 deletions(-) diff --git a/tests/qtest/numa-test.c b/tests/qtest/numa-test.c index d657f389474..8f563c079f6 100644 --- a/tests/qtest/numa-test.c +++ b/tests/qtest/numa-test.c @@ -19,19 +19,50 @@ static char *make_cli(const GString *generic_cli, const= char *test_cli) return g_strdup_printf("%s %s", generic_cli->str, test_cli); } =20 +static void check_cpu_node(QTestState *qts, int cpu_idx, int expected_node) +{ + QDict *resp; + QList *cpus; + QListEntry *e; + bool found =3D false; + + resp =3D qtest_qmp(qts, "{ 'execute': 'query-cpus-fast' }"); + g_assert(resp); + g_assert(qdict_haskey(resp, "return")); + cpus =3D qdict_get_qlist(resp, "return"); + g_assert(cpus); + + QLIST_FOREACH_ENTRY(cpus, e) { + QDict *cpu =3D qobject_to(QDict, qlist_entry_obj(e)); + int64_t idx =3D qdict_get_int(cpu, "cpu-index"); + if (idx =3D=3D cpu_idx) { + QDict *props =3D qdict_get_qdict(cpu, "props"); + g_assert(qdict_haskey(props, "node-id")); + g_assert_cmpint(qdict_get_int(props, "node-id"), =3D=3D, expec= ted_node); + found =3D true; + break; + } + } + g_assert(found); + qobject_unref(resp); +} + static void test_mon_explicit(const void *data) { QTestState *qts; - g_autofree char *s =3D NULL; g_autofree char *cli =3D NULL; + int i; =20 cli =3D make_cli(data, "-machine smp.cpus=3D8 -numa node,nodeid=3D0,me= mdev=3Dram,cpus=3D0-3 " "-numa node,nodeid=3D1,cpus=3D4-7"); qts =3D qtest_init(cli); =20 - s =3D qtest_hmp(qts, "info numa"); - g_assert(strstr(s, "node 0 cpus: 0 1 2 3")); - g_assert(strstr(s, "node 1 cpus: 4 5 6 7")); + for (i =3D 0; i < 4; i++) { + check_cpu_node(qts, i, 0); + } + for (i =3D 4; i < 8; i++) { + check_cpu_node(qts, i, 1); + } =20 qtest_quit(qts); } @@ -39,16 +70,19 @@ static void test_mon_explicit(const void *data) static void test_def_cpu_split(const void *data) { QTestState *qts; - g_autofree char *s =3D NULL; g_autofree char *cli =3D NULL; + int even_cpus[] =3D {0, 2, 4, 6}; + int odd_cpus[] =3D {1, 3, 5, 7}; + int i; =20 cli =3D make_cli(data, "-machine smp.cpus=3D8,smp.sockets=3D8 " "-numa node,memdev=3Dram -numa node"); qts =3D qtest_init(cli); =20 - s =3D qtest_hmp(qts, "info numa"); - g_assert(strstr(s, "node 0 cpus: 0 2 4 6")); - g_assert(strstr(s, "node 1 cpus: 1 3 5 7")); + for (i =3D 0; i < 4; i++) { + check_cpu_node(qts, even_cpus[i], 0); + check_cpu_node(qts, odd_cpus[i], 1); + } =20 qtest_quit(qts); } @@ -56,17 +90,22 @@ static void test_def_cpu_split(const void *data) static void test_mon_partial(const void *data) { QTestState *qts; - g_autofree char *s =3D NULL; g_autofree char *cli =3D NULL; + int node0_cpus[] =3D {0, 1, 2, 3, 6, 7}; + int node1_cpus[] =3D {4, 5}; + int i; =20 cli =3D make_cli(data, "-machine smp.cpus=3D8 " "-numa node,nodeid=3D0,memdev=3Dram,cpus=3D0-1 " "-numa node,nodeid=3D1,cpus=3D4-5 "); qts =3D qtest_init(cli); =20 - s =3D qtest_hmp(qts, "info numa"); - g_assert(strstr(s, "node 0 cpus: 0 1 2 3 6 7")); - g_assert(strstr(s, "node 1 cpus: 4 5")); + for (i =3D 0; i < 6; i++) { + check_cpu_node(qts, node0_cpus[i], 0); + } + for (i =3D 0; i < 2; i++) { + check_cpu_node(qts, node1_cpus[i], 1); + } =20 qtest_quit(qts); } --=20 2.54.0 From nobody Sun Jul 26 11:53:26 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782422603; cv=none; d=zohomail.com; s=zohoarc; b=HuxTP4IIFzlHJv7cpYJqQ1Dqy++oNs7K1/WppYsH2JWkSOl7kn8d7PPztknJqV1cYnkOecLfUdn99DQ+L5ROdOSqXGKCvoo0+6oNx8nZ1pvcSVl9luWytRFGW0v/nmsnShNbnIkQm/ZtdASjWgipbdealVCUXj5dDiaq1ILQj9M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782422603; 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=09tB3jSORQpBG3yYGaO0m63lpZkUd3XoKXR5lh13pEA=; b=S7c8GX6ujwwt8DwawaoauB3BjX2G0YVoeHA+pRuaa+y0cNWgEzi140qo7Q+6C6qQLbqBygkYKRk4H8/11+NHYM34YLiHhtLWbNZupO0ubnEOwWb0bSvuQqVESBdGeFoyQzajFCALyns4R+ynf7zbGrA0EaVyhIXN3SUla5wHsGg= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1782422603824421.4280789988593; Thu, 25 Jun 2026 14:23:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wcrVe-0001WD-8z; Thu, 25 Jun 2026 17:21:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrVZ-0001Hu-Kc for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:21:13 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrVV-0003kK-H6 for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:21:11 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-68-aSPdG3ODPyqo_9F87iuSLw-1; Thu, 25 Jun 2026 17:21:05 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6117B180AD4B; Thu, 25 Jun 2026 21:21:04 +0000 (UTC) Received: from localhost (unknown [10.44.24.16]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 18C7C18001D2; Thu, 25 Jun 2026 21:21:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782422468; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=09tB3jSORQpBG3yYGaO0m63lpZkUd3XoKXR5lh13pEA=; b=hM8GCoFr/SWC3XmHz1sSZz5Jy0EHyfAWy+4AI2hl+JGxm+nVWXFGlTn/BJnPysrWCmt09f EzG/WtWGlwuehtN8djzGLH2XS8w+1aav+EqdQYIsQ4bhwN2SvJZAh7rsTpJ1huKPxciPwB d2Me69Sp9/jJpEgS7LVnjp5hh0oCveQ= X-MC-Unique: aSPdG3ODPyqo_9F87iuSLw-1 X-Mimecast-MFC-AGG-ID: aSPdG3ODPyqo_9F87iuSLw_1782422464 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 26 Jun 2026 01:19:18 +0400 Subject: [PATCH v2 17/39] tests/qtest/cdrom-test: replace HMP "info block" with QMP query-block MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260626-qemu-no-hmp-v2-17-8af31bc54c61@redhat.com> References: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> In-Reply-To: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=2179; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=advw8TM6wPK904i74p/bG/x1uSjxzUPiXdbN5Flf4Sg=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqPZtdICf8rmYUoHyN7iQjShs66Wf+sFR9iQNuj OAaVFS8RtSJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaj2bXQAKCRDa6OEJdZac 5dwqD/426By7UGlZODpUZg/NMy9yTMoLm5x0NGzeWzgqAJ7ZcZCmBIvOo6WKFHgvjqN2+tUUsYE PKpaTMdNRlyvqfOwmdmUGPSYr5pDgG6UQVTHLNfny6H9W8HH7i3+SKY9fxKpNWBZC22543Hl4Td wBySBM1P6DavJDWO01CY05WnLDFo/YKQwglS8uPhgo4eUzF+RaKYum6LsNdEdxLDqRLS93fFvdH LQ6ONzLDNiPDjooFFxySte9nSjxmG0ClTVR13rEnj00B8R1WC/+vKXjnWEOAFAkfiWRMdjy9vUu TjQAp47mxoWdMidwe3q0K3gVtR+NuCzBMbZUBaSSsrth+5LUp/PKZFoRnRxMcizAw5+CYQq+dBY szbE3nv+OYOhIHQ+hwQgKcDAjQWuIoowW3kR6+BtOJ1QhYvZ23aubdZ6PoVKwBsfO8hCi6oFiwh UfJolhmZB12xPOgS0Hf9OXkMVi6ZKUYx1mY1tY0rbU7r5eoqHGkFt/VVoujtVzGFlds3xVTqFoE W0KeABweJjiM/nsugC5rN4ARlSst9ZPVL8fOmLyl9dvkMsOG4Ru2pUiPK5wTHoRyJXxKqEaV41e X1V2cCQfbCT7rwWBXIZCQbpknG/iuhdenRuHO/Bc/E6ogfKoPz8b2InBmYH8Um9JZjgiFszMXeE txtvTbUN2DRECyA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1782422604115158500 The test_cdrom_param() function uses qtest_hmp() to run "info block", which depends on the human-monitor-command QMP endpoint. Replace it with the QMP query-block command so the test works when HMP is disabled (-Dhmp=3Ddisabled). Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- tests/qtest/cdrom-test.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/tests/qtest/cdrom-test.c b/tests/qtest/cdrom-test.c index a65854d2bc5..bf997be6d69 100644 --- a/tests/qtest/cdrom-test.c +++ b/tests/qtest/cdrom-test.c @@ -14,6 +14,7 @@ #include "libqtest.h" #include "boot-sector.h" #include "qobject/qdict.h" +#include "qobject/qlist.h" =20 static char isoimage[] =3D "cdrom-boot-iso-XXXXXX"; =20 @@ -92,17 +93,35 @@ cleanup: =20 /** * Check that at least the -cdrom parameter is basically working, i.e. we = can - * see the filename of the ISO image in the output of "info block" afterwa= rds + * see the filename of the ISO image in the output of "query-block" afterw= ards */ static void test_cdrom_param(gconstpointer data) { QTestState *qts; - char *resp; + QDict *response; + QList *ret; + QListEntry *entry; + bool found =3D false; =20 qts =3D qtest_initf("-M %s -cdrom %s", (const char *)data, isoimage); - resp =3D qtest_hmp(qts, "info block"); - g_assert(strstr(resp, isoimage) !=3D 0); - g_free(resp); + response =3D qtest_qmp(qts, "{'execute': 'query-block'}"); + g_assert(response && qdict_haskey(response, "return")); + ret =3D qdict_get_qlist(response, "return"); + + QLIST_FOREACH_ENTRY(ret, entry) { + QDict *entry_dict =3D qobject_to(QDict, entry->value); + QDict *inserted =3D qdict_get_qdict(entry_dict, "inserted"); + if (inserted) { + const char *file =3D qdict_get_str(inserted, "file"); + if (file && strstr(file, isoimage)) { + found =3D true; + break; + } + } + } + + g_assert(found); + qobject_unref(response); qtest_quit(qts); } =20 --=20 2.54.0 From nobody Sun Jul 26 11:53:26 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782422490; cv=none; d=zohomail.com; s=zohoarc; b=D67zrZ6Z+GT4/cnC8RhLhzPhPSd8n33l20bVWpg5Ol43XB3o6tfhf4Y44hdB8KOvZTDMgg8Yn26ibUUvyDq+rAchG8fxwRdetcPZMhYZIRqQVTEhF1hb7QZAlK0aF23H5F98hnYaJ+vbs8rUoucNoozEuz7LdSpQsIy9BR16iMg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782422490; 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=fRPtQELqolxkJtRA6vnIe5NUc3hcSq+toynCIGwIkSk=; b=EMKH5tBFO1/jp1jXHjR4Ws7Fn5ylKhdyJXkg4MYxXCY8mL7g0PNIwNEnF8xNG+kbUbeaG2Ot7l8KF45F/1YgRW8F+OD3L2uzkolMo7gBGHbQrxzqhQZObitShQRE434bCfT82ea23yTiRyWzSgQB+UpW4CE1PbDRPcvJeOK468Q= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1782422490684279.63979996065143; Thu, 25 Jun 2026 14:21:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wcrVi-0001vR-IE; Thu, 25 Jun 2026 17:21:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrVe-0001Z5-Gq for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:21:18 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrVZ-0003kU-DJ for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:21:15 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-570-F6roRQggPsGVXePBSYu3qw-1; Thu, 25 Jun 2026 17:21:10 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9F8781955DE1; Thu, 25 Jun 2026 21:21:09 +0000 (UTC) Received: from localhost (unknown [10.44.24.16]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 6A9FD1956047; Thu, 25 Jun 2026 21:21:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782422471; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fRPtQELqolxkJtRA6vnIe5NUc3hcSq+toynCIGwIkSk=; b=RuJtYYHy9BMLYqUJLG8Wxfi2KdjPJfmTyQ3kqVRVEvwrz1rtnXDLi1MaRwZAOtzRDDXcv1 XiY+NrhORtYTN9dLLM3Al9EOJrE/1Pl+2r8qEeubPrTETPxn4bFtNyDPt5kL4kkb3sK4qe Uf36vwSAZcVYZ6TED6/hDAOQy4ttols= X-MC-Unique: F6roRQggPsGVXePBSYu3qw-1 X-Mimecast-MFC-AGG-ID: F6roRQggPsGVXePBSYu3qw_1782422469 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 26 Jun 2026 01:19:19 +0400 Subject: [PATCH v2 18/39] tests/qtest/device-introspect-test: fix test without HMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260626-qemu-no-hmp-v2-18-8af31bc54c61@redhat.com> References: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> In-Reply-To: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster X-Developer-Signature: v=1; a=openpgp-sha256; l=7498; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=/JxQv6h3FUqjsdGwFy0SeHfp3oZCxzfgsDm04W8itkE=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqPZtdaOeovuOD8iPMcvz+fZ3y1LXJpBbN9nUBL 5kIMMFuNq6JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaj2bXQAKCRDa6OEJdZac 5bQiEACsg0UV4OkjxJxmnI4GzUbh79+q2mvMw2VaMoyRzHANC2f3y2hBj0RfuasZkxri2eVje/U 2be1N1IYQeoweLzG8NPlO1nI3OaHq1SI6Dwc2yOXshaFlGCiZly877E0AaHhgKmVnFRkk9Pwnn0 /or59UN2+vMGKfgUyxJA17c2vlwXG9gM6LacQYWyK0Fh15vsUxQtzEkBZa1sl/E/2/EoTtmhbFw 7u/+7bYT/ZgKaG0CXJi05fPZ5cPsK+oBmUTXP4RfyMuqjq/PSmXjkVDeEBiKT1HFoBAAridbPOO LDjP5HnYhrlhgr4GlAAjkp2gA0q6ZXUqI8PeAMTH3UwxBwZE+usQsXkE2C8C8foMMxNDRlIfJzn oVgrAZ40ymX8ze9htZ3CY6in7p33vpcJq3ctO4kgenSXiLGxWNkwWMzza3cobY/octXRRnhlat/ jur/neLVHYdtkB77JbZSqpoYwU+O/rUBvVuyjc8TYGi7ZikbZc7fGHVPG92u6f0h/u16Qy5t6xM Kn76wJbxJ4SnXDrwDkkOwz2UatAJq5o77IOjdQHvTfyT/NGEQ9Vvw0zqA9WQMKIvmMEuDjFSR3+ AFqJE5aJbm9d+wOgf/27+/iaSyuPFsxpq8KBan5K+xHAjzM4myAT5YgFTtCmbdGJXd2+qo34uD7 hrgMH0TBAYAX6Kg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 8 X-Spam_score: 0.8 X-Spam_bar: / X-Spam_report: (0.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-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: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1782422491654158500 Replace "info qom-tree" with recursive qom-list walk. Disable HMP-only code paths, info qtree, kinda duplicating the test. Signed-off-by: Marc-Andr=C3=A9 Lureau --- tests/qtest/device-introspect-test.c | 111 +++++++++++++++++++++++++++----= ---- 1 file changed, 88 insertions(+), 23 deletions(-) diff --git a/tests/qtest/device-introspect-test.c b/tests/qtest/device-intr= ospect-test.c index f84cec51dc2..f6eca2c8eb7 100644 --- a/tests/qtest/device-introspect-test.c +++ b/tests/qtest/device-introspect-test.c @@ -11,10 +11,10 @@ */ =20 /* - * Covers QMP device-list-properties and HMP device_add help. We - * currently don't check that their output makes sense, only that QEMU - * survives. Useful since we've had an astounding number of crash - * bugs around here. + * Covers QMP device-list-properties and HMP device_add help (if + * CONFIG_HMP). We currently don't check that the output makes sense, + * only that QEMU survives. Useful since we've had an astounding + * number of crash bugs around here. */ =20 #include "qemu/osdep.h" @@ -100,11 +100,60 @@ static QList *device_type_list(QTestState *qts, bool = abstract) return qom_list_types(qts, "device", abstract); } =20 +/* + * Recursively walk the QOM composition tree via qom-list and build a + * string representation. This serves two purposes: detecting dangling + * pointers (qom-list would crash QEMU) and detecting leaked objects + * (by comparing the output before and after device introspection). + */ +static void qom_tree_walk(QTestState *qts, const char *path, GString *resu= lt) +{ + QDict *resp; + QList *list; + QListEntry *e; + GList *children =3D NULL; + + resp =3D qtest_qmp(qts, "{'execute': 'qom-list'," + " 'arguments': {'path': %s}}", path); + g_assert(qdict_haskey(resp, "return")); + list =3D qdict_get_qlist(resp, "return"); + + QLIST_FOREACH_ENTRY(list, e) { + QDict *prop =3D qobject_to(QDict, qlist_entry_obj(e)); + const char *type =3D qdict_get_str(prop, "type"); + if (g_str_has_prefix(type, "child<")) { + const char *name =3D qdict_get_str(prop, "name"); + children =3D g_list_prepend(children, g_strdup(name)); + } + } + + children =3D g_list_sort_with_data(children, (GCompareDataFunc)g_strcm= p0, + NULL); + + for (GList *l =3D children; l; l =3D l->next) { + const char *name =3D l->data; + g_autofree char *child_path =3D (!strcmp(path, "/")) + ? g_strdup_printf("/%s", name) + : g_strdup_printf("%s/%s", path, name); + + g_string_append_printf(result, "%s\n", child_path); + qom_tree_walk(qts, child_path, result); + } + + g_list_free_full(children, g_free); + qobject_unref(resp); +} + +static char *qom_tree_str(QTestState *qts) +{ + GString *result =3D g_string_new(""); + qom_tree_walk(qts, "/", result); + return g_string_free(result, FALSE); +} + static void test_one_device(QTestState *qts, const char *type) { QDict *resp; - char *help, *escaped; - GRegex *comma; =20 g_test_message("Testing device '%s'", type); =20 @@ -113,19 +162,21 @@ static void test_one_device(QTestState *qts, const ch= ar *type) type); qobject_unref(resp); =20 - comma =3D g_regex_new(",", 0, 0, NULL); - escaped =3D g_regex_replace_literal(comma, type, -1, 0, ",,", 0, NULL); - g_regex_unref(comma); +#ifdef CONFIG_HMP + { + g_autofree char *escaped =3D NULL; + g_autoptr(GRegex) comma =3D NULL; =20 - help =3D qtest_hmp(qts, "device_add \"%s,help\"", escaped); - g_free(help); - g_free(escaped); + comma =3D g_regex_new(",", 0, 0, NULL); + escaped =3D g_regex_replace_literal(comma, type, -1, 0, ",,", 0, N= ULL); + g_free(qtest_hmp(qts, "device_add \"%s,help\"", escaped)); + } +#endif } =20 static void test_device_intro_list(void) { QList *types; - char *help; QTestState *qts; =20 qts =3D qtest_init(common_args); @@ -133,8 +184,11 @@ static void test_device_intro_list(void) types =3D device_type_list(qts, true); qobject_unref(types); =20 - help =3D qtest_hmp(qts, "device_add help"); - g_free(help); +#ifdef CONFIG_HMP + { + g_free(qtest_hmp(qts, "device_add help")); + } +#endif =20 qtest_quit(qts); } @@ -198,18 +252,22 @@ static void test_qom_list_fields(void) static void test_device_intro_none(void) { QTestState *qts =3D qtest_init(common_args); - g_autofree char *qom_tree_start =3D qtest_hmp(qts, "info qom-tree"); + g_autofree char *qom_tree_start =3D qom_tree_str(qts); g_autofree char *qom_tree_end =3D NULL; +#ifdef CONFIG_HMP g_autofree char *qtree_start =3D qtest_hmp(qts, "info qtree"); g_autofree char *qtree_end =3D NULL; +#endif =20 test_one_device(qts, "nonexistent"); =20 /* Make sure that really nothing changed in the trees */ - qom_tree_end =3D qtest_hmp(qts, "info qom-tree"); + qom_tree_end =3D qom_tree_str(qts); g_assert_cmpstr(qom_tree_start, =3D=3D, qom_tree_end); +#ifdef CONFIG_HMP qtree_end =3D qtest_hmp(qts, "info qtree"); g_assert_cmpstr(qtree_start, =3D=3D, qtree_end); +#endif =20 qtest_quit(qts); } @@ -217,18 +275,22 @@ static void test_device_intro_none(void) static void test_device_intro_abstract(void) { QTestState *qts =3D qtest_init(common_args); - g_autofree char *qom_tree_start =3D qtest_hmp(qts, "info qom-tree"); + g_autofree char *qom_tree_start =3D qom_tree_str(qts); g_autofree char *qom_tree_end =3D NULL; +#ifdef CONFIG_HMP g_autofree char *qtree_start =3D qtest_hmp(qts, "info qtree"); g_autofree char *qtree_end =3D NULL; +#endif =20 test_one_device(qts, "device"); =20 /* Make sure that really nothing changed in the trees */ - qom_tree_end =3D qtest_hmp(qts, "info qom-tree"); + qom_tree_end =3D qom_tree_str(qts); g_assert_cmpstr(qom_tree_start, =3D=3D, qom_tree_end); +#ifdef CONFIG_HMP qtree_end =3D qtest_hmp(qts, "info qtree"); g_assert_cmpstr(qtree_start, =3D=3D, qtree_end); +#endif =20 qtest_quit(qts); } @@ -239,10 +301,12 @@ static void test_device_intro_concrete(const void *ar= gs) QListEntry *entry; const char *type; QTestState *qts =3D qtest_init(args); - g_autofree char *qom_tree_start =3D qtest_hmp(qts, "info qom-tree"); + g_autofree char *qom_tree_start =3D qom_tree_str(qts); g_autofree char *qom_tree_end =3D NULL; +#ifdef CONFIG_HMP g_autofree char *qtree_start =3D qtest_hmp(qts, "info qtree"); g_autofree char *qtree_end =3D NULL; +#endif =20 types =3D device_type_list(qts, false); =20 @@ -255,14 +319,15 @@ static void test_device_intro_concrete(const void *ar= gs) =20 /* * Some devices leave dangling pointers in QOM behind. - * "info qom-tree" or "info qtree" have a good chance at crashing then. + * Walking the QOM tree via qom-list has a good chance at crashing the= n. * Also make sure that the tree did not change. */ - qom_tree_end =3D qtest_hmp(qts, "info qom-tree"); + qom_tree_end =3D qom_tree_str(qts); g_assert_cmpstr(qom_tree_start, =3D=3D, qom_tree_end); - +#ifdef CONFIG_HMP qtree_end =3D qtest_hmp(qts, "info qtree"); g_assert_cmpstr(qtree_start, =3D=3D, qtree_end); +#endif =20 qobject_unref(types); qtest_quit(qts); --=20 2.54.0 From nobody Sun Jul 26 11:53:26 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782422491; cv=none; d=zohomail.com; s=zohoarc; b=MFzvxHmvRthrKNwQ8M0yS3h17vqJP3hHNTddwZImSI1WWcNJ2lCDgmh8CiEdaS1KqDWUPz+UVq1q3DpuBz+C5H7I1YDfHQyCINy3MnijMzIF3SEkUO1wlogrM/FtEoTCooIi+7puM1tKm5Ojaj3u2H760EhUyEpNVE1IlI4k+Ls= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782422491; 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=BDNq0Jn1G3l2ITQQ3JXhQNcg0DMRRd1rLiTd5+ILQqw=; b=ICzAk3TlpgYt4d499UduK6MDQ6OMpZvvkzy4okp1+QWFMGsIAyLv610cS8rwERyVOpLPQU/rLubENOo5NJ8GhDFC6Rjk7JKSufl81ucrQIEMCp1dK2hdOFRxYbKdSL4l4AFpyKb+dKuUmG1kAELXdWHhcvE/7fsWXH/IOL7+vTw= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1782422491092239.78311414835161; Thu, 25 Jun 2026 14:21:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wcrVk-0002AU-Pl; Thu, 25 Jun 2026 17:21:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrVh-0001rB-MI for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:21:21 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrVe-0003l2-54 for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:21:20 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-308-kkei26l3OCCH7RZRyUvOvg-1; Thu, 25 Jun 2026 17:21:15 -0400 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B0BF71806CA9; Thu, 25 Jun 2026 21:21:14 +0000 (UTC) Received: from localhost (unknown [10.44.24.16]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7C5EA31D2; Thu, 25 Jun 2026 21:21:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782422477; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BDNq0Jn1G3l2ITQQ3JXhQNcg0DMRRd1rLiTd5+ILQqw=; b=HLZfPdnexb2PIdh7ilVdJiVlPTCvMGBHIeGCNZcEZ/WWSruBZKf3MlBMgYeKZQVemcHHnh NmJmvxdL8Uew+0YZoW1xjnggcHA/lv+uNAnpbxfxlgWuyUW6GTzz847jyy4opgFuCv2764 wUN+DIw1ck7W4PSEL7MRpOYk7pG5HXE= X-MC-Unique: kkei26l3OCCH7RZRyUvOvg-1 X-Mimecast-MFC-AGG-ID: kkei26l3OCCH7RZRyUvOvg_1782422474 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 26 Jun 2026 01:19:20 +0400 Subject: [PATCH v2 19/39] tests/qemu-iotests/205: fix race in assertExportNotFound MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260626-qemu-no-hmp-v2-19-8af31bc54c61@redhat.com> References: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> In-Reply-To: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster X-Developer-Signature: v=1; a=openpgp-sha256; l=1417; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=7IeWmVBR5ELo9JBkMzgfOKrPFErr8GlSRKnuYx5o2UU=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqPZtdHsvd3wVEnBi7ADUccf7Spm+FvJ3hDM1R0 a5t4d837taJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaj2bXQAKCRDa6OEJdZac 5SxBD/0TgJ9K2cMdRQVLqxSApJwVARIDiKXHa3wQgdCIl2fcbp3TM9DostP1VQ7u5dNWAXIesdr ijh0/YolLPIDoARM8tSakNo8My+VrqNuWklFHCvW4sdADulnjlQ9a+Jv48954B73EpJFNPqKnTj A21CvIQdWVa8+Pd4hw3eswK386sxp5bVL8fVlqHQ5v3YKi8LHmUtaXsbfmJ5PhA/ITsHMsSj6IT M+p3Pja3+pITwUQoN+nVRlxpjP5Tv4Nkf6HMnUwHxwT+xEwd3AIupArVd4ogO3ox0Q6PQVCHP2k 0/hpcO1OxVI0I/fO2hsf0VsjJnBFyrwa9B6CEgEnQEfFwpdbRiWwqbBW2j/NgV+4k+DfsSQ8P6b u1JIFdWvXmlH/OIw1lsyw0SD5OJgdPYPA98ajVZ3a5a/T+6sVyKLIGuf4DJfmS96oNC++CethZ7 m5mh+DIn2051pbr4Z3qrkt0UY0AurV80AduOB8BfO7rNkd0RWGwdYD/jaT5bq/1TUFhGm0xudK/ mOD/AqZ99Oia1hiZNV8msAt0VzZyKRBfZQhQYmr0pcQUoFqDyVgE20Vz0+N+3TITosXsydyTW3q Yu40YbyfuGQzhcGZ43TEhawoQyqX4RwuYmUPmy/EYFECI0sOPLlp05t0seGnnxRf32Ho2ZDu/TC lIsWj4NFUamIFHQ== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1782422491524158500 After nbd-server-remove with mode=3Dhard and an active client, the export is removed from the NBD export list synchronously but remains in the block export list until async cleanup completes (via blk_exp_delete_bh bottom-half). A subsequent nbd-server-remove call may find the export still in the block list with user_owned=3Dfalse, returning "already shutting down" instead of "not found". Accept both error messages in assertExportNotFound, since both indicate the export is no longer usable. Signed-off-by: Marc-Andr=C3=A9 Lureau --- tests/qemu-iotests/205 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/qemu-iotests/205 b/tests/qemu-iotests/205 index 2370e1a138b..78459065418 100755 --- a/tests/qemu-iotests/205 +++ b/tests/qemu-iotests/205 @@ -60,7 +60,9 @@ class TestNbdServerRemove(iotests.QMPTestCase): =20 def assertExportNotFound(self, name): result =3D self.vm.qmp('nbd-server-remove', name=3Dname) - self.assert_qmp(result, 'error/desc', "Export 'exp' is not found") + desc =3D result.get('error', {}).get('desc', '') + self.assertIn(desc, ("Export '%s' is not found" % name, + "Export '%s' is already shutting down" % name= )) =20 def assertExistingClients(self, result): self.assert_qmp(result, 'error/desc', "export 'exp' still in use") --=20 2.54.0 From nobody Sun Jul 26 11:53:26 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782422516; cv=none; d=zohomail.com; s=zohoarc; b=Eow0Pfk4YOd/HiqxRAHGk+pxoNLzz22qhAZ4cUKDciUosHn7g+U1ONe30uzVTTYxY0ULJewwUl6ihfkQ3NWZOZOaxUzOD1ZzGnVMBtLZSkJheNfGVkZlGZJCzJwJ4SX3dXta8KTwF36JFIXIv3HPyIDdkIqTxfKDkYHlNU9+clk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782422516; 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=IGOFtTtIm18CbFS62rvFJ8CMdfn3xMDbvbzbBD1NSt0=; b=Q5dmpAIctm92Su0sNzHKrFltu9tPiqnYntLfRZ76cY3RatcC41GrOeb0AuOJ2N/oMRGrP8CaT9vHBoQlJSorDn1nmMqIcS0NgNYRGbOUKYzalk0YiMwPyGBLN//iTWpyf0Y0nfUk3ByC2LwNAsjJu4FOZ0SGztD7nVMOIEyD72E= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1782422516665251.18538176030756; Thu, 25 Jun 2026 14:21:56 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wcrVp-0002hV-9W; Thu, 25 Jun 2026 17:21:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrVm-0002QY-Ny for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:21:26 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrVj-0003nc-BO for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:21:26 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-110-1Gvbxm8FOQ6BvySCfGWIHw-1; Thu, 25 Jun 2026 17:21:20 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id EC4F71801373; Thu, 25 Jun 2026 21:21:19 +0000 (UTC) Received: from localhost (unknown [10.44.24.16]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 6FAC4195608D; Thu, 25 Jun 2026 21:21:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782422482; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IGOFtTtIm18CbFS62rvFJ8CMdfn3xMDbvbzbBD1NSt0=; b=fmK4L7eB6BSyFhtefTs8zW5Mc8BxKCWNypOzLNPDQEq7wiHMUKHq0Kqw7Or1HPWzcAoOau c5RQ9/k4qIsly3zjkQDsg1CG8MoSA5q2XL7qrCJyCwxyVoKN5AkUDVn4B/+qf8Ro7OLWlP nqsv8/Y/uXKxbsy0uCKfe0kiPTfs9f8= X-MC-Unique: 1Gvbxm8FOQ6BvySCfGWIHw-1 X-Mimecast-MFC-AGG-ID: 1Gvbxm8FOQ6BvySCfGWIHw_1782422480 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 26 Jun 2026 01:19:21 +0400 Subject: [PATCH v2 20/39] net: add x-query-network QMP command MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260626-qemu-no-hmp-v2-20-8af31bc54c61@redhat.com> References: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> In-Reply-To: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster X-Developer-Signature: v=1; a=openpgp-sha256; l=13500; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=9kHb/QW02A5Jfqrs46sTFz+867Gxvm3FA6wUvJDlhlE=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqPZtdatWBNPM6vfm/JV5yJASucRGhQOLnXUcXI XvCKhz4huuJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaj2bXQAKCRDa6OEJdZac 5cGrD/4zWlaul8b1CaUiroXC9dq7TC6j7kssnU2zAnAKYqy9yf/bl9jBpWoYaTc9jS0grLq9AhH tNbMf2DZ/vYfQyqiNhnVqtv9Z/8oV6I1tbnimGL4+QgzR36Pkcn6DIL4fUDLBsEhVlQiggx/T08 rIdloQL9qERZCT+FuJ02TXocU7X+QBm/YxtOW3UCJ8rkV09MKo++10tWe7j8VTcDq7M9TIy5q24 nm5d5hqDTsuvIPxbDQkSbbzARyMUESa2s8hPAQnEXcao+ZfGVBE2iS9hmG3rUaTuVralYojryKA XuP+ZkV7GI1Xynb88hHLEzdCwthkVVfuRPHG6Snqq/3iDoHMB0r5xNcfjJrSizEKHWISRwatuVh 7Qex0WP24wCqXGzdeBQ0T+taoFASN/OxV0GJxDfDzxyD/Ey60cscIVk6uwYSMlT4OKeUl21EaTt HFQfAWWJ/YIRJOzFdnHkz2Wz0uXxYzvn2Tbp6upzXjSBRKR921Bi+Raje3lIRosaZR5h0rn390X YyyXseBg/1shPkNoKl7MCx2myhWspeoVxhzqRE3ysmbwahh+PAyR29vS9R/Q2sJapZa/dYnfVvs XzGyH3zXSQ4AMc1XmxeIEPL55e0s+8tmhm2gLGJlXL/PtZqRmBtFzwjUAN0XDfgBstcKTSW0itV iuPwIfM0svzKuCg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1782422517803158500 Add a structured x-query-network QMP command that returns network configuration as a NetworkInfo struct with pre-grouped hub information and a flat list of non-hub clients. Each hub includes its ports with inlined peer client info, and each client includes attached netfilter details. Refactor hmp_info_network() to consume only the QMP result instead of directly accessing internal net_clients state. This decouples HMP from internal data structures, making it possible to remove HMP support without losing programmatic network introspection. Signed-off-by: Marc-Andr=C3=A9 Lureau --- qapi/net.json | 122 +++++++++++++++++++++++++++++++++++++++++++++++++= ++++ include/net/net.h | 3 +- net/hub.h | 4 +- net/hub.c | 29 +++++++------ net/net-hmp-cmds.c | 59 +++++++++++++++++++------- net/net.c | 70 +++++++++++++++++++++++------- 6 files changed, 243 insertions(+), 44 deletions(-) diff --git a/qapi/net.json b/qapi/net.json index 08ec7f37946..39db58b03d4 100644 --- a/qapi/net.json +++ b/qapi/net.json @@ -1305,3 +1305,125 @@ 'returns': ['UsernetInfo'], 'if': 'CONFIG_SLIRP', 'features': [ 'unstable' ] } + +## +# @NetFilterInfo: +# +# Information about a netfilter attached to a network client. +# +# @name: filter object name (QOM path component) +# +# @type: QOM type name (e.g. "filter-mirror") +# +# @info: filter properties as comma-separated key=3Dvalue pairs +# (excluding @type) +# +# Since: 11.1 +## +{ 'struct': 'NetFilterInfo', + 'data': { + 'name': 'str', + 'type': 'str', + 'info': 'str' } } + +## +# @NetworkClientInfo: +# +# Information about a network client. +# +# @name: unique network client identifier +# +# @queue-index: index of this queue (0 for single-queue clients) +# +# @type: network client driver type +# +# @info-str: driver-specific formatted information string (e.g. +# "model=3De1000,macaddr=3D52:54:00:12:34:56") +# +# @peer: the connected peer client (always a leaf; the peer's own +# peer field is never populated) +# +# @filters: attached netfilters +# +# Since: 11.1 +## +{ 'struct': 'NetworkClientInfo', + 'data': { + 'name': 'str', + 'queue-index': 'uint32', + 'type': 'NetClientDriver', + 'info-str': 'str', + '*peer': 'NetworkClientInfo', + 'filters': ['NetFilterInfo'] } } + +## +# @NetHubPortInfo: +# +# Information about a hub port. +# +# @name: hub port identifier +# +# @peer: the network client connected through this port +# +# Since: 11.1 +## +{ 'struct': 'NetHubPortInfo', + 'data': { + 'name': 'str', + '*peer': 'NetworkClientInfo' } } + +## +# @NetHubInfo: +# +# Information about a network hub. +# +# @id: hub identifier +# +# @ports: list of ports on this hub +# +# Since: 11.1 +## +{ 'struct': 'NetHubInfo', + 'data': { + 'id': 'int', + 'ports': ['NetHubPortInfo'] } } + +## +# @NetworkInfo: +# +# Information about the network configuration. +# +# @hubs: network hubs and their ports +# +# @clients: network clients not associated with a hub +# +# Since: 11.1 +## +{ 'struct': 'NetworkInfo', + 'data': { + 'hubs': ['NetHubInfo'], + 'clients': ['NetworkClientInfo'] } } + +## +# @x-query-network: +# +# Query the network configuration including hubs and clients. +# +# Features: +# +# @unstable: This command is meant for debugging. +# +# Returns: @NetworkInfo describing hubs and clients. +# +# Since: 11.1 +# +# .. qmp-example:: +# +# -> { "execute": "x-query-network" } +# <- { "return": { "clients": [ { "name": "st0", +# "queue-index": 0, "type": "stream", +# "info-str": "listening" } ] } } +## +{ 'command': 'x-query-network', + 'returns': 'NetworkInfo', + 'features': [ 'unstable' ] } diff --git a/include/net/net.h b/include/net/net.h index 45bc86fc86b..0f0b524df00 100644 --- a/include/net/net.h +++ b/include/net/net.h @@ -274,7 +274,6 @@ DeviceState *qemu_create_nic_device(const char *typenam= e, bool match_default, void qemu_create_nic_bus_devices(BusState *bus, const char *parent_type, const char *default_model, const char *alias, const char *alias_targ= et); -void print_net_client(Monitor *mon, NetClientState *nc); void net_socket_rs_init(SocketReadState *rs, SocketReadStateFinalize *finalize, bool vnet_hdr); @@ -325,6 +324,8 @@ void netdev_add(QemuOpts *opts, Error **errp); =20 int net_hub_id_for_client(NetClientState *nc, int *id); =20 +NetworkClientInfo *net_client_info(NetClientState *nc); + #define DEFAULT_NETWORK_SCRIPT CONFIG_SYSCONFDIR "/qemu-ifup" #define DEFAULT_NETWORK_DOWN_SCRIPT CONFIG_SYSCONFDIR "/qemu-ifdown" #define DEFAULT_BRIDGE_HELPER CONFIG_QEMU_HELPERDIR "/qemu-bridge-helper" diff --git a/net/hub.h b/net/hub.h index ce45f7b399d..cab6b1459b1 100644 --- a/net/hub.h +++ b/net/hub.h @@ -15,10 +15,12 @@ #ifndef NET_HUB_H #define NET_HUB_H =20 +#include "qapi/qapi-types-net.h" + NetClientState *net_hub_add_port(int hub_id, const char *name, NetClientState *hubpeer); -void net_hub_info(Monitor *mon); void net_hub_check_clients(void); bool net_hub_flush(NetClientState *nc); +NetHubInfoList *net_hub_query_info(void); =20 #endif /* NET_HUB_H */ diff --git a/net/hub.c b/net/hub.c index ee5881f6d5c..b53a4cc872c 100644 --- a/net/hub.c +++ b/net/hub.c @@ -14,7 +14,7 @@ =20 #include "qemu/osdep.h" #include "qapi/error.h" -#include "monitor/monitor.h" +#include "qapi/util.h" #include "net/net.h" #include "clients.h" #include "hub.h" @@ -199,26 +199,31 @@ NetClientState *net_hub_add_port(int hub_id, const ch= ar *name, return &port->nc; } =20 -/** - * Print hub configuration - */ -void net_hub_info(Monitor *mon) +NetHubInfoList *net_hub_query_info(void) { + NetHubInfoList *head =3D NULL, **tail =3D &head; NetHub *hub; - NetHubPort *port; =20 QLIST_FOREACH(hub, &hubs, next) { - monitor_printf(mon, "hub %d\n", hub->id); + NetHubInfo *hi =3D g_new0(NetHubInfo, 1); + NetHubPortInfoList **ptail =3D &hi->ports; + NetHubPort *port; + + hi->id =3D hub->id; + QLIST_FOREACH(port, &hub->ports, next) { - monitor_printf(mon, " \\ %s", port->nc.name); + NetHubPortInfo *pi =3D g_new0(NetHubPortInfo, 1); + pi->name =3D g_strdup(port->nc.name); if (port->nc.peer) { - monitor_printf(mon, ": "); - print_net_client(mon, port->nc.peer); - } else { - monitor_printf(mon, "\n"); + pi->peer =3D net_client_info(port->nc.peer); } + QAPI_LIST_APPEND(ptail, pi); } + + QAPI_LIST_APPEND(tail, hi); } + + return head; } =20 /** diff --git a/net/net-hmp-cmds.c b/net/net-hmp-cmds.c index 2b24c9e6049..52ac8da770d 100644 --- a/net/net-hmp-cmds.c +++ b/net/net-hmp-cmds.c @@ -19,37 +19,66 @@ #include "monitor/hmp-completion.h" #include "monitor/monitor.h" #include "net/net.h" -#include "net/hub.h" #include "qapi/clone-visitor.h" #include "qapi/qapi-commands-net.h" #include "qapi/qapi-visit-net.h" +#include "qapi/error.h" #include "qobject/qdict.h" #include "qemu/config-file.h" #include "qemu/help_option.h" #include "qemu/option.h" =20 -void hmp_info_network(Monitor *mon, const QDict *qdict) +static void hmp_print_client_info(Monitor *mon, NetworkClientInfo *ci) { - NetClientState *nc, *peer; - NetClientDriver type; + NetFilterInfoList *f; + + monitor_printf(mon, "%s: index=3D%" PRIu32 ",type=3D%s,%s\n", + ci->name, ci->queue_index, + NetClientDriver_str(ci->type), ci->info_str); + if (ci->filters) { + monitor_printf(mon, "filters:\n"); + for (f =3D ci->filters; f; f =3D f->next) { + monitor_printf(mon, " - %s: type=3D%s%s%s\n", + f->value->name, f->value->type, + f->value->info[0] ? "," : "", f->value->info); + } + } +} =20 - net_hub_info(mon); +void hmp_info_network(Monitor *mon, const QDict *qdict) +{ + Error *err =3D NULL; + g_autoptr(NetworkInfo) info =3D qmp_x_query_network(&err); + NetHubInfoList *h; + NetworkClientInfoList *entry; =20 - QTAILQ_FOREACH(nc, &net_clients, next) { - peer =3D nc->peer; - type =3D nc->info->type; + if (hmp_handle_error(mon, err)) { + return; + } =20 - /* Skip if already printed in hub info */ - if (net_hub_id_for_client(nc, NULL) =3D=3D 0) { - continue; + for (h =3D info->hubs; h; h =3D h->next) { + NetHubPortInfoList *p; + + monitor_printf(mon, "hub %d\n", (int)h->value->id); + for (p =3D h->value->ports; p; p =3D p->next) { + if (p->value->peer) { + monitor_printf(mon, " \\ %s: ", p->value->name); + hmp_print_client_info(mon, p->value->peer); + } else { + monitor_printf(mon, " \\ %s\n", p->value->name); + } } + } + + for (entry =3D info->clients; entry; entry =3D entry->next) { + NetworkClientInfo *ci =3D entry->value; =20 - if (!peer || type =3D=3D NET_CLIENT_DRIVER_NIC) { - print_net_client(mon, nc); + if (!ci->peer || ci->type =3D=3D NET_CLIENT_DRIVER_NIC) { + hmp_print_client_info(mon, ci); } /* else it's a netdev connected to a NIC, printed with the NIC */ - if (peer && type =3D=3D NET_CLIENT_DRIVER_NIC) { + if (ci->peer && ci->type =3D=3D NET_CLIENT_DRIVER_NIC) { monitor_printf(mon, " \\ "); - print_net_client(mon, peer); + hmp_print_client_info(mon, ci->peer); } } } diff --git a/net/net.c b/net/net.c index 2892f1730d1..2bcd229cd9d 100644 --- a/net/net.c +++ b/net/net.c @@ -1523,14 +1523,14 @@ void qmp_netdev_del(const char *id, Error **errp) } } =20 -static void netfilter_print_info(Monitor *mon, NetFilterState *nf) +static char *netfilter_get_info_str(NetFilterState *nf) { char *str; ObjectProperty *prop; ObjectPropertyIterator iter; Visitor *v; + GString *buf =3D g_string_new(NULL); =20 - /* generate info str */ object_property_iter_init(&iter, OBJECT(nf)); while ((prop =3D object_property_iter_next(&iter))) { if (!strcmp(prop->name, "type")) { @@ -1540,29 +1540,69 @@ static void netfilter_print_info(Monitor *mon, NetF= ilterState *nf) object_property_get(OBJECT(nf), prop->name, v, NULL); visit_complete(v, &str); visit_free(v); - monitor_printf(mon, ",%s=3D%s", prop->name, str); + if (buf->len > 0) { + g_string_append_c(buf, ','); + } + g_string_append_printf(buf, "%s=3D%s", prop->name, str); g_free(str); } - monitor_printf(mon, "\n"); + + return g_string_free(buf, false); } =20 -void print_net_client(Monitor *mon, NetClientState *nc) +static NetworkClientInfo *net_client_info_no_peer(NetClientState *nc) { + NetworkClientInfo *info =3D g_new0(NetworkClientInfo, 1); NetFilterState *nf; =20 - monitor_printf(mon, "%s: index=3D%d,type=3D%s,%s\n", nc->name, - nc->queue_index, - NetClientDriver_str(nc->info->type), - nc->info_str); + info->name =3D g_strdup(nc->name); + info->queue_index =3D nc->queue_index; + info->type =3D nc->info->type; + info->info_str =3D g_strdup(nc->info_str); + if (!QTAILQ_EMPTY(&nc->filters)) { - monitor_printf(mon, "filters:\n"); + NetFilterInfoList **ftail =3D &info->filters; + QTAILQ_FOREACH(nf, &nc->filters, next) { + NetFilterInfo *fi =3D g_new0(NetFilterInfo, 1); + fi->name =3D g_strdup( + object_get_canonical_path_component(OBJECT(nf))); + fi->type =3D g_strdup(object_get_typename(OBJECT(nf))); + fi->info =3D netfilter_get_info_str(nf); + QAPI_LIST_APPEND(ftail, fi); + } } - QTAILQ_FOREACH(nf, &nc->filters, next) { - monitor_printf(mon, " - %s: type=3D%s", - object_get_canonical_path_component(OBJECT(nf)), - object_get_typename(OBJECT(nf))); - netfilter_print_info(mon, nf); + + return info; +} + +NetworkClientInfo *net_client_info(NetClientState *nc) +{ + NetworkClientInfo *info =3D net_client_info_no_peer(nc); + + if (nc->peer) { + info->peer =3D net_client_info_no_peer(nc->peer); } + + return info; +} + +NetworkInfo *qmp_x_query_network(Error **errp) +{ + NetworkInfo *info =3D g_new0(NetworkInfo, 1); + NetworkClientInfoList **tail =3D &info->clients; + NetClientState *nc; + + info->hubs =3D net_hub_query_info(); + + QTAILQ_FOREACH(nc, &net_clients, next) { + /* Skip if already gathered in hub info */ + if (net_hub_id_for_client(nc, NULL) =3D=3D 0) { + continue; + } + QAPI_LIST_APPEND(tail, net_client_info(nc)); + } + + return info; } =20 RxFilterInfoList *qmp_query_rx_filter(const char *name, Error **errp) --=20 2.54.0 From nobody Sun Jul 26 11:53:26 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782422525; cv=none; d=zohomail.com; s=zohoarc; b=adggZ/ko0zfWt6UULHK/Z34G3u1B6rqkLkpKyD4+yI6h8soibQhwfG4Dr7D7nVIW9nazSNUIRKkiQ7l+1WBYsRtZzZDzio0NWUEhf02oIDRhSJo0MZgFBk+Byb18/K7u5lNMVL9CQNplqiOUSWeDXWmw+N+bcuFseIKJQousYO0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782422525; 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=12bX/10Ziyy/6kLw/JdKoHVNUOqJFvEDee/qU/5MXpg=; b=V60dwwN8X4270Tbw3hEcEIF2mE238cdbz5nG3IE6MwGjnmERTSPo0qGRjZdDcCRjZtobLR2JtHiaR4vJzCaS2Sc0/iG/+nYAqzXOHKFv9cpUcq9lwqiXdjRtArWta5FNt6n2lPiFMuTURE1oTw/xMlCidrSAcL3UPmk3kXRa3cA= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1782422525352109.06995735197529; Thu, 25 Jun 2026 14:22:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wcrVx-0003N4-KN; Thu, 25 Jun 2026 17:21:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrVr-000317-OR for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:21:33 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrVo-0003oT-Qm for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:21:31 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-344-KztnCAUnMlSsQ7xtRWyZGg-1; Thu, 25 Jun 2026 17:21:26 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6053E183019B; Thu, 25 Jun 2026 21:21:25 +0000 (UTC) Received: from localhost (unknown [10.44.24.16]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D1A5E1800370; Thu, 25 Jun 2026 21:21:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782422488; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=12bX/10Ziyy/6kLw/JdKoHVNUOqJFvEDee/qU/5MXpg=; b=Wo82cev6CMAsd/25YIdyTOpYP5DBt8dBEo8tordT8Ep2hFC60G13i3O9sS6c1Mbl+KqpaT ArmdzNkqaeJJ4z40fraH0rS0sxft4fGXWpKPEunyIWS/t9QQk/OLXYeusc3UsB2SdSZOkP UVSupqsuarcVzTQOd/EXtJZ5pKGzhq8= X-MC-Unique: KztnCAUnMlSsQ7xtRWyZGg-1 X-Mimecast-MFC-AGG-ID: KztnCAUnMlSsQ7xtRWyZGg_1782422485 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 26 Jun 2026 01:19:22 +0400 Subject: [PATCH v2 21/39] tests/qtest/netdev-socket: replace HMP with x-query-network QMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260626-qemu-no-hmp-v2-21-8af31bc54c61@redhat.com> References: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> In-Reply-To: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster X-Developer-Signature: v=1; a=openpgp-sha256; l=12748; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=TAdPYGTKLkf+slB8VP74dWLo4dpdLt/APwXIDAyeryg=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqPZtdF65GFpFQ27Z9LrMXNO/laCcPO/u8Iv4Sa ZGtrLMqa3aJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaj2bXQAKCRDa6OEJdZac 5d9ID/4kOb/QNbjNKY4Je3rSkQlAbl4rDWYwcBywyqr+cWTiOh7fkWemwJ8IwGv8QZvvBHnEYtb vlzLECdH6NZEg6xZRK+CaQUL/j6udGBqY//CMKzXDA6U2c5Q7thMpDV0Sd9jgaiJ9o9Ham45fgP 7HsXexxqlN308Y9TP/jpIq/mUW4hJXq2cag9BYS/+lxDe8FGHCE4Yl+88nk/RZRb1XEBBfs+NyV bomaACcY8U+2GfRh3vdvEGnAPuz2zJoqLMNUd9C8mYf9TRQtKRQx/9UzUGItbjdWF3kS2yLNpER XW7fshpBsEvz1r9j7LWOswrQp3rRT/b7IHEJ1xcTkVEe76vPMMoYrsW2spnyz31B/LbGYd9Q+C9 sPrB9wqJC8gyD0dE8rbXLQgaWcHdbnrl2Pk77ZHuMEPodRWUih34zhudGdp4jSa1RDQiC1Pg9Mp Yb+ahF0FSIY29af/faYG5rFlSd7Glz215dwg+Jg0cB4Hii7Ou62r91ZAFQLl1JVroHkLa3rIDL7 KUbyw00iZ07KmUBc1VmcrKvJd98kpGsR1wzbfEhRO7Cn1rXUyeNvyzQ+lowJPAJ/asvmupUTShJ oTMJ50tExjsdIf3OV/e3ORQ28HivpvK7pKQm4vspl3fH9zDWxbikMln7SGW5+M6AEgI11Lilupw AyWJxy3oYf2W+4g== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1782422525898158500 Replace the HMP "info network" text parsing with the structured x-query-network QMP command. This makes the test assertions more robust by matching individual fields (info-str) instead of parsing the full HMP line format. The EXPECT_STATE macro now takes an explicit netdev id argument to look up the client by name in the QMP response. The strrchr truncation is made NULL-safe: if the truncation character is not found, the full string is compared (and the final g_assert_cmpstr will catch mismatches). While at it, fix the pre-existing duplicate "qemu/sockets.h" include, and reorder includes. Signed-off-by: Marc-Andr=C3=A9 Lureau --- tests/qtest/netdev-socket.c | 143 +++++++++++++++++++++++++---------------= ---- 1 file changed, 82 insertions(+), 61 deletions(-) diff --git a/tests/qtest/netdev-socket.c b/tests/qtest/netdev-socket.c index b731af0ad95..30005c2e001 100644 --- a/tests/qtest/netdev-socket.c +++ b/tests/qtest/netdev-socket.c @@ -7,33 +7,62 @@ */ =20 #include "qemu/osdep.h" -#include "qemu/sockets.h" #include #include "../unit/socket-helpers.h" #include "libqtest.h" -#include "qobject/qstring.h" -#include "qemu/sockets.h" -#include "qapi/qobject-input-visitor.h" #include "qapi/qapi-visit-sockets.h" +#include "qapi/qobject-input-visitor.h" +#include "qemu/sockets.h" +#include "qobject/qdict.h" +#include "qobject/qlist.h" +#include "qobject/qstring.h" =20 #define CONNECTION_TIMEOUT 60 =20 -#define EXPECT_STATE(q, e, t) \ -do { \ - char *resp =3D NULL; \ - g_test_timer_start(); \ - do { \ - g_free(resp); \ - resp =3D qtest_hmp(q, "info network"); \ - if (t) { \ - strrchr(resp, t)[0] =3D 0; \ - } \ - if (g_str_equal(resp, e)) { \ - break; \ - } \ - } while (g_test_timer_elapsed() < CONNECTION_TIMEOUT); \ - g_assert_cmpstr(resp, =3D=3D, e); \ - g_free(resp); \ +/* + * Only checks info-str; type is implicit from the netdev created by each = test + */ +static char *query_net_info_str(QTestState *q, const char *name) +{ + QDict *ret; + QList *clients; + QListEntry *entry; + + ret =3D qtest_qmp_assert_success_ref(q, "{'execute': 'x-query-network'= }"); + clients =3D qdict_get_qlist(ret, "clients"); + g_assert_nonnull(clients); + + QLIST_FOREACH_ENTRY(clients, entry) { + QDict *client =3D qobject_to(QDict, qlist_entry_obj(entry)); + if (g_str_equal(qdict_get_str(client, "name"), name)) { + char *info =3D g_strdup(qdict_get_str(client, "info-str")); + qobject_unref(ret); + return info; + } + } + + g_assert_not_reached(); +} + +#define EXPECT_STATE(q, id, e, t) \ +do { \ + char *info =3D NULL; \ + g_test_timer_start(); \ + do { \ + g_free(info); \ + info =3D query_net_info_str(q, id); \ + if (t) { \ + char *p =3D strrchr(info, t); \ + if (p) { \ + p[0] =3D 0; \ + } \ + } \ + if (g_str_equal(info, e)) { \ + break; \ + } \ + } while (g_test_timer_elapsed() < CONNECTION_TIMEOUT); \ + g_assert_cmpstr(info, =3D=3D, e); \ + g_free(info); \ } while (0) =20 static gchar *tmpdir; @@ -127,20 +156,19 @@ static void test_stream_inet_ipv4(void) "addr.ipv4=3Don,addr.ipv6=3Doff," "addr.host=3D127.0.0.1,addr.port=3D%d", port); =20 - EXPECT_STATE(qts0, "st0: index=3D0,type=3Dstream,listening\r\n", 0); + EXPECT_STATE(qts0, "st0", "listening", 0); =20 qts1 =3D qtest_initf("-nodefaults -M none " "-netdev stream,server=3Dfalse,id=3Dst0,addr.type= =3Dinet," "addr.ipv4=3Don,addr.ipv6=3Doff," "addr.host=3D127.0.0.1,addr.port=3D%d", port); =20 - expect =3D g_strdup_printf("st0: index=3D0,type=3Dstream,tcp:127.0.0.1= :%d\r\n", - port); - EXPECT_STATE(qts1, expect, 0); + expect =3D g_strdup_printf("tcp:127.0.0.1:%d", port); + EXPECT_STATE(qts1, "st0", expect, 0); g_free(expect); =20 /* the port is unknown, check only the address */ - EXPECT_STATE(qts0, "st0: index=3D0,type=3Dstream,tcp:127.0.0.1", ':'); + EXPECT_STATE(qts0, "st0", "tcp:127.0.0.1", ':'); =20 qtest_quit(qts1); qtest_quit(qts0); @@ -200,7 +228,7 @@ static void test_stream_unix_reconnect(void) "-netdev stream,id=3Dst0,server=3Dtrue,addr.type=3D= unix," "addr.path=3D%s", path); =20 - EXPECT_STATE(qts0, "st0: index=3D0,type=3Dstream,listening\r\n", 0); + EXPECT_STATE(qts0, "st0", "listening", 0); =20 qts1 =3D qtest_initf("-nodefaults -M none " "-netdev stream,server=3Dfalse,id=3Dst0,addr.type= =3Dunix," @@ -250,20 +278,19 @@ static void test_stream_inet_ipv6(void) "addr.ipv4=3Doff,addr.ipv6=3Don," "addr.host=3D::1,addr.port=3D%d", port); =20 - EXPECT_STATE(qts0, "st0: index=3D0,type=3Dstream,listening\r\n", 0); + EXPECT_STATE(qts0, "st0", "listening", 0); =20 qts1 =3D qtest_initf("-nodefaults -M none " "-netdev stream,server=3Dfalse,id=3Dst0,addr.type= =3Dinet," "addr.ipv4=3Doff,addr.ipv6=3Don," "addr.host=3D::1,addr.port=3D%d", port); =20 - expect =3D g_strdup_printf("st0: index=3D0,type=3Dstream,tcp:::1:%d\r\= n", - port); - EXPECT_STATE(qts1, expect, 0); + expect =3D g_strdup_printf("tcp:::1:%d", port); + EXPECT_STATE(qts1, "st0", expect, 0); g_free(expect); =20 /* the port is unknown, check only the address */ - EXPECT_STATE(qts0, "st0: index=3D0,type=3Dstream,tcp:::1", ':'); + EXPECT_STATE(qts0, "st0", "tcp:::1", ':'); =20 qtest_quit(qts1); qtest_quit(qts0); @@ -282,16 +309,16 @@ static void test_stream_unix(void) "addr.type=3Dunix,addr.path=3D%s,", path); =20 - EXPECT_STATE(qts0, "st0: index=3D0,type=3Dstream,listening\r\n", 0); + EXPECT_STATE(qts0, "st0", "listening", 0); =20 qts1 =3D qtest_initf("-nodefaults -M none " "-netdev stream,id=3Dst0,server=3Dfalse," "addr.type=3Dunix,addr.path=3D%s", path); =20 - expect =3D g_strdup_printf("st0: index=3D0,type=3Dstream,unix:%s\r\n",= path); - EXPECT_STATE(qts1, expect, 0); - EXPECT_STATE(qts0, expect, 0); + expect =3D g_strdup_printf("unix:%s", path); + EXPECT_STATE(qts1, "st0", expect, 0); + EXPECT_STATE(qts0, "st0", expect, 0); g_free(expect); g_free(path); =20 @@ -314,16 +341,16 @@ static void test_stream_unix_abstract(void) "addr.abstract=3Don", path); =20 - EXPECT_STATE(qts0, "st0: index=3D0,type=3Dstream,listening\r\n", 0); + EXPECT_STATE(qts0, "st0", "listening", 0); =20 qts1 =3D qtest_initf("-nodefaults -M none " "-netdev stream,id=3Dst0,server=3Dfalse," "addr.type=3Dunix,addr.path=3D%s,addr.abstract=3Don= ", path); =20 - expect =3D g_strdup_printf("st0: index=3D0,type=3Dstream,unix:%s\r\n",= path); - EXPECT_STATE(qts1, expect, 0); - EXPECT_STATE(qts0, expect, 0); + expect =3D g_strdup_printf("unix:%s", path); + EXPECT_STATE(qts1, "st0", expect, 0); + EXPECT_STATE(qts0, "st0", expect, 0); g_free(expect); g_free(path); =20 @@ -346,14 +373,14 @@ static void test_stream_fd(void) "-netdev stream,id=3Dst0,addr.type=3Dfd,addr.str=3D= %d", sock[0]); =20 - EXPECT_STATE(qts0, "st0: index=3D0,type=3Dstream,unix:\r\n", 0); + EXPECT_STATE(qts0, "st0", "unix:", 0); =20 qts1 =3D qtest_initf("-nodefaults -M none " "-netdev stream,id=3Dst0,addr.type=3Dfd,addr.str=3D= %d", sock[1]); =20 - EXPECT_STATE(qts1, "st0: index=3D0,type=3Dstream,unix:\r\n", 0); - EXPECT_STATE(qts0, "st0: index=3D0,type=3Dstream,unix:\r\n", 0); + EXPECT_STATE(qts1, "st0", "unix:", 0); + EXPECT_STATE(qts0, "st0", "unix:", 0); =20 qtest_quit(qts1); qtest_quit(qts0); @@ -379,10 +406,9 @@ static void test_dgram_inet(void) "remote.type=3Dinet,remote.host=3D127.0.0.1,remote.= port=3D%d", port[0], port[1]); =20 - expect =3D g_strdup_printf("st0: index=3D0,type=3Ddgram," - "udp=3D127.0.0.1:%d/127.0.0.1:%d\r\n", + expect =3D g_strdup_printf("udp=3D127.0.0.1:%d/127.0.0.1:%d", port[0], port[1]); - EXPECT_STATE(qts0, expect, 0); + EXPECT_STATE(qts0, "st0", expect, 0); g_free(expect); =20 qts1 =3D qtest_initf("-nodefaults -M none " @@ -391,10 +417,9 @@ static void test_dgram_inet(void) "remote.type=3Dinet,remote.host=3D127.0.0.1,remote.= port=3D%d", port[1], port[0]); =20 - expect =3D g_strdup_printf("st0: index=3D0,type=3Ddgram," - "udp=3D127.0.0.1:%d/127.0.0.1:%d\r\n", + expect =3D g_strdup_printf("udp=3D127.0.0.1:%d/127.0.0.1:%d", port[1], port[0]); - EXPECT_STATE(qts1, expect, 0); + EXPECT_STATE(qts1, "st0", expect, 0); g_free(expect); =20 qtest_quit(qts1); @@ -410,7 +435,7 @@ static void test_dgram_mcast(void) "-netdev dgram,id=3Dst0," "remote.type=3Dinet,remote.host=3D230.0.0.1,remote.p= ort=3D1234"); =20 - EXPECT_STATE(qts, "st0: index=3D0,type=3Ddgram,mcast=3D230.0.0.1:1234\= r\n", 0); + EXPECT_STATE(qts, "st0", "mcast=3D230.0.0.1:1234", 0); =20 qtest_quit(qts); } @@ -431,9 +456,8 @@ static void test_dgram_unix(void) "remote.type=3Dunix,remote.path=3D%s", path0, path1); =20 - expect =3D g_strdup_printf("st0: index=3D0,type=3Ddgram,udp=3D%s:%s\r\= n", - path0, path1); - EXPECT_STATE(qts0, expect, 0); + expect =3D g_strdup_printf("udp=3D%s:%s", path0, path1); + EXPECT_STATE(qts0, "st0", expect, 0); g_free(expect); =20 qts1 =3D qtest_initf("-nodefaults -M none " @@ -441,10 +465,8 @@ static void test_dgram_unix(void) "remote.type=3Dunix,remote.path=3D%s", path1, path0); =20 - - expect =3D g_strdup_printf("st0: index=3D0,type=3Ddgram,udp=3D%s:%s\r\= n", - path1, path0); - EXPECT_STATE(qts1, expect, 0); + expect =3D g_strdup_printf("udp=3D%s:%s", path1, path0); + EXPECT_STATE(qts1, "st0", expect, 0); g_free(expect); =20 unlink(path0); @@ -470,17 +492,16 @@ static void test_dgram_fd(void) "-netdev dgram,id=3Dst0,local.type=3Dfd,local.str= =3D%d", sv[0]); =20 - expect =3D g_strdup_printf("st0: index=3D0,type=3Ddgram,fd=3D%d unix\r= \n", sv[0]); - EXPECT_STATE(qts0, expect, 0); + expect =3D g_strdup_printf("fd=3D%d unix", sv[0]); + EXPECT_STATE(qts0, "st0", expect, 0); g_free(expect); =20 qts1 =3D qtest_initf("-nodefaults -M none " "-netdev dgram,id=3Dst0,local.type=3Dfd,local.str= =3D%d", sv[1]); =20 - - expect =3D g_strdup_printf("st0: index=3D0,type=3Ddgram,fd=3D%d unix\r= \n", sv[1]); - EXPECT_STATE(qts1, expect, 0); + expect =3D g_strdup_printf("fd=3D%d unix", sv[1]); + EXPECT_STATE(qts1, "st0", expect, 0); g_free(expect); =20 qtest_quit(qts1); --=20 2.54.0 From nobody Sun Jul 26 11:53:26 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782422549; cv=none; d=zohomail.com; s=zohoarc; b=We9WjfO5urzTYDiFvR+arkdyBZADVONZNRHLXur99txzKkn4CSmodGUZlvFMnesWBluglRReYMgIKEiq7f9BML0l9ag+XXDLI2eygqhF/HhkPDA8CRUG2xIFL0e9qTValbl4y44QRx9Fqw7VfqrAGjsF8SwnaJLUsDwxwSyf72g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782422549; 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=AWESVFA/bEGjV5UoFt7/z1oT86TfXk+2E5bFqTUhbG8=; b=mGD0epHJVXkLdH+XqYmkkLOpwHAw6foQpc8Cr+IoKsdIa3t0/UTNsqxMhTcSp8HOJLCWhpIMq+Gg5kV2no4W/3MEl/GO/0DRZ9MmB9yJ5m+infSghspkk/jbtfYg+jIU4xvwwnFCNRFtBVDGTM0unr8zS3pgDVaPhxeWMOWr5e8= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1782422549401282.73910916214595; Thu, 25 Jun 2026 14:22:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wcrWD-0004Ke-7d; Thu, 25 Jun 2026 17:21:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrW4-0003mf-QO for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:21:45 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrVz-0003q4-9o for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:21:44 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-399-LIaEQqogOwOumzdcUsmkTw-1; Thu, 25 Jun 2026 17:21:34 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 77AAC1954221; Thu, 25 Jun 2026 21:21:33 +0000 (UTC) Received: from localhost (unknown [10.44.24.16]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 792053000B56; Thu, 25 Jun 2026 21:21:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782422498; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AWESVFA/bEGjV5UoFt7/z1oT86TfXk+2E5bFqTUhbG8=; b=G/htHuCiydgq/dtiequZWVorPAEpzNj11F7WLSt9sXacfQB7aM2iSsuuwiNQwVD2eX505G fHduTk63v9L6ee/nVgp+8slHiLKnm8tTOPgHlPb9DSXDHRJOll5DdjbZCQ64yyXYcSzjlw earF6yya4uHH0dAolBn5nCRxSY+B/cI= X-MC-Unique: LIaEQqogOwOumzdcUsmkTw-1 X-Mimecast-MFC-AGG-ID: LIaEQqogOwOumzdcUsmkTw_1782422493 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 26 Jun 2026 01:19:23 +0400 Subject: [PATCH v2 22/39] qemu-io: propagate errors through Error API instead of printf MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260626-qemu-no-hmp-v2-22-8af31bc54c61@redhat.com> References: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> In-Reply-To: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Developer-Signature: v=1; a=openpgp-sha256; l=150498; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=pnCYlYRc060UbFLh3QGMLxh17/n+1JF4a69v6bHcPx8=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqPZtdVvt5V3X1SieSS9QHxCl+yBSYhqL28rGdI rY06PEB+paJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaj2bXQAKCRDa6OEJdZac 5fV+D/4kKHmtBKsfPwvjc+0+0aMrBGTQd0izylfdnCwLlW6+NpnEfFUsW/0HmoiiGIMZu+sctdF d6kPDV6rHfmRLWxi2vHI6sxROv0jh9CTysUMIHKduzxMuZANOqDtj58yxiq+U7JVcEe+SRMhfOs hSMvK0zLVSyL+NNXUT767mWam3vRV3MdVi/DnKk1fNSCVvUzvweh9/T+BjnV5upaQNnRlm43sA6 dIEvPu+XFolBohdfPLGYmN7a5WgA4Lac4dQNnUlsIXwMNen6i0/JdJjBsmG1KNLvIWWJulSCD2O RBRI8WiEJzBpkHta5vx5fKdsxwDWqQZISH9FBi59GwbRizm2uEvSBmeZiSj/FG/TVceTG4JUZqM YqBj3iuWTjqHz7dOAAq27I2OpFPHwu6RIdf/4Ppj3qziE50sGRXSe5rd5XIoWP2znd2YNFfTGC+ eo/JJcXQbampj1uxmQtfsxxY7qWxAaQNrsa2LdWuRDjtloTBQlu2QwDD4gHAmkpN4bZ2tiIPHQ9 cJaPLzIoF0Xs+jLVfah/PZPeAOuwavmEOZ996/6GFQ09DKqILfobOQLcVfwFf+EDFFCQx3RnFbO BXL3KIlf6gb1HUVtu0SD95vcJhXd4ecLGO2CV6qvaxqSkaL7w4ulS334D5VZeqGzE7FTYyDqgol Hy0wfLRiIyV+V/w== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 8 X-Spam_score: 0.8 X-Spam_bar: / X-Spam_report: (0.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-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: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1782422550145158500 Convert the qemu-io command infrastructure to use QEMU's Error API (Error **errp) for error propagation instead of printing directly to stdout/stderr via printf/fprintf. The cfunc_t typedef, all ~35 command functions, the dispatcher chain (command/init_check_command/qemuio_command), and helper functions (parse_pattern, create_iovec, qemu_io_alloc_from_file) all gain an Error **errp parameter. Async completion callbacks (aio_read_done, aio_write_done, aio_discard_done) use error_report() since they have no Error path back to the caller. Update tests: - error_report_err() prepends qemu-io: prefix - copy-before-write: check the HMP return value, rather than stdio - other tests: update to check JSON {"return": "Error: error text"} Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/qemu-io.h | 4 +- block/monitor/block-hmp-cmds.c | 2 +- qemu-io-cmds.c | 414 +++++++++++++--------= ---- qemu-io.c | 17 +- tests/qemu-iotests/004.out | 20 +- tests/qemu-iotests/021.out | 60 ++-- tests/qemu-iotests/026.out | 228 +++++++------- tests/qemu-iotests/060.out | 44 ++- tests/qemu-iotests/071.out | 10 +- tests/qemu-iotests/072.out | 2 +- tests/qemu-iotests/080.out | 4 +- tests/qemu-iotests/081.out | 2 +- tests/qemu-iotests/083.out | 36 +-- tests/qemu-iotests/089.out | 4 +- tests/qemu-iotests/114.out | 2 +- tests/qemu-iotests/134.out | 2 +- tests/qemu-iotests/137.out | 2 +- tests/qemu-iotests/153.out | 12 +- tests/qemu-iotests/171 | 2 +- tests/qemu-iotests/171.out | 68 ++-- tests/qemu-iotests/205 | 2 +- tests/qemu-iotests/214.out | 2 +- tests/qemu-iotests/220.out | 2 +- tests/qemu-iotests/225.out | 4 +- tests/qemu-iotests/244.out | 12 +- tests/qemu-iotests/249.out | 6 +- tests/qemu-iotests/271.out | 14 +- tests/qemu-iotests/289.out | 2 +- tests/qemu-iotests/305.out | 2 +- tests/qemu-iotests/307.out | 2 +- tests/qemu-iotests/tests/backup-discard-source | 4 +- tests/qemu-iotests/tests/copy-before-write | 66 ++-- tests/qemu-iotests/tests/file-io-error.out | 2 +- tests/qemu-iotests/tests/image-fleecing.out | 12 +- tests/qemu-iotests/tests/inactive-node-nbd.out | 8 +- 35 files changed, 552 insertions(+), 523 deletions(-) diff --git a/include/qemu-io.h b/include/qemu-io.h index 3af513004a6..240764bb35c 100644 --- a/include/qemu-io.h +++ b/include/qemu-io.h @@ -25,7 +25,7 @@ * Operate on @blk using @argc/@argv as the command's arguments, and * return 0 on success or negative errno on failure. */ -typedef int (*cfunc_t)(BlockBackend *blk, int argc, char **argv); +typedef int (*cfunc_t)(BlockBackend *blk, int argc, char **argv, Error **e= rrp); =20 typedef void (*helpfunc_t)(void); =20 @@ -45,7 +45,7 @@ typedef struct cmdinfo { =20 extern bool qemuio_misalign; =20 -int qemuio_command(BlockBackend *blk, const char *cmd); +int qemuio_command(BlockBackend *blk, const char *cmd, Error **errp); =20 void qemuio_add_command(const cmdinfo_t *ci); void qemuio_command_usage(const cmdinfo_t *ci); diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c index 69ade0534f1..c7113b8ea5e 100644 --- a/block/monitor/block-hmp-cmds.c +++ b/block/monitor/block-hmp-cmds.c @@ -608,7 +608,7 @@ void hmp_qemu_io(Monitor *mon, const QDict *qdict) * extended, possibly resulting in a read-only guest device keeping wr= ite * permissions. Ugly, but it appears to be the lesser evil. */ - qemuio_command(blk, command); + qemuio_command(blk, command, &err); =20 fail: blk_unref(local_blk); diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c index de4c1966fea..aa795fd87a1 100644 --- a/qemu-io-cmds.c +++ b/qemu-io-cmds.c @@ -55,40 +55,43 @@ void qemuio_command_usage(const cmdinfo_t *ci) printf("%s %s -- %s\n", ci->name, ci->args, ci->oneline); } =20 -static int init_check_command(BlockBackend *blk, const cmdinfo_t *ct) +static int init_check_command(BlockBackend *blk, const cmdinfo_t *ct, + Error **errp) { if (ct->flags & CMD_FLAG_GLOBAL) { return 1; } if (!(ct->flags & CMD_NOFILE_OK) && !blk) { - fprintf(stderr, "no file open, try 'help open'\n"); + error_setg(errp, "no file open, try 'help open'"); return 0; } return 1; } =20 static int command(BlockBackend *blk, const cmdinfo_t *ct, int argc, - char **argv) + char **argv, Error **errp) { char *cmd =3D argv[0]; =20 - if (!init_check_command(blk, ct)) { + if (!init_check_command(blk, ct, errp)) { return -EINVAL; } =20 if (argc - 1 < ct->argmin || (ct->argmax !=3D -1 && argc - 1 > ct->arg= max)) { if (ct->argmax =3D=3D -1) { - fprintf(stderr, - "bad argument count %d to %s, expected at least %d arg= uments\n", - argc-1, cmd, ct->argmin); + error_setg(errp, + "bad argument count %d to %s," + " expected at least %d arguments", + argc - 1, cmd, ct->argmin); } else if (ct->argmin =3D=3D ct->argmax) { - fprintf(stderr, - "bad argument count %d to %s, expected %d arguments\n", - argc-1, cmd, ct->argmin); + error_setg(errp, + "bad argument count %d to %s, expected %d arguments= ", + argc - 1, cmd, ct->argmin); } else { - fprintf(stderr, - "bad argument count %d to %s, expected between %d and = %d arguments\n", - argc-1, cmd, ct->argmin, ct->argmax); + error_setg(errp, + "bad argument count %d to %s," + " expected between %d and %d arguments", + argc - 1, cmd, ct->argmin, ct->argmax); } return -EINVAL; } @@ -112,21 +115,19 @@ static int command(BlockBackend *blk, const cmdinfo_t= *ct, int argc, =20 if (ct->perm & ~orig_perm) { uint64_t new_perm; - Error *local_err =3D NULL; int ret; =20 new_perm =3D orig_perm | ct->perm; =20 - ret =3D blk_set_perm(blk, new_perm, orig_shared_perm, &local_e= rr); + ret =3D blk_set_perm(blk, new_perm, orig_shared_perm, errp); if (ret < 0) { - error_report_err(local_err); return ret; } } } =20 qemu_reset_optind(); - return ct->cfunc(blk, argc, argv); + return ct->cfunc(blk, argc, argv, errp); } =20 static const cmdinfo_t *find_command(const char *cmd) @@ -192,18 +193,18 @@ static int64_t cvtnum(const char *s) return value; } =20 -static void print_cvtnum_err(int64_t rc, const char *arg) +static void set_cvtnum_err(int64_t rc, const char *arg, Error **errp) { switch (rc) { case -EINVAL: - printf("Parsing error: non-numeric argument," - " or extraneous/unrecognized suffix -- %s\n", arg); + error_setg(errp, "Parsing error: non-numeric argument," + " or extraneous/unrecognized suffix -- %s", arg); break; case -ERANGE: - printf("Parsing error: argument too large -- %s\n", arg); + error_setg(errp, "Parsing error: argument too large -- %s", arg); break; default: - printf("Parsing error: %s\n", arg); + error_setg(errp, "Parsing error: %s", arg); } } =20 @@ -316,14 +317,14 @@ static void timestr(struct timespec *tv, char *ts, si= ze_t size, int format) * Because the pattern is used as an argument to memset it must evaluate * to an unsigned integer that fits into a single byte. */ -static int parse_pattern(const char *arg) +static int parse_pattern(const char *arg, Error **errp) { char *endptr =3D NULL; long pattern; =20 pattern =3D strtol(arg, &endptr, 0); if (pattern < 0 || pattern > UCHAR_MAX || *endptr !=3D '\0') { - printf("%s is not a valid pattern byte\n", arg); + error_setg(errp, "%s is not a valid pattern byte", arg); return -1; } =20 @@ -386,7 +387,8 @@ static void qemu_io_free(BlockBackend *blk, void *p, si= ze_t len, * NULL on error */ static void *qemu_io_alloc_from_file(BlockBackend *blk, size_t len, - const char *file_name, bool register_= buf) + const char *file_name, bool register_= buf, + Error **errp) { size_t alloc_len =3D len + (qemuio_misalign ? MISALIGN_OFFSET : 0); char *alloc_buf, *buf, *end; @@ -394,7 +396,7 @@ static void *qemu_io_alloc_from_file(BlockBackend *blk,= size_t len, int pattern_len; =20 if (!f) { - perror(file_name); + error_setg_errno(errp, errno, "%s", file_name); return NULL; } =20 @@ -407,12 +409,12 @@ static void *qemu_io_alloc_from_file(BlockBackend *bl= k, size_t len, pattern_len =3D fread(buf, 1, len, f); =20 if (ferror(f)) { - perror(file_name); + error_setg_errno(errp, errno, "%s", file_name); goto error; } =20 if (pattern_len =3D=3D 0) { - fprintf(stderr, "%s: file is empty\n", file_name); + error_setg(errp, "%s: file is empty", file_name); goto error; } =20 @@ -494,7 +496,7 @@ static void print_report(const char *op, struct timespe= c *t, int64_t offset, */ static void * create_iovec(BlockBackend *blk, QEMUIOVector *qiov, char **argv, int nr_io= v, - int pattern, bool register_buf) + int pattern, bool register_buf, Error **errp) { size_t *sizes =3D g_new0(size_t, nr_iov); size_t count =3D 0; @@ -508,19 +510,20 @@ create_iovec(BlockBackend *blk, QEMUIOVector *qiov, c= har **argv, int nr_iov, =20 len =3D cvtnum(arg); if (len < 0) { - print_cvtnum_err(len, arg); + set_cvtnum_err(len, arg, errp); goto fail; } =20 if (len > BDRV_REQUEST_MAX_BYTES) { - printf("Argument '%s' exceeds maximum size %" PRIu64 "\n", arg, - (uint64_t)BDRV_REQUEST_MAX_BYTES); + error_setg(errp, "Argument '%s' exceeds maximum size %" PRIu64, + arg, (uint64_t)BDRV_REQUEST_MAX_BYTES); goto fail; } =20 if (count > BDRV_REQUEST_MAX_BYTES - len) { - printf("The total number of bytes exceed the maximum size %" P= RIu64 - "\n", (uint64_t)BDRV_REQUEST_MAX_BYTES); + error_setg(errp, + "The total number of bytes exceed the maximum size = %" + PRIu64, (uint64_t)BDRV_REQUEST_MAX_BYTES); goto fail; } =20 @@ -692,7 +695,7 @@ static void read_help(void) "\n"); } =20 -static int read_f(BlockBackend *blk, int argc, char **argv); +static int read_f(BlockBackend *blk, int argc, char **argv, Error **errp); =20 static const cmdinfo_t read_cmd =3D { .name =3D "read", @@ -705,7 +708,7 @@ static const cmdinfo_t read_cmd =3D { .help =3D read_help, }; =20 -static int read_f(BlockBackend *blk, int argc, char **argv) +static int read_f(BlockBackend *blk, int argc, char **argv, Error **errp) { struct timespec t1, t2; bool Cflag =3D false, qflag =3D false, vflag =3D false; @@ -732,7 +735,7 @@ static int read_f(BlockBackend *blk, int argc, char **a= rgv) lflag =3D true; pattern_count =3D cvtnum(optarg); if (pattern_count < 0) { - print_cvtnum_err(pattern_count, optarg); + set_cvtnum_err(pattern_count, optarg, errp); return pattern_count; } break; @@ -741,7 +744,7 @@ static int read_f(BlockBackend *blk, int argc, char **a= rgv) break; case 'P': Pflag =3D true; - pattern =3D parse_pattern(optarg); + pattern =3D parse_pattern(optarg, errp); if (pattern < 0) { return -EINVAL; } @@ -756,7 +759,7 @@ static int read_f(BlockBackend *blk, int argc, char **a= rgv) sflag =3D true; pattern_offset =3D cvtnum(optarg); if (pattern_offset < 0) { - print_cvtnum_err(pattern_offset, optarg); + set_cvtnum_err(pattern_offset, optarg, errp); return pattern_offset; } break; @@ -776,18 +779,18 @@ static int read_f(BlockBackend *blk, int argc, char *= *argv) =20 offset =3D cvtnum(argv[optind]); if (offset < 0) { - print_cvtnum_err(offset, argv[optind]); + set_cvtnum_err(offset, argv[optind], errp); return offset; } =20 optind++; count =3D cvtnum(argv[optind]); if (count < 0) { - print_cvtnum_err(count, argv[optind]); + set_cvtnum_err(count, argv[optind], errp); return count; } else if (count > BDRV_REQUEST_MAX_BYTES) { - printf("length cannot exceed %" PRIu64 ", given %s\n", - (uint64_t)BDRV_REQUEST_MAX_BYTES, argv[optind]); + error_setg(errp, "length cannot exceed %" PRIu64 ", given %s", + (uint64_t)BDRV_REQUEST_MAX_BYTES, argv[optind]); return -EINVAL; } =20 @@ -801,24 +804,26 @@ static int read_f(BlockBackend *blk, int argc, char *= *argv) } =20 if ((pattern_count < 0) || (pattern_count + pattern_offset > count)) { - printf("pattern verification range exceeds end of read data\n"); + error_setg(errp, "pattern verification range exceeds end of read d= ata"); return -EINVAL; } =20 if (bflag) { if (!QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE)) { - printf("%" PRId64 " is not a sector-aligned value for 'offset'= \n", - offset); + error_setg(errp, + "%" PRId64 " is not a sector-aligned value for 'off= set'", + offset); return -EINVAL; } if (!QEMU_IS_ALIGNED(count, BDRV_SECTOR_SIZE)) { - printf("%"PRId64" is not a sector-aligned value for 'count'\n", - count); + error_setg(errp, + "%" PRId64 " is not a sector-aligned value for 'cou= nt'", + count); return -EINVAL; } if (flags & BDRV_REQ_REGISTERED_BUF) { - printf("I/O buffer registration is not supported when reading " - "from vmstate\n"); + error_setg(errp, "I/O buffer registration is not supported whe= n" + " reading from vmstate"); return -EINVAL; } } @@ -834,7 +839,7 @@ static int read_f(BlockBackend *blk, int argc, char **a= rgv) clock_gettime(CLOCK_MONOTONIC, &t2); =20 if (ret < 0) { - printf("read failed: %s\n", strerror(-ret)); + error_setg(errp, "read failed: %s", strerror(-ret)); goto out; } cnt =3D ret; @@ -845,9 +850,9 @@ static int read_f(BlockBackend *blk, int argc, char **a= rgv) void *cmp_buf =3D g_malloc(pattern_count); memset(cmp_buf, pattern, pattern_count); if (memcmp(buf + pattern_offset, cmp_buf, pattern_count)) { - printf("Pattern verification failed at offset %" - PRId64 ", %"PRId64" bytes\n", - offset + pattern_offset, pattern_count); + error_setg(errp, "Pattern verification failed at offset %" + PRId64 ", %" PRId64 " bytes", + offset + pattern_offset, pattern_count); ret =3D -EINVAL; } g_free(cmp_buf); @@ -890,7 +895,7 @@ static void readv_help(void) "\n"); } =20 -static int readv_f(BlockBackend *blk, int argc, char **argv); +static int readv_f(BlockBackend *blk, int argc, char **argv, Error **errp); =20 static const cmdinfo_t readv_cmd =3D { .name =3D "readv", @@ -902,7 +907,7 @@ static const cmdinfo_t readv_cmd =3D { .help =3D readv_help, }; =20 -static int readv_f(BlockBackend *blk, int argc, char **argv) +static int readv_f(BlockBackend *blk, int argc, char **argv, Error **errp) { struct timespec t1, t2; bool Cflag =3D false, qflag =3D false, vflag =3D false; @@ -924,7 +929,7 @@ static int readv_f(BlockBackend *blk, int argc, char **= argv) break; case 'P': Pflag =3D true; - pattern =3D parse_pattern(optarg); + pattern =3D parse_pattern(optarg, errp); if (pattern < 0) { return -EINVAL; } @@ -952,14 +957,14 @@ static int readv_f(BlockBackend *blk, int argc, char = **argv) =20 offset =3D cvtnum(argv[optind]); if (offset < 0) { - print_cvtnum_err(offset, argv[optind]); + set_cvtnum_err(offset, argv[optind], errp); return offset; } optind++; =20 nr_iov =3D argc - optind; buf =3D create_iovec(blk, &qiov, &argv[optind], nr_iov, 0xab, - flags & BDRV_REQ_REGISTERED_BUF); + flags & BDRV_REQ_REGISTERED_BUF, errp); if (buf =3D=3D NULL) { return -EINVAL; } @@ -969,7 +974,7 @@ static int readv_f(BlockBackend *blk, int argc, char **= argv) clock_gettime(CLOCK_MONOTONIC, &t2); =20 if (ret < 0) { - printf("readv failed: %s\n", strerror(-ret)); + error_setg(errp, "readv failed: %s", strerror(-ret)); goto out; } cnt =3D ret; @@ -980,8 +985,8 @@ static int readv_f(BlockBackend *blk, int argc, char **= argv) void *cmp_buf =3D g_malloc(qiov.size); memset(cmp_buf, pattern, qiov.size); if (memcmp(buf, cmp_buf, qiov.size)) { - printf("Pattern verification failed at offset %" - PRId64 ", %zu bytes\n", offset, qiov.size); + error_setg(errp, "Pattern verification failed at offset %" + PRId64 ", %zu bytes", offset, qiov.size); ret =3D -EINVAL; } g_free(cmp_buf); @@ -1031,7 +1036,7 @@ static void write_help(void) "\n"); } =20 -static int write_f(BlockBackend *blk, int argc, char **argv); +static int write_f(BlockBackend *blk, int argc, char **argv, Error **errp); =20 static const cmdinfo_t write_cmd =3D { .name =3D "write", @@ -1045,7 +1050,7 @@ static const cmdinfo_t write_cmd =3D { .help =3D write_help, }; =20 -static int write_f(BlockBackend *blk, int argc, char **argv) +static int write_f(BlockBackend *blk, int argc, char **argv, Error **errp) { struct timespec t1, t2; bool Cflag =3D false, qflag =3D false, bflag =3D false; @@ -1082,7 +1087,7 @@ static int write_f(BlockBackend *blk, int argc, char = **argv) break; case 'P': Pflag =3D true; - pattern =3D parse_pattern(optarg); + pattern =3D parse_pattern(optarg, errp); if (pattern < 0) { return -EINVAL; } @@ -1115,72 +1120,78 @@ static int write_f(BlockBackend *blk, int argc, cha= r **argv) } =20 if (bflag && zflag) { - printf("-b and -z cannot be specified at the same time\n"); + error_setg(errp, "-b and -z cannot be specified at the same time"); return -EINVAL; } =20 if ((flags & BDRV_REQ_FUA) && (bflag || cflag)) { - printf("-f and -b or -c cannot be specified at the same time\n"); + error_setg(errp, + "-f and -b or -c cannot be specified at the same time"); return -EINVAL; } =20 if ((flags & BDRV_REQ_NO_FALLBACK) && !zflag) { - printf("-n requires -z to be specified\n"); + error_setg(errp, "-n requires -z to be specified"); return -EINVAL; } =20 if ((flags & BDRV_REQ_MAY_UNMAP) && !zflag) { - printf("-u requires -z to be specified\n"); + error_setg(errp, "-u requires -z to be specified"); return -EINVAL; } =20 if (zflag + Pflag + sflag > 1) { - printf("Only one of -z, -P, and -s " - "can be specified at the same time\n"); + error_setg(errp, "Only one of -z, -P, and -s " + "can be specified at the same time"); return -EINVAL; } =20 offset =3D cvtnum(argv[optind]); if (offset < 0) { - print_cvtnum_err(offset, argv[optind]); + set_cvtnum_err(offset, argv[optind], errp); return offset; } =20 optind++; count =3D cvtnum(argv[optind]); if (count < 0) { - print_cvtnum_err(count, argv[optind]); + set_cvtnum_err(count, argv[optind], errp); return count; } else if (count > BDRV_REQUEST_MAX_BYTES && !(flags & BDRV_REQ_NO_FALLBACK)) { - printf("length cannot exceed %" PRIu64 " without -n, given %s\n", - (uint64_t)BDRV_REQUEST_MAX_BYTES, argv[optind]); + error_setg(errp, + "length cannot exceed %" PRIu64 " without -n, given %s", + (uint64_t)BDRV_REQUEST_MAX_BYTES, argv[optind]); return -EINVAL; } =20 if (bflag || cflag) { if (!QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE)) { - printf("%" PRId64 " is not a sector-aligned value for 'offset'= \n", - offset); + error_setg(errp, + "%" PRId64 " is not a sector-aligned value for 'off= set'", + offset); return -EINVAL; } =20 if (!QEMU_IS_ALIGNED(count, BDRV_SECTOR_SIZE)) { - printf("%"PRId64" is not a sector-aligned value for 'count'\n", - count); + error_setg(errp, + "%" PRId64 " is not a sector-aligned value for 'cou= nt'", + count); return -EINVAL; } } =20 if (zflag) { if (flags & BDRV_REQ_REGISTERED_BUF) { - printf("cannot combine zero write with registered I/O buffer\n= "); + error_setg(errp, + "cannot combine zero write with registered I/O buff= er"); return -EINVAL; } } else { if (sflag) { buf =3D qemu_io_alloc_from_file(blk, count, file_name, - flags & BDRV_REQ_REGISTERED_BUF); + flags & BDRV_REQ_REGISTERED_BUF, + errp); if (!buf) { return -EINVAL; } @@ -1203,7 +1214,7 @@ static int write_f(BlockBackend *blk, int argc, char = **argv) clock_gettime(CLOCK_MONOTONIC, &t2); =20 if (ret < 0) { - printf("write failed: %s\n", strerror(-ret)); + error_setg(errp, "write failed: %s", strerror(-ret)); goto out; } cnt =3D ret; @@ -1245,7 +1256,7 @@ writev_help(void) "\n"); } =20 -static int writev_f(BlockBackend *blk, int argc, char **argv); +static int writev_f(BlockBackend *blk, int argc, char **argv, Error **errp= ); =20 static const cmdinfo_t writev_cmd =3D { .name =3D "writev", @@ -1258,7 +1269,7 @@ static const cmdinfo_t writev_cmd =3D { .help =3D writev_help, }; =20 -static int writev_f(BlockBackend *blk, int argc, char **argv) +static int writev_f(BlockBackend *blk, int argc, char **argv, Error **errp) { struct timespec t1, t2; bool Cflag =3D false, qflag =3D false; @@ -1287,7 +1298,7 @@ static int writev_f(BlockBackend *blk, int argc, char= **argv) flags |=3D BDRV_REQ_REGISTERED_BUF; break; case 'P': - pattern =3D parse_pattern(optarg); + pattern =3D parse_pattern(optarg, errp); if (pattern < 0) { return -EINVAL; } @@ -1305,14 +1316,14 @@ static int writev_f(BlockBackend *blk, int argc, ch= ar **argv) =20 offset =3D cvtnum(argv[optind]); if (offset < 0) { - print_cvtnum_err(offset, argv[optind]); + set_cvtnum_err(offset, argv[optind], errp); return offset; } optind++; =20 nr_iov =3D argc - optind; buf =3D create_iovec(blk, &qiov, &argv[optind], nr_iov, pattern, - flags & BDRV_REQ_REGISTERED_BUF); + flags & BDRV_REQ_REGISTERED_BUF, errp); if (buf =3D=3D NULL) { return -EINVAL; } @@ -1322,7 +1333,7 @@ static int writev_f(BlockBackend *blk, int argc, char= **argv) clock_gettime(CLOCK_MONOTONIC, &t2); =20 if (ret < 0) { - printf("writev failed: %s\n", strerror(-ret)); + error_setg(errp, "writev failed: %s", strerror(-ret)); goto out; } cnt =3D ret; @@ -1367,7 +1378,7 @@ static void aio_write_done(void *opaque, int ret) =20 =20 if (ret < 0) { - printf("aio_write failed: %s\n", strerror(-ret)); + error_report("aio_write failed: %s", strerror(-ret)); block_acct_failed(blk_get_stats(ctx->blk), &ctx->acct); goto out; } @@ -1399,7 +1410,7 @@ static void aio_read_done(void *opaque, int ret) clock_gettime(CLOCK_MONOTONIC, &t2); =20 if (ret < 0) { - printf("readv failed: %s\n", strerror(-ret)); + error_report("readv failed: %s", strerror(-ret)); block_acct_failed(blk_get_stats(ctx->blk), &ctx->acct); goto out; } @@ -1409,8 +1420,8 @@ static void aio_read_done(void *opaque, int ret) =20 memset(cmp_buf, ctx->pattern, ctx->qiov.size); if (memcmp(ctx->buf, cmp_buf, ctx->qiov.size)) { - printf("Pattern verification failed at offset %" - PRId64 ", %zu bytes\n", ctx->offset, ctx->qiov.size); + error_report("Pattern verification failed at offset %" + PRId64 ", %zu bytes", ctx->offset, ctx->qiov.size= ); } g_free(cmp_buf); } @@ -1461,7 +1472,7 @@ static void aio_read_help(void) "\n"); } =20 -static int aio_read_f(BlockBackend *blk, int argc, char **argv); +static int aio_read_f(BlockBackend *blk, int argc, char **argv, Error **er= rp); =20 static const cmdinfo_t aio_read_cmd =3D { .name =3D "aio_read", @@ -1473,7 +1484,7 @@ static const cmdinfo_t aio_read_cmd =3D { .help =3D aio_read_help, }; =20 -static int aio_read_f(BlockBackend *blk, int argc, char **argv) +static int aio_read_f(BlockBackend *blk, int argc, char **argv, Error **er= rp) { int nr_iov, c; struct aio_ctx *ctx =3D g_new0(struct aio_ctx, 1); @@ -1486,7 +1497,7 @@ static int aio_read_f(BlockBackend *blk, int argc, ch= ar **argv) break; case 'P': ctx->Pflag =3D true; - ctx->pattern =3D parse_pattern(optarg); + ctx->pattern =3D parse_pattern(optarg, errp); if (ctx->pattern < 0) { g_free(ctx); return -EINVAL; @@ -1522,7 +1533,7 @@ static int aio_read_f(BlockBackend *blk, int argc, ch= ar **argv) ctx->offset =3D cvtnum(argv[optind]); if (ctx->offset < 0) { int ret =3D ctx->offset; - print_cvtnum_err(ret, argv[optind]); + set_cvtnum_err(ret, argv[optind], errp); g_free(ctx); return ret; } @@ -1530,7 +1541,7 @@ static int aio_read_f(BlockBackend *blk, int argc, ch= ar **argv) =20 nr_iov =3D argc - optind; ctx->buf =3D create_iovec(blk, &ctx->qiov, &argv[optind], nr_iov, 0xab, - ctx->flags & BDRV_REQ_REGISTERED_BUF); + ctx->flags & BDRV_REQ_REGISTERED_BUF, errp); if (ctx->buf =3D=3D NULL) { block_acct_invalid(blk_get_stats(blk), BLOCK_ACCT_READ); g_free(ctx); @@ -1573,7 +1584,7 @@ static void aio_write_help(void) "\n"); } =20 -static int aio_write_f(BlockBackend *blk, int argc, char **argv); +static int aio_write_f(BlockBackend *blk, int argc, char **argv, Error **e= rrp); =20 static const cmdinfo_t aio_write_cmd =3D { .name =3D "aio_write", @@ -1586,7 +1597,7 @@ static const cmdinfo_t aio_write_cmd =3D { .help =3D aio_write_help, }; =20 -static int aio_write_f(BlockBackend *blk, int argc, char **argv) +static int aio_write_f(BlockBackend *blk, int argc, char **argv, Error **e= rrp) { int nr_iov, c; int pattern =3D 0xcd; @@ -1611,7 +1622,7 @@ static int aio_write_f(BlockBackend *blk, int argc, c= har **argv) ctx->flags |=3D BDRV_REQ_MAY_UNMAP; break; case 'P': - pattern =3D parse_pattern(optarg); + pattern =3D parse_pattern(optarg, errp); if (pattern < 0) { g_free(ctx); return -EINVAL; @@ -1639,25 +1650,26 @@ static int aio_write_f(BlockBackend *blk, int argc,= char **argv) } =20 if (ctx->zflag && optind !=3D argc - 2) { - printf("-z supports only a single length parameter\n"); + error_setg(errp, "-z supports only a single length parameter"); g_free(ctx); return -EINVAL; } =20 if ((ctx->flags & BDRV_REQ_MAY_UNMAP) && !ctx->zflag) { - printf("-u requires -z to be specified\n"); + error_setg(errp, "-u requires -z to be specified"); g_free(ctx); return -EINVAL; } =20 if (ctx->zflag && ctx->Pflag) { - printf("-z and -P cannot be specified at the same time\n"); + error_setg(errp, "-z and -P cannot be specified at the same time"); g_free(ctx); return -EINVAL; } =20 if (ctx->zflag && (ctx->flags & BDRV_REQ_REGISTERED_BUF)) { - printf("cannot combine zero write with registered I/O buffer\n"); + error_setg(errp, + "cannot combine zero write with registered I/O buffer"); g_free(ctx); return -EINVAL; } @@ -1665,7 +1677,7 @@ static int aio_write_f(BlockBackend *blk, int argc, c= har **argv) ctx->offset =3D cvtnum(argv[optind]); if (ctx->offset < 0) { int ret =3D ctx->offset; - print_cvtnum_err(ret, argv[optind]); + set_cvtnum_err(ret, argv[optind], errp); g_free(ctx); return ret; } @@ -1674,7 +1686,7 @@ static int aio_write_f(BlockBackend *blk, int argc, c= har **argv) if (ctx->zflag) { int64_t count =3D cvtnum(argv[optind]); if (count < 0) { - print_cvtnum_err(count, argv[optind]); + set_cvtnum_err(count, argv[optind], errp); g_free(ctx); return count; } @@ -1685,7 +1697,8 @@ static int aio_write_f(BlockBackend *blk, int argc, c= har **argv) } else { nr_iov =3D argc - optind; ctx->buf =3D create_iovec(blk, &ctx->qiov, &argv[optind], nr_iov, - pattern, ctx->flags & BDRV_REQ_REGISTERED_= BUF); + pattern, + ctx->flags & BDRV_REQ_REGISTERED_BUF, errp= ); if (ctx->buf =3D=3D NULL) { block_acct_invalid(blk_get_stats(blk), BLOCK_ACCT_WRITE); g_free(ctx); @@ -1703,7 +1716,7 @@ static int aio_write_f(BlockBackend *blk, int argc, c= har **argv) return 0; } =20 -static int aio_flush_f(BlockBackend *blk, int argc, char **argv) +static int aio_flush_f(BlockBackend *blk, int argc, char **argv, Error **e= rrp) { BlockAcctCookie cookie; block_acct_start(blk_get_stats(blk), &cookie, 0, BLOCK_ACCT_FLUSH); @@ -1718,7 +1731,7 @@ static const cmdinfo_t aio_flush_cmd =3D { .oneline =3D "completes all outstanding aio requests" }; =20 -static int flush_f(BlockBackend *blk, int argc, char **argv) +static int flush_f(BlockBackend *blk, int argc, char **argv, Error **errp) { return blk_flush(blk); } @@ -1735,7 +1748,7 @@ static inline int64_t tosector(int64_t bytes) return bytes >> BDRV_SECTOR_BITS; } =20 -static int zone_report_f(BlockBackend *blk, int argc, char **argv) +static int zone_report_f(BlockBackend *blk, int argc, char **argv, Error *= *errp) { int ret; int64_t offset; @@ -1745,17 +1758,17 @@ static int zone_report_f(BlockBackend *blk, int arg= c, char **argv) ++optind; offset =3D cvtnum(argv[optind]); if (offset < 0) { - print_cvtnum_err(offset, argv[optind]); + set_cvtnum_err(offset, argv[optind], errp); return offset; } ++optind; val =3D cvtnum(argv[optind]); if (val < 0) { - print_cvtnum_err(val, argv[optind]); + set_cvtnum_err(val, argv[optind], errp); return val; } if (val > UINT_MAX) { - printf("Number of zones must be less than 2^32\n"); + error_setg(errp, "Number of zones must be less than 2^32"); return -ERANGE; } nr_zones =3D val; @@ -1764,7 +1777,7 @@ static int zone_report_f(BlockBackend *blk, int argc,= char **argv) zones =3D g_new(BlockZoneDescriptor, nr_zones); ret =3D blk_zone_report(blk, offset, &nr_zones, zones); if (ret < 0) { - printf("zone report failed: %s\n", strerror(-ret)); + error_setg(errp, "zone report failed: %s", strerror(-ret)); } else { for (int i =3D 0; i < nr_zones; ++i) { printf("start: 0x%" PRIx64 ", len 0x%" PRIx64 ", " @@ -1788,25 +1801,25 @@ static const cmdinfo_t zone_report_cmd =3D { .oneline =3D "report zone information", }; =20 -static int zone_open_f(BlockBackend *blk, int argc, char **argv) +static int zone_open_f(BlockBackend *blk, int argc, char **argv, Error **e= rrp) { int ret; int64_t offset, len; ++optind; offset =3D cvtnum(argv[optind]); if (offset < 0) { - print_cvtnum_err(offset, argv[optind]); + set_cvtnum_err(offset, argv[optind], errp); return offset; } ++optind; len =3D cvtnum(argv[optind]); if (len < 0) { - print_cvtnum_err(len, argv[optind]); + set_cvtnum_err(len, argv[optind], errp); return len; } ret =3D blk_zone_mgmt(blk, BLK_ZO_OPEN, offset, len); if (ret < 0) { - printf("zone open failed: %s\n", strerror(-ret)); + error_setg(errp, "zone open failed: %s", strerror(-ret)); } return ret; } @@ -1821,25 +1834,25 @@ static const cmdinfo_t zone_open_cmd =3D { .oneline =3D "explicit open a range of zones in zone block device", }; =20 -static int zone_close_f(BlockBackend *blk, int argc, char **argv) +static int zone_close_f(BlockBackend *blk, int argc, char **argv, Error **= errp) { int ret; int64_t offset, len; ++optind; offset =3D cvtnum(argv[optind]); if (offset < 0) { - print_cvtnum_err(offset, argv[optind]); + set_cvtnum_err(offset, argv[optind], errp); return offset; } ++optind; len =3D cvtnum(argv[optind]); if (len < 0) { - print_cvtnum_err(len, argv[optind]); + set_cvtnum_err(len, argv[optind], errp); return len; } ret =3D blk_zone_mgmt(blk, BLK_ZO_CLOSE, offset, len); if (ret < 0) { - printf("zone close failed: %s\n", strerror(-ret)); + error_setg(errp, "zone close failed: %s", strerror(-ret)); } return ret; } @@ -1854,25 +1867,25 @@ static const cmdinfo_t zone_close_cmd =3D { .oneline =3D "close a range of zones in zone block device", }; =20 -static int zone_finish_f(BlockBackend *blk, int argc, char **argv) +static int zone_finish_f(BlockBackend *blk, int argc, char **argv, Error *= *errp) { int ret; int64_t offset, len; ++optind; offset =3D cvtnum(argv[optind]); if (offset < 0) { - print_cvtnum_err(offset, argv[optind]); + set_cvtnum_err(offset, argv[optind], errp); return offset; } ++optind; len =3D cvtnum(argv[optind]); if (len < 0) { - print_cvtnum_err(len, argv[optind]); + set_cvtnum_err(len, argv[optind], errp); return len; } ret =3D blk_zone_mgmt(blk, BLK_ZO_FINISH, offset, len); if (ret < 0) { - printf("zone finish failed: %s\n", strerror(-ret)); + error_setg(errp, "zone finish failed: %s", strerror(-ret)); } return ret; } @@ -1887,25 +1900,25 @@ static const cmdinfo_t zone_finish_cmd =3D { .oneline =3D "finish a range of zones in zone block device", }; =20 -static int zone_reset_f(BlockBackend *blk, int argc, char **argv) +static int zone_reset_f(BlockBackend *blk, int argc, char **argv, Error **= errp) { int ret; int64_t offset, len; ++optind; offset =3D cvtnum(argv[optind]); if (offset < 0) { - print_cvtnum_err(offset, argv[optind]); + set_cvtnum_err(offset, argv[optind], errp); return offset; } ++optind; len =3D cvtnum(argv[optind]); if (len < 0) { - print_cvtnum_err(len, argv[optind]); + set_cvtnum_err(len, argv[optind], errp); return len; } ret =3D blk_zone_mgmt(blk, BLK_ZO_RESET, offset, len); if (ret < 0) { - printf("zone reset failed: %s\n", strerror(-ret)); + error_setg(errp, "zone reset failed: %s", strerror(-ret)); } return ret; } @@ -1934,7 +1947,7 @@ static int do_aio_zone_append(BlockBackend *blk, QEMU= IOVector *qiov, return async_ret < 0 ? async_ret : 1; } =20 -static int zone_append_f(BlockBackend *blk, int argc, char **argv) +static int zone_append_f(BlockBackend *blk, int argc, char **argv, Error *= *errp) { int ret; bool pflag =3D false; @@ -1956,19 +1969,19 @@ static int zone_append_f(BlockBackend *blk, int arg= c, char **argv) =20 offset =3D cvtnum(argv[optind]); if (offset < 0) { - print_cvtnum_err(offset, argv[optind]); + set_cvtnum_err(offset, argv[optind], errp); return offset; } optind++; nr_iov =3D argc - optind; buf =3D create_iovec(blk, &qiov, &argv[optind], nr_iov, pattern, - flags & BDRV_REQ_REGISTERED_BUF); + flags & BDRV_REQ_REGISTERED_BUF, errp); if (buf =3D=3D NULL) { return -EINVAL; } ret =3D do_aio_zone_append(blk, &qiov, &offset, flags, &total); if (ret < 0) { - printf("zone append failed: %s\n", strerror(-ret)); + error_setg(errp, "zone append failed: %s", strerror(-ret)); goto out; } =20 @@ -1994,7 +2007,7 @@ static const cmdinfo_t zone_append_cmd =3D { .oneline =3D "append write a number of bytes at a specified offset", }; =20 -static int truncate_f(BlockBackend *blk, int argc, char **argv); +static int truncate_f(BlockBackend *blk, int argc, char **argv, Error **er= rp); static const cmdinfo_t truncate_cmd =3D { .name =3D "truncate", .altname =3D "t", @@ -2006,9 +2019,8 @@ static const cmdinfo_t truncate_cmd =3D { .oneline =3D "truncates the current file at the given offset", }; =20 -static int truncate_f(BlockBackend *blk, int argc, char **argv) +static int truncate_f(BlockBackend *blk, int argc, char **argv, Error **er= rp) { - Error *local_err =3D NULL; int64_t offset; int c, ret; PreallocMode prealloc =3D PREALLOC_MODE_OFF; @@ -2019,7 +2031,7 @@ static int truncate_f(BlockBackend *blk, int argc, ch= ar **argv) prealloc =3D qapi_enum_parse(&PreallocMode_lookup, optarg, PREALLOC_MODE__MAX, NULL); if (prealloc =3D=3D PREALLOC_MODE__MAX) { - error_report("Invalid preallocation mode '%s'", optarg); + error_setg(errp, "Invalid preallocation mode '%s'", optarg= ); return -EINVAL; } break; @@ -2031,7 +2043,7 @@ static int truncate_f(BlockBackend *blk, int argc, ch= ar **argv) =20 offset =3D cvtnum(argv[optind]); if (offset < 0) { - print_cvtnum_err(offset, argv[1]); + set_cvtnum_err(offset, argv[1], errp); return offset; } =20 @@ -2040,23 +2052,22 @@ static int truncate_f(BlockBackend *blk, int argc, = char **argv) * exact=3Dtrue. It is better to err on the "emit more errors" side * than to be overly permissive. */ - ret =3D blk_truncate(blk, offset, false, prealloc, 0, &local_err); + ret =3D blk_truncate(blk, offset, false, prealloc, 0, errp); if (ret < 0) { - error_report_err(local_err); return ret; } =20 return 0; } =20 -static int length_f(BlockBackend *blk, int argc, char **argv) +static int length_f(BlockBackend *blk, int argc, char **argv, Error **errp) { int64_t size; char s1[64]; =20 size =3D blk_getlength(blk); if (size < 0) { - printf("getlength: %s\n", strerror(-size)); + error_setg(errp, "getlength: %s", strerror(-size)); return size; } =20 @@ -2074,12 +2085,12 @@ static const cmdinfo_t length_cmd =3D { }; =20 =20 -static int info_f(BlockBackend *blk, int argc, char **argv) +static int info_f(BlockBackend *blk, int argc, char **argv, Error **errp) { + ERRP_GUARD(); BlockDriverState *bs =3D blk_bs(blk); BlockDriverInfo bdi; ImageInfoSpecific *spec_info; - Error *local_err =3D NULL; char s1[64], s2[64]; int ret; =20 @@ -2104,9 +2115,8 @@ static int info_f(BlockBackend *blk, int argc, char *= *argv) printf("cluster size: %s\n", s1); printf("vm state offset: %s\n", s2); =20 - spec_info =3D bdrv_get_specific_info(bs, &local_err); - if (local_err) { - error_report_err(local_err); + spec_info =3D bdrv_get_specific_info(bs, errp); + if (*errp) { return -EIO; } if (spec_info) { @@ -2143,7 +2153,7 @@ static void discard_help(void) "\n"); } =20 -static int discard_f(BlockBackend *blk, int argc, char **argv); +static int discard_f(BlockBackend *blk, int argc, char **argv, Error **err= p); =20 static const cmdinfo_t discard_cmd =3D { .name =3D "discard", @@ -2157,7 +2167,7 @@ static const cmdinfo_t discard_cmd =3D { .help =3D discard_help, }; =20 -static int discard_f(BlockBackend *blk, int argc, char **argv) +static int discard_f(BlockBackend *blk, int argc, char **argv, Error **err= p) { struct timespec t1, t2; bool Cflag =3D false, qflag =3D false; @@ -2185,18 +2195,18 @@ static int discard_f(BlockBackend *blk, int argc, c= har **argv) =20 offset =3D cvtnum(argv[optind]); if (offset < 0) { - print_cvtnum_err(offset, argv[optind]); + set_cvtnum_err(offset, argv[optind], errp); return offset; } =20 optind++; bytes =3D cvtnum(argv[optind]); if (bytes < 0) { - print_cvtnum_err(bytes, argv[optind]); + set_cvtnum_err(bytes, argv[optind], errp); return bytes; } else if (bytes > BDRV_REQUEST_MAX_BYTES) { - printf("length cannot exceed %"PRIu64", given %s\n", - (uint64_t)BDRV_REQUEST_MAX_BYTES, argv[optind]); + error_setg(errp, "length cannot exceed %" PRIu64 ", given %s", + (uint64_t)BDRV_REQUEST_MAX_BYTES, argv[optind]); return -EINVAL; } =20 @@ -2205,7 +2215,7 @@ static int discard_f(BlockBackend *blk, int argc, cha= r **argv) clock_gettime(CLOCK_MONOTONIC, &t2); =20 if (ret < 0) { - printf("discard failed: %s\n", strerror(-ret)); + error_setg(errp, "discard failed: %s", strerror(-ret)); return ret; } =20 @@ -2238,7 +2248,8 @@ static void aio_discard_help(void) "\n"); } =20 -static int aio_discard_f(BlockBackend *blk, int argc, char **argv); +static int aio_discard_f(BlockBackend *blk, int argc, char **argv, + Error **errp); =20 static const cmdinfo_t aio_discard_cmd =3D { .name =3D "aio_discard", @@ -2259,7 +2270,7 @@ static void aio_discard_done(void *opaque, int ret) clock_gettime(CLOCK_MONOTONIC, &t2); =20 if (ret < 0) { - printf("aio_discard failed: %s\n", strerror(-ret)); + error_report("aio_discard failed: %s", strerror(-ret)); block_acct_failed(blk_get_stats(ctx->blk), &ctx->acct); goto out; } @@ -2278,7 +2289,7 @@ out: g_free(ctx); } =20 -static int aio_discard_f(BlockBackend *blk, int argc, char **argv) +static int aio_discard_f(BlockBackend *blk, int argc, char **argv, Error *= *errp) { int c, ret; int64_t count; @@ -2310,7 +2321,7 @@ static int aio_discard_f(BlockBackend *blk, int argc,= char **argv) ctx->offset =3D cvtnum(argv[optind]); if (ctx->offset < 0) { ret =3D ctx->offset; - print_cvtnum_err(ret, argv[optind]); + set_cvtnum_err(ret, argv[optind], errp); g_free(ctx); return ret; } @@ -2318,7 +2329,7 @@ static int aio_discard_f(BlockBackend *blk, int argc,= char **argv) =20 count =3D cvtnum(argv[optind]); if (count < 0) { - print_cvtnum_err(count, argv[optind]); + set_cvtnum_err(count, argv[optind], errp); g_free(ctx); return count; } @@ -2332,7 +2343,7 @@ static int aio_discard_f(BlockBackend *blk, int argc,= char **argv) return 0; } =20 -static int alloc_f(BlockBackend *blk, int argc, char **argv) +static int alloc_f(BlockBackend *blk, int argc, char **argv, Error **errp) { BlockDriverState *bs =3D blk_bs(blk); int64_t offset, start, remaining, count; @@ -2342,14 +2353,14 @@ static int alloc_f(BlockBackend *blk, int argc, cha= r **argv) =20 start =3D offset =3D cvtnum(argv[1]); if (offset < 0) { - print_cvtnum_err(offset, argv[1]); + set_cvtnum_err(offset, argv[1], errp); return offset; } =20 if (argc =3D=3D 3) { count =3D cvtnum(argv[2]); if (count < 0) { - print_cvtnum_err(count, argv[2]); + set_cvtnum_err(count, argv[2], errp); return count; } } else { @@ -2361,7 +2372,7 @@ static int alloc_f(BlockBackend *blk, int argc, char = **argv) while (remaining) { ret =3D bdrv_is_allocated(bs, offset, remaining, &num); if (ret < 0) { - printf("is_allocated failed: %s\n", strerror(-ret)); + error_setg(errp, "is_allocated failed: %s", strerror(-ret)); return ret; } offset +=3D num; @@ -2422,7 +2433,7 @@ static int map_is_allocated(BlockDriverState *bs, int= 64_t offset, return firstret; } =20 -static int map_f(BlockBackend *blk, int argc, char **argv) +static int map_f(BlockBackend *blk, int argc, char **argv, Error **errp) { int64_t offset, bytes; char s1[64], s2[64]; @@ -2433,17 +2444,18 @@ static int map_f(BlockBackend *blk, int argc, char = **argv) offset =3D 0; bytes =3D blk_getlength(blk); if (bytes < 0) { - error_report("Failed to query image length: %s", strerror(-bytes)); + error_setg(errp, "Failed to query image length: %s", strerror(-byt= es)); return bytes; } =20 while (bytes) { ret =3D map_is_allocated(blk_bs(blk), offset, bytes, &num); if (ret < 0) { - error_report("Failed to get allocation status: %s", strerror(-= ret)); + error_setg(errp, "Failed to get allocation status: %s", + strerror(-ret)); return ret; } else if (!num) { - error_report("Unexpected end of image"); + error_setg(errp, "Unexpected end of image"); return -EIO; } =20 @@ -2485,7 +2497,7 @@ static void reopen_help(void) "\n"); } =20 -static int reopen_f(BlockBackend *blk, int argc, char **argv); +static int reopen_f(BlockBackend *blk, int argc, char **argv, Error **errp= ); =20 static QemuOptsList reopen_opts =3D { .name =3D "reopen", @@ -2507,7 +2519,7 @@ static const cmdinfo_t reopen_cmd =3D { .help =3D reopen_help, }; =20 -static int reopen_f(BlockBackend *blk, int argc, char **argv) +static int reopen_f(BlockBackend *blk, int argc, char **argv, Error **errp) { BlockDriverState *bs =3D blk_bs(blk); QemuOpts *qopts; @@ -2517,13 +2529,12 @@ static int reopen_f(BlockBackend *blk, int argc, ch= ar **argv) bool writethrough =3D !blk_enable_write_cache(blk); bool has_rw_option =3D false; bool has_cache_option =3D false; - Error *local_err =3D NULL; =20 while ((c =3D getopt(argc, argv, "c:o:rw")) !=3D -1) { switch (c) { case 'c': if (bdrv_parse_cache_mode(optarg, &flags, &writethrough) < 0) { - error_report("Invalid cache option: %s", optarg); + error_setg(errp, "Invalid cache option: %s", optarg); return -EINVAL; } has_cache_option =3D true; @@ -2536,7 +2547,7 @@ static int reopen_f(BlockBackend *blk, int argc, char= **argv) break; case 'r': if (has_rw_option) { - error_report("Only one -r/-w option may be given"); + error_setg(errp, "Only one -r/-w option may be given"); return -EINVAL; } flags &=3D ~BDRV_O_RDWR; @@ -2544,7 +2555,7 @@ static int reopen_f(BlockBackend *blk, int argc, char= **argv) break; case 'w': if (has_rw_option) { - error_report("Only one -r/-w option may be given"); + error_setg(errp, "Only one -r/-w option may be given"); return -EINVAL; } flags |=3D BDRV_O_RDWR; @@ -2566,7 +2577,7 @@ static int reopen_f(BlockBackend *blk, int argc, char= **argv) if (!writethrough !=3D blk_enable_write_cache(blk) && blk_get_attached_dev(blk)) { - error_report("Cannot change cache.writeback: Device attached"); + error_setg(errp, "Cannot change cache.writeback: Device attached"); qemu_opts_reset(&reopen_opts); return -EBUSY; } @@ -2589,7 +2600,8 @@ static int reopen_f(BlockBackend *blk, int argc, char= **argv) =20 if (qdict_haskey(opts, BDRV_OPT_READ_ONLY)) { if (has_rw_option) { - error_report("Cannot set both -r/-w and '" BDRV_OPT_READ_ONLY = "'"); + error_setg(errp, + "Cannot set both -r/-w and '" BDRV_OPT_READ_ONLY "'= "); qobject_unref(opts); return -EINVAL; } @@ -2600,7 +2612,7 @@ static int reopen_f(BlockBackend *blk, int argc, char= **argv) if (qdict_haskey(opts, BDRV_OPT_CACHE_DIRECT) || qdict_haskey(opts, BDRV_OPT_CACHE_NO_FLUSH)) { if (has_cache_option) { - error_report("Cannot set both -c and the cache options"); + error_setg(errp, "Cannot set both -c and the cache options"); qobject_unref(opts); return -EINVAL; } @@ -2609,10 +2621,7 @@ static int reopen_f(BlockBackend *blk, int argc, cha= r **argv) qdict_put_bool(opts, BDRV_OPT_CACHE_NO_FLUSH, flags & BDRV_O_NO_FL= USH); } =20 - bdrv_reopen(bs, opts, true, &local_err); - - if (local_err) { - error_report_err(local_err); + if (bdrv_reopen(bs, opts, true, errp) < 0) { return -EINVAL; } =20 @@ -2620,26 +2629,28 @@ static int reopen_f(BlockBackend *blk, int argc, ch= ar **argv) return 0; } =20 -static int break_f(BlockBackend *blk, int argc, char **argv) +static int break_f(BlockBackend *blk, int argc, char **argv, Error **errp) { int ret; =20 ret =3D bdrv_debug_breakpoint(blk_bs(blk), argv[1], argv[2]); if (ret < 0) { - printf("Could not set breakpoint: %s\n", strerror(-ret)); + error_setg(errp, "Could not set breakpoint: %s", strerror(-ret)); return ret; } =20 return 0; } =20 -static int remove_break_f(BlockBackend *blk, int argc, char **argv) +static int remove_break_f(BlockBackend *blk, int argc, char **argv, + Error **errp) { int ret; =20 ret =3D bdrv_debug_remove_breakpoint(blk_bs(blk), argv[1]); if (ret < 0) { - printf("Could not remove breakpoint %s: %s\n", argv[1], strerror(-= ret)); + error_setg(errp, "Could not remove breakpoint %s: %s", + argv[1], strerror(-ret)); return ret; } =20 @@ -2665,13 +2676,13 @@ static const cmdinfo_t remove_break_cmd =3D { .oneline =3D "remove a breakpoint by tag", }; =20 -static int resume_f(BlockBackend *blk, int argc, char **argv) +static int resume_f(BlockBackend *blk, int argc, char **argv, Error **errp) { int ret; =20 ret =3D bdrv_debug_resume(blk_bs(blk), argv[1]); if (ret < 0) { - printf("Could not resume request: %s\n", strerror(-ret)); + error_setg(errp, "Could not resume request: %s", strerror(-ret)); return ret; } =20 @@ -2687,7 +2698,7 @@ static const cmdinfo_t resume_cmd =3D { .oneline =3D "resumes the request tagged as tag", }; =20 -static int wait_break_f(BlockBackend *blk, int argc, char **argv) +static int wait_break_f(BlockBackend *blk, int argc, char **argv, Error **= errp) { while (!bdrv_debug_is_suspended(blk_bs(blk), argv[1])) { aio_poll(blk_get_aio_context(blk), true); @@ -2704,7 +2715,7 @@ static const cmdinfo_t wait_break_cmd =3D { .oneline =3D "waits for the suspension of a request", }; =20 -static int abort_f(BlockBackend *blk, int argc, char **argv) +static int abort_f(BlockBackend *blk, int argc, char **argv, Error **errp) { abort(); } @@ -2730,7 +2741,7 @@ static void sigraise_help(void) "\n", SIGTERM); } =20 -static int sigraise_f(BlockBackend *blk, int argc, char **argv); +static int sigraise_f(BlockBackend *blk, int argc, char **argv, Error **er= rp); =20 static const cmdinfo_t sigraise_cmd =3D { .name =3D "sigraise", @@ -2743,15 +2754,16 @@ static const cmdinfo_t sigraise_cmd =3D { .help =3D sigraise_help, }; =20 -static int sigraise_f(BlockBackend *blk, int argc, char **argv) +static int sigraise_f(BlockBackend *blk, int argc, char **argv, Error **er= rp) { int64_t sig =3D cvtnum(argv[1]); if (sig < 0) { - print_cvtnum_err(sig, argv[1]); + set_cvtnum_err(sig, argv[1], errp); return sig; } else if (sig > NSIG) { - printf("signal argument '%s' is too large to be a valid signal\n", - argv[1]); + error_setg(errp, + "signal argument '%s' is too large to be a valid signal= ", + argv[1]); return -EINVAL; } =20 @@ -2772,7 +2784,7 @@ static void sleep_cb(void *opaque) *expired =3D true; } =20 -static int sleep_f(BlockBackend *blk, int argc, char **argv) +static int sleep_f(BlockBackend *blk, int argc, char **argv, Error **errp) { char *endptr; long ms; @@ -2781,7 +2793,7 @@ static int sleep_f(BlockBackend *blk, int argc, char = **argv) =20 ms =3D strtol(argv[1], &endptr, 0); if (ms < 0 || *endptr !=3D '\0') { - printf("%s is not a valid number\n", argv[1]); + error_setg(errp, "%s is not a valid number", argv[1]); return -EINVAL; } =20 @@ -2833,7 +2845,7 @@ static void help_all(void) printf("\nUse 'help commandname' for extended help.\n"); } =20 -static int help_f(BlockBackend *blk, int argc, char **argv) +static int help_f(BlockBackend *blk, int argc, char **argv, Error **errp) { const cmdinfo_t *ct; =20 @@ -2844,7 +2856,7 @@ static int help_f(BlockBackend *blk, int argc, char *= *argv) =20 ct =3D find_command(argv[1]); if (ct =3D=3D NULL) { - printf("command %s not found\n", argv[1]); + error_setg(errp, "command %s not found", argv[1]); return -EINVAL; } =20 @@ -2867,7 +2879,7 @@ static const cmdinfo_t help_cmd =3D { * Called with aio context of blk acquired. Or with qemu_get_aio_context() * context acquired if blk is NULL. */ -int qemuio_command(BlockBackend *blk, const char *cmd) +int qemuio_command(BlockBackend *blk, const char *cmd, Error **errp) { char *input; const cmdinfo_t *ct; @@ -2880,9 +2892,9 @@ int qemuio_command(BlockBackend *blk, const char *cmd) if (c) { ct =3D find_command(v[0]); if (ct) { - ret =3D command(blk, ct, c, v); + ret =3D command(blk, ct, c, v, errp); } else { - fprintf(stderr, "command \"%s\" not found\n", v[0]); + error_setg(errp, "command \"%s\" not found", v[0]); ret =3D -EINVAL; } } diff --git a/qemu-io.c b/qemu-io.c index 8f2de83f3c8..598d5b1c9ca 100644 --- a/qemu-io.c +++ b/qemu-io.c @@ -68,7 +68,7 @@ static int get_eof_char(void) #endif } =20 -static int close_f(BlockBackend *blk, int argc, char **argv) +static int close_f(BlockBackend *blk, int argc, char **argv, Error **errp) { blk_unref(qemuio_blk); qemuio_blk =3D NULL; @@ -140,7 +140,7 @@ static void open_help(void) "\n"); } =20 -static int open_f(BlockBackend *blk, int argc, char **argv); +static int open_f(BlockBackend *blk, int argc, char **argv, Error **errp); =20 static const cmdinfo_t open_cmd =3D { .name =3D "open", @@ -164,7 +164,7 @@ static QemuOptsList empty_opts =3D { }, }; =20 -static int open_f(BlockBackend *blk, int argc, char **argv) +static int open_f(BlockBackend *blk, int argc, char **argv, Error **errp) { int flags =3D BDRV_O_UNMAP; int readonly =3D 0; @@ -268,7 +268,7 @@ static int open_f(BlockBackend *blk, int argc, char **a= rgv) return 0; } =20 -static int quit_f(BlockBackend *blk, int argc, char **argv) +static int quit_f(BlockBackend *blk, int argc, char **argv, Error **errp) { quit_qemu_io =3D true; return 0; @@ -414,7 +414,14 @@ static void prep_fetchline(void *opaque) =20 static int do_qemuio_command(const char *cmd) { - return qemuio_command(qemuio_blk, cmd); + Error *local_err =3D NULL; + int ret; + + ret =3D qemuio_command(qemuio_blk, cmd, &local_err); + if (local_err) { + error_report_err(local_err); + } + return ret; } =20 static int command_loop(void) diff --git a/tests/qemu-iotests/004.out b/tests/qemu-iotests/004.out index fb8593289f5..37da6024809 100644 --- a/tests/qemu-iotests/004.out +++ b/tests/qemu-iotests/004.out @@ -6,36 +6,36 @@ wrote 1048576/1048576 bytes at offset 133169152 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 write into image boundary -write failed: Input/output error +qemu-io: write failed: Input/output error =20 write at image boundary -write failed: Input/output error +qemu-io: write failed: Input/output error =20 write past image boundary -write failed: Input/output error +qemu-io: write failed: Input/output error =20 pwrite past image boundary -write failed: Input/output error +qemu-io: write failed: Input/output error =20 writev past image boundary -writev failed: Input/output error +qemu-io: writev failed: Input/output error =20 read before image boundary read 1048576/1048576 bytes at offset 133169152 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 read into image boundary -read failed: Input/output error +qemu-io: read failed: Input/output error =20 read at image boundary -read failed: Input/output error +qemu-io: read failed: Input/output error =20 read past image boundary -read failed: Input/output error +qemu-io: read failed: Input/output error =20 pread past image boundary -read failed: Input/output error +qemu-io: read failed: Input/output error =20 readv past image boundary -readv failed: Input/output error +qemu-io: readv failed: Input/output error *** done diff --git a/tests/qemu-iotests/021.out b/tests/qemu-iotests/021.out index 8533f8e58ae..dfdfeb50378 100644 --- a/tests/qemu-iotests/021.out +++ b/tests/qemu-iotests/021.out @@ -2,92 +2,92 @@ QA output created by 021 Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D134217728 =20 =3D=3D testing writev -P -1 =3D=3D --1 is not a valid pattern byte +qemu-io: -1 is not a valid pattern byte =20 =3D=3D testing read -P -1 =3D=3D --1 is not a valid pattern byte +qemu-io: -1 is not a valid pattern byte =20 =3D=3D testing write -P -1 =3D=3D --1 is not a valid pattern byte +qemu-io: -1 is not a valid pattern byte =20 =3D=3D testing readv -P -1 =3D=3D --1 is not a valid pattern byte +qemu-io: -1 is not a valid pattern byte =20 =3D=3D testing aio_read -P -1 =3D=3D --1 is not a valid pattern byte +qemu-io: -1 is not a valid pattern byte =20 =3D=3D testing aio_write -P -1 =3D=3D --1 is not a valid pattern byte +qemu-io: -1 is not a valid pattern byte =20 =3D=3D testing writev -P 300 =3D=3D -300 is not a valid pattern byte +qemu-io: 300 is not a valid pattern byte =20 =3D=3D testing read -P 300 =3D=3D -300 is not a valid pattern byte +qemu-io: 300 is not a valid pattern byte =20 =3D=3D testing write -P 300 =3D=3D -300 is not a valid pattern byte +qemu-io: 300 is not a valid pattern byte =20 =3D=3D testing readv -P 300 =3D=3D -300 is not a valid pattern byte +qemu-io: 300 is not a valid pattern byte =20 =3D=3D testing aio_read -P 300 =3D=3D -300 is not a valid pattern byte +qemu-io: 300 is not a valid pattern byte =20 =3D=3D testing aio_write -P 300 =3D=3D -300 is not a valid pattern byte +qemu-io: 300 is not a valid pattern byte =20 =3D=3D testing writev -P 12m =3D=3D -12m is not a valid pattern byte +qemu-io: 12m is not a valid pattern byte =20 =3D=3D testing read -P 12m =3D=3D -12m is not a valid pattern byte +qemu-io: 12m is not a valid pattern byte =20 =3D=3D testing write -P 12m =3D=3D -12m is not a valid pattern byte +qemu-io: 12m is not a valid pattern byte =20 =3D=3D testing readv -P 12m =3D=3D -12m is not a valid pattern byte +qemu-io: 12m is not a valid pattern byte =20 =3D=3D testing aio_read -P 12m =3D=3D -12m is not a valid pattern byte +qemu-io: 12m is not a valid pattern byte =20 =3D=3D testing aio_write -P 12m =3D=3D -12m is not a valid pattern byte +qemu-io: 12m is not a valid pattern byte =20 =3D=3D testing writev -P 4k =3D=3D -4k is not a valid pattern byte +qemu-io: 4k is not a valid pattern byte =20 =3D=3D testing read -P 4k =3D=3D -4k is not a valid pattern byte +qemu-io: 4k is not a valid pattern byte =20 =3D=3D testing write -P 4k =3D=3D -4k is not a valid pattern byte +qemu-io: 4k is not a valid pattern byte =20 =3D=3D testing readv -P 4k =3D=3D -4k is not a valid pattern byte +qemu-io: 4k is not a valid pattern byte =20 =3D=3D testing aio_read -P 4k =3D=3D -4k is not a valid pattern byte +qemu-io: 4k is not a valid pattern byte =20 =3D=3D testing aio_write -P 4k =3D=3D -4k is not a valid pattern byte +qemu-io: 4k is not a valid pattern byte =20 =3D=3D testing writev -P route66 =3D=3D -route66 is not a valid pattern byte +qemu-io: route66 is not a valid pattern byte =20 =3D=3D testing read -P route66 =3D=3D -route66 is not a valid pattern byte +qemu-io: route66 is not a valid pattern byte =20 =3D=3D testing write -P route66 =3D=3D -route66 is not a valid pattern byte +qemu-io: route66 is not a valid pattern byte =20 =3D=3D testing readv -P route66 =3D=3D -route66 is not a valid pattern byte +qemu-io: route66 is not a valid pattern byte =20 =3D=3D testing aio_read -P route66 =3D=3D -route66 is not a valid pattern byte +qemu-io: route66 is not a valid pattern byte =20 =3D=3D testing aio_write -P route66 =3D=3D -route66 is not a valid pattern byte +qemu-io: route66 is not a valid pattern byte *** done diff --git a/tests/qemu-iotests/026.out b/tests/qemu-iotests/026.out index 83989996ff6..b998a9ac83d 100644 --- a/tests/qemu-iotests/026.out +++ b/tests/qemu-iotests/026.out @@ -4,442 +4,442 @@ Errors while writing 128 kB Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_update; errno: 5; imm: off; once: on; write -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_update; errno: 5; imm: off; once: on; write -b -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_update; errno: 5; imm: off; once: off; write +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_update; errno: 5; imm: off; once: off; write -b +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_update; errno: 28; imm: off; once: on; write -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_update; errno: 28; imm: off; once: on; write -b -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_update; errno: 28; imm: off; once: off; write +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_update; errno: 28; imm: off; once: off; write -b +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_load; errno: 5; imm: off; once: on; write wrote 131072/131072 bytes at offset 0 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -write failed: Input/output error -read failed: Input/output error +qemu-io: write failed: Input/output error +qemu-io: read failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_load; errno: 5; imm: off; once: on; write -b wrote 131072/131072 bytes at offset 0 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -write failed: Input/output error -read failed: Input/output error +qemu-io: write failed: Input/output error +qemu-io: read failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_load; errno: 5; imm: off; once: off; write wrote 131072/131072 bytes at offset 0 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -write failed: Input/output error -read failed: Input/output error +qemu-io: write failed: Input/output error +qemu-io: read failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_load; errno: 5; imm: off; once: off; write -b wrote 131072/131072 bytes at offset 0 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -write failed: Input/output error -read failed: Input/output error +qemu-io: write failed: Input/output error +qemu-io: read failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_load; errno: 28; imm: off; once: on; write wrote 131072/131072 bytes at offset 0 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -write failed: No space left on device -read failed: No space left on device +qemu-io: write failed: No space left on device +qemu-io: read failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_load; errno: 28; imm: off; once: on; write -b wrote 131072/131072 bytes at offset 0 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -write failed: No space left on device -read failed: No space left on device +qemu-io: write failed: No space left on device +qemu-io: read failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_load; errno: 28; imm: off; once: off; write wrote 131072/131072 bytes at offset 0 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -write failed: No space left on device -read failed: No space left on device +qemu-io: write failed: No space left on device +qemu-io: read failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_load; errno: 28; imm: off; once: off; write -b wrote 131072/131072 bytes at offset 0 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -write failed: No space left on device -read failed: No space left on device +qemu-io: write failed: No space left on device +qemu-io: read failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_update; errno: 5; imm: off; once: on; write -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_update; errno: 5; imm: off; once: on; write -b -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_update; errno: 5; imm: off; once: off; write +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_update; errno: 5; imm: off; once: off; write -b +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_update; errno: 28; imm: off; once: on; write -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_update; errno: 28; imm: off; once: on; write -b -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_update; errno: 28; imm: off; once: off; write +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_update; errno: 28; imm: off; once: off; write -b +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_alloc_write; errno: 5; imm: off; once: on; write -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_alloc_write; errno: 5; imm: off; once: on; write -b -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_alloc_write; errno: 5; imm: off; once: off; write +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_alloc_write; errno: 5; imm: off; once: off; write -b +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_alloc_write; errno: 28; imm: off; once: on; write -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_alloc_write; errno: 28; imm: off; once: on; write -b -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_alloc_write; errno: 28; imm: off; once: off; write +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l2_alloc_write; errno: 28; imm: off; once: off; write -b +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: write_aio; errno: 5; imm: off; once: on; write -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: write_aio; errno: 5; imm: off; once: on; write -b -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: write_aio; errno: 5; imm: off; once: off; write +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: write_aio; errno: 5; imm: off; once: off; write -b +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: write_aio; errno: 28; imm: off; once: on; write -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: write_aio; errno: 28; imm: off; once: on; write -b -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: write_aio; errno: 28; imm: off; once: off; write +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: write_aio; errno: 28; imm: off; once: off; write -b +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_load; errno: 5; imm: off; once: on; write -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_load; errno: 5; imm: off; once: on; write -b -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_load; errno: 5; imm: off; once: off; write +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_load; errno: 5; imm: off; once: off; write -b +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_load; errno: 28; imm: off; once: on; write -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_load; errno: 28; imm: off; once: on; write -b -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_load; errno: 28; imm: off; once: off; write +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_load; errno: 28; imm: off; once: off; write -b +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_update_part; errno: 5; imm: off; once: on; write -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_update_part; errno: 5; imm: off; once: on; write -b -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_update_part; errno: 5; imm: off; once: off; write +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_update_part; errno: 5; imm: off; once: off; write -b +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_update_part; errno: 28; imm: off; once: on; write -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_update_part; errno: 28; imm: off; once: on; write -b -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_update_part; errno: 28; imm: off; once: off; write +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_update_part; errno: 28; imm: off; once: off; write -b +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc; errno: 5; imm: off; once: on; write -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc; errno: 5; imm: off; once: on; write -b -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc; errno: 5; imm: off; once: off; write +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc; errno: 5; imm: off; once: off; write -b +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc; errno: 28; imm: off; once: on; write -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc; errno: 28; imm: off; once: on; write -b -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc; errno: 28; imm: off; once: off; write +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc; errno: 28; imm: off; once: off; write -b +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: cluster_alloc; errno: 5; imm: off; once: on; write -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: cluster_alloc; errno: 5; imm: off; once: on; write -b -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: cluster_alloc; errno: 5; imm: off; once: off; write -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: cluster_alloc; errno: 5; imm: off; once: off; write -b -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: cluster_alloc; errno: 28; imm: off; once: on; write -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: cluster_alloc; errno: 28; imm: off; once: on; write -b -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: cluster_alloc; errno: 28; imm: off; once: off; write -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: cluster_alloc; errno: 28; imm: off; once: off; write -b -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. =20 =3D=3D=3D Refcount table growth tests =3D=3D=3D @@ -447,122 +447,122 @@ No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_hookup; errno: 28; imm: off; once: on; write -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_hookup; errno: 28; imm: off; once: on; write -b -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_hookup; errno: 28; imm: off; once: off; write +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_hookup; errno: 28; imm: off; once: off; write -b +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_write; errno: 28; imm: off; once: on; write -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_write; errno: 28; imm: off; once: on; write -b -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_write; errno: 28; imm: off; once: off; write +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_write; errno: 28; imm: off; once: off; write -b +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_write_blocks; errno: 28; imm: off; once: on; write -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_write_blocks; errno: 28; imm: off; once: on; write -b -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_write_blocks; errno: 28; imm: off; once: off; write +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_write_blocks; errno: 28; imm: off; once: off; write = -b +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_write_table; errno: 28; imm: off; once: on; write -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_write_table; errno: 28; imm: off; once: on; write -b -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_write_table; errno: 28; imm: off; once: off; write +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_write_table; errno: 28; imm: off; once: off; write -b +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_switch_table; errno: 28; imm: off; once: on; write -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_switch_table; errno: 28; imm: off; once: on; write -b -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_switch_table; errno: 28; imm: off; once: off; write +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: refblock_alloc_switch_table; errno: 28; imm: off; once: off; write = -b +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. =20 =3D=3D=3D L1 growth tests =3D=3D=3D @@ -570,76 +570,76 @@ No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_grow_alloc_table; errno: 5; imm: off; once: on -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_grow_alloc_table; errno: 5; imm: off; once: off -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_grow_alloc_table; errno: 28; imm: off; once: on -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_grow_alloc_table; errno: 28; imm: off; once: off -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_grow_write_table; errno: 5; imm: off; once: on -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_grow_write_table; errno: 5; imm: off; once: off +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_grow_write_table; errno: 28; imm: off; once: on -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_grow_write_table; errno: 28; imm: off; once: off +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_grow_activate_table; errno: 5; imm: off; once: on -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_grow_activate_table; errno: 5; imm: off; once: off +qemu-io: write failed: Input/output error qemu-io: Failed to flush the L2 table cache: Input/output error qemu-io: Failed to flush the refcount block cache: Input/output error -write failed: Input/output error No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_grow_activate_table; errno: 28; imm: off; once: on -write failed: No space left on device +qemu-io: write failed: No space left on device No errors were found on the image. Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1073741824 =20 Event: l1_grow_activate_table; errno: 28; imm: off; once: off +qemu-io: write failed: No space left on device qemu-io: Failed to flush the L2 table cache: No space left on device qemu-io: Failed to flush the refcount block cache: No space left on device -write failed: No space left on device No errors were found on the image. =20 =3D=3D=3D Avoid cluster leaks after temporary failure =3D=3D=3D =20 Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 -write failed: Input/output error +qemu-io: write failed: Input/output error wrote 1048576/1048576 bytes at offset 0 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) No errors were found on the image. @@ -651,6 +651,6 @@ wrote 1024/1024 bytes at offset 0 1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) wrote 1024/1024 bytes at offset 0 1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -write failed: Input/output error +qemu-io: write failed: Input/output error No errors were found on the image. *** done diff --git a/tests/qemu-iotests/060.out b/tests/qemu-iotests/060.out index a37bf446e94..27275fd6b70 100644 --- a/tests/qemu-iotests/060.out +++ b/tests/qemu-iotests/060.out @@ -9,7 +9,7 @@ ERROR cluster 3 refcount=3D1 reference=3D3 Data may be corrupted, or further writes to the image may corrupt it. incompatible_features [] qcow2: Marking image as corrupt: Preventing invalid write on metadata (ove= rlaps with active L1 table); further corruption events will be suppressed -write failed: Input/output error +qemu-io: write failed: Input/output error incompatible_features [1] image: TEST_DIR/t.IMGFMT file format: IMGFMT @@ -23,7 +23,7 @@ Format specific information: corrupt: true extended l2: false qemu-io: can't open device TEST_DIR/t.IMGFMT: IMGFMT: Image is corrupt; ca= nnot be opened read/write -no file open, try 'help open' +qemu-io: no file open, try 'help open' read 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 @@ -37,7 +37,7 @@ ERROR cluster 2 refcount=3D1 reference=3D2 Data may be corrupted, or further writes to the image may corrupt it. incompatible_features [] qcow2: Marking image as corrupt: Preventing invalid write on metadata (ove= rlaps with refcount block); further corruption events will be suppressed -write failed: Input/output error +qemu-io: write failed: Input/output error incompatible_features [1] ERROR refcount block 0 refcount=3D2 ERROR cluster 2 refcount=3D1 reference=3D2 @@ -73,7 +73,7 @@ Data may be corrupted, or further writes to the image may= corrupt it. This means waste of disk space, but no harm to data. incompatible_features [] qcow2: Marking image as corrupt: Preventing invalid write on metadata (ove= rlaps with inactive L2 table); further corruption events will be suppressed -write failed: Input/output error +qemu-io: write failed: Input/output error incompatible_features [1] ERROR cluster 4 refcount=3D1 reference=3D2 Leaked cluster 9 refcount=3D1 reference=3D0 @@ -108,10 +108,10 @@ wrote 65536/65536 bytes at offset 0 wrote 65536/65536 bytes at offset 536870912 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) qcow2: Marking image as corrupt: Preventing invalid write on metadata (ove= rlaps with active L2 table); further corruption events will be suppressed +qemu-io: write failed: Input/output error +qemu-io: aio_write failed: No medium found blkdebug: Suspended request '0' -write failed: Input/output error blkdebug: Resuming request '0' -aio_write failed: No medium found =20 =3D=3D=3D Testing unallocated image header =3D=3D=3D =20 @@ -119,7 +119,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D671= 08864 wrote 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) qcow2: Marking image as corrupt: Preventing invalid write on metadata (ove= rlaps with qcow2_header); further corruption events will be suppressed -write failed: Input/output error +qemu-io: write failed: Input/output error =20 =3D=3D=3D Testing unaligned L1 entry =3D=3D=3D =20 @@ -127,7 +127,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D671= 08864 wrote 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) qcow2: Marking image as corrupt: L2 table offset 0x42a00 unaligned (L1 ind= ex: 0); further corruption events will be suppressed -read failed: Input/output error +qemu-io: read failed: Input/output error Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 wrote 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -140,7 +140,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D671= 08864 wrote 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) qcow2: Marking image as corrupt: Cluster allocation offset 0x52a00 unalign= ed (L2 offset: 0x40000, L2 index: 0); further corruption events will be sup= pressed -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Testing unaligned pre-allocated zero cluster =3D=3D=3D =20 @@ -154,7 +154,7 @@ qemu-img: Failed to turn zero into data clusters: Input= /output error =20 Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 qcow2: Marking image as corrupt: Refblock offset 0x22a00 unaligned (reftab= le index: 0); further corruption events will be suppressed -write failed: Input/output error +qemu-io: write failed: Input/output error =20 =3D=3D=3D Testing non-fatal corruption on freeing =3D=3D=3D =20 @@ -171,8 +171,8 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D671= 08864 wrote 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) qcow2: Image is corrupt: Cluster allocation offset 0x52a00 unaligned (L2 o= ffset: 0x40000, L2 index: 0); further non-fatal corruption events will be s= uppressed -read failed: Input/output error -read failed: Input/output error +qemu-io: read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Testing non-fatal and then fatal corruption report =3D=3D=3D =20 @@ -181,15 +181,15 @@ wrote 131072/131072 bytes at offset 0 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) qcow2: Image is corrupt: Cannot free unaligned cluster 0x52a00; further no= n-fatal corruption events will be suppressed qcow2: Marking image as corrupt: Cluster allocation offset 0x62a00 unalign= ed (L2 offset: 0x40000, L2 index: 0x1); further corruption events will be s= uppressed +qemu-io: read failed: Input/output error discard 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -read failed: Input/output error =20 =3D=3D=3D Testing empty refcount table =3D=3D=3D =20 Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 qcow2: Marking image as corrupt: Preventing invalid write on metadata (ove= rlaps with refcount table); further corruption events will be suppressed -write failed: Input/output error +qemu-io: write failed: Input/output error ERROR cluster 0 refcount=3D0 reference=3D1 ERROR cluster 1 refcount=3D0 reference=3D1 ERROR cluster 3 refcount=3D0 reference=3D1 @@ -209,7 +209,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D671= 08864 wrote 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) qcow2: Marking image as corrupt: Preventing invalid allocation of refcount= block at offset 0; further corruption events will be suppressed -write failed: Input/output error +qemu-io: write failed: Input/output error ERROR cluster 0 refcount=3D0 reference=3D1 ERROR cluster 1 refcount=3D0 reference=3D1 ERROR cluster 3 refcount=3D0 reference=3D1 @@ -229,7 +229,7 @@ No errors were found on the image. =20 Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 qcow2: Marking image as corrupt: Preventing invalid allocation of L2 table= at offset 0; further corruption events will be suppressed -write failed: Input/output error +qemu-io: write failed: Input/output error ERROR cluster 0 refcount=3D0 reference=3D1 ERROR cluster 1 refcount=3D0 reference=3D1 ERROR cluster 2 refcount=3D0 reference=3D1 @@ -251,7 +251,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D671= 08864 wrote 65536/65536 bytes at offset 65536 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) qcow2: Marking image as corrupt: Preventing invalid allocation of compress= ed cluster at offset 0; further corruption events will be suppressed -write failed: Input/output error +qemu-io: write failed: Input/output error ERROR cluster 0 refcount=3D0 reference=3D1 ERROR cluster 1 refcount=3D0 reference=3D1 ERROR cluster 2 refcount=3D0 reference=3D1 @@ -286,7 +286,7 @@ No errors were found on the image. =20 Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 qcow2: Marking image as corrupt: Preventing invalid allocation of L2 table= at offset 0; further corruption events will be suppressed -write failed: Input/output error +qemu-io: write failed: Input/output error =20 =3D=3D=3D Testing dirty corrupt image =3D=3D=3D =20 @@ -319,7 +319,7 @@ wrote 65536/65536 bytes at offset 0 discard 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) qcow2: Marking image as corrupt: Preallocated zero cluster offset 0x2a00 u= naligned (guest offset: 0); further corruption events will be suppressed -write failed: Input/output error +qemu-io: write failed: Input/output error --- Repairing --- Repairing offset=3D2a00: Preallocated cluster is not properly aligned; L2 = entry corrupted. The following inconsistencies were found and repaired: @@ -337,7 +337,7 @@ wrote 131072/131072 bytes at offset 0 128 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) qcow2: Marking image as corrupt: Refblock offset 0x2a00 unaligned (reftabl= e index: 0); further corruption events will be suppressed qcow2_free_clusters failed: Input/output error -discard failed: No medium found +qemu-io: discard failed: No medium found --- Repairing --- ERROR refcount block 0 is not cluster aligned; refcount table entry corrup= ted qcow2: Marking image as corrupt: Refblock offset 0x2a00 unaligned (reftabl= e index: 0); further corruption events will be suppressed @@ -419,8 +419,7 @@ qcow2: Marking image as corrupt: Preventing invalid wri= te on metadata (overlaps QMP_VERSION {"return": {}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "BLOCK_IMAGE_CORRUPTED", "data": {"device": "none0", "msg": "Preventing i= nvalid write on metadata (overlaps with refcount table)", "offset": 65536, = "node-name": "drive", "fatal": true, "size": 65536}} -write failed: Input/output error -{"return": ""} +{"return": "Error: write failed: Input/output error\r\n"} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} {"return": {}} =20 @@ -431,7 +430,6 @@ QMP_VERSION {"return": {}} qcow2: Image is corrupt: L2 table offset 0x2a2a2a00 unaligned (L1 index: 0= ); further non-fatal corruption events will be suppressed {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "BLOCK_IMAGE_CORRUPTED", "data": {"device": "", "msg": "L2 table offset 0= x2a2a2a00 unaligned (L1 index: 0)", "node-name": "drive", "fatal": false}} -{"return": ""} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} {"return": {}} =20 diff --git a/tests/qemu-iotests/071.out b/tests/qemu-iotests/071.out index a2923b05c29..f2d015d8cca 100644 --- a/tests/qemu-iotests/071.out +++ b/tests/qemu-iotests/071.out @@ -30,11 +30,11 @@ blkverify: read offset=3D0 bytes=3D512 contents mismatc= h at offset 0 =20 =3D=3D=3D Testing blkdebug through filename =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Testing blkdebug through file blockref =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Testing blkdebug on existing block device =3D=3D=3D =20 @@ -43,8 +43,7 @@ QMP_VERSION {"return": {}} {"return": {}} {"return": {}} -read failed: Input/output error -{"return": ""} +{"return": "Error: read failed: Input/output error\r\n"} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} {"return": {}} =20 @@ -82,8 +81,7 @@ read 512/512 bytes at offset 0 wrote 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) {"return": ""} -read failed: Input/output error -{"return": ""} +{"return": "Error: read failed: Input/output error\r\n"} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} QEMU_PROG: Failed to flush the L2 table cache: Input/output error QEMU_PROG: Failed to flush the refcount block cache: Input/output error diff --git a/tests/qemu-iotests/072.out b/tests/qemu-iotests/072.out index fe949d47817..d7ce24da1f7 100644 --- a/tests/qemu-iotests/072.out +++ b/tests/qemu-iotests/072.out @@ -15,7 +15,7 @@ read 512/512 bytes at offset 512 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) read 512/512 bytes at offset 1024 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -Pattern verification failed at offset 0, 512 bytes +qemu-io: Pattern verification failed at offset 0, 512 bytes read 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) *** done diff --git a/tests/qemu-iotests/080.out b/tests/qemu-iotests/080.out index d8acb3e7235..b20c21faf6a 100644 --- a/tests/qemu-iotests/080.out +++ b/tests/qemu-iotests/080.out @@ -66,8 +66,8 @@ wrote 512/512 bytes at offset 0 qemu-img: Failed to load snapshot: Snapshot L1 table offset invalid qemu-img: Snapshot L1 table offset invalid qemu-img: Failed to turn zero into data clusters: Invalid argument +qemu-io: write failed: Invalid argument qemu-io: Failed to flush the refcount block cache: Invalid argument -write failed: Invalid argument qemu-img: Snapshot L1 table offset invalid qemu-img: Could not apply snapshot 'test': Failed to load snapshot: Invali= d argument qemu-img: Could not delete snapshot 'test': Snapshot L1 table offset inval= id @@ -89,8 +89,8 @@ wrote 512/512 bytes at offset 0 qemu-img: Failed to load snapshot: Snapshot L1 table too large qemu-img: Snapshot L1 table too large qemu-img: Failed to turn zero into data clusters: File too large +qemu-io: write failed: File too large qemu-io: Failed to flush the refcount block cache: File too large -write failed: File too large qemu-img: Snapshot L1 table too large qemu-img: Could not apply snapshot 'test': Failed to load snapshot: File t= oo large qemu-img: Could not delete snapshot 'test': Snapshot L1 table too large diff --git a/tests/qemu-iotests/081.out b/tests/qemu-iotests/081.out index aba85ea5644..bc902bd8183 100644 --- a/tests/qemu-iotests/081.out +++ b/tests/qemu-iotests/081.out @@ -81,7 +81,7 @@ wrote 10485760/10485760 bytes at offset 0 10 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 =3D=3D checking that quorum is broken =3D=3D -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D checking the blkverify mode with broken content =3D=3D quorum: offset=3D0 bytes=3D10485760 contents mismatch at offset 0 diff --git a/tests/qemu-iotests/083.out b/tests/qemu-iotests/083.out index 2090ee693c1..a1c446d5365 100644 --- a/tests/qemu-iotests/083.out +++ b/tests/qemu-iotests/083.out @@ -41,7 +41,7 @@ qemu-io: can't open device nbd+tcp://127.0.0.1:PORT/foo =20 =3D=3D=3D Check disconnect after neg2 =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect 8 neg2 =3D=3D=3D =20 @@ -53,31 +53,31 @@ qemu-io: can't open device nbd+tcp://127.0.0.1:PORT/foo =20 =3D=3D=3D Check disconnect before request =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect after request =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect before reply =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect after reply =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect 4 reply =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect 8 reply =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect before data =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect after data =3D=3D=3D =20 @@ -106,7 +106,7 @@ qemu-io: can't open device nbd+tcp://127.0.0.1:PORT/ =20 =3D=3D=3D Check disconnect after neg-classic =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect before neg1 =3D=3D=3D =20 @@ -150,7 +150,7 @@ qemu-io: can't open device nbd+unix:///foo?socket=3DSOC= K_DIR/nbd.sock =20 =3D=3D=3D Check disconnect after neg2 =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect 8 neg2 =3D=3D=3D =20 @@ -162,31 +162,31 @@ qemu-io: can't open device nbd+unix:///foo?socket=3DS= OCK_DIR/nbd.sock =20 =3D=3D=3D Check disconnect before request =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect after request =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect before reply =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect after reply =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect 4 reply =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect 8 reply =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect before data =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Check disconnect after data =3D=3D=3D =20 @@ -215,6 +215,6 @@ qemu-io: can't open device nbd+unix:///?socket=3DSOCK_D= IR/nbd.sock =20 =3D=3D=3D Check disconnect after neg-classic =3D=3D=3D =20 -read failed: Input/output error +qemu-io: read failed: Input/output error =20 *** done diff --git a/tests/qemu-iotests/089.out b/tests/qemu-iotests/089.out index c53fc4823a1..a29e19b12d7 100644 --- a/tests/qemu-iotests/089.out +++ b/tests/qemu-iotests/089.out @@ -16,7 +16,7 @@ read 512/512 bytes at offset 512 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) read 512/512 bytes at offset 1024 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -Pattern verification failed at offset 0, 512 bytes +qemu-io: Pattern verification failed at offset 0, 512 bytes read 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 @@ -33,7 +33,7 @@ read 512/512 bytes at offset 0 Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 wrote 512/512 bytes at offset 229376 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -read failed: Input/output error +qemu-io: read failed: Input/output error =20 =3D=3D=3D Testing qemu-img info output =3D=3D=3D =20 diff --git a/tests/qemu-iotests/114.out b/tests/qemu-iotests/114.out index f51dd9d20a1..80220e440ec 100644 --- a/tests/qemu-iotests/114.out +++ b/tests/qemu-iotests/114.out @@ -11,7 +11,7 @@ cluster_size: 65536 backing file: TEST_DIR/t.IMGFMT.base backing file format: foo qemu-io: can't open device TEST_DIR/t.qcow2: Could not open backing file: = Unknown driver 'foo' -no file open, try 'help open' +qemu-io: no file open, try 'help open' read 4096/4096 bytes at offset 0 4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) qemu-img: Could not change the backing file to 'TEST_DIR/t.qcow2.base': ba= cking format must be specified diff --git a/tests/qemu-iotests/134.out b/tests/qemu-iotests/134.out index 4abc5b5f7da..ce2a0df166e 100644 --- a/tests/qemu-iotests/134.out +++ b/tests/qemu-iotests/134.out @@ -24,7 +24,7 @@ read 134217728/134217728 bytes at offset 0 128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 =3D=3D verify pattern failure with wrong password =3D=3D -Pattern verification failed at offset 0, 134217728 bytes +qemu-io: Pattern verification failed at offset 0, 134217728 bytes read 134217728/134217728 bytes at offset 0 128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) *** done diff --git a/tests/qemu-iotests/137.out b/tests/qemu-iotests/137.out index e19df5b6ba8..1947c1a1bd7 100644 --- a/tests/qemu-iotests/137.out +++ b/tests/qemu-iotests/137.out @@ -40,5 +40,5 @@ OK: Dirty bit not set Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 qemu-io: Parameter 'lazy-refcounts' expects 'on' or 'off' qcow2: Marking image as corrupt: Preventing invalid allocation of L2 table= at offset 0; further corruption events will be suppressed -write failed: Input/output error +qemu-io: write failed: Input/output error *** done diff --git a/tests/qemu-iotests/153.out b/tests/qemu-iotests/153.out index 28e1a22952b..e235d9e59e3 100644 --- a/tests/qemu-iotests/153.out +++ b/tests/qemu-iotests/153.out @@ -33,12 +33,12 @@ Is another process using the image [TEST_DIR/t.qcow2]? _qemu_io_wrapper -c open TEST_DIR/t.qcow2 -c read 0 512 qemu-io: can't open device TEST_DIR/t.qcow2: Failed to get "write" lock Is another process using the image [TEST_DIR/t.qcow2]? -no file open, try 'help open' +qemu-io: no file open, try 'help open' =20 _qemu_io_wrapper -c open -r TEST_DIR/t.qcow2 -c read 0 512 qemu-io: can't open device TEST_DIR/t.qcow2: Failed to get shared "write" = lock Is another process using the image [TEST_DIR/t.qcow2]? -no file open, try 'help open' +qemu-io: no file open, try 'help open' =20 _qemu_img_wrapper info TEST_DIR/t.qcow2 qemu-img: Could not open 'TEST_DIR/t.qcow2': Failed to get shared "write" = lock @@ -107,7 +107,7 @@ _qemu_io_wrapper -U -r -c read 0 512 TEST_DIR/t.qcow2 =20 _qemu_io_wrapper -c open -U TEST_DIR/t.qcow2 -c read 0 512 qemu-io: can't open device TEST_DIR/t.qcow2: force-share=3Don can only be = used with read-only images -no file open, try 'help open' +qemu-io: no file open, try 'help open' =20 _qemu_io_wrapper -c open -r -U TEST_DIR/t.qcow2 -c read 0 512 =20 @@ -176,7 +176,7 @@ _qemu_io_wrapper -r -c read 0 512 TEST_DIR/t.qcow2 _qemu_io_wrapper -c open TEST_DIR/t.qcow2 -c read 0 512 qemu-io: can't open device TEST_DIR/t.qcow2: Failed to get "write" lock Is another process using the image [TEST_DIR/t.qcow2]? -no file open, try 'help open' +qemu-io: no file open, try 'help open' =20 _qemu_io_wrapper -c open -r TEST_DIR/t.qcow2 -c read 0 512 =20 @@ -231,7 +231,7 @@ _qemu_io_wrapper -U -r -c read 0 512 TEST_DIR/t.qcow2 =20 _qemu_io_wrapper -c open -U TEST_DIR/t.qcow2 -c read 0 512 qemu-io: can't open device TEST_DIR/t.qcow2: force-share=3Don can only be = used with read-only images -no file open, try 'help open' +qemu-io: no file open, try 'help open' =20 _qemu_io_wrapper -c open -r -U TEST_DIR/t.qcow2 -c read 0 512 =20 @@ -336,7 +336,7 @@ _qemu_io_wrapper -U -r -c read 0 512 TEST_DIR/t.qcow2 =20 _qemu_io_wrapper -c open -U TEST_DIR/t.qcow2 -c read 0 512 qemu-io: can't open device TEST_DIR/t.qcow2: force-share=3Don can only be = used with read-only images -no file open, try 'help open' +qemu-io: no file open, try 'help open' =20 _qemu_io_wrapper -c open -r -U TEST_DIR/t.qcow2 -c read 0 512 =20 diff --git a/tests/qemu-iotests/171 b/tests/qemu-iotests/171 index d1d77f70130..87a8aa24d96 100755 --- a/tests/qemu-iotests/171 +++ b/tests/qemu-iotests/171 @@ -188,7 +188,7 @@ img_offset=3D512 img_size=3D512 _make_test_img $size ( -$QEMU_IO "$(img_json)" <&1 < (p=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 178242255600366.662792889456; Thu, 25 Jun 2026 14:22:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wcrWA-00045g-HB; Thu, 25 Jun 2026 17:21:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrW5-0003nK-13 for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:21:45 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrW2-0003qF-TP for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:21:44 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-520-yCMG_NqqNyGshK49U0ar-Q-1; Thu, 25 Jun 2026 17:21:39 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9F9C71873123; Thu, 25 Jun 2026 21:21:38 +0000 (UTC) Received: from localhost (unknown [10.44.24.16]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 69C1E195608D; Thu, 25 Jun 2026 21:21:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782422500; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BlhHofObbsVrLDShPeZ5nrE9X0iBsYpUrMq1zqJFAxQ=; b=WUEovOcSRs9JhYSevSuPiviPvH0vRIVAQ9fr3+1CfsLz1qupR0SxhPSKhQV4k6KCdQTOkq DYhtlp2SBIOw/DJHkHd/VmGrSKN2f3KKKgY3Sf/rDxKYcdo1P7o0L09YqZxCpqD4l/CfYU 0r0M8ojkcSQyMF+rAg4XpXd0KBW3O5g= X-MC-Unique: yCMG_NqqNyGshK49U0ar-Q-1 X-Mimecast-MFC-AGG-ID: yCMG_NqqNyGshK49U0ar-Q_1782422498 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 26 Jun 2026 01:19:24 +0400 Subject: [PATCH v2 23/39] RFC: qtest: add qemu-io command to the qtest protocol MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260626-qemu-no-hmp-v2-23-8af31bc54c61@redhat.com> References: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> In-Reply-To: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster X-Developer-Signature: v=1; a=openpgp-sha256; l=3151; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=TSJRJJyhZSVJid/Syo1kRYTzV1+HRdBIZSliK3y36Is=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqPZtdrwi//1HCvjWTpz2Hys7SWDgf8QvOpR65e IrCwXUrasSJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaj2bXQAKCRDa6OEJdZac 5UhiD/0e3lThNdsrz/8jNt+7MgA7YghEfdh3/Xgzfa6xCyMJxHBZM8PPgEkaoMcNKVQGEdBx69A mx4/RZQPlS87I0KZtT133i8VDilCqlW+8f0qUYdHZ/ZYsUX2m68XQZ6qT9/XZ9lBrToqJFAp9Xa 73jdZak0qcz/NJhBU6gxC9gxywlXwHJ5WsUdzp1ool+ajMTIvzfefz0e9DRCzOna9gCdZPA8nbU EIfa6dql1zY0kAhs8klOnvyQigzG9dEA/pCbTAZDaKSLcCfozkm1lIFUF1epj2eiuseAxrQ4flD ZRqlYy7kI69fkZG8cIg/gJkZwZXhhB94y9orp75G5T/A8ZotEfukBnQf7DQpwS82mttKr+hJxCb lEiUgD1SPDKe2MKhBLgnycZAhs5eHl4uAnxW5Ar10boPJkZrPaNj8PFRxO5wQd9t1yHZM7o9NLl kT/A+w5opXAIDLs2J5tIk5af0iH4BEITUsAaPXQfRBfiXX+/oCuyV283+ny4iigglsWJxToUNzO 50imkDf6WCXB+lUY+dFtBZNM9Hhmdf7SIMK0jSIoakXXESrOZW87ACAs7DSXKb/kuDndND5M9OU 7e94qsStE41PDuyeaflX3VLDAn0PEI9R7enhsYnbXjNWpPbFNk2TKk78oOsT5RwBShHsMgaMyWY zTn6ke5F7/Ckkkg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1782422561938158500 Add a "qemu-io" command to the qtest protocol so that tests can issue block layer I/O commands without going through the HMP monitor's "human-monitor-command" QMP, or use QMP at all. Unfortunately, many tests will prefer to use QMP as they also monitor and log other events. It's easier if it is pipelined in the same stream. Signed-off-by: Marc-Andr=C3=A9 Lureau --- tests/qtest/libqtest.h | 11 +++++++++++ system/qtest.c | 14 ++++++++++++++ tests/qtest/libqtest.c | 14 ++++++++++++++ 3 files changed, 39 insertions(+) diff --git a/tests/qtest/libqtest.h b/tests/qtest/libqtest.h index 45217fb8dc0..58491ca53ab 100644 --- a/tests/qtest/libqtest.h +++ b/tests/qtest/libqtest.h @@ -424,6 +424,17 @@ char *qtest_hmp(QTestState *s, const char *fmt, ...) G= _GNUC_PRINTF(2, 3); char *qtest_vhmp(QTestState *s, const char *fmt, va_list ap) G_GNUC_PRINTF(2, 0); =20 +/** + * qtest_qemu_io: + * @s: #QTestState instance to operate on. + * @device: block device node-name or BlockBackend name. + * @fmt: qemu-io command to send, formats arguments like sprintf(). + * + * Send a qemu-io command via the qtest protocol. + */ +void qtest_qemu_io(QTestState *s, const char *device, + const char *fmt, ...) G_GNUC_PRINTF(3, 4); + void qtest_module_load(QTestState *s, const char *prefix, const char *libn= ame); =20 /** diff --git a/system/qtest.c b/system/qtest.c index fd37bcbfaab..f7f2636854b 100644 --- a/system/qtest.c +++ b/system/qtest.c @@ -33,6 +33,7 @@ #include "qom/object_interfaces.h" #include "qom/qom-qobject.h" #include "qobject/qobject.h" +#include "qapi-commands-block.h" =20 #define MAX_IRQ 256 =20 @@ -800,6 +801,19 @@ static void qtest_process_command(CharFrontend *chr, g= char **words) } g_slist_free(list); qtest_send(chr, "OK\n"); + } else if (strcmp(words[0], "qemu-io") =3D=3D 0) { + const char *io_dev; + g_autofree char *io_cmd =3D NULL; + Error *err =3D NULL; + + g_assert(words[1] && words[2]); + io_dev =3D words[1]; + io_cmd =3D g_strjoinv(" ", &words[2]); + + qmp_x_qemu_io(io_dev, NULL, io_cmd, &err); + qtest_sendf(chr, err ? "FAIL %s\n" : "OK\n", + err ? error_get_pretty(err) : NULL); + error_free(err); } else if (process_command_cb && process_command_cb(chr, words)) { /* Command got consumed by the callback handler */ } else { diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index 4e22c66b754..eccffd3a0c2 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -1012,6 +1012,20 @@ char *qtest_hmp(QTestState *s, const char *fmt, ...) return ret; } =20 +void qtest_qemu_io(QTestState *s, const char *device, + const char *fmt, ...) +{ + va_list ap; + g_autofree char *cmd =3D NULL; + + va_start(ap, fmt); + cmd =3D g_strdup_vprintf(fmt, ap); + va_end(ap); + + qtest_sendf(s, "qemu-io %s %s\n", device, cmd); + qtest_rsp(s); +} + const char *qtest_get_arch(void) { /* --=20 2.54.0 From nobody Sun Jul 26 11:53:26 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782422562; cv=none; d=zohomail.com; s=zohoarc; b=MjBD7GA5nFIpqEn80hGmISrTRn3RhUhH8rp4PufDF4mIjDTGOngxJ+sL1//zS8Xk5jg+Lxv5HOQTrkKl8pe+91izOmhYx+AggkKd+m0kY6r3zkItYYOcduMZibU2nzOKU7yut8V2C4g3HGQqSaRSjIk0LcRWqf1G6tbxh9Uk5z0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782422562; 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=yL+I36xW04SZCDuWgJ8/65gYMn8EW7W4lUAZmnKKp8I=; b=KUoai3BATX4erIPwojm3CdefFtU4D/5tPHdNGFfB7JJRLhYoXYZYyWMuBEWodkDRNUJItCuOIxkk8Zgs46gv91Vx0Uz2WNMH/p+V2HOqqmfHer0MfeS6v0QUT1NTWCLuZEJ2yuwUIuljWEArzMsyYHaOv9JSzNlxRxSw/P5I4o0= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1782422562090150.54668076094424; Thu, 25 Jun 2026 14:22:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wcrWG-0004lV-TK; Thu, 25 Jun 2026 17:21:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrWE-0004Re-26 for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:21:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrWB-0003rG-6w for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:21:53 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-270-1GdDI-3pOyOLnCddXxmHnA-1; Thu, 25 Jun 2026 17:21:44 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 04FE61955EA4; Thu, 25 Jun 2026 21:21:44 +0000 (UTC) Received: from localhost (unknown [10.44.24.16]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id AD0603000B52; Thu, 25 Jun 2026 21:21:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782422508; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yL+I36xW04SZCDuWgJ8/65gYMn8EW7W4lUAZmnKKp8I=; b=ff1fTtJqAEbyEdYp8TUXSR29pn0bMQS2g3ZruGZoVqxMkGM1Obj4WKMIZumhULRBxFjqS2 Pfe5T+KMuIoZgzWP5U9hU4j1bz+OnMk3fJeQPYMr0qBwhJ5Pk3wz/jgICjNmih1n4J2L8R gAMkJARrC8W0OnAM4AYHThraztnBqgU= X-MC-Unique: 1GdDI-3pOyOLnCddXxmHnA-1 X-Mimecast-MFC-AGG-ID: 1GdDI-3pOyOLnCddXxmHnA_1782422504 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 26 Jun 2026 01:19:25 +0400 Subject: [PATCH v2 24/39] RFC: qtest/ide-test: convert to use qtest qemu-io command MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260626-qemu-no-hmp-v2-24-8af31bc54c61@redhat.com> References: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> In-Reply-To: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster X-Developer-Signature: v=1; a=openpgp-sha256; l=1102; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=yC8UAV22PJD6GzaLylZtpEyM7zqkarcz0LMdqtxpHvc=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqPZtdvCbxMr5CZM3fmn27TLtJ3fgEw/ZOZkmLr JlHScNgsaOJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaj2bXQAKCRDa6OEJdZac 5SNnD/9EDX7ZmwsqHVn+4BhBHLlkUkck2pxJvlrv8J1Ii8GnIzX3a+WlsLrrOTo9SulVn+W55yA Wa3PDtV7kQVILf6XIO2PbTwCROreqKgTCOpXkPYG8pfpGq5EsVxJ3c1pkZHVLoZRYc9hbhFidsM PTR/KMJ/UpDl3RayNhbJlHDg5NUZSztkddPiBk0S25pBQeTZFV8xkTX370TOtc8M6AGy/SMz1aU i96WYQYmfgo+Z5FlPaH5Ig4ZLk3WoT79ZaLyDk5DkRKYouZ7wVzJqn2OqTSh7VUhJX2tzQKEtxn mUX2gTnWwt8rZzJdl+hVqbsTP2J9S7xcN1HGY7Jxg6a/i9GTZu5jADk8WpJNvxpBgbxkroLAIe1 F1kAfFougoFFwN0V5SY8U9Y549EFZiow7iEKPB/RsH9MCXwPV1InFLMSRK81ZMBNHM8OhApBz0R JpWCgL5h7k/KmJ/X/iWWjm7FEw3EzSLzLXsoaDybR7yWHukjE9EoeUtyqf4u9FW5D6TsQ4QEdNq waMQmQNlWbrIeAS3RLGb+KgJ1XkCQ+rWuz4SUVL5eKSC5zYL4FYbUrbBJJ9oi+F6QmlocwzAFM2 eJdKYMlwc5l/Qs+Ywu4uIB5XD0PBXnpR6WK/+26J9EAtPC7hRUQsZQ49AlwEiCRxAnlu15d2VCX yG7LHIu5iR94u7w== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 8 X-Spam_score: 0.8 X-Spam_bar: / X-Spam_report: (0.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-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: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1782422563891158500 Depend on the previous commit to be accepted. Signed-off-by: Marc-Andr=C3=A9 Lureau --- tests/qtest/ide-test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/qtest/ide-test.c b/tests/qtest/ide-test.c index 721e78170bc..3a00c5ff8eb 100644 --- a/tests/qtest/ide-test.c +++ b/tests/qtest/ide-test.c @@ -832,7 +832,7 @@ static void test_flush(void) make_dirty(qts, 0); =20 /* Delay the completion of the flush request until we explicitly do it= */ - g_free(qtest_hmp(qts, "qemu-io ide0-hd0 \"break flush_to_os A\"")); + qtest_qemu_io(qts, "ide0-hd0", "break flush_to_os A"); =20 /* FLUSH CACHE command on device 0*/ qpci_io_writeb(dev, ide_bar, reg_device, 0); @@ -844,7 +844,7 @@ static void test_flush(void) assert_bit_clear(data, DF | ERR | DRQ); =20 /* Complete the command */ - g_free(qtest_hmp(qts, "qemu-io ide0-hd0 \"resume A\"")); + qtest_qemu_io(qts, "ide0-hd0", "resume A"); =20 /* Check registers */ data =3D qpci_io_readb(dev, ide_bar, reg_device); --=20 2.54.0 From nobody Sun Jul 26 11:53:26 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782422531; cv=none; d=zohomail.com; s=zohoarc; b=XTTME5sWj+zDp5Aou0Pg1/EEiYPaK9YenhRxJFJ1To2C0/dGFxxI5ge8x/3oTfGUULM8AxJwNtg2kQtha76oGlh0+SnDnd7Brt/stv3OTsFENb2QsS3mlqVFb7F7hitaaX5f336xTO+2RhTitPJKGIsPl4PegzW1oAqV8MY/VEs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782422531; 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=xcbi6iQOJXsXwF5MiX/+1dYadWpWkRK6Z3B5qI7YnGs=; b=IE6Jozi4X6wSsIbcJOJahpqLtN1I6P6AIw3TTqnOJXypGoDn4ZItx5To2OQ7lfSp14stwKfS9Ya3fIxlwG0UAXUACeBWELE5uEVWNiuOIt6l/WROoB8FWDFCqFQyWn2jYF8XRVGbkfrFImXVRbGpBoLr6y+q/eIMlK/d1vcx0eU= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1782422531144932.8194204061974; Thu, 25 Jun 2026 14:22:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wcrWJ-00054Z-RR; Thu, 25 Jun 2026 17:22:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrWH-0004pT-5F for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:21:57 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrWE-0003se-8h for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:21:56 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-637-UV46BILnMKy9cjwdgerMOg-1; Thu, 25 Jun 2026 17:21:50 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 250C61873C02; Thu, 25 Jun 2026 21:21:49 +0000 (UTC) Received: from localhost (unknown [10.44.24.16]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D322E1800370; Thu, 25 Jun 2026 21:21:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782422513; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xcbi6iQOJXsXwF5MiX/+1dYadWpWkRK6Z3B5qI7YnGs=; b=TdsdCeb0HhubaY2GHfbM7FyyqnUhFHcHNPVQLvVvaj4C4p3MMSO573G6F2xK67uRi1u00K ChkPsvVzvmsF4UZcDTYNIm0b1/V0AuCGbbozOjFjKXYkH9OUsgJR6AMK45671HpeKEJgTO oqFx+o9lx5LbC7M4Bk1PPEKHeFFIIqg= X-MC-Unique: UV46BILnMKy9cjwdgerMOg-1 X-Mimecast-MFC-AGG-ID: UV46BILnMKy9cjwdgerMOg_1782422509 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 26 Jun 2026 01:19:26 +0400 Subject: [PATCH v2 25/39] block: add x-qemu-io QMP command MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260626-qemu-no-hmp-v2-25-8af31bc54c61@redhat.com> References: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> In-Reply-To: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster X-Developer-Signature: v=1; a=openpgp-sha256; l=8342; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=DiQcJdI1f9nONZOOEnwYdPmt6zyudOkA5HARGlaT2Hk=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqPZtdsex20bZjiqCtaEMoeNQHU7X2T+ePZAXD4 RfyZp5d/3eJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaj2bXQAKCRDa6OEJdZac 5a5WD/oDrdjS/r81ThobINzhuhZiW3soP5NM/5DwFahnL3zHen03V8iS7fVnzBejgKACJ5qiUgI TXieL+rc4XzvnjLePHD2GnxwDlQrkzQjiUB9PhcOaXk0L6s3xJuelelhcOBkUpli6B6aVKp3IT2 3ioVckzQ9vf5Re1+dUgsrIighLHWLmLkDWjCWEPbZhkrkAygwpJRUB3NV8vFC1A8ouoEnQ9x+0D s6asPrMsTz8j/HI/SX5RkcmDcTzHkjSIEVvVVctVKwgWLu4bOFg4v8N5rm1H49wUwbBgx4uoV9F LmIKJZ0xKuPFmQKvZcref9PEne8kFdamHDEZhjem24dXzDruJu33e5DHqfBiSI9elYgIlxxduut GrG4O4gLbtydzIjCQvzALIoZJY9eEqdevHILOJIu+JBv5K9T820yPPqjHmaFKiG9fxSCW0DpXTZ WVLaUeolXItJ+KocXiaf7xTP/UYadJ8GYNX/DZjXETUbh/iV16OVSAWe3GJHhtWxCRVEVWRNmvW QRPHMSRBLB0fiiVv9RDw80gxBzyNBY6nMzxgpp4JLgO20vjfkPgQP5Y4K6O5xJhS8NZtMqTdCwP X4AZN0oUAmC7nRzEQ3eampT7R+KvEgGr5BbAH7QUGOoZ+DGm48o6gc7lV9bX6NSeVMFsRl5f64/ CnwXNXtLJ7yXxuw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1782422533861158501 Add an x-qemu-io QMP command that runs qemu-io commands on block devices. The command accepts a device name (block backend name, node-name, or qdev ID) and a qemu-io command string. Refactor hmp_qemu_io() to be a thin wrapper around the new QMP command, following the standard HMP-over-QMP pattern used by other block commands. Signed-off-by: Marc-Andr=C3=A9 Lureau --- qapi/block.json | 34 ++++++++++++++++++ block/monitor/block-hmp-cmds.c | 60 ++------------------------------ block/monitor/qmp-cmds.c | 79 ++++++++++++++++++++++++++++++++++++++= ++++ block/monitor/meson.build | 1 + 4 files changed, 117 insertions(+), 57 deletions(-) diff --git a/qapi/block.json b/qapi/block.json index 46955bbb3e3..0a588714ea9 100644 --- a/qapi/block.json +++ b/qapi/block.json @@ -603,3 +603,37 @@ '*boundaries-zap': ['uint64'], '*boundaries-flush': ['uint64'] }, 'allow-preconfig': true } + +## +# @x-qemu-io: +# +# Run a qemu-io command on a block device. Take either a block +# backend name or a qdev ID to identify the device. +# +# @device: the block backend name, node-name to run the +# command on. +# +# @qdev: the qdev ID of the block device to run the +# command on. +# +# @command: the qemu-io command string to execute. +# +# Features: +# +# @unstable: This command is for testing only. +# +# Since: 11.1 +# +# .. qmp-example:: +# +# -> { "execute": "x-qemu-io", +# "arguments": { "device": "virtio0", +# "command": "read 0 512" } } +# <- { "return": {} } +## +{ 'command': 'x-qemu-io', + 'data': { '*device': 'str', + '*qdev': 'str', + 'command': 'str' }, + 'features': [ 'unstable' ], + 'allow-preconfig': true } diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c index c7113b8ea5e..254a79ce855 100644 --- a/block/monitor/block-hmp-cmds.c +++ b/block/monitor/block-hmp-cmds.c @@ -56,7 +56,6 @@ #include "block/qapi.h" #include "block/block_int.h" #include "block/block-hmp-cmds.h" -#include "qemu-io.h" =20 static void hmp_drive_add_node(Monitor *mon, const char *optstr) { @@ -551,67 +550,14 @@ void hmp_eject(Monitor *mon, const QDict *qdict) =20 void hmp_qemu_io(Monitor *mon, const QDict *qdict) { - BlockBackend *blk =3D NULL; - BlockDriverState *bs =3D NULL; - BlockBackend *local_blk =3D NULL; bool qdev =3D qdict_get_try_bool(qdict, "qdev", false); const char *device =3D qdict_get_str(qdict, "device"); const char *command =3D qdict_get_str(qdict, "command"); Error *err =3D NULL; - int ret; - - if (qdev) { - blk =3D blk_by_qdev_id(device, &err); - if (!blk) { - goto fail; - } - } else { - blk =3D blk_by_name(device); - if (!blk) { - bs =3D bdrv_lookup_bs(NULL, device, &err); - if (!bs) { - goto fail; - } - } - } - - if (bs) { - blk =3D local_blk =3D blk_new(bdrv_get_aio_context(bs), 0, BLK_PER= M_ALL); - ret =3D blk_insert_bs(blk, bs, &err); - if (ret < 0) { - goto fail; - } - } - - /* - * Notably absent: Proper permission management. This is sad, but it s= eems - * almost impossible to achieve without changing the semantics and the= reby - * limiting the use cases of the qemu-io HMP command. - * - * In an ideal world we would unconditionally create a new BlockBacken= d for - * qemuio_command(), but we have commands like 'reopen' and want them = to - * take effect on the exact BlockBackend whose name the user passed in= stead - * of just on a temporary copy of it. - * - * Another problem is that deleting the temporary BlockBackend involves - * draining all requests on it first, but some qemu-iotests cases want= to - * issue multiple aio_read/write requests and expect them to complete = in - * the background while the monitor has already returned. - * - * This is also what prevents us from saving the original permissions = and - * restoring them later: We can't revoke permissions until all requests - * have completed, and we don't know when that is nor can we really let - * anything else run before we have revoken them to avoid race conditi= ons. - * - * What happens now is that command() in qemu-io-cmds.c can extend the - * permissions if necessary for the qemu-io command. And they simply s= tay - * extended, possibly resulting in a read-only guest device keeping wr= ite - * permissions. Ugly, but it appears to be the lesser evil. - */ - qemuio_command(blk, command, &err); =20 -fail: - blk_unref(local_blk); + qmp_x_qemu_io(qdev ? NULL : device, + qdev ? device : NULL, + command, &err); hmp_handle_error(mon, err); } =20 diff --git a/block/monitor/qmp-cmds.c b/block/monitor/qmp-cmds.c new file mode 100644 index 00000000000..e5759d824f1 --- /dev/null +++ b/block/monitor/qmp-cmds.c @@ -0,0 +1,79 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#include "qemu/osdep.h" + +#include "system/block-backend.h" +#include "block/block_int.h" +#include "qapi/qapi-commands-block.h" +#include "qapi/error.h" +#include "qemu-io.h" + +void qmp_x_qemu_io(const char *device, const char *qdev, + const char *command, Error **errp) +{ + BlockBackend *blk =3D NULL; + BlockBackend *local_blk =3D NULL; + BlockDriverState *bs =3D NULL; + int ret; + + if (!device && !qdev) { + error_setg(errp, "Must specify either device or qdev"); + return; + } + if (qdev && device) { + error_setg(errp, "Cannot specify both qdev and device"); + return; + } + + if (qdev) { + blk =3D blk_by_qdev_id(qdev, errp); + if (!blk) { + return; + } + } else { + blk =3D blk_by_name(device); + if (!blk) { + bs =3D bdrv_lookup_bs(NULL, device, errp); + if (!bs) { + return; + } + } + } + + if (bs) { + blk =3D local_blk =3D blk_new(bdrv_get_aio_context(bs), 0, BLK_PER= M_ALL); + ret =3D blk_insert_bs(blk, bs, errp); + if (ret < 0) { + goto fail; + } + } + + /* + * Notably absent: Proper permission management. This is sad, but it s= eems + * almost impossible to achieve without changing the semantics and the= reby + * limiting the use cases of the qemu-io command. + * + * In an ideal world we would unconditionally create a new BlockBacken= d for + * qemuio_command(), but we have commands like 'reopen' and want them = to + * take effect on the exact BlockBackend whose name the user passed in= stead + * of just on a temporary copy of it. + * + * Another problem is that deleting the temporary BlockBackend involves + * draining all requests on it first, but some qemu-iotests cases want= to + * issue multiple aio_read/write requests and expect them to complete = in + * the background while the monitor has already returned. + * + * This is also what prevents us from saving the original permissions = and + * restoring them later: We can't revoke permissions until all requests + * have completed, and we don't know when that is nor can we really let + * anything else run before we have revoken them to avoid race conditi= ons. + * + * What happens now is that command() in qemu-io-cmds.c can extend the + * permissions if necessary for the qemu-io command. And they simply s= tay + * extended, possibly resulting in a read-only guest device keeping wr= ite + * permissions. Ugly, but it appears to be the lesser evil. + */ + qemuio_command(blk, command, errp); + +fail: + blk_unref(local_blk); +} diff --git a/block/monitor/meson.build b/block/monitor/meson.build index 1022516e93c..74faced9e17 100644 --- a/block/monitor/meson.build +++ b/block/monitor/meson.build @@ -1,2 +1,3 @@ system_ss.add(files('block-hmp-cmds.c')) block_ss.add(files('bitmap-qmp-cmds.c')) +system_ss.add(files('qmp-cmds.c')) --=20 2.54.0 From nobody Sun Jul 26 11:53:26 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782422566; cv=none; d=zohomail.com; s=zohoarc; b=bIMCkcm++yFdqslYfYqe3/VG3ov9HMJew9ASpliE8wRzzg3ZzTZ6lSz2D/AQXtgaiKnXT/2ianPyh/l8zbeghsJfZthC7ZdRf/BGyZ7Z+RCx5EnYbM+27uBAP8Ch87kKjzEmvu+jGX23N0lbxFi/Gzcv/yqaRt5QmEIIOYyVmVM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782422566; 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=nDTL60CqacufkpD3COu06t22E+dNdIfDWJkj0E3iGPE=; b=M7XgLNTsGdFN3UAYjgxlG2N/dFg37JnuvNtD0a9boMUutxM0qsCV+FhuGDyZ6lYmDyX5mnQQXBjhPKuhg34Re20f1x96uktsBU1U3Q/HqCpdBj2OInQcz6Bh15N4wbLrlk3RZc3jTaejHj0yRmIcs2quINdg2eqEHChJCUYRKDg= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1782422566174822.1990579423791; Thu, 25 Jun 2026 14:22:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wcrWM-0005M7-8K; Thu, 25 Jun 2026 17:22:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrWJ-00056w-Mw for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:21:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrWH-0003tD-K6 for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:21:58 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-266-bWs1EXXrOQiC5TBtP08adw-1; Thu, 25 Jun 2026 17:21:55 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4ABC7180AC50; Thu, 25 Jun 2026 21:21:54 +0000 (UTC) Received: from localhost (unknown [10.44.24.16]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 1576C195604A; Thu, 25 Jun 2026 21:21:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782422516; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nDTL60CqacufkpD3COu06t22E+dNdIfDWJkj0E3iGPE=; b=PiGkP4khYMPGECtqcRHoC2fKPua9qwz++1NDD/owgrK2D45cgYY0BvGXq2WS054XW8BZTO m+jr+vnwVYG1gXEuo3msWlo4/Gy8FBEQbTYKYmjXWIHwF9QNx1FvfUd19B6euuAZR6qwW2 k/Wq7bu+GhyNvn6JU51cq+U0qQw4BnA= X-MC-Unique: bWs1EXXrOQiC5TBtP08adw-1 X-Mimecast-MFC-AGG-ID: bWs1EXXrOQiC5TBtP08adw_1782422514 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 26 Jun 2026 01:19:27 +0400 Subject: [PATCH v2 26/39] tests/qemu-iotests: add qmp_qemu_io() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260626-qemu-no-hmp-v2-26-8af31bc54c61@redhat.com> References: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> In-Reply-To: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster X-Developer-Signature: v=1; a=openpgp-sha256; l=1471; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=zBEDpNdxGrFiJykDG+qFptAI5517U/xG7WgjHd2vzsc=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqPZtdueCQTdlyHYGfkLn4d3D/+yQB/Zc0rS4am /q+OcVvvY2JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaj2bXQAKCRDa6OEJdZac 5Q1EEAC0IdCL9ZPM+Kzk1PKKzmmpNPOA+IeMcjsPgMpiMH8U5A63ebC+i6a1yfnjbcG5BEn9J6b vVCPK/yPJw+8yqyRAaTWGrqBD2Mdc9U50Nu7Ocx5odfY4oRIgPXoHhYe4lqV+CZqeSzdiGlCVCQ srSwItFcCNTzmTQb7SxEUBXsFN1ivHXBp6nCoYaJmeDBwTYDTGDNA6+hirnzzRibTJWyj34EH1k jA3/nazpOvYf9TnVXeqVIZLLKh22h9GPdwpyJRR5jgs1pxL/lvcf8//xZXFEqnlOo0Oki+HZRAa 1s7Fm/WhkzLMZEAF3phLW+u715Ikm93S9LW0zUuosKMqCbfcpru6GY/7mhTy2NHvzU1Q6CJJZo/ gISORO2b5rXbpuiSOSe1Y3lSprJr2jOjiY1akAqvm18zwz2Yd50LGIkQfQHYRg37uVxnTr+54iI uaUyq7EF/xloio9w4IpYEMrqfB+bXyfo0NjfUE3z8c37wr+deI2wpY+il8qkdWVWkRtsTv16ipd T155L17G5TfiNcWDjrmbwBKbmrgHFyr71W5I+oGUjVUtA1tkVo/VKUsXIY58HOkVceKjv8tJWkm AK8Dw+Qf8o08TyltpuZGsQyJkCycvvTxv8uJYtxCooEHSYAVqR04C11BlU7nsqGGMhf0KZdSp/8 giBmD+Lx6m9yv3w== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1782422567903158500 Add qmp_qemu_io() method as a QMP counterpart to hmp_qemu_io(), using the x-qemu-io QMP command instead of human-monitor-command. The x-qemu-io command takes separate 'device' (or 'qdev') and 'command' arguments, and returns the error string. Signed-off-by: Marc-Andre Lureau --- tests/qemu-iotests/iotests.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 072be80e079..c24f1e3767c 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -953,6 +953,20 @@ def hmp_qemu_io(self, drive: str, cmd: str, d =3D '-d ' if qdev else '' return self.hmp(f'qemu-io {d}{drive} "{cmd}"', use_log=3Duse_log) =20 + def qmp_qemu_io(self, drive: str, cmd: str, + use_log: bool =3D False, qdev: bool =3D False) -> str: + """Write to a given drive using the x-qemu-io QMP command""" + kwargs: Dict[str, Any] =3D {'command': cmd} + if qdev: + kwargs['qdev'] =3D drive + else: + kwargs['device'] =3D drive + if use_log: + res =3D self.qmp_log('x-qemu-io', **kwargs) + else: + res =3D self.qmp('x-qemu-io', **kwargs) + return res.get('error', {}).get('desc', '') + def flatten_qmp_object(self, obj, output=3DNone, basestr=3D''): if output is None: output =3D {} --=20 2.54.0 From nobody Sun Jul 26 11:53:26 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782422567; cv=none; d=zohomail.com; s=zohoarc; b=DXZN2xwNRtb3B6RUdFXbarX1zZcah62SuxBrLt7VDlEdT8tCqtKuyNaFvoFs+82c0sJACXqH1lShrGEPp1+YNeftqamJMgvGz0rH7LQ6asWBxvC0zU2rNKQmBQclCflIF0RKpSdm2LrKXPf9TaVsXOghgjpyz2ni7Nh5NOElOdo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782422567; 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=hi2vEzgQrcrQaOzimQFu2ofvp7AA736N78llG+JKBUE=; b=OZTR0lt9aeQVwTJjI0mldLApQifUg4h47LpjQJYOoXrM6rFGOSWWPKlMbplJ9RsMlk9TAvcbJWzsv/rIv/ToYJaNB/OGgeugJykJxI7UIA+xWrSUYvgfuE7WPUoVagqDFGXLeqfkKPa/FQisoIh6M895+y3TvHPy9HZUOWRwiaE= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1782422567341957.6019713059383; Thu, 25 Jun 2026 14:22:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wcrWQ-0005jv-Ds; Thu, 25 Jun 2026 17:22:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrWO-0005bf-HY for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:22:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrWM-0003u7-UI for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:22:04 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-512-GE4eovPaOH-XldN309WE7g-1; Thu, 25 Jun 2026 17:22:00 -0400 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 61C0B1954236; Thu, 25 Jun 2026 21:21:59 +0000 (UTC) Received: from localhost (unknown [10.44.24.16]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 1E9E731D2; Thu, 25 Jun 2026 21:21:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782422521; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hi2vEzgQrcrQaOzimQFu2ofvp7AA736N78llG+JKBUE=; b=cNfIeK3/92CBpf8sDd3F+0JVvNXnt+Qw+fcnTDOTohMq2SpLfV1g6doalRCIPioVIC/+2v 40+qYxVZZO04XZKKL3XAWaJymC3m1fe6TVJDLLfUAXdKKQ3mlzWdH5ZxewS1Ce+fvqdtMV cem3MxOEzufW7QTWvJ3aSSEMLyjZnVM= X-MC-Unique: GE4eovPaOH-XldN309WE7g-1 X-Mimecast-MFC-AGG-ID: GE4eovPaOH-XldN309WE7g_1782422519 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 26 Jun 2026 01:19:28 +0400 Subject: [PATCH v2 27/39] tests/qemu-iotests: convert pause/resume_drive() to QMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260626-qemu-no-hmp-v2-27-8af31bc54c61@redhat.com> References: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> In-Reply-To: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster X-Developer-Signature: v=1; a=openpgp-sha256; l=1175; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=qM0Xof+7smXnWaV+O717rWpzA/cboySeKHxvYp0PgWw=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqPZtdk9+UxvsVXDDpKTU3ARlC5piaiYVKWRh13 vTm/iBWjkaJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaj2bXQAKCRDa6OEJdZac 5W0LEACp3FfWkDJfCRsdO6DWNZhUd1bYBJCmbWzgok8hwpoWMEAWNSjFwDTYBwPPM7qZaJNANoD hAC5n7n+Av8Qg2iLMJV4ndtsMBiNgEOU0nOYK/zgdcE8DTUyxqpecfzX5es1VAd31ZcqOefrMp7 AIe6dR5yyfzHAOKbijw9CecCJ4MUueGjTROy9jxAzL28ysIGGwrQPZxswrFQG0B1T2l0dqFqUws izzlXNnm2kPoYiflxC9tsTrkmyRB/G1eBkDgx2pge+nv1NhiWfOXMgk5DQjSUE4pB2T+ZoCYJMX sojhCS55fjHRD8BNxrSUWBt9c1TGFbV+jbNZKKifLFzaeNTz9NYhd8RsZhHi9NDgri2CDYqMdle nU2MNJiHaUzGz98HfKaO6EtTe+nXVF3ZJcwlmOtRooxjbh6JOFdaukW07PBaE2jHQF4GDySnJJt c/o+Ly0xscStiKuqDL0a0WeWK75YTsT8vllmHSh+N0cMOpoUotsY0fLEFiGWLQC5HzR/azbc1BR L8BJZdJEn9IP6xweqzC1h/mDt+ruEV7IyDLRAgLOn7PnJeUCAp4xkvw2R5DQwZIikFYn3CDiUzm Xv5A4XWZPQ23sKTWODzHpQAdKT8WDat+JmLiygAXCdTpgXIDCvXcjOeWZ+MC4U1bSlcy4F+yFoX /gdx4kT9JeB/rSA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 8 X-Spam_score: 0.8 X-Spam_bar: / X-Spam_report: (0.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-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: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1782422567915158500 Convert pause_drive() and resume_drive() to use x-qemu-io directly instead of routing through hmp(). Signed-off-by: Marc-Andr=C3=A9 Lureau --- tests/qemu-iotests/iotests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index c24f1e3767c..f36bcf31642 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -941,11 +941,11 @@ def pause_drive(self, drive: str, event: Optional[str= ] =3D None) -> None: self.pause_drive(drive, "read_aio") self.pause_drive(drive, "write_aio") return - self.hmp(f'qemu-io {drive} "break {event} bp_{drive}"') + self.qmp_qemu_io(drive, f'break {event} bp_{drive}') =20 def resume_drive(self, drive: str) -> None: """Resume drive r/w operations""" - self.hmp(f'qemu-io {drive} "remove_break bp_{drive}"') + self.qmp_qemu_io(drive, f'remove_break bp_{drive}') =20 def hmp_qemu_io(self, drive: str, cmd: str, use_log: bool =3D False, qdev: bool =3D False) -> QMPM= essage: --=20 2.54.0 From nobody Sun Jul 26 11:53:26 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782422583; cv=none; d=zohomail.com; s=zohoarc; b=jyDLrcICs5RptqAjDJGZaU0SD3+qBuXmoLAARZ7wU9Eu1A84N53H3UFK7w0LWSg/rdUclTd9snDZ78CqmDICS3kRwoJndZoruYX0SN7k+LOhl1466lfPWTOmYYEaxq6FrykMdk+kHypq1sQMP8N/J8YMc1MboLYJR5hhFYHiNio= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782422583; 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=a8MqeA40QOR+nIk2+32wAxE8AqwLWXQRv12gEo1E+W8=; b=eXPhxGmkcXHO6qpEy58x23zlUmcTUzJoWDElIZVtSWB7vpnUUv3OUgj2wkJtaPd9cE+QbbWUgh7BJGWEUSZvEUN1nqaX9EhaIj7CFm+GJuqqYXAEFLVxWk/AOG8aObHTB5MdIMyuH0ZRFX1q4FPj4Zk8S7lNN4G3oYIF3c4YPxI= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1782422583260898.5034697861768; Thu, 25 Jun 2026 14:23:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wcrWU-0006B6-Qy; Thu, 25 Jun 2026 17:22:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrWT-000620-5r for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:22:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrWR-0003ut-9Z for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:22:08 -0400 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-478-UIe2FwMCP_GRLPLQ8LnJZw-1; Thu, 25 Jun 2026 17:22:05 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 73F7A1835E2B; Thu, 25 Jun 2026 21:22:04 +0000 (UTC) Received: from localhost (unknown [10.44.24.16]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3E1731800661; Thu, 25 Jun 2026 21:22:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782422526; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=a8MqeA40QOR+nIk2+32wAxE8AqwLWXQRv12gEo1E+W8=; b=ZeN4DMV+5+jgA/67PopCrGKCPYPThUKp3f177islpG4/X0ejBlUgrBl8ZZLbdd/ldtBTrl mtoluxuO+SCpNLamT2xHCY5XotT5Vfo8POO7gZvhGzmUoyBDQAb04peMzgQCDYk/5S0tqx rQDnbe7KFy5lnXbuKe1gKXSISRIUVu0= X-MC-Unique: UIe2FwMCP_GRLPLQ8LnJZw-1 X-Mimecast-MFC-AGG-ID: UIe2FwMCP_GRLPLQ8LnJZw_1782422524 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 26 Jun 2026 01:19:29 +0400 Subject: [PATCH v2 28/39] build-sys: add 'hmp' option MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260626-qemu-no-hmp-v2-28-8af31bc54c61@redhat.com> References: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> In-Reply-To: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster X-Developer-Signature: v=1; a=openpgp-sha256; l=3029; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=uCNypvAhoJYTu2L3kXSPIUPn8bgO6jkCWdgE1SDj+5g=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqPZtdl4aoNK8PvcrV+xc7RC2ONZvdKuuO9cfIx JL+atUvniaJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaj2bXQAKCRDa6OEJdZac 5fRBD/0ZtDOjSO+r8zi8Fb2c1JDNYrfs4G6ylfaQH/G+JstmpT5LUksjN7e8XXlX6MMwwqaiOoR YSQszUytME0Mi9VfJSoQbPGxFVDvW4Ff18EAjo/FchKJWzD3gQEzkXXUBR7eu10vF7mIuPw5fVr Ade/JauuZ0HbfkgsHVgN8CUd+3Npef3CvRBtTISUj4ZpzCftBfSTI5nj1h5ErpYYudMpttQfuE9 VlitRQmwUxSsZ6Hyaw3LR1N9t0KjRRdS2FRmYL9nZnvE9PiPXJhfQHIxe1AlY+aDZUSFqa4sJ8V iZ6nQvObqKfz6DCB6diLeetaRD/aydaW0y0k5v+2S4O+7o7d+vVseQWmsTpHHEyc9vDLOsqVupQ h5VWVdvodQrk1C0Du0gkx7v7frYYW3uOZstofjHoqJP7Dcg0yV4XWv2VDb2KfVawo8J9t0wy+oi +Hvz0+rtCwX/tmg9ZcfoBApmPkGUe4eFF/C45jqVcoJGSVwj9dyZ4BLXoAqdtGE17X+8Y50dSfq a48KLGyXJqficvsH8I7kghLjgr9fcYymOTuy9BN622PSdVC2mbM88Li0joO7RHFWVavUbeJIz9B 5yOgZZU6sjnymhhWDnX3hgXu2LQl4qvj1Px5T9GviTsJepe9V4dmq+inqtEF+lTmfOXRZtLYzOs MySALw/9FKoiNrg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1782422584052158500 Add an option to enable/disable HMP support, default to true. The following commits are going to make --disable-hmp gradually working. Signed-off-by: Marc-Andr=C3=A9 Lureau --- meson.build | 4 ++++ meson_options.txt | 2 ++ scripts/meson-buildoptions.sh | 3 +++ 3 files changed, 9 insertions(+) diff --git a/meson.build b/meson.build index e026851309e..824ba695801 100644 --- a/meson.build +++ b/meson.build @@ -247,6 +247,9 @@ have_vhost_net =3D have_vhost_net_kernel or have_vhost_= net_user or have_vhost_net_ =20 have_tcg =3D get_option('tcg').allowed() and (have_system or have_user) =20 +have_hmp =3D get_option('hmp') \ + .disable_auto_if(not have_system) \ + .allowed() have_tools =3D get_option('tools') \ .disable_auto_if(not have_system) \ .allowed() @@ -2254,6 +2257,7 @@ endif config_host_data =3D configuration_data() =20 config_host_data.set('CONFIG_HAVE_RUST', have_rust) +config_host_data.set('CONFIG_HMP', have_hmp) audio_drivers_selected =3D [] if have_system audio_drivers_available =3D { diff --git a/meson_options.txt b/meson_options.txt index a07cb47d35e..d8f59cf92ca 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -111,6 +111,8 @@ option('cfi', type: 'boolean', value: false, description: 'Control-Flow Integrity (CFI)') option('cfi_debug', type: 'boolean', value: false, description: 'Verbose errors in case of CFI violation') +option('hmp', type : 'feature', value : 'auto', + description: 'HMP monitor support') option('multiprocess', type: 'feature', value: 'auto', description: 'Out of process device emulation support') option('relocatable', type : 'boolean', value : true, diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh index c003985047c..5a67e59a167 100644 --- a/scripts/meson-buildoptions.sh +++ b/scripts/meson-buildoptions.sh @@ -125,6 +125,7 @@ meson_options_help() { printf "%s\n" ' gtk GTK+ user interface' printf "%s\n" ' guest-agent Build QEMU Guest Agent' printf "%s\n" ' guest-agent-msi Build MSI package for the QEMU Guest Ag= ent' + printf "%s\n" ' hmp HMP monitor support' printf "%s\n" ' hv-balloon hv-balloon driver (requires Glib 2.68+ = GTree API)' printf "%s\n" ' hvf HVF acceleration support' printf "%s\n" ' iconv Font glyph conversion support' @@ -339,6 +340,8 @@ _meson_option_parse() { --disable-guest-agent-msi) printf "%s" -Dguest_agent_msi=3Ddisabled ;; --enable-hexagon-idef-parser) printf "%s" -Dhexagon_idef_parser=3Dtrue= ;; --disable-hexagon-idef-parser) printf "%s" -Dhexagon_idef_parser=3Dfal= se ;; + --enable-hmp) printf "%s" -Dhmp=3Denabled ;; + --disable-hmp) printf "%s" -Dhmp=3Ddisabled ;; --enable-hv-balloon) printf "%s" -Dhv_balloon=3Denabled ;; --disable-hv-balloon) printf "%s" -Dhv_balloon=3Ddisabled ;; --enable-hvf) printf "%s" -Dhvf=3Denabled ;; --=20 2.54.0 From nobody Sun Jul 26 11:53:26 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782422598; cv=none; d=zohomail.com; s=zohoarc; b=NG2BrEHKLdp3djVvifkMU5htsXChb9UL2x/0n7sszRaT40RZx6vdrTC5hQM2JHL5c347tZ7/VawvF6bSAtqmQpJ7m771uG/xQLgZYiGXOVgHAR+RiV5uO2qIYtqYurT0r7EU7Sl45lvvPJ5s7Y3L0OG+aKbA4H7g/QhTswwQ/HE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782422598; 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=IGuygaw90nyfUcdlBzft+Etf4fff8VkgQ5bDUxaELbM=; b=XOg3rSvm8nkI+cA55B3VqHx4sElskm0Hv5ePYSLkQTyy2Axr3IcJ+Ri7ws0gM9oUiZe7SnKZ1ULyhhffHtEL+xt2EY2vWQB/oMpxu7xAlvDp6tdv4zBkcfjv70n5w/X5N8TsRyEjcD7J9laos7oF2/1dd0gQQ+h8gD2uJtJ06H0= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1782422598367532.3978709776331; Thu, 25 Jun 2026 14:23:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wcrWb-0006bT-1i; Thu, 25 Jun 2026 17:22:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrWa-0006as-8z for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:22:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrWY-0003z5-KY for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:22:15 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-524-mwdW4xrOOciurxJK2Bp-Pg-1; Thu, 25 Jun 2026 17:22:10 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 98DEB1873123; Thu, 25 Jun 2026 21:22:09 +0000 (UTC) Received: from localhost (unknown [10.44.24.16]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 64AF21800586; Thu, 25 Jun 2026 21:22:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782422533; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IGuygaw90nyfUcdlBzft+Etf4fff8VkgQ5bDUxaELbM=; b=T4w00+k8SDV4bBOJoLyY1Z1Qbm1nIJLO/813Zu/c1jddnTXhMRqKPVtzm5AsD2PONkp9aC IdiFaKfM1UJS1P7jaig+kAR5D/FDfScbfM7XgeQ7NeFpc9aP0NGuotKKvWncUWhFqlp1a3 0qdDSGlaAF6CEGxxlRqxkqJlONMVZss= X-MC-Unique: mwdW4xrOOciurxJK2Bp-Pg-1 X-Mimecast-MFC-AGG-ID: mwdW4xrOOciurxJK2Bp-Pg_1782422529 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 26 Jun 2026 01:19:30 +0400 Subject: [PATCH v2 29/39] monitor: reject readline monitor when HMP is disabled MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260626-qemu-no-hmp-v2-29-8af31bc54c61@redhat.com> References: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> In-Reply-To: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster X-Developer-Signature: v=1; a=openpgp-sha256; l=1038; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=SdR1H1AX7SN41gTLzd1ShW5/r4BEAKXdex8EICuZOEw=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqPZtd0Ppuna9n2940R3OXSRUP4iTrICQxg88yP MWrBQz+F66JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaj2bXQAKCRDa6OEJdZac 5fcsEACt8f8AbCaJhxdktf0x6v2xzs96Rkk/Td99kn3WW73knCIXeBqDcM3K7y3DSA8VTxotVi6 IdbfpwucVVd93cp7UGYje30R2eg88s89JkJL6YXzbExy31g7X7Yu1aY7oX8bl56W1pCXXnYFJEV AULVUkF1krLYpqbw78zUEQUM2TT4yHYQXpBzdt5eVE4yPTRU2oo8yVvBdmt/PYcuZOtb7Dp5lLQ Xv5zBeVyWAD25lR2U1tF2DIzr+OZuAtYFYSrCDs21/hvZ/LGTTUPO4DDTWRvrXSiljxmuEDX8eL wqPkx89ozYlT4fNtZd4wkya4qmtps6fvKnCOBxeS/GgQ7gOo7O2eDKxjKt0MLoBGbPiJTsITfVl zWS9Qqq5vj0f419TDuGbXF0MXJAOvv2CKcxOIpIZzEjAWOj+5D6EsPOHIq8E4xnmlVbP2/jKXc9 lrzfFTRtb9Dyp2wWG9rEB8iIdLmd6IZo/Ki72/tsxi2A9Sko1hCtBvXtvUrE66fsQfYpVmwJM4J XsNAdxRJY5aOsUGZR334L7oTbiveiDHhx5LUMIzsdFQUqgXRA32vktJoQyLndSqx7GMfhar1AJJ DmOXBn1PmgAoWbyu7kk+vw00NBvyjBJd0vRzLrRJcgbcm6gtEdU3/mMqSDFBsDuyGiXhrY89Hdo BIh3zuEkGvQ8zMA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1782422600095158500 When QEMU is built without HMP support, reject '-monitor' (which requests readline/HMP mode) early in monitor_init_opts() with a clear error message directing users to '-qmp' instead. Signed-off-by: Marc-Andre Lureau --- monitor/monitor.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/monitor/monitor.c b/monitor/monitor.c index 2dec0e299af..f443f406b4c 100644 --- a/monitor/monitor.c +++ b/monitor/monitor.c @@ -764,6 +764,16 @@ int monitor_init_opts(QemuOpts *opts, Error **errp) MonitorOptions *options; int ret; =20 +#ifndef CONFIG_HMP + const char *mode =3D qemu_opt_get(opts, "mode"); + /* readline is HMP.. */ + if (mode && g_str_equal(mode, "readline")) { + error_setg(errp, "HMP monitor is not available," + " use '-qmp' instead of '-monitor'"); + return -1; + } +#endif + v =3D opts_visitor_new(opts); visit_type_MonitorOptions(v, NULL, &options, errp); visit_free(v); --=20 2.54.0 From nobody Sun Jul 26 11:53:26 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782422615; cv=none; d=zohomail.com; s=zohoarc; b=JB4rQXihTn3ZjsTj4U9EXnZEGNEixBV5Vi1pfTeo+sz36s+ZUco70D2dOfehI6ooJRHm4xWHOz8w9dWUYDjlhWDqvjwUbwoznJw0MVdBl8wwZ9EmMp0nW35q4phD4qd8aZfd0Y4S+cgecfDrnEyUhS8gj9ak3LEY79VbDYJtmLY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782422615; 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=w73Cj+3OEn79zjrHJA/TKQF7WC3Bh1T5g/kIWklZkbI=; b=lf/ECJfyaSL07k5VMi7suX3N7+6DgPzvqf3B2DDaDvqXvdhRcWXdXTGrZOdOACr+bAi1Rz+NwPfUwmi6EAMSx5Y0iFwRfMqL0yRZnJUBQghkqkbfHi2+HdgbDV9VXrdzrHLhf6ji80t6tTFJuK04MnGRGgURe9fPEy6s7fzkVgY= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1782422615490111.48709899189623; Thu, 25 Jun 2026 14:23:35 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wcrWi-0006xU-JU; Thu, 25 Jun 2026 17:22:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrWg-0006pe-LO for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:22:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrWc-0003zx-5n for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:22:22 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-504-G49GpnlDOvCAR7dl7Y6ROA-1; Thu, 25 Jun 2026 17:22:15 -0400 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id F3EFB1955E78; Thu, 25 Jun 2026 21:22:14 +0000 (UTC) Received: from localhost (unknown [10.44.24.16]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8255531D2; Thu, 25 Jun 2026 21:22:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782422537; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=w73Cj+3OEn79zjrHJA/TKQF7WC3Bh1T5g/kIWklZkbI=; b=KX46S800Gs+ndBHAAuErmz7qakMSa7qOz3Ms1QZ6fh0QRe/0i8p60qMMPIOFSR0NLuXixy jcvxYPGHQAJ172v9ROStRiz6Nbzpvgi6ucDigicv9FeEy76hLzw1HSkru1mFm33qLonStT OQmDSe590yzw6g7FaHESjI/TDfXwhnU= X-MC-Unique: G49GpnlDOvCAR7dl7Y6ROA-1 X-Mimecast-MFC-AGG-ID: G49GpnlDOvCAR7dl7Y6ROA_1782422535 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 26 Jun 2026 01:19:31 +0400 Subject: [PATCH v2 30/39] tests: skip HMP-dependent tests when HMP is disabled MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260626-qemu-no-hmp-v2-30-8af31bc54c61@redhat.com> References: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> In-Reply-To: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster X-Developer-Signature: v=1; a=openpgp-sha256; l=40841; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=lcjWk9njzs1OLGyvr5P8Ek+yiRi9Vqzsoi7OtJpwpgQ=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqPZtdU+kSkNnbFKrmmzJxil7kFMKhPKMhlFgb7 UtZ4zRt9uCJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaj2bXQAKCRDa6OEJdZac 5TPnD/9cTfg54eciLw32cINH/9ZsacyXPrVkDJ6d/ql95Vpfgl+hI4wCOaNafF3+gl+Ll30rkzI z8F4vmqInciIrgWYpFC1ZFF6Qpymc4HFI5QWIQtbgBwJ6ZB+pliCIv9zrRaQqFnYwhhBA6h3ORx 8LYLHdG+tNro/4VFz84R+4PDnN/KPlwm5DOI2rtXarhGUqmArUQLuLVInE69peHmS9kZbGGvCrY vbM/tm08Wx52uw2HCVZ61JNE0FxNZ4dshMchWcwji07SK5rv5SaWm3gnUYb38Ov/2OO51K9ElZH kweqWN5kAt2Hd3lHttzh/A6p5ekdeROE/aqFfGiX2rQ+d0w/EUvtqIj57H4KgWFGTSUz5Iy14D8 k/XFnkgC77L5hdU5OKVV4iF8SSll+qV9jaRQ6ud53dVY1EbijoCaKLduUWz/fJtg+Js+YldbH9b BP7AcHO1MSc/pW1KH4RuNAxuzviipPZDa6Kzsu/5zXF+zMmwp3A8f/1ymcXpifLtN+JdaXfuSD0 PoLrss83YECfcn9uNkHry40J4L1Nl2VuhJf3VQi+gQ3KuM5f9wF0gr0VTg5CPwOX1eGUtWEfDaY lMOND+iLrW8DHy8o8uriaoDYfSq+jVsa7yeuPVoN1jeDYLy0ERJ8QhXoIxC8cPWQceZOzW1WE71 KccjQWu2EPCmz8A== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 8 X-Spam_score: 0.8 X-Spam_bar: / X-Spam_report: (0.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-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: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1782422616453158500 Add runtime detection of HMP availability so tests gracefully skip instead of failing when QEMU is built without HMP support. For qtests (drive_del-test), use compile-time #ifndef CONFIG_HMP guards. For bash iotests, add _require_hmp() to common.rc that probes QEMU. For Python iotests, add _verify_hmp() and a require_hmp parameter threaded through execute_setup_common()/main()/script_initialize()/ script_main(). An earlier version of this series did an almost-complete conversion of the tests to QMP. However, this made the series even longer. I decided to post-pone it for now. Signed-off-by: Marc-Andre Lureau --- tests/qtest/drive_del-test.c | 25 ++++++++++++++++++= ++++ tests/qemu-iotests/028 | 1 + tests/qemu-iotests/045 | 3 ++- tests/qemu-iotests/051 | 1 + tests/qemu-iotests/056 | 3 ++- tests/qemu-iotests/060 | 1 + tests/qemu-iotests/068 | 1 + tests/qemu-iotests/071 | 1 + tests/qemu-iotests/081 | 1 + tests/qemu-iotests/091 | 1 + tests/qemu-iotests/093 | 3 ++- tests/qemu-iotests/102 | 1 + tests/qemu-iotests/117 | 1 + tests/qemu-iotests/119 | 1 + tests/qemu-iotests/120 | 1 + tests/qemu-iotests/124 | 3 ++- tests/qemu-iotests/130 | 1 + tests/qemu-iotests/132 | 3 ++- tests/qemu-iotests/136 | 3 ++- tests/qemu-iotests/142 | 1 + tests/qemu-iotests/145 | 1 + tests/qemu-iotests/146 | 1 + tests/qemu-iotests/148 | 3 ++- tests/qemu-iotests/151 | 3 ++- tests/qemu-iotests/152 | 3 ++- tests/qemu-iotests/153 | 1 + tests/qemu-iotests/156 | 1 + tests/qemu-iotests/157 | 1 + tests/qemu-iotests/161 | 1 + tests/qemu-iotests/165 | 3 ++- tests/qemu-iotests/172 | 1 + tests/qemu-iotests/181 | 1 + tests/qemu-iotests/185 | 1 + tests/qemu-iotests/186 | 1 + tests/qemu-iotests/192 | 1 + tests/qemu-iotests/201 | 1 + tests/qemu-iotests/216 | 3 ++- tests/qemu-iotests/225 | 1 + tests/qemu-iotests/232 | 1 + tests/qemu-iotests/236 | 3 ++- tests/qemu-iotests/245 | 3 ++- tests/qemu-iotests/246 | 3 ++- tests/qemu-iotests/249 | 1 + tests/qemu-iotests/254 | 3 ++- tests/qemu-iotests/255 | 3 ++- tests/qemu-iotests/257 | 3 ++- tests/qemu-iotests/260 | 3 ++- tests/qemu-iotests/264 | 3 ++- tests/qemu-iotests/267 | 1 + tests/qemu-iotests/274 | 3 ++- tests/qemu-iotests/280 | 1 + tests/qemu-iotests/281 | 3 ++- tests/qemu-iotests/283 | 1 + tests/qemu-iotests/286 | 1 + tests/qemu-iotests/298 | 3 ++- tests/qemu-iotests/300 | 3 ++- tests/qemu-iotests/304 | 3 ++- tests/qemu-iotests/310 | 3 ++- tests/qemu-iotests/common.rc | 8 +++++++ tests/qemu-iotests/iotests.py | 14 +++++++++++- tests/qemu-iotests/tests/backup-discard-source | 3 ++- tests/qemu-iotests/tests/copy-before-write | 3 ++- tests/qemu-iotests/tests/image-fleecing | 3 ++- tests/qemu-iotests/tests/iothreads-create | 3 ++- tests/qemu-iotests/tests/luks-detached-header | 3 ++- .../tests/migrate-bitmaps-postcopy-test | 3 ++- tests/qemu-iotests/tests/migrate-bitmaps-test | 3 ++- tests/qemu-iotests/tests/mirror-change-copy-mode | 3 ++- tests/qemu-iotests/tests/mirror-ready-cancel-error | 3 ++- tests/qemu-iotests/tests/qcow2-internal-snapshots | 1 + tests/qemu-iotests/tests/qsd-migrate | 3 ++- tests/qemu-iotests/tests/reopen-file | 3 ++- tests/qemu-iotests/tests/write-zeroes-unmap | 1 + 73 files changed, 152 insertions(+), 37 deletions(-) diff --git a/tests/qtest/drive_del-test.c b/tests/qtest/drive_del-test.c index 30d9451ddda..804f56cc58d 100644 --- a/tests/qtest/drive_del-test.c +++ b/tests/qtest/drive_del-test.c @@ -167,6 +167,11 @@ static void test_drive_without_dev(void) { QTestState *qts; =20 +#ifndef CONFIG_HMP + g_test_skip("HMP not enabled"); + return; +#endif + /* Start with an empty drive */ qts =3D qtest_init("-drive if=3Dnone,id=3Ddrive0 -M none"); =20 @@ -187,6 +192,11 @@ static void test_after_failed_device_add(void) QDict *response; QTestState *qts; =20 +#ifndef CONFIG_HMP + g_test_skip("HMP not enabled"); + return; +#endif + if (!has_device_builtin("virtio-blk")) { g_test_skip("Device virtio-blk is not available"); return; @@ -223,6 +233,11 @@ static void test_drive_del_device_del(void) { QTestState *qts; =20 +#ifndef CONFIG_HMP + g_test_skip("HMP not enabled"); + return; +#endif + if (!has_device_builtin("virtio-scsi")) { g_test_skip("Device virtio-scsi is not available"); return; @@ -397,6 +412,11 @@ static void test_drive_add_device_add_and_del(void) const char *arch =3D qtest_get_arch(); const char *machine_addition =3D ""; =20 +#ifndef CONFIG_HMP + g_test_skip("HMP not enabled"); + return; +#endif + if (!has_device_builtin("virtio-blk")) { g_test_skip("Device virtio-blk is not available"); return; @@ -424,6 +444,11 @@ static void test_drive_add_device_add_and_del_q35(void) { QTestState *qts; =20 +#ifndef CONFIG_HMP + g_test_skip("HMP not enabled"); + return; +#endif + if (!has_device_builtin("virtio-blk")) { g_test_skip("Device virtio-blk is not available"); return; diff --git a/tests/qemu-iotests/028 b/tests/qemu-iotests/028 index 2b232c46140..28f01439c52 100755 --- a/tests/qemu-iotests/028 +++ b/tests/qemu-iotests/028 @@ -49,6 +49,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt qcow2 qed _supported_proto file fuse _supported_os Linux +_require_hmp =20 # Choose a size that is not necessarily a cluster size multiple for image # formats that use clusters. This will ensure that the base image doesn't= end diff --git a/tests/qemu-iotests/045 b/tests/qemu-iotests/045 index a341f21cd70..cd1b35edb17 100755 --- a/tests/qemu-iotests/045 +++ b/tests/qemu-iotests/045 @@ -172,4 +172,5 @@ class TestSCMFd(iotests.QMPTestCase): =20 if __name__ =3D=3D '__main__': iotests.main(supported_fmts=3D['raw'], - supported_protocols=3D['file']) + supported_protocols=3D['file'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/051 b/tests/qemu-iotests/051 index 4c079b11e32..a722c0c1bc8 100755 --- a/tests/qemu-iotests/051 +++ b/tests/qemu-iotests/051 @@ -45,6 +45,7 @@ _supported_proto file _unsupported_imgopts 'refcount_bits=3D\([^1]\|.\([^6]\|$\)\)' data_file \ compression_type _require_drivers nbd +_require_hmp =20 if [ "$QEMU_DEFAULT_MACHINE" =3D "pc" ]; then _require_devices lsi53c895a diff --git a/tests/qemu-iotests/056 b/tests/qemu-iotests/056 index 808ea6b48ab..7cc97486951 100755 --- a/tests/qemu-iotests/056 +++ b/tests/qemu-iotests/056 @@ -332,4 +332,5 @@ class BackupTest(iotests.QMPTestCase): =20 if __name__ =3D=3D '__main__': iotests.main(supported_fmts=3D['qcow2', 'qed'], - supported_protocols=3D['file']) + supported_protocols=3D['file'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/060 b/tests/qemu-iotests/060 index 5cd21a6f686..8d06f84df16 100755 --- a/tests/qemu-iotests/060 +++ b/tests/qemu-iotests/060 @@ -56,6 +56,7 @@ _unsupported_imgopts 'compat=3D0.10' data_file \ =20 # The repair process will create a large file - so check for availability = first _require_large_file 64G +_require_hmp =20 rt_offset=3D65536 # 0x10000 (XXX: just an assumption) rb_offset=3D131072 # 0x20000 (XXX: just an assumption) diff --git a/tests/qemu-iotests/068 b/tests/qemu-iotests/068 index 7ecd2474093..11b660a8b7c 100755 --- a/tests/qemu-iotests/068 +++ b/tests/qemu-iotests/068 @@ -43,6 +43,7 @@ _supported_proto generic # Internal snapshots are (currently) impossible with refcount_bits=3D1, # and generally impossible with external data files _unsupported_imgopts 'compat=3D0.10' 'refcount_bits=3D1[^0-9]' data_file +_require_hmp =20 IMG_SIZE=3D128K =20 diff --git a/tests/qemu-iotests/071 b/tests/qemu-iotests/071 index 331f8cfddcf..83c4ce6314c 100755 --- a/tests/qemu-iotests/071 +++ b/tests/qemu-iotests/071 @@ -43,6 +43,7 @@ _require_drivers blkdebug blkverify # blkdebug can only inject errors on bs->file, not on the data_file, # so this test does not work with external data files _unsupported_imgopts data_file +_require_hmp =20 do_run_qemu() { diff --git a/tests/qemu-iotests/081 b/tests/qemu-iotests/081 index 1ac66f197e4..d9e729f674c 100755 --- a/tests/qemu-iotests/081 +++ b/tests/qemu-iotests/081 @@ -44,6 +44,7 @@ _supported_proto file _supported_os Linux _require_drivers quorum _require_devices virtio-scsi +_require_hmp =20 do_run_qemu() { diff --git a/tests/qemu-iotests/091 b/tests/qemu-iotests/091 index e396748a917..626203d6fc9 100755 --- a/tests/qemu-iotests/091 +++ b/tests/qemu-iotests/091 @@ -48,6 +48,7 @@ _supported_fmt qcow2 _supported_proto file fuse _supported_os Linux _supported_cache_modes writethrough none writeback +_require_hmp _default_cache_mode none writeback =20 size=3D1G diff --git a/tests/qemu-iotests/093 b/tests/qemu-iotests/093 index 4f9e224e8a8..26ae6e2b2d5 100755 --- a/tests/qemu-iotests/093 +++ b/tests/qemu-iotests/093 @@ -419,4 +419,5 @@ class ThrottleTestRemovableMedia(iotests.QMPTestCase): if __name__ =3D=3D '__main__': if 'null-co' not in iotests.supported_formats(): iotests.notrun('null-co driver support missing') - iotests.main(supported_fmts=3D["raw"]) + iotests.main(supported_fmts=3D["raw"], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/102 b/tests/qemu-iotests/102 index 141bfe1e902..5db8180d3bb 100755 --- a/tests/qemu-iotests/102 +++ b/tests/qemu-iotests/102 @@ -41,6 +41,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 =20 _supported_fmt qcow2 _supported_proto file fuse +_require_hmp =20 IMG_SIZE=3D64K =20 diff --git a/tests/qemu-iotests/117 b/tests/qemu-iotests/117 index 6081473584f..5cc9433f4a6 100755 --- a/tests/qemu-iotests/117 +++ b/tests/qemu-iotests/117 @@ -41,6 +41,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 =20 _supported_fmt qcow2 _supported_proto file fuse +_require_hmp =20 _make_test_img 64k =20 diff --git a/tests/qemu-iotests/119 b/tests/qemu-iotests/119 index 6cac8793bac..ce1b62521f5 100755 --- a/tests/qemu-iotests/119 +++ b/tests/qemu-iotests/119 @@ -41,6 +41,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt raw _supported_proto nbd _supported_os Linux +_require_hmp =20 _make_test_img 64M # This should not crash diff --git a/tests/qemu-iotests/120 b/tests/qemu-iotests/120 index ac7bd8c4e3c..e4ed87e1a70 100755 --- a/tests/qemu-iotests/120 +++ b/tests/qemu-iotests/120 @@ -42,6 +42,7 @@ _supported_fmt generic _supported_proto file fuse _unsupported_fmt luks _require_drivers raw +_require_hmp =20 _make_test_img 64M =20 diff --git a/tests/qemu-iotests/124 b/tests/qemu-iotests/124 index b2f4328e345..ab9ea4d8b59 100755 --- a/tests/qemu-iotests/124 +++ b/tests/qemu-iotests/124 @@ -750,4 +750,5 @@ class TestIncrementalBackupBlkdebug(TestIncrementalBack= upBase): =20 if __name__ =3D=3D '__main__': iotests.main(supported_fmts=3D['qcow2'], - supported_protocols=3D['file']) + supported_protocols=3D['file'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/130 b/tests/qemu-iotests/130 index 7af85d20a89..3d10aba2594 100755 --- a/tests/qemu-iotests/130 +++ b/tests/qemu-iotests/130 @@ -46,6 +46,7 @@ _supported_proto file _supported_os Linux # We are going to use lazy-refcounts _unsupported_imgopts 'compat=3D0.10' +_require_hmp =20 qemu_comm_method=3D"monitor" =20 diff --git a/tests/qemu-iotests/132 b/tests/qemu-iotests/132 index 12a64b3d95a..3756573a57c 100755 --- a/tests/qemu-iotests/132 +++ b/tests/qemu-iotests/132 @@ -57,4 +57,5 @@ class TestSingleDrive(iotests.QMPTestCase): =20 if __name__ =3D=3D '__main__': iotests.main(supported_fmts=3D['raw', 'qcow2'], - supported_protocols=3D['file']) + supported_protocols=3D['file'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/136 b/tests/qemu-iotests/136 index 58df876bafc..72fd638aa04 100755 --- a/tests/qemu-iotests/136 +++ b/tests/qemu-iotests/136 @@ -410,4 +410,5 @@ class BlockDeviceStatsTestCoroutine(BlockDeviceStatsTes= tCase): if __name__ =3D=3D '__main__': if 'null-co' not in iotests.supported_formats(): iotests.notrun('null-co driver support missing') - iotests.main(supported_fmts=3D["raw"]) + iotests.main(supported_fmts=3D["raw"], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/142 b/tests/qemu-iotests/142 index 86d65a2d1a1..8538a727ac0 100755 --- a/tests/qemu-iotests/142 +++ b/tests/qemu-iotests/142 @@ -43,6 +43,7 @@ _supported_proto file # We test all cache modes anyway, but O_DIRECT needs to be supported _default_cache_mode none _supported_cache_modes none directsync +_require_hmp =20 do_run_qemu() { diff --git a/tests/qemu-iotests/145 b/tests/qemu-iotests/145 index a2ce92516dc..f61a50f6395 100755 --- a/tests/qemu-iotests/145 +++ b/tests/qemu-iotests/145 @@ -40,6 +40,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 =20 _supported_fmt generic _supported_proto generic +_require_hmp =20 _make_test_img 1M =20 diff --git a/tests/qemu-iotests/146 b/tests/qemu-iotests/146 index 661a9d2625c..f63291d0ffb 100755 --- a/tests/qemu-iotests/146 +++ b/tests/qemu-iotests/146 @@ -42,6 +42,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt vpc _supported_proto file _supported_os Linux +_require_hmp =20 =20 qemu_comm_method=3D"monitor" diff --git a/tests/qemu-iotests/148 b/tests/qemu-iotests/148 index 7ccbde4633c..4b092dccb7c 100755 --- a/tests/qemu-iotests/148 +++ b/tests/qemu-iotests/148 @@ -140,4 +140,5 @@ class TestFifoQuorumEvents(TestQuorumEvents): if __name__ =3D=3D '__main__': iotests.verify_quorum() iotests.main(supported_fmts=3D["raw"], - supported_protocols=3D["file"]) + supported_protocols=3D["file"], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/151 b/tests/qemu-iotests/151 index 647194094a4..204221a5738 100755 --- a/tests/qemu-iotests/151 +++ b/tests/qemu-iotests/151 @@ -434,4 +434,5 @@ class TestHighThrottledWithNbdExport(TestThrottledWithN= bdExportBase): =20 if __name__ =3D=3D '__main__': iotests.main(supported_fmts=3D['qcow2', 'raw'], - supported_protocols=3D['file']) + supported_protocols=3D['file'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/152 b/tests/qemu-iotests/152 index 197bea9e778..d9170359213 100755 --- a/tests/qemu-iotests/152 +++ b/tests/qemu-iotests/152 @@ -61,4 +61,5 @@ class TestUnaligned(iotests.QMPTestCase): =20 if __name__ =3D=3D '__main__': iotests.main(supported_fmts=3D['raw', 'qcow2'], - supported_protocols=3D['file']) + supported_protocols=3D['file'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/153 b/tests/qemu-iotests/153 index 1e02f6a6e34..def01d6f3ea 100755 --- a/tests/qemu-iotests/153 +++ b/tests/qemu-iotests/153 @@ -59,6 +59,7 @@ _check_ofd || _notrun "OFD lock not available" =20 _supported_fmt qcow2 _supported_proto file +_require_hmp =20 _run_cmd() { diff --git a/tests/qemu-iotests/156 b/tests/qemu-iotests/156 index 97c2d86ce57..a0e4d1ffd42 100755 --- a/tests/qemu-iotests/156 +++ b/tests/qemu-iotests/156 @@ -53,6 +53,7 @@ _supported_fmt qcow2 qed _supported_proto file # Copying files around with cp does not work with external data files _unsupported_imgopts data_file +_require_hmp =20 # Create source disk TEST_IMG=3D"$TEST_IMG.backing" _make_test_img 1M diff --git a/tests/qemu-iotests/157 b/tests/qemu-iotests/157 index aa2ebbfb4b4..531dbd3122b 100755 --- a/tests/qemu-iotests/157 +++ b/tests/qemu-iotests/157 @@ -41,6 +41,7 @@ _supported_fmt generic _supported_proto file =20 _require_devices virtio-blk +_require_hmp =20 do_run_qemu() { diff --git a/tests/qemu-iotests/161 b/tests/qemu-iotests/161 index f25effab936..8ca13926297 100755 --- a/tests/qemu-iotests/161 +++ b/tests/qemu-iotests/161 @@ -45,6 +45,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt qcow2 qed _supported_proto file fuse _supported_os Linux +_require_hmp =20 IMG_SIZE=3D1M =20 diff --git a/tests/qemu-iotests/165 b/tests/qemu-iotests/165 index b3b1709d71f..8fc79daae16 100755 --- a/tests/qemu-iotests/165 +++ b/tests/qemu-iotests/165 @@ -154,4 +154,5 @@ class TestPersistentDirtyBitmap(iotests.QMPTestCase): if __name__ =3D=3D '__main__': iotests.main(supported_fmts=3D['qcow2'], supported_protocols=3D['file'], - unsupported_imgopts=3D['compat']) + unsupported_imgopts=3D['compat'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/172 b/tests/qemu-iotests/172 index 4da0e0f2e29..a78e42ff0ad 100755 --- a/tests/qemu-iotests/172 +++ b/tests/qemu-iotests/172 @@ -42,6 +42,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt qcow2 _supported_proto file _supported_os Linux +_require_hmp =20 if [ "$QEMU_DEFAULT_MACHINE" !=3D "pc" ]; then _notrun "Requires a PC machine" diff --git a/tests/qemu-iotests/181 b/tests/qemu-iotests/181 index b904e8ce012..458cb737f1c 100755 --- a/tests/qemu-iotests/181 +++ b/tests/qemu-iotests/181 @@ -47,6 +47,7 @@ _supported_fmt generic _unsupported_fmt qcow vdi vhdx vmdk vpc vvfat parallels _supported_proto generic _supported_os Linux +_require_hmp =20 _flaky_test https://gitlab.com/qemu-project/qemu/-/work_items/3515 =20 diff --git a/tests/qemu-iotests/185 b/tests/qemu-iotests/185 index a62ae8d3293..bb577a9cc99 100755 --- a/tests/qemu-iotests/185 +++ b/tests/qemu-iotests/185 @@ -50,6 +50,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt qcow2 _supported_proto file _supported_os Linux +_require_hmp _flaky_test https://gitlab.com/qemu-project/qemu/-/issues/3270 =20 size=3D$((64 * 1048576)) diff --git a/tests/qemu-iotests/186 b/tests/qemu-iotests/186 index eaf13c7a334..9a4215d28e9 100755 --- a/tests/qemu-iotests/186 +++ b/tests/qemu-iotests/186 @@ -41,6 +41,7 @@ _supported_fmt qcow2 _supported_proto file fuse _require_drivers null-co _require_devices virtio-scsi-pci +_require_hmp =20 if [ "$QEMU_DEFAULT_MACHINE" !=3D "pc" ]; then _notrun "Requires a PC machine" diff --git a/tests/qemu-iotests/192 b/tests/qemu-iotests/192 index e66e1a4f06a..6869bd17153 100755 --- a/tests/qemu-iotests/192 +++ b/tests/qemu-iotests/192 @@ -43,6 +43,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 =20 _supported_fmt generic _supported_proto file +_require_hmp =20 if [ "$QEMU_DEFAULT_MACHINE" !=3D "pc" ]; then _notrun "Requires a PC machine" diff --git a/tests/qemu-iotests/201 b/tests/qemu-iotests/201 index 1b8eb51d8f3..a5c750c38a8 100755 --- a/tests/qemu-iotests/201 +++ b/tests/qemu-iotests/201 @@ -47,6 +47,7 @@ _supported_os Linux # Internal snapshots are (currently) impossible with refcount_bits=3D1, # and generally impossible with external data files _unsupported_imgopts 'refcount_bits=3D1[^0-9]' data_file +_require_hmp =20 size=3D64M _make_test_img $size diff --git a/tests/qemu-iotests/216 b/tests/qemu-iotests/216 index 311e02af3a7..4eabada9b35 100755 --- a/tests/qemu-iotests/216 +++ b/tests/qemu-iotests/216 @@ -25,7 +25,8 @@ from iotests import log, qemu_img, qemu_io =20 # Need backing file support iotests.script_initialize(supported_fmts=3D['qcow2', 'qcow', 'qed', 'vmdk'= ], - supported_platforms=3D['linux']) + supported_platforms=3D['linux'], + require_hmp=3DTrue) =20 log('') log('=3D=3D=3D Copy-on-read across nodes =3D=3D=3D') diff --git a/tests/qemu-iotests/225 b/tests/qemu-iotests/225 index b5949fcb58e..8128d583d60 100755 --- a/tests/qemu-iotests/225 +++ b/tests/qemu-iotests/225 @@ -46,6 +46,7 @@ _supported_os Linux _unsupported_imgopts "subformat=3DmonolithicFlat" \ "subformat=3DtwoGbMaxExtentFlat" \ "subformat=3DtwoGbMaxExtentSparse" +_require_hmp =20 TEST_IMG=3D"$TEST_IMG.base" _make_test_img 1M TEST_IMG=3D"$TEST_IMG.not_base" _make_test_img 1M diff --git a/tests/qemu-iotests/232 b/tests/qemu-iotests/232 index b30faaa2180..1ee0aae481d 100755 --- a/tests/qemu-iotests/232 +++ b/tests/qemu-iotests/232 @@ -43,6 +43,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt generic _supported_proto file _supported_os Linux +_require_hmp =20 do_run_qemu() { diff --git a/tests/qemu-iotests/236 b/tests/qemu-iotests/236 index 20419bbb9e5..3cf0de4043f 100755 --- a/tests/qemu-iotests/236 +++ b/tests/qemu-iotests/236 @@ -23,7 +23,8 @@ import iotests from iotests import log =20 -iotests.script_initialize(supported_fmts=3D['generic']) +iotests.script_initialize(supported_fmts=3D['generic'], + require_hmp=3DTrue) size =3D 64 * 1024 * 1024 granularity =3D 64 * 1024 =20 diff --git a/tests/qemu-iotests/245 b/tests/qemu-iotests/245 index f96610f5109..af08bcf0c96 100755 --- a/tests/qemu-iotests/245 +++ b/tests/qemu-iotests/245 @@ -1160,4 +1160,5 @@ class TestBlockdevReopen(iotests.QMPTestCase): if __name__ =3D=3D '__main__': iotests.activate_logging() iotests.main(supported_fmts=3D["qcow2"], - supported_protocols=3D["file"]) + supported_protocols=3D["file"], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/246 b/tests/qemu-iotests/246 index b009a783977..cee5131c3ce 100755 --- a/tests/qemu-iotests/246 +++ b/tests/qemu-iotests/246 @@ -24,7 +24,8 @@ import iotests from iotests import log =20 iotests.script_initialize(supported_fmts=3D['qcow2'], - unsupported_imgopts=3D['compat']) + unsupported_imgopts=3D['compat'], + require_hmp=3DTrue) size =3D 64 * 1024 * 1024 * 1024 gran_small =3D 32 * 1024 gran_large =3D 128 * 1024 diff --git a/tests/qemu-iotests/249 b/tests/qemu-iotests/249 index 28bffd4d571..1254bf94291 100755 --- a/tests/qemu-iotests/249 +++ b/tests/qemu-iotests/249 @@ -45,6 +45,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt qcow2 qed _supported_proto file fuse _supported_os Linux +_require_hmp =20 IMG_SIZE=3D1M =20 diff --git a/tests/qemu-iotests/254 b/tests/qemu-iotests/254 index 7ea098818cf..d3d18a1bbf1 100755 --- a/tests/qemu-iotests/254 +++ b/tests/qemu-iotests/254 @@ -23,7 +23,8 @@ import iotests from iotests import qemu_img_create, file_path, log =20 iotests.script_initialize(supported_fmts=3D['qcow2'], - unsupported_imgopts=3D['compat']) + unsupported_imgopts=3D['compat'], + require_hmp=3DTrue) =20 disk, top =3D file_path('disk', 'top') size =3D 1024 * 1024 diff --git a/tests/qemu-iotests/255 b/tests/qemu-iotests/255 index 88b29d64b44..8f88522f1e9 100755 --- a/tests/qemu-iotests/255 +++ b/tests/qemu-iotests/255 @@ -24,7 +24,8 @@ import iotests from iotests import imgfmt =20 -iotests.script_initialize(supported_fmts=3D['qcow2']) +iotests.script_initialize(supported_fmts=3D['qcow2'], + require_hmp=3DTrue) =20 iotests.log('Finishing a commit job with background reads') iotests.log('=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D') diff --git a/tests/qemu-iotests/257 b/tests/qemu-iotests/257 index cd0468aaa16..5e4dba02e76 100755 --- a/tests/qemu-iotests/257 +++ b/tests/qemu-iotests/257 @@ -533,4 +533,5 @@ def main(): =20 if __name__ =3D=3D '__main__': iotests.script_main(main, supported_fmts=3D['qcow2'], - supported_protocols=3D['file']) + supported_protocols=3D['file'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/260 b/tests/qemu-iotests/260 index c2133f99801..65165446607 100755 --- a/tests/qemu-iotests/260 +++ b/tests/qemu-iotests/260 @@ -24,7 +24,8 @@ from iotests import qemu_img_create, file_path, log, filt= er_qmp_event =20 iotests.script_initialize( supported_fmts=3D['qcow2'], - unsupported_imgopts=3D['compat'] + unsupported_imgopts=3D['compat'], + require_hmp=3DTrue, ) =20 base, top =3D file_path('base', 'top') diff --git a/tests/qemu-iotests/264 b/tests/qemu-iotests/264 index c6ba2754e27..b621f11ab42 100755 --- a/tests/qemu-iotests/264 +++ b/tests/qemu-iotests/264 @@ -114,4 +114,5 @@ class TestNbdReconnect(iotests.QMPTestCase): =20 =20 if __name__ =3D=3D '__main__': - iotests.main(supported_fmts=3D['qcow2']) + iotests.main(supported_fmts=3D['qcow2'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/267 b/tests/qemu-iotests/267 index 2e2afdad9c5..e14aeb1f18d 100755 --- a/tests/qemu-iotests/267 +++ b/tests/qemu-iotests/267 @@ -48,6 +48,7 @@ _require_drivers copy-on-read _unsupported_imgopts 'refcount_bits=3D1[^0-9]' data_file =20 _require_devices virtio-blk +_require_hmp =20 do_run_qemu() { diff --git a/tests/qemu-iotests/274 b/tests/qemu-iotests/274 index 2495e051a22..d91c11c70d2 100755 --- a/tests/qemu-iotests/274 +++ b/tests/qemu-iotests/274 @@ -24,7 +24,8 @@ import iotests =20 iotests.script_initialize(supported_fmts=3D['qcow2'], supported_platforms=3D['linux'], - unsupported_imgopts=3D['refcount_bits', 'compat'= ]) + unsupported_imgopts=3D['refcount_bits', 'compat'= ], + require_hmp=3DTrue) =20 size_short =3D 1 * 1024 * 1024 size_long =3D 2 * 1024 * 1024 diff --git a/tests/qemu-iotests/280 b/tests/qemu-iotests/280 index 5f50500fdb8..8f4750de074 100755 --- a/tests/qemu-iotests/280 +++ b/tests/qemu-iotests/280 @@ -27,6 +27,7 @@ iotests.script_initialize( supported_fmts=3D['qcow2'], supported_protocols=3D['file'], supported_platforms=3D['linux'], + require_hmp=3DTrue, ) =20 with iotests.FilePath('base') as base_path , \ diff --git a/tests/qemu-iotests/281 b/tests/qemu-iotests/281 index f6746a12e88..5f3050f50d0 100755 --- a/tests/qemu-iotests/281 +++ b/tests/qemu-iotests/281 @@ -336,4 +336,5 @@ class TestYieldingAndTimers(iotests.QMPTestCase): if __name__ =3D=3D '__main__': iotests.main(supported_fmts=3D['qcow2'], supported_protocols=3D['file'], - unsupported_imgopts=3D['compat']) + unsupported_imgopts=3D['compat'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/283 b/tests/qemu-iotests/283 index 5defe48e97d..6d341d3e974 100755 --- a/tests/qemu-iotests/283 +++ b/tests/qemu-iotests/283 @@ -24,6 +24,7 @@ import iotests # The test is unrelated to formats, restrict it to qcow2 to avoid extra ru= ns iotests.script_initialize( supported_fmts=3D['qcow2'], + require_hmp=3DTrue, ) =20 size =3D 1024 * 1024 diff --git a/tests/qemu-iotests/286 b/tests/qemu-iotests/286 index cc6aacf0228..3b030ec58aa 100755 --- a/tests/qemu-iotests/286 +++ b/tests/qemu-iotests/286 @@ -40,6 +40,7 @@ _supported_proto file fuse # Internal snapshots are (currently) impossible with refcount_bits=3D1, # and generally impossible with external data files _unsupported_imgopts 'refcount_bits=3D1[^0-9]' data_file +_require_hmp =20 _make_test_img 64M =20 diff --git a/tests/qemu-iotests/298 b/tests/qemu-iotests/298 index 09c9290711a..f2b94077f43 100755 --- a/tests/qemu-iotests/298 +++ b/tests/qemu-iotests/298 @@ -177,4 +177,5 @@ class TestTruncate(iotests.QMPTestCase): =20 =20 if __name__ =3D=3D '__main__': - iotests.main(supported_fmts=3D['qcow2'], required_fmts=3D['preallocate= ']) + iotests.main(supported_fmts=3D['qcow2'], required_fmts=3D['preallocate= '], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/300 b/tests/qemu-iotests/300 index e46616d7b19..df2ba326327 100755 --- a/tests/qemu-iotests/300 +++ b/tests/qemu-iotests/300 @@ -683,4 +683,5 @@ class TestAliasTransformMigration(TestDirtyBitmapMigrat= ion): self.verify_dest_error(None) =20 if __name__ =3D=3D '__main__': - iotests.main(supported_protocols=3D['file']) + iotests.main(supported_protocols=3D['file'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/304 b/tests/qemu-iotests/304 index 198f2820871..d465a519a93 100755 --- a/tests/qemu-iotests/304 +++ b/tests/qemu-iotests/304 @@ -24,7 +24,8 @@ import iotests from iotests import qemu_img_create, qemu_img_log, file_path =20 iotests.script_initialize(supported_fmts=3D['qcow2'], - supported_protocols=3D['file']) + supported_protocols=3D['file'], + require_hmp=3DTrue) =20 test_img =3D file_path('test.qcow2') target_img =3D file_path('target.qcow2') diff --git a/tests/qemu-iotests/310 b/tests/qemu-iotests/310 index 650d2cb6fb3..7f290898fea 100755 --- a/tests/qemu-iotests/310 +++ b/tests/qemu-iotests/310 @@ -25,7 +25,8 @@ from iotests import log, qemu_img, qemu_io =20 # Need backing file support iotests.script_initialize(supported_fmts=3D['qcow2'], - supported_platforms=3D['linux']) + supported_platforms=3D['linux'], + require_hmp=3DTrue) =20 log('') log('=3D=3D=3D Copy-on-read across nodes =3D=3D=3D') diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc index 298bc483e0c..7dd4f6e0d8e 100644 --- a/tests/qemu-iotests/common.rc +++ b/tests/qemu-iotests/common.rc @@ -981,6 +981,14 @@ _require_drivers() done } =20 +_require_hmp() +{ + if echo quit | $QEMU -M none -display none -monitor stdio 2>&1 | + grep -q "HMP monitor is not available"; then + _notrun "HMP monitor not available" + fi +} + # Check that we have a file system that allows huge (but very sparse) files # _require_large_file() diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index f36bcf31642..7d5a77a85e5 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -1456,6 +1456,15 @@ def _verify_formats(required_formats: Sequence[str] = =3D ()) -> None: notrun(f'formats {usf_list} are not whitelisted') =20 =20 +def _verify_hmp() -> None: + args =3D [qemu_prog] + qemu_opts + ['-M', 'none', '-monitor', 'stdio'] + with subprocess.Popen(args, stdin=3Dsubprocess.PIPE, + stdout=3Dsubprocess.PIPE, stderr=3Dsubprocess.ST= DOUT, + universal_newlines=3DTrue) as subp: + out, _ =3D subp.communicate('quit\n') + if 'HMP monitor is not available' in out: + notrun('HMP monitor not available') + def _verify_virtio_blk() -> None: out =3D qemu_pipe('-M', 'none', '-device', 'help') if 'virtio-blk' not in out: @@ -1694,7 +1703,8 @@ def execute_setup_common(supported_fmts: Sequence[str= ] =3D (), supported_protocols: Sequence[str] =3D (), unsupported_protocols: Sequence[str] =3D (), required_fmts: Sequence[str] =3D (), - unsupported_imgopts: Sequence[str] =3D ()) -> boo= l: + unsupported_imgopts: Sequence[str] =3D (), + require_hmp: bool =3D False) -> bool: """ Perform necessary setup for either script-style or unittest-style test= s. =20 @@ -1715,6 +1725,8 @@ def execute_setup_common(supported_fmts: Sequence[str= ] =3D (), _verify_formats(required_fmts) _verify_virtio_blk() _verify_imgopts(unsupported_imgopts) + if require_hmp: + _verify_hmp() =20 return debug =20 diff --git a/tests/qemu-iotests/tests/backup-discard-source b/tests/qemu-io= tests/tests/backup-discard-source index 6c624bc8b0b..80ea32c46e3 100755 --- a/tests/qemu-iotests/tests/backup-discard-source +++ b/tests/qemu-iotests/tests/backup-discard-source @@ -160,4 +160,5 @@ class TestBackup(iotests.QMPTestCase): =20 if __name__ =3D=3D '__main__': iotests.main(supported_fmts=3D['qcow2'], - supported_protocols=3D['file']) + supported_protocols=3D['file'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/tests/copy-before-write b/tests/qemu-iotest= s/tests/copy-before-write index 3e43e7127f2..5531ad8a4c0 100755 --- a/tests/qemu-iotests/tests/copy-before-write +++ b/tests/qemu-iotests/tests/copy-before-write @@ -321,4 +321,5 @@ wrote 524288/524288 bytes at offset 524288 if __name__ =3D=3D '__main__': iotests.main(supported_fmts=3D['qcow2'], supported_protocols=3D['file'], - required_fmts=3D['copy-before-write']) + required_fmts=3D['copy-before-write'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/tests/image-fleecing b/tests/qemu-iotests/t= ests/image-fleecing index 5e3b2c7e46a..b42aa6967f6 100755 --- a/tests/qemu-iotests/tests/image-fleecing +++ b/tests/qemu-iotests/tests/image-fleecing @@ -31,7 +31,8 @@ iotests.script_initialize( supported_fmts=3D['qcow2'], supported_platforms=3D['linux'], required_fmts=3D['copy-before-write'], - unsupported_imgopts=3D['compat'] + unsupported_imgopts=3D['compat'], + require_hmp=3DTrue, ) =20 patterns =3D [('0x5d', '0', '64k'), diff --git a/tests/qemu-iotests/tests/iothreads-create b/tests/qemu-iotests= /tests/iothreads-create index 0c862d73f20..09fe57a09ac 100755 --- a/tests/qemu-iotests/tests/iothreads-create +++ b/tests/qemu-iotests/tests/iothreads-create @@ -22,7 +22,8 @@ import asyncio import iotests =20 iotests.script_initialize(supported_fmts=3D['qcow2', 'qcow', 'qed', 'vdi', - 'vmdk', 'parallels']) + 'vmdk', 'parallels'], + require_hmp=3DTrue) iotests.verify_virtio_scsi_pci_or_ccw() =20 with iotests.FilePath('disk.img') as img_path, \ diff --git a/tests/qemu-iotests/tests/luks-detached-header b/tests/qemu-iot= ests/tests/luks-detached-header index 3455fd8de1e..58eb3c2cc48 100755 --- a/tests/qemu-iotests/tests/luks-detached-header +++ b/tests/qemu-iotests/tests/luks-detached-header @@ -313,4 +313,5 @@ class TestDetachedLUKSHeader(QMPTestCase): =20 if __name__ =3D=3D "__main__": # Test image creation and I/O - iotests.main(supported_fmts=3D["luks"], supported_protocols=3D["file"]) + iotests.main(supported_fmts=3D["luks"], supported_protocols=3D["file"], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/tests/migrate-bitmaps-postcopy-test b/tests= /qemu-iotests/tests/migrate-bitmaps-postcopy-test index c519e6db8c7..9014c2a19e2 100755 --- a/tests/qemu-iotests/tests/migrate-bitmaps-postcopy-test +++ b/tests/qemu-iotests/tests/migrate-bitmaps-postcopy-test @@ -266,4 +266,5 @@ class TestDirtyBitmapPostcopyMigration(iotests.QMPTestC= ase): =20 if __name__ =3D=3D '__main__': iotests.main(supported_fmts=3D['qcow2'], - unsupported_imgopts=3D['compat']) + unsupported_imgopts=3D['compat'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/tests/migrate-bitmaps-test b/tests/qemu-iot= ests/tests/migrate-bitmaps-test index 8fb4099201d..7b0e709f9b4 100755 --- a/tests/qemu-iotests/tests/migrate-bitmaps-test +++ b/tests/qemu-iotests/tests/migrate-bitmaps-test @@ -296,7 +296,8 @@ def main() -> None: iotests.main( supported_fmts=3D['qcow2'], supported_protocols=3D['file'], - unsupported_imgopts=3D['compat'] + unsupported_imgopts=3D['compat'], + require_hmp=3DTrue, ) =20 =20 diff --git a/tests/qemu-iotests/tests/mirror-change-copy-mode b/tests/qemu-= iotests/tests/mirror-change-copy-mode index 51788b85c7a..c9c345f1397 100755 --- a/tests/qemu-iotests/tests/mirror-change-copy-mode +++ b/tests/qemu-iotests/tests/mirror-change-copy-mode @@ -190,4 +190,5 @@ class TestMirrorChangeCopyMode(iotests.QMPTestCase): =20 if __name__ =3D=3D '__main__': iotests.main(supported_fmts=3D['qcow2', 'raw'], - supported_protocols=3D['file']) + supported_protocols=3D['file'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/tests/mirror-ready-cancel-error b/tests/qem= u-iotests/tests/mirror-ready-cancel-error index ed2e46447e3..ffa045af219 100755 --- a/tests/qemu-iotests/tests/mirror-ready-cancel-error +++ b/tests/qemu-iotests/tests/mirror-ready-cancel-error @@ -139,4 +139,5 @@ if __name__ =3D=3D '__main__': # LUKS would require special key-secret handling in add_blockdevs() iotests.main(supported_fmts=3D['generic'], unsupported_fmts=3D['luks'], - supported_protocols=3D['file']) + supported_protocols=3D['file'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/tests/qcow2-internal-snapshots b/tests/qemu= -iotests/tests/qcow2-internal-snapshots index 9f83aa89039..d301f0941b5 100755 --- a/tests/qemu-iotests/tests/qcow2-internal-snapshots +++ b/tests/qemu-iotests/tests/qcow2-internal-snapshots @@ -43,6 +43,7 @@ _supported_proto file # Internal snapshots are (currently) impossible with refcount_bits=3D1, # and generally impossible with external data files _unsupported_imgopts 'compat=3D0.10' 'refcount_bits=3D1[^0-9]' data_file +_require_hmp =20 IMG_SIZE=3D64M =20 diff --git a/tests/qemu-iotests/tests/qsd-migrate b/tests/qemu-iotests/test= s/qsd-migrate index a4c6592420c..d76278b576c 100755 --- a/tests/qemu-iotests/tests/qsd-migrate +++ b/tests/qemu-iotests/tests/qsd-migrate @@ -24,7 +24,8 @@ from iotests import filter_qemu_io, filter_qtest =20 iotests.script_initialize(supported_fmts=3D['qcow2', 'qed', 'raw'], supported_protocols=3D['file'], - supported_platforms=3D['linux']) + supported_platforms=3D['linux'], + require_hmp=3DTrue) =20 with iotests.FilePath('disk.img') as path, \ iotests.FilePath('nbd-src.sock', base_dir=3Diotests.sock_dir) as nbd_= src, \ diff --git a/tests/qemu-iotests/tests/reopen-file b/tests/qemu-iotests/test= s/reopen-file index 5a50794ffc4..f8812320ea8 100755 --- a/tests/qemu-iotests/tests/reopen-file +++ b/tests/qemu-iotests/tests/reopen-file @@ -85,4 +85,5 @@ if __name__ =3D=3D '__main__': # Must support creating images and reopen iotests.main(supported_fmts=3D['qcow', 'qcow2', 'qed', 'raw', 'vdi', '= vhdx', 'vmdk', 'vpc'], - supported_protocols=3D['file']) + supported_protocols=3D['file'], + require_hmp=3DTrue) diff --git a/tests/qemu-iotests/tests/write-zeroes-unmap b/tests/qemu-iotes= ts/tests/write-zeroes-unmap index f90fb8e8d27..506ced647bc 100755 --- a/tests/qemu-iotests/tests/write-zeroes-unmap +++ b/tests/qemu-iotests/tests/write-zeroes-unmap @@ -33,6 +33,7 @@ _supported_fmt raw _supported_proto file _supported_os Linux _require_disk_usage +_require_hmp =20 create_test_image() { _make_test_img -f $IMGFMT 1m --=20 2.54.0 From nobody Sun Jul 26 11:53:26 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782422582; cv=none; d=zohomail.com; s=zohoarc; b=IpqwwGSc7XdrHLm28N/31vLsZXTJ4PITVWe8A2hudFZzOk3slDZU1bdS7mK5LELRLq8rXTRzkBncC6S9mGqYPGWEy6N6EaFJAzg69EZxVMhUgatT1pq+9TjOxfgcvN4x3UanvvrSPU5qw79Rq4GE0+Y2MEu6R9xoLLV63l8tK2E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782422582; 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=fEpLNtezLZ5gi9gc6tBA5aF7JHFme/l1NsetAdVdzOU=; b=lTtOgbPjOGEij6fJmX56bgJvtd27hBjZyYRhld3bH4XhgUW4H2/y8jMb7UB9aANyPnCNS/Bzk/Qb2XSW3Odb3vLul1BJzqbE3q6OaByRcfmxb3miMw7yIQDBaDggI7q/ijs+ZKxM/IOf5cx6O7l3LzQR5xnq91CK9udZ7ZRLrGE= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1782422582002560.8125960539744; Thu, 25 Jun 2026 14:23:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wcrWm-000773-IF; Thu, 25 Jun 2026 17:22:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrWk-00071n-Fj for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:22:26 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrWi-00041V-Qi for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:22:26 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-180-j7KBVDziOHyqtkD-dyaJIw-1; Thu, 25 Jun 2026 17:22:21 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 13451185FC5C; Thu, 25 Jun 2026 21:22:20 +0000 (UTC) Received: from localhost (unknown [10.44.24.16]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D2D6C30001BE; Thu, 25 Jun 2026 21:22:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782422544; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fEpLNtezLZ5gi9gc6tBA5aF7JHFme/l1NsetAdVdzOU=; b=OkcmTMTosLaNholxmeiBjGfvRimp/0funMbbD7YbENNom0P5O80Ob+/tBEb8exBUztNxp7 bPoz5dzpLfw//hoQryxJWJBLxebJTNengl2lkbC6knej7/EXqUqH+ADSPj9Qe7sA3GIl26 FLA60ZDyaa4b8HL9FVLGxXxXsHJvUyE= X-MC-Unique: j7KBVDziOHyqtkD-dyaJIw-1 X-Mimecast-MFC-AGG-ID: j7KBVDziOHyqtkD-dyaJIw_1782422540 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 26 Jun 2026 01:19:32 +0400 Subject: [PATCH v2 31/39] util: guard monitor_vprintf callers with CONFIG_HMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260626-qemu-no-hmp-v2-31-8af31bc54c61@redhat.com> References: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> In-Reply-To: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster X-Developer-Signature: v=1; a=openpgp-sha256; l=3044; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=HwWHsZFMKZdWXTYjOmgerggdHu8TDi5XpVZ7v+nyDlk=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqPZteeCm0gKmQ12qklaBF9GyVLpZSjexlVIxFt 5XZ9V3TjB2JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaj2bXgAKCRDa6OEJdZac 5dUcD/42ygnbSspFamHFW6w0RVngWqKxe1uHVu+McRl+5omXH1RHMnGpHNyb7djnrkrJtu3OzJL LQoELuS6W7j9OGx5wce/EMh9llOlq6AOby3JU5P0PtCSYEmVkmceW1Rh/V6uTMR/8uVnryTPye6 AuCu+61A0zZZOchGA0Q14p6g8MryIzwt6UgGW8oJoaljRZwZPL5hiovOJlOhx88YfUrjuheco2m aohzwhHPIPyutF65cS7uPfOfMLCUIOhNomYOnVev4JZDKZs0Lna9BeYblb0PBMboHXEgtQCIpSy wmWEcWasH9M2xnJU54LX5gv9++4LUmg7+bDfNl6Qi+rw8tQK7XfS0oz32LHPcjxYMf/GrZTG3Fh kG7XbPGTB/2FPFHXHuPEbMxFC9TlPjWgiWX3I9aF5ef9CWAEcwmVLI15HSzeBmvPRYlHMQzLCQU 1Tb5ibq23BCvdk6wmeO2U/iIllb8caWKmIFixo3VV0QBXL1XgCIzjWYRvONTBX8ungBiTpwDrVT LTd8z7Jf+gybgp+nrGnf8EVdkG7lpyxZo//NCdsbxBgBjHX3ZjXS9WEk0qEWqKRf38rYP7vu6ck og8c0Yz4zussZW3d7AJoXs0c7kaidZvYIOedtKb2txw+uxVJio0sKiWxQWd2BC5jib9ygE/eLry dHxpfk8f/69eV5w== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1782422588057158500 Guard calls to monitor_vprintf in error-report and qemu-print so they compile without HMP. When CONFIG_HMP is not set, error_vprintf_mon falls back directly to stderr and qemu_vfprintf returns -1 for NULL streams. Signed-off-by: Marc-Andr=C3=A9 Lureau --- tests/unit/test-util-sockets.c | 4 +++- tools/qemu-vnc/stubs.c | 2 ++ util/error-report.c | 8 +++++--- util/qemu-print.c | 6 ++++++ 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/tests/unit/test-util-sockets.c b/tests/unit/test-util-sockets.c index b9f2453e299..23ebe1e26b5 100644 --- a/tests/unit/test-util-sockets.c +++ b/tests/unit/test-util-sockets.c @@ -73,8 +73,10 @@ int monitor_get_fd(Monitor *mon, const char *fdname, Err= or **errp) */ Monitor *monitor_cur(void) { return cur_mon; } Monitor *monitor_set_cur(Coroutine *co, Monitor *mon) { abort(); } -int monitor_vprintf(Monitor *mon, const char *fmt, va_list ap) { abort(); } bool monitor_cur_is_qmp(void) { abort(); }; +#ifdef CONFIG_HMP +int monitor_vprintf(Monitor *mon, const char *fmt, va_list ap) { abort(); } +#endif =20 #ifndef _WIN32 static void test_socket_fd_pass_name_good(void) diff --git a/tools/qemu-vnc/stubs.c b/tools/qemu-vnc/stubs.c index a865ce85f04..f476dd6d956 100644 --- a/tools/qemu-vnc/stubs.c +++ b/tools/qemu-vnc/stubs.c @@ -46,10 +46,12 @@ Monitor *monitor_set_cur(Coroutine *co, Monitor *mon) return NULL; } =20 +#ifdef CONFIG_HMP int monitor_vprintf(Monitor *mon, const char *fmt, va_list ap) { return -1; } +#endif =20 /* * Link-time stubs for VMState symbols referenced by VNC code. diff --git a/util/error-report.c b/util/error-report.c index f832ad9b6b6..e2e46281455 100644 --- a/util/error-report.c +++ b/util/error-report.c @@ -40,11 +40,13 @@ error_vprintf_mon(Monitor *cur_mon, const char *fmt, va= _list ap) * IOW this will only print if in HMP, otherwise we * fallback to stderr for QMP / no-monitor scenarios. */ +#ifdef CONFIG_HMP int ret =3D monitor_vprintf(cur_mon, fmt, ap); - if (ret =3D=3D -1) { - ret =3D vfprintf(stderr, fmt, ap); + if (ret !=3D -1) { + return ret; } - return ret; +#endif + return vfprintf(stderr, fmt, ap); } =20 /* diff --git a/util/qemu-print.c b/util/qemu-print.c index 7b9591035e5..ee80000722b 100644 --- a/util/qemu-print.c +++ b/util/qemu-print.c @@ -20,10 +20,12 @@ */ int qemu_vprintf(const char *fmt, va_list ap) { +#ifdef CONFIG_HMP Monitor *cur_mon =3D monitor_cur(); if (cur_mon) { return monitor_vprintf(cur_mon, fmt, ap); } +#endif return vprintf(fmt, ap); } =20 @@ -52,7 +54,11 @@ int qemu_printf(const char *fmt, ...) int qemu_vfprintf(FILE *stream, const char *fmt, va_list ap) { if (!stream) { +#ifdef CONFIG_HMP return monitor_vprintf(monitor_cur(), fmt, ap); +#else + return -1; +#endif } return vfprintf(stream, fmt, ap); } --=20 2.54.0 From nobody Sun Jul 26 11:53:26 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782422609; cv=none; d=zohomail.com; s=zohoarc; b=ZfABcmJTDMdU9u4Ov+7mbZZyDIVFLgBgXJVrH2VaIZ6qiJ1j1aZUdmYPuTfq5ja6LQYwCM6pyaTQuCjI/jxoIhMgqE9zXyhgd/32iDl5gxQhkuqdHo0vn2lqhG12OJp+0luoeSiSZSSebbEmDm2Z9Dtl+5cMOYG/kKp+XsQP+og= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782422609; 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=mcrkkX6WwcNtQ4IJrOAOYrtGoT3tnz6PRliTLLQAtiE=; b=joA2wLu2HtI7fI0n3Imi/hu4YIIA5IpAJlyt7CYaIAW8gsoPXMoENkAARFH4f1IQ7Q5xQwba3wtB2WYoOqYvhosUt3J9rFER1qFM8Jy0jX5ujcJr+0ca55UGCkFGuEKR5yZsxsUG2gwoYNQfP9ZK5ZaliZoHwZ65RaasRBFdwtI= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1782422609923785.7714216209209; Thu, 25 Jun 2026 14:23:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wcrWp-0007Ax-6E; Thu, 25 Jun 2026 17:22:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrWn-000799-Lq for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:22:29 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrWl-00042K-UA for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:22:29 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-685-SqBBdP_zPEu4Je4TJNZ7ng-1; Thu, 25 Jun 2026 17:22:26 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2F7281873C06; Thu, 25 Jun 2026 21:22:25 +0000 (UTC) Received: from localhost (unknown [10.44.24.16]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id EE86E1956047; Thu, 25 Jun 2026 21:22:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782422547; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mcrkkX6WwcNtQ4IJrOAOYrtGoT3tnz6PRliTLLQAtiE=; b=gB0bOPtWAm7TSOquZN62MUJN7bH2BPAKaWnDPzePQj5DkwOUzdLS8OPzH2mPvfYhLxVO28 KsjZgCp3sQgemWFh0R/5F5QNZefIDAxBHvx8voZ/Ey/XKfGJ73Fu+1f2Hnp3ywP24rCwh1 yqx3i1+ZBlAmflchKQ6eXok1vHO2TMM= X-MC-Unique: SqBBdP_zPEu4Je4TJNZ7ng-1 X-Mimecast-MFC-AGG-ID: SqBBdP_zPEu4Je4TJNZ7ng_1782422545 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 26 Jun 2026 01:19:33 +0400 Subject: [PATCH v2 32/39] qapi: make HMP-specific schema entries conditional on CONFIG_HMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260626-qemu-no-hmp-v2-32-8af31bc54c61@redhat.com> References: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> In-Reply-To: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster X-Developer-Signature: v=1; a=openpgp-sha256; l=2860; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=c9jaqfUW6JVD++uSYBGlWL79xz3IWpsoXpJJfFxlqpw=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqPZte4sIDzfvo0CRJawdmgvOuwjlqqpbofhFnb oB8PH3Z2MOJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaj2bXgAKCRDa6OEJdZac 5f++EACxcyePBX6gPl29FYjqMvwtFPsLwl3irWsg4/kbgTHm61fupkra0UF3Iv95fY9o/S23CCR Mxc36QM4pw3oNd0yNZgJTUZnnc2CJG+EH28gad2vh3CbRaqJBGI1XGYox82ncUGVocLzVUygusF 130QwCCGNCOycsDHB9jY6AdD3rZ/aaUbW/TGLRMoQbZ41WQkXhtLXGNxBfdAGjah9GPeF/AaJrA Gl34vEJyNlyXyrUUopsdnS5k29jlU2PSISJyNW3KKUgRKXAKOWuf+4YwYX74Y3AEzVyze+jhfGI OP63XGNe8JTOjDGIrfSFsZqQh67OCs4nqa75yEBMFhzkACchcyo4u3QEGkFcGCtO90S8hxX7J4C hLNEncXyG0QV8gsSCNDIonGVH9EYvinUx4j4BiRcwfw2Yu61Rhalc2wy6Cm5nJte3kif7Mdz1dT DMTvsvU5UN1W4AAWm8EcJNPxDjw5ZDg9UVoxEjqhZGlBeNiP00RsG3Oplps6ei0kT73QIccyw40 2mV+6wx09N+iI9XNzCXHNStNh4jEQys1FO212YW4OGBFjwbY75Zb9h5gENAHkLCG0Z5jk5m1tWl oks6+oUy4/k4+sk3+J9IJEqJaz/OU4VoXOKy0qmjbAAzWg0EDlZ+rbCkLauggKhkMcAAxN0CTEl XqpzKrK4DUelbqg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1782422610118158500 Make the 'readline' value of MonitorMode and the 'human-monitor-command' command conditional on CONFIG_HMP, so they are only available when HMP support is compiled in. Signed-off-by: Marc-Andr=C3=A9 Lureau --- qapi/control.json | 4 +++- qapi/misc.json | 3 ++- monitor/monitor.c | 8 +++++++- monitor/qmp-cmds.c | 2 ++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/qapi/control.json b/qapi/control.json index 9a5302193d6..9898552814b 100644 --- a/qapi/control.json +++ b/qapi/control.json @@ -186,7 +186,9 @@ # # Since: 5.0 ## -{ 'enum': 'MonitorMode', 'data': [ 'readline', 'control' ] } +{ 'enum': 'MonitorMode', 'data': [ + { 'name': 'readline', 'if': 'CONFIG_HMP' }, + 'control' ] } =20 ## # @MonitorOptions: diff --git a/qapi/misc.json b/qapi/misc.json index 22b7afed9f6..a21ba61b96e 100644 --- a/qapi/misc.json +++ b/qapi/misc.json @@ -247,7 +247,8 @@ { 'command': 'human-monitor-command', 'data': {'command-line': 'str', '*cpu-index': 'int'}, 'returns': 'str', - 'features': [ 'savevm-monitor-nodes' ] } + 'features': [ 'savevm-monitor-nodes' ], + 'if': 'CONFIG_HMP' } =20 ## # @getfd: diff --git a/monitor/monitor.c b/monitor/monitor.c index f443f406b4c..50f1fe77c33 100644 --- a/monitor/monitor.c +++ b/monitor/monitor.c @@ -733,13 +733,18 @@ int monitor_init(MonitorOptions *opts, bool allow_hmp= , Error **errp) } =20 if (!opts->has_mode) { - opts->mode =3D allow_hmp ? MONITOR_MODE_READLINE : MONITOR_MODE_CO= NTROL; + opts->mode =3D +#ifdef CONFIG_HMP + allow_hmp ? MONITOR_MODE_READLINE : +#endif + MONITOR_MODE_CONTROL; } =20 switch (opts->mode) { case MONITOR_MODE_CONTROL: monitor_init_qmp(chr, opts->pretty, errp); break; +#ifdef CONFIG_HMP case MONITOR_MODE_READLINE: if (!allow_hmp) { error_setg(errp, "Only QMP is supported"); @@ -751,6 +756,7 @@ int monitor_init(MonitorOptions *opts, bool allow_hmp, = Error **errp) } monitor_init_hmp(chr, true, errp); break; +#endif /* CONFIG_HMP */ default: g_assert_not_reached(); } diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c index 0c409c27dc3..5e642a2b14d 100644 --- a/monitor/qmp-cmds.c +++ b/monitor/qmp-cmds.c @@ -162,6 +162,7 @@ void qmp_add_client(const char *protocol, const char *f= dname, } } =20 +#ifdef CONFIG_HMP char *qmp_human_monitor_command(const char *command_line, bool has_cpu_ind= ex, int64_t cpu_index, Error **errp) { @@ -189,6 +190,7 @@ out: monitor_data_destroy(&hmp.common); return output; } +#endif /* CONFIG_HMP */ =20 static void __attribute__((__constructor__)) monitor_init_qmp_commands(voi= d) { --=20 2.54.0 From nobody Sun Jul 26 11:53:26 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782422590; cv=none; d=zohomail.com; s=zohoarc; b=AAF7W1q46ur2ZgTDsFGU5ggE9jZj/8qAU0Pp8sd+WgLZ8ltBOGzOgJoAR8glE+HdZzW4/HDHcnggw08HDqQxw/BG/Y0zvJZmHYPk4qHXpmFiEyqVA1afh44/61ITEbCU0ctXONeQwH1uHYgX7j8buWRvkuZH3+Nt+1BKABQ49xM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782422590; 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=vncEFif2osB8pSxSJn0Cg1Dge9a/h6LPCpFOXSBXXbU=; b=e/b1kplGiD38Y7drtBu3JowE3BUqvcbF6ynQ41fPNNDPTQ6N+52NVySIuC28gXIKFPELe/zqqlHeWC+3DOqRteL7X3EwERz7o2NTpdVK3w2M8UKBcZg/SLT+k0327In8qagcqogXD6hNdQLeVnQMxMWzsf6wtVfcjO+fMkI+6nc= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1782422590020320.12676771585745; Thu, 25 Jun 2026 14:23:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wcrWw-0007IL-54; Thu, 25 Jun 2026 17:22:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrWu-0007G8-PO for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:22:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrWt-00044g-5M for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:22:36 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-296-Q0Rzf7WqNZqCwbnD5aOiyQ-1; Thu, 25 Jun 2026 17:22:31 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6222F19560B3; Thu, 25 Jun 2026 21:22:30 +0000 (UTC) Received: from localhost (unknown [10.44.24.16]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 0B96D30001BE; Thu, 25 Jun 2026 21:22:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782422554; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vncEFif2osB8pSxSJn0Cg1Dge9a/h6LPCpFOXSBXXbU=; b=RJgBewLmSNp/hruTd/UvYWRYGOxt24xKaOvVrf6OvlowreuqERasCdweMWXNvPcDkerYs9 briRNmkIbhLJgvUI7Q1cLqpudP8WfM6Odl4XGcwYMF/9UD55zXRmsWlLO8pRbCoo2XVZHz iooP32ouGwgjY0Y7f4LVKxVkw0KnBGY= X-MC-Unique: Q0Rzf7WqNZqCwbnD5aOiyQ-1 X-Mimecast-MFC-AGG-ID: Q0Rzf7WqNZqCwbnD5aOiyQ_1782422550 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 26 Jun 2026 01:19:34 +0400 Subject: [PATCH v2 33/39] system: guard HMP initialization paths with CONFIG_HMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260626-qemu-no-hmp-v2-33-8af31bc54c61@redhat.com> References: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> In-Reply-To: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster X-Developer-Signature: v=1; a=openpgp-sha256; l=3542; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=pi+RZupVSF4KPZC6fj/bHKUWEpXfwKDV4jn+ic/nk24=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqPZteE7GwTr8JVyd8VGwElMKoC9bnXaIhiwjHM tji8MpwbNaJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaj2bXgAKCRDa6OEJdZac 5aybEAC53DUtqaoBqmZ++EMNolSgPFGYPfj01nT/JjH8zzF8urTqiTN7au0e0oe2xAPT1czddTp FzSdLeGfxssFyVvXKmZcYQYMfB1AeY81luL4TDAHpPnlZKKipLyaYfkqRC3VLuKutt7CmxZCZ1B WdEoUrJubiWh8c7uHVFATyyxqL83N4n6lI6XoOoXvEkUaLfAVxjYCoZZwDQPleLqniogk2J2fmi DW8Hbvzi6MiTeVGk16EeAuxvag4omEuHLqq7a04c4WrBW75fi5eNuRXc98D4jSBWjy3ucYayq/b flvRSi6veFOwiEeJka2dYk6QLvrO6v2GJzin6qfjwhsyCCgXUlr6CilLAD+a0yjGPPrvXeG3lfh I+fpt8JV1GiVkjhYjIgrVbeX16vbqsQI4unr3QAeR8bOQRJtfGZPLZUdezI//TEwAM34GcibpQv HIuU2W9jEqVL/ZSF2P3TIhgzrmBHa4GxtSa3X/9qjoGMMTLRS0KEefAXX76gxdLink5a5FuMlGl Zq0nPB/bnYBVmjcRY49a05gppFEeJqsZfOLMoIQCC9pYeRya8z6hmnSXW78WUh62Uofp8FiWDSJ 0vUw3vD8PESK54myaeaR/nEZY4Qy+iYQikCuQxlEkWDfWta3Z76Uc0/f7ZSkgPh37VpV+cERc/i MrcCj0zctWZgXJg== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 8 X-Spam_score: 0.8 X-Spam_bar: / X-Spam_report: (0.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-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: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1782422592269158500 - disable default monitor when HMP is not available - hide 'readline' from -mon help text - error out on mux chardev monitor when no HMP - skip HMP monitor terminal for gdb, return E01 for 'qRcmd' remote commands Signed-off-by: Marc-Andr=C3=A9 Lureau --- chardev/char.c | 7 +++++++ gdbstub/system.c | 8 ++++++++ system/vl.c | 4 ++++ qemu-options.hx | 6 +++++- 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/chardev/char.c b/chardev/char.c index ca8b37ed8d7..5f2b9fbc4bf 100644 --- a/chardev/char.c +++ b/chardev/char.c @@ -805,6 +805,7 @@ static Chardev *qemu_chr_new_from_name(const char *labe= l, const char *filename, =20 if (qemu_opt_get_bool(opts, "mux", 0)) { assert(permit_mux_mon); +#ifdef CONFIG_HMP monitor_init_hmp(chr, true, &err); if (err) { error_report_err(err); @@ -812,6 +813,12 @@ static Chardev *qemu_chr_new_from_name(const char *lab= el, const char *filename, chr =3D NULL; goto out; } +#else + error_report("HMP monitor is disabled"); + object_unparent(OBJECT(chr)); + chr =3D NULL; + goto out; +#endif } =20 out: diff --git a/gdbstub/system.c b/gdbstub/system.c index 2063b63b2f8..4e0e94ffb28 100644 --- a/gdbstub/system.c +++ b/gdbstub/system.c @@ -386,10 +386,14 @@ bool gdbserver_start(const char *device, Error **errp) =20 qemu_add_vm_change_state_handler(gdb_vm_state_change, NULL); =20 +#ifdef CONFIG_HMP /* Initialize a monitor terminal for gdb */ mon_chr =3D qemu_chardev_new(NULL, TYPE_CHARDEV_GDB, NULL, NULL, &error_abort); monitor_init_hmp(mon_chr, false, &error_abort); +#else + mon_chr =3D NULL; +#endif } else { qemu_chr_fe_deinit(&gdbserver_system_state.chr, true); mon_chr =3D gdbserver_system_state.mon_chr; @@ -528,10 +532,14 @@ void gdb_handle_query_rcmd(GArray *params, void *ctx) len =3D len / 2; gdb_hextomem(gdbserver_state.mem_buf, gdb_get_cmd_param(params, 0)->da= ta, len); g_byte_array_append(gdbserver_state.mem_buf, &zero, 1); +#ifdef CONFIG_HMP qemu_chr_be_write(gdbserver_system_state.mon_chr, gdbserver_state.mem_buf->data, gdbserver_state.mem_buf->len); gdb_put_packet("OK"); +#else + gdb_put_packet("E01"); +#endif } =20 /* diff --git a/system/vl.c b/system/vl.c index dd7fe828118..1e693710920 100644 --- a/system/vl.c +++ b/system/vl.c @@ -199,7 +199,11 @@ static int has_defaults =3D 1; static int default_audio =3D 1; static int default_serial =3D 1; static int default_parallel =3D 1; +#ifdef CONFIG_HMP static int default_monitor =3D 1; +#else +static int default_monitor; /* false */ +#endif static int default_floppy =3D 1; static int default_cdrom =3D 1; static bool auto_create_sdcard =3D true; diff --git a/qemu-options.hx b/qemu-options.hx index c799286153f..4714b5e8f85 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -4962,7 +4962,11 @@ SRST ERST =20 DEF("mon", HAS_ARG, QEMU_OPTION_mon, \ - "-mon [chardev=3D]name[,mode=3Dreadline|control][,pretty=3Don|off]\n",= QEMU_ARCH_ALL) + "-mon [chardev=3D]name[,mode=3D" +#ifdef CONFIG_HMP + "readline|" +#endif + "control][,pretty=3Don|off]\n", QEMU_ARCH_ALL) SRST ``-mon [chardev=3D]name[,mode=3Dreadline|control][,pretty=3Don|off]`` Set up a monitor connected to the chardev ``name``. --=20 2.54.0 From nobody Sun Jul 26 11:53:26 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782422593; cv=none; d=zohomail.com; s=zohoarc; b=mTSMqbxdnf5h0tw5UBwoBY98oQ3MVGCCpPt1ZZXC6dXddC23m4b9jSq2wFlhD/d6lYl+fT1AL6v2gVuSupjpHq338R0j9irqVrdJS9MJevAbacjA1rsdpu1ffUy7qIyruOi2FLQ6DFPG6+ckY27SMjx7Xpj6M+fUHfTCrOf5i3I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782422593; 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=YhYMnPhbRYhjBhgARIMoP5FZYbbXSNC5Y99BK0mBCEY=; b=XfpJ5eJt+C1KABS3DqmtEDj4Tmob3+VAx2kClS3PAzNA1DC8U0O0Ni8jq4rIon+eokplHYyNlX+I8FGJOb2/Fy598VR+cJj2XEF2BB9uEZCr8XK+jCuChyjWFZANzO8XedElR76zEpzgpkug9oeMWqGZXDAU1nyaCqw5l8uMcWI= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1782422593036129.31092620226525; Thu, 25 Jun 2026 14:23:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wcrX3-0007aj-V9; Thu, 25 Jun 2026 17:22:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrX1-0007Qr-PR for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:22:43 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrWy-00045I-Rs for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:22:43 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-235-eEc5xAsiOvimtrmlHh91aA-1; Thu, 25 Jun 2026 17:22:36 -0400 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D98071955F38; Thu, 25 Jun 2026 21:22:35 +0000 (UTC) Received: from localhost (unknown [10.44.24.16]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4DD5531D2; Thu, 25 Jun 2026 21:22:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782422560; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YhYMnPhbRYhjBhgARIMoP5FZYbbXSNC5Y99BK0mBCEY=; b=A8da8PmRnMCj5S/d8AZj4+G1EdpURS+lmIbDwOCEmkcbelUUEB7R53cscrnbUiNl4k11XO b2rlTZgmd2spiPk7kp3phQxHmqO9qu6J9Xro2Sf/YADo8YwmOnlVOk+c0uwF8xcyVraIq6 vALDIXz+DATF+bW3UYssgoxNhVLvsUU= X-MC-Unique: eEc5xAsiOvimtrmlHh91aA-1 X-Mimecast-MFC-AGG-ID: eEc5xAsiOvimtrmlHh91aA_1782422556 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 26 Jun 2026 01:19:35 +0400 Subject: [PATCH v2 34/39] Guard HMP command implementations with CONFIG_HMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260626-qemu-no-hmp-v2-34-8af31bc54c61@redhat.com> References: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> In-Reply-To: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster X-Developer-Signature: v=1; a=openpgp-sha256; l=22115; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=eYZoSOXto3I/Guv1BywDpFtgYoq43ZklUDHw6DxAJIU=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqPZteGE6W12wpgxpKm6mu4RqzpTJgGg02Xmmg2 zGAULcECdSJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaj2bXgAKCRDa6OEJdZac 5YvbD/oD7Xi1AnvWuwJ3fAXQsj+WUc0wIN5jhgqr6zPaAesmIkHYokMcWQjb7EE1F6+MOiTosIC w13gYW8RxpEqIVFWjlthSMcKHHzwN3ss0FJvNIssrTwFcWPrRAkzGmnH+ZzfAtCe7k/bEcG6yIw WsnOnXA+AtMC7p4CcdA6XkB5z9MwD/Ucid9fINhEHHoKv/CTLci5lDnpEStHOD3gxPZScseyqb6 ZsclUQ4mQ74/9YGUXNSBAtwbKcZnLvs6X40a4qVoVwW3RBvLuLG0Ni+p23Kd9xUBktiPj6/9PDk byWfXObt1A3/pP7uO8RkEhepmivn43yCeGGCAPTegaF2KvuOJ1In6iTVbrzPvHxtffSmKAe3pVx xt1l08zZVDLg28dwT+yvEvEEp5rwdi/3aUe400nSJCdv8B+E1jf3oIx/I9gcqQQo+wN9z/50HhY mm+Sej8TVRkL1H8Zvt/AsaXqkcGHf8i8KmG2fJvas9BowS0uSL68i8+8dCC4+JGoeyItxzmB4yU iRDzSDcVWzYNoKHYXI7eRghobbe20pl0FCT2y1PyY8yiVZeRRVOVQMnRpn9n49Ymswib8MB4cqb WXbsOEPa4iSHt/YXVhZPGCfAXQkz4WcZFcgBu9v++qstcHn9ob/zKs5PUyoghxxRmnwROUqmuwf yFa62kqwTbUMnKA== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 8 X-Spam_score: 0.8 X-Spam_bar: / X-Spam_report: (0.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-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: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1782422594233158500 Add #ifdef CONFIG_HMP around all hmp_* function implementations and their HMP-only helpers across subsystems. This covers monitor_register_hmp* callers, hmp_info_* handlers, and HMP-only helper functions like slirp_lookup. To link succesfully, use empty cmds tables in hmp-cmds.c (to be removed once meson build-sys is updated with !hmp support later in the series) Signed-off-by: Marc-Andr=C3=A9 Lureau --- accel/accel-system.c | 2 ++ accel/tcg/monitor.c | 2 ++ hw/i386/kvm/xen-stubs.c | 2 ++ hw/i386/kvm/xen_evtchn.c | 3 ++- hw/i386/sgx.c | 2 ++ hw/misc/mos6522-stub.c | 2 ++ hw/misc/mos6522.c | 2 ++ hw/pci/pci-stub.c | 2 ++ hw/s390x/s390-skeys.c | 2 ++ hw/s390x/s390-stattrib.c | 4 ++++ hw/uefi/ovmf-log.c | 2 ++ hw/usb/host-libusb.c | 6 ++++++ migration/dirtyrate.c | 2 ++ monitor/hmp-cmds.c | 5 +++++ net/slirp.c | 7 ++++++- replay/replay-debugging.c | 8 ++++++++ replay/stubs-system.c | 6 ++++++ system/dirtylimit.c | 6 ++++++ system/qdev-monitor.c | 4 ++++ target/i386/cpu-apic.c | 2 ++ target/i386/monitor.c | 3 +++ target/i386/sev.c | 2 ++ target/m68k/monitor.c | 2 ++ target/ppc/monitor.c | 2 ++ target/riscv/monitor.c | 3 +++ target/sh4/monitor.c | 2 ++ target/sparc/monitor.c | 2 ++ target/xtensa/monitor.c | 2 ++ 28 files changed, 87 insertions(+), 2 deletions(-) diff --git a/accel/accel-system.c b/accel/accel-system.c index 9176665202d..a8715924729 100644 --- a/accel/accel-system.c +++ b/accel/accel-system.c @@ -108,7 +108,9 @@ void accel_init_ops_interfaces(AccelClass *ac) =20 static void accel_ops_class_init(ObjectClass *oc, const void *data) { +#ifdef CONFIG_HMP monitor_register_hmp_info_hrt("accel", qmp_x_accel_stats); +#endif } =20 static const TypeInfo accel_ops_type_info =3D { diff --git a/accel/tcg/monitor.c b/accel/tcg/monitor.c index be5c1950177..c860744536b 100644 --- a/accel/tcg/monitor.c +++ b/accel/tcg/monitor.c @@ -29,9 +29,11 @@ HumanReadableText *qmp_x_query_jit(Error **errp) return human_readable_text_from_str(buf); } =20 +#ifdef CONFIG_HMP static void hmp_tcg_register(void) { monitor_register_hmp_info_hrt("jit", qmp_x_query_jit); } =20 type_init(hmp_tcg_register); +#endif diff --git a/hw/i386/kvm/xen-stubs.c b/hw/i386/kvm/xen-stubs.c index bf6ac28bef4..df36c84a4f4 100644 --- a/hw/i386/kvm/xen-stubs.c +++ b/hw/i386/kvm/xen-stubs.c @@ -40,6 +40,7 @@ void xen_primary_console_set_be_port(uint16_t port) { } =20 +#ifdef CONFIG_HMP void hmp_xen_event_list(Monitor *mon, const QDict *qdict) { monitor_printf(mon, "XEN emulation is not available in this QEMU\n"); @@ -49,3 +50,4 @@ void hmp_xen_event_inject(Monitor *mon, const QDict *qdic= t) { monitor_printf(mon, "XEN emulation is not available in this QEMU\n"); } +#endif diff --git a/hw/i386/kvm/xen_evtchn.c b/hw/i386/kvm/xen_evtchn.c index 8b243984e41..cb7b4c7a81b 100644 --- a/hw/i386/kvm/xen_evtchn.c +++ b/hw/i386/kvm/xen_evtchn.c @@ -2344,6 +2344,7 @@ void qmp_xen_event_inject(uint32_t port, Error **errp) } } =20 +#ifdef CONFIG_HMP void hmp_xen_event_list(Monitor *mon, const QDict *qdict) { EvtchnInfoList *iter, *info_list; @@ -2391,4 +2392,4 @@ void hmp_xen_event_inject(Monitor *mon, const QDict *= qdict) monitor_printf(mon, "Delivered port %d\n", port); } } - +#endif diff --git a/hw/i386/sgx.c b/hw/i386/sgx.c index 7e4c509f5a4..4ac8ea75aa7 100644 --- a/hw/i386/sgx.c +++ b/hw/i386/sgx.c @@ -234,6 +234,7 @@ SgxInfo *qmp_query_sgx(Error **errp) return info; } =20 +#ifdef CONFIG_HMP void hmp_info_sgx(Monitor *mon, const QDict *qdict) { Error *err =3D NULL; @@ -265,6 +266,7 @@ void hmp_info_sgx(Monitor *mon, const QDict *qdict) monitor_printf(mon, "total size=3D%" PRIu64 "\n", size); } +#endif =20 bool check_sgx_support(void) { diff --git a/hw/misc/mos6522-stub.c b/hw/misc/mos6522-stub.c index 85eb0ee36ee..03fea6985a9 100644 --- a/hw/misc/mos6522-stub.c +++ b/hw/misc/mos6522-stub.c @@ -10,7 +10,9 @@ #include "monitor/monitor.h" #include "monitor/hmp.h" =20 +#ifdef CONFIG_HMP void hmp_info_via(Monitor *mon, const QDict *qdict) { monitor_printf(mon, "MOS6522 VIA is not available in this QEMU\n"); } +#endif diff --git a/hw/misc/mos6522.c b/hw/misc/mos6522.c index bae766ef178..6be7ed3ff30 100644 --- a/hw/misc/mos6522.c +++ b/hw/misc/mos6522.c @@ -497,6 +497,7 @@ void mos6522_write(void *opaque, hwaddr addr, uint64_t = val, unsigned size) } } =20 +#ifdef CONFIG_HMP static int qmp_x_query_via_foreach(Object *obj, void *opaque) { GString *buf =3D opaque; @@ -596,6 +597,7 @@ void hmp_info_via(Monitor *mon, const QDict *qdict) } monitor_puts(mon, info->human_readable_text); } +#endif /* CONFIG_HMP */ =20 static const MemoryRegionOps mos6522_ops =3D { .read =3D mos6522_read, diff --git a/hw/pci/pci-stub.c b/hw/pci/pci-stub.c index 3397d0c82ea..f217373ef03 100644 --- a/hw/pci/pci-stub.c +++ b/hw/pci/pci-stub.c @@ -34,6 +34,7 @@ PciInfoList *qmp_query_pci(Error **errp) return NULL; } =20 +#ifdef CONFIG_HMP void hmp_info_pci(Monitor *mon, const QDict *qdict) { } @@ -42,6 +43,7 @@ void hmp_pcie_aer_inject_error(Monitor *mon, const QDict = *qdict) { monitor_printf(mon, "PCI devices not supported\n"); } +#endif =20 /* kvm-all wants this */ MSIMessage pci_get_msi_message(PCIDevice *dev, int vector) diff --git a/hw/s390x/s390-skeys.c b/hw/s390x/s390-skeys.c index 7dca67d6618..81885a1640c 100644 --- a/hw/s390x/s390-skeys.c +++ b/hw/s390x/s390-skeys.c @@ -104,6 +104,7 @@ static void write_keys(FILE *f, uint8_t *keys, uint64_t= startgfn, } } =20 +#ifdef CONFIG_HMP void hmp_info_skeys(Monitor *mon, const QDict *qdict) { S390SKeysState *ss =3D s390_get_skeys_device(); @@ -144,6 +145,7 @@ void hmp_dump_skeys(Monitor *mon, const QDict *qdict) error_report_err(err); } } +#endif =20 void s390_qmp_dump_skeys(const char *filename, Error **errp) { diff --git a/hw/s390x/s390-stattrib.c b/hw/s390x/s390-stattrib.c index c334714b31a..2fdf70bf2ed 100644 --- a/hw/s390x/s390-stattrib.c +++ b/hw/s390x/s390-stattrib.c @@ -32,6 +32,7 @@ #define STATTR_FLAG_ERROR 0x04ULL #define STATTR_FLAG_DONE 0x08ULL =20 +#ifdef CONFIG_HMP static S390StAttribState *s390_get_stattrib_device(void) { S390StAttribState *sas; @@ -40,6 +41,7 @@ static S390StAttribState *s390_get_stattrib_device(void) assert(sas); return sas; } +#endif =20 void s390_stattrib_init(void) { @@ -59,6 +61,7 @@ void s390_stattrib_init(void) =20 /* Console commands: */ =20 +#ifdef CONFIG_HMP void hmp_migrationmode(Monitor *mon, const QDict *qdict) { S390StAttribState *sas =3D s390_get_stattrib_device(); @@ -110,6 +113,7 @@ void hmp_info_cmma(Monitor *mon, const QDict *qdict) out: g_free(vals); } +#endif =20 /* Migration support: */ =20 diff --git a/hw/uefi/ovmf-log.c b/hw/uefi/ovmf-log.c index 3a24afd9417..395a2d10a37 100644 --- a/hw/uefi/ovmf-log.c +++ b/hw/uefi/ovmf-log.c @@ -256,6 +256,7 @@ FirmwareLog *qmp_query_firmware_log(bool have_max_size,= uint64_t max_size, return ret; } =20 +#ifdef CONFIG_HMP void hmp_info_firmware_log(Monitor *mon, const QDict *qdict) { g_autofree gchar *log_esc =3D NULL; @@ -284,3 +285,4 @@ void hmp_info_firmware_log(Monitor *mon, const QDict *q= dict) log_esc =3D g_strescape((gchar *)log_out, "\r\n"); monitor_printf(mon, "%s\n", log_esc); } +#endif diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c index b9f3ad3f66d..121fd817e82 100644 --- a/hw/usb/host-libusb.c +++ b/hw/usb/host-libusb.c @@ -183,6 +183,7 @@ static void usb_host_attach_kernel(USBHostDevice *s); # define HAVE_SUPER_PLUS 1 #endif =20 +#ifdef CONFIG_HMP static const char *speed_name[] =3D { [LIBUSB_SPEED_UNKNOWN] =3D "?", [LIBUSB_SPEED_LOW] =3D "1.5", @@ -193,6 +194,7 @@ static const char *speed_name[] =3D { [LIBUSB_SPEED_SUPER_PLUS] =3D "5000+", #endif }; +#endif =20 static const unsigned int speed_map[] =3D { [LIBUSB_SPEED_LOW] =3D USB_SPEED_LOW, @@ -1814,7 +1816,9 @@ module_kconfig(USB); static void usb_host_register_types(void) { type_register_static(&usb_host_dev_info); +#ifdef CONFIG_HMP monitor_register_hmp("usbhost", true, hmp_info_usbhost); +#endif } =20 type_init(usb_host_register_types) @@ -1919,6 +1923,7 @@ static void usb_host_auto_check(void *unused) timer_mod(usb_auto_timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + 200= 0); } =20 +#ifdef CONFIG_HMP void hmp_info_usbhost(Monitor *mon, const QDict *qdict) { libusb_device **devs =3D NULL; @@ -1962,3 +1967,4 @@ void hmp_info_usbhost(Monitor *mon, const QDict *qdic= t) } libusb_free_device_list(devs, 1); } +#endif diff --git a/migration/dirtyrate.c b/migration/dirtyrate.c index b360f49efea..8808f20f1b9 100644 --- a/migration/dirtyrate.c +++ b/migration/dirtyrate.c @@ -856,6 +856,7 @@ struct DirtyRateInfo *qmp_query_dirty_rate(bool has_cal= c_time_unit, has_calc_time_unit ? calc_time_unit : TIME_UNIT_SECOND); } =20 +#ifdef CONFIG_HMP void hmp_info_dirty_rate(Monitor *mon, const QDict *qdict) { DirtyRateInfo *info =3D query_dirty_rate_info(TIME_UNIT_SECOND); @@ -932,3 +933,4 @@ void hmp_calc_dirty_rate(Monitor *mon, const QDict *qdi= ct) " seconds\n", sec); monitor_printf(mon, "[Please use 'info dirty_rate' to check results]\n= "); } +#endif diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index e7a02b1fddb..a68d3b828d2 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -42,6 +42,7 @@ #include "disas/disas.h" =20 /* Please update hmp-commands.hx when adding or changing commands */ +#ifdef CONFIG_HMP static HMPCommand hmp_info_cmds[] =3D { #include "hmp-commands-info.h" { NULL, NULL, }, @@ -52,6 +53,10 @@ static HMPCommand hmp_cmds[] =3D { #include "hmp-commands.h" { NULL, NULL, }, }; +#else +static HMPCommand hmp_info_cmds[] =3D { { NULL, NULL, }, }; +static HMPCommand hmp_cmds[] =3D { { NULL, NULL, }, }; +#endif =20 HMPCommand *hmp_cmds_for_target(bool info_command) { diff --git a/net/slirp.c b/net/slirp.c index 517dd23be14..d9527e663aa 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -710,6 +710,7 @@ error: return -1; } =20 +#ifdef CONFIG_HMP static SlirpState *slirp_lookup(Monitor *mon, const char *id) { if (id) { @@ -800,6 +801,7 @@ void hmp_hostfwd_remove(Monitor *mon, const QDict *qdic= t) fail_syntax: monitor_printf(mon, "invalid format\n"); } +#endif =20 static int slirp_hostfwd(SlirpState *s, const char *redir_str, Error **err= p) { @@ -956,6 +958,7 @@ static int slirp_hostfwd(SlirpState *s, const char *red= ir_str, Error **errp) return -1; } =20 +#ifdef CONFIG_HMP void hmp_hostfwd_add(Monitor *mon, const QDict *qdict) { const char *redir_str; @@ -976,8 +979,8 @@ void hmp_hostfwd_add(Monitor *mon, const QDict *qdict) error_report_err(err); } } - } +#endif =20 #if defined(CONFIG_SMBD_COMMAND) =20 @@ -1223,6 +1226,7 @@ UsernetInfoList *qmp_x_query_usernet(Error **errp) return head; } =20 +#ifdef CONFIG_HMP void hmp_info_usernet(Monitor *mon, const QDict *qdict) { g_autoptr(UsernetInfoList) list =3D NULL; @@ -1236,6 +1240,7 @@ void hmp_info_usernet(Monitor *mon, const QDict *qdic= t) ui->hub_name, ui->info); } } +#endif =20 static void net_init_slirp_configs_host(const NetdevUserHostForwardList *fwd) diff --git a/replay/replay-debugging.c b/replay/replay-debugging.c index 11053640021..1adf7422e36 100644 --- a/replay/replay-debugging.c +++ b/replay/replay-debugging.c @@ -31,6 +31,7 @@ bool replay_running_debug(void) return replay_is_debugging; } =20 +#ifdef CONFIG_HMP void hmp_info_replay(Monitor *mon, const QDict *qdict) { if (replay_mode =3D=3D REPLAY_MODE_NONE) { @@ -42,6 +43,7 @@ void hmp_info_replay(Monitor *mon, const QDict *qdict) replay_get_filename(), replay_get_current_icount()); } } +#endif =20 ReplayInfo *qmp_query_replay(Error **errp) { @@ -103,6 +105,7 @@ void qmp_replay_break(int64_t icount, Error **errp) } } =20 +#ifdef CONFIG_HMP void hmp_replay_break(Monitor *mon, const QDict *qdict) { int64_t icount =3D qdict_get_try_int(qdict, "icount", -1LL); @@ -114,6 +117,7 @@ void hmp_replay_break(Monitor *mon, const QDict *qdict) return; } } +#endif =20 void qmp_replay_delete_break(Error **errp) { @@ -124,6 +128,7 @@ void qmp_replay_delete_break(Error **errp) } } =20 +#ifdef CONFIG_HMP void hmp_replay_delete_break(Monitor *mon, const QDict *qdict) { Error *err =3D NULL; @@ -134,6 +139,7 @@ void hmp_replay_delete_break(Monitor *mon, const QDict = *qdict) return; } } +#endif =20 static char *replay_find_nearest_snapshot(int64_t icount, int64_t *snapshot_icount) @@ -208,6 +214,7 @@ void qmp_replay_seek(int64_t icount, Error **errp) replay_seek(icount, replay_stop_vm, errp); } =20 +#ifdef CONFIG_HMP void hmp_replay_seek(Monitor *mon, const QDict *qdict) { int64_t icount =3D qdict_get_try_int(qdict, "icount", -1LL); @@ -219,6 +226,7 @@ void hmp_replay_seek(Monitor *mon, const QDict *qdict) return; } } +#endif =20 static void replay_stop_vm_debug(void *opaque) { diff --git a/replay/stubs-system.c b/replay/stubs-system.c index f8e17dcf1ce..5ca80b4439d 100644 --- a/replay/stubs-system.c +++ b/replay/stubs-system.c @@ -63,22 +63,28 @@ void replay_vmstate_init(void) #include "qapi/error.h" #include "qemu/error-report.h" =20 +#ifdef CONFIG_HMP void hmp_info_replay(Monitor *mon, const QDict *qdict) { error_report("replay support not available"); } + void hmp_replay_break(Monitor *mon, const QDict *qdict) { error_report("replay support not available"); } + void hmp_replay_delete_break(Monitor *mon, const QDict *qdict) { error_report("replay support not available"); } + void hmp_replay_seek(Monitor *mon, const QDict *qdict) { error_report("replay support not available"); } +#endif + ReplayInfo *qmp_query_replay(Error **errp) { error_set(errp, ERROR_CLASS_COMMAND_NOT_FOUND, diff --git a/system/dirtylimit.c b/system/dirtylimit.c index 50fa67f3d6a..8992c45a509 100644 --- a/system/dirtylimit.c +++ b/system/dirtylimit.c @@ -491,6 +491,7 @@ void qmp_cancel_vcpu_dirty_limit(bool has_cpu_index, dirtylimit_state_unlock(); } =20 +#ifdef CONFIG_HMP void hmp_cancel_vcpu_dirty_limit(Monitor *mon, const QDict *qdict) { int64_t cpu_index =3D qdict_get_try_int(qdict, "cpu_index", -1); @@ -505,6 +506,7 @@ void hmp_cancel_vcpu_dirty_limit(Monitor *mon, const QD= ict *qdict) monitor_printf(mon, "[Please use 'info vcpu_dirty_limit' to query " "dirty limit for virtual CPU]\n"); } +#endif =20 void qmp_set_vcpu_dirty_limit(bool has_cpu_index, int64_t cpu_index, @@ -548,6 +550,7 @@ void qmp_set_vcpu_dirty_limit(bool has_cpu_index, dirtylimit_state_unlock(); } =20 +#ifdef CONFIG_HMP void hmp_set_vcpu_dirty_limit(Monitor *mon, const QDict *qdict) { int64_t dirty_rate =3D qdict_get_int(qdict, "dirty_rate"); @@ -564,6 +567,7 @@ void hmp_set_vcpu_dirty_limit(Monitor *mon, const QDict= *qdict) out: hmp_handle_error(mon, err); } +#endif =20 /* Return the max throttle time of each virtual CPU */ uint64_t dirtylimit_throttle_time_per_round(void) @@ -647,6 +651,7 @@ struct DirtyLimitInfoList *qmp_query_vcpu_dirty_limit(E= rror **errp) return dirtylimit_query_all(); } =20 +#ifdef CONFIG_HMP void hmp_info_vcpu_dirty_limit(Monitor *mon, const QDict *qdict) { DirtyLimitInfoList *info; @@ -672,3 +677,4 @@ void hmp_info_vcpu_dirty_limit(Monitor *mon, const QDic= t *qdict) info->value->current_rate); } } +#endif diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c index dfc95a08c10..68454bc7909 100644 --- a/system/qdev-monitor.c +++ b/system/qdev-monitor.c @@ -763,6 +763,7 @@ DeviceState *qdev_device_add(QemuOpts *opts, Error **er= rp) return ret; } =20 +#ifdef CONFIG_HMP #define qdev_printf(fmt, ...) monitor_printf(mon, "%*s" fmt, indent, "", #= # __VA_ARGS__) =20 static void qdev_print_props(Monitor *mon, DeviceState *dev, DeviceClass *= dc, @@ -864,6 +865,7 @@ void hmp_info_qdm(Monitor *mon, const QDict *qdict) { qdev_print_devinfos(true); } +#endif /* CONFIG_HMP */ =20 void qmp_device_add(QDict *qdict, QObject **ret_data, Error **errp) { @@ -1001,6 +1003,7 @@ void qmp_device_sync_config(const char *id, Error **e= rrp) qdev_sync_config(dev, errp); } =20 +#ifdef CONFIG_HMP void hmp_device_add(Monitor *mon, const QDict *qdict) { Error *err =3D NULL; @@ -1043,6 +1046,7 @@ void hmp_device_del(Monitor *mon, const QDict *qdict) qmp_device_del(id, &err); hmp_handle_error(mon, err); } +#endif =20 void device_add_completion(ReadLineState *rs, int nb_args, const char *str) { diff --git a/target/i386/cpu-apic.c b/target/i386/cpu-apic.c index 04b7257ad12..2f4c8a58fb2 100644 --- a/target/i386/cpu-apic.c +++ b/target/i386/cpu-apic.c @@ -80,6 +80,7 @@ void x86_cpu_apic_realize(X86CPU *cpu, Error **errp) } } =20 +#ifdef CONFIG_HMP void hmp_info_local_apic(Monitor *mon, const QDict *qdict) { CPUState *cs; @@ -102,3 +103,4 @@ void hmp_info_local_apic(Monitor *mon, const QDict *qdi= ct) } x86_cpu_dump_local_apic_state(cs, CPU_DUMP_FPU); } +#endif diff --git a/target/i386/monitor.c b/target/i386/monitor.c index 9ed772e6d7f..18329b6cc98 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -31,6 +31,8 @@ #include "qapi/qapi-commands-misc.h" #include "system/memory.h" =20 +#ifdef CONFIG_HMP + /* Perform linear address sign extension */ static hwaddr addr_canonical(CPUArchState *env, hwaddr addr) { @@ -595,3 +597,4 @@ void hmp_mce(Monitor *mon, const QDict *qdict) } hmp_handle_error(mon, err); } +#endif diff --git a/target/i386/sev.c b/target/i386/sev.c index 99cf30806be..b6d975ae2b2 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -758,6 +758,7 @@ SevInfo *qmp_query_sev(Error **errp) return info; } =20 +#ifdef CONFIG_HMP void hmp_info_sev(Monitor *mon, const QDict *qdict) { SevInfo *info =3D sev_get_info(); @@ -791,6 +792,7 @@ void hmp_info_sev(Monitor *mon, const QDict *qdict) out: qapi_free_SevInfo(info); } +#endif =20 static int sev_get_pdh_info(int fd, guchar **pdh, size_t *pdh_len, guchar **cert_chai= n, diff --git a/target/m68k/monitor.c b/target/m68k/monitor.c index 3e0df40a6b8..27f65d556e5 100644 --- a/target/m68k/monitor.c +++ b/target/m68k/monitor.c @@ -10,6 +10,7 @@ #include "monitor/hmp.h" #include "monitor/monitor.h" =20 +#ifdef CONFIG_HMP void hmp_info_tlb(Monitor *mon, const QDict *qdict) { CPUArchState *env1 =3D mon_get_cpu_env(mon); @@ -21,3 +22,4 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict) =20 dump_mmu(env1); } +#endif diff --git a/target/ppc/monitor.c b/target/ppc/monitor.c index 7c88e0e2bda..2fa27105a34 100644 --- a/target/ppc/monitor.c +++ b/target/ppc/monitor.c @@ -11,6 +11,7 @@ #include "monitor/hmp.h" #include "cpu.h" =20 +#ifdef CONFIG_HMP void hmp_info_tlb(Monitor *mon, const QDict *qdict) { CPUArchState *env1 =3D mon_get_cpu_env(mon); @@ -21,3 +22,4 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict) } dump_mmu(env1); } +#endif diff --git a/target/riscv/monitor.c b/target/riscv/monitor.c index 3e89dcaf7c6..da9975dd1b9 100644 --- a/target/riscv/monitor.c +++ b/target/riscv/monitor.c @@ -39,6 +39,8 @@ #define PTE_HEADER_DELIMITER "-------- ---------------- -------- ------= -\n" #endif =20 +#ifdef CONFIG_HMP + /* Perform linear address sign extension */ static target_ulong addr_canonical(int va_bits, target_ulong addr) { @@ -244,6 +246,7 @@ void hmp_info_mem(Monitor *mon, const QDict *qdict) =20 mem_info_svxx(mon, env); } +#endif /* CONFIG_HMP */ =20 static bool reg_is_ulong_integer(CPURISCVState *env, const char *name, target_ulong *val, bool is_gprh) diff --git a/target/sh4/monitor.c b/target/sh4/monitor.c index 50324d3600c..619d2678d0a 100644 --- a/target/sh4/monitor.c +++ b/target/sh4/monitor.c @@ -26,6 +26,7 @@ #include "monitor/monitor.h" #include "monitor/hmp.h" =20 +#ifdef CONFIG_HMP static void print_tlb(Monitor *mon, int idx, tlb_t *tlb) { monitor_printf(mon, " tlb%i:\t" @@ -55,3 +56,4 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict) for (i =3D 0 ; i < UTLB_SIZE ; i++) print_tlb (mon, i, &env->utlb[i]); } +#endif diff --git a/target/sparc/monitor.c b/target/sparc/monitor.c index 36f3d8d58e9..ed7e3b4b8b2 100644 --- a/target/sparc/monitor.c +++ b/target/sparc/monitor.c @@ -27,6 +27,7 @@ #include "monitor/hmp.h" =20 =20 +#ifdef CONFIG_HMP void hmp_info_tlb(Monitor *mon, const QDict *qdict) { CPUArchState *env1 =3D mon_get_cpu_env(mon); @@ -37,3 +38,4 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict) } dump_mmu(env1); } +#endif diff --git a/target/xtensa/monitor.c b/target/xtensa/monitor.c index 2af84934f83..3f8a93ed724 100644 --- a/target/xtensa/monitor.c +++ b/target/xtensa/monitor.c @@ -26,6 +26,7 @@ #include "monitor/monitor.h" #include "monitor/hmp.h" =20 +#ifdef CONFIG_HMP void hmp_info_tlb(Monitor *mon, const QDict *qdict) { CPUArchState *env1 =3D mon_get_cpu_env(mon); @@ -36,3 +37,4 @@ void hmp_info_tlb(Monitor *mon, const QDict *qdict) } dump_mmu(env1); } +#endif --=20 2.54.0 From nobody Sun Jul 26 11:53:26 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782422610; cv=none; d=zohomail.com; s=zohoarc; b=DvUHiIjGbfgtziQrpi+VUycDgQ1ZHKTHGfH0Tvi7k0RRdngj1IRFhVmhkbG+Qc41hWb+Xe0MaY+i9s2DPMzLxOFAsc1kTV1vaiD2vcD54HsN8DFNdt3CDtj+v1Kw82BAmBQBZnIicZGGfpjPbXUPNSx1w1/9QWLHighSJ2xS1pk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782422610; 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=Yg/4vpe/VIpC1IVkv/gpb2hEGj5BTSTBQNgDPD8xpG4=; b=iZrtpDQF+T9YOkSNdOOldhvz4NWh4tE6dqkd5rErOvhOykyHP5xoa/s60CVXh6Kl9t4RnSCNDQfgZSYmvqcYgZvU4fgm69q7Ps/p8/EQkvCG5nWjkziuse7ZCBkCmuQRAvn+jO2wc/Ex8NG+o24RPcqTl3bwuyotpvVU5cogDPc= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1782422609999461.05161821808474; Thu, 25 Jun 2026 14:23:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wcrX7-0007i1-Kc; Thu, 25 Jun 2026 17:22:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrX5-0007gV-Mw for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:22:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrX4-00045t-2J for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:22:47 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-74-EH0J8SM2P-evD6I7XqJG-w-1; Thu, 25 Jun 2026 17:22:42 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4B2161955DA3; Thu, 25 Jun 2026 21:22:41 +0000 (UTC) Received: from localhost (unknown [10.44.24.16]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 16FA4195608D; Thu, 25 Jun 2026 21:22:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782422565; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Yg/4vpe/VIpC1IVkv/gpb2hEGj5BTSTBQNgDPD8xpG4=; b=hckb8UxDRDRqt3PKYJvVjwJH9Ezq7X4YtPy6uG8WV0t2PuJTb/B779OE3amNCFW7anQ3VV +Kj4w+acM9dn37LFJFkbtHHYu+dyyGnkM5oaeR5qVgL7J8gdxrLH0Ie6OYXUHOKA3RrQTM XmDMkZErHFN9xXVdWxyp1YcYc+ykKTQ= X-MC-Unique: EH0J8SM2P-evD6I7XqJG-w-1 X-Mimecast-MFC-AGG-ID: EH0J8SM2P-evD6I7XqJG-w_1782422561 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 26 Jun 2026 01:19:36 +0400 Subject: [PATCH v2 35/39] target: guard MonitorDef tables with CONFIG_HMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260626-qemu-no-hmp-v2-35-8af31bc54c61@redhat.com> References: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> In-Reply-To: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster X-Developer-Signature: v=1; a=openpgp-sha256; l=4501; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=sZOBLMbuxr+KBjkNww4oQRWP2H2MtPQHjO8YsjtUmXs=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqPZteLiBbia/tEW1Nr4EGcJuJPH5r+CP2f0B2D fHl9i9UKc6JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaj2bXgAKCRDa6OEJdZac 5V7lD/9gJXt8/OzfnjLb9tCDyWj9DiSy8EMsTPHDNvjMFPKGr8eqagGkOV5vNcprGvBHTnWXIaX 2vYDiw1kz3ZcMmVPP6aekEWAQYvufDmmU4I2pN3z1pXyFWOY55QepCeJCO7FqTzL4ECYo18rK5S F7LkoF+m85B+4QetxbdOfAPi3wfaYnpZFEsraAO0VZ7+AMPwHDz3sfenlN9zVlZUWCBAneoIUw6 hViBJsUOjucQqZOG80iwH4BKtJQTgV7VbdGz67F1B6qS1CCbAYwLDq9q3h/Cz5wiZTGaleYrJ9C /ji1x22J0ch+47Tor8sESyLENm40BApjHMpWgqVZX2YpPGamQCG1hMazivVpD6jhaC7dlriXN7+ ms+gmplYPuKhdyZgV6oXpC1LfBAy57/wYBwe0maUELHuuRMcL9d4z+Ux1/pVtbOrHe1mhGP+3Fc P1q/EmSW51OVsVVuqwC0DZgD6/4MlHH4vBrFzOcJ+DjC4FIE097gbXjeX0YyjLpBiQYxqU9FyYA 8ht9+Dnt4PWzUdSzhw/dgehrAmD2s9NOnJlVet8Uj19HAQJTlduFqHSjt4nqLRmvqtslsc9CSmi KYv1rRKwPdeienrdpibPa/6SCEiwUI3aYAcVQbWz+QOaXl1TE4B+zy4ul5jbrb22RSL1nfYWHkd zQnJLSc1UUlxurQ== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 8 X-Spam_score: 0.8 X-Spam_bar: / X-Spam_report: (0.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-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: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1782422614228158500 Guard SysemuCPUOps::monitor_defs field and the per-target MonitorDef arrays with CONFIG_HMP. These tables are only used by HMP 'print' and 'info registers' commands. Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/hw/core/sysemu-cpu-ops.h | 2 ++ monitor/hmp.c | 4 +++- target/i386/cpu.c | 4 ++++ target/m68k/cpu.c | 4 ++++ target/sparc/cpu.c | 5 +++-- 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/include/hw/core/sysemu-cpu-ops.h b/include/hw/core/sysemu-cpu-= ops.h index 8be6a84bd54..09bb193e453 100644 --- a/include/hw/core/sysemu-cpu-ops.h +++ b/include/hw/core/sysemu-cpu-ops.h @@ -106,11 +106,13 @@ typedef struct SysemuCPUOps { */ int (*monitor_get_register)(CPUState *cs, const char *name, int64_t *p= val); =20 +#ifdef CONFIG_HMP /** * @monitor_defs: Array of MonitorDef entries. This field is legacy, * use @gdb_core_xml_file to dump registers instead. */ const MonitorDef *monitor_defs; +#endif =20 /** * @legacy_vmsd: Legacy state for migration. diff --git a/monitor/hmp.c b/monitor/hmp.c index de8804af51a..c9e207c7a30 100644 --- a/monitor/hmp.c +++ b/monitor/hmp.c @@ -1610,13 +1610,15 @@ void monitor_register_hmp_info_hrt(const char *name, static int get_monitor_def(Monitor *mon, int64_t *pval, const char *name) { CPUState *cs =3D mon_get_cpu(mon); - const MonitorDef *md; + const MonitorDef *md =3D NULL; void *ptr; =20 if (cs =3D=3D NULL) { return -1; } +#ifdef CONFIG_HMP md =3D cs->cc->sysemu_ops->monitor_defs; +#endif if (md =3D=3D NULL) { return -1; } diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 8929a75c7c9..9fc7677735e 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -10845,6 +10845,7 @@ static const Property x86_cpu_properties[] =3D { =20 #ifndef CONFIG_USER_ONLY =20 +#ifdef CONFIG_HMP static int64_t monitor_get_pc(Monitor *mon, const struct MonitorDef *md, int offset) { @@ -10870,6 +10871,7 @@ static const MonitorDef x86_monitor_defs[] =3D { { NULL }, #undef SEG }; +#endif =20 #include "hw/core/sysemu-cpu-ops.h" =20 @@ -10884,7 +10886,9 @@ static const struct SysemuCPUOps i386_sysemu_ops = =3D { .write_elf64_note =3D x86_cpu_write_elf64_note, .write_elf32_qemunote =3D x86_cpu_write_elf32_qemunote, .write_elf64_qemunote =3D x86_cpu_write_elf64_qemunote, +#ifdef CONFIG_HMP .monitor_defs =3D x86_monitor_defs, +#endif .legacy_vmsd =3D &vmstate_x86_cpu, }; #endif diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c index 9ad3057d91c..9955acb6c8d 100644 --- a/target/m68k/cpu.c +++ b/target/m68k/cpu.c @@ -603,6 +603,7 @@ static const VMStateDescription vmstate_m68k_cpu =3D { }, }; =20 +#ifdef CONFIG_HMP static const MonitorDef m68k_monitor_defs[] =3D { { "ssp", offsetof(CPUM68KState, sp[0]) }, { "usp", offsetof(CPUM68KState, sp[1]) }, @@ -618,13 +619,16 @@ static const MonitorDef m68k_monitor_defs[] =3D { { "mmusr", offsetof(CPUM68KState, mmu.mmusr) }, { NULL }, }; +#endif =20 #include "hw/core/sysemu-cpu-ops.h" =20 static const struct SysemuCPUOps m68k_sysemu_ops =3D { .has_work =3D m68k_cpu_has_work, .get_phys_addr_debug =3D m68k_cpu_get_phys_addr_debug, +#ifdef CONFIG_HMP .monitor_defs =3D m68k_monitor_defs, +#endif }; #endif /* !CONFIG_USER_ONLY */ =20 diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c index 13ebb122a38..51c720bdbc0 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -997,7 +997,7 @@ static const Property sparc_cpu_properties[] =3D { =20 #ifdef TARGET_SPARC64 #include "monitor/hmp.h" - +#ifdef CONFIG_HMP static const MonitorDef sparc64_monitor_defs[] =3D { { "asi", offsetof(CPUSPARCState, asi) }, { "pstate", offsetof(CPUSPARCState, pstate) }, @@ -1009,6 +1009,7 @@ static const MonitorDef sparc64_monitor_defs[] =3D { { NULL }, }; #endif +#endif =20 #include "hw/core/sysemu-cpu-ops.h" =20 @@ -1016,7 +1017,7 @@ static const struct SysemuCPUOps sparc_sysemu_ops =3D= { .has_work =3D sparc_cpu_has_work, .get_phys_addr_debug =3D sparc_cpu_get_phys_addr_debug, .legacy_vmsd =3D &vmstate_sparc_cpu, -#if defined(TARGET_SPARC64) +#if defined(TARGET_SPARC64) && defined(CONFIG_HMP) .monitor_defs =3D sparc64_monitor_defs, #endif }; --=20 2.54.0 From nobody Sun Jul 26 11:53:26 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782422639; cv=none; d=zohomail.com; s=zohoarc; b=Q3sR8lm1P7lNNiyTOU7smolZrGHGXRyrPzYv5qeUuKBrsthdIvUKi8RLLnwByVTQuBH12gCFP02dbzQvAHBeK8aLg93N13HHW4tzNCOxo3HvdEwowjL7xnzfxil/wh5qWx/NYvZRZzDDYEOXLkQ25I6lPAK/UE8CEb+2mNaQlUk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782422639; 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=q8yNuPkSRmwG2FtTaJ9taZvjiz2bPiOWU/0IOstoqqY=; b=RxJw+VaguaLstbB5tQ9v7cSq1LoyZ4B5xs7RBfvUbC0FVFlb4h0ic2Lm5kd3GLgwA53JE5kutcuTbHOCxjPznHVKbVdOjBXMniMaIsat1NwYhjIZBgnS/4ylTqFHC9QjUG6K29G5TWa8+9eq7CoK3wk1kzBY+1J+901yz1whvUM= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1782422639010226.8315784714007; Thu, 25 Jun 2026 14:23:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wcrXA-0007kk-7X; Thu, 25 Jun 2026 17:22:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrX9-0007kM-3c for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:22:51 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrX7-00046M-51 for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:22:50 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-588-pIhRMi1OMGaqRIkP0mVfRQ-1; Thu, 25 Jun 2026 17:22:47 -0400 Received: from mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.95]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5D2691955F18; Thu, 25 Jun 2026 21:22:46 +0000 (UTC) Received: from localhost (unknown [10.44.24.16]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 28B7E30A8; Thu, 25 Jun 2026 21:22:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782422568; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=q8yNuPkSRmwG2FtTaJ9taZvjiz2bPiOWU/0IOstoqqY=; b=PiVq47+qrQ/l3qox13F/WpddEFiulMDSyCI6KXgmOZtukihpT2nrG5TbEQ3JfrXlsavt9d 7LmjAUPfAsGoaqVxWBdBUGdpPaM8cZ/OYslgGHPj4kwGqiNxLBMFu48C3hqt9irSC6CgK7 /cTX8BunLvwAAdgOYpNEJ4ZN5aO1U2k= X-MC-Unique: pIhRMi1OMGaqRIkP0mVfRQ-1 X-Mimecast-MFC-AGG-ID: pIhRMi1OMGaqRIkP0mVfRQ_1782422566 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 26 Jun 2026 01:19:37 +0400 Subject: [PATCH v2 36/39] hw: guard BusClass::print_dev with CONFIG_HMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260626-qemu-no-hmp-v2-36-8af31bc54c61@redhat.com> References: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> In-Reply-To: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster X-Developer-Signature: v=1; a=openpgp-sha256; l=9322; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=2CsYO/ueypyjal1LK5FE8EKb7V0DI5Zh8hvtTU3txZk=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqPZte3PPLIyIOvPXiTtikIMDZAf2Ihn0VRpJNs LAhIqe6aPKJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaj2bXgAKCRDa6OEJdZac 5QALD/9+dIghBocYlvhfNQZw/gN0cNJ5aXrllSQ8eOxOEZkw8Ci7ji51ojaSnzhqDnqKk3bMPwi xfwhuGpUSKyzopGBBKfxRQGojZMFIjplA64F20pj84MwHWq7k0Bb3XEr0iBCdhbbnu5J9JSj30e xHtN52h0XG5IL80SZ/Sf/mHBNMlBEsAIegBdFwPThUMHFRfWSBNSqea044oCxC5Uj/dZ7YGu7ei UrdyvQv89U0bz10Icmn7QlMox+/44tGgRB0mG4YRQ3eyU0PN3wtEM+crHKvsEreTIs6apUtF3lE atqfaZFh62eJp71JyRApQ2UJCe/BzioBng/I5Z0Y1xJd0usr1kkcZv+2XP5/BMxqN/BjTrKxB2A SfFCQf5qn/OsE3YuZYpP7X7Y64UXDb+18FVNnjTYPkDrlac51lYVtRtW6uDNMESHTHG6b85Aceb oBAw0YQaMl6EoUm5eNnTBBwIXHdxj4WWx+rpZqd0184VNS6a9GPrN9t6WxhdNXDlq2jyFp/WYfX 7U5PEg75sqT2+8W++KUEYO5zoyQbmgtIjm/r8uiT9PevddKmosimap23wo5nMYXJtmgsXaCRZxB SWZz8OlMEAKrtq3XeJGs+VkRglzU17HILg+ZFWajXwtyVIVhPkNixrF+46MawynEiViIcKOkvq8 qp9E7ecI8LCQ9MQ== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.6 on 10.30.177.95 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 8 X-Spam_score: 0.8 X-Spam_bar: / X-Spam_report: (0.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-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: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1782422640395158500 The print_dev callback is only used by HMP 'info qtree'. Guard the field in BusClass, all implementations, and the caller with CONFIG_HMP. Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/hw/core/qdev.h | 2 ++ hw/char/virtio-serial-bus.c | 6 ++++++ hw/core/sysbus.c | 6 ++++++ hw/misc/auxbus.c | 16 +++++++++++----- hw/pci/pci-hmp-cmds.c | 2 ++ hw/pci/pci.c | 2 ++ hw/usb/bus.c | 6 ++++++ hw/xen/xen-bus.c | 4 ++++ 8 files changed, 39 insertions(+), 5 deletions(-) diff --git a/include/hw/core/qdev.h b/include/hw/core/qdev.h index e1476223411..22dd143acf0 100644 --- a/include/hw/core/qdev.h +++ b/include/hw/core/qdev.h @@ -322,8 +322,10 @@ DECLARE_OBJ_CHECKERS(BusState, BusClass, struct BusClass { ObjectClass parent_class; =20 +#ifdef CONFIG_HMP /* FIXME first arg should be BusState */ void (*print_dev)(Monitor *mon, DeviceState *dev, int indent); +#endif /* * Return a newly allocated string containing the path of the * device on this bus. diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c index cd234dc6db1..34a723a8715 100644 --- a/hw/char/virtio-serial-bus.c +++ b/hw/char/virtio-serial-bus.c @@ -833,7 +833,9 @@ static int virtio_serial_load_device(VirtIODevice *vdev= , QEMUFile *f, return 0; } =20 +#ifdef CONFIG_HMP static void virtser_bus_dev_print(Monitor *mon, DeviceState *qdev, int ind= ent); +#endif =20 static const Property virtser_props[] =3D { DEFINE_PROP_UINT32("nr", VirtIOSerialPort, id, VIRTIO_CONSOLE_BAD_ID), @@ -842,8 +844,10 @@ static const Property virtser_props[] =3D { =20 static void virtser_bus_class_init(ObjectClass *klass, const void *data) { +#ifdef CONFIG_HMP BusClass *k =3D BUS_CLASS(klass); k->print_dev =3D virtser_bus_dev_print; +#endif } =20 static const TypeInfo virtser_bus_info =3D { @@ -853,6 +857,7 @@ static const TypeInfo virtser_bus_info =3D { .class_init =3D virtser_bus_class_init, }; =20 +#ifdef CONFIG_HMP static void virtser_bus_dev_print(Monitor *mon, DeviceState *qdev, int ind= ent) { VirtIOSerialPort *port =3D VIRTIO_SERIAL_PORT(qdev); @@ -863,6 +868,7 @@ static void virtser_bus_dev_print(Monitor *mon, DeviceS= tate *qdev, int indent) port->host_connected ? "on" : "off", port->throttled ? "on" : "off"); } +#endif =20 /* This function is only used if a port id is not provided by the user */ static uint32_t find_free_port_id(VirtIOSerial *vser) diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c index 3e1160ee921..0b970d6b64f 100644 --- a/hw/core/sysbus.c +++ b/hw/core/sysbus.c @@ -23,7 +23,9 @@ #include "monitor/monitor.h" #include "system/address-spaces.h" =20 +#ifdef CONFIG_HMP static void sysbus_dev_print(Monitor *mon, DeviceState *dev, int indent); +#endif static char *sysbus_get_fw_dev_path(DeviceState *dev); =20 typedef struct SysBusFind { @@ -75,7 +77,9 @@ static void system_bus_class_init(ObjectClass *klass, con= st void *data) { BusClass *k =3D BUS_CLASS(klass); =20 +#ifdef CONFIG_HMP k->print_dev =3D sysbus_dev_print; +#endif k->get_fw_dev_path =3D sysbus_get_fw_dev_path; } =20 @@ -248,6 +252,7 @@ bool sysbus_realize_and_unref(SysBusDevice *dev, Error = **errp) return qdev_realize_and_unref(DEVICE(dev), sysbus_get_default(), errp); } =20 +#ifdef CONFIG_HMP static void sysbus_dev_print(Monitor *mon, DeviceState *dev, int indent) { SysBusDevice *s =3D SYS_BUS_DEVICE(dev); @@ -260,6 +265,7 @@ static void sysbus_dev_print(Monitor *mon, DeviceState = *dev, int indent) indent, "", s->mmio[i].addr, size); } } +#endif =20 static char *sysbus_get_fw_dev_path(DeviceState *dev) { diff --git a/hw/misc/auxbus.c b/hw/misc/auxbus.c index 877f3456062..dd0629620ac 100644 --- a/hw/misc/auxbus.c +++ b/hw/misc/auxbus.c @@ -46,18 +46,22 @@ } while (0) =20 =20 +#ifdef CONFIG_HMP static void aux_slave_dev_print(Monitor *mon, DeviceState *dev, int indent= ); +#endif static inline I2CBus *aux_bridge_get_i2c_bus(AUXTOI2CState *bridge); =20 /* aux-bus implementation (internal not public) */ static void aux_bus_class_init(ObjectClass *klass, const void *data) { +#ifdef CONFIG_HMP BusClass *k =3D BUS_CLASS(klass); =20 /* AUXSlave has an MMIO so we need to change the way we print informat= ion * in monitor. */ k->print_dev =3D aux_slave_dev_print; +#endif } =20 AUXBus *aux_bus_init(DeviceState *parent, const char *name) @@ -90,11 +94,6 @@ void aux_map_slave(AUXSlave *aux_dev, hwaddr addr) memory_region_add_subregion(bus->aux_io, addr, aux_dev->mmio); } =20 -static bool aux_bus_is_bridge(AUXBus *bus, DeviceState *dev) -{ - return (dev =3D=3D DEVICE(bus->bridge)); -} - I2CBus *aux_get_i2c_bus(AUXBus *bus) { return aux_bridge_get_i2c_bus(bus->bridge); @@ -287,6 +286,12 @@ static const TypeInfo aux_to_i2c_type_info =3D { }; =20 /* aux-slave implementation */ +#ifdef CONFIG_HMP +static bool aux_bus_is_bridge(AUXBus *bus, DeviceState *dev) +{ + return (dev =3D=3D DEVICE(bus->bridge)); +} + static void aux_slave_dev_print(Monitor *mon, DeviceState *dev, int indent) { AUXBus *bus =3D AUX_BUS(qdev_get_parent_bus(dev)); @@ -304,6 +309,7 @@ static void aux_slave_dev_print(Monitor *mon, DeviceSta= te *dev, int indent) object_property_get_uint(OBJECT(s->mmio), "addr", NULL), memory_region_size(s->mmio)); } +#endif =20 void aux_init_mmio(AUXSlave *aux_slave, MemoryRegion *mmio) { diff --git a/hw/pci/pci-hmp-cmds.c b/hw/pci/pci-hmp-cmds.c index a5f6483cc3d..3e378eadfaa 100644 --- a/hw/pci/pci-hmp-cmds.c +++ b/hw/pci/pci-hmp-cmds.c @@ -134,6 +134,7 @@ void hmp_info_pci(Monitor *mon, const QDict *qdict) qapi_free_PciInfoList(info_list); } =20 +#ifdef CONFIG_HMP void pcibus_dev_print(Monitor *mon, DeviceState *dev, int indent) { PCIDevice *d =3D (PCIDevice *)dev; @@ -169,6 +170,7 @@ void pcibus_dev_print(Monitor *mon, DeviceState *dev, i= nt indent) r->addr, r->addr + r->size - 1); } } +#endif =20 void hmp_pcie_aer_inject_error(Monitor *mon, const QDict *qdict) { diff --git a/hw/pci/pci.c b/hw/pci/pci.c index d3191609e28..9e5db952937 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -290,7 +290,9 @@ static void pci_bus_class_init(ObjectClass *klass, cons= t void *data) ResettableClass *rc =3D RESETTABLE_CLASS(klass); FWCfgDataGeneratorClass *fwgc =3D FW_CFG_DATA_GENERATOR_CLASS(klass); =20 +#ifdef CONFIG_HMP k->print_dev =3D pcibus_dev_print; +#endif k->get_dev_path =3D pcibus_get_dev_path; k->get_fw_dev_path =3D pcibus_get_fw_dev_path; k->realize =3D pci_bus_realize; diff --git a/hw/usb/bus.c b/hw/usb/bus.c index 3b6fbd46ac3..753f2d9be56 100644 --- a/hw/usb/bus.c +++ b/hw/usb/bus.c @@ -12,7 +12,9 @@ #include "trace.h" #include "qemu/cutils.h" =20 +#ifdef CONFIG_HMP static void usb_bus_dev_print(Monitor *mon, DeviceState *qdev, int indent); +#endif =20 static char *usb_get_dev_path(DeviceState *dev); static char *usb_get_fw_dev_path(DeviceState *qdev); @@ -31,7 +33,9 @@ static void usb_bus_class_init(ObjectClass *klass, const = void *data) BusClass *k =3D BUS_CLASS(klass); HotplugHandlerClass *hc =3D HOTPLUG_HANDLER_CLASS(klass); =20 +#ifdef CONFIG_HMP k->print_dev =3D usb_bus_dev_print; +#endif k->get_dev_path =3D usb_get_dev_path; k->get_fw_dev_path =3D usb_get_fw_dev_path; hc->unplug =3D qdev_simple_device_unplug_cb; @@ -543,6 +547,7 @@ static const char *usb_speed(unsigned int speed) return txt[speed]; } =20 +#ifdef CONFIG_HMP static void usb_bus_dev_print(Monitor *mon, DeviceState *qdev, int indent) { USBDevice *dev =3D USB_DEVICE(qdev); @@ -554,6 +559,7 @@ static void usb_bus_dev_print(Monitor *mon, DeviceState= *qdev, int indent) usb_speed(dev->speed), dev->product_desc, dev->attached ? ", attached" : ""); } +#endif =20 static char *usb_get_dev_path(DeviceState *qdev) { diff --git a/hw/xen/xen-bus.c b/hw/xen/xen-bus.c index dfad2bc5085..439cd47e849 100644 --- a/hw/xen/xen-bus.c +++ b/hw/xen/xen-bus.c @@ -100,6 +100,7 @@ abort: qemu_xen_xs_transaction_end(xenbus->xsh, tid, true); } =20 +#ifdef CONFIG_HMP static void xen_bus_print_dev(Monitor *mon, DeviceState *dev, int indent) { XenDevice *xendev =3D XEN_DEVICE(dev); @@ -107,6 +108,7 @@ static void xen_bus_print_dev(Monitor *mon, DeviceState= *dev, int indent) monitor_printf(mon, "%*sname =3D '%s' frontend_id =3D %u\n", indent, "", xendev->name, xendev->frontend_id); } +#endif =20 static char *xen_bus_get_dev_path(DeviceState *dev) { @@ -385,7 +387,9 @@ static void xen_bus_class_init(ObjectClass *class, cons= t void *data) BusClass *bus_class =3D BUS_CLASS(class); HotplugHandlerClass *hotplug_class =3D HOTPLUG_HANDLER_CLASS(class); =20 +#ifdef CONFIG_HMP bus_class->print_dev =3D xen_bus_print_dev; +#endif bus_class->get_dev_path =3D xen_bus_get_dev_path; bus_class->realize =3D xen_bus_realize; bus_class->unrealize =3D xen_bus_unrealize; --=20 2.54.0 From nobody Sun Jul 26 11:53:26 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782422638; cv=none; d=zohomail.com; s=zohoarc; b=lPtjXeBy8m2mYo6f5vdEkdYGjOM7P9qp20HhIh43lLXRT010uIOvJZZplNVhADkS/bJiGOqFDFwFeIE9M84gzu5Hn0ZijJPpaOEaMsaaC3Xcx/0AZnPhs9WKMIM4Rt9sJ0gpmnUYENVj7dTTgNF30qhsRScJ5p2sbOfuWmZqFKM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782422638; 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=29Z3rBfPd1tCZESqoKoleKg6oLMW7kB/G4ySrNtwxvo=; b=c7Tdiwk3BebMAw4ksL6UKdCGBI/13QMqe75JiYB7QhAlxD/oQnmQopql3MNONfSQ3pTREpuhXyjRfeHMVOw9FUGHYLQcBYastPAk1C7Tu9Pt/YCOE724KLtD+aoe/p6dlMDN/PerC3yEawp/r8qJ7PrM0u9n8GpI4TCo/dWZ0LY= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1782422638703673.3687041433441; Thu, 25 Jun 2026 14:23:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wcrXH-0007uD-3D; Thu, 25 Jun 2026 17:22:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrXF-0007mO-4a for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:22:57 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrXC-00047N-NI for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:22:56 -0400 Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-668-I_KXnCMKOuWr6OwPvOk5-w-1; Thu, 25 Jun 2026 17:22:52 -0400 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C486D1955E75; Thu, 25 Jun 2026 21:22:51 +0000 (UTC) Received: from localhost (unknown [10.44.24.16]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 34DD61800347; Thu, 25 Jun 2026 21:22:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782422574; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=29Z3rBfPd1tCZESqoKoleKg6oLMW7kB/G4ySrNtwxvo=; b=DSGp+eW3R3qsCDNOB8/zLP563WQ1222VHCUCpNfxvwmYmz+wAAzYpbDKNA83gwt6Ah8Hcj YxELRd6bfOjxftw6CXZhDYou1PfStikfikW+/8WXoRFwtXSn9M3jsjrr5BGNz6ZsZRTWSR r11CxAdwTM/qA7nsRT1l3sSHSjPgGlM= X-MC-Unique: I_KXnCMKOuWr6OwPvOk5-w-1 X-Mimecast-MFC-AGG-ID: I_KXnCMKOuWr6OwPvOk5-w_1782422571 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 26 Jun 2026 01:19:38 +0400 Subject: [PATCH v2 37/39] build-sys: make HMP source files conditional on have_hmp MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260626-qemu-no-hmp-v2-37-8af31bc54c61@redhat.com> References: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> In-Reply-To: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster X-Developer-Signature: v=1; a=openpgp-sha256; l=13380; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=2JAfSLU5I4P1cKSyjKnc5riI/bxpf8qr0sQZXLFVhc4=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqPZte23FKJP0Ukn0mATJSaYhKsWUbzZhPyH+Kp xBpnUCPvMCJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaj2bXgAKCRDa6OEJdZac 5bpbEACnG69rxtx7ir0E45pV+2uhBTRSMWAKCw1NFRUhzNd4UvyjbiAp0PMUwCxGGKACTkCH+2O dw4hn2jUeNwErJMi+SWDsgZxR4rM6nc0tdu88ukJwZutiBemYR/k1w+NSyaizTjycSKEtCk8hvl cEzeU1RIXVY32xwu/9/2+hn+PmNAaJnCA77QNFO3n30Mh5tXeeym/JxoQvFVihsvcyUctDTP/6F X9eIsQGZWWZIbhNt+hg6BwPRWsHWRYZJwpLcuaBFJzIESRHO8iel9yD4KPgME3s+J6gNxDZu+9x 6IblYiyBZyeYTsN26HJMu4B8FREqBU/vzSxokDEHkd9JR7mPo38ksIF0cpkzgJcm0I2jiEf7VAV YsRwjEjAW2rHu/w+U0Ex5qrZuslBycBeTiOkTZLxirG+UMGiE+vSlKRF4uu/Bxg4FJkWYUrlxsh Y5DRUbUFXNMFvrn1bKqQL4X9f5BBm8y8pheZcNkTke4MYDu4U6vTEaItxdQcBhbLUYaLzOudWs0 Muha9zPstUApvQunf4aRkwryeq+6CBgx5bpE+KQKM5NnEKgKk27EhiBeRbsCVYiYPM/2NOC6FoG CmpeSTglYnoaXmrItpEhgQCkpGchzeZISJlUaPvCh8Z92yzA/deaEW0i9Rvx7922C+2cHQHBJhl NUxnYzRBjbNVVMw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 8 X-Spam_score: 0.8 X-Spam_bar: / X-Spam_report: (0.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-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: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1782422640478158500 Exclude all *-hmp-cmds.c files and HMP-only source files from the build when HMP is disabled. Also conditionalise the hmp-commands.hx header generation and the test-hmp qtest. Drop the transient #ifdef CONFIG_HMP, no longer needed. Signed-off-by: Marc-Andr=C3=A9 Lureau --- meson.build | 2 +- hw/pci/pci-hmp-cmds.c | 2 -- monitor/hmp.c | 2 -- audio/meson.build | 4 +++- backends/meson.build | 5 ++++- block/monitor/meson.build | 4 +++- chardev/meson.build | 5 ++++- disas/meson.build | 4 +++- dump/meson.build | 5 ++++- hw/core/meson.build | 5 +++-- hw/i386/meson.build | 4 +++- hw/net/meson.build | 4 +++- hw/pci/meson.build | 4 +++- hw/virtio/meson.build | 4 +++- migration/meson.build | 4 +++- monitor/meson.build | 9 +++++++-- net/meson.build | 4 +++- qom/meson.build | 4 +++- stats/meson.build | 5 ++++- stubs/meson.build | 12 +++++++----- system/meson.build | 9 +++++++-- tests/qtest/meson.build | 8 +++++++- trace/meson.build | 5 ++++- ui/meson.build | 4 +++- 24 files changed, 85 insertions(+), 33 deletions(-) diff --git a/meson.build b/meson.build index 824ba695801..4b208a2c56e 100644 --- a/meson.build +++ b/meson.build @@ -3536,7 +3536,7 @@ hx_headers =3D [ ['qemu-options.hx', 'qemu-options.def'], ['qemu-img-cmds.hx', 'qemu-img-cmds.h'], ] -if have_system +if have_system and have_hmp hx_headers +=3D [ ['hmp-commands.hx', 'hmp-commands.h'], ['hmp-commands-info.hx', 'hmp-commands-info.h'], diff --git a/hw/pci/pci-hmp-cmds.c b/hw/pci/pci-hmp-cmds.c index 3e378eadfaa..a5f6483cc3d 100644 --- a/hw/pci/pci-hmp-cmds.c +++ b/hw/pci/pci-hmp-cmds.c @@ -134,7 +134,6 @@ void hmp_info_pci(Monitor *mon, const QDict *qdict) qapi_free_PciInfoList(info_list); } =20 -#ifdef CONFIG_HMP void pcibus_dev_print(Monitor *mon, DeviceState *dev, int indent) { PCIDevice *d =3D (PCIDevice *)dev; @@ -170,7 +169,6 @@ void pcibus_dev_print(Monitor *mon, DeviceState *dev, i= nt indent) r->addr, r->addr + r->size - 1); } } -#endif =20 void hmp_pcie_aer_inject_error(Monitor *mon, const QDict *qdict) { diff --git a/monitor/hmp.c b/monitor/hmp.c index c9e207c7a30..4926972a3fb 100644 --- a/monitor/hmp.c +++ b/monitor/hmp.c @@ -1616,9 +1616,7 @@ static int get_monitor_def(Monitor *mon, int64_t *pva= l, const char *name) if (cs =3D=3D NULL) { return -1; } -#ifdef CONFIG_HMP md =3D cs->cc->sysemu_ops->monitor_defs; -#endif if (md =3D=3D NULL) { return -1; } diff --git a/audio/meson.build b/audio/meson.build index 0e33b6f9836..6655f601b11 100644 --- a/audio/meson.build +++ b/audio/meson.build @@ -9,7 +9,9 @@ audio_ss.add(files( )) =20 # deprecated since v10.2, to be removed -system_ss.add(files('audio-hmp-cmds.c', 'wavcapture.c')) +if have_hmp + system_ss.add(files('audio-hmp-cmds.c', 'wavcapture.c')) +endif =20 audio_modules =3D {} foreach m : [ diff --git a/backends/meson.build b/backends/meson.build index 60021f45d12..a59729f56fe 100644 --- a/backends/meson.build +++ b/backends/meson.build @@ -1,6 +1,5 @@ system_ss.add([files( 'cryptodev-builtin.c', - 'cryptodev-hmp-cmds.c', 'cryptodev.c', 'hostmem-ram.c', 'hostmem.c', @@ -10,6 +9,10 @@ system_ss.add([files( 'confidential-guest-support.c', ), numa]) =20 +if have_hmp + system_ss.add(files('cryptodev-hmp-cmds.c')) +endif + if host_os !=3D 'windows' system_ss.add(files('rng-random.c')) if host_os !=3D 'emscripten' diff --git a/block/monitor/meson.build b/block/monitor/meson.build index 74faced9e17..2d5c157a739 100644 --- a/block/monitor/meson.build +++ b/block/monitor/meson.build @@ -1,3 +1,5 @@ -system_ss.add(files('block-hmp-cmds.c')) +if have_hmp + system_ss.add(files('block-hmp-cmds.c')) +endif block_ss.add(files('bitmap-qmp-cmds.c')) system_ss.add(files('qmp-cmds.c')) diff --git a/chardev/meson.build b/chardev/meson.build index 56ee39ac0b0..031b6d7238c 100644 --- a/chardev/meson.build +++ b/chardev/meson.build @@ -30,11 +30,14 @@ endif chardev_ss =3D chardev_ss.apply({}) =20 system_ss.add(files( - 'char-hmp-cmds.c', 'msmouse.c', 'wctablet.c', 'testdev.c')) =20 +if have_hmp + system_ss.add(files('char-hmp-cmds.c')) +endif + chardev_modules =3D {} =20 if brlapi.found() diff --git a/disas/meson.build b/disas/meson.build index 42977a1f74d..b382550e41f 100644 --- a/disas/meson.build +++ b/disas/meson.build @@ -20,5 +20,7 @@ common_ss.add(when: 'CONFIG_TCG', if_true: files( 'objdump.c' )) common_ss.add(files('disas-common.c')) -system_ss.add(files('disas-mon.c')) +if have_hmp + system_ss.add(files('disas-mon.c')) +endif specific_ss.add(capstone) diff --git a/dump/meson.build b/dump/meson.build index 26e1561ed48..bef8276aa5a 100644 --- a/dump/meson.build +++ b/dump/meson.build @@ -1,3 +1,6 @@ -system_ss.add([files('dump.c', 'dump-hmp-cmds.c'), snappy, lzo]) +system_ss.add([files('dump.c'), snappy, lzo]) +if have_hmp + system_ss.add(files('dump-hmp-cmds.c')) +endif specific_ss.add(when: 'CONFIG_WINDUMP', if_true: files('win_dump-x86.c')) system_ss.add(when: 'CONFIG_WINDUMP', if_false: files('win_dump-stubs.c')) diff --git a/hw/core/meson.build b/hw/core/meson.build index 8a96567de8f..8fe776d2c86 100644 --- a/hw/core/meson.build +++ b/hw/core/meson.build @@ -26,13 +26,11 @@ system_ss.add(when: 'CONFIG_SPLIT_IRQ', if_true: files(= 'split-irq.c')) system_ss.add(when: 'CONFIG_XILINX_AXI', if_true: files('stream.c')) system_ss.add(when: 'CONFIG_PLATFORM_BUS', if_true: files('sysbus-fdt.c')) system_ss.add(when: 'CONFIG_EIF', if_true: [files('eif.c'), zlib, libcbor,= gnutls]) - system_ss.add(files( 'cpu-system.c', 'fw-path-provider.c', 'hotplug.c', 'loader.c', - 'machine-hmp-cmds.c', 'machine-qmp-cmds.c', 'machine.c', 'nmi.c', @@ -46,6 +44,9 @@ system_ss.add(files( 'vm-change-state-handler.c', 'clock-vmstate.c', )) +if have_hmp + system_ss.add(files('machine-hmp-cmds.c')) +endif user_ss.add(files( 'cpu-user.c', 'qdev-user.c', diff --git a/hw/i386/meson.build b/hw/i386/meson.build index b611fbb5a7f..125f4ce894c 100644 --- a/hw/i386/meson.build +++ b/hw/i386/meson.build @@ -24,7 +24,9 @@ i386_ss.add(when: 'CONFIG_VTD', if_true: files('intel_iom= mu.c')) i386_ss.add(when: 'CONFIG_VTD_ACCEL', if_true: files('intel_iommu_accel.c'= )) i386_ss.add(when: 'CONFIG_SGX', if_true: files('sgx-epc.c','sgx.c'), if_false: files('sgx-stub.c')) -stub_ss.add(files('sgx-hmp-stub.c')) +if have_hmp + stub_ss.add(files('sgx-hmp-stub.c')) +endif =20 i386_ss.add(when: 'CONFIG_ACPI', if_true: files('acpi-common.c')) i386_ss.add(when: 'CONFIG_PC', if_true: files( diff --git a/hw/net/meson.build b/hw/net/meson.build index 84f142df222..df3373be03b 100644 --- a/hw/net/meson.build +++ b/hw/net/meson.build @@ -67,6 +67,8 @@ system_ss.add(when: 'CONFIG_ROCKER', if_true: files( 'rocker/rocker_world.c', )) stub_ss.add(files('rocker/rocker-stubs.c')) -system_ss.add(files('rocker/rocker-hmp-cmds.c')) +if have_hmp + system_ss.add(files('rocker/rocker-hmp-cmds.c')) +endif =20 subdir('can') diff --git a/hw/pci/meson.build b/hw/pci/meson.build index a6cbd89c0a3..984c7327e5d 100644 --- a/hw/pci/meson.build +++ b/hw/pci/meson.build @@ -5,12 +5,14 @@ pci_ss.add(files( 'pci.c', 'pci_bridge.c', 'pci_host.c', - 'pci-hmp-cmds.c', 'pci-qmp-cmds.c', 'pcie_sriov.c', 'shpc.c', 'slotid_cap.c' )) +if have_hmp + pci_ss.add(files('pci-hmp-cmds.c')) +endif # The functions in these modules can be used by devices too. Since we # allow plugging PCIe devices into PCI buses, include them even if # CONFIG_PCI_EXPRESS=3Dn. diff --git a/hw/virtio/meson.build b/hw/virtio/meson.build index 0e023235164..b59f455a511 100644 --- a/hw/virtio/meson.build +++ b/hw/virtio/meson.build @@ -100,6 +100,8 @@ stub_ss.add(files('vhost-user-stub.c')) stub_ss.add(files('virtio-stub.c')) stub_ss.add(files('virtio-md-stubs.c')) =20 -system_ss.add(files('virtio-hmp-cmds.c')) +if have_hmp + system_ss.add(files('virtio-hmp-cmds.c')) +endif =20 system_ss.add(when: 'CONFIG_ACPI', if_true: files('virtio-acpi.c')) diff --git a/migration/meson.build b/migration/meson.build index 0a9a5d0d374..4ab9d99cea6 100644 --- a/migration/meson.build +++ b/migration/meson.build @@ -36,7 +36,9 @@ system_ss.add(files( 'socket.c', 'tls.c', ), gnutls, zlib) -system_ss.add([spice_headers, files('migration-hmp-cmds.c'), spice]) +if have_hmp + system_ss.add([spice_headers, files('migration-hmp-cmds.c'), spice]) +endif =20 if get_option('replication').allowed() system_ss.add(files('colo-failover.c', 'colo.c', 'multifd-colo.c')) diff --git a/monitor/meson.build b/monitor/meson.build index 4c58dd148c0..f67e0291a42 100644 --- a/monitor/meson.build +++ b/monitor/meson.build @@ -2,8 +2,13 @@ qmp_ss.add(files('monitor.c', 'qmp.c', 'qmp-cmds-control.c= ')) =20 system_ss.add(files( 'fds.c', - 'hmp-cmds.c', - 'hmp.c', 'qemu-config-qmp.c', 'qmp-cmds.c', )) + +if have_hmp + system_ss.add(files( + 'hmp-cmds.c', + 'hmp.c', + )) +endif diff --git a/net/meson.build b/net/meson.build index 9c8068b06d1..5bb76d13649 100644 --- a/net/meson.build +++ b/net/meson.build @@ -8,7 +8,6 @@ system_ss.add(files( 'filter-mirror.c', 'filter.c', 'hub.c', - 'net-hmp-cmds.c', 'net.c', 'queue.c', 'socket.c', @@ -16,6 +15,9 @@ system_ss.add(files( 'stream_data.c', 'util.c', )) +if have_hmp + system_ss.add(files('net-hmp-cmds.c')) +endif =20 if get_option('replication').allowed() or \ get_option('colo_proxy').allowed() diff --git a/qom/meson.build b/qom/meson.build index bd6f4aadd78..022d3ad5c8f 100644 --- a/qom/meson.build +++ b/qom/meson.build @@ -10,4 +10,6 @@ if have_system endif =20 qmp_ss.add(files('qom-qmp-cmds.c')) -system_ss.add(files('qom-hmp-cmds.c')) +if have_hmp + system_ss.add(files('qom-hmp-cmds.c')) +endif diff --git a/stats/meson.build b/stats/meson.build index 0728dafcd1c..b5f68a94052 100644 --- a/stats/meson.build +++ b/stats/meson.build @@ -1 +1,4 @@ -system_ss.add(files('stats-hmp-cmds.c', 'stats-qmp-cmds.c')) +system_ss.add(files('stats-qmp-cmds.c')) +if have_hmp + system_ss.add(files('stats-hmp-cmds.c')) +endif diff --git a/stubs/meson.build b/stubs/meson.build index 3b2f2680b19..fe77107cc86 100644 --- a/stubs/meson.build +++ b/stubs/meson.build @@ -85,11 +85,13 @@ if have_system stub_ss.add(files('qmp-cpu.c')) stub_ss.add(files('qmp-cpu-s390x.c')) stub_ss.add(files('qmp-cpu-s390x-kvm.c')) - stub_ss.add(files('hmp-cmd-info_mem.c')) - stub_ss.add(files('hmp-cmd-info_sev.c')) - stub_ss.add(files('hmp-cmd-info_tlb.c')) - stub_ss.add(files('hmp-cmds-hw-s390x.c')) - stub_ss.add(files('hmp-cmds-target-i386.c')) + if have_hmp + stub_ss.add(files('hmp-cmd-info_mem.c')) + stub_ss.add(files('hmp-cmd-info_sev.c')) + stub_ss.add(files('hmp-cmd-info_tlb.c')) + stub_ss.add(files('hmp-cmds-hw-s390x.c')) + stub_ss.add(files('hmp-cmds-target-i386.c')) + endif endif =20 if have_system or have_user diff --git a/system/meson.build b/system/meson.build index cd3193d170b..da4d4fe1f6c 100644 --- a/system/meson.build +++ b/system/meson.build @@ -22,12 +22,17 @@ system_ss.add(files( 'qtest.c', 'rtc.c', 'runstate-action.c', - 'runstate-hmp-cmds.c', 'runstate.c', - 'tpm-hmp-cmds.c', 'watchpoint.c', )) =20 +if have_hmp + system_ss.add(files( + 'runstate-hmp-cmds.c', + 'tpm-hmp-cmds.c', + )) +endif + if have_tpm system_ss.add(files('tpm.c')) endif diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index e154abb05d2..c00a53b2bba 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -26,7 +26,13 @@ qtests_generic =3D [ 'qmp-test', 'qmp-cmd-test', 'qom-test', - 'test-hmp', +] +if have_hmp + qtests_generic +=3D [ + 'test-hmp', + ] +endif +qtests_generic +=3D [ 'qos-test', 'readconfig-test', 'netdev-socket', diff --git a/trace/meson.build b/trace/meson.build index d89a0db82a1..4e5681c44ca 100644 --- a/trace/meson.build +++ b/trace/meson.build @@ -1,4 +1,7 @@ -system_ss.add(files('control-target.c', 'trace-hmp-cmds.c')) +system_ss.add(files('control-target.c')) +if have_hmp + system_ss.add(files('trace-hmp-cmds.c')) +endif trace_rs_targets =3D [] trace_events_files =3D [] foreach item : [ '.' ] + trace_events_subdirs + qapi_trace_events diff --git a/ui/meson.build b/ui/meson.build index 0c6a432948c..433b3b9118c 100644 --- a/ui/meson.build +++ b/ui/meson.build @@ -55,10 +55,12 @@ system_ss.add(png) system_ss.add(files( 'input-barrier.c', 'input.c', - 'ui-hmp-cmds.c', 'ui-qmp-cmds.c', 'util.c', )) +if have_hmp + system_ss.add(files('ui-hmp-cmds.c')) +endif system_ss.add(ui) system_ss.add(when: pixman, if_true: files('console-vc.c'), if_false: file= s('console-vc-stubs.c')) if dbus_display --=20 2.54.0 From nobody Sun Jul 26 11:53:26 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782422595; cv=none; d=zohomail.com; s=zohoarc; b=mgZ/9C3BdGtvpfcs4u3x4u1t1qstN4bhiHwjTtsbg+UN4EM7COMNlYYWEci273froykqxuXOBkcn57g9JbNMyToiQ0XM+HNZbYOFsf2xTIzmcKOXXwwokvOef4Q1wSFxufhaa/n1CHZisJzQo3QeQiHfje58Fg7XDao3e7XyrRQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782422595; 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=ag7F9xteFBEKBw2pzxGC4debp42G/GndA61uJ7Hkh+c=; b=ZkqX8JMZQl1Umabg1KJ3Af+GKOSFDLWJh3eciwMw9IgSl1+fq2B8uxU7sgpXOUtKFIJAtZ0ykliXoctBhPtboMCHliUdhTt/CbwZEZzvXtbXjsXJXBrLTCkOQ9mBxiunC7KAwC0gpgG1PfIG1QlLperfVqkO6XTWMkwtTmWdppU= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 178242259542553.70521114119185; Thu, 25 Jun 2026 14:23:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wcrXM-0008Az-Ks; Thu, 25 Jun 2026 17:23:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrXL-00089q-NL for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:23:03 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrXK-00048O-2J for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:23:03 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-160-6wNs1QmpN26t1RYs9BIEHg-1; Thu, 25 Jun 2026 17:22:58 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3E87A1955D54; Thu, 25 Jun 2026 21:22:57 +0000 (UTC) Received: from localhost (unknown [10.44.24.16]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 0B38F180059F; Thu, 25 Jun 2026 21:22:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782422581; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ag7F9xteFBEKBw2pzxGC4debp42G/GndA61uJ7Hkh+c=; b=Qo+gujvqOV5QehMoTbmQ1gOLkHJQnzI03hbsFplVQSopwkI8RCclYb7ThjmsqCReXs4Dzq 0c0eG3NDuPqMBMK9jubLuILOXb13xrLgPqUmCwtbk0Bpk8wryT/3Kuj7e3kRHuGSdQsmvd nePt+tMJSOyd+iYQA2kvgbvebfRZWBE= X-MC-Unique: 6wNs1QmpN26t1RYs9BIEHg-1 X-Mimecast-MFC-AGG-ID: 6wNs1QmpN26t1RYs9BIEHg_1782422577 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 26 Jun 2026 01:19:39 +0400 Subject: [PATCH v2 38/39] monitor: guard HMP internal helpers with CONFIG_HMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260626-qemu-no-hmp-v2-38-8af31bc54c61@redhat.com> References: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> In-Reply-To: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster X-Developer-Signature: v=1; a=openpgp-sha256; l=2129; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=gtrBrCcURBTHkW9jIWAENQN706Ffioe+/a51GP4eiLU=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqPZterzQUa0BCgIB5pptrvVtY1I4DDoVshOXKv 2Ptij36ebeJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaj2bXgAKCRDa6OEJdZac 5V3rD/96Us4HYv8jfvrvJEpaeGYHOHM6hHBaldJT/aN7EExRhwzLWlr/IFR4NVmBiM1+wW8uqBu LVwrxJ0tUmOY4KiJyxGNkgFQzg6DMWCyIccuDXGiuvu9mb0y9tKmwKTjJrcVMFXXUjSagvxdabd rpB0XQH/R5zI1rzdSWQAMqrMQAoZJYl9V6p2eeoFtvVrnneFNBB5cvqHMN8P5u7yEhm6B/PqmAx z9vMDSo2CKYe+DnCBsscwofOGg1unA6Y0ZjyzDccOTHCdXsTetUBrcjdUyqVXMoRPjOtad5YYfB 8PB4CaHRr9NvovU1oMviiyZum7KRHHxEVRU+h6ijesbCczZeOzu93DanBhxZIZ5pYcwF2+skLlM 68zYHczZvLVas4pgSNtudrbXNKjt0EdP51TtjT90FgvvuxyXtIKLNvYgsOdGQRAuybQTWJtQoNQ Q1Yb0TE0kcVlKAgAzw4HREIhRTClXdzM1MXA20BxZoultLOf4xnLaSYCL5pn1y2bbK1U/Z1gaab qZt2iVO4M/cLq8gSyfkCJLdzvH/R9g4yNhcktOoMAkLVmY4zRD7ni4z1eIUx51FLZSJL/uf93G5 1mcTAdlgpoiZjaRI8yTWIpPf6OuBTJR9zUIsA0UISp9HAgZeW2GT01scd4DcUFlOXGoInODqPX/ eGZZQd2qq4qmUiQ== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 8 X-Spam_score: 0.8 X-Spam_bar: / X-Spam_report: (0.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_PASS=-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: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1782422596069158500 Guard monitor_uses_readline() and monitor_is_hmp_non_interactive() with CONFIG_HMP, providing a stub returning false when HMP is disabled. Also guard the HMP code paths in monitor_accept_input() and monitor_data_destroy() that reference MonitorHMP fields. Signed-off-by: Marc-Andre Lureau --- monitor/monitor.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/monitor/monitor.c b/monitor/monitor.c index 50f1fe77c33..c8207af57ec 100644 --- a/monitor/monitor.c +++ b/monitor/monitor.c @@ -116,6 +116,7 @@ bool monitor_cur_is_qmp(void) return cur_mon && monitor_is_qmp(cur_mon); } =20 +#ifdef CONFIG_HMP /** * Is @mon is using readline? * Note: not all HMP monitors use readline, e.g., gdbserver has a @@ -134,6 +135,12 @@ static inline bool monitor_is_hmp_non_interactive(cons= t Monitor *mon) =20 return !monitor_uses_readline(container_of(mon, MonitorHMP, common)); } +#else +static inline bool monitor_is_hmp_non_interactive(const Monitor *mon) +{ + return false; +} +#endif =20 static gboolean monitor_unblocked(void *do_not_use, GIOCondition cond, void *opaque) @@ -540,6 +547,7 @@ static void monitor_accept_input(void *opaque) { Monitor *mon =3D opaque; =20 +#ifdef CONFIG_HMP qemu_mutex_lock(&mon->mon_lock); if (!monitor_is_qmp(mon)) { MonitorHMP *hmp_mon =3D container_of(mon, MonitorHMP, common); @@ -555,6 +563,7 @@ static void monitor_accept_input(void *opaque) } else { qemu_mutex_unlock(&mon->mon_lock); } +#endif =20 qemu_chr_fe_accept_input(&mon->chr); } @@ -631,9 +640,11 @@ void monitor_data_destroy(Monitor *mon) if (monitor_is_qmp(mon)) { monitor_data_destroy_qmp(container_of(mon, MonitorQMP, common)); } else { +#ifdef CONFIG_HMP MonitorHMP *hmp_mon =3D container_of(mon, MonitorHMP, common); readline_free(hmp_mon->rs); g_free(hmp_mon->mon_cpu_path); +#endif } g_string_free(mon->outbuf, true); qemu_mutex_destroy(&mon->mon_lock); --=20 2.54.0 From nobody Sun Jul 26 11:53:26 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1782422624; cv=none; d=zohomail.com; s=zohoarc; b=L+CKKREelpHpBKsk28Aa7MBqOQmHHbSFSkUd/5GKJN54iJp03kh9wBfopoI1VROzj0SbyAbgW7eQ44Ak31Xkw7hIvpf2gzcz7ntQa3udA+GNYD58pYIO8McHjx4q56piLZSB6GCAvXG1kCJl9gxRfCpppRGRnhY05KuMUGAIk2Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1782422624; 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=t80BfEWkfSGFH37H9VOynd9pfUSEwTWajT3v7BkCWk8=; b=gXW9WP+gyLV0W6pZ7Oh6vbZSm4sDF1dBRBRLetQ2YrFIoWvQlzgJIIFKJy9B+BQizoILw8H9Tg05rRxK6MHA87byk/Oxmv4+mrNT/cuwTx3rrB2PvNR1aBvatzeoqWMX+kw5LqAe8IvbaFJJqP/PDhiUuol40A6CK+MhMqP4FJQ= 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1782422624340598.191431830917; Thu, 25 Jun 2026 14:23:44 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wcrXS-0008IV-Lj; Thu, 25 Jun 2026 17:23:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrXR-0008D0-0M for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:23:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wcrXP-00048k-DF for qemu-devel@nongnu.org; Thu, 25 Jun 2026 17:23:08 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-488-7Fej8yNOOjm3Voa4CyR4oQ-1; Thu, 25 Jun 2026 17:23:03 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7504F1873C12; Thu, 25 Jun 2026 21:23:02 +0000 (UTC) Received: from localhost (unknown [10.44.24.16]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2CF82195608D; Thu, 25 Jun 2026 21:23:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782422586; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=t80BfEWkfSGFH37H9VOynd9pfUSEwTWajT3v7BkCWk8=; b=fMsOS2e/b7pKp+7eJU5Q6dA4Eui27BFYTHVlCamH5Sf07vqa02CVql8+XfmHWPAUv+hCdh maukEbp1s8c8jq/jRsCGJosJKLKHPrB5D8KSsB1YHU7hWD3Z/g37nYJag8zGX86KnIeIo+ p8wRGDhRd5lSHk2nDS04UkGXKyMDqFk= X-MC-Unique: 7Fej8yNOOjm3Voa4CyR4oQ-1 X-Mimecast-MFC-AGG-ID: 7Fej8yNOOjm3Voa4CyR4oQ_1782422582 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Fri, 26 Jun 2026 01:19:40 +0400 Subject: [PATCH v2 39/39] monitor: guard HMP monitor API with CONFIG_HMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260626-qemu-no-hmp-v2-39-8af31bc54c61@redhat.com> References: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> In-Reply-To: <20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster X-Developer-Signature: v=1; a=openpgp-sha256; l=4284; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=BaSExTs++36GT2j1R0szz6+T1BCUasqyW+Wnzi0jGlI=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqPZtep+bmJC85TeMfyIvXA1oVaUC2gKnkqcuYk uQ1SlC14M+JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCaj2bXgAKCRDa6OEJdZac 5WNpEACRTk7iwPlFLTY4fVGDHfe4twkM0TTME7eQT/cjo0hnhzAdCSvEHrYOHSAhQgc6GafreRS kL5eUhD4fk9Ui8Is6fst/4tBzwmhNSGKqIp4lYtKIqSN7E+XV1iApldp9ym4UUuoEESS7O84Aa2 POUbdUla944ZWJlPWqDE8JUl+7NA5WsCQAP4LeZQW80T2ReHXHtcC2aXj0RRjNQUpOguKxAq8Lc TghnaSNqrFxB2hZE9u1kJAUqlDsyRvd0KEXAWp8Aj7drNlMZ+drqZT1bjGC3GpwCqmt+Y/KqZ33 uo7MlKUGLnTZdn7LEGMHpDcustY1A3DPeebC9vTUJqRuLl1QQG1xLEbw2GAbirbqC0HOPHsAqiY ekohYupbgcwF7hVopeY+bDpANyaTTHc7XwIMx1ybIDTbKqlFYtJ1tccm5+gOOIqVVyLvimttXit RyVPb3+02MOzn0lsAwc2wrBdhGJ1hfMVXY3UoyBgjdggPilGnzWG9EFfWKaV/R8hidKNS0RZJiy Am7zWcopp/16hcmofRpD+2d5rTg9ux1KdR1xm9v6jkqBtFAhYVDN+iCapDoaS6NQADooUGa2GrA ZiLw5Yh/5097W0BHDERbvcTZnGJKZerQ1gfYLlhZPYirhtpM+lm4hwT+vpqhQbGGXJ+FMfgujJu 1f4k+OBJB8ywpqw== X-Developer-Key: i=marcandre.lureau@redhat.com; a=openpgp; fpr=87A9BD933F87C606D276F62DDAE8E10975969CE5 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.445, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1782422626359158500 Now that all callers of HMP-specific monitor APIs have been guarded by prior patches, wrap the public declarations and their definitions with CONFIG_HMP: - monitor.h: guard monitor_vprintf/printf/printc, monitor_init_hmp, monitor_read_command/password, and monitor_register_hmp* - monitor.c: guard monitor_vprintf/printf/printc definitions - stubs/monitor-core.c: guard monitor_vprintf stub - stubs/monitor-internal.c: guard monitor_init_hmp stub Signed-off-by: Marc-Andre Lureau --- include/monitor/monitor.h | 11 +++++++++++ monitor/monitor.c | 2 ++ stubs/monitor-core.c | 2 ++ stubs/monitor-internal.c | 2 ++ 4 files changed, 17 insertions(+) diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h index 17182e626a7..3457f4a7f88 100644 --- a/include/monitor/monitor.h +++ b/include/monitor/monitor.h @@ -20,7 +20,9 @@ bool monitor_cur_is_qmp(void); void monitor_init_globals(void); void monitor_init_globals_core(void); void monitor_init_qmp(Chardev *chr, bool pretty, Error **errp); +#ifdef CONFIG_HMP void monitor_init_hmp(Chardev *chr, bool use_readline, Error **errp); +#endif int monitor_init(MonitorOptions *opts, bool allow_hmp, Error **errp); int monitor_init_opts(QemuOpts *opts, Error **errp); void monitor_cleanup(void); @@ -32,28 +34,37 @@ int monitor_get_fd(Monitor *mon, const char *fdname, Er= ror **errp); int monitor_fd_param(Monitor *mon, const char *fdname, Error **errp); =20 int monitor_puts(Monitor *mon, const char *str); + +#ifdef CONFIG_HMP int monitor_vprintf(Monitor *mon, const char *fmt, va_list ap) G_GNUC_PRINTF(2, 0); int monitor_printf(Monitor *mon, const char *fmt, ...) G_GNUC_PRINTF(2, 3); void monitor_printc(Monitor *mon, int ch); +#endif + void monitor_flush(Monitor *mon); int monitor_get_cpu_index(Monitor *mon); =20 int monitor_puts_locked(Monitor *mon, const char *str); void monitor_flush_locked(Monitor *mon); =20 + +#ifdef CONFIG_HMP void monitor_read_command(MonitorHMP *mon, int show_prompt); int monitor_read_password(MonitorHMP *mon, ReadLineFunc *readline_func, void *opaque); +#endif =20 AddfdInfo *monitor_fdset_add_fd(int fd, bool has_fdset_id, int64_t fdset_i= d, const char *opaque, Error **errp); int monitor_fdset_dup_fd_add(int64_t fdset_id, int flags, Error **errp); void monitor_fdset_dup_fd_remove(int dup_fd); =20 +#ifdef CONFIG_HMP void monitor_register_hmp(const char *name, bool info, void (*cmd)(Monitor *mon, const QDict *qdict)); void monitor_register_hmp_info_hrt(const char *name, HumanReadableText *(*handler)(Error **e= rrp)); +#endif =20 #endif /* MONITOR_H */ diff --git a/monitor/monitor.c b/monitor/monitor.c index c8207af57ec..8ea1bafd99e 100644 --- a/monitor/monitor.c +++ b/monitor/monitor.c @@ -218,6 +218,7 @@ int monitor_puts(Monitor *mon, const char *str) return monitor_puts_locked(mon, str); } =20 +#ifdef CONFIG_HMP int monitor_vprintf(Monitor *mon, const char *fmt, va_list ap) { char *buf; @@ -274,6 +275,7 @@ void monitor_printc(Monitor *mon, int c) } monitor_printf(mon, "'"); } +#endif =20 static MonitorQAPIEventConf monitor_qapi_event_conf[QAPI_EVENT__MAX] =3D { /* Limit guest-triggerable events to 1 per second */ diff --git a/stubs/monitor-core.c b/stubs/monitor-core.c index 078a5012e9b..b4a4de41aa2 100644 --- a/stubs/monitor-core.c +++ b/stubs/monitor-core.c @@ -21,6 +21,7 @@ void qapi_event_emit(QAPIEvent event, QDict *qdict) { } =20 +#ifdef CONFIG_HMP int monitor_vprintf(Monitor *mon, const char *fmt, va_list ap) { /* @@ -37,3 +38,4 @@ int monitor_vprintf(Monitor *mon, const char *fmt, va_lis= t ap) } return -1; } +#endif diff --git a/stubs/monitor-internal.c b/stubs/monitor-internal.c index 4fece49d531..29274bd2b4a 100644 --- a/stubs/monitor-internal.c +++ b/stubs/monitor-internal.c @@ -8,6 +8,8 @@ int monitor_get_fd(Monitor *mon, const char *name, Error **= errp) return -1; } =20 +#ifdef CONFIG_HMP void monitor_init_hmp(Chardev *chr, bool use_readline, Error **errp) { } +#endif --=20 2.54.0