From nobody Sat May 30 17:44:35 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=1779313847; cv=none; d=zohomail.com; s=zohoarc; b=aJRubtF4uiZ+/jICnj6eTepNqGPOQrXit5xaXu5wKrlenZNn6d7uO++XU2KAiAz6x4IqJUh6Uvt0TOtdLX9DaHaIfol2T4pGTFMTJTbInXli6L2l9LKPp2aJNKz7c0uaAMPWkTBvuaFM0y64J4U9hmwf3QJegaXmZoQ9tLxPiBs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1779313847; 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=mFuMg9Nf51Fo+RmvZ9wx8GSLjsCdERWDd+BzDg9qt+I=; b=M2bl9BqB4Gc1t8LH3CeGWAi0L58+qlHZ93pXsm0tXjnXuZDgSckLp0NhE46o9lb8JHMwiA3XOnYZpdsd1NJnBLNvsdOQIZGlEICCIaIEUDseNUQYNO6Ka6j4Ye0UCbxssjZglTSIw62b9R6s7+u6KD/eDmvFljcaITxFrsZfEFs= 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 1779313847222567.0145842340521; Wed, 20 May 2026 14:50:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wPonz-0006ru-Cf; Wed, 20 May 2026 17:50:19 -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 1wPonx-0006rc-Fr for qemu-devel@nongnu.org; Wed, 20 May 2026 17:50:17 -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 1wPonw-00044d-3U for qemu-devel@nongnu.org; Wed, 20 May 2026 17:50:17 -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-395-vk9_6GmmPRyymEs5Yc3e7Q-1; Wed, 20 May 2026 17:50:13 -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 C9FD6195608B for ; Wed, 20 May 2026 21:50:12 +0000 (UTC) Received: from localhost (unknown [10.44.24.26]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7E2F130002DA; Wed, 20 May 2026 21:50:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779313815; 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=mFuMg9Nf51Fo+RmvZ9wx8GSLjsCdERWDd+BzDg9qt+I=; b=VoRJsoQMAxgNy324S4ZXBYkDmOdRgDuCNw4iFTrYruCZ1neimxH3hFysBHXPRpyqpyE+Pg 3u3KSiTBaDjwUqlzhx8ltfGmO3M5e8TAUkxioxxoAPkVIMlIrN+W1aY1WLrugb9JlizfUY /WMicxEl1LHxfglm93ffir9bQ9lJBzU= X-MC-Unique: vk9_6GmmPRyymEs5Yc3e7Q-1 X-Mimecast-MFC-AGG-ID: vk9_6GmmPRyymEs5Yc3e7Q_1779313813 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Thu, 21 May 2026 01:49:02 +0400 Subject: [PATCH 01/40] vl: fix -monitor none prefix matching MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260521-qemu-no-hmp-v1-1-d104f809e145@redhat.com> References: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> In-Reply-To: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Developer-Signature: v=1; a=openpgp-sha256; l=861; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=MbdsVT0QB2pfR6fNSqyjIdKPIfOJTSHpYH2VOh+5gng=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqDiyCucvsUmDvfrLcuYzWGvu9EB0nZcKfB6Hin IsOXksn59mJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCag4sggAKCRDa6OEJdZac 5ZS4EAC1Lq35St2k7ZwYPLFSrGYRZn6S2R8eiCdvXsoajeghye8FB7spHhBeHUdaLajMX7hXz6T ZzaS9d2ZPOtesXDloUBnbceUAiaGDATRK0yOSaMdqFPP1gf05a3sb/mjtmYwG3+JCDim7Dl8ReZ p5a1+ulub60felMpcWxWSKzQCyZxVwxf+MXRlVX7uGZ3MbIw/lRIiUGGdX8Rf0VjzJAWRqMMNu4 9FBr9oYr9+vODqiRI7tFaLUCyJTLfudSEQcxrIXQUdOtcXGK135JQK/kvTF26kyvoIks0gbARmm QuN5fzmqvlD2usbazCGWiwnw8BeVEPJQsdfy6tLqTIVmVT8BuaZi64aIZpYoG7lWXwzLABGxvYR QJCEbbCR3ag1hHKXe4QunHWwpADnuflcxkVYDeeTqsQfKqOQNeaeW4dYvqcykn/eJLr7GO39QCM jDhvWTLQ701q0+fLnPg9eGhACnbpEoRB//cnNr7QY3qG9XuKkpqAxZ32ghdgSG2/oWX6mqSvF68 zZ/rVeTzRYO8XymxrjwytC2vZ34/rKSzztgdtVMLBipmEW9TgQUyPEBxQmtEuVD1kyZi6g9hRnW VO+4UMzjbO357vjFq7stFxVBFvNdL7OI8k7qSItH4halFkXJFRkfnY2H9LisgaVtDyLiG7qDUhq WSFW13H7+XVG3EA== 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_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: 1779313847885158500 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 e690aa3ed8c..f4d55f0addd 100644 --- a/system/vl.c +++ b/system/vl.c @@ -3216,7 +3216,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 Sat May 30 17:44:35 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=1779313846; cv=none; d=zohomail.com; s=zohoarc; b=XKNKnmcc7AnVJ1L6mOOToczTTW4z3/EIrqzSdUsK5y3446zWnk/ZeJVieb0ScutWyHrJDByLEgUALioqgMARQViUfs6x1/SYbjPteCd85uP1xbt52dzmjyD/WihJjOnfiPqXYDUNx+AZS+/r2iZ/S3tdn05vw79hai1t+w8F/XE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1779313846; 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=9nT4X+Ax/crkv5jiDNFsYV7uISWRVrL55cv0JyHkZgg=; b=fNPIpIJW0KbyL14bokFTpphfMzNJn+nnQhAMzZuOm4hQ4BE9pjxI7TuETpRADSss+A2IFPcRtF6kzogqgcaHhOgJQGm8Ko7iHPfcsrvdY1Awbo8IN2OE3kjVgmJbFc1OkN8DMIxNrxLA9lrHu1Vkr5by9WPueZN1fdO19yQdac8= 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 1779313846677494.89955504879924; Wed, 20 May 2026 14:50:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wPoo4-0006sN-7q; Wed, 20 May 2026 17:50: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 1wPoo3-0006sF-9i for qemu-devel@nongnu.org; Wed, 20 May 2026 17:50:23 -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 1wPoo1-000452-Tv for qemu-devel@nongnu.org; Wed, 20 May 2026 17:50:23 -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-541-IW2NaNIDPSyiS6H6cz76aw-1; Wed, 20 May 2026 17:50:19 -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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B611A180034E for ; Wed, 20 May 2026 21:50:18 +0000 (UTC) Received: from localhost (unknown [10.44.24.26]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 61C9130001A2; Wed, 20 May 2026 21:50:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779313821; 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=9nT4X+Ax/crkv5jiDNFsYV7uISWRVrL55cv0JyHkZgg=; b=Y+0y0ak+IMoHO8e4d/b743HVc7syY5xj8zw+DAs9Hj7uPX35auDcLBBvJYqcFnXa8emaJV CYajlXHc8Z3HXcRPV1HBb2Uc3DP7w4LRsplMD4QIz3WwRNJ6AVjKRG/wkcU+60dt1uCN7O qqaQMoshgTe8fZ4hvyKsHZRXpXH/mCc= X-MC-Unique: IW2NaNIDPSyiS6H6cz76aw-1 X-Mimecast-MFC-AGG-ID: IW2NaNIDPSyiS6H6cz76aw_1779313818 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Thu, 21 May 2026 01:49:03 +0400 Subject: [PATCH 02/40] 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: <20260521-qemu-no-hmp-v1-2-d104f809e145@redhat.com> References: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> In-Reply-To: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Developer-Signature: v=1; a=openpgp-sha256; l=1677; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=DmuatJwycw5b+Kgbt0UY/vBtUV9Z7+jspuiV6gjgjV4=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqDiyCTQCjmTRZs61XOVowhBTHS8Gv1gBdRu3y4 JRqm34Yw12JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCag4sggAKCRDa6OEJdZac 5eycEACD7bvMP7+nYsCK89kME0Y/rqOpnCEvv4THRcYFprqWHt991FhTVXETa1dgv+dSO8gKJPg l+3ubINCO16HcirBB0Ffvo52DGhugf3EkPkDs2I93x/xAV51XQxVZnhQHy+MU3cDgOp3sJIlTJd 8KEg/LEdzkd/39IuTwCBr5cZ+OnPw1s7g0ggftex7z8gPmPeHYV+WZ8LQglOywe5pcgN0b2ErT+ h/Z4EyxQehY4a6eJapF6/Ug875dD4jMYDA5VsulWvHLQyzyBdMyhrwU2OX4TAUc/K9bHKvZCs2O UE8ix8mcBNVTNqJVQWs+VNQ4vYIKKU1KpPzCUX86dm957obr3XYx3zz/H8jG2g3C0DVtVSoTKKE R3K1jOzwL/Kpp72NyWCRV/qE8QOXAJOR8h4YE3/kT88wa7U/hkk88ofCWlUNuBfV0OaofIVpf57 gDDbEU9jxRhRqMdzCboRm8N6OfPX7ANnJ8wNUoEyrfYC8yaJGeY23au91uUXpI5x8W3JUEIPh8U VJjOFux4/46BNLCVM8QYI/jOEPngsBNjuJXykcmyYoTMsEBIMzbMAgGlIngrVYGIlu64XyYE6kZ j2xtiaCGGQ9J3fojqp4H647uZyGQ8uotBswDB31BqVgFoCU3X6sWdA9x1UlMIDRbpGz8wPhfNHL vH/d+mHRIQ8ZRkQ== 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: -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: 1779313849526154100 Fixes: 89aafcf2a793 ("trace: remove code that depends on setting vcpu") Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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 c3a1a95c5fb..750a2f42a80 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 Sat May 30 17:44:35 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=1779313908; cv=none; d=zohomail.com; s=zohoarc; b=VKhd4zSSh4MjZTdiEtUsPSA3tu8pWW4IYCPan8dm9P3ixSIRxJBj83zJBfnJX2uOIUwBXr/mQfXkOLBciRObWOg1lpLE7aqtAk55+PrZNRfJhxa8MSJFnyL2icFChVr3DXLJ8CDBltIVVKUnvi2ULXj0VvAn8fWqKOWwlX4LvCE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1779313908; 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=0eJdJcfyGT1m9XhcdoBH46HTaYnr0mwJYyndbnLTphA=; b=Fb7jok+OYfdh5m0d31FKSYDxExu6AGGqdxDjHkrZd012vtmmLfQ1lr+aN1ltinm9TWRhpZ+RZ9BfWnCbWVHQgxry3XE8NrgPSq5VNROpP4yYPKik6YppzRrrpuggVv2IdzhbRySes/cea6ld89OuH9VKpozy5XH80DTdOwabnqc= 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 1779313908125960.9665537678258; Wed, 20 May 2026 14:51:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wPooA-0006tI-Kq; Wed, 20 May 2026 17:50:30 -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 1wPoo8-0006sv-Vr for qemu-devel@nongnu.org; Wed, 20 May 2026 17:50: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 1wPoo7-00046h-Jj for qemu-devel@nongnu.org; Wed, 20 May 2026 17:50:28 -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-441-KCKaaaZuNZWdS3KBdo7HjQ-1; Wed, 20 May 2026 17:50:25 -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 942131956095 for ; Wed, 20 May 2026 21:50:24 +0000 (UTC) Received: from localhost (unknown [10.44.24.26]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 048D91800357; Wed, 20 May 2026 21:50:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779313826; 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=0eJdJcfyGT1m9XhcdoBH46HTaYnr0mwJYyndbnLTphA=; b=HSCX/c27EGpvM4/WkyRQ94Ob7BIrefpZjzasBSOfIWMoOkBzCPzsollkqbHf3r0HhWO1GT XRcvHUBH4z97LHNXG8xL+iOyCefqVq3DoE50wUcn50D5ZqEpiKLkteuch1ymNQQNOD6KrR uQlqCqcfZYaloHOldCsJYtOW2m56PMc= X-MC-Unique: KCKaaaZuNZWdS3KBdo7HjQ-1 X-Mimecast-MFC-AGG-ID: KCKaaaZuNZWdS3KBdo7HjQ_1779313824 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Thu, 21 May 2026 01:49:04 +0400 Subject: [PATCH 03/40] hmp: fix snapshot_blkdev argument type MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260521-qemu-no-hmp-v1-3-d104f809e145@redhat.com> References: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> In-Reply-To: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Developer-Signature: v=1; a=openpgp-sha256; l=908; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=cmSXXEvy+S/p9NUPm0pNCoVfh6+SHKQEGeOOZ3aepek=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqDiyCeToatH0zY34OITz8+Yr3AoljK1ZQnU703 KvSudVawtuJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCag4sggAKCRDa6OEJdZac 5RW9D/9nWnNhp4ViH3aUMX9HbqZxVAJD3STvdMRON7ZIB+QW+BVsWaHgge+Ysc0ErUFfWY+OO+u alkIojIkBND3dG5i9MguHKpb8zTPQ6eiaDYEfzCNSNG+rqdS82pwbB/8BFQMAXdFdyWSwOm+EyZ ap+I66DOyn94BBz22CmAy4QcctzboEzRwWcuH3v4/+YVhVFi7fxr3GODrn8g0QBXiEcbOCDSg2j rm32aW2vL8vhje+gPvjIlJ9ofrJuohJT7DplGIHmqyGggmqDGnNFYSuQWC9znk5RVeaJWp7bO2M rzu8+QDtpBqbUC0HyQDeHPKi67pL/IrUIOUNZYRUrJTvxxEEAaXmQF+9a+xvKgm2hwM8nURfRJK 6KN9K3snFcOoa4c1paeHRi93qSyOkV+C/b3XE9mTDwXlXIzjXg5ngEEhFKc7jEdlYQzq5kTvUbf 6aYHKIxibOtLuaNXm/2laM4Eqr6k0XJTMps1V4gC+savIDTwWZ3+eW7PR56qswRq+3O8uUOVJTm 2v1Y+zbBkypyFx5Sk4DzT2VNm7pUMf/QLOpEVlNN3FrqA1/QmbssJChiNcnEUF9waf8vfPe8/0F eNWotv374x0b3nvaXF+Wec5gTigogou6wp8EOjxOzWg8xJ/M7OPZygA17FOzNI5t9L6w43EjAz7 tNPRhfGneAwwt0A== 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: 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: 1779313910167158500 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 750a2f42a80..705c8662f4b 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 Sat May 30 17:44:35 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=1779313881; cv=none; d=zohomail.com; s=zohoarc; b=XVF05CeBc4cfgrjjJbGjgPcrOX+p8aWE/Wmv4a4GR8B9V90RlGdh7y9+fYLXxEYSiQ0tH2wY6QtiVBeqYX+ooIu5Vv3tm6QA16VgXP/ntKa73BP9BHsKWWCvfsBu+oZiNWMo2T9wgLUslQs4U4I6AzzaQmhc6JZ8LBVmYgDRthk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1779313881; 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=Zgbilhy9vgfL87SyKBeKQoEo1Sfe5fdtx1DgdjZluhU=; b=g2uF3xJwiIwu8hVIc3+B8zO+wVcolHbhlFUp/gXkHAfJ1ueKpLCK769NW/efM8ETXbuo0NU3JgeNDi/gjdA04IwQGrxo3r+OflkTJmB2BWPDviXLYfC54JhMHfPtRfrd7mjyifx2bx5DT3B7LZdB54kDObQmfXwHDApouUDKC5I= 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 1779313881822955.4240316029113; Wed, 20 May 2026 14:51:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wPooH-0006ti-1e; Wed, 20 May 2026 17:50: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 1wPooF-0006tV-4y for qemu-devel@nongnu.org; Wed, 20 May 2026 17:50:35 -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 1wPooD-00047c-BZ for qemu-devel@nongnu.org; Wed, 20 May 2026 17:50:34 -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-673-suwx-5u5Pe2Y7SPG-x9WwA-1; Wed, 20 May 2026 17:50:31 -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 5418C1956046 for ; Wed, 20 May 2026 21:50:30 +0000 (UTC) Received: from localhost (unknown [10.44.24.26]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 06ACA1800591; Wed, 20 May 2026 21:50:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779313832; 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=Zgbilhy9vgfL87SyKBeKQoEo1Sfe5fdtx1DgdjZluhU=; b=FVD1fW3W3bhiekUX06drTyT9HI8NZ2ymoA+qW22qz3nuB0qvZxGuIW4unUOE6w9vdwK+yi W9t84z4uEscCCMe8mSPRHlVRqTv9cgralpbo2tA4ggvcwGsL5FFU8iPMg/LvltmPN12PWp 9YPZGLbUAjUbwtiaCsd2FxzcLxoqJfU= X-MC-Unique: suwx-5u5Pe2Y7SPG-x9WwA-1 X-Mimecast-MFC-AGG-ID: suwx-5u5Pe2Y7SPG-x9WwA_1779313830 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Thu, 21 May 2026 01:49:05 +0400 Subject: [PATCH 04/40] 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: <20260521-qemu-no-hmp-v1-4-d104f809e145@redhat.com> References: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> In-Reply-To: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Developer-Signature: v=1; a=openpgp-sha256; l=7642; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=yANMK/PMDx6+75gaRNXwSLaOhY0TlOLUb0ODWU3hzAA=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqDiyC0VDhpNkb3N+szmkH8l+vgUNLQ9kzAxlgR UxKyghhjLeJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCag4sggAKCRDa6OEJdZac 5XG4EACZ8jjygagBpbH0xusHyhtp8tx9zEERx66akGZLzvIH/jdfv06q6mwDJan3wj/23GUuZtb krC567yjS4xtx01tV1fCPASvLOGb+QjqPqLmpVK2ewvSXdl2cZuoFAIZFHsdTN4/OxvgW0ApR1b WKIyX+Blu2WEz/2KpVlT3VnQZIbyswWabvZ8IHOaVAQdKxRhgPhfiGQNVIKK4Ei1KHTijYJ+cb+ 6M5mgW1og4OrDcplu4rymetSK/tT7DSHnQODNw+NXVzULpB2HoHKI4NcEs+PtI7AYOmnNdBurfL m5D1SaxjXpNKMcAApfwghis5GpWSPY4wqIzWH+zJ6l/y5ENsJ4BcnowZPVQas4jrldvyL4pD+Kc 35W1ltvGlh12qWDgvq/vfma4l2LDHhkQBrDWcXlAkHmbXxVYSHFLdmJBE8QnAs2qYZcQyEJvtHO iqcc3cHpoYbUntcmr9QE9ocGykzqB40H30lPIps6/fB735cCKrRDea7U+z8NmkeFQosrIVm8WvG lSPsRDHybyzsB56O/W/GdPug4elF6P6H5wt3dh2rR/BGwvMd/DRosb7/cg7WJPKJ+VsOOezYUym ICKdEOTiVV7tuhsJ3nOxmw8jh8/EzPgSpbHgnhWdmREUow8gKM/pConbceav/ri3uWKoXmnFCfT dh/IwO5V8K70qTA== 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_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: 1779313884157154100 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 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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 bdd4fff89d6..da9f51b85b7 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 8cc73f619a9..03265c80b0a 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" @@ -377,7 +377,7 @@ out: } =20 typedef struct MCEInjectionParams { - Monitor *mon; + GString *err; int bank; uint64_t status; uint64_t mcg_status; @@ -424,9 +424,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 @@ -435,10 +435,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 @@ -455,7 +454,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; @@ -484,14 +483,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, @@ -502,21 +503,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)); @@ -535,6 +536,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 Sat May 30 17:44:35 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=1779313881; cv=none; d=zohomail.com; s=zohoarc; b=iVOZVuC6t7WOekue11S5nfI8inTwV+ohyIGYldSrxgVhwjirBj7t5IITBJsBmkr72RQ8M8vG1VwOiCIanJNYQd/xqhUxMRsABSIg5KBGZNTdRmkBRpbbo1VhNuzoH7CLy85zIU9jCa9HV9p/3toUKJrsY+EXje2IiKKfXylyMs4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1779313881; 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=ho9+bos+FxoxTK+kgywlHgnaViRN8O0JYKchFHfp2lE=; b=ngE3LCddprtURIJV46al6yvZd7/n+HaTZgf5whOBEj0ursaZreDN9MdKGls6uGx6dCQoPmGqDRVVW6tRnelXEPPOylvy0L5fVUuqJDTAiAeSO7LVGL/amCMEuOfjDuUCdL0j037LvGzlo67M6L7etz5tGE0ytjhc6+fBViCo+GU= 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 1779313881210652.0479962428349; Wed, 20 May 2026 14:51:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wPooM-0006uF-Tn; Wed, 20 May 2026 17:50:42 -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 1wPooL-0006u7-QI for qemu-devel@nongnu.org; Wed, 20 May 2026 17:50:41 -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 1wPooK-000490-9n for qemu-devel@nongnu.org; Wed, 20 May 2026 17:50:41 -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-304-npeDwFhzOtyNeGkKm6LFkQ-1; Wed, 20 May 2026 17:50: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 F22FC1956053 for ; Wed, 20 May 2026 21:50:35 +0000 (UTC) Received: from localhost (unknown [10.44.24.26]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 907F61681; Wed, 20 May 2026 21:50:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779313839; 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=ho9+bos+FxoxTK+kgywlHgnaViRN8O0JYKchFHfp2lE=; b=X9X5wQmpTLsXS5/eup1bZQULehXlX6zTOUjlCK0arcmSRgjS7AoccWEn1SQf1SMQVEofil 76l8uzxdXt1pNv34PTmhaPs90INWok3dFfXlBUfg9GrqQNNYnRHmRcEj5u5XOHkFMt+4mD 9ZJI5KYaSE+Wpndg1DVKxi1RNAasEzE= X-MC-Unique: npeDwFhzOtyNeGkKm6LFkQ-1 X-Mimecast-MFC-AGG-ID: npeDwFhzOtyNeGkKm6LFkQ_1779313836 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Thu, 21 May 2026 01:49:06 +0400 Subject: [PATCH 05/40] 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: <20260521-qemu-no-hmp-v1-5-d104f809e145@redhat.com> References: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> In-Reply-To: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Developer-Signature: v=1; a=openpgp-sha256; l=4236; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=xFi/sRUUClGuN6YVMPpbyquIv/44+h9uGV2sti/w3V0=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqDiyCtVSz0SER6KMLTZgpkQhIUq54+QMXIDU1W eNatMzRth+JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCag4sggAKCRDa6OEJdZac 5cMBEACXLPuzBs3YjezmdQxV0ZJDL4KeKrgTFGfdprRePeU6WmqAuPhYXpO94w3ZUpomtDU9mL7 5v4RlBdIXJ27Vl+8DFoRPPYMzvd4JTF35DfrqzFq2DjxjCaF2w+d1U9IkJxYZXqnwiYjp+OeHK/ V6p5HhEYGHuHe2P+Bna/ADcUlgvPlxWItUzVLMyaEbd6vRjCofHexxRN8Tu8HUAIvwHVYct4NiF SZsm7I1wm/N4aP1akyX88pxc6JIAmq9zRbH+ohsVlJuIkZti93yhEQREKvGkKLW8p7c9er/a/sy +YM13xl1B75/H3PP29btsyB2+xSTajT18n25XilK1HbEOMdz99ix4KjtevAZ2ruwXH3MbE9avOi +u3Bq/PlJ/G+DVq9U5Q8adpxQ03n0Hhf4DKWOwjVt2d9tczrJMpBu0WorIxoOO82lq3EKqIqQZg k0fg5Ffvt1oDI34rfElTfK8OvYGBwCdxuIUC8ArdslWUvNEhbKZGumHTIdI0I/s/7cJWYHEWifp PKlFs2kAIRoWxpABbZXGgUEu209wdef/Tpac01ssc8h8AxSnxzOojBh9CPDkHPnMFQJ4n7Qmktw cUu31tlutvaqBW5Ki7mKNaIIAqfwBHBt+b1k2b7LWisgqRKZQPVD5DglQU8nBgWpMPx9kU1ksBo HLO+DfP9Acx17Dw== 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_H5=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: 1779313881967158500 The function is now used by SEV code path. Move it to physmem.c rather than hmp-cmds.c. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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 1417132f6d9..e2724e38532 100644 --- a/include/system/memory.h +++ b/include/system/memory.h @@ -3063,4 +3063,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 7bcbf875736..90bf857c9df 100644 --- a/system/physmem.c +++ b/system/physmem.c @@ -4477,3 +4477,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 Sat May 30 17:44:35 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=1779313881; cv=none; d=zohomail.com; s=zohoarc; b=WZmfvU7FvEzKzWMfjB3EuVvpUqF2PoDOOLAVfUJ3rtMjyLCaZbj7lt0+srrJmtbWsR5YVL8u4e4Bg9PUx78KDk48YD5LqUaq4wCvn7rQE5p1oYRG+azm8LxyHPsq7R2ZHbBykFDppeisOh1QgRxuF3ps23rAdKX54F+EVe+0/JQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1779313881; 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=mdeg6KZimag8UGjN/vDgHGgf4EKwXlKAmfn2EJzpOFM=; b=RYf9JCj2jYOgPCcFhzXe1121ARVouYJHQILKfLNR2uD+c1Fqr1nM+dDviML5HGEE8tk2MeEfdRCVarMIpia/OwoXEbjFwSs5hZT/42KUV7SOjxQEauBmTakLkQXPeWfpB5lrPr2zgjV9O+OAWSmM7HOcAG5RmJ6lRETS6Y4jh1g= 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 17793138819561005.5484691922103; Wed, 20 May 2026 14:51:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wPooR-000715-Ca; Wed, 20 May 2026 17:50: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 1wPooQ-0006xQ-9f for qemu-devel@nongnu.org; Wed, 20 May 2026 17:50: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 1wPooO-0004A0-WF for qemu-devel@nongnu.org; Wed, 20 May 2026 17:50:46 -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-30-5BJmYDtMNgi_Mdp79VrOVg-1; Wed, 20 May 2026 17:50: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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DBF3C1956080 for ; Wed, 20 May 2026 21:50:41 +0000 (UTC) Received: from localhost (unknown [10.44.24.26]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7975630001A2; Wed, 20 May 2026 21:50:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779313844; 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=mdeg6KZimag8UGjN/vDgHGgf4EKwXlKAmfn2EJzpOFM=; b=SHoI6yxKNLPK6qJaIHZmZ9XskJ0ReNIhEJAA0oa5UlDfvGjB7rTFOGl4hLOJarKEu4MDZ4 n95hsfJm/0y4CxHzRWN2L75qChsofPK8A2hf9e1IQAAmt+2C6gorr7KBr5URah7/ad1vH5 89HjWTbuwHi5LqoiopQuMBw0bQ97NSM= X-MC-Unique: 5BJmYDtMNgi_Mdp79VrOVg-1 X-Mimecast-MFC-AGG-ID: 5BJmYDtMNgi_Mdp79VrOVg_1779313842 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Thu, 21 May 2026 01:49:07 +0400 Subject: [PATCH 06/40] 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: <20260521-qemu-no-hmp-v1-6-d104f809e145@redhat.com> References: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> In-Reply-To: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Developer-Signature: v=1; a=openpgp-sha256; l=630; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=RCG2TEBkp0lXDDkBP+4/T7m2pCFCYtedJ2NUBZ+T14M=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqDiyCeUpyYYR/MzgGz033z4WkmvVaneW1ZlBGp pMwiIMEBGCJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCag4sggAKCRDa6OEJdZac 5clnD/9HhJl8/gAzGIHf+gKXoTMSt/AZVVRsoqiRDk0HLnuJ3P1XFvdVBBro7kI4WfBjqDszzYH JilJUcxMx6GXS8WJ5oytNArOkvrB0PriiDeqDfmgJqOozTWXxW677B/OOQcc5uzyk64BTM3ZiLU rUOfyvH+hSeAokwtQgG/yPIYweJ5qauuNq/ScqIUL0sJM3T9Pw4kQeocVPhLmgbOcODslX+VyYk FqGVBBaM+KxRG53Otz45PXcUvok06gMvZXDbhESXw/2j6bOIuF7mhbvB06GtO7L3xg7q+xH4QgB jwPQCsiVdxqlTKIPk08W7YKHbAcCCglsIy4JwZwExePN6f+OSdtTh/Nvmi2biMcL6oMK//jnP5L +RLdj/Rvivxl5rhU1C0Yr1NkjUHv+zwC15xy5uNmDzBUJL0Ga98Ao7yN6AhPu6Tej7pxOpcN39k hRyQQs5bZ9hxjsIdX1AnQafuYi+uDif5U0vGsOGonysyZo+ZNvXKmoWyAiNiYYGl1hEr+Wxdm8K 4u39vrF5tNaWO8jzFMSF3m5pA/8zAbdAA4+PYHxh18yTq+EKwljHt2HLCVAnpVXO7KKIyjTCx8/ zu6gRP3N40BdfkuPBHs+EQHm9Gxpye4D9LSMc5APaUylAbFjKsGdyGhXx6uObAgYHQe8fs8uV9T OrVWiYStbBYA4bQ== 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_H5=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: 1779313884051154100 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Eric Farman --- 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 4d35f9b10bc..d27d82a378a 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 Sat May 30 17:44:35 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=1779313876; cv=none; d=zohomail.com; s=zohoarc; b=clr6NZsIlPnaJ+7ZMT0ptEGI4qn2exIT89r54f3HW2b2VMxLHjB6UdIjwaDdoB+tCeRu2rn+EBCTCty/z2mlMgIXZhf2B2YI8PGa8Y/ghXQLK+lGXZkKeqwJYCmG4QnipTQzlykYwvMxO8hGHgnvC62Dmkk6SyOjm2qvKEHRatE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1779313876; 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=DaxMm+ATW0XH2SRjrJ9nzr1kVlKpgwqFzKFlBZW+20c=; b=JolbGYHX/hMwn21vtvL/mILF8u3vAKigLl6+W124Nc2E20Sc8HP3fC2WWyV9D4fBOzL4LQILNH3v8Pfw5r9Xj0wCZwpi7dCH3L7oZUgRImv9pXqwf6Lp+lyfrv7tSnfvc6MAB7tMw4tvGnsG3GcoBkMiFcgJHfUVgaINRHGf8F0= 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 1779313876585716.0519548843642; Wed, 20 May 2026 14:51:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wPooa-00074F-2u; Wed, 20 May 2026 17:50: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 1wPooZ-00073u-Fk for qemu-devel@nongnu.org; Wed, 20 May 2026 17:50:55 -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 1wPooY-0004Hd-0n for qemu-devel@nongnu.org; Wed, 20 May 2026 17:50:55 -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-58-0_IIJDd8NWCGaVjxaSuj0w-1; Wed, 20 May 2026 17:50:51 -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 881DF1800343 for ; Wed, 20 May 2026 21:50:50 +0000 (UTC) Received: from localhost (unknown [10.44.24.26]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B53B018004A3; Wed, 20 May 2026 21:50:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779313853; 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=DaxMm+ATW0XH2SRjrJ9nzr1kVlKpgwqFzKFlBZW+20c=; b=KSU/TccKXEboQOCTR8xvhVmJ3ys0aCs3YZHtRKPgaVGpqBi4dP/yK80nGAC91jggMQwwl3 90EWOAgOwDmoDuV6x4m5dMs/W2czcSyxLXKzvfPSjb5YWoDICC8HAUyhJJHrLKJmezO64N xqHNDqclWhPH85O9YXBnjw7N4eShYug= X-MC-Unique: 0_IIJDd8NWCGaVjxaSuj0w-1 X-Mimecast-MFC-AGG-ID: 0_IIJDd8NWCGaVjxaSuj0w_1779313850 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Thu, 21 May 2026 01:49:08 +0400 Subject: [PATCH 07/40] 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: <20260521-qemu-no-hmp-v1-7-d104f809e145@redhat.com> References: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> In-Reply-To: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Developer-Signature: v=1; a=openpgp-sha256; l=1472; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=UITm5A9BOl36Q/cBlizyzMSRl4g2E0zRKS3yWKFt7nQ=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqDiyCmx70+e9oWUCQahL+F4WRSrzFDVZ23sBEO Ny1NxEYUHCJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCag4sggAKCRDa6OEJdZac 5fBED/9Oko5SEO6aRawDyf+d+2kZ90xzeUn/8M4Y9+STE0J5UeJGBsn9vHfu+dkKT7TUyvRUGqF +L5heGzzyXoJXCI8GkVUSeHs+OcdBD1NZO7G2us/Ce0hYO5aKCcrtJZFvfY43fxaJfV4EMKcVX8 y7It5cjiVZ7XAr79EVq+3+qjoo4vK/37kZfHuJxr1cGLH7q3cgYgWI7wNTGY0u05FhaMoPDKK1g n9ryZvpzwSmOj/DACgRlCQamgEOMDES84/mlPD0rGs+oVLeo3mi5bxCAIQGgykwmvnkays/bRy5 ofeFc99DxCVGBEtKZ7ki1CvfqFXaW9y0Ecc+yIO4Cyl0++UxzBrzMMF/F3OnIHY9QHd/LEy8QqX mGnOYyZTQuO37P1guCwclt6Tx5B/ArgKuFaXmZXQg/pJkneqX8jR5PZsAIHfl9jAkf3BQJQUb1X MC6HZ5fZxsnZcKokP1S6Aavry/JI1K6A6WRS8/ADgekfUX/+S4rEDT1SkL6wJKPOxmUCE2W+JQr 9XeXZFo0DdFEIr+Q0zJP7JVQ2NsgHY7XTy1/E9ye0jXRJBp+T3GuowRtPM5+r1Slm3V3YVkPsKI Vvu3+ySjEgc09+P1N47tksePdDPhhWWhQx9yIoB6OX0hxhxXeqYo5UE8h667kJghvSeLiQlr628 ftK1IRyCtJaqanw== 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_H5=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: 1779313878012154100 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 bded87feb1c..0089eef9b1c 100644 --- a/system/cpus.c +++ b/system/cpus.c @@ -913,6 +913,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 Sat May 30 17:44:35 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=1779313902; cv=none; d=zohomail.com; s=zohoarc; b=Us6WRndZWUMoeOI6y5EsTv3X81hk7tTU8zbQbSdrRUWvUgfABvyDfu/7+xzF1SXJs/Fz9Cn39mYBRjNHfdyME8OP/hAM03IlwlGXgsUol2PUZUGU76xenTkJetFzat+IiJMnayjsH/GKELYeSS4IsrLRNioy8bflgNrTWFnh4/o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1779313902; 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=1LQv/rhoZBwJsycfF7fcJCSjT/fGpRtfUatVJogJqc8=; b=csfSkDdfPra06W2fZvwK3pzAA+RSZvVr2ZxprHv2hk9bvKmyxi8Gyt7MsAgjuwafVBOFBOQPfZmTJf0V4F51jTvZzT6vlyZZ1OIwPSlqQgxeGtA1J4OJ/8HbSN7Buu7gmly9F/5CepiC8yN00dG8TGoYfKrAVdK0zwKNHODFqVc= 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 177931390221848.67154520317115; Wed, 20 May 2026 14:51:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wPooh-00078L-Gz; Wed, 20 May 2026 17:51:03 -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 1wPoog-000784-IK for qemu-devel@nongnu.org; Wed, 20 May 2026 17:51:02 -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 1wPoof-0004Js-8O for qemu-devel@nongnu.org; Wed, 20 May 2026 17:51: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-643-0LY_jnmIPNWQFpK0EaILjQ-1; Wed, 20 May 2026 17:50: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 0BBE919560BB for ; Wed, 20 May 2026 21:50:57 +0000 (UTC) Received: from localhost (unknown [10.44.24.26]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id AC7B41681; Wed, 20 May 2026 21:50:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779313860; 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=1LQv/rhoZBwJsycfF7fcJCSjT/fGpRtfUatVJogJqc8=; b=eii6WlBkNSTWfb/yQWdpxw3cj9/Mwbo2IZK+DShDMBl5UfmNRJ+QrDsAJVW6oXZ9WGQoFw n5crmi6ondQn1FuEJ5pQnpOpzluIa1wL14TWCwZ8wmdhaWDt85lSM3ag5UjAEKUep2Lca8 sCsccP947WsCwxBen1gEvO0hNOeEJho= X-MC-Unique: 0LY_jnmIPNWQFpK0EaILjQ-1 X-Mimecast-MFC-AGG-ID: 0LY_jnmIPNWQFpK0EaILjQ_1779313857 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Thu, 21 May 2026 01:49:09 +0400 Subject: [PATCH 08/40] hmp: correct the nmi documentation MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260521-qemu-no-hmp-v1-8-d104f809e145@redhat.com> References: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> In-Reply-To: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Developer-Signature: v=1; a=openpgp-sha256; l=606; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=ILtXC4u+7Uk/JAKm4bgHcdSs2fKg/MgQMk7bR7QWHBk=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqDiyCN8iBWRoktfYRM71AMLcnaIrrIoV0VM92Y dKZHTJC46+JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCag4sggAKCRDa6OEJdZac 5eDBD/9N374Ml4zihuFpMaIuFS5lh8Jm5FEeHVnVAhqZBY/Uox+k3iDqOr1HDfOF8wfXP9tAbrM wevdVaB3olndk52wgockkdf4kGrHaYL1ilIUQ9HGise4JpnHKhsKfrvG+znO6G/r7qKTA5ylTrb Q39u1tQv6DQWF4O+Bki1X5vYE+HBijs7xDAZ3VrIPJKyNT334d7AKnz5OZKdIpRZ3fq81SRjaCE lVIEEpD8b2GQCrwo1eKrxF/lI1OtXZkPvcWe8W7mcKVFg6Hm7mYWmpZcpCKlNpf1tcODUqFcpTT ZPtoeN83yE6pO67+ksS4Cu2mNYpfBPR2jzOtvM5UE/U9TYz8IO7yN0sWclKq6q92eYJzIUtYBxg KlAPVHRT4+sxXZEEgFkPp0jFg3cNt4cJLTtM2QUt9XDrMhRB6YZJiK+UVlbJczSbjI8pidTJpFC ISq6fsqhVv41FRrNzGZrpDR2jm34waFT7Nd4jI53QunnQINKGsYFnW0w3n8kFmozj71BDjDo9AR zLWVTBOfqJD5tmrJmm4K45r4qIQYLfMzF4sCcMihSczePhMb0O88gvE+dCLf/pAJNm5fTXN21Nb zgK+xZFd8kMlEWHFCCnsvJAqCtg0AJXJjqICzDqkq0jxJzJU3pxg1W1Qv/p+qi+Dhs8+xJ0woCL 3KpslH22cjaNHbg== 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_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: 1779313904089158500 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 705c8662f4b..146fb05dc64 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 Sat May 30 17:44:35 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=1779313892; cv=none; d=zohomail.com; s=zohoarc; b=Jw+/z8rTHPsu3Xc+/kgiYt3NjokYkQ+uCF77mw8G0sd2fB3f96GKloNjQ62fB5RCAS7U9MNJ8lOYHxgBEzqLvlppUuU4X3q7yScXBsUrkpZmTfukFXNUq4sk5Tit3+HVLGuOgBvkSJToMRFH7vhmsdlLK3iaocg+gzIoyg+ifXM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1779313892; 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=NV2lxj+kSafDI+Xt+W9HA0PH51XxNna6tbCIetfdZS8=; b=OXx0ZNbaSNS+sTaFHDKzlwS1JKL44Oz79zOey34zfzw8ShzBo/whSKCrbaCrf+T/6rkfWvXHMNDmcjIOCZrXEmZ5Z+UzOVkdZqy6xOiO2V+o9vYn9DHjAf5N2wgX1ArVlbWN389ezsJVtfyzdDh7ey+7l6e4JmD1rg522bAn8t0= 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 1779313892158561.0885198945505; Wed, 20 May 2026 14:51:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wPoom-0007J7-70; Wed, 20 May 2026 17:51:08 -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 1wPook-00079M-Ps for qemu-devel@nongnu.org; Wed, 20 May 2026 17:51:06 -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 1wPooj-0004Kd-5b for qemu-devel@nongnu.org; Wed, 20 May 2026 17:51:06 -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-314-_WMrpovWOVe_Y1ANGGeDtg-1; Wed, 20 May 2026 17:51:03 -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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 437A11956048 for ; Wed, 20 May 2026 21:51:02 +0000 (UTC) Received: from localhost (unknown [10.44.24.26]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 453D31956053; Wed, 20 May 2026 21:51:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779313864; 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=NV2lxj+kSafDI+Xt+W9HA0PH51XxNna6tbCIetfdZS8=; b=XzWg14bkg25OAQL75hmNBPGObEgJVtn2G6phvVySU7KkmoxwsU4+iuxQRzsGaDDXXb3De/ dleFED+lurE8yl/i3BNo+OB8WZbaVWCAkX4OZHfAtLkMkm6IUyQo3sSuJMWUSfbi1ZKC2/ mmWW0dnKP9Z4TLjnXJZn5rh43/LjN8Y= X-MC-Unique: _WMrpovWOVe_Y1ANGGeDtg-1 X-Mimecast-MFC-AGG-ID: _WMrpovWOVe_Y1ANGGeDtg_1779313862 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Thu, 21 May 2026 01:49:10 +0400 Subject: [PATCH 09/40] 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: <20260521-qemu-no-hmp-v1-9-d104f809e145@redhat.com> References: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> In-Reply-To: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Developer-Signature: v=1; a=openpgp-sha256; l=5676; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=YgaR6uo3LHWF8Lt96k+ghSBepcAnzNcI9602SPUCXeY=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqDiyCFW3Xdz9JH9xqc4wVAp2zyuMZZinhfsqIm UpN/yY6elWJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCag4sggAKCRDa6OEJdZac 5dTQD/9DgGIap7UrZzasCqvwn1HvRehz2tG5bk975juHcA6geajKXXdKLz+iKqYOysVbpwNVNBD hQLcZho2uOr8DeL4lOd0MyYd+R3OSNoHg6810na/dtZdHwNw0pUsQInKCzr5ykCwRPGymJ50cMw HRtvGZ9N3vc+1y590SwKbGdfWKGwyB4eb8thq35S3Z776RexDKhzK89AJYAxo+ZhscjyqWAQ+Ct rexOMLUdTb/s05sGsz9NtRK+TmhK3Ycicpfrc/FWNzDOt+2XehLcjLpYWk5IpZn3rNtQGXWXtty ZGt5jX8C6EA36aehgU7Y5bRd13n//UVviw3TYxOgShZeHRGvk02dMx7tk04qut51L2b0P7FvJaE 9dZed29oWQafQYuFHk3Ktz4EtRoiKsVGcfVbIhDURItMa9v7UhIfHuEy8LTD31cvSxO6+O8UDFT 1lmc1alNOAkJCUeakjY6ujlIqWCIzemG8c+1b8Aec19gPgjqBnG3i2x3OckiSyybW75TWjUJcUj hlTYe0a6q4pqGp2hoQIC7leQCXXNZFXyV2z8r+bOi3kMUnQK/qdM4+M7tdF31BL/yKqw8cEs5lV pQaSgiSKWBxNaAlYxRXkJMo6uLDbxF3tawjmiO/ypoad+X1Axwnq4QQ9h6o3YkK5Fa0jDSPephd 2njMlGxJ9vDLikQ== 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_H5=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: 1779313894457154100 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. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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 Sat May 30 17:44:35 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=1779313879; cv=none; d=zohomail.com; s=zohoarc; b=XxGrJNxk3ULdv0Cy+3A3jmfasWjeI2gpq7BNxuYl4ALSptsX4CNXhC4AKuc/80qfJA8iRPobsMtwMiveWpw4CEbNMBarnVR3vlHJBFDtcPkmzTpyyzsTChdqAIc1a9LjgVKqzt9Qrhh00zopMVVJQd+M6JXlHOux53BC8WBnhyU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1779313879; 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=rLImqMhG7gzftcCBIWDsSz6iVC+6ygpsm3SMVeSSwrI=; b=Zhi17qcMXqSo/7cSvQUO45AYKQuamK9sCEbRvsg4GNwXpdCwN0ypWgseWXoZg8fEdb7GsQttvEagSMfCNnwV+BLPkpgn8fV4pEJsXo9lymS2K16zwukPgLdq0giNHowMf9ACEGDyYJApGDux+k3LxhccTFvbGcTBqsll8+zt3jU= 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 1779313879559692.9638280686868; Wed, 20 May 2026 14:51:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wPoos-00088c-TS; Wed, 20 May 2026 17:51: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 1wPooq-0007qQ-QQ for qemu-devel@nongnu.org; Wed, 20 May 2026 17:51:12 -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 1wPoop-0004P6-4O for qemu-devel@nongnu.org; Wed, 20 May 2026 17:51:12 -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-651-A302GKqeNxSeDxQcGTmHeQ-1; Wed, 20 May 2026 17:51:09 -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 3D8AA18005B4 for ; Wed, 20 May 2026 21:51:08 +0000 (UTC) Received: from localhost (unknown [10.44.24.26]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D09D31956053; Wed, 20 May 2026 21:51:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779313870; 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=rLImqMhG7gzftcCBIWDsSz6iVC+6ygpsm3SMVeSSwrI=; b=RHaLemK51Wyhx8tIWDD3Oz7NqCmogPdXHTawTLp/sUmUJza9KOK+WDoNPA9GRPd3TKVa69 CLdp11RTkJfbAIWRjLZ93U5FY43vCzOZnEdYvnqllehWjTRG2pZeif5qIbWGiyAPFGaqij FLvmpf5801a7TLeX6i8tI6K95vT5KPo= X-MC-Unique: A302GKqeNxSeDxQcGTmHeQ-1 X-Mimecast-MFC-AGG-ID: A302GKqeNxSeDxQcGTmHeQ_1779313868 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Thu, 21 May 2026 01:49:11 +0400 Subject: [PATCH 10/40] 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: <20260521-qemu-no-hmp-v1-10-d104f809e145@redhat.com> References: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> In-Reply-To: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Developer-Signature: v=1; a=openpgp-sha256; l=1281; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=8WgIk7UsN9SsK95MJIVTQHpWzl0LTIcrl9qnXjaWd+c=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqDiyChmNDbEVSupBoJDAz1kmEsaDNR9F89PEZS bi/TgrBU+SJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCag4sggAKCRDa6OEJdZac 5ZNCD/9u/g3J4uZdGISt4OiODQOE6KeY/IQi3qXqEHrOMDao2pebb6NoS8YvmQ8xv4h6fLc5BQ4 KF8dkYSkbHeczn92LHrO6r0izUXWziq2EsRr7DHnDT4iy8TVfkr0dD2jCaASGStByu5dSoTely6 qL9nbAPHLNimui/7e1OJ/oT8rEEAPHm91MNUYCoV6viMUQKCDc9QPgnWCc0GPInv9yl2ltN3Abl KKMUyn7hJhZvWe458RBWWXn46TgK72O2BFkUCW9vfoULpGVDQuHKpD1co75NSHgGNnslt36N+ZL kIb6tgOtTrEeC2351TZ5v/WVBxexPw7pZkZsiKYxt1T43hUYm8iL5pDN8ztTTsuYsVBJWzEDBDV yrC3tDGNGaDqtp5++4bu5Z3VWD6F13Q1/zrXttgk7sJOa2sl4CNAuPXfseRxhX9jBXburIfza/M Hmzz4hUotBpbL0R9c4pRdBcHGwCSqPFBnz2+/Yb6TjbJZuoGEAokWrtLtm1uO0pGw9HDrJHj9MK vwzXjsZrD4ApCHMfYkWaBD5ukAF/yL6DLBKh7H9WqrcCb3xUxPIXf9A1XQyb4OqAanGOK3Dvjp/ sZzvIzw+ba3GarANPX+UWBAVqIcUlXGt50yQkBGa+kcrsTmRmhD3ImR6UBpdpcIGGrCNyDmdALK kxjBxelrVslDFkw== 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_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: 1779313880014158500 Replace the human-monitor-command based version test with the native QMP query-version command, which returns structured version data. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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 Sat May 30 17:44:35 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=1779313905; cv=none; d=zohomail.com; s=zohoarc; b=gnsHuz7l/npQ8l3UrTB/DcP6MjoD5S1MuLc13eWJVc56Sf+w6OIuUubVdHGimxp9fxEX60TcPR6SURlpvxe6zJhBiDS9Pws2+kNkHp5yejby9zKn0YxysIgal295F2RO1rddZBKlxRYtd1aovCu3YRUyo1gLc5uliP+2ZPG2BxQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1779313905; 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=0gc5N08QNN+OjdBiGrYotMBQ3e65sybYUrp28BmT1vc=; b=AJAPG/MeSHu3qWr787l2iGllWnjAQ9RtxqoGLyAPkM1Z8c5EtliOpNG1YqLi5Rk/0ublDuBc9NAoolHwdYPfTxQdxV+QO22t59J2mI3Tt5PMi+lv/J/ZqZbLkJBCwdu85yXkW+0PzIHehSZ6YDu4p0VV+hB70uMmswCOnVvobOY= 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 1779313905225313.8736648944714; Wed, 20 May 2026 14:51:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wPop3-0000YW-BU; Wed, 20 May 2026 17:51:25 -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 1wPop1-0000U6-TI for qemu-devel@nongnu.org; Wed, 20 May 2026 17:51:23 -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 1wPoox-0004SH-Lb for qemu-devel@nongnu.org; Wed, 20 May 2026 17:51:23 -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-375-xpVSGeZDMzq4qLeq_6eOUQ-1; Wed, 20 May 2026 17:51: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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7638319560B9 for ; Wed, 20 May 2026 21:51:14 +0000 (UTC) Received: from localhost (unknown [10.44.24.26]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 279FC1684; Wed, 20 May 2026 21:51:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779313878; 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=0gc5N08QNN+OjdBiGrYotMBQ3e65sybYUrp28BmT1vc=; b=UAtKvXcyq95sj0wDpfW6Tk/G5Mmh93TTB1MKS/ElCcs9z51wHEb0TBHyN60tqbT7MlkZmN hgxThXc1HZ6rgmhfHaqG10ORUJ+wCUhom+dtdxuDY0/IUJT4KpvgormoBhFh4nf/17lEy9 oR1FQ1J94unI7ctpz4Iwccx/Wkrlttk= X-MC-Unique: xpVSGeZDMzq4qLeq_6eOUQ-1 X-Mimecast-MFC-AGG-ID: xpVSGeZDMzq4qLeq_6eOUQ_1779313874 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Thu, 21 May 2026 01:49:12 +0400 Subject: [PATCH 11/40] net/qapi: add x-query-usernet MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260521-qemu-no-hmp-v1-11-d104f809e145@redhat.com> References: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> In-Reply-To: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Developer-Signature: v=1; a=openpgp-sha256; l=3306; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=E94/3MiB0VgFNkT6H5WYvo+WLMYYtQvL8sNhmBto3GA=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqDiyCIJUcHQUEVAeLhrIxeNpH0vcY1R111Ykjx 8i7XL1uR7mJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCag4sggAKCRDa6OEJdZac 5Sz4EACSKn9Q7uK9HhopMQYh9rT8Gp4HtVyqAhdc/jHs8WQFwMMr/+ssHoPF/hd6t1LWQlUPVLk 0WLTE7uCgR6yZVbhlSgdAhGvjouPbuPh1S+XTd8GKEwFykBqw1R6hY0GO0r/j2qUlgwoodV+u0T JyO+4a5KjbfWRCTJzYKTQ9s7c7qzvazY0NY3l080Nr4GSFMRUCzhx62f35Me1yXkKorCbo4L10G ltBvzBYor/TG4AaasQ6jRev3o9OruoqP++CuV7C336kHM+cKhe1UW29w7d1dCdoXIKIbJy49fAm UHwAz/b68Pl3QHkmGpVe4x9a8wN2VoIktd17dtTRHUwK5heEASj1PIBnYFIeRTpHFZurXz98Tue R7YK1zxyFbRMnBxfBOwLhP/Y6fc3w41r5EtleZSwtDwTjvQ7d7Op4c7yt4UDtQs8TzgeKuOMIMs YUNVGI/F48f+NYlfb+KVvri0wONLwmOPmamIIB5iibhDML720uTrMNbPN+pXIo2gp7+bDmabfqJ emH69++6vbs2rRWWUhVFkuc4jg9DDkVE3fZavw4fA7VcK1vxX3oXRE7aofrCTNy+N9lJ9YOP6jT jWEGlbo5sJwPuRkoOE8BVtExvwpUl+8hsrfyq8dRrs3PmOeFcb/AdjbGOdfyDOw52hpJBqez4mm XSVGMPFkjjl0jZQ== 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_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: 1779313906155158500 Add a QMP equivalent to hmp "info usernet", so we can disable HMP. Signed-off-by: Marc-Andr=C3=A9 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 118bd349651..dd56215fd15 100644 --- a/qapi/net.json +++ b/qapi/net.json @@ -1191,3 +1191,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 04925f33187..d3ed5ec9cb8 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" @@ -1199,18 +1200,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 Sat May 30 17:44:35 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=1779313897; cv=none; d=zohomail.com; s=zohoarc; b=nXrmgo5mkIMqRCzotsJ90nqvl4C8p/ASwe+pN06/Wo/nhGVtsXtcdphKUILL9ei+wVahdOG+VqSIQ72IkV2CPleV5FBTvIeqMENdtRZXecvy42/buNWZIHbUqGSDZqoNI/cwxqjADf/7gGy1TQ1q/TRPTevE6nS9QoyOsUmzdVk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1779313897; 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=pjcl2dWy7e1z/2pEJNDQKBeV0ZyclpnFFu+cLOFkHro=; b=SwWiYQHAV2LYRsmb7GAwfd2D5deqHNyE7qNoWDm4hDxwBS22sChadn758gi3AD27QtDbCF7MXa5oSOhyRH0WKIWup9nRiglc1ty2D3EnbY7SYWwgQsmQ8u0+XCNgwDK0K37X/FZ7thaGgl0vHN29H/nLKLB600q2pV+/n2aNTRA= 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 1779313897158991.8362058490933; Wed, 20 May 2026 14:51:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wPop4-0000b2-Tx; Wed, 20 May 2026 17:51:26 -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 1wPop3-0000YM-8H for qemu-devel@nongnu.org; Wed, 20 May 2026 17:51:25 -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 1wPop1-0004Se-FH for qemu-devel@nongnu.org; Wed, 20 May 2026 17:51:24 -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-7OdiUSK5Py2sA8n7W6glfQ-1; Wed, 20 May 2026 17:51:20 -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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E5C401956046 for ; Wed, 20 May 2026 21:51:19 +0000 (UTC) Received: from localhost (unknown [10.44.24.26]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9800618004A3; Wed, 20 May 2026 21:51:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779313882; 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=pjcl2dWy7e1z/2pEJNDQKBeV0ZyclpnFFu+cLOFkHro=; b=ezOPCW+0xUSZAYRyPl45iBR7L0TE26XxZAaLZNtWEibSpBSy592tCVxJ3cKHSdJBDEJVWN UxhiJEY87jVw/Km/eMF5xQdFi7yI/TKxDS4EcicaVARauzEV52LR3giDGJ24D7jxxl12qc z2FLa/KUd3TlEC8TzFQwMIOazA8c3Ns= X-MC-Unique: 7OdiUSK5Py2sA8n7W6glfQ-1 X-Mimecast-MFC-AGG-ID: 7OdiUSK5Py2sA8n7W6glfQ_1779313880 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Thu, 21 May 2026 01:49:13 +0400 Subject: [PATCH 12/40] tests: use x-query-usernet MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260521-qemu-no-hmp-v1-12-d104f809e145@redhat.com> References: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> In-Reply-To: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Developer-Signature: v=1; a=openpgp-sha256; l=2929; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=+P16oBsYld1xCUKsO57K6aS/d455wRba5dgXW09RuWc=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqDiyDdDRmH0csLE5tn4rA7HTqKlRN1qFANHmwU R/POELKAQGJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCag4sgwAKCRDa6OEJdZac 5YbVD/97wv36fnrTz0REsCXxfadmCap6A6yu/3786aEJ5J7A0QDslVaPIubs78B0uG4WVr8ZBbM MACAYRXmq8lBHrZSShtJgHB+hJWcx9VrXlJr2nsq3+7Rws+xt9lNQMpmyftfP7sL+/zOYcPsQLD rb0VQN2JSrZkC3zgtHTbnjOMxXyQtgtXBD4EC3tyFBQNC4XMmAZ+gD7GLmumCa4Y+1tVpNeGdji DeJxGAGAURaCm7NxM3QQbiz+DAlzuR486k7j+owSIdInwj9m4hABJduU0+2vwGP2HN1wHWh/FgO opSqQYJXvY9cV/ZNvuUSC2EwGPvKWYVHP4OW8RG32WdQ2egfLGQ9qjpcHMJVLH8QkdnxIF5G3Dv /iqr3EXmo/1Bn6LSHr5Bn0vVifpgQnTN+L7V6yppKEqBDzz7xQolPVV9LvvUvmh93uYaoOcKAgZ 2SZsjCR3P5kjZ+FlY1FD8cfGUFng4PbSUnfuWyNuVEk4iuhs629ba1X6WGs3kJgx7hv/x0n6sr1 WKBBpCmyzAfG2VxjVFzGxXQKUp7kQIKfBScS3mb7MTX+JSzRMDCMG13y9xY0iFtQ24ZJQapWqlU wX3ybRPv1RO40fT0XD/+8wDySNbwpPCnzlUDzqFdKA4P1NpPdNRYbJMGBZBLu847amhtjCRG1zL n093sVX1fsO0mKA== 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: 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: 1779313898472154100 Signed-off-by: Marc-Andr=C3=A9 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 Sat May 30 17:44:35 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=1779313913; cv=none; d=zohomail.com; s=zohoarc; b=OqlG3ztFNdaHLLIo78sjA5mRe4q1Km9kaT1HnBjIq+t6JoIxCQIV5fl7JY9BP4NpIK8xEUniaiAYKy0OyS5nFlG1MjgmcQRHCsouvQu36zMd0IuMnqTgOOcGDFAkyyjPi6SLQ/7NL+YXRq4Ig3Jvnwbmt0y06xICuxs0qIaK6rg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1779313913; 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=ksXnSdCisvMLT0xEMZ61fb0FZ9ryLVg4k04RdQxqvL8=; b=PojbcA6XjD9wuIX/mYSE/mmlNRgUn8wuBMi7bLAOmIAQ5WqbpJbPvubbfhaFTtokc4edoDuzLXv3rcF6sMCFsskTyn2wtJ2rSGbea/en0zUeTcjlzUFqpyX/CEsW5g1LCCG9G92BZVxiirIWEYiIG5JYabXOzN8TLpUSTqppYmE= 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 177931391302484.66793872475716; Wed, 20 May 2026 14:51:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wPopB-0000i3-EJ; Wed, 20 May 2026 17:51:33 -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 1wPop8-0000d2-Qp for qemu-devel@nongnu.org; Wed, 20 May 2026 17:51:30 -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 1wPop6-0004TR-Kx for qemu-devel@nongnu.org; Wed, 20 May 2026 17:51:30 -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-287-LHrLn0iUOkOJMjbRP1QXpQ-1; Wed, 20 May 2026 17:51:26 -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 AF3021800451 for ; Wed, 20 May 2026 21:51:25 +0000 (UTC) Received: from localhost (unknown [10.44.24.26]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 1CC811800576; Wed, 20 May 2026 21:51:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779313888; 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=ksXnSdCisvMLT0xEMZ61fb0FZ9ryLVg4k04RdQxqvL8=; b=IEtAybG9R6rsRLxba9tnUPckdqJn4uQcNgGr9g9oR/lOl2sZnJsY70dX9i+celv5hdp+XR ofPXr8DWDVjbmImXyAFZ0M87u0XH25OBNIteoTsD34OSkAtle7TaTPaWxrI+sGcA0Hv2nd DnLjlUajZCo+hbHwsAz6sA5O5c6Ik3A= X-MC-Unique: LHrLn0iUOkOJMjbRP1QXpQ-1 X-Mimecast-MFC-AGG-ID: LHrLn0iUOkOJMjbRP1QXpQ_1779313885 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Thu, 21 May 2026 01:49:14 +0400 Subject: [PATCH 13/40] RFC: qtest: add -qtest-no-ts option MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260521-qemu-no-hmp-v1-13-d104f809e145@redhat.com> References: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> In-Reply-To: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Developer-Signature: v=1; a=openpgp-sha256; l=11485; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=Jw4PEMMLKFEptBB8a458urbLVasRzHu9XlHlSMJ5gr0=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqDiyDl3VwB5oM4WFYW3ncfYuYTwCaqpglPjkYp 0B+oz7GtpaJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCag4sgwAKCRDa6OEJdZac 5R6hD/4hXbaFQLBKAnYy35yG/i38Btlj00PiknVldwqNK3q8I1lYcX8EwchdnY+KF8cS6yHIOPq hu4gTilpsxy9CKLhnmT1OGXzpU/C6DjdHDeesmwuoZrSXDxwUGqyFJhzV017kCl5PnXuWJ/Q0J6 NhRrCO4bygWMe7ZsYTFrHxrXzjyK5DKsV3ES30qQ8k93tiH/MgVPSt+tdRWbJ9CAo+WQdy3R/WC qgvxSAPLFstk6Ue0BVk5zs8QWjzavVeeYvWXeS13lIMNhVOP86oLa9/18GkwJpGVurUrVUB4BJe WmehezkAr/J9aeDtWVyeK11RBCpJZcBEcj1NCb6/Ypo2jIe3x/UWwcp2UxbH9Hb052PS931vgGr mlwDmZmuEbYAAgedZQ5trnCH51fsujaCqQ6BPHeL9CR32xXK6MkNV/tnmuVqowRfMGydGEyOyau erzFGrpGPw7ZnrAqpXgY9OgjKpOdNzAn4X4ax8uFsGzfvV7U3qoLGvVLYFkC7yWcPeZntFh+gLv u3yhosHQOgZ7VSWt9HAeR0uKLY0PbvMQC9l4915Y5DX6lLBMAyh0nQwBCMtshnsrQJ447ICjTWj qK3XrliYN8m9UZ2XepJT+nufA7ka4BfHMJh6Y93G94F04NDcS2/BSe4D3LHx8P6AScT6rwcexKZ p9RAq4c602mD/qg== 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: -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: 1779313914759154100 Add an option to disable printing the timestamp in the reply. This may help tests that want to compare the output between runs. It's not use by this series after all, it could be excluded. Signed-off-by: Marc-Andr=C3=A9 Lureau --- qapi/qom.json | 5 ++- include/system/qtest.h | 3 +- system/qtest.c | 61 ++++++++++++++++++++++-= ---- system/vl.c | 7 ++- qemu-options.hx | 1 + tests/qemu-iotests/iotests.py | 4 +- tests/qemu-iotests/tests/copy-before-write | 4 +- tests/qemu-iotests/tests/migrate-bitmaps-test | 4 +- 8 files changed, 70 insertions(+), 19 deletions(-) diff --git a/qapi/qom.json b/qapi/qom.json index dd45ac1087c..c7b6c64d157 100644 --- a/qapi/qom.json +++ b/qapi/qom.json @@ -834,11 +834,14 @@ # # @log: the path to a log file # +# @ts: if true, print timestamps in the log. Default true. +# # Since: 6.0 ## { 'struct': 'QtestProperties', 'data': { 'chardev': 'str', - '*log': 'str' } } + '*log': 'str', + '*ts': 'bool' } } =20 ## # @RemoteObjectProperties: diff --git a/include/system/qtest.h b/include/system/qtest.h index 7f6dc01d147..2fa06409a84 100644 --- a/include/system/qtest.h +++ b/include/system/qtest.h @@ -27,7 +27,8 @@ void G_GNUC_PRINTF(2, 3) qtest_sendf(CharFrontend *chr, c= onst char *fmt, ...); void qtest_set_command_cb(bool (*pc_cb)(CharFrontend *chr, gchar **words)); bool qtest_driver(void); =20 -void qtest_server_init(const char *qtest_chrdev, const char *qtest_log, Er= ror **errp); +void qtest_server_init(const char *qtest_chrdev, const char *qtest_log, + bool qtest_no_ts, Error **errp); =20 void qtest_server_set_send_handler(void (*send)(void *, const char *), void *opaque); diff --git a/system/qtest.c b/system/qtest.c index a79d10d1361..1fb35ae36bc 100644 --- a/system/qtest.c +++ b/system/qtest.c @@ -42,6 +42,7 @@ struct QTest { Object parent; =20 bool has_machine_link; + bool ts; char *chr_name; Chardev *chr; CharFrontend qtest_chr; @@ -57,6 +58,7 @@ static GString *inbuf; static int irq_levels[MAX_IRQ]; static GTimer *timer; static bool qtest_opened; +static bool qtest_ts =3D true; static void (*qtest_server_send)(void*, const char*); static void *qtest_server_send_opaque; =20 @@ -270,13 +272,17 @@ static int hex2nib(char ch) } } =20 -static void qtest_log_timestamp(void) +static void qtest_log_timestamp(const char c) { if (!qtest_log_fp || !qtest_opened) { return; } =20 - fprintf(qtest_log_fp, "[S +" FMT_timeval "] ", g_timer_elapsed(timer, = NULL)); + fprintf(qtest_log_fp, "[%c", c); + if (qtest_ts) { + fprintf(qtest_log_fp, " +" FMT_timeval, g_timer_elapsed(timer, NUL= L)); + } + fprintf(qtest_log_fp, "]"); } =20 static void G_GNUC_PRINTF(1, 2) qtest_log_send(const char *fmt, ...) @@ -287,8 +293,8 @@ static void G_GNUC_PRINTF(1, 2) qtest_log_send(const ch= ar *fmt, ...) return; } =20 - qtest_log_timestamp(); - + qtest_log_timestamp('S'); + fprintf(qtest_log_fp, " "); va_start(ap, fmt); vfprintf(qtest_log_fp, fmt, ap); va_end(ap); @@ -306,7 +312,10 @@ static void qtest_server_char_be_send(void *opaque, co= nst char *str) =20 static void qtest_send(CharFrontend *chr, const char *str) { - qtest_log_timestamp(); + if (qtest_log_fp) { + qtest_log_timestamp('S'); + fprintf(qtest_log_fp, " "); + } qtest_server_send(qtest_server_send_opaque, str); } =20 @@ -364,7 +373,7 @@ static void qtest_process_command(CharFrontend *chr, gc= har **words) if (qtest_log_fp) { int i; =20 - fprintf(qtest_log_fp, "[R +" FMT_timeval "]", g_timer_elapsed(time= r, NULL)); + qtest_log_timestamp('R'); for (i =3D 0; words[i]; i++) { fprintf(qtest_log_fp, " %s", words[i]); } @@ -812,7 +821,8 @@ static void qtest_event(void *opaque, QEMUChrEvent even= t) timer =3D g_timer_new(); qtest_opened =3D true; if (qtest_log_fp) { - fprintf(qtest_log_fp, "[I " FMT_timeval "] OPENED\n", g_timer_= elapsed(timer, NULL)); + qtest_log_timestamp('I'); + fprintf(qtest_log_fp, " OPENED\n"); } break; case CHR_EVENT_CLOSED: @@ -820,10 +830,11 @@ static void qtest_event(void *opaque, QEMUChrEvent ev= ent) /* Ignore CLOSED events if we have already closed the log */ break; } - qtest_opened =3D false; if (qtest_log_fp) { - fprintf(qtest_log_fp, "[I +" FMT_timeval "] CLOSED\n", g_timer= _elapsed(timer, NULL)); + qtest_log_timestamp('I'); + fprintf(qtest_log_fp, " CLOSED\n"); } + qtest_opened =3D false; g_clear_pointer(&timer, g_timer_destroy); break; default: @@ -831,7 +842,8 @@ static void qtest_event(void *opaque, QEMUChrEvent even= t) } } =20 -void qtest_server_init(const char *qtest_chrdev, const char *qtest_log, Er= ror **errp) +void qtest_server_init(const char *qtest_chrdev, const char *qtest_log, + bool no_ts, Error **errp) { ERRP_GUARD(); Chardev *chr; @@ -849,6 +861,9 @@ void qtest_server_init(const char *qtest_chrdev, const = char *qtest_log, Error ** if (qtest_log) { object_property_set_str(qobj, "log", qtest_log, &error_abort); } + if (no_ts) { + object_property_set_bool(qobj, "ts", false, &error_abort); + } object_property_add_child(qdev_get_machine(), "qtest", qobj); user_creatable_complete(USER_CREATABLE(qobj), errp); if (*errp) { @@ -871,6 +886,8 @@ static bool qtest_server_start(QTest *q, Error **errp) qtest_log_fp =3D stderr; } =20 + qtest_ts =3D q->ts; + if (!qemu_chr_fe_init(&q->qtest_chr, chr, errp)) { return false; } @@ -974,6 +991,20 @@ static char *qtest_get_log(Object *obj, Error **errp) return g_strdup(q->log); } =20 +static bool qtest_get_ts(Object *obj, Error **errp) +{ + QTest *q =3D QTEST(obj); + + return q->ts; +} + +static void qtest_set_ts(Object *obj, bool value, Error **errp) +{ + QTest *q =3D QTEST(obj); + + q->ts =3D value; +} + static void qtest_set_chardev(Object *obj, const char *value, Error **errp) { QTest *q =3D QTEST(obj); @@ -1018,6 +1049,8 @@ static void qtest_class_init(ObjectClass *oc, const v= oid *data) qtest_get_chardev, qtest_set_chardev); object_class_property_add_str(oc, "log", qtest_get_log, qtest_set_log); + object_class_property_add_bool(oc, "ts", + qtest_get_ts, qtest_set_ts); } =20 static void qtest_finalize(Object *obj) @@ -1029,10 +1062,18 @@ static void qtest_finalize(Object *obj) object_unref(q->chr); } =20 +static void qtest_init(Object *obj) +{ + QTest *q =3D QTEST(obj); + + q->ts =3D true; +} + static const TypeInfo qtest_info =3D { .name =3D TYPE_QTEST, .parent =3D TYPE_OBJECT, .class_init =3D qtest_class_init, + .instance_init =3D qtest_init, .instance_finalize =3D qtest_finalize, .instance_size =3D sizeof(QTest), .interfaces =3D (const InterfaceInfo[]) { diff --git a/system/vl.c b/system/vl.c index f4d55f0addd..4797700abd5 100644 --- a/system/vl.c +++ b/system/vl.c @@ -193,6 +193,7 @@ static const char *log_file; static bool list_data_dirs; static const char *qtest_chrdev; static const char *qtest_log; +static bool qtest_no_ts; =20 static int has_defaults =3D 1; static int default_audio =3D 1; @@ -2092,7 +2093,8 @@ static bool object_create_late(const char *type) static void qemu_create_late_backends(void) { if (qtest_chrdev) { - qtest_server_init(qtest_chrdev, qtest_log, &error_fatal); + qtest_server_init(qtest_chrdev, qtest_log, qtest_no_ts, + &error_fatal); } =20 net_init_clients(); @@ -3596,6 +3598,9 @@ void qemu_init(int argc, char **argv) case QEMU_OPTION_qtest_log: qtest_log =3D optarg; break; + case QEMU_OPTION_qtest_no_ts: + qtest_no_ts =3D true; + break; case QEMU_OPTION_sandbox: olist =3D qemu_find_opts("sandbox"); if (!olist) { diff --git a/qemu-options.hx b/qemu-options.hx index 96ae41f787b..4c1b32713e0 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -5584,6 +5584,7 @@ ERST HXCOMM Internal use DEF("qtest", HAS_ARG, QEMU_OPTION_qtest, "", QEMU_ARCH_ALL) DEF("qtest-log", HAS_ARG, QEMU_OPTION_qtest_log, "", QEMU_ARCH_ALL) +DEF("qtest-no-ts", 0, QEMU_OPTION_qtest_no_ts, "", QEMU_ARCH_ALL) =20 #if defined(CONFIG_POSIX) && !defined(EMSCRIPTEN) DEF("run-with", HAS_ARG, QEMU_OPTION_run_with, diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 05274772ce4..5a4d843886d 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -712,8 +712,8 @@ def filter_nbd_exports(output: str) -> str: return re.sub(r'((min|opt|max) block): [0-9]+', r'\1: XXX', output) =20 def filter_qtest(output: str) -> str: - output =3D re.sub(r'^\[I \d+\.\d+\] OPENED\n', '', output) - output =3D re.sub(r'\n?\[I \+\d+\.\d+\] CLOSED\n?$', '', output) + output =3D re.sub(r'^\[I \+?\d+\.\d+\] OPENED\n', '', output) + output =3D re.sub(r'\n?\[I \+?\d+\.\d+\] CLOSED\n?$', '', output) return output =20 Msg =3D TypeVar('Msg', Dict[str, Any], List[Any], str) diff --git a/tests/qemu-iotests/tests/copy-before-write b/tests/qemu-iotest= s/tests/copy-before-write index 236cb8ac374..f86032b1167 100755 --- a/tests/qemu-iotests/tests/copy-before-write +++ b/tests/qemu-iotests/tests/copy-before-write @@ -273,8 +273,8 @@ read 1048576/1048576 bytes at offset 0 =20 self.vm.shutdown() log =3D self.vm.get_log() - log =3D re.sub(r'^\[I \d+\.\d+\] OPENED\n', '', log) - log =3D re.sub(r'\[I \+\d+\.\d+\] CLOSED\n?$', '', log) + log =3D re.sub(r'^\[I \+?\d+\.\d+\] OPENED\n', '', log) + log =3D re.sub(r'\[I \+?\d+\.\d+\] CLOSED\n?$', '', log) log =3D iotests.filter_qemu_io(log) return log =20 diff --git a/tests/qemu-iotests/tests/migrate-bitmaps-test b/tests/qemu-iot= ests/tests/migrate-bitmaps-test index 8fb4099201d..eec110757a6 100755 --- a/tests/qemu-iotests/tests/migrate-bitmaps-test +++ b/tests/qemu-iotests/tests/migrate-bitmaps-test @@ -195,8 +195,8 @@ class TestDirtyBitmapMigration(iotests.QMPTestCase): # catch 'Could not reopen qcow2 layer: Bitmap already exists' # possible error log =3D self.vm_b.get_log() - log =3D re.sub(r'^\[I \d+\.\d+\] OPENED\n', '', log) - log =3D re.sub(r'\[I \+\d+\.\d+\] CLOSED\n?$', '', log) + log =3D re.sub(r'^\[I \+?\d+\.\d+\] OPENED\n', '', log) + log =3D re.sub(r'\[I \+?\d+\.\d+\] CLOSED\n?$', '', log) self.assertEqual(log, '') =20 # recreate vm_b, as we don't want -incoming option (this will = lead --=20 2.54.0 From nobody Sat May 30 17:44:35 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=1779313914; cv=none; d=zohomail.com; s=zohoarc; b=KDFvqch9rXgqwp4oiMOwM4zq43a8XynajyFQLjCYN7IA7C2na/HtR7f7eSR77bUhOAEeLzRSq0j8RwFlLlKj/d9y35wHAep3UKEj4gsVY4CopmTeuzmAgwcoXdY2xikLxEGOyqNKeX7+JZLycpRKUrVFFg+uXmhoRvfmner2gxM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1779313914; 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=q7GvvRPQTRKT8Kaje+f0v9Wy2HvsIqFzenfS/N58Q5o=; b=DqGOAFftNTM6pphEOxaLa0YZDQp1o9FaPo6mv78s+P7EhR9hRcpZC1Mf0dLpveGI9ewiPTRe1rz0q6ZnabKCUvyaJ3WL+BZOlqeCVKXkGQo4ILXriRBvaGPOPrwxYqhyoxyeP2EnaxwDiuk4CP3/GIezKcUAlrM4wR8h0H//2/c= 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 1779313914929815.1745166561949; Wed, 20 May 2026 14:51:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wPopL-0001gI-Ei; Wed, 20 May 2026 17:51:43 -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 1wPopK-0001UM-8G for qemu-devel@nongnu.org; Wed, 20 May 2026 17:51:42 -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 1wPopE-0004Uo-JJ for qemu-devel@nongnu.org; Wed, 20 May 2026 17:51:41 -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-114-ob6qK24GNE6H13tFGv_ODA-1; Wed, 20 May 2026 17:51:33 -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 151241800451 for ; Wed, 20 May 2026 21:51:33 +0000 (UTC) Received: from localhost (unknown [10.44.24.26]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 156401685; Wed, 20 May 2026 21:51:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779313896; 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=q7GvvRPQTRKT8Kaje+f0v9Wy2HvsIqFzenfS/N58Q5o=; b=dZLGQ4IacJU+F4BkwEklVW6qg4Fu7W4TyxgVxEp4o6T8+AclRaHzzTidFqObwLj47rcXAs Ajh8ZiphzBiBi8nivNHJfdlz9HuxcmuJVlC1Y6MkKRepA22npaGg3ibJe9RrMEXi0WtlRZ R59WzV6jaeIHF+nixy9aUdr+7snpG1o= X-MC-Unique: ob6qK24GNE6H13tFGv_ODA-1 X-Mimecast-MFC-AGG-ID: ob6qK24GNE6H13tFGv_ODA_1779313893 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Thu, 21 May 2026 01:49:15 +0400 Subject: [PATCH 14/40] 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: <20260521-qemu-no-hmp-v1-14-d104f809e145@redhat.com> References: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> In-Reply-To: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Developer-Signature: v=1; a=openpgp-sha256; l=103176; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=GzLfhQALNps/ir3QBbcOMLk4C16QnmT1WpBPIlVEkTI=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqDiyDBl/LcLYY0Occ13ipS0JYpill+gmnSRXjE PGFy66zvFKJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCag4sgwAKCRDa6OEJdZac 5Sf4EACOxhk+1RRVa9PzNMvaMtwk/AjTuwLXt7UCnRVQxCU+qiEzRcZCtXjbab7CpIeTdZg/2NH UuAcfGg4UQ/ZTIlE0/Yfy+b4Ng8YOf1nUbKqnj+kLT7MDJKkv49ufetSO645FVbcbYd6sO7OGcZ rOo1+ZiSGLhb0xrWMQfJXhbj7mncz4p4y1urruvuvMH5YSyl/tzGYQ3zlkzOqfs4i1RDUHr9Lfo COCCSm0bvG+LMjnVWMzApw/ezY5jdOrkNBDMmKMXlxv5t+FJsBp+34SxbvBkq8vs/DnrdY9ezlj OrnUqXX5NHQW34fI5wMlcgFITkFdwUAbGE4hAcliitHRV+g+W+TN1jgmHt/kj/+0ZFY2aQmY+KG fbeosQOHTieRUNZZR7QkE4mKz2gT3hkZHxu+yhocXhYZM2Mke3Yg4v+Fl8VvjxIWcHZEd/CS3PH Y/5v5EjicCWaPtoHiaizbdEhpsylsP0A3vetF4Nywlsl5rJnQSdtyUAeMYIQbU52AG2DQG6xLY1 4ZQpWugzhV6u5TtbovFLrur6YHwcGHuzV2jjTQ+OKPM3I0QboxH1vn2vLso9uqDaFg/EzgKaPte c0zM2I6JKwk3ktzCIOq7aQ7CRPjKGSzWNZ+tF2ldV+1Hx1Dr9N4eCX5/qRy2/KamJCjZcqMK6sx XZuux65medZ0nhA== 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_H5=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: 1779313916754154100 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"} Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- include/qemu-io.h | 4 +- block/monitor/block-hmp-cmds.c | 2 +- qemu-io-cmds.c | 426 +++++++++++++++----------= ---- qemu-io.c | 17 +- tests/qemu-iotests/004.out | 20 +- tests/qemu-iotests/021.out | 60 ++-- 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/089.out | 4 +- tests/qemu-iotests/114.out | 2 +- tests/qemu-iotests/134.out | 2 +- tests/qemu-iotests/137.out | 2 +- tests/qemu-iotests/171 | 2 +- tests/qemu-iotests/171.out | 68 ++--- tests/qemu-iotests/214.out | 2 +- tests/qemu-iotests/220.out | 2 +- tests/qemu-iotests/244.out | 12 +- tests/qemu-iotests/249.out | 6 +- tests/qemu-iotests/271.out | 14 +- tests/qemu-iotests/tests/copy-before-write | 66 +++-- 22 files changed, 404 insertions(+), 367 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..5093aa4169a 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,11 @@ 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) { 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,10 +2114,13 @@ 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); - return -EIO; + { + Error *local_err =3D NULL; + spec_info =3D bdrv_get_specific_info(bs, &local_err); + if (local_err) { + error_propagate(errp, local_err); + return -EIO; + } } if (spec_info) { bdrv_image_info_specific_dump(spec_info, @@ -2143,7 +2156,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 +2170,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 +2198,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 +2218,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 +2251,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 +2273,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 +2292,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 +2324,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 +2332,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 +2346,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 +2356,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 +2375,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 +2436,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 +2447,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 +2500,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 +2522,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 +2532,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 +2550,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 +2558,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 +2580,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 +2603,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 +2615,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,37 +2624,41 @@ static int reopen_f(BlockBackend *blk, int argc, ch= ar **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); - return -EINVAL; + { + Error *local_err =3D NULL; + bdrv_reopen(bs, opts, true, &local_err); + if (local_err) { + error_propagate(errp, local_err); + return -EINVAL; + } } =20 blk_set_enable_write_cache(blk, !writethrough); 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 +2684,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 +2706,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 +2723,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 +2749,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 +2762,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 +2792,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 +2801,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 +2853,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 +2864,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 +2887,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 +2900,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/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/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/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 1779313918423786.9187143245297; Wed, 20 May 2026 14:51:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wPopN-0001vL-KJ; Wed, 20 May 2026 17:51:45 -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 1wPopM-0001nW-Cg for qemu-devel@nongnu.org; Wed, 20 May 2026 17:51:44 -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 1wPopJ-0004ah-QM for qemu-devel@nongnu.org; Wed, 20 May 2026 17:51:44 -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-262-xMRn7W_iNQCGv5Cu7PoMkw-1; Wed, 20 May 2026 17:51:39 -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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D4662195608E for ; Wed, 20 May 2026 21:51:38 +0000 (UTC) Received: from localhost (unknown [10.44.24.26]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8AC801956053; Wed, 20 May 2026 21:51:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779313901; 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=RI/GfL+YIuNQkKldDELoZ3A2iLQOpqapPwggqt66UIg=; b=WRqzDBvkBTi0d45K2UhJm9ZYSjm7v7bGkYMSOb2t6jeR8JH2Mo9XD0epKG+RpLCFwWQnUP UpBD22kQmHX0FRgj7RnvUhY+fMBXwaVc+bUiUSJ21LZeCCf6oc886hhAfk33Mzeo7Mezju 8e0E4J5v1qY79lP9vUQoYi7sAQIA3zE= X-MC-Unique: xMRn7W_iNQCGv5Cu7PoMkw-1 X-Mimecast-MFC-AGG-ID: xMRn7W_iNQCGv5Cu7PoMkw_1779313898 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Thu, 21 May 2026 01:49:16 +0400 Subject: [PATCH 15/40] 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: <20260521-qemu-no-hmp-v1-15-d104f809e145@redhat.com> References: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> In-Reply-To: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Developer-Signature: v=1; a=openpgp-sha256; l=12400; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=105GLtz4Doau6tSSsomcN3HFvoAQ9hulVhQWImUMqYM=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqDiyDRTZUNSm6vaO3FV2nlRfrfEINBG/3UvV/m NZpSgWv4KiJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCag4sgwAKCRDa6OEJdZac 5U6gD/wIB1mzUip8IGO2ahmZtajxhaQkXFZD5+Z0jdoPKKruF+RC4brZ8+Na6weRHcTWEZtFtX1 mxWxhsK2ixFvCgFIQd8fJcA3cP7djqYcVNRj9WQXwEXkYZD8oB+L8MxqO5o25u00YMA6eG9g2RP R/kMH/ZI10GiIbRgJc4Hp9ucLCCWY+z19jRHQn64zDX+W5TwV1r0+gwpZPFkzzRjLQ7ODAAdMIO doD/zNdC9B9RLgk5XuQ57mS/MNJBNFT2w7ifh2bRox+5XkoHU3z719Cug8aZUuAGRCzFpAGWy/c zzbw+zb6s/03wQzy61kMeiVts7YRmPQpdpWRdwZxM/YVz5xXr8l72aq/95YYC0DPKMkwiWNY3+B 6x0qmzzP5/FubAIbOoobKUPEdMtZN4j9/YqZpa8LTCupNnjeBy7FVjAxywAx9rhq5zuUoFGHYGv X14m+79JljSAW9DqCLrofqfUafxlvxOv0NSe3WeBFk5ZzGBFFFbIWveY4eYD6JpLKtSANKVlIAE 8LkDpnNJ8SpCotdYipkpTFC28TPWoa1qdjVhdndqoEtNXRcKqJ3gxE1X7QJflTcBTxPKKTgfH+l dDd7LLkUUaBOW4WUkob2kQsRdGlr97BZs+E0Il0aoEnl/un8wJPdQpGmIV0+iEle2aX8Q6W3GcS r6/t6VoQ/rzb1Zw== 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_H5=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: 1779313920714154100 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 + tests/qemu-iotests/tests/image-fleecing | 4 +- tests/qemu-iotests/tests/image-fleecing.out | 52 +++++++++---------- 6 files changed, 145 insertions(+), 85 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')) diff --git a/tests/qemu-iotests/tests/image-fleecing b/tests/qemu-iotests/t= ests/image-fleecing index 5e3b2c7e46a..62ef15ff046 100755 --- a/tests/qemu-iotests/tests/image-fleecing +++ b/tests/qemu-iotests/tests/image-fleecing @@ -202,12 +202,12 @@ def do_test(vm, use_cbw, use_snapshot_access_filter, = base_img_path, for p in overwrite: cmd =3D 'write -P%s %s %s' % p log(cmd) - log(vm.hmp_qemu_io(qom_path, cmd, qdev=3DTrue)) + log(vm.qmp('x-qemu-io', qdev=3D'sda', command=3Dcmd)) =20 if push_backup: # Check that previous operations were done during backup, not after # If backup is already finished, it's possible that it was finished - # even before hmp qemu_io write, and we didn't actually test + # even before qemu_io write, and we didn't actually test # copy-before-write operation. This should not happen, as we use # speed=3D1. But worth checking. result =3D vm.qmp('query-block-jobs') diff --git a/tests/qemu-iotests/tests/image-fleecing.out b/tests/qemu-iotes= ts/tests/image-fleecing.out index acfc89ff0e9..0a819539130 100644 --- a/tests/qemu-iotests/tests/image-fleecing.out +++ b/tests/qemu-iotests/tests/image-fleecing.out @@ -31,13 +31,13 @@ read -P0 0x3fe0000 64k --- Testing COW --- =20 write -P0xab 0 64k -{"return": ""} +{"return": {}} write -P0xad 0x00f8000 64k -{"return": ""} +{"return": {}} write -P0x1d 0x2008000 64k -{"return": ""} +{"return": {}} write -P0xea 0x3fe0000 64k -{"return": ""} +{"return": {}} =20 --- Verifying Data --- =20 @@ -101,13 +101,13 @@ read -P0 0x3fe0000 64k --- Testing COW --- =20 write -P0xab 0 64k -{"return": ""} +{"return": {}} write -P0xad 0x00f8000 64k -{"return": ""} +{"return": {}} write -P0x1d 0x2008000 64k -{"return": ""} +{"return": {}} write -P0xea 0x3fe0000 64k -{"return": ""} +{"return": {}} =20 --- Verifying Data --- =20 @@ -172,13 +172,13 @@ read -P0 0x3fe0000 64k --- Testing COW --- =20 write -P0xab 0 64k -{"return": ""} +{"return": {}} write -P0xad 0x00f8000 64k -{"return": ""} +{"return": {}} write -P0x1d 0x2008000 64k -{"return": ""} +{"return": {}} write -P0xea 0x3fe0000 64k -{"return": ""} +{"return": {}} =20 --- Verifying Data --- =20 @@ -238,25 +238,25 @@ read -P0xd5 1M 64k read -P0xdc 32M 64k read -P0xcd 0x3ff0000 64k read -P0 0x00f8000 32k -read failed: Invalid argument +qemu-io: read failed: Invalid argument =20 read -P0 0x2010000 32k -read failed: Invalid argument +qemu-io: read failed: Invalid argument =20 read -P0 0x3fe0000 64k -read failed: Invalid argument +qemu-io: read failed: Invalid argument =20 =20 --- Testing COW --- =20 write -P0xab 0 64k -{"return": ""} +{"return": {}} write -P0xad 0x00f8000 64k -{"return": ""} +{"return": {}} write -P0x1d 0x2008000 64k -{"return": ""} +{"return": {}} write -P0xea 0x3fe0000 64k -{"return": ""} +{"return": {}} =20 --- Verifying Data --- =20 @@ -265,13 +265,13 @@ read -P0xd5 1M 64k read -P0xdc 32M 64k read -P0xcd 0x3ff0000 64k read -P0 0x00f8000 32k -read failed: Invalid argument +qemu-io: read failed: Invalid argument =20 read -P0 0x2010000 32k -read failed: Invalid argument +qemu-io: read failed: Invalid argument =20 read -P0 0x3fe0000 64k -read failed: Invalid argument +qemu-io: read failed: Invalid argument =20 =20 --- Cleanup --- @@ -318,13 +318,13 @@ Done --- Testing COW --- =20 write -P0xab 0 64k -{"return": ""} +{"return": {}} write -P0xad 0x00f8000 64k -{"return": ""} +{"return": {}} write -P0x1d 0x2008000 64k -{"return": ""} +{"return": {}} write -P0xea 0x3fe0000 64k -{"return": ""} +{"return": {}} {"data": {"device": "push-backup", "len": 67108864, "offset": 67108864, "s= peed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {= "microseconds": "USECS", "seconds": "SECS"}} {"return": {}} =20 --=20 2.54.0 From nobody Sat May 30 17:44:35 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=1779313920; cv=none; d=zohomail.com; s=zohoarc; b=Qcle82vc9GbJoItMNmDKgAgcEouXfKZ95AXqJ7LUG7DoQaonPmvS1VmINKXKmrWbNGYTxUv8HLnoPgYSf1db66xAZj0+oraEBF6WBASgOShJjpdlhfsNvDDqVtPxMiHXQVyKWcaM6YI/i3kbNybcrTAEPChPZISJVp2C0iUdeXc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1779313920; 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=y1Mue0S2X6VyYUNIZGExwsUa2eSlbjX3q6PRbrp4a54=; b=HK0H3B5YJGo6waxPxauyHyGDDSCtqrAM8bGCiI91Rylg+vDNhORm1U6MivXU9CSfZsU3J8JBi88DW5RfhwTbKsh/StFMxGQjQuzLgD/v2ehAS/0OkJeXM57K7NtrX1Qe8GgTxHGlG4s7Tfs7WVnRB2wcm9ERhH3jxY6O1Omi4pk= 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 177931392044699.16234901683663; Wed, 20 May 2026 14:52:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wPopW-00033z-S9; Wed, 20 May 2026 17:51:54 -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 1wPopV-0002t0-6i for qemu-devel@nongnu.org; Wed, 20 May 2026 17:51:53 -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 1wPopP-0004cU-QV for qemu-devel@nongnu.org; Wed, 20 May 2026 17:51:52 -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-643-HBIb78TdPJCykXBztEbVqg-1; Wed, 20 May 2026 17:51:45 -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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A299F180061B for ; Wed, 20 May 2026 21:51:44 +0000 (UTC) Received: from localhost (unknown [10.44.24.26]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5AFDD1681; Wed, 20 May 2026 21:51:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779313907; 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=y1Mue0S2X6VyYUNIZGExwsUa2eSlbjX3q6PRbrp4a54=; b=cF7869iWBfWXa/CUT2S604hUJSE4ySgJJisnEMz8kT+duyE1l3yAxXU0Lkdlg8wcX0UjYL RklP7p9pvDHhjmiS1SQ1nWgvm9gB03ptYWBLnQL9UkxJ30H+7ek58CFpTCdgivXx2XQcDn YJC3kweefxGpkAJJpKkfsyw/GuVhpyk= X-MC-Unique: HBIb78TdPJCykXBztEbVqg-1 X-Mimecast-MFC-AGG-ID: HBIb78TdPJCykXBztEbVqg_1779313904 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Thu, 21 May 2026 01:49:17 +0400 Subject: [PATCH 16/40] tests/qemu-iotests/N: use x-qemu-io QMP command MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260521-qemu-no-hmp-v1-16-d104f809e145@redhat.com> References: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> In-Reply-To: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Developer-Signature: v=1; a=openpgp-sha256; l=26085; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=W7tBIGjX9jcsMOsJY7Cyoyr/m4noj2riyG8PcEHAjc4=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqDiyDpliVo5W90G9OAOfDYKxiB1tvjNAGobr/o FbE3XcDGx6JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCag4sgwAKCRDa6OEJdZac 5Q7GD/9Ya1T/eeUEh2uLYtphdI9Obv5+Njcmofo131Kw4+vMXIkB71pwE3kPgFtupdhYpIxTLZN qNfY08k71waSoAjwft2ml8AXuloDbgxWw/rDViKuzOSLfGlK6nhVvXEbKy5HeSXGrqa4g/ZuODn EpFZMu/Xizi2Sj6VM4JzvuQ2M7FblX+csc3N16PUsRaUBvGrMECxn+6UqzI10lljQREV/YyBIO/ JGPfJJAPmf2HsbSDgr0cXctoAnsw0T3P4UPM//wg1Yw4RpJs/VtF/Nfc40zt1TjCcKlGLEsJgfG 9lvrhakgkaPAUeIh54/DsBUkUwRytbT9P31Hm+S8b4SAx9yAHppOuU//IPUQySHzVYm4TRGM5kU PCkcogaPwnBd9IQcecKcwzZ7SNGoYdzwEQ7UitVmE0h4s4E6lUH+QXsNyrkPkexp7Ro/kx/LvTM tho3BxKTbKACVzLUQyV031Bm+NmhCekEtPD9fXNqWxk55yjrXjAa3Dm+tL7MmO7qVeONNwDCeNu Oqx+4KFmHSEl3c+7jyURaY+M5LmlcCh1fyKX19+l7QoMB/Qr5NipZujO54cE67Dw5U7EXfF5twg fr/Ze5QJGtE8SNdfuWoQJVuCRsFUrUJ0D4hjFtiaxiKbMgf8dkmYdXIJIzRSpSoMydFSob1HJIp tnhsZuERWOaldEg== 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_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: 1779313922631154100 Replace human-monitor-command wrapping of the HMP qemu-io command with direct x-qemu-io QMP calls in the two test cases that exercised corrupted image behavior through the monitor. The only output change is the QMP response: {"return": {}} (void) instead of {"return": ""} (empty HMP string). Signed-off-by: Marc-Andr=C3=A9 Lureau --- tests/qemu-iotests/060 | 8 ++++---- tests/qemu-iotests/060.out | 2 +- tests/qemu-iotests/071 | 30 +++++++++++++++++------------ tests/qemu-iotests/071.out | 8 ++++---- tests/qemu-iotests/117 | 5 +++-- tests/qemu-iotests/117.out | 7 ++++--- tests/qemu-iotests/120 | 4 ++-- tests/qemu-iotests/120.out | 2 +- tests/qemu-iotests/156 | 36 +++++++++++++++++----------------- tests/qemu-iotests/156.out | 48 +++++++++++++++++++++++-------------------= ---- tests/qemu-iotests/161 | 18 ++++++++--------- tests/qemu-iotests/161.out | 24 +++++++++++------------ tests/qemu-iotests/249 | 12 ++++++------ tests/qemu-iotests/249.out | 18 ++++++++--------- tests/qemu-iotests/283 | 4 ++-- tests/qemu-iotests/283.out | 4 ++-- 16 files changed, 119 insertions(+), 111 deletions(-) diff --git a/tests/qemu-iotests/060 b/tests/qemu-iotests/060 index 5cd21a6f686..c2c1cd815f0 100755 --- a/tests/qemu-iotests/060 +++ b/tests/qemu-iotests/060 @@ -449,8 +449,8 @@ echo _make_test_img 64M poke_file "$TEST_IMG" "$rt_offset" "\x00\x00\x00\x00\x00\x00\x00\x0= 0" echo "{'execute': 'qmp_capabilities'} - {'execute': 'human-monitor-command', - 'arguments': {'command-line': 'qemu-io drive \"write 0 512\"'}} + {'execute': 'x-qemu-io', + 'arguments': {'device': 'drive', 'command': 'write 0 512'}} {'execute': 'quit'}" \ | $QEMU -qmp stdio -nographic -nodefaults \ -drive if=3Dnone,node-name=3Ddrive,file=3D"$TEST_IMG",driver= =3Dqcow2 \ @@ -468,8 +468,8 @@ poke_file "$TEST_IMG" "$l1_offset" "\x00\x00\x00\x00\x2= a\x2a\x2a\x2a" # Inactive images are effectively read-only images, so this should be a # non-fatal corruption (which does not modify the image) echo "{'execute': 'qmp_capabilities'} - {'execute': 'human-monitor-command', - 'arguments': {'command-line': 'qemu-io drive \"read 0 512\"'}} + {'execute': 'x-qemu-io', + 'arguments': {'device': 'drive', 'command': 'read 0 512'}} {'execute': 'quit'}" \ | $QEMU -qmp stdio -nographic -nodefaults \ -blockdev "{'node-name': 'drive', diff --git a/tests/qemu-iotests/060.out b/tests/qemu-iotests/060.out index 27275fd6b70..7d3bfc97450 100644 --- a/tests/qemu-iotests/060.out +++ b/tests/qemu-iotests/060.out @@ -419,7 +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}} -{"return": "Error: write failed: Input/output error\r\n"} +{"error": {"class": "GenericError", "desc": "write failed: Input/output er= ror"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} {"return": {}} =20 diff --git a/tests/qemu-iotests/071 b/tests/qemu-iotests/071 index 331f8cfddcf..463f5c02349 100755 --- a/tests/qemu-iotests/071 +++ b/tests/qemu-iotests/071 @@ -139,9 +139,10 @@ run_qemu < (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 1779313928798997.977924188549; Wed, 20 May 2026 14:52:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wPopZ-0003NP-AQ; Wed, 20 May 2026 17:51:57 -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 1wPopX-0003C6-V3 for qemu-devel@nongnu.org; Wed, 20 May 2026 17:51:56 -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 1wPopV-0004e9-B4 for qemu-devel@nongnu.org; Wed, 20 May 2026 17:51:55 -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-220-TTkhfpYDPJWbwdDbaLYrsQ-1; Wed, 20 May 2026 17:51:51 -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 546D7180061D for ; Wed, 20 May 2026 21:51:50 +0000 (UTC) Received: from localhost (unknown [10.44.24.26]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 0B5471800357; Wed, 20 May 2026 21:51:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779313912; 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=2kxyCfqcdW8J97BihJGOEfbJd+XcaIHswgXj1K0ZftQ=; b=CtKh8r6/nTnNvOMmqyEk7/M39WuBhPUHB/1KF+1hZ0CqcNTdTHjB5SgdwHyvKoPRiHvHXP dnE7Vt0u7c3wzxhU0dAyf47veCHKGQbEtZgz1DaJJy/jGV44sWuBI0tjZCMXfg0tPLvdMg Or4zmYjvAGomL+g/A4v2jH6/XXRbVu8= X-MC-Unique: TTkhfpYDPJWbwdDbaLYrsQ-1 X-Mimecast-MFC-AGG-ID: TTkhfpYDPJWbwdDbaLYrsQ_1779313910 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Thu, 21 May 2026 01:49:18 +0400 Subject: [PATCH 17/40] tests/qemu-iotests/181, 192, 249: convert to QMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260521-qemu-no-hmp-v1-17-d104f809e145@redhat.com> References: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> In-Reply-To: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Developer-Signature: v=1; a=openpgp-sha256; l=11592; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=TKYDQFrviMWTTW7fOJIEpLbLgZZhdKe9SzfIKlZ95sU=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqDiyDiGCB9Cga9B2PPGzeVDxPGrhgIKm+MDxLT i3CDpaaZBGJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCag4sgwAKCRDa6OEJdZac 5TgBEACL77wPWgtHzkcb85CqW+LcmALGu7c/DGDHpR8cdBM60gQxj5jqO4754BSNiqyO0URyIVi EDqTfC8l56A+Kg/1Idt/qQtQtsVx6ir+sCFVonKHsDcIU4jG4fw6nIs7gtr1XmowqZnLtEEi9R5 iy6Cz/h4T3D/GjLhjCHf2dT6EDE4Gi1fovz5R8fjrpeRSJqtc9OwFVEWUh+RwvGmp8mrhSBsqqJ GsH+VaLLq7rRPQaAv8agBAMuYzPqW4Gx731JUjgMCOHZbcYcCLCIo3zidZOyIR3MOMUM9fZY1Ti ZoyX+zxEcAzdlrivUlE2gHbJZY7gbU40E6knnWEju2HkgEcn/X1LCqCkFrSEKwNTxiTjqyyCHXr GfDSe4YDTTY2/odJHuEZlWMlUWN64DIHGymlK4ZMHPXBZoVfjDtm+bv8YZU2YtryavQL28quGTk YP/0DNjXMdbc5+Yxjv+yhMfSGCoIiMQE9xZS+bOn0vp6j+tKX2ESq5A0WpPml54bpuRG7Ba7o7P RFsEiKzyezQ6bkcuPkyDa76VybpFFr8D7mKEVS4qwlaiur/yAdXCNVAhNXMO1zeku1XJzaKXMnS 5GilY6ev303YYF+HjP6s5tXDgF6gNhHNbNzoAXc/QWlRKd9bbEzNwfvPJXVG8l/Antcu/XcvI27 gJVapcUSlFyNw/w== 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_H5=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: 1779313930783154100 Convert tests 181 and 192 from HMP monitor commands to QMP: - Remove qemu_comm_method=3D"monitor" and add qmp_capabilities negotiation. - Replace HMP commands (qemu-io, migrate_set_capability, migrate_set_parameter, migrate, info migrate, nbd_server_start, nbd_server_add, quit) with their QMP equivalents (x-qemu-io, migrate-set-capabilities, migrate-set-parameters, migrate, query-migrate, nbd-server-start, nbd-server-add, quit). Unlike human-monitor-command which wraps errors inside {"return": "Error: ..."}, x-qemu-io returns errors as a proper QMP {"error": ...} response. Match 'return\|error' on x-qemu-io calls so the test terminates on both success and failure, rather than hanging until timeout. Apply the same fix to test 249. Remove the HMP output drain idiom (send empty command, wait for prompt) after query-migrate polling in test 181. In QMP, an empty line produces no response, so this would hang. Capture the RESUME event delivered on the destination QMP channel after postcopy migration completes. This event was not visible in HMP mode. Update expected output for all three tests. Signed-off-by: Marc-Andr=C3=A9 Lureau --- tests/qemu-iotests/181 | 99 ++++++++++++++++++++++++++++++++++--------= ---- tests/qemu-iotests/181.out | 36 ++++++++++++----- tests/qemu-iotests/192 | 22 +++++++++-- tests/qemu-iotests/192.out | 17 ++++++-- tests/qemu-iotests/249 | 6 +-- 5 files changed, 134 insertions(+), 46 deletions(-) diff --git a/tests/qemu-iotests/181 b/tests/qemu-iotests/181 index dc90a10757f..3de24090c68 100755 --- a/tests/qemu-iotests/181 +++ b/tests/qemu-iotests/181 @@ -55,8 +55,6 @@ echo echo =3D=3D=3D Starting VMs =3D=3D=3D echo =20 -qemu_comm_method=3D"monitor" - if [ "$IMGOPTSSYNTAX" =3D "true" ]; then _launch_qemu \ -drive "${TEST_IMG}",cache=3D${CACHEMODE},aio=3D$AIOMODE,id=3Ddisk @@ -77,15 +75,30 @@ else fi dest=3D$QEMU_HANDLE =20 +_send_qemu_cmd $src \ + "{ 'execute': 'qmp_capabilities' }" \ + 'return' + +_send_qemu_cmd $dest \ + "{ 'execute': 'qmp_capabilities' }" \ + 'return' + echo echo =3D=3D=3D Write something on the source =3D=3D=3D echo =20 silent=3D -_send_qemu_cmd $src 'qemu-io disk "write -P 0x55 0 64k"' "(qemu)" -_send_qemu_cmd $src "" "ops/sec" -_send_qemu_cmd $src 'qemu-io disk "read -P 0x55 0 64k"' "(qemu)" -_send_qemu_cmd $src "" "ops/sec" +_send_qemu_cmd $src \ + "{ 'execute': 'x-qemu-io', + 'arguments': { 'device': 'disk', + 'command': 'write -P 0x55 0 64k' } }" \ + 'return\|error' + +_send_qemu_cmd $src \ + "{ 'execute': 'x-qemu-io', + 'arguments': { 'device': 'disk', + 'command': 'read -P 0x55 0 64k' } }" \ + 'return\|error' =20 echo echo =3D=3D=3D Do postcopy migration to destination =3D=3D=3D @@ -95,28 +108,49 @@ echo # switch to postcopy # Enable postcopy-ram capability both on source and destination silent=3Dyes -_send_qemu_cmd $dest 'migrate_set_capability postcopy-ram on' "(qemu)" - qemu_error_no_exit=3Dyes success_or_failure=3Dyes \ - _send_qemu_cmd $dest '' "(qemu)" "Postcopy is not supported" -if [ ${QEMU_STATUS[$dest]} -lt 0 ]; then - _send_qemu_cmd $dest '' "(qemu)" + _send_qemu_cmd $dest \ + "{ 'execute': 'migrate-set-capabilities', + 'arguments': { 'capabilities': [ + { 'capability': 'postcopy-ram', 'state': true } ] } }" \ + 'return' 'error' =20 - _send_qemu_cmd $src 'quit' "" - _send_qemu_cmd $dest 'quit' "" +if [ ${QEMU_STATUS[$dest]} -lt 0 ]; then + _send_qemu_cmd $src \ + "{ 'execute': 'quit' }" \ + 'return' + _send_qemu_cmd $dest \ + "{ 'execute': 'quit' }" \ + 'return' wait=3D1 _cleanup_qemu =20 _notrun 'Postcopy is not supported' fi =20 -_send_qemu_cmd $src 'migrate_set_parameter max-bandwidth 4k' "(qemu)" -_send_qemu_cmd $src 'migrate_set_capability postcopy-ram on' "(qemu)" -_send_qemu_cmd $src "migrate -d unix:${MIG_SOCKET}" "(qemu)" -_send_qemu_cmd $src 'migrate_start_postcopy' "(qemu)" +_send_qemu_cmd $src \ + "{ 'execute': 'migrate-set-parameters', + 'arguments': { 'max-bandwidth': 4096 } }" \ + 'return' + +_send_qemu_cmd $src \ + "{ 'execute': 'migrate-set-capabilities', + 'arguments': { 'capabilities': [ + { 'capability': 'postcopy-ram', 'state': true } ] } }" \ + 'return' + +_send_qemu_cmd $src \ + "{ 'execute': 'migrate', + 'arguments': { 'uri': 'unix:${MIG_SOCKET}' } }" \ + 'return' + +_send_qemu_cmd $src \ + "{ 'execute': 'migrate-start-postcopy' }" \ + 'return' =20 QEMU_COMM_TIMEOUT=3D1 qemu_cmd_repeat=3D10 silent=3Dyes \ - _send_qemu_cmd $src "info migrate" "completed\|failed" -silent=3Dyes _send_qemu_cmd $src "" "(qemu)" + _send_qemu_cmd $src \ + "{ 'execute': 'query-migrate' }" \ + "completed\|failed" =20 echo echo =3D=3D=3D Do some I/O on the destination =3D=3D=3D @@ -126,17 +160,32 @@ echo # of the node name, which would create a new BlockBackend and not test whe= ther # the guest has the necessary permissions to access the image now silent=3D -_send_qemu_cmd $dest 'qemu-io disk "read -P 0x55 0 64k"' "(qemu)" -_send_qemu_cmd $dest "" "ops/sec" -_send_qemu_cmd $dest 'qemu-io disk "write -P 0x66 1M 64k"' "(qemu)" -_send_qemu_cmd $dest "" "ops/sec" +capture_events=3D"RESUME" +_send_qemu_cmd $dest \ + "{ 'execute': 'x-qemu-io', + 'arguments': { 'device': 'disk', + 'command': 'read -P 0x55 0 64k' } }" \ + 'return\|error' +capture_events=3D + +_send_qemu_cmd $dest \ + "{ 'execute': 'x-qemu-io', + 'arguments': { 'device': 'disk', + 'command': 'write -P 0x66 1M 64k' } }" \ + 'return\|error' =20 echo echo =3D=3D=3D Shut down and check image =3D=3D=3D echo =20 -_send_qemu_cmd $src 'quit' "" -_send_qemu_cmd $dest 'quit' "" +_send_qemu_cmd $src \ + "{ 'execute': 'quit' }" \ + 'return' + +_send_qemu_cmd $dest \ + "{ 'execute': 'quit' }" \ + 'return' + wait=3D1 _cleanup_qemu =20 _check_test_img diff --git a/tests/qemu-iotests/181.out b/tests/qemu-iotests/181.out index d58c6a9dabb..ddcce564699 100644 --- a/tests/qemu-iotests/181.out +++ b/tests/qemu-iotests/181.out @@ -3,35 +3,51 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108= 864 =20 =3D=3D=3D Starting VMs =3D=3D=3D =20 +{ 'execute': 'qmp_capabilities' } +{"return": {}} +{ 'execute': 'qmp_capabilities' } +{"return": {}} =20 =3D=3D=3D Write something on the source =3D=3D=3D =20 -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) qemu-io disk "write -P 0x55 0 64k" +{ 'execute': 'x-qemu-io', + 'arguments': { 'device': 'disk', + 'command': 'write -P 0x55 0 64k' } } wrote 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -(qemu)=20 -(qemu) qemu-io disk "read -P 0x55 0 64k" +{"return": {}} +{ 'execute': 'x-qemu-io', + 'arguments': { 'device': 'disk', + 'command': 'read -P 0x55 0 64k' } } read 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +{"return": {}} =20 =3D=3D=3D Do postcopy migration to destination =3D=3D=3D =20 =20 =3D=3D=3D Do some I/O on the destination =3D=3D=3D =20 -(qemu) qemu-io disk "read -P 0x55 0 64k" +{ 'execute': 'x-qemu-io', + 'arguments': { 'device': 'disk', + 'command': 'read -P 0x55 0 64k' } } read 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -(qemu)=20 -(qemu) qemu-io disk "write -P 0x66 1M 64k" +{"return": {}} +{ 'execute': 'x-qemu-io', + 'arguments': { 'device': 'disk', + 'command': 'write -P 0x66 1M 64k' } } wrote 65536/65536 bytes at offset 1048576 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +{"return": {}} =20 =3D=3D=3D Shut down and check image =3D=3D=3D =20 -(qemu) quit -(qemu)=20 -(qemu) quit +{ 'execute': 'quit' } +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} +{"return": {}} +{ 'execute': 'quit' } +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} +{"return": {}} No errors were found on the image. *** done diff --git a/tests/qemu-iotests/192 b/tests/qemu-iotests/192 index e66e1a4f06a..ea89cffe107 100755 --- a/tests/qemu-iotests/192 +++ b/tests/qemu-iotests/192 @@ -58,7 +58,6 @@ else DRIVE_ARG=3Dif=3Dide,id=3Ddrive0,format=3D$IMGFMT,file=3D$TEST_IMG fi =20 -qemu_comm_method=3D"monitor" _launch_qemu -drive $DRIVE_ARG -incoming defer h=3D$QEMU_HANDLE if [ "${VALGRIND_QEMU}" =3D=3D "y" ]; then @@ -67,9 +66,24 @@ else QEMU_COMM_TIMEOUT=3D1 fi =20 -_send_qemu_cmd $h "nbd_server_start unix:$SOCK_DIR/nbd" "(qemu)" -_send_qemu_cmd $h "nbd_server_add -w drive0" "(qemu)" -_send_qemu_cmd $h "q" "(qemu)" +_send_qemu_cmd $h \ + "{ 'execute': 'qmp_capabilities' }" \ + 'return' + +_send_qemu_cmd $h \ + "{ 'execute': 'nbd-server-start', + 'arguments': { 'addr': { 'type': 'unix', + 'data': { 'path': '$SOCK_DIR/nbd' } } } }"= \ + 'return' + +_send_qemu_cmd $h \ + "{ 'execute': 'nbd-server-add', + 'arguments': { 'device': 'drive0', 'writable': true } }" \ + 'return' + +_send_qemu_cmd $h \ + "{ 'execute': 'quit' }" \ + 'return' =20 # success, all done echo "*** done" diff --git a/tests/qemu-iotests/192.out b/tests/qemu-iotests/192.out index b9429dbe367..88185a2e8ff 100644 --- a/tests/qemu-iotests/192.out +++ b/tests/qemu-iotests/192.out @@ -1,7 +1,16 @@ QA output created by 192 Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) nbd_server_start unix:SOCK_DIR/nbd -(qemu) nbd_server_add -w drive0 -(qemu) q +{ 'execute': 'qmp_capabilities' } +{"return": {}} +{ 'execute': 'nbd-server-start', + 'arguments': { 'addr': { 'type': 'unix', + 'data': { 'path': 'SOCK_DIR/nbd' } } } } +{"return": {}} +{ 'execute': 'nbd-server-add', + 'arguments': { 'device': 'drive0', 'writable': true } } +{"return": {}} +{ 'execute': 'quit' } +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "BLOCK_EXPORT_DELETED", "data": {"id": "drive0"}} +{"return": {}} *** done diff --git a/tests/qemu-iotests/249 b/tests/qemu-iotests/249 index 16cf6c2d8c4..d30a2ac6bc8 100755 --- a/tests/qemu-iotests/249 +++ b/tests/qemu-iotests/249 @@ -69,7 +69,7 @@ echo _send_qemu_cmd $QEMU_HANDLE \ "{ 'execute': 'x-qemu-io', 'arguments': {'device': 'none0', 'command': 'aio_write 0 2k'}}" \ - 'return' + 'return\|error' =20 echo echo '=3D=3D=3D Run block-commit on base using an invalid filter node name' @@ -86,7 +86,7 @@ echo _send_qemu_cmd $QEMU_HANDLE \ "{ 'execute': 'x-qemu-io', 'arguments': {'device': 'none0', 'command': 'aio_write 0 2k'}}" \ - 'return' + 'return\|error' =20 echo echo '=3D=3D=3D Run block-commit on base using the default filter node nam= e' @@ -106,7 +106,7 @@ echo _send_qemu_cmd $QEMU_HANDLE \ "{ 'execute': 'x-qemu-io', 'arguments': {'device': 'none0', 'command': 'aio_write 0 2k'}}" \ - 'return' + 'return\|error' =20 _cleanup_qemu =20 --=20 2.54.0 From nobody Sat May 30 17:44:35 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=1779313943; cv=none; d=zohomail.com; s=zohoarc; b=ZhQMLFqdw9nHwJuSbsCpjucmnr+RHZE4DeVAa02N7GSGojtjb5iY3XnpQd8yJ2wotXmj2pHuFkhnVg2PK99ZsWxs4+ouZ7CzJeeUJfF+4reBU4lr641kopKwpzo7uUaFyLncewvbtzzDXmtGPgmxEookZmZNnjv/7+ME7pF+B7I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1779313943; 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=ufZAiVzqJFOxVoQfwy4RilsYE7GTwcD7lNPFl/Uo2EQ=; b=fQEaAGaPmIm4RBzz3SwaC4ZzqJ4WXrISVUq22LgFH6ssSbWTMsvR9CI7JcinskhIpJIr2CefAk78g7xAyKccJGtpnZoCE1S2Mg+W8zm1lAUTj/X0g/LrKmYfImUFqqQA2viq9lz6qF842R/4vTWbXd3bBr8ug46IKoWKhRcaO+4= 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 1779313943327408.5388759198954; Wed, 20 May 2026 14:52:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wPopj-0004U3-4f; Wed, 20 May 2026 17:52: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 1wPopi-0004PH-0O for qemu-devel@nongnu.org; Wed, 20 May 2026 17:52:06 -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 1wPopc-0004gJ-Ci for qemu-devel@nongnu.org; Wed, 20 May 2026 17:52:05 -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-591-rkhK3qHwMBSMyRvLkIvMRA-1; Wed, 20 May 2026 17:51:57 -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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7E4201956080 for ; Wed, 20 May 2026 21:51:56 +0000 (UTC) Received: from localhost (unknown [10.44.24.26]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7158519560A2; Wed, 20 May 2026 21:51:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779313919; 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=ufZAiVzqJFOxVoQfwy4RilsYE7GTwcD7lNPFl/Uo2EQ=; b=ZIv4GzsyRX5rqNOnwZfDGWoQY1ztSnMx6Y8FaNbEQTaXHrWUUWC17VCT/yWuqcqTWCzyyc FiexKi3NWr+lw5IdWWsIfOz4ZHd39z2Zrcq0xTZLqSBdYkINHI6z9yCm8PHB3VYsM17JOq E/dkrs5ISlLXKLq6/uDJIeVxx8U1csE= X-MC-Unique: rkhK3qHwMBSMyRvLkIvMRA-1 X-Mimecast-MFC-AGG-ID: rkhK3qHwMBSMyRvLkIvMRA_1779313916 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Thu, 21 May 2026 01:49:19 +0400 Subject: [PATCH 18/40] tests/qemu-iotests/186: convert from HMP to QMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260521-qemu-no-hmp-v1-18-d104f809e145@redhat.com> References: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> In-Reply-To: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Developer-Signature: v=1; a=openpgp-sha256; l=55242; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=SJeNraDDmveXGbgl/jOyBph6ScrwdGQk14rgIwS0MM8=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqDiyDfWs2hMvIUlw3ncIVlxpZwOUWh8yRo4yTv YZ4iRbMv9yJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCag4sgwAKCRDa6OEJdZac 5VuFEACmC8Q37+25gdfH8RPV7JAd8hLxS4Khl1AKSuGIFPmJpxmdgU1/VBmRYeCcS3KgygZvXX8 vBXdDR4NV9b5K9arbK3NeMI47/8/crqUJWfzZE3p0UpuROaF25zVkqDPx1DmrSFunAwDwYaCvYC al07qOISoeQtztrarhC5Lc9zishojUz8rD1bEDsOr9gXYhc0dCAiF4aM2NyCQ1ZwUovEdIiPFYn rJNG9EKxs8vYrecZgdml/73Gm8l74LSNsNMaqTfs/635/LBqJ23PUnoPcOoLnrdTy4K1Qyn6zd0 qCVedHAFlbxb7O1Wc49eTWWbGOkEGjod6ERmbGAx7dy8Zseo+0ZEPL0q4V5HK3wG+wv4grAGZtl arF08TQNQE+pF5VBUYAHDelF4UM0wiomdVVZOE3AgBDUpK3LbR2L+LkmYbKH4SgrIedRMCCWSVU o3lqsjutQGzXN850euql/igAMrzusxI53THCN7cPozSU2gAPb5Z3HUguwuzvkT47pjtpsXc5D20 ggeLQmTfeBFmfvVnYUETi5ocUY5uVL09RaKuXQpx72gBURDwxRbpw3P2e8iQ2IlH54Vahg3tAsH eerLrLq4rrR8TPR5t3lLKYnEVQLmRxZbTL5PRbD77qzT1Upam6c3WWtfCB7Jdku0zePlFh9CwrI KCE8evZJENwmbIA== 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: 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: 1779313945170154100 Replace HMP 'info block' with QMP 'query-block' so the test works with --disable-hmp builds. Use -qmp stdio instead of -monitor stdio, send JSON commands via printf, and filter with _filter_qmp and _filter_qmp_empty_return instead of _filter_hmp. Signed-off-by: Marc-Andr=C3=A9 Lureau --- tests/qemu-iotests/186 | 20 +-- tests/qemu-iotests/186.out | 440 +++++++++++------------------------------= ---- 2 files changed, 108 insertions(+), 352 deletions(-) diff --git a/tests/qemu-iotests/186 b/tests/qemu-iotests/186 index eaf13c7a334..fa77319614b 100755 --- a/tests/qemu-iotests/186 +++ b/tests/qemu-iotests/186 @@ -1,7 +1,7 @@ #!/usr/bin/env bash # group: rw auto # -# Test 'info block' with all kinds of configurations +# Test 'query-block' with all kinds of configurations # # Copyright (C) 2017 Red Hat, Inc. # @@ -50,22 +50,18 @@ do_run_qemu() { echo Testing: "$@" =20 - ( - if ! test -t 0; then - while read cmd; do - echo $cmd - done - fi - echo quit - ) | $QEMU -S -display none -device virtio-scsi-pci -monitor stdio "$@"= 2>&1 + printf '{"execute":"qmp_capabilities"}\n{"execute":"query-block"}\n{"e= xecute":"quit"}\n' | + $QEMU -S -display none -device virtio-scsi-pci -monitor none -qmp stdi= o "$@" 2>&1 echo } =20 check_info_block() { - echo "info block" | - do_run_qemu "$@" | _filter_win32 | _filter_hmp | _filter_qemu | - _filter_generated_node_ids | _filter_qom_path + do_run_qemu "$@" | _filter_win32 | _filter_qemu | _filter_qmp | + _filter_qmp_empty_return | + grep -v '"event"' | + _filter_generated_node_ids | + sed 's/device\[[0-9]\+\]/device[N]/g' } =20 =20 diff --git a/tests/qemu-iotests/186.out b/tests/qemu-iotests/186.out index 01530040e5f..952b0c7a0a0 100644 --- a/tests/qemu-iotests/186.out +++ b/tests/qemu-iotests/186.out @@ -4,458 +4,218 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D671= 08864 =3D=3D=3D Empty drives =3D=3D=3D =20 Testing: -device floppy -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -/machine/peripheral-anon/device[1]: [not inserted] - Attached to: /machine/peripheral-anon/device[N] - Removable device: not locked, tray closed -(qemu) quit +QMP_VERSION +{"return": [{"device": "", "locked": false, "removable": true, "qdev": "/m= achine/peripheral-anon/device[N]", "type": "unknown"}]} =20 Testing: -device floppy,id=3Dqdev_id -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -qdev_id: [not inserted] - Attached to: qdev_id - Removable device: not locked, tray closed -(qemu) quit +QMP_VERSION +{"return": [{"device": "", "locked": false, "removable": true, "qdev": "qd= ev_id", "type": "unknown"}]} =20 Testing: -device ide-cd -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -/machine/peripheral-anon/device[1]: [not inserted] - Attached to: /machine/peripheral-anon/device[N] - Removable device: not locked, tray closed -(qemu) quit +QMP_VERSION +{"return": [{"io-status": "ok", "device": "", "locked": false, "removable"= : true, "qdev": "/machine/peripheral-anon/device[N]", "tray_open": false, "= type": "unknown"}]} =20 Testing: -device ide-cd,id=3Dqdev_id -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -qdev_id: [not inserted] - Attached to: qdev_id - Removable device: not locked, tray closed -(qemu) quit +QMP_VERSION +{"return": [{"io-status": "ok", "device": "", "locked": false, "removable"= : true, "qdev": "qdev_id", "tray_open": false, "type": "unknown"}]} =20 Testing: -device scsi-cd -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -/machine/peripheral-anon/device[1]: [not inserted] - Attached to: /machine/peripheral-anon/device[N] - Removable device: not locked, tray closed -(qemu) quit +QMP_VERSION +{"return": [{"io-status": "ok", "device": "", "locked": false, "removable"= : true, "qdev": "/machine/peripheral-anon/device[N]", "tray_open": false, "= type": "unknown"}]} =20 Testing: -device scsi-cd,id=3Dqdev_id -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -qdev_id: [not inserted] - Attached to: qdev_id - Removable device: not locked, tray closed -(qemu) quit +QMP_VERSION +{"return": [{"io-status": "ok", "device": "", "locked": false, "removable"= : true, "qdev": "qdev_id", "tray_open": false, "type": "unknown"}]} =20 =20 =3D=3D=3D -blockdev/-device=3D =3D=3D=3D =20 Testing: -blockdev driver=3Dnull-co,read-zeroes=3Don,node-name=3Dnull -dev= ice ide-hd,drive=3Dnull -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -null: json:{"read-zeroes": true, "driver": "null-co"} (null-co) - Attached to: /machine/peripheral-anon/device[N] - Cache mode: writeback -(qemu) quit +QMP_VERSION +{"return": [{"io-status": "ok", "device": "", "locked": false, "removable"= : false, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true,= "image": {"limits": {"request-alignment": 1, "min-mem-alignment": 512, "op= t-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 1073741824, "file= name": "json:{\"read-zeroes\": true, \"driver\": \"null-co\"}", "format": "= null-co", "actual-size": 0}, "iops_wr": 0, "ro": false, "children": [], "no= de-name": "null", "backing_file_depth": 0, "drv": "null-co", "iops": 0, "bp= s_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, = "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "= json:{\"read-zeroes\": true, \"driver\": \"null-co\"}"}, "qdev": "/machine/= peripheral-anon/device[N]", "type": "unknown"}]} =20 Testing: -blockdev driver=3Dnull-co,read-zeroes=3Don,node-name=3Dnull -dev= ice ide-hd,drive=3Dnull,id=3Dqdev_id -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -null: json:{"read-zeroes": true, "driver": "null-co"} (null-co) - Attached to: qdev_id - Cache mode: writeback -(qemu) quit +QMP_VERSION +{"return": [{"io-status": "ok", "device": "", "locked": false, "removable"= : false, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true,= "image": {"limits": {"request-alignment": 1, "min-mem-alignment": 512, "op= t-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 1073741824, "file= name": "json:{\"read-zeroes\": true, \"driver\": \"null-co\"}", "format": "= null-co", "actual-size": 0}, "iops_wr": 0, "ro": false, "children": [], "no= de-name": "null", "backing_file_depth": 0, "drv": "null-co", "iops": 0, "bp= s_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, = "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "= json:{\"read-zeroes\": true, \"driver\": \"null-co\"}"}, "qdev": "qdev_id",= "type": "unknown"}]} =20 Testing: -blockdev driver=3Dnull-co,read-zeroes=3Don,node-name=3Dnull -dev= ice scsi-hd,drive=3Dnull -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -null: json:{"read-zeroes": true, "driver": "null-co"} (null-co) - Attached to: /machine/peripheral-anon/device[N] - Cache mode: writeback -(qemu) quit +QMP_VERSION +{"return": [{"io-status": "ok", "device": "", "locked": false, "removable"= : false, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true,= "image": {"limits": {"request-alignment": 1, "min-mem-alignment": 512, "op= t-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 1073741824, "file= name": "json:{\"read-zeroes\": true, \"driver\": \"null-co\"}", "format": "= null-co", "actual-size": 0}, "iops_wr": 0, "ro": false, "children": [], "no= de-name": "null", "backing_file_depth": 0, "drv": "null-co", "iops": 0, "bp= s_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, = "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "= json:{\"read-zeroes\": true, \"driver\": \"null-co\"}"}, "qdev": "/machine/= peripheral-anon/device[N]", "type": "unknown"}]} =20 Testing: -blockdev driver=3Dnull-co,read-zeroes=3Don,node-name=3Dnull -dev= ice scsi-hd,drive=3Dnull,id=3Dqdev_id -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -null: json:{"read-zeroes": true, "driver": "null-co"} (null-co) - Attached to: qdev_id - Cache mode: writeback -(qemu) quit +QMP_VERSION +{"return": [{"io-status": "ok", "device": "", "locked": false, "removable"= : false, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true,= "image": {"limits": {"request-alignment": 1, "min-mem-alignment": 512, "op= t-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 1073741824, "file= name": "json:{\"read-zeroes\": true, \"driver\": \"null-co\"}", "format": "= null-co", "actual-size": 0}, "iops_wr": 0, "ro": false, "children": [], "no= de-name": "null", "backing_file_depth": 0, "drv": "null-co", "iops": 0, "bp= s_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, = "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "= json:{\"read-zeroes\": true, \"driver\": \"null-co\"}"}, "qdev": "qdev_id",= "type": "unknown"}]} =20 Testing: -blockdev driver=3Dnull-co,read-zeroes=3Don,node-name=3Dnull -dev= ice virtio-blk-pci,drive=3Dnull -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -null: json:{"read-zeroes": true, "driver": "null-co"} (null-co) - Attached to: /machine/peripheral-anon/device[N]/virtio-backend - Cache mode: writeback -(qemu) quit +QMP_VERSION +{"return": [{"io-status": "ok", "device": "", "locked": false, "removable"= : false, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true,= "image": {"limits": {"request-alignment": 1, "min-mem-alignment": 512, "op= t-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 1073741824, "file= name": "json:{\"read-zeroes\": true, \"driver\": \"null-co\"}", "format": "= null-co", "actual-size": 0}, "iops_wr": 0, "ro": false, "children": [], "no= de-name": "null", "backing_file_depth": 0, "drv": "null-co", "iops": 0, "bp= s_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, = "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "= json:{\"read-zeroes\": true, \"driver\": \"null-co\"}"}, "qdev": "/machine/= peripheral-anon/device[N]/virtio-backend", "type": "unknown"}]} =20 Testing: -blockdev driver=3Dnull-co,read-zeroes=3Don,node-name=3Dnull -dev= ice virtio-blk-pci,drive=3Dnull,id=3Dqdev_id -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -null: json:{"read-zeroes": true, "driver": "null-co"} (null-co) - Attached to: /machine/peripheral/qdev_id/virtio-backend - Cache mode: writeback -(qemu) quit +QMP_VERSION +{"return": [{"io-status": "ok", "device": "", "locked": false, "removable"= : false, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true,= "image": {"limits": {"request-alignment": 1, "min-mem-alignment": 512, "op= t-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 1073741824, "file= name": "json:{\"read-zeroes\": true, \"driver\": \"null-co\"}", "format": "= null-co", "actual-size": 0}, "iops_wr": 0, "ro": false, "children": [], "no= de-name": "null", "backing_file_depth": 0, "drv": "null-co", "iops": 0, "bp= s_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, = "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "= json:{\"read-zeroes\": true, \"driver\": \"null-co\"}"}, "qdev": "/machine/= peripheral/qdev_id/virtio-backend", "type": "unknown"}]} =20 Testing: -blockdev driver=3Dnull-co,read-zeroes=3Don,node-name=3Dnull -dev= ice floppy,drive=3Dnull -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -null: json:{"read-zeroes": true, "driver": "null-co"} (null-co) - Attached to: /machine/peripheral-anon/device[N] - Removable device: not locked, tray closed - Cache mode: writeback -(qemu) quit +QMP_VERSION +{"return": [{"device": "", "locked": false, "removable": true, "inserted":= {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits":= {"request-alignment": 1, "min-mem-alignment": 512, "opt-mem-alignment": 40= 96, "max-iov": 1024}, "virtual-size": 1073741824, "filename": "json:{\"read= -zeroes\": true, \"driver\": \"null-co\"}", "format": "null-co", "actual-si= ze": 0}, "iops_wr": 0, "ro": false, "children": [], "node-name": "null", "b= acking_file_depth": 0, "drv": "null-co", "iops": 0, "bps_wr": 0, "write_thr= eshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush"= : false, "direct": false, "writeback": true}, "file": "json:{\"read-zeroes\= ": true, \"driver\": \"null-co\"}"}, "qdev": "/machine/peripheral-anon/devi= ce[N]", "type": "unknown"}]} =20 Testing: -blockdev driver=3Dnull-co,read-zeroes=3Don,node-name=3Dnull -dev= ice floppy,drive=3Dnull,id=3Dqdev_id -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -null: json:{"read-zeroes": true, "driver": "null-co"} (null-co) - Attached to: qdev_id - Removable device: not locked, tray closed - Cache mode: writeback -(qemu) quit +QMP_VERSION +{"return": [{"device": "", "locked": false, "removable": true, "inserted":= {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits":= {"request-alignment": 1, "min-mem-alignment": 512, "opt-mem-alignment": 40= 96, "max-iov": 1024}, "virtual-size": 1073741824, "filename": "json:{\"read= -zeroes\": true, \"driver\": \"null-co\"}", "format": "null-co", "actual-si= ze": 0}, "iops_wr": 0, "ro": false, "children": [], "node-name": "null", "b= acking_file_depth": 0, "drv": "null-co", "iops": 0, "bps_wr": 0, "write_thr= eshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush"= : false, "direct": false, "writeback": true}, "file": "json:{\"read-zeroes\= ": true, \"driver\": \"null-co\"}"}, "qdev": "qdev_id", "type": "unknown"}]} =20 Testing: -blockdev driver=3Dnull-co,read-zeroes=3Don,node-name=3Dnull -dev= ice ide-cd,drive=3Dnull -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -null: json:{"read-zeroes": true, "driver": "null-co"} (null-co) - Attached to: /machine/peripheral-anon/device[N] - Removable device: not locked, tray closed - Cache mode: writeback -(qemu) quit +QMP_VERSION +{"return": [{"io-status": "ok", "device": "", "locked": false, "removable"= : true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, = "image": {"limits": {"request-alignment": 1, "min-mem-alignment": 512, "opt= -mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 1073741824, "filen= ame": "json:{\"read-zeroes\": true, \"driver\": \"null-co\"}", "format": "n= ull-co", "actual-size": 0}, "iops_wr": 0, "ro": false, "children": [], "nod= e-name": "null", "backing_file_depth": 0, "drv": "null-co", "iops": 0, "bps= _wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "= cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "j= son:{\"read-zeroes\": true, \"driver\": \"null-co\"}"}, "qdev": "/machine/p= eripheral-anon/device[N]", "tray_open": false, "type": "unknown"}]} =20 Testing: -blockdev driver=3Dnull-co,read-zeroes=3Don,node-name=3Dnull -dev= ice ide-cd,drive=3Dnull,id=3Dqdev_id -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -null: json:{"read-zeroes": true, "driver": "null-co"} (null-co) - Attached to: qdev_id - Removable device: not locked, tray closed - Cache mode: writeback -(qemu) quit +QMP_VERSION +{"return": [{"io-status": "ok", "device": "", "locked": false, "removable"= : true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, = "image": {"limits": {"request-alignment": 1, "min-mem-alignment": 512, "opt= -mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 1073741824, "filen= ame": "json:{\"read-zeroes\": true, \"driver\": \"null-co\"}", "format": "n= ull-co", "actual-size": 0}, "iops_wr": 0, "ro": false, "children": [], "nod= e-name": "null", "backing_file_depth": 0, "drv": "null-co", "iops": 0, "bps= _wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "= cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "j= son:{\"read-zeroes\": true, \"driver\": \"null-co\"}"}, "qdev": "qdev_id", = "tray_open": false, "type": "unknown"}]} =20 Testing: -blockdev driver=3Dnull-co,read-zeroes=3Don,node-name=3Dnull -dev= ice scsi-cd,drive=3Dnull -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -null: json:{"read-zeroes": true, "driver": "null-co"} (null-co) - Attached to: /machine/peripheral-anon/device[N] - Removable device: not locked, tray closed - Cache mode: writeback -(qemu) quit +QMP_VERSION +{"return": [{"io-status": "ok", "device": "", "locked": false, "removable"= : true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, = "image": {"limits": {"request-alignment": 1, "min-mem-alignment": 512, "opt= -mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 1073741824, "filen= ame": "json:{\"read-zeroes\": true, \"driver\": \"null-co\"}", "format": "n= ull-co", "actual-size": 0}, "iops_wr": 0, "ro": false, "children": [], "nod= e-name": "null", "backing_file_depth": 0, "drv": "null-co", "iops": 0, "bps= _wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "= cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "j= son:{\"read-zeroes\": true, \"driver\": \"null-co\"}"}, "qdev": "/machine/p= eripheral-anon/device[N]", "tray_open": false, "type": "unknown"}]} =20 Testing: -blockdev driver=3Dnull-co,read-zeroes=3Don,node-name=3Dnull -dev= ice scsi-cd,drive=3Dnull,id=3Dqdev_id -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -null: json:{"read-zeroes": true, "driver": "null-co"} (null-co) - Attached to: qdev_id - Removable device: not locked, tray closed - Cache mode: writeback -(qemu) quit +QMP_VERSION +{"return": [{"io-status": "ok", "device": "", "locked": false, "removable"= : true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, = "image": {"limits": {"request-alignment": 1, "min-mem-alignment": 512, "opt= -mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 1073741824, "filen= ame": "json:{\"read-zeroes\": true, \"driver\": \"null-co\"}", "format": "n= ull-co", "actual-size": 0}, "iops_wr": 0, "ro": false, "children": [], "nod= e-name": "null", "backing_file_depth": 0, "drv": "null-co", "iops": 0, "bps= _wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "= cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "j= son:{\"read-zeroes\": true, \"driver\": \"null-co\"}"}, "qdev": "qdev_id", = "tray_open": false, "type": "unknown"}]} =20 =20 =3D=3D=3D -drive if=3Dnone/-device=3D =3D=3D=3D =20 Testing: -drive if=3Dnone,driver=3Dnull-co,read-zeroes=3Don,node-name=3Dnu= ll -device ide-hd,drive=3Dnull,id=3Dqdev_id -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co) - Removable device: not locked, tray closed - Cache mode: writeback - -null: json:{"read-zeroes": "on", "driver": "null-co"} (null-co) - Attached to: qdev_id - Cache mode: writeback -(qemu) quit +QMP_VERSION +{"return": [{"device": "none0", "locked": false, "removable": true, "inser= ted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"lim= its": {"request-alignment": 1, "min-mem-alignment": 512, "opt-mem-alignment= ": 4096, "max-iov": 1024}, "virtual-size": 1073741824, "filename": "json:{\= "read-zeroes\": \"on\", \"driver\": \"null-co\"}", "format": "null-co", "ac= tual-size": 0}, "iops_wr": 0, "ro": false, "children": [], "node-name": "nu= ll", "backing_file_depth": 0, "drv": "null-co", "iops": 0, "bps_wr": 0, "wr= ite_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no= -flush": false, "direct": false, "writeback": true}, "file": "json:{\"read-= zeroes\": \"on\", \"driver\": \"null-co\"}"}, "type": "unknown"}, {"io-stat= us": "ok", "device": "", "locked": false, "removable": false, "inserted": {= "iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {= "request-alignment": 1, "min-mem-alignment": 512, "opt-mem-alignment": 4096= , "max-iov": 1024}, "vi rtual-size": 1073741824, "filename": "json:{\"read-zeroes\": \"on\", \"dri= ver\": \"null-co\"}", "format": "null-co", "actual-size": 0}, "iops_wr": 0,= "ro": false, "children": [], "node-name": "null", "backing_file_depth": 0,= "drv": "null-co", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted= ": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": fal= se, "writeback": true}, "file": "json:{\"read-zeroes\": \"on\", \"driver\":= \"null-co\"}"}, "qdev": "qdev_id", "type": "unknown"}]} =20 Testing: -drive if=3Dnone,driver=3Dnull-co,read-zeroes=3Don,node-name=3Dnu= ll -device scsi-hd,drive=3Dnull,id=3Dqdev_id -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co) - Removable device: not locked, tray closed - Cache mode: writeback - -null: json:{"read-zeroes": "on", "driver": "null-co"} (null-co) - Attached to: qdev_id - Cache mode: writeback -(qemu) quit +QMP_VERSION +{"return": [{"device": "none0", "locked": false, "removable": true, "inser= ted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"lim= its": {"request-alignment": 1, "min-mem-alignment": 512, "opt-mem-alignment= ": 4096, "max-iov": 1024}, "virtual-size": 1073741824, "filename": "json:{\= "read-zeroes\": \"on\", \"driver\": \"null-co\"}", "format": "null-co", "ac= tual-size": 0}, "iops_wr": 0, "ro": false, "children": [], "node-name": "nu= ll", "backing_file_depth": 0, "drv": "null-co", "iops": 0, "bps_wr": 0, "wr= ite_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no= -flush": false, "direct": false, "writeback": true}, "file": "json:{\"read-= zeroes\": \"on\", \"driver\": \"null-co\"}"}, "type": "unknown"}, {"io-stat= us": "ok", "device": "", "locked": false, "removable": false, "inserted": {= "iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {= "request-alignment": 1, "min-mem-alignment": 512, "opt-mem-alignment": 4096= , "max-iov": 1024}, "vi rtual-size": 1073741824, "filename": "json:{\"read-zeroes\": \"on\", \"dri= ver\": \"null-co\"}", "format": "null-co", "actual-size": 0}, "iops_wr": 0,= "ro": false, "children": [], "node-name": "null", "backing_file_depth": 0,= "drv": "null-co", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted= ": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": fal= se, "writeback": true}, "file": "json:{\"read-zeroes\": \"on\", \"driver\":= \"null-co\"}"}, "qdev": "qdev_id", "type": "unknown"}]} =20 Testing: -drive if=3Dnone,driver=3Dnull-co,read-zeroes=3Don,node-name=3Dnu= ll -device virtio-blk-pci,drive=3Dnull,id=3Dqdev_id -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co) - Removable device: not locked, tray closed - Cache mode: writeback - -null: json:{"read-zeroes": "on", "driver": "null-co"} (null-co) - Attached to: /machine/peripheral/qdev_id/virtio-backend - Cache mode: writeback -(qemu) quit +QMP_VERSION +{"return": [{"device": "none0", "locked": false, "removable": true, "inser= ted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"lim= its": {"request-alignment": 1, "min-mem-alignment": 512, "opt-mem-alignment= ": 4096, "max-iov": 1024}, "virtual-size": 1073741824, "filename": "json:{\= "read-zeroes\": \"on\", \"driver\": \"null-co\"}", "format": "null-co", "ac= tual-size": 0}, "iops_wr": 0, "ro": false, "children": [], "node-name": "nu= ll", "backing_file_depth": 0, "drv": "null-co", "iops": 0, "bps_wr": 0, "wr= ite_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no= -flush": false, "direct": false, "writeback": true}, "file": "json:{\"read-= zeroes\": \"on\", \"driver\": \"null-co\"}"}, "type": "unknown"}, {"io-stat= us": "ok", "device": "", "locked": false, "removable": false, "inserted": {= "iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {= "request-alignment": 1, "min-mem-alignment": 512, "opt-mem-alignment": 4096= , "max-iov": 1024}, "vi rtual-size": 1073741824, "filename": "json:{\"read-zeroes\": \"on\", \"dri= ver\": \"null-co\"}", "format": "null-co", "actual-size": 0}, "iops_wr": 0,= "ro": false, "children": [], "node-name": "null", "backing_file_depth": 0,= "drv": "null-co", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted= ": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": fal= se, "writeback": true}, "file": "json:{\"read-zeroes\": \"on\", \"driver\":= \"null-co\"}"}, "qdev": "/machine/peripheral/qdev_id/virtio-backend", "typ= e": "unknown"}]} =20 Testing: -drive if=3Dnone,driver=3Dnull-co,read-zeroes=3Don,node-name=3Dnu= ll -device floppy,drive=3Dnull,id=3Dqdev_id -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co) - Removable device: not locked, tray closed - Cache mode: writeback - -null: json:{"read-zeroes": "on", "driver": "null-co"} (null-co) - Attached to: qdev_id - Removable device: not locked, tray closed - Cache mode: writeback -(qemu) quit +QMP_VERSION +{"return": [{"device": "none0", "locked": false, "removable": true, "inser= ted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"lim= its": {"request-alignment": 1, "min-mem-alignment": 512, "opt-mem-alignment= ": 4096, "max-iov": 1024}, "virtual-size": 1073741824, "filename": "json:{\= "read-zeroes\": \"on\", \"driver\": \"null-co\"}", "format": "null-co", "ac= tual-size": 0}, "iops_wr": 0, "ro": false, "children": [], "node-name": "nu= ll", "backing_file_depth": 0, "drv": "null-co", "iops": 0, "bps_wr": 0, "wr= ite_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no= -flush": false, "direct": false, "writeback": true}, "file": "json:{\"read-= zeroes\": \"on\", \"driver\": \"null-co\"}"}, "type": "unknown"}, {"device"= : "", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "detec= t_zeroes": "off", "active": true, "image": {"limits": {"request-alignment":= 1, "min-mem-alignment": 512, "opt-mem-alignment": 4096, "max-iov": 1024}, = "virtual-size": 1073741 824, "filename": "json:{\"read-zeroes\": \"on\", \"driver\": \"null-co\"}"= , "format": "null-co", "actual-size": 0}, "iops_wr": 0, "ro": false, "child= ren": [], "node-name": "null", "backing_file_depth": 0, "drv": "null-co", "= iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, = "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": tru= e}, "file": "json:{\"read-zeroes\": \"on\", \"driver\": \"null-co\"}"}, "qd= ev": "qdev_id", "type": "unknown"}]} =20 Testing: -drive if=3Dnone,driver=3Dnull-co,read-zeroes=3Don,node-name=3Dnu= ll -device ide-cd,drive=3Dnull,id=3Dqdev_id -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co) - Removable device: not locked, tray closed - Cache mode: writeback - -null: json:{"read-zeroes": "on", "driver": "null-co"} (null-co) - Attached to: qdev_id - Removable device: not locked, tray closed - Cache mode: writeback -(qemu) quit +QMP_VERSION +{"return": [{"device": "none0", "locked": false, "removable": true, "inser= ted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"lim= its": {"request-alignment": 1, "min-mem-alignment": 512, "opt-mem-alignment= ": 4096, "max-iov": 1024}, "virtual-size": 1073741824, "filename": "json:{\= "read-zeroes\": \"on\", \"driver\": \"null-co\"}", "format": "null-co", "ac= tual-size": 0}, "iops_wr": 0, "ro": false, "children": [], "node-name": "nu= ll", "backing_file_depth": 0, "drv": "null-co", "iops": 0, "bps_wr": 0, "wr= ite_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no= -flush": false, "direct": false, "writeback": true}, "file": "json:{\"read-= zeroes\": \"on\", \"driver\": \"null-co\"}"}, "type": "unknown"}, {"io-stat= us": "ok", "device": "", "locked": false, "removable": true, "inserted": {"= iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"= request-alignment": 1, "min-mem-alignment": 512, "opt-mem-alignment": 4096,= "max-iov": 1024}, "vir tual-size": 1073741824, "filename": "json:{\"read-zeroes\": \"on\", \"driv= er\": \"null-co\"}", "format": "null-co", "actual-size": 0}, "iops_wr": 0, = "ro": false, "children": [], "node-name": "null", "backing_file_depth": 0, = "drv": "null-co", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted"= : false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": fals= e, "writeback": true}, "file": "json:{\"read-zeroes\": \"on\", \"driver\": = \"null-co\"}"}, "qdev": "qdev_id", "tray_open": false, "type": "unknown"}]} =20 Testing: -drive if=3Dnone,driver=3Dnull-co,read-zeroes=3Don,node-name=3Dnu= ll -device scsi-cd,drive=3Dnull,id=3Dqdev_id -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co) - Removable device: not locked, tray closed - Cache mode: writeback - -null: json:{"read-zeroes": "on", "driver": "null-co"} (null-co) - Attached to: qdev_id - Removable device: not locked, tray closed - Cache mode: writeback -(qemu) quit +QMP_VERSION +{"return": [{"device": "none0", "locked": false, "removable": true, "inser= ted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"lim= its": {"request-alignment": 1, "min-mem-alignment": 512, "opt-mem-alignment= ": 4096, "max-iov": 1024}, "virtual-size": 1073741824, "filename": "json:{\= "read-zeroes\": \"on\", \"driver\": \"null-co\"}", "format": "null-co", "ac= tual-size": 0}, "iops_wr": 0, "ro": false, "children": [], "node-name": "nu= ll", "backing_file_depth": 0, "drv": "null-co", "iops": 0, "bps_wr": 0, "wr= ite_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no= -flush": false, "direct": false, "writeback": true}, "file": "json:{\"read-= zeroes\": \"on\", \"driver\": \"null-co\"}"}, "type": "unknown"}, {"io-stat= us": "ok", "device": "", "locked": false, "removable": true, "inserted": {"= iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"= request-alignment": 1, "min-mem-alignment": 512, "opt-mem-alignment": 4096,= "max-iov": 1024}, "vir tual-size": 1073741824, "filename": "json:{\"read-zeroes\": \"on\", \"driv= er\": \"null-co\"}", "format": "null-co", "actual-size": 0}, "iops_wr": 0, = "ro": false, "children": [], "node-name": "null", "backing_file_depth": 0, = "drv": "null-co", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted"= : false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": fals= e, "writeback": true}, "file": "json:{\"read-zeroes\": \"on\", \"driver\": = \"null-co\"}"}, "qdev": "qdev_id", "tray_open": false, "type": "unknown"}]} =20 =20 =3D=3D=3D -drive if=3Dnone/-device=3D (with medium) =3D=3D=3D =20 Testing: -drive if=3Dnone,driver=3Dnull-co,read-zeroes=3Don,node-name=3Dnu= ll -device ide-hd,drive=3Dnone0 -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co) - Attached to: /machine/peripheral-anon/device[N] - Cache mode: writeback -(qemu) quit +QMP_VERSION +{"return": [{"io-status": "ok", "device": "none0", "locked": false, "remov= able": false, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": = true, "image": {"limits": {"request-alignment": 1, "min-mem-alignment": 512= , "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 1073741824, = "filename": "json:{\"read-zeroes\": \"on\", \"driver\": \"null-co\"}", "for= mat": "null-co", "actual-size": 0}, "iops_wr": 0, "ro": false, "children": = [], "node-name": "null", "backing_file_depth": 0, "drv": "null-co", "iops":= 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_r= d": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "f= ile": "json:{\"read-zeroes\": \"on\", \"driver\": \"null-co\"}"}, "qdev": "= /machine/peripheral-anon/device[N]", "type": "unknown"}]} =20 Testing: -drive if=3Dnone,driver=3Dnull-co,read-zeroes=3Don,node-name=3Dnu= ll -device ide-hd,drive=3Dnone0,id=3Dqdev_id -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co) - Attached to: qdev_id - Cache mode: writeback -(qemu) quit +QMP_VERSION +{"return": [{"io-status": "ok", "device": "none0", "locked": false, "remov= able": false, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": = true, "image": {"limits": {"request-alignment": 1, "min-mem-alignment": 512= , "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 1073741824, = "filename": "json:{\"read-zeroes\": \"on\", \"driver\": \"null-co\"}", "for= mat": "null-co", "actual-size": 0}, "iops_wr": 0, "ro": false, "children": = [], "node-name": "null", "backing_file_depth": 0, "drv": "null-co", "iops":= 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_r= d": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "f= ile": "json:{\"read-zeroes\": \"on\", \"driver\": \"null-co\"}"}, "qdev": "= qdev_id", "type": "unknown"}]} =20 Testing: -drive if=3Dnone,driver=3Dnull-co,read-zeroes=3Don,node-name=3Dnu= ll -device scsi-hd,drive=3Dnone0 -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co) - Attached to: /machine/peripheral-anon/device[N] - Cache mode: writeback -(qemu) quit +QMP_VERSION +{"return": [{"io-status": "ok", "device": "none0", "locked": false, "remov= able": false, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": = true, "image": {"limits": {"request-alignment": 1, "min-mem-alignment": 512= , "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 1073741824, = "filename": "json:{\"read-zeroes\": \"on\", \"driver\": \"null-co\"}", "for= mat": "null-co", "actual-size": 0}, "iops_wr": 0, "ro": false, "children": = [], "node-name": "null", "backing_file_depth": 0, "drv": "null-co", "iops":= 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_r= d": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "f= ile": "json:{\"read-zeroes\": \"on\", \"driver\": \"null-co\"}"}, "qdev": "= /machine/peripheral-anon/device[N]", "type": "unknown"}]} =20 Testing: -drive if=3Dnone,driver=3Dnull-co,read-zeroes=3Don,node-name=3Dnu= ll -device scsi-hd,drive=3Dnone0,id=3Dqdev_id -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co) - Attached to: qdev_id - Cache mode: writeback -(qemu) quit +QMP_VERSION +{"return": [{"io-status": "ok", "device": "none0", "locked": false, "remov= able": false, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": = true, "image": {"limits": {"request-alignment": 1, "min-mem-alignment": 512= , "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 1073741824, = "filename": "json:{\"read-zeroes\": \"on\", \"driver\": \"null-co\"}", "for= mat": "null-co", "actual-size": 0}, "iops_wr": 0, "ro": false, "children": = [], "node-name": "null", "backing_file_depth": 0, "drv": "null-co", "iops":= 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_r= d": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "f= ile": "json:{\"read-zeroes\": \"on\", \"driver\": \"null-co\"}"}, "qdev": "= qdev_id", "type": "unknown"}]} =20 Testing: -drive if=3Dnone,driver=3Dnull-co,read-zeroes=3Don,node-name=3Dnu= ll -device virtio-blk-pci,drive=3Dnone0 -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co) - Attached to: /machine/peripheral-anon/device[N]/virtio-backend - Cache mode: writeback -(qemu) quit +QMP_VERSION +{"return": [{"io-status": "ok", "device": "none0", "locked": false, "remov= able": false, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": = true, "image": {"limits": {"request-alignment": 1, "min-mem-alignment": 512= , "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 1073741824, = "filename": "json:{\"read-zeroes\": \"on\", \"driver\": \"null-co\"}", "for= mat": "null-co", "actual-size": 0}, "iops_wr": 0, "ro": false, "children": = [], "node-name": "null", "backing_file_depth": 0, "drv": "null-co", "iops":= 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_r= d": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "f= ile": "json:{\"read-zeroes\": \"on\", \"driver\": \"null-co\"}"}, "qdev": "= /machine/peripheral-anon/device[N]/virtio-backend", "type": "unknown"}]} =20 Testing: -drive if=3Dnone,driver=3Dnull-co,read-zeroes=3Don,node-name=3Dnu= ll -device virtio-blk-pci,drive=3Dnone0,id=3Dqdev_id -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co) - Attached to: /machine/peripheral/qdev_id/virtio-backend - Cache mode: writeback -(qemu) quit +QMP_VERSION +{"return": [{"io-status": "ok", "device": "none0", "locked": false, "remov= able": false, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": = true, "image": {"limits": {"request-alignment": 1, "min-mem-alignment": 512= , "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 1073741824, = "filename": "json:{\"read-zeroes\": \"on\", \"driver\": \"null-co\"}", "for= mat": "null-co", "actual-size": 0}, "iops_wr": 0, "ro": false, "children": = [], "node-name": "null", "backing_file_depth": 0, "drv": "null-co", "iops":= 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_r= d": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "f= ile": "json:{\"read-zeroes\": \"on\", \"driver\": \"null-co\"}"}, "qdev": "= /machine/peripheral/qdev_id/virtio-backend", "type": "unknown"}]} =20 Testing: -drive if=3Dnone,driver=3Dnull-co,read-zeroes=3Don,node-name=3Dnu= ll -device floppy,drive=3Dnone0 -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co) - Attached to: /machine/peripheral-anon/device[N] - Removable device: not locked, tray closed - Cache mode: writeback -(qemu) quit +QMP_VERSION +{"return": [{"device": "none0", "locked": false, "removable": true, "inser= ted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"lim= its": {"request-alignment": 1, "min-mem-alignment": 512, "opt-mem-alignment= ": 4096, "max-iov": 1024}, "virtual-size": 1073741824, "filename": "json:{\= "read-zeroes\": \"on\", \"driver\": \"null-co\"}", "format": "null-co", "ac= tual-size": 0}, "iops_wr": 0, "ro": false, "children": [], "node-name": "nu= ll", "backing_file_depth": 0, "drv": "null-co", "iops": 0, "bps_wr": 0, "wr= ite_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no= -flush": false, "direct": false, "writeback": true}, "file": "json:{\"read-= zeroes\": \"on\", \"driver\": \"null-co\"}"}, "qdev": "/machine/peripheral-= anon/device[N]", "type": "unknown"}]} =20 Testing: -drive if=3Dnone,driver=3Dnull-co,read-zeroes=3Don,node-name=3Dnu= ll -device floppy,drive=3Dnone0,id=3Dqdev_id -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co) - Attached to: qdev_id - Removable device: not locked, tray closed - Cache mode: writeback -(qemu) quit +QMP_VERSION +{"return": [{"device": "none0", "locked": false, "removable": true, "inser= ted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"lim= its": {"request-alignment": 1, "min-mem-alignment": 512, "opt-mem-alignment= ": 4096, "max-iov": 1024}, "virtual-size": 1073741824, "filename": "json:{\= "read-zeroes\": \"on\", \"driver\": \"null-co\"}", "format": "null-co", "ac= tual-size": 0}, "iops_wr": 0, "ro": false, "children": [], "node-name": "nu= ll", "backing_file_depth": 0, "drv": "null-co", "iops": 0, "bps_wr": 0, "wr= ite_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no= -flush": false, "direct": false, "writeback": true}, "file": "json:{\"read-= zeroes\": \"on\", \"driver\": \"null-co\"}"}, "qdev": "qdev_id", "type": "u= nknown"}]} =20 Testing: -drive if=3Dnone,driver=3Dnull-co,read-zeroes=3Don,node-name=3Dnu= ll -device ide-cd,drive=3Dnone0 -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co) - Attached to: /machine/peripheral-anon/device[N] - Removable device: not locked, tray closed - Cache mode: writeback -(qemu) quit +QMP_VERSION +{"return": [{"io-status": "ok", "device": "none0", "locked": false, "remov= able": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": t= rue, "image": {"limits": {"request-alignment": 1, "min-mem-alignment": 512,= "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 1073741824, "= filename": "json:{\"read-zeroes\": \"on\", \"driver\": \"null-co\"}", "form= at": "null-co", "actual-size": 0}, "iops_wr": 0, "ro": false, "children": [= ], "node-name": "null", "backing_file_depth": 0, "drv": "null-co", "iops": = 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd= ": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "fi= le": "json:{\"read-zeroes\": \"on\", \"driver\": \"null-co\"}"}, "qdev": "/= machine/peripheral-anon/device[N]", "tray_open": false, "type": "unknown"}]} =20 Testing: -drive if=3Dnone,driver=3Dnull-co,read-zeroes=3Don,node-name=3Dnu= ll -device ide-cd,drive=3Dnone0,id=3Dqdev_id -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co) - Attached to: qdev_id - Removable device: not locked, tray closed - Cache mode: writeback -(qemu) quit +QMP_VERSION +{"return": [{"io-status": "ok", "device": "none0", "locked": false, "remov= able": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": t= rue, "image": {"limits": {"request-alignment": 1, "min-mem-alignment": 512,= "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 1073741824, "= filename": "json:{\"read-zeroes\": \"on\", \"driver\": \"null-co\"}", "form= at": "null-co", "actual-size": 0}, "iops_wr": 0, "ro": false, "children": [= ], "node-name": "null", "backing_file_depth": 0, "drv": "null-co", "iops": = 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd= ": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "fi= le": "json:{\"read-zeroes\": \"on\", \"driver\": \"null-co\"}"}, "qdev": "q= dev_id", "tray_open": false, "type": "unknown"}]} =20 Testing: -drive if=3Dnone,driver=3Dnull-co,read-zeroes=3Don,node-name=3Dnu= ll -device scsi-cd,drive=3Dnone0 -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co) - Attached to: /machine/peripheral-anon/device[N] - Removable device: not locked, tray closed - Cache mode: writeback -(qemu) quit +QMP_VERSION +{"return": [{"io-status": "ok", "device": "none0", "locked": false, "remov= able": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": t= rue, "image": {"limits": {"request-alignment": 1, "min-mem-alignment": 512,= "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 1073741824, "= filename": "json:{\"read-zeroes\": \"on\", \"driver\": \"null-co\"}", "form= at": "null-co", "actual-size": 0}, "iops_wr": 0, "ro": false, "children": [= ], "node-name": "null", "backing_file_depth": 0, "drv": "null-co", "iops": = 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd= ": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "fi= le": "json:{\"read-zeroes\": \"on\", \"driver\": \"null-co\"}"}, "qdev": "/= machine/peripheral-anon/device[N]", "tray_open": false, "type": "unknown"}]} =20 Testing: -drive if=3Dnone,driver=3Dnull-co,read-zeroes=3Don,node-name=3Dnu= ll -device scsi-cd,drive=3Dnone0,id=3Dqdev_id -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -none0 (null): json:{"read-zeroes": "on", "driver": "null-co"} (null-co) - Attached to: qdev_id - Removable device: not locked, tray closed - Cache mode: writeback -(qemu) quit +QMP_VERSION +{"return": [{"io-status": "ok", "device": "none0", "locked": false, "remov= able": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": t= rue, "image": {"limits": {"request-alignment": 1, "min-mem-alignment": 512,= "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 1073741824, "= filename": "json:{\"read-zeroes\": \"on\", \"driver\": \"null-co\"}", "form= at": "null-co", "actual-size": 0}, "iops_wr": 0, "ro": false, "children": [= ], "node-name": "null", "backing_file_depth": 0, "drv": "null-co", "iops": = 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd= ": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "fi= le": "json:{\"read-zeroes\": \"on\", \"driver\": \"null-co\"}"}, "qdev": "q= dev_id", "tray_open": false, "type": "unknown"}]} =20 =20 =3D=3D=3D -drive if=3Dnone/-device=3D (without medium) =3D=3D=3D =20 Testing: -drive if=3Dnone -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -none0: [not inserted] - Removable device: not locked, tray closed -(qemu) quit +QMP_VERSION +{"return": [{"device": "none0", "locked": false, "removable": true, "type"= : "unknown"}]} =20 Testing: -drive if=3Dnone -device floppy,drive=3Dnone0 -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -none0: [not inserted] - Attached to: /machine/peripheral-anon/device[N] - Removable device: not locked, tray closed -(qemu) quit +QMP_VERSION +{"return": [{"device": "none0", "locked": false, "removable": true, "qdev"= : "/machine/peripheral-anon/device[N]", "type": "unknown"}]} =20 Testing: -drive if=3Dnone -device floppy,drive=3Dnone0,id=3Dqdev_id -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -none0: [not inserted] - Attached to: qdev_id - Removable device: not locked, tray closed -(qemu) quit +QMP_VERSION +{"return": [{"device": "none0", "locked": false, "removable": true, "qdev"= : "qdev_id", "type": "unknown"}]} =20 Testing: -drive if=3Dnone -device ide-cd,drive=3Dnone0 -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -none0: [not inserted] - Attached to: /machine/peripheral-anon/device[N] - Removable device: not locked, tray closed -(qemu) quit +QMP_VERSION +{"return": [{"io-status": "ok", "device": "none0", "locked": false, "remov= able": true, "qdev": "/machine/peripheral-anon/device[N]", "tray_open": fal= se, "type": "unknown"}]} =20 Testing: -drive if=3Dnone -device ide-cd,drive=3Dnone0,id=3Dqdev_id -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -none0: [not inserted] - Attached to: qdev_id - Removable device: not locked, tray closed -(qemu) quit +QMP_VERSION +{"return": [{"io-status": "ok", "device": "none0", "locked": false, "remov= able": true, "qdev": "qdev_id", "tray_open": false, "type": "unknown"}]} =20 Testing: -drive if=3Dnone -device scsi-cd,drive=3Dnone0 -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -none0: [not inserted] - Attached to: /machine/peripheral-anon/device[N] - Removable device: not locked, tray closed -(qemu) quit +QMP_VERSION +{"return": [{"io-status": "ok", "device": "none0", "locked": false, "remov= able": true, "qdev": "/machine/peripheral-anon/device[N]", "tray_open": fal= se, "type": "unknown"}]} =20 Testing: -drive if=3Dnone -device scsi-cd,drive=3Dnone0,id=3Dqdev_id -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -none0: [not inserted] - Attached to: qdev_id - Removable device: not locked, tray closed -(qemu) quit +QMP_VERSION +{"return": [{"io-status": "ok", "device": "none0", "locked": false, "remov= able": true, "qdev": "qdev_id", "tray_open": false, "type": "unknown"}]} =20 =20 =3D=3D=3D -drive if=3D... =3D=3D=3D =20 Testing: -drive if=3Dfloppy -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -floppy0: [not inserted] - Attached to: /machine/unattached/device[N] - Removable device: not locked, tray closed -(qemu) quit +QMP_VERSION +{"return": [{"device": "floppy0", "locked": false, "removable": true, "qde= v": "/machine/unattached/device[N]", "type": "unknown"}]} =20 Testing: -drive if=3Dfloppy,driver=3Dnull-co,read-zeroes=3Don -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -floppy0 (NODE_NAME): json:{"read-zeroes": "on", "driver": "null-co"} (null= -co) - Attached to: /machine/unattached/device[N] - Removable device: not locked, tray closed - Cache mode: writeback -(qemu) quit +QMP_VERSION +{"return": [{"device": "floppy0", "locked": false, "removable": true, "ins= erted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"l= imits": {"request-alignment": 1, "min-mem-alignment": 512, "opt-mem-alignme= nt": 4096, "max-iov": 1024}, "virtual-size": 1073741824, "filename": "json:= {\"read-zeroes\": \"on\", \"driver\": \"null-co\"}", "format": "null-co", "= actual-size": 0}, "iops_wr": 0, "ro": false, "children": [], "node-name": "= NODE_NAME", "backing_file_depth": 0, "drv": "null-co", "iops": 0, "bps_wr":= 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache= ": {"no-flush": false, "direct": false, "writeback": true}, "file": "json:{= \"read-zeroes\": \"on\", \"driver\": \"null-co\"}"}, "qdev": "/machine/unat= tached/device[N]", "type": "unknown"}]} =20 Testing: -drive if=3Dide,driver=3Dnull-co,read-zeroes=3Don -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -ide0-hd0 (NODE_NAME): json:{"read-zeroes": "on", "driver": "null-co"} (nul= l-co) - Attached to: /machine/unattached/device[N] - Cache mode: writeback -(qemu) quit +QMP_VERSION +{"return": [{"io-status": "ok", "device": "ide0-hd0", "locked": false, "re= movable": false, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active= ": true, "image": {"limits": {"request-alignment": 1, "min-mem-alignment": = 512, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 107374182= 4, "filename": "json:{\"read-zeroes\": \"on\", \"driver\": \"null-co\"}", "= format": "null-co", "actual-size": 0}, "iops_wr": 0, "ro": false, "children= ": [], "node-name": "NODE_NAME", "backing_file_depth": 0, "drv": "null-co",= "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0= , "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": t= rue}, "file": "json:{\"read-zeroes\": \"on\", \"driver\": \"null-co\"}"}, "= qdev": "/machine/unattached/device[N]", "type": "unknown"}]} =20 Testing: -drive if=3Dide,media=3Dcdrom -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -ide0-cd0: [not inserted] - Attached to: /machine/unattached/device[N] - Removable device: not locked, tray closed -(qemu) quit +QMP_VERSION +{"return": [{"io-status": "ok", "device": "ide0-cd0", "locked": false, "re= movable": true, "qdev": "/machine/unattached/device[N]", "tray_open": false= , "type": "unknown"}]} =20 Testing: -drive if=3Dide,driver=3Dnull-co,read-zeroes=3Don,media=3Dcdrom -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -ide0-cd0 (NODE_NAME): json:{"read-zeroes": "on", "driver": "null-co"} (nul= l-co, read-only) - Attached to: /machine/unattached/device[N] - Removable device: not locked, tray closed - Cache mode: writeback -(qemu) quit +QMP_VERSION +{"return": [{"io-status": "ok", "device": "ide0-cd0", "locked": false, "re= movable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active"= : true, "image": {"limits": {"request-alignment": 1, "min-mem-alignment": 5= 12, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 1073741824= , "filename": "json:{\"read-zeroes\": \"on\", \"driver\": \"null-co\"}", "f= ormat": "null-co", "actual-size": 0}, "iops_wr": 0, "ro": true, "children":= [], "node-name": "NODE_NAME", "backing_file_depth": 0, "drv": "null-co", "= iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, = "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": tru= e}, "file": "json:{\"read-zeroes\": \"on\", \"driver\": \"null-co\"}"}, "qd= ev": "/machine/unattached/device[N]", "tray_open": false, "type": "unknown"= }]} =20 Testing: -drive if=3Dvirtio,driver=3Dnull-co,read-zeroes=3Don -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -virtio0 (NODE_NAME): json:{"read-zeroes": "on", "driver": "null-co"} (null= -co) - Attached to: /machine/peripheral-anon/device[N]/virtio-backend - Cache mode: writeback -(qemu) quit +QMP_VERSION +{"return": [{"io-status": "ok", "device": "virtio0", "locked": false, "rem= ovable": false, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active"= : true, "image": {"limits": {"request-alignment": 1, "min-mem-alignment": 5= 12, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 1073741824= , "filename": "json:{\"read-zeroes\": \"on\", \"driver\": \"null-co\"}", "f= ormat": "null-co", "actual-size": 0}, "iops_wr": 0, "ro": false, "children"= : [], "node-name": "NODE_NAME", "backing_file_depth": 0, "drv": "null-co", = "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0,= "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": tr= ue}, "file": "json:{\"read-zeroes\": \"on\", \"driver\": \"null-co\"}"}, "q= dev": "/machine/peripheral-anon/device[N]/virtio-backend", "type": "unknown= "}]} =20 Testing: -drive if=3Dpflash,driver=3Dnull-co,read-zeroes=3Don,size=3D1M -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -pflash0 (NODE_NAME): json:{"read-zeroes": "on", "driver": "null-co", "size= ": "1M"} (null-co) - Attached to: /machine/system.flash0 - Cache mode: writeback -(qemu) quit +QMP_VERSION +{"return": [{"device": "pflash0", "locked": false, "removable": false, "in= serted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"= limits": {"request-alignment": 1, "min-mem-alignment": 512, "opt-mem-alignm= ent": 4096, "max-iov": 1024}, "virtual-size": 1048576, "filename": "json:{\= "read-zeroes\": \"on\", \"driver\": \"null-co\", \"size\": \"1M\"}", "forma= t": "null-co", "actual-size": 0}, "iops_wr": 0, "ro": false, "children": []= , "node-name": "NODE_NAME", "backing_file_depth": 0, "drv": "null-co", "iop= s": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bp= s_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true},= "file": "json:{\"read-zeroes\": \"on\", \"driver\": \"null-co\", \"size\":= \"1M\"}"}, "qdev": "/machine/system.flash0", "type": "unknown"}]} =20 *** done --=20 2.54.0 From nobody Sat May 30 17:44:35 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=1779313936; cv=none; d=zohomail.com; s=zohoarc; b=RIJLryh720RdsUABNAu+XGsrpE9jnQbP0lp8CS004vUvjbDuWhmD24LOztDQ1sFhQY0/Fq7i713oDZPF64HE41CDdICzslkwu4wXxviaPeVA2uF8zZMZhhK7ENdOKZxoTsugc/oj9ZYkFNsywu67t0WHjXq7n2/LOTj+pUUiCnc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1779313936; 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=IZtUzZpbpf9YYm5RHL11hpLjPNLROe9A2vYPhB1Pxo0=; b=WZbTRsoIclqmCcNMxG8o0R3xBmpMyrYYS5R5lCHM+vJMRvtVEMYtfKHZvzCsYeJ+dyRABcE1+XopL1f7lo3J0i9yGvrSFBMXYy2GOUMDIHWNFTpqY70rsyXOy2yA5NkCkayNSt4JrvqhAJ+jcgm0zkcpa/z+Ifdj8bDFGdlrwAI= 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 1779313936917610.6642057703609; Wed, 20 May 2026 14:52:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wPopk-0004Vy-8A; Wed, 20 May 2026 17:52:08 -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 1wPopi-0004Tq-Vp for qemu-devel@nongnu.org; Wed, 20 May 2026 17:52:06 -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 1wPoph-0004ir-CL for qemu-devel@nongnu.org; Wed, 20 May 2026 17:52:06 -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-170-qeQhkSDoN3OVRHDw8ec2fQ-1; Wed, 20 May 2026 17:52:03 -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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4ED091956095 for ; Wed, 20 May 2026 21:52:02 +0000 (UTC) Received: from localhost (unknown [10.44.24.26]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A4CD51800576; Wed, 20 May 2026 21:52:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779313924; 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=IZtUzZpbpf9YYm5RHL11hpLjPNLROe9A2vYPhB1Pxo0=; b=WFtY9ldkI/g+RQknzHzOerumJEc1Rg2XDcI86lwchSawYs/NFPyUidQ3Uh53F2m/IdBOXg 9hmiwLzV+GtduWTEeB38wB7xKL9GnLhLQRSpn1O5J2vsuvweAzeW+EyWrYWbOe8Vh5lSdN P4m4cotM1jee/GJgfLWeeGriH7a9vUk= X-MC-Unique: qeQhkSDoN3OVRHDw8ec2fQ-1 X-Mimecast-MFC-AGG-ID: qeQhkSDoN3OVRHDw8ec2fQ_1779313922 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Thu, 21 May 2026 01:49:20 +0400 Subject: [PATCH 19/40] tests/qemu-iotests/copy-before-write: convert to QMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260521-qemu-no-hmp-v1-19-d104f809e145@redhat.com> References: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> In-Reply-To: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Developer-Signature: v=1; a=openpgp-sha256; l=3450; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=cY5OL3HTF9JMTQj/3Myv8kv0xhi8eNvqsNljyBUmFeg=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqDiyD5kG7eRhXfizk8uDOVB3MbJ+OTkEoXHYL4 DBcBjjK4VOJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCag4sgwAKCRDa6OEJdZac 5Wa4D/9Dd9UKFGEBU1Et1g4zxXTV86RUmMwXU1esuMlQrrnQh/2PnyfZVVfZTuSG7j+h4E4ILuJ RcXAyJenQK8qkxoaC3QPY6WtZiJhHojKdvUA3jdBGoZ++XBm9ooUgCvgQzzIe3QRETD7rWQL0br Z0S2MNNM4woqDrxm7QtzcR/mJnwrhJrBlFjrJ9hQxDQSVnr9CE/qedU0v8kXtGbakYS3XANBf+y qBLD3gmMpJxrw+9ya/cM60g065qt3lM0mOdW7S93YRrHpGmNzTfPgcAOlb/tUKnWNKS571j9tVn fO7mgXtzxkqfXknysDpu6QTBchRqiSdqdPrrxQZO2I//wJ0yvzrlDdpJwr1ITCodDgZWOX1y+Km bslLMn9MT7WFCbaH0tp+tgisiv0f7+kEIMUvnzw6pDP5C9YyyNiAIbYfot03TmjoBWxkkw7MDEJ b1s2oKAcOKpUa1Gam8qSLoCRgsabF1+i+Gfg6ZFeAP3ZnZcxqIbC28YqNLce7hISy50Wd/a0pKn UDaFwpf3tm2pvDcK32rbs54bGK8psitLThukF1C/ZY62kEynW0PJOM91xwcHmARO3MzOnX61MwI fb7C0ifH0KqPUsWQgUFb5H/H2M8LsHBmJGAPuoj1V/CLnijeBV7vPOFGRlIMVna/fkHbT6xa+XE oiCWymnUqpMv7AQ== 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_H5=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: 1779313938977154100 Signed-off-by: Marc-Andr=C3=A9 Lureau --- tests/qemu-iotests/tests/copy-before-write | 42 +++++++++++++++-----------= ---- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/tests/qemu-iotests/tests/copy-before-write b/tests/qemu-iotest= s/tests/copy-before-write index 11a9562067b..339bd0de644 100755 --- a/tests/qemu-iotests/tests/copy-before-write +++ b/tests/qemu-iotests/tests/copy-before-write @@ -85,13 +85,13 @@ class TestCbwError(iotests.QMPTestCase): 'file': 'cbw' }) =20 - result =3D self.vm.qmp('human-monitor-command', - command_line=3D'qemu-io cbw "write 0 1M"') - write_res =3D result['return'] + result =3D self.vm.qmp('x-qemu-io', + device=3D'cbw', command=3D'write 0 1M') + write_res =3D result.get('error', {}).get('desc', '') =20 - result =3D self.vm.qmp('human-monitor-command', - command_line=3D'qemu-io access "read 0 1M"') - read_res =3D result['return'] + result =3D self.vm.qmp('x-qemu-io', + device=3D'access', command=3D'read 0 1M') + read_res =3D result.get('error', {}).get('desc', '') =20 self.vm.shutdown() log =3D self.vm.get_log() @@ -148,13 +148,13 @@ class TestCbwError(iotests.QMPTestCase): 'file': 'cbw' }) =20 - result =3D self.vm.qmp('human-monitor-command', - command_line=3D'qemu-io cbw "write 0 1M"') - write_res =3D result['return'] + result =3D self.vm.qmp('x-qemu-io', + device=3D'cbw', command=3D'write 0 1M') + write_res =3D result.get('error', {}).get('desc', '') =20 - result =3D self.vm.qmp('human-monitor-command', - command_line=3D'qemu-io access "read 0 1M"') - read_res =3D result['return'] + result =3D self.vm.qmp('x-qemu-io', + device=3D'access', command=3D'read 0 1M') + read_res =3D result.get('error', {}).get('desc', '') =20 self.vm.shutdown() log =3D self.vm.get_log() @@ -266,18 +266,18 @@ read 1048576/1048576 bytes at offset 0 'file': 'cbw' }) =20 - result =3D self.vm.qmp('human-monitor-command', - command_line=3D'qemu-io cbw "write 0 512K"') - write1_res =3D result['return'] + result =3D self.vm.qmp('x-qemu-io', + device=3D'cbw', command=3D'write 0 512K') + write1_res =3D result.get('error', {}).get('desc', '') =20 # We need second write to trigger throttling - result =3D self.vm.qmp('human-monitor-command', - command_line=3D'qemu-io cbw "write 512K 512K"= ') - write2_res =3D result['return'] + result =3D self.vm.qmp('x-qemu-io', + device=3D'cbw', command=3D'write 512K 512K') + write2_res =3D result.get('error', {}).get('desc', '') =20 - result =3D self.vm.qmp('human-monitor-command', - command_line=3D'qemu-io access "read 0 1M"') - read_res =3D result['return'] + result =3D self.vm.qmp('x-qemu-io', + device=3D'access', command=3D'read 0 1M') + read_res =3D result.get('error', {}).get('desc', '') =20 self.vm.shutdown() log =3D self.vm.get_log() --=20 2.54.0 From nobody Sat May 30 17:44:35 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=1779313944; cv=none; d=zohomail.com; s=zohoarc; b=Xhwcg95LA8EYPSwvrhkaqVRtOlDicH5tMKzDfnpdqcPp9nAPMko3sR1cS+2p2YUrLeLgk5Ot0QYjVvLr37Whbdk61EZAageMlW7dZWgitjJzp591knyuqn478ex5LNah/D0SH1Fwrs0ISyRXLdf6hBwUHycRAciRtpKkrJTzoT8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1779313944; 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=OmN3Rq6q8nx3rcgb/VkzKyF1bVfGMUlyaVZDpJTV74g=; b=LYNpw1ZJefdHaw2eQ8EfkuDkVXlXypp/dHmWa7JaS52h9QJRdtjATU3E3vkVpzwE8fR9AmTl9e7FT5GT4k4TGoQv41zGGYNtN0BdV0FpdFULqGAZ4HoHWsR1DwQ0uG+2fdpobamMXr2ItAmt0tIxEcc7iQP/EEaLWCgf2nLxs70= 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 1779313944044256.0171589044139; Wed, 20 May 2026 14:52:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wPopr-00056F-UR; Wed, 20 May 2026 17:52: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 1wPopp-0004nJ-G5 for qemu-devel@nongnu.org; Wed, 20 May 2026 17:52:13 -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 1wPopn-0004kT-MJ for qemu-devel@nongnu.org; Wed, 20 May 2026 17:52:13 -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-503-eb0gjaDmMhuRrKjLstBw9Q-1; Wed, 20 May 2026 17:52:09 -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 28B951956053 for ; Wed, 20 May 2026 21:52:08 +0000 (UTC) Received: from localhost (unknown [10.44.24.26]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B34AC1800576; Wed, 20 May 2026 21:52:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779313931; 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=OmN3Rq6q8nx3rcgb/VkzKyF1bVfGMUlyaVZDpJTV74g=; b=DeOo9K9v1ZZ7ashtY4Ezrmrz7AGXBY8hqFXpFFF1IbsYN9Vv2ravKlHWrGPU/ewS2H0KqL KkCGQdm+t/PETeCUwLW0utIGzAKXS+qruqLjCa83RO+oQd1cYDzDwyNYEDZbTus33fLS+V KsMZTba09y92ZgCFec35Z2gx2eK7UG4= X-MC-Unique: eb0gjaDmMhuRrKjLstBw9Q-1 X-Mimecast-MFC-AGG-ID: eb0gjaDmMhuRrKjLstBw9Q_1779313928 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Thu, 21 May 2026 01:49:21 +0400 Subject: [PATCH 20/40] tests/qemu-iotests: skip some 172 & 267 that require HMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260521-qemu-no-hmp-v1-20-d104f809e145@redhat.com> References: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> In-Reply-To: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Developer-Signature: v=1; a=openpgp-sha256; l=1641; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=NGxmYJ1VFBEMXJFRX4TSmkJYX96YWqQbv5XRveZIpvY=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqDiyDVRYXgUkPsTKRz1OOzhO6pBsIkEz+sl8RN B8slV420W2JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCag4sgwAKCRDa6OEJdZac 5VI4D/9EszIJE3XaphXpTssq+9BS+EbwC08gVnBPoFhOGm87eupidEVtNSkuJt97AL3j3dePzTa knlMwHh55jYrVgynxlMhQu4qTK13Zx3QHbOlCQeroxPCQMyaXLe4+0I8Hs0P45u4bpbj0AoYgs4 GGej/P4uE94+bxYQZTkfvr7oLu3yaBCAwEkTy4XZAL6FdOtPcpbN946XnrShAZl1E4xJIFcVsS0 eA1YMjeLesuvIYMK+qGGZOQbpiu0SEQlb8ReboDGbZGRqqBIEESkYYxhbJEEhHwv7QcYcAK8SQT uZvvHzdffbvQFjhet0ltMr4EAYfUACdZnQY4WUTJrLkNkPkkapzNyFR+Ubrts9UpZ1BYOxSn7al k45fqNKyhu2RYHIJuDL455CyxGJh0BSdsj6pAhD2NVU3szIYjumJ/yJSi1WqdowsDhLgZn/L9Ls pSYz+SGw0JunT5jTyewVrqnhSaGX2PzMbvohEP7kLkMZgi+eRQAq7CvXK/sPTECG5in2v0Mx44F HZklwoOcHevqA+w6C4apCgj55uGuFeHiNbVpRN6fAOi2zwx7q3GLRGNRvZ0oqoFLSQnYW6eMXc7 mLFGwfv/WAdxoik32Hi8QLlM+JUmcLGMgYKahsy4E9SefViOZGyUsFeETZT3sJxDhK3fBHDsB4b kW3OTtU9uQXuJlA== 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_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: 1779313944440158500 Signed-off-by: Marc-Andr=C3=A9 Lureau --- tests/qemu-iotests/172 | 5 +++++ tests/qemu-iotests/267 | 4 ++++ tests/qemu-iotests/common.rc | 7 +++++++ 3 files changed, 16 insertions(+) diff --git a/tests/qemu-iotests/172 b/tests/qemu-iotests/172 index 4da0e0f2e29..40298c0d7c3 100755 --- a/tests/qemu-iotests/172 +++ b/tests/qemu-iotests/172 @@ -39,6 +39,11 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.rc . ./common.filter =20 +# HMP: info block & info qtree +# rewrite with qom-list/get + query-block is possible, +# but hardly in bash +_require_hmp + _supported_fmt qcow2 _supported_proto file _supported_os Linux diff --git a/tests/qemu-iotests/267 b/tests/qemu-iotests/267 index 2e2afdad9c5..ff8eed0a44b 100755 --- a/tests/qemu-iotests/267 +++ b/tests/qemu-iotests/267 @@ -38,6 +38,10 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 . ./common.rc . ./common.filter =20 +# HMP: savevm/loadvm, info snapshots +# TODO: rewrite with QMP snapshot-save/load +_require_hmp + _supported_fmt qcow2 _supported_proto file _supported_os Linux diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc index 731e4b2b998..4f51a22f8df 100644 --- a/tests/qemu-iotests/common.rc +++ b/tests/qemu-iotests/common.rc @@ -1067,6 +1067,13 @@ _require_secret() rm -f "$TEST_IMG" } =20 +_require_hmp() +{ + if ! echo quit | $QEMU -M none -monitor stdio > /dev/null 2>&1; then + _notrun "HMP monitor not available" + fi +} + _qcow2_dump_header() { if [[ "$1" =3D=3D "--no-filter-compression" ]]; then --=20 2.54.0 From nobody Sat May 30 17:44:35 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=1779313953; cv=none; d=zohomail.com; s=zohoarc; b=h6etAz06ynxQr+ZuV+l3EG3QTWmRj+e5AJD7Kew8934A10x2ny7GU1uNM/pFGs6MzNJ0p7T5C+9H83VZjmeNtq8hk0+L6I+r8ZwfZIxB2q/jKvU84tiLB+4SP4MaRE8irJWX1donQL4zBXAH+HQtBKkz9hbBLJYThSrfY8Yywos= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1779313953; 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=ZP/vlaSsKakh9nwYd/UnexPrmYFT0jPzQuj7CDSztJo=; b=NvMoas+HfM5ju3BoFRrFm4ONXSW+ZxzkPt93qlxz9s6zqinnRCPb2LWpNjXtrx/dLsUpQqUW8XfzWjbo55gYqKXI84kvLl+JITdY1Cyhj6k0aY8GPLASjA/i4Iz2ZKX0MUgtEXKZg6UyBYqOUKVKSsG9EMzK7dtBYXFoRRyX1uA= 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 1779313953380111.12340974685446; Wed, 20 May 2026 14:52:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wPoq0-0005iF-ME; Wed, 20 May 2026 17:52: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 1wPopy-0005Z6-Gt for qemu-devel@nongnu.org; Wed, 20 May 2026 17:52:22 -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 1wPops-0004l8-TO for qemu-devel@nongnu.org; Wed, 20 May 2026 17:52:22 -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-161-0COpcffgPla6CBI2mSuDqQ-1; Wed, 20 May 2026 17:52:14 -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 B83681956096 for ; Wed, 20 May 2026 21:52:13 +0000 (UTC) Received: from localhost (unknown [10.44.24.26]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4BC701956053; Wed, 20 May 2026 21:52:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779313936; 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=ZP/vlaSsKakh9nwYd/UnexPrmYFT0jPzQuj7CDSztJo=; b=BUfYEyGdzHd3soYoJaO/DBydP37DKPnpWrjEotxMkMGBF7DqYWRMoCKuLqRulIgEkz3A3t fSM3xj7zRhe131UmyRMHYWv19MRQCymYuuPi3LCg0hLlv/uWLKCw7qOzEkBvlMDTBv3OSg 1tMLWLpNiFR4SeeEejnsdrTgK+fCR1k= X-MC-Unique: 0COpcffgPla6CBI2mSuDqQ-1 X-Mimecast-MFC-AGG-ID: 0COpcffgPla6CBI2mSuDqQ_1779313933 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Thu, 21 May 2026 01:49:22 +0400 Subject: [PATCH 21/40] 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: <20260521-qemu-no-hmp-v1-21-d104f809e145@redhat.com> References: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> In-Reply-To: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Developer-Signature: v=1; a=openpgp-sha256; l=3233; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=TH0GcsZ6il8ZtxeGOOCNWywd3aQP6tbV17VNL87VHmU=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqDiyDPx4MQ0JYMxfPegsc7obhdCAitiH1IvjrU Txl3C1HVQiJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCag4sgwAKCRDa6OEJdZac 5XjMEACoorUxYQ886N2UeqmM7GhvNNCfR8nZSiIfPCwUPSEC/BqBvzmvikcrNVKTcabU4yvuG8W HKDMdAPRlRTWOcYZ/lTh36N4naCVosrLQW6qvK9J/wrJL9ja1y6zlubSBmqOaIFAUR1ogPkPaQl l6keAPq+fyXbVKQp1edicHKPBUBHO3YCRMSYfzwTmBoU9M7FMaXvx4fR9POkBy8eVapVcTeydOV Ci4sPQOlD6rXPB+2H7QxTSOTYx9Xh4MZA0I//vXzHvZa0xcP+uTZereuGT5dyaSz5OS7WXt/xv2 FrOhJbJ1mLbkDK59p+aWyT7vj/LJzptxm/3eQYeDFZ+Yq64IxySa6JJdESZW1cDbrW2e+RkCcfo JX3n0eMiOeVtTjZJa7jLxu1ZwK+00aE9TXZqlTXn7Cs1kSw7BrahltNivVFTXKZJ8F5mnAFXPxM LLOPap+qx+GjdlQiRDLvfy2su8FknnVD1Rbyc6xm+6/crLP3nx3zviQ3g76FcRtHenZDjRc3ZeV WrYJJAX1Q684QtEYaf0hOrpCU1ist4RUROUsMhL634Hy+9JC1e1uYWf50lgg7vYtktPbFXOW4Gg miesFALG5HCHEV6tslmLfWoNzK5N2PxJtnY+by5GXzDIvAYpr9JzSEotJPOzR5r86/JApJ6aLIj fv4Vg89EG3bPDXQ== 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: 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: 1779313954536158500 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 950ea2baafa..647a8a095a1 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 1fb35ae36bc..1b7a7b6b8b8 100644 --- a/system/qtest.c +++ b/system/qtest.c @@ -31,6 +31,7 @@ #include "qemu/cutils.h" #include "qemu/target-info.h" #include "qom/object_interfaces.h" +#include "qapi-commands-block.h" =20 #define MAX_IRQ 256 =20 @@ -763,6 +764,19 @@ static void qtest_process_command(CharFrontend *chr, g= char **words) new_ns =3D qemu_clock_advance_virtual_time(ns); qtest_sendf(chr, "%s %"PRIi64"\n", new_ns =3D=3D ns ? "OK" : "FAIL", new_ns); + } 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 b1e06ea364e..363fc3028d3 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 Sat May 30 17:44:35 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=1779313967; cv=none; d=zohomail.com; s=zohoarc; b=Pi/QwXB37Ai0jNr054R/592eY/H3Ui/vBbKKQ+wlN4K7hg+32aCIqcnU71ZHbNKoFq6CYDQqd/bMxpY3j6ZUwNUN3kqiS2cL4qmsCUlemQa6Zh4ZmhF+6oBwqiFud7R6V9t9pzxN0b3D6cE0d3VDqCfJahkVKzIxUfSKRoCFofQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1779313967; 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=ZoGkxOT4G8Ooe7cEMewjFUSfWApvV7VdEMSaCnuKk2Ux8Lf35DJv/6FxHWQos675GNkMCEXpuayQoxfwu8EsAtWIU8gWXYhVegZwL3jF2UJHM5L5bTOqUZJ0QnPMa6dZsEVQuy2qwqg76egl7yOKCi+bemK/sMRX+YRnH4a/QTg= 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 1779313966901282.09386638102364; Wed, 20 May 2026 14:52:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wPoq5-0005mx-TA; Wed, 20 May 2026 17:52: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 1wPoq0-0005h8-B6 for qemu-devel@nongnu.org; Wed, 20 May 2026 17:52:24 -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 1wPopy-0004mH-Uc for qemu-devel@nongnu.org; Wed, 20 May 2026 17:52:24 -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-626-y18i8vR-OtyfcANaMzp_tA-1; Wed, 20 May 2026 17:52:20 -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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 12F24195608D for ; Wed, 20 May 2026 21:52:19 +0000 (UTC) Received: from localhost (unknown [10.44.24.26]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id F36B81956053; Wed, 20 May 2026 21:52:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779313942; 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=Q1i2PSG/hvvZFLlbyriIZ+QGfMooalEXWzf0/np/vedRqCN/D89fRol9UXq+ZvYoq8s+5t ktLXVdTz4zPj8V6Ttu4cDQY5Oqw0vLz21FxHuS331QGMS3OXwOc24W89+0QeyP/g5fo4sZ r2UNj95k//cipLbRtoBRCTQEIBuCIRE= X-MC-Unique: y18i8vR-OtyfcANaMzp_tA-1 X-Mimecast-MFC-AGG-ID: y18i8vR-OtyfcANaMzp_tA_1779313940 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Thu, 21 May 2026 01:49:23 +0400 Subject: [PATCH 22/40] 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: <20260521-qemu-no-hmp-v1-22-d104f809e145@redhat.com> References: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> In-Reply-To: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Developer-Signature: v=1; a=openpgp-sha256; l=1102; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=yC8UAV22PJD6GzaLylZtpEyM7zqkarcz0LMdqtxpHvc=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqDiyDKzuvcZrdRRJaZeSA2VeGTfJq3g8iv9dLq DtZ1qkNJw2JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCag4sgwAKCRDa6OEJdZac 5ZpAD/9Dd82QbUfPhvJabgDDgP7Df6dQMqwr0OQBuGYFeO/d5/NbdtODSjW2nJhglXUzfp3NejH WVlATHD7knsfUyxBylsI0XUo1+05q+jBlLB7eI0HEOVrJ6DYL0KmbtzG2SpTPJ0xjSaKy0Ny6wF rbgJUk1TigHY1879COlzI3vRUMC6OVgso7kgsl+m04D0fRIkUy9tw1JaPuPqojSDWFG+Mfg/PA/ 2pbK77QbHvDfXyFOHWQ+iK5TePPr1jEGX+Qk0/NS1MSvt9GB0IYWXBAHQaDvibf/RPXG0s44KZu g1jRajxNtOXkuqVnh93s5G5Rv7lMoTl7fiK/QzAYbfDHRVMT3NH1pkFSduk6DOhRyNjlggOLbJT ljVXFK0wfDe/Q3A2Q+5iGG5/AbCQjnAmC+imhSWJh6IQMW8UGluu8Ud8tnyW7fPYbKcIwDLNble Ub5igA6b5/FURIsYU9QTWZBLX2FnCEU7kJB4zjP6h4ELgOB1Cc7qZuV4/v6tkjKUkq9FEjQvhGE HV5JnoDxaHQhEOk+13h46iYRFmpdM1quHZ14uFpHApxVOzQsieyeS7akIGRA13zuaj62/AgXQDi W49dGsqeD4Hw4WKKJengd/ov/c2Vs7uC5QyhBHEp3VkUvI9fOf6pvJ2+5o/H1mXlxuGMmRKrlKq 2LUSqO2EXLcRcgw== 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_H5=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: 1779313968649158500 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 Sat May 30 17:44:35 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=1779313969; cv=none; d=zohomail.com; s=zohoarc; b=i1xLY3CHfGtN+16LTpoyrLzz+irZjZHf/WcySgdqJNP/TxzC7UamtLwUt9rfpu7VClNCX1K9/eitFf/gVsyQ2+ZsjT8CWE3zfXrC7S2kFPKa5X+IWwEz2B8vptvoLm1aCLkoeqgTkHeZBG6Abvg73SzWqmxDZtoBjDGB5L1CP08= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1779313969; 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=kP6Rz82L/iINJNyCovJ2Rwt+GCjOZZ6C8s0Wy9okgbXIDLw5t5L9Ok6Xp8k4ADTcFA3N9qzCU0/ljq5+Itl8wZystMJkAsswdyY9EOb4Kg7yQIDZYzn8UdiUihDA/PdPLsvkj5B0hWLPIciPA8T0xyXIziOfwJDCJMBdS4cBKoA= 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 1779313969304154.83623254288443; Wed, 20 May 2026 14:52:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wPoq7-0005yx-AM; Wed, 20 May 2026 17:52: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 1wPoq4-0005oC-RE for qemu-devel@nongnu.org; Wed, 20 May 2026 17:52:29 -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 1wPoq3-0004mf-3U for qemu-devel@nongnu.org; Wed, 20 May 2026 17:52:28 -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-418-5sc75D_1NOG4SQK1_BTpEA-1; Wed, 20 May 2026 17:52:25 -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 43E601956095 for ; Wed, 20 May 2026 21:52:24 +0000 (UTC) Received: from localhost (unknown [10.44.24.26]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4A9BC19560A2; Wed, 20 May 2026 21:52:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779313946; 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=AKEnTBdqQVARdIP/LuvXnGNxPzFQBKY3IIqPfnqU584VpQAiLG3WzskNL7x9BBxgldwPS2 O3UOb2Bt0BwMoJ9X9dKdYkWzWVe96VCPJBPBn+6oj2I57BRigKF6bhiw+3jP/o4Kg0oUtl VDQWGtIg4Y6jDYQI9DAWiCrHH5ddJm8= X-MC-Unique: 5sc75D_1NOG4SQK1_BTpEA-1 X-Mimecast-MFC-AGG-ID: 5sc75D_1NOG4SQK1_BTpEA_1779313944 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Thu, 21 May 2026 01:49:24 +0400 Subject: [PATCH 23/40] 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: <20260521-qemu-no-hmp-v1-23-d104f809e145@redhat.com> References: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> In-Reply-To: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= 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/ZANAwAKAdro4Ql1lpzlAcsmYgBqDiyD5Z/RwFa22qwGaZZtFx9fBX2uyrtWwwYRF 5G0g9qk20+JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCag4sgwAKCRDa6OEJdZac 5Qs7EACrOrvbQ5m27cp7QKm0dJ+D9HxgAuqFhlgdpviBQush6GXxRw5TFpvt8gIANYZykRaUUX/ 9rGq3KffUcy75KffWrAo9SccylViO5+udDh5khYyF4m1yockhi7N1GLsfdWmZ/TCIOF8QMnUOgm 2ipO8e6d9fqZep+5hv23uN4rnR7RBwUREVGgrR/Kt1q28b8zY96QzbCTZR3+uTQjR5+SjIw8dSS lmELj9lpGOTQSki2UVh9dGHzqWVuU2vwRVjICFyBLAfHa2dB8/zVFfq+ylswY6ENAVpJ7K2PCMB K9ZcT81KYLYAEyHVfucLtsK0fpc5F3P3F/nWHZM/7u+1LMyX1y75Aa5NifQwOpx3YW2ZlgIlo+R Sf4rlA6+R9ldZNCfTtrCj7/cLtSIISD+msH1y7MAXgwsZl/uCyV6ix+Y1pBquhLEMFWyi840AXE LOzB4D2FIVHqcxjKD2WEpUaKZqT7XGlNOFp0vCOwtzEKGzA1BA0nwz3QFsETJtO4WEPyQY52tEx 07MgbM3TF/W3ELMcv4JouZaB23U5epldB6SwAFC9I9sO2g7hJFJnWPGcDAR5ogOEOleMmG9pQ3D GVD9gHZ6S5PRkTQ1k5wsOIcNt8NUEoeq73joJ8pJF35KAf+0s19/6ZRn7g3uco2BP+7eZH4lb5p xAIGN54OiCFUAfw== 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_H5=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: 1779313971438154100 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 Sat May 30 17:44:35 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=1779313979; cv=none; d=zohomail.com; s=zohoarc; b=AifhdxEQdN1RZXM4HaYDEfWJomnG25IQZhHcNcw8mbO/JjWqyxolWck56G2My+0AdZym5AaU6ZigxbBHID5kbVxH2Bnb9n+5uNZ5PjAcxFXB0BbmD+5OCzD6n7ddwAv4FoTsDxPJyM2ZoSg7HDwb/g6j7D/Dtmmkww+uy98J28w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1779313979; 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=Au1bjnYBq8gJVhKy/ShzJcY2FC4Rk+tKFMcIE9soNJ0=; b=WRhKG3O7rMdlsgZppDuNxvwlvSf2+DSBYcoRT9YQ+1PWaFRAwpAhlXcMAZhbK0RUa8ClKHak5FV1nCTYLCn8+Z7aMVT4TpExO2vGm6yGfqMCbFHpXQPt/lU21fK6N/po/62Qjuk7cyxNvj6y30dKZM00EENDXTJy5AgZi7ur2tw= 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 1779313979695744.1403617453565; Wed, 20 May 2026 14:52:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wPoqO-0006ik-9K; Wed, 20 May 2026 17:52: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 1wPoqA-0006Pb-QF for qemu-devel@nongnu.org; Wed, 20 May 2026 17:52: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 1wPoq9-0004nV-24 for qemu-devel@nongnu.org; Wed, 20 May 2026 17:52:34 -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-543-A7P6BIwXORiiiFswbPkWpw-1; Wed, 20 May 2026 17:52:30 -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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2A5921956050 for ; Wed, 20 May 2026 21:52:30 +0000 (UTC) Received: from localhost (unknown [10.44.24.26]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id BB94B180075C; Wed, 20 May 2026 21:52:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779313952; 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=Au1bjnYBq8gJVhKy/ShzJcY2FC4Rk+tKFMcIE9soNJ0=; b=T6WunwTiMqKqJhWAEn0PEPLHP/+bWUU0lFJBs5H8oYJao6Aj1Lcw3EeHro5zr0XXRzZuWM KNbfMRq3syC7ZkZIQMeT3yp9vjAIbJjZCvq8F1HxcpMAH24DAKjqFAqXNUjMn4eQKDNUM7 fNw+CHW71Hml+oiU0dS4zzy/6Gh2KVk= X-MC-Unique: A7P6BIwXORiiiFswbPkWpw-1 X-Mimecast-MFC-AGG-ID: A7P6BIwXORiiiFswbPkWpw_1779313950 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Thu, 21 May 2026 01:49:25 +0400 Subject: [PATCH 24/40] 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: <20260521-qemu-no-hmp-v1-24-d104f809e145@redhat.com> References: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> In-Reply-To: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Developer-Signature: v=1; a=openpgp-sha256; l=1624; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=y+jBGoxcJrIQ2FfjIUXDStP648LleiEG2EggA9iCaEo=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqDiyDhh/NFkfk+etAqOpIMlKIyu0VqbpLDlrrT GINiF2nFEiJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCag4sgwAKCRDa6OEJdZac 5UlMD/41fiNbstgLNEYkQTxWSAtcLsxrHMj/u7Fx32wbzvWcfVPlKsil1B0BEFuY/ZeRml0t/62 E66DPodgaWVueSHQmv8ctnRFNwt50F8cQ8BPdgJ1TGge417PW+JuIxppzV1fVVi3NURlPQk+F6W 8PwKkVD/z6ud+nEf7eTcBjmiZNv1lTkrKd20CKgBSiDyFGGTN5VjcjH6tke/hkrj/JXRuwN8jNZ KRNNp1BYj9lMyavo5eeGkSRVa54ymu0uy35FeZUedmXUb5Biyz5KTC48sp+/Ulm1OGRDqe5yswF OtENL/CfiFEuaMiewasERhb3S/M5EzS8jthwkGeqYFUgCDk+shM1BSAs5sqUvwiYLIcNx7wdZ/4 tpcXCUSHeK91tWhvpOyZl9wUlq0Oz62Jfnq0a3G1EqbFPhWLGKXLMQE7RpWjOKcJmvpyXl/xfmz ghJsDNOqYOLuJka/T0Tpq0InKAVMskb4P4eA3CufW5l9C33+lKyVoIChTvs84dW+hXlkvwM4xY9 0LkuncD5rEfA+Svjuv+eoXHpiF0Cu+5cvL4wg+yLeGHlkx0/x+r/qGTNIv9mBN9bVDLvxIUP/V2 Hb+HrYQrX6JZi/IbOi/egyuTOiwXvOsBtbF06/IcyYgZJXR4H0oRnc+qU7gsOSsX/MYeZIw6Qzr 4snWDrLI/dK60DQ== 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: 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: 1779313981640154100 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. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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 Sat May 30 17:44:35 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=1779313997; cv=none; d=zohomail.com; s=zohoarc; b=CUG1Q73c3PV1XW411E6uxWQiJxt9Qd2fl5S+ZiDXn3xyMjc2sk801PwhtfJqCub2bannjxehSLR4HwpZKUtwiU181ohu6owx4IH4bMrleCNY5ZsogayMAV6FRR1iaCIPtbQuF7wPE2vDm4m20iWDKMEhVs4qxPRx3AKdYwe5VSE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1779313997; 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=Ny5pfaZzFGmnGeeLq+0zzagTdWAYo/ZKZR1hucXAr/o=; b=KQWycfTgw4+SCYn6ZtnYZARdJKCkJm05iTdFmCpXb+K8OQT/uxx4xIJmEfFr0x5tjGLn/fseLB8gk8fNHegeiCsHeD9cs3vEAp8B4bpm/3G8dAP96GWKBFH7TLl9Sbe/GAJYBr8yLlHHp1XESH3c/nJbKVxS3MjzDzgpD1YLCDM= 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 1779313997940161.2698063008479; Wed, 20 May 2026 14:53:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wPoqa-0007LN-NZ; Wed, 20 May 2026 17:53: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 1wPoqK-0006c4-Dn for qemu-devel@nongnu.org; Wed, 20 May 2026 17:52: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 1wPoqG-0004rb-4R for qemu-devel@nongnu.org; Wed, 20 May 2026 17:52: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-224-oncClGRANt69-Zel-2WzbQ-1; Wed, 20 May 2026 17:52:37 -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 E78BC1956056 for ; Wed, 20 May 2026 21:52:35 +0000 (UTC) Received: from localhost (unknown [10.44.24.26]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 596051800576; Wed, 20 May 2026 21:52:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779313959; 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=Ny5pfaZzFGmnGeeLq+0zzagTdWAYo/ZKZR1hucXAr/o=; b=KGTEECm9fbrZpdi43/WzYt3fwS/vo+chXEY/Eb5ZVHm6UP+03HMWBmK5rB53HRVU/zJRli WTIrkGH656GCLvpoaonUH3aUFi8XUWlpYSMiQ6ZQxHkGBytiFTUHkt4GGAfc7xEGRQEQpA zKSnqnVIAgdiO5875cddfkyb0ipnEC4= X-MC-Unique: oncClGRANt69-Zel-2WzbQ-1 X-Mimecast-MFC-AGG-ID: oncClGRANt69-Zel-2WzbQ_1779313956 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Thu, 21 May 2026 01:49:26 +0400 Subject: [PATCH 25/40] 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: <20260521-qemu-no-hmp-v1-25-d104f809e145@redhat.com> References: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> In-Reply-To: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Developer-Signature: v=1; a=openpgp-sha256; l=13500; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=mEYVeOV2ZIGJyvEI9qKJs0uDZEiQSgRpNCpRgeV0SYg=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqDiyDZ9dFwU7PunqOG9JNerHTuFYG07M1DSFRV P8HOZzmcAyJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCag4sgwAKCRDa6OEJdZac 5UpQD/4tPB7DHYGVp567/uAXS15rfJCwTZ8zl44urI0FbtK/yKpl7VLpDAOaEHCdBu/ZOTZiAGq a97IyTqd/ANNClY8ktaQAT1E/b0G7nm8Ka4AAPPIJnSrK2KAyS7+xhx5rfPFgxgJ3edUwOWd0MF EXrnOK9qg+EoO34fCRAdo737L08kMNt6DXLx2e2JlU+9sbI4XEjOLssao+2eS3muNnA2uGpIYgb /b398oGmhqbwgeOj4LzvfT/H1TGIlcqvfBm+boSx/K0O3K+/Q6vod29TiBDA7AdrMelt1EwoLCz C527cCxZ2Intp2+h33C+55To/gTMOF2gbbkUtq4mHIileeahSgBw2y/mIU4C/zaC8qeH2mSV+im 7IBJ3+DP0k/+jqCYFIMESuCQLxakr45CvkwDgNINwzwEMTTMmdrY1RWouLj9h65qKDDyoIZxZ5p gAIJn5Lq8t7MKRdZhV0X70J5JGRoqtAIT+Qs50U67kM6iEX9vqTxl6kpVkuQ6eaJdTg2kK2ZId3 p6MEpV56NcBePV0mjSNjsLkNZpUPyDd9mKXGteraxFcij9KJfzZPtRMEJ2gkJY/gbM1QmrUbAJ0 JKqjENMMbenFBknMM+lHPWy9kVvNFYVLnPLEfEmM/1xGZfedHxhq5KYUe4DXXWf1GPhzRjKLjmj QYNk8Q3kIaa5SqA== 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_H5=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: 1779313999051158500 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 dd56215fd15..c329da9cec8 100644 --- a/qapi/net.json +++ b/qapi/net.json @@ -1235,3 +1235,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 Sat May 30 17:44:35 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=1779314072; cv=none; d=zohomail.com; s=zohoarc; b=dJOPuPPFrxR3iNPxvR8HkxP0l5XS4Aa73++Ag/u6D6VzctxfwAHga2Mxatz2Y++AZhvMVvKjlKa0wtrLVBRnejpWDl2L7nMMnaNMhdkal3EkWiCjeOQlKMYNiPDa8L/JymaD/uVC1vf4H9IdSOfoVvEaLsGcgE9vMhPsPDRa+2k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1779314072; 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=ku/6PXtOTkTXK/QPLuIK7W+1XejjiJtCN3z2+4aAP2Kj/PoRE310X5tuEKK9Ihd0Gh7sXLl/I/6I2WVyPOnbC9if62701cBejDEzr0jgB8P1jR6ufJ+O+FpNZWduCh7iCL7giur6tUPen00tYTuMzCvroHa0f1UMofscwMQvgmI= 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 1779314072985471.5819480113064; Wed, 20 May 2026 14:54:32 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wPor3-0007hd-SJ; Wed, 20 May 2026 17:53: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 1wPoqP-0006tb-DY for qemu-devel@nongnu.org; Wed, 20 May 2026 17:52:53 -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 1wPoqL-0004tZ-8f for qemu-devel@nongnu.org; Wed, 20 May 2026 17:52:48 -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-43-y7fh2K0VNqSIhQnZJBqE-w-1; Wed, 20 May 2026 17:52:42 -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 F30611956096 for ; Wed, 20 May 2026 21:52:41 +0000 (UTC) Received: from localhost (unknown [10.44.24.26]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4A45B1956053; Wed, 20 May 2026 21:52:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779313964; 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=XV81I6J+1LGL9IfNaHiowyk4rRs8whedWq3LnzZQ8fQTnUva8k/KiRMrtGCrQno1Gf6OQf X/0WtaoYhnuzuZfvix91oOJbEsLAeMD4EfAJ4yvITn4uezup0c7QQ3t5B93OjZyDi/MTZW H0hwGRvz2+5Ay0N7sKnxzTpPyikh3Pg= X-MC-Unique: y7fh2K0VNqSIhQnZJBqE-w-1 X-Mimecast-MFC-AGG-ID: y7fh2K0VNqSIhQnZJBqE-w_1779313962 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Thu, 21 May 2026 01:49:27 +0400 Subject: [PATCH 26/40] 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: <20260521-qemu-no-hmp-v1-26-d104f809e145@redhat.com> References: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> In-Reply-To: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= 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/ZANAwAKAdro4Ql1lpzlAcsmYgBqDiyDjyqoFsdI+cfzkI0zVGUI06UV9pRtwj46z /eft9c9tHKJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCag4sgwAKCRDa6OEJdZac 5XV5EAC6sVeLJipt6BnbvSYWAqDdxhoOmw3S/l8rR22BiRjEvjiW2eaKUrI2fk8LP5fPFo09OLE 83rLb+aHJknK/kbDrmzWUMn3jnRiPw7nSkdyEbrdy83KbIiKSHyIRjDoeR45WnmTfnId0AQ6fbF HY3T14Fjo98iQCNn1Gj6ImjsKzWAg55e68IwIZ5FrHmApz/FZByB1mEoaELpDWhB5rx2MFAbmLU 8RVjxjYpi7693FmNegFIoirotBTN2m9tHILStG/qZejsMUjYwoOBF15OC35hP5mmbv+DQ8uQN95 fAfMbqwwdzTyiNU7DQeZdbxXnzrkT+x17zMlJLUXY40tyXtYGf6Pmry0eexVFdjXqahV2jZxnyp H+ZrxQ+0skHEcRMzTh/tOcNUOIgCz0y2wL3bLMyNwLJ+EFR2Qc9BM4l/sSsA/kNFIzFqoCoQfyo 59hfzUgmM/TH8dP8bigdP36ZQe588vy/ipSeK15ilDEqYaw3cOasRqVppKUxgzhN2nIPVkpCmdz AB62PVvUH4KKzkK6c3qMAvLLIdpVp5F9ISB9A0NW9Ws2MioKrCVvl0O5t+M/qG9eGJq1mEQ5JY0 wpPalR0paq+cclI+pMw9NBUaXcd23wgOU56NaOJqSQE5NGvbmOCcPrU6FoyYEsh9cNgmvRuDXA7 gTP3c4QhwOGe2GQ== 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: 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: 1779314073616158501 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 Sat May 30 17:44:35 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=1779314001; cv=none; d=zohomail.com; s=zohoarc; b=Xa/8NuVpl6aomBNfEuUf1ahRZU3NcGkhxQ7zr9FNfF31N4U4yzm59kcCDQj7nHvfy4vMmcDYsEvjKhNR038UQ9/hnGo9X7aC5QEBy7KExjgMFSiCF+w7Tg53kXTxxkBmeUE48AOcrFv2E3++BVb1zF75BHUY0B0NlkqLbK/8WYM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1779314001; 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=UXCdTl3XnS/yX4EcgpbdGYdHJ0t5E9Vy5BN4DTXZ7Pk=; b=dGEDRJiSRqXsJN5fskZdBhqO+CboWpAexHF5vMMfekX0TDGWYFEY/4twmoqO+XvWK59jleUGvQOQqHFezBDOyP3peldvxRGNwVJJm+DsCe8QdVVzOCjg07gIwONUdr5FGG+sS331UnuijtdAIsn0Ymx3X6Nh7wcl4nxiJBpXtfA= 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 1779314001907176.382425114831; Wed, 20 May 2026 14:53:21 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wPoqk-0007SL-VM; Wed, 20 May 2026 17:53:15 -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 1wPoqR-0006xC-Rl for qemu-devel@nongnu.org; Wed, 20 May 2026 17:52:53 -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 1wPoqQ-0004ua-2P for qemu-devel@nongnu.org; Wed, 20 May 2026 17:52:51 -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-178-CNevShqjPt-N63Pe09jgFg-1; Wed, 20 May 2026 17:52:47 -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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 30BBE195609D for ; Wed, 20 May 2026 21:52:47 +0000 (UTC) Received: from localhost (unknown [10.44.24.26]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2EB881800465; Wed, 20 May 2026 21:52:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779313969; 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=UXCdTl3XnS/yX4EcgpbdGYdHJ0t5E9Vy5BN4DTXZ7Pk=; b=dEH3rdYKj9Ycwrt+0XnWQKkauBL6IhqWmfrVAPXZ6SgLWHuxThdiRT+oZ7YUDlLSUCDvkm FbY2FSI0N/tRK7RkO9I8x51km1g6MKFgm3qHfxrMwhcoLKPbXKMr7JW/hzM/Yp9VGsc+Hc eIlWK4utKqMqNM2dH0gnWPGdmASBiGw= X-MC-Unique: CNevShqjPt-N63Pe09jgFg-1 X-Mimecast-MFC-AGG-ID: CNevShqjPt-N63Pe09jgFg_1779313967 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Thu, 21 May 2026 01:49:28 +0400 Subject: [PATCH 27/40] 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: <20260521-qemu-no-hmp-v1-27-d104f809e145@redhat.com> References: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> In-Reply-To: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Developer-Signature: v=1; a=openpgp-sha256; l=2121; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=28lV59NbZNzsPX8tOyozxy6UDf8rQI/n99c7klYsbi4=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqDiyDr8d7rBXS1WQWqBdrf08GX94PSCjYTDTAL wzQe92E3y2JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCag4sgwAKCRDa6OEJdZac 5R61D/9fnlBbTgZeetXskKohEb1hXKQ7uQvbqq5tgj5CCnX48VdwYy7C5ot+P7Z/iO0yLFGt2rM c3Ug+ql8w9CK3dgx7mN/dOuUHMIfoE9nww6d7uSdEGTwb5oM9FET9t7KrZXtTG2/wzabmKZ5p// kBaQ+K5+TIxY1QQnC5MoFivPuv8yjFP/MXFrKH9FwyNTs+M5ElhI4p0yjRijL1GcHGEKORiajS4 aKPB+zQ4w2ztleWAd/vEjkeEwONM0SwpE8lXMgFFP8idXlEFql+nQVbcKjrEO7xmmb0SDaJNYTw iOHs5tJ4oEFv4nuCvz/qSfo5fyPgcrUOnDm3lHKeEn4L602Eu7vcotI/izErEA5T5UNeB5oFQZa zOKaw83FEiDI7JpXrrwV0AaR/k+EKNVdhHFIn/apcCYgQF7ZqGhY1otWBXSXR66uFqDoM0lb2Aa cAiWpWrNjZT1aEdIuLc7WD4m4B0HrjRfsFRwDj7ozRLkw27+MTqdWmekYhB5DnQYDne/plueXt4 j3N5W+crrkdej7htH4XRLNY9FZPXWVxC7uLViDwd3yGOWEj99Oi262Y0sxCLqOvUKau7iD06oP9 3A4qPfIOmJKgctbSgS6VR6fjkgbpbU6Imk3nyAzxlCJrzwGC/ZUr3ljpEhDudgaVXvGOXLLVz7q FcApppfKaO/FnZw== 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_H5=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: 1779314002977158503 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). Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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 Sat May 30 17:44:35 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=1779314033; cv=none; d=zohomail.com; s=zohoarc; b=C94e24h5WRrjwiPW8K5hVE3fnCWQPN8n6Y2NR9u/vi4stqCR607h1yuYudbHD2ylDeKvAWs1FIR5VAcCHA6QNfiP8qguC53SGVNkUlCuTX37rVr13pA/Y26RKYpDcv449lWF3+eVoqhC47hrtxdHVYTKJuNSu9dpMpZH1Lp/6Z4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1779314033; 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=hl5RCCZCbEQIgVmDDG4lW9u52z1f1j0xe4KSKFb982CG2Y7lO9vSHrLbdeUzMxi7JFmZ+1U6f06VyOxBH+HY++WgWLgaLljLT9h10RIA5gnz617VL5m6DaXawFRCslvsyvdKxD9QGrIREy2fu8ZOulgjut/L+0U1ESfbpL1FSnQ= 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 1779314033161444.0347590038506; Wed, 20 May 2026 14:53:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wPor9-0007qQ-Ke; Wed, 20 May 2026 17:53: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 1wPoqX-0007AL-5j for qemu-devel@nongnu.org; Wed, 20 May 2026 17:52:58 -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 1wPoqV-0004wF-Ma for qemu-devel@nongnu.org; Wed, 20 May 2026 17:52: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-380-TtB8k5ktMHy0WgzZBEL0yw-1; Wed, 20 May 2026 17:52:53 -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 D3A711956055 for ; Wed, 20 May 2026 21:52:52 +0000 (UTC) Received: from localhost (unknown [10.44.24.26]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 61BD630001A2; Wed, 20 May 2026 21:52:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779313975; 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=OXgDV2wwHEJKoamCz4fmdTMxPj0Dlc5LHogpnaXooG02NPM98oSgf+lyaUo7KGVLi1R+Ui cZPliWZpqBc/LIeBe4Rs8PcMMTXONzbO8EkjcqcsdakTr0nueTZEoQFkgOfWnDl8kBCd8W wFKjKfYUgM01cNMr0XZlVA9Gf6CFBnc= X-MC-Unique: TtB8k5ktMHy0WgzZBEL0yw-1 X-Mimecast-MFC-AGG-ID: TtB8k5ktMHy0WgzZBEL0yw_1779313972 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Thu, 21 May 2026 01:49:29 +0400 Subject: [PATCH 28/40] 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: <20260521-qemu-no-hmp-v1-28-d104f809e145@redhat.com> References: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> In-Reply-To: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= 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/ZANAwAKAdro4Ql1lpzlAcsmYgBqDiyDffKUlgwIFQRXpssqW63I0KvFWzi4sR9Sk mforiHtWv6JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCag4sgwAKCRDa6OEJdZac 5XHkD/9EBmxmFN1dDQaSfLPewd2spU06FICjpxRojloZweVR5RMY8SIbvOn5678hJKxRfzl92qY FhJzHF1KgA8ummrW0c1SmQlvlRmZy7W1I0Q4Blg83jNCh4zwx6ebLcwGnJpC24cNFdRPpXNkNBy So7YiQLTtGdx0WTboEXqNFtSTGLvKB3mk+UGkeY8F7Shr9ciqr5Ps5fmHrGSvK1pKE5txJUUu+F N01kOPO6o0QpS10d6bWvr0m2Gh/yUnFVSAv8dQbSEZ2YOqHGxxuUsD3SGjp1u4Z6xm+oKLalrY3 UjF3bF9QyRQW8pNRfy7KkJJ6zgHgynQ6jcZ5rT6GO6utOv0EJPXi5EeGquKMDpLDwWtsmmKP+uH bC+0ZYBTCLKP7KCLzC6loj2EpgY4elIXw1EYoHKmHfSeH+kmna+n3mLUXUWmJrXU7LPe8dbOhf5 UslpOzZuQlcUVv0yDWDIS86xpF5HUxXnqyduWA8iJpx9kr6Df+v9OveLcX6Bm4bYYZ+2xbszkYl A8kQMqo2MMkv75Ym/6Ei8X7yC6mcPuVTI9rR52dJ87/9VW3R++MKn2/JDJbtlpKaZIk+QBWs3LA DoQ/TaKo8smBMd7PQj0MrK6yVW3DiabETyLLWBda/adTzDOCZ1IACp8YRuEZQYad+UPyRZaKpe1 CYeC3gX35ikbjXA== 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_H5=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: 1779314038466154100 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 Sat May 30 17:44:35 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=1779314047; cv=none; d=zohomail.com; s=zohoarc; b=D0IpPkybe/gNFe1NTA/Q5rabv2Gv6mAk+ct0JkrA5l4qbtoYRYrjGpBFe0MOLZbkQrAwsIg6VXwmA8T2+yREgphJLwEpwwdhmXI5VGJJSf0PdRju3mO9cyXXDGW5w3hwXKk3xMuSNjELu6CBBoQDOL2BEe9gQ0ausEB8hln+GRY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1779314047; 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=D9vkZcvw2HkP52fCwSequJ6rNHWVcsqOc79tJBc0sZ4=; b=aJ35dHYZY8wXBFQ9PWkAA3Io7c6O9ljAs7YITU2I3otBtD8REwzAvAxbKrxpcybhsc2LjoiuWF0aF9OldkXeY0BnyQXo1L7XAabMsv37ZbVH/eYcPYWvsvTDybjCQvBtjwoGMPmLYKA+00L6k8ndqPjXDzY6tezt4MbBTnKH1Tc= 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 1779314047308674.2444538988559; Wed, 20 May 2026 14:54:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wPorK-00086Z-S1; Wed, 20 May 2026 17:53: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 1wPoqe-0007Vy-W5 for qemu-devel@nongnu.org; Wed, 20 May 2026 17:53:08 -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 1wPoqb-0004xQ-C3 for qemu-devel@nongnu.org; Wed, 20 May 2026 17:53: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-116-XxJ9vu7eMau2X4wxhyJmhw-1; Wed, 20 May 2026 17:52:59 -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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5FA8D195608F for ; Wed, 20 May 2026 21:52:58 +0000 (UTC) Received: from localhost (unknown [10.44.24.26]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5AFA730001A2; Wed, 20 May 2026 21:52:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779313980; 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=D9vkZcvw2HkP52fCwSequJ6rNHWVcsqOc79tJBc0sZ4=; b=CuDtGvup5kHO3NNUbUAb60En/UYumxZb6JT2YJdy5NZ4xwEzLge46BLZTECLaAJLlnLCzU cENZAs0Zyds6wzPHoHxANqFA83HvHCr3kLLj7sfFzJphfGdywjnuc1OJgt8ewe69TJ25PG fw32466S5a6A8XI5TE2Hk/42VN6A3aU= X-MC-Unique: XxJ9vu7eMau2X4wxhyJmhw-1 X-Mimecast-MFC-AGG-ID: XxJ9vu7eMau2X4wxhyJmhw_1779313978 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Thu, 21 May 2026 01:49:30 +0400 Subject: [PATCH 29/40] build-sys: add 'hmp' option MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260521-qemu-no-hmp-v1-29-d104f809e145@redhat.com> References: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> In-Reply-To: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Developer-Signature: v=1; a=openpgp-sha256; l=3029; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=SSpy2B0WqY0f8zQ5IsoJK0vva9F2lFMbocFOR8o9an8=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqDiyEs3btwJSX+8j0SguH/8shOlv7b3saJL6PF xcEs2YSzc6JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCag4shAAKCRDa6OEJdZac 5RHDD/9Cm/fREOzvfeDgz7xtR/MGXE+OznqhfFZhk79LwpF6GGuHJpltLFCK+i35TMieJWKrg/D bmnyX3MCLAyoQNH8k3JqjNRdVYbRx7nrcLdwS6ZHMwUfQfKTevbHI8uKr099CxnHfaZwlWKTYGe VXCCIvD5sr0kWx+O9DBpWxTLVlZ0PDQ4/Aqa1ta4oNC+7t0RVTvsFSkXLMwe9Nk5zWpy5pcRTYX bYgWd24SL+zR3ZPN215SSicU9fN/8diKATMxBauF5bDehd8M2AFhJM7d9RTNLS1DJS7uUlf+1/j v5FCUnJsWKH/vi0sZ3sgAltzSwGviewlYrfMWbZLFEZnHL4lZ2V24NKaClq9yLDuXkHZfhpkP1A 6wQGXnixN/WKI+CYfffusx7hsU85CFnVZGioJN9BYHAq4o818sizJqdZySWhBXN5XS/GItBkiOp PxxjrryX0OjLziE9UvRXVBkiE+6xTPw5/K42g/QGSUq8SmQub/oM+Nxk4tVdXhVZIWA7y0Dcb7x 8TvefyCxoKI0L+5j+3vicghYvZ4MVK1/TDcp7AWxqpE1O/SKNU+Zf8mZ7Q0QgCRZiD60j58kzGB F4rqPsAuA7jSBJK9Jc5yPzbGdPj1/IHKH73Y5Cyp40hTKh/HCgt2+y/FWJS3a13oVEzrst2pE/q 2phCLDx2zG/v5Fg== 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_H5=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: 1779314049386158500 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 70613bf4afc..e83cfe56cf3 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() @@ -2256,6 +2259,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 Sat May 30 17:44:35 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=1779314175; cv=none; d=zohomail.com; s=zohoarc; b=SqNDTVPq7FlsleX6YRu7pvnGcv/HBobYh6QFInytjqD0S45TnA1iwU1THP/QCz8QaT6f2h+23v+FHEQUWD5Xk+92dbmE5aJD4mXvW8B096U+2dGngPLEOrQBTe4vbrQmDWiCO4hiirqo2hgn2cMVTjr8orE8pO2WciO14jI06bk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1779314175; 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=byJCV9Cuo6//JubWOsgu/XvjiZcml+Y3+x9eERpD6WtIgrXMNtQOhresfYbHybJ1nMsblYYz57K7fckNH8pLJswkKWPGhKoVbw93xX/CAba2JmwTycGJSrxgRVHA82Rhw0FUf8Q8rIQP/Tlihq9L407H88JczDDHNli56GHxRcU= 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 1779314175124939.785449474952; Wed, 20 May 2026 14:56:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wPorb-0000cF-O0; Wed, 20 May 2026 17:54:03 -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 1wPoqi-0007bj-PC for qemu-devel@nongnu.org; Wed, 20 May 2026 17:53: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 1wPoqg-0004y7-HY for qemu-devel@nongnu.org; Wed, 20 May 2026 17:53:08 -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-_GE0mzQRM9qjbj1qj3dzrQ-1; Wed, 20 May 2026 17:53:04 -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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9DB41195608E for ; Wed, 20 May 2026 21:53:03 +0000 (UTC) Received: from localhost (unknown [10.44.24.26]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 804811800465; Wed, 20 May 2026 21:53:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779313986; 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=LXBtVAGG/SVlei4QH0/Q8VRRoqkFD/RqI6ZBHWzuNdHK3RBXHq28CTMORC1GxxU0celbdW i6Wl9Zh2lPWimI3dcqpp2k7+zq4ePrFUI4NlD2Cwf8OJjHTjGElz9pB3vvt6EFeZyG4Pwr fSCwf+QPpb1zru1UEEkWH7XOrE+VFQs= X-MC-Unique: _GE0mzQRM9qjbj1qj3dzrQ-1 X-Mimecast-MFC-AGG-ID: _GE0mzQRM9qjbj1qj3dzrQ_1779313983 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Thu, 21 May 2026 01:49:31 +0400 Subject: [PATCH 30/40] 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: <20260521-qemu-no-hmp-v1-30-d104f809e145@redhat.com> References: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> In-Reply-To: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Developer-Signature: v=1; a=openpgp-sha256; l=7498; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=/JxQv6h3FUqjsdGwFy0SeHfp3oZCxzfgsDm04W8itkE=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqDiyEvyi6wX6t3QC8ySVOtpVgcIoTm1LgDIlGL qtspRZhoaOJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCag4shAAKCRDa6OEJdZac 5YfwD/9v2JZt6StUTHSbHBV0GgHoE8D1/ByKNJQPEIqd1XRHtYFACluZj69wzcHyFtrR75coRRR EoOgvuT4rox4EpQjIrgY7iZvj7+vNb0heTwABfQtw99HbkfNpPdzDNf/FlbMKZKzso/CP3jtemr XB5OmM2AHwNdJwd5S0X/2ysj2jCjCHMaCM5G7m1epThw05pdSsGUckANWLtipB/5dWtvIgh2+vl JrE2pkRADY0IkUm+IUQOs+YW1jQ7dr41D0z1Fe7EgaUS7VEtIg9aRc0UyTNIFFSLOwRTFt0BLd3 hO+6K72LOJHc+LpNny0Jy5YYCZJ/PbEkamFCnJoh+Mdac90aIxnQXgagiCUUSbypHvJ5oUUU4xj YIoL46LLBbXnprRQrEEWdWzXYzahGEzOZw7V6VHf/y+okIzs3w0pnHFC27yosh4D/up4vpWo3q5 RMeLo5d3nA2Bb+WRPkRWT+Q5GytFpUDQxnzWt45MdND8Od2nKfLGqTk5W0+TfLhDphOvTN3FvsV BCFocXMjor2Pzp86cNTTQ3vwN1EuG1KTPMoTYsKaV9esFPasdh7mqBohQMvVZ0niqNxnH7SY7so OH+/QK7bGx7TuLrdhi811LG6BnnN9kgvACrvDqlvEYUe1aQYCdywV8TxhtN5Taa3uHgLRGZKrCp I422op5L88vJcYQ== 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_H5=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: 1779314176200158500 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 Sat May 30 17:44:35 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=1779314238; cv=none; d=zohomail.com; s=zohoarc; b=kcr1kwBRc7NUoXyFcOANUg4AtCG4pqLpTjImrfSYHlkfPoJ4rEjZbAwwnOWBg4ST9/XmDwmMxwRzkvHk7c1OWwxN1Nqu8iGMttD/c4D2ejnNlSwsM7fsx4PBTeZonnrCrF6rYRAsQUEweLVRrTnAaLDl2GWZXSORs6P1FJWQXWc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1779314238; 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=3KUG4432JhTrb0PuW80xNY0zS5CkpLg7NX6P+/NnTq4=; b=d/ZO+YOBT9qO6rXQ9ezhIp0468ssj1B/JMxd2gfG7xo/zS2SjXxuvsQ2ssaFYb5ZU6mCZlar1AAJ8Rvv3y2VG0Ugkh0C71Tt0mCzTfLGvHJugE9JNhE2hRaPjO9exxa25Ddo5xfyOfJ76kJZALyq2yJ59OTgOxrXdT8rLt10zAs= 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 1779314238954198.07228866091748; Wed, 20 May 2026 14:57:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wPorR-0008PE-LD; Wed, 20 May 2026 17:53:54 -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 1wPoqp-0007dh-Mp for qemu-devel@nongnu.org; Wed, 20 May 2026 17:53:17 -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 1wPoqo-0004z2-4D for qemu-devel@nongnu.org; Wed, 20 May 2026 17:53:15 -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-474-7T6uL6ODNJKjpqYOrbDPPw-1; Wed, 20 May 2026 17:53: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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4B4F7195608D for ; Wed, 20 May 2026 21:53:09 +0000 (UTC) Received: from localhost (unknown [10.44.24.26]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D828D18004A3; Wed, 20 May 2026 21:53:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779313992; 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=3KUG4432JhTrb0PuW80xNY0zS5CkpLg7NX6P+/NnTq4=; b=Q97PWMdX6Zz0DRLVwCkhYWEDBk9YkHYLc0efvT4nquMVcKAohRX3wZc+3Zo5Hoo8k2KmUN aoLXSokbNq72q6ScsMXfsqroydSQXFcFn9ruUephaVypA0LR79E+1XMtlExMXGg4WqWyqX dnyySyXqNaNkp8CD5VMBi/4GZ4U91LI= X-MC-Unique: 7T6uL6ODNJKjpqYOrbDPPw-1 X-Mimecast-MFC-AGG-ID: 7T6uL6ODNJKjpqYOrbDPPw_1779313989 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Thu, 21 May 2026 01:49:32 +0400 Subject: [PATCH 31/40] tests/qtest/drive_del-test: guard HMP-dependent tests with CONFIG_HMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260521-qemu-no-hmp-v1-31-d104f809e145@redhat.com> References: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> In-Reply-To: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Developer-Signature: v=1; a=openpgp-sha256; l=3445; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=9n36PJYlKJGC91zsIXys/gJy72dL3cNyBLFLxzQVzSE=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqDiyErCFQq0lbmS9OWR4wxhSc3KeytpqPvuEpX BIW/12Qx7mJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCag4shAAKCRDa6OEJdZac 5SuMEACXrOcPyWoIgD09m98sgj9mUIwLZJB/50k/PuzCITKxb8FKY+Nkn0iL7p2R8yBJpGrWI20 /wW9zDiloDFLYRFAvAppM/jizbAFhP7xeh3IeniyRQ3cmoUN7sId94rZOUUjL7e43P5OxalZE2U K6j2bFmt3/a+O0ycv8Lr7E3AM4ETjfuynL1URp6jzTqaOeMAlWEFST2z0f2Q/TnjxcBI9voCLzp uEOT5yM/7HvZCsEbO+cc32u57Z7lW0Pcb05jPiX824VBNhaAdhdXREVgbyIpOpkGkOYyMxfbddJ ts+Q4hMNEVAYYTuanlkWKbf4KXSkexn15ptuAvUXRGdA/x/PozKqCqI8eme5CCqDAT0pDptC5D4 pwKg3pqGuv35Ybi9QLfI7p9zW0D6pKWWqGTdk9RxeCu5lK44fr+EdtmKfbBYFZnfVubhlDwtsI8 sSkxxvXSvK7kRIrRDWlE7VES6TAACUnTugVvUhX0ggFJX/Xq9uWaoNjLalLysjd3sENYjCQbbRs lxpN5+AkTKQoaoF+ZF+UtJdIs/cRJL/2v0bkBU71kOedtX4nIyXXNKmbK7o2guuphU2+F5ELZPA C0QyBUEku49icpViNUehD2bYXk5alzXF6wobESv4+9vZqMWbyL97Hu5KEjD1z+uUj06ZpBF3QsV VWNSr9HaMcUrO5A== 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_H5=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: 1779314240493158500 These tests rely on HMP commands (drive_add, drive_del) that have no direct QMP equivalent. QMP's blockdev-del operates on node-names and rejects deletion of in-use nodes, whereas HMP's drive_del operates on BlockBackend IDs and can detach a drive from a device. The equivalent QMP-based tests already exist (test_blockdev_add_device_add_and_del*). Signed-off-by: Marc-Andr=C3=A9 Lureau --- tests/qtest/drive_del-test.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/qtest/drive_del-test.c b/tests/qtest/drive_del-test.c index 30d9451ddda..d78816d44a7 100644 --- a/tests/qtest/drive_del-test.c +++ b/tests/qtest/drive_del-test.c @@ -87,6 +87,7 @@ static void blockdev_add_with_media(QTestState *qts) g_assert(has_blockdev(qts)); } =20 +#ifdef CONFIG_HMP static void drive_add(QTestState *qts) { char *resp =3D qtest_hmp(qts, "drive_add 0 if=3Dnone,id=3Ddrive0"); @@ -117,6 +118,7 @@ static void drive_del(QTestState *qts) g_assert(!has_drive(qts)); g_free(resp); } +#endif =20 /* * qvirtio_get_dev_type: @@ -163,6 +165,7 @@ static void device_del(QTestState *qts, bool and_reset) qtest_qmp_eventwait(qts, "DEVICE_DELETED"); } =20 +#ifdef CONFIG_HMP static void test_drive_without_dev(void) { QTestState *qts; @@ -245,6 +248,7 @@ static void test_drive_del_device_del(void) =20 qtest_quit(qts); } +#endif =20 static void test_cli_device_del(void) { @@ -391,6 +395,7 @@ static void test_device_add_and_del_q35(void) qtest_quit(qts); } =20 +#ifdef CONFIG_HMP static void test_drive_add_device_add_and_del(void) { QTestState *qts; @@ -443,6 +448,7 @@ static void test_drive_add_device_add_and_del_q35(void) =20 qtest_quit(qts); } +#endif =20 static void test_blockdev_add_device_add_and_del(void) { @@ -501,19 +507,25 @@ int main(int argc, char **argv) { g_test_init(&argc, &argv, NULL); =20 +#ifdef CONFIG_HMP qtest_add_func("/drive_del/without-dev", test_drive_without_dev); +#endif =20 if (qvirtio_get_dev_type() !=3D NULL) { +#ifdef CONFIG_HMP qtest_add_func("/drive_del/after_failed_device_add", test_after_failed_device_add); qtest_add_func("/drive_del/drive_del_device_del", test_drive_del_device_del); +#endif qtest_add_func("/device_del/drive/cli_device", test_cli_device_del); qtest_add_func("/device_del/drive/device_add", test_device_add_and_del); +#ifdef CONFIG_HMP qtest_add_func("/device_del/drive/drive_add_device_add", test_drive_add_device_add_and_del); +#endif qtest_add_func("/device_del/empty", test_empty_device_del); qtest_add_func("/device_del/blockdev", @@ -524,8 +536,10 @@ int main(int argc, char **argv) test_cli_device_del_q35); qtest_add_func("/device_del/drive/device_add_q35", test_device_add_and_del_q35); +#ifdef CONFIG_HMP qtest_add_func("/device_del/drive/drive_add_device_add_q35", test_drive_add_device_add_and_del_q35); +#endif qtest_add_func("/device_del/blockdev_q35", test_blockdev_add_device_add_and_del_q35); } --=20 2.54.0 From nobody Sat May 30 17:44:35 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=1779314154; cv=none; d=zohomail.com; s=zohoarc; b=R/cPq0CVDhfad6zQR0aI1zqtfxZB1a5CIpVYOVj6KWbRxhtiLMbN7i1n2mKWWPm03V9aS8PUoNWhi/Pjief1cZ+oAUaI3k34urHixtU/Hh55jy9MRcUKXS3oE/JVoGbOKl4You+ExaOWeM62yR6+MRIahYI+W63NIm3PMu+WWnM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1779314154; 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=HBlj5f3wT4E4oR9tV3iE2UTgqMEBYhz+fMm03flQA0M=; b=SjvDntpOYNg+W2cq7Ad5ra/0JXzxf6rIwhmo2uqAOn7fyKlxNhVPk0GpX2RPzJday7Zu5a3m3UaTORqp8+akgsy3+AHyJYlYy6MeMJUNSu61OlsD1sGqLkN1dEt0d56bkcFQiVtpJ6Kfj2yyOdqu18hrdwV4uxmxXqWR4GZW6/c= 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 1779314154878812.2471756587003; Wed, 20 May 2026 14:55:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wPorP-0008IW-Vt; Wed, 20 May 2026 17:53: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 1wPoqt-0007hf-Ql for qemu-devel@nongnu.org; Wed, 20 May 2026 17:53:24 -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 1wPoqs-0004zg-EG for qemu-devel@nongnu.org; Wed, 20 May 2026 17:53:19 -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-573-1ATqXtd1MLe0_v1WX2Pneg-1; Wed, 20 May 2026 17:53:16 -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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 480D11956080 for ; Wed, 20 May 2026 21:53:15 +0000 (UTC) Received: from localhost (unknown [10.44.24.26]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C9BB71956053; Wed, 20 May 2026 21:53:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779313997; 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=HBlj5f3wT4E4oR9tV3iE2UTgqMEBYhz+fMm03flQA0M=; b=RNB0qMq+YQ1wfg16fIKss8oXEodjuezn9oePcFNgOoooUCkBuWXnx5CNQZPXAGkQTNx7Kr 7dM+msDQ9y/9R62uYP6E77BqGqxJOdSjXxjtOBHgL8w86F1YedEOThCUo40TSwcsg6TEf4 TpD7aNHk4cGCTiGFbRYltzGtM3RKFlM= X-MC-Unique: 1ATqXtd1MLe0_v1WX2Pneg-1 X-Mimecast-MFC-AGG-ID: 1ATqXtd1MLe0_v1WX2Pneg_1779313995 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Thu, 21 May 2026 01:49:33 +0400 Subject: [PATCH 32/40] 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: <20260521-qemu-no-hmp-v1-32-d104f809e145@redhat.com> References: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> In-Reply-To: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Developer-Signature: v=1; a=openpgp-sha256; l=1157; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=YSxNCm8GyYz8MbWnmE5OfmTVRR1y3lVfgK99MtZ/ZCE=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqDiyE0BeexYWo+Hxsou2K0KsUXxLACioSXcUHk zk+L7h61IuJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCag4shAAKCRDa6OEJdZac 5ffoEACv2mj8xirn5uTzC7l7A6Vot3LEi3FldBaiAu8C7y+GPKm/bELI750sX7Riomjf+1RG6kf MW5mUh2EAx4lf9sTDYvPUpwtBjc9HRid/LfoVeozgRF8FF0CCesE9KQY9VfD1Vzedp6Ni8Rcwiy D3XIh6DTpvxx4YyAiJAdQJF0uP0ejURcZWTy7awhg4vhG3ZPH0CPVxKO2g4ztBO6lXcSnpnAe0N dpcf05083cI4nRcbsvz5vGJtfPv+0znhkJxNtL5pXrNNc0IbMXpaEs5hFDnalRxWiXkGWcOMS6f EqnH7EJDG3bQmSPanslyUmdjnPapM3xC/dXmSIixSQ3S9960szYlasEdnZv6kKF45XqPn0L5OhF 5C0buCImI2Ikv9jDOwC6kr/sSC3PTypsw9Gzb/CuVvpIhmI3hdatEVf3Dh3yJa6hpebJsjasGsG RO6upCJ6GVbtq7izRbiuYt0wM+VOLDV61lAShNdwXW4ilrJBsWluIZOjtA9jjsIPpyjfko1XTwr OCF4tZzHC8dTAqD2W18pMfMQdKGatJcZh5oyicMK+FMwGtqB2NhhdB27rFcmIfSkv8vXLfh4UvJ hdAcHChOLh30cZkHSbB6OX7IMzUPDb6xFLDd71Ya2VPNipqKzMeLVD0C5iWzk178kwWGD5XguD1 N5zuYCry9aaSwSQ== 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: 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: 1779314155923158500 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 ++- 2 files changed, 5 insertions(+), 2 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: --=20 2.54.0 From nobody Sat May 30 17:44:36 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=1779314079; cv=none; d=zohomail.com; s=zohoarc; b=ShBaPc6mch+Iyhh82Jn3fHvWT7vFNm/2yUSqh9ivlAxaIXIuVwFKFy3nifTpSNv3+1XhfqO1glQ+oDkO3yYkZIYqoLEOjpaePk0Ln+9A0Vm4rieoQ1wqgxJ5ujWYtj+d7t5j1U37NpN1HASTyGTRfGCB1S8d160pT3UHzblFmaw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1779314079; 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=RREV8hzA8/5WtMwkYEuhorHQd2Tymhqo2wbwMEUqD3w=; b=f0ZwYxxT8Kl1Rf/syUz5Q8B12XYlkk7HDjuPwn+XtPGMzlWfRetxIf0Xn0zqeaSQ5uADWH0I9FhiQORUgOatYe2JyHo+IX5Mp9LFf8qnGXyjCB1/8s7M+OcUzWXcMpMOL61tgE/+2hWKnPgY8vOPt+eO1Muz19slLzfYcjR5HGk= 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 1779314079968928.0557064465689; Wed, 20 May 2026 14:54:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wPorZ-0000Hc-0c; Wed, 20 May 2026 17:54: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 1wPor0-0007ms-EH for qemu-devel@nongnu.org; Wed, 20 May 2026 17:53:28 -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 1wPoqy-00051L-14 for qemu-devel@nongnu.org; Wed, 20 May 2026 17:53: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-515-ebzaoaG9NaakWUG0AMlJFQ-1; Wed, 20 May 2026 17:53:21 -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 0AFDB1800359 for ; Wed, 20 May 2026 21:53:21 +0000 (UTC) Received: from localhost (unknown [10.44.24.26]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A1A001800465; Wed, 20 May 2026 21:53:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779314003; 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=RREV8hzA8/5WtMwkYEuhorHQd2Tymhqo2wbwMEUqD3w=; b=e3wfJaV8SxbvqEI7IkOy4bZ13r4+FM3kwov3KBiYsbjJobgfsUtrTv8MVa5wUCWmx8Rhg+ Sb71rlvOt5It7bBj6lM3AikmNjddmA4IM2vkASl4jgaMaTjczzak4UiU7BEsJhevYEnRxv mtE9I/9UKFjNiorDXZH9RYuSz1jSyew= X-MC-Unique: ebzaoaG9NaakWUG0AMlJFQ-1 X-Mimecast-MFC-AGG-ID: ebzaoaG9NaakWUG0AMlJFQ_1779314001 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Thu, 21 May 2026 01:49:34 +0400 Subject: [PATCH 33/40] monitor: guard HMP-specific code with CONFIG_HMP MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260521-qemu-no-hmp-v1-33-d104f809e145@redhat.com> References: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> In-Reply-To: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Developer-Signature: v=1; a=openpgp-sha256; l=8115; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=x+A7gittc42wCYkzsQ0krT0K5pxUHKEFswcZ957WsS4=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqDiyE3M/Nrj8g1DDd/I/+F/onei+Srec/ZOtef MHigNzw0a2JAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCag4shAAKCRDa6OEJdZac 5QJXD/9wRtePunmiojmr0qzXj6WfAFMlsdKUVChoqpZMUzAuQnmjDavA5gpKlmJmV7cZExNzqHC 5eUtVkKb1IwFS1RRn+jpA72ZxmAILo6FXX62szW81hL+8rGukxO7vpxcYxbI3Zd66koPvO70OYw cpaaN7s4kSprG+QWlmFoonSJE8Cl5ngCWRw4FWdoHjCshpAgwCD6P6JsLWVMF4cPfyzyEKHbs8M oAAv5zUkHJISxV+U5KmhhcJsBKw3Yzl2XgX2PRjtG0d/EPlLl4ZSQf1vDlOAsHqO6v0DV7d8u/o mRyf/hT/fNXhaO3jZvORUYKZNKVCRCJK5OM1SMbANnGkMm2Qa3P49GymIVOaeFCL9BRn1uicYWI YWc5xUa30q53fVOGqW9m6dIYXWeS1T6v8ZWPAu3QEpxe1qltufa+4F9U2ASSx46gPCrnYr4J3S4 2+K+vYbI4JSgGB4FP35MmFTK1A9I3IDpTblhk3k10qX3yzx+PMlWpuLrKjQjtdbI9mVAGhXSyZi /qFa4Ad0X/55CDIyuGxx6qz0tC4BXq6S5Q7bHCSWV6XQvDN7jNaa+PrPmq5OCB/SWzoTCME/HdP jjtY1Jtba0YjVYq5T1RtYkmGaBGiFIJqPVGdo6y2chmaQDZ3n0k4m8dyGXnKvfgc+4WbaLQgPKt VOH/4YKPCmy7QAw== 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: -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: 1779314081628158500 Add #ifdef CONFIG_HMP guards around HMP-specific declarations in monitor headers and implementations: Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/monitor/hmp.h | 2 ++ include/monitor/monitor.h | 11 +++++++++++ monitor/monitor.c | 31 +++++++++++++++++++++++++++++++ monitor/qmp-cmds.c | 2 ++ stubs/monitor-core.c | 2 ++ stubs/monitor-internal.c | 2 ++ 6 files changed, 50 insertions(+) diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h index 9258a049bff..7bc524cd4ff 100644 --- a/include/monitor/hmp.h +++ b/include/monitor/hmp.h @@ -14,6 +14,7 @@ #ifndef HMP_H #define HMP_H =20 +#ifdef CONFIG_HMP #include "qemu/readline.h" #include "qapi/qapi-types-common.h" #include "monitor/monitor.h" @@ -195,3 +196,4 @@ void hmp_info_cmma(Monitor *mon, const QDict *qdict); void hmp_migrationmode(Monitor *mon, const QDict *qdict); =20 #endif +#endif 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 2dec0e299af..096a5ee748d 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) @@ -211,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; @@ -267,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 */ @@ -541,6 +550,7 @@ static void monitor_accept_input(void *opaque) Monitor *mon =3D opaque; =20 qemu_mutex_lock(&mon->mon_lock); +#ifdef CONFIG_HMP if (!monitor_is_qmp(mon)) { MonitorHMP *hmp_mon =3D container_of(mon, MonitorHMP, common); assert(hmp_mon->rs); @@ -555,6 +565,9 @@ static void monitor_accept_input(void *opaque) } else { qemu_mutex_unlock(&mon->mon_lock); } +#else + qemu_mutex_unlock(&mon->mon_lock); +#endif =20 qemu_chr_fe_accept_input(&mon->chr); } @@ -631,9 +644,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); @@ -733,13 +748,18 @@ int monitor_init(MonitorOptions *opts, bool allow_hmp= , Error **errp) } =20 if (!opts->has_mode) { +#ifdef CONFIG_HMP opts->mode =3D allow_hmp ? MONITOR_MODE_READLINE : MONITOR_MODE_CO= NTROL; +#else + opts->mode =3D MONITOR_MODE_CONTROL; +#endif } =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 +771,7 @@ int monitor_init(MonitorOptions *opts, bool allow_hmp, = Error **errp) } monitor_init_hmp(chr, true, errp); break; +#endif default: g_assert_not_reached(); } @@ -764,6 +785,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); diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c index 0c409c27dc3..cca25c18a15 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 =20 static void __attribute__((__constructor__)) monitor_init_qmp_commands(voi= d) { 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 From nobody Sat May 30 17:44:36 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=1779314218; cv=none; d=zohomail.com; s=zohoarc; b=cmguKiq0Pb8aF/R2nDOiGt5/4NRfgvyDn7Q6gDG794NhJSNjX1rgbIJOHo/Iw1jAmxn2RTCPELhhrZO9QCYQzqsCRPc9ewLL1oApL8XcoqeX/I8BExKD/Uq/LQknk3Ff0lZtvPCUZ+ozaNIBzNN6DIRkbpK1xCpCgux5NO8Wc10= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1779314218; 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=dVxHp+VgSkhxY/19oOClF5Kb+UOms29HTynl815qS8QQXjzdFxWWCcxV08fAv3e//4+9KioxXVYwL9c8uUOtUNgHw7B0OaXyHo2nTe6yiF+89vtKzMlKN8IMXieXmw8/OqYDweuSVuMBwqtb9/GPUgdLauYIVBgphOoa5HnURtk= 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 1779314218329283.57341908071214; Wed, 20 May 2026 14:56:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wPorR-0008Ow-Hn; Wed, 20 May 2026 17:53:54 -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 1wPor5-0007rS-HL for qemu-devel@nongnu.org; Wed, 20 May 2026 17:53: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 1wPor4-000525-1I for qemu-devel@nongnu.org; Wed, 20 May 2026 17:53:31 -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-520-f7jyiDZCMQ-Fd4_C0TlmBA-1; Wed, 20 May 2026 17:53:27 -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 E264E19560B4 for ; Wed, 20 May 2026 21:53:26 +0000 (UTC) Received: from localhost (unknown [10.44.24.26]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8A81E30001A2; Wed, 20 May 2026 21:53:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779314009; 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=A8U+aT3VFeRiOiyb5fL4+X4XnBPDsgJCbWpt6aERvctom+aI0XVpHz2n1mo1mdh2v3aTBs FXmjQvufuOIvrM/DLqWgIBKBDqXxXvkCvvlakNdlkjShJ9f2sbY6x5jPEj/pd2i4g0TxMJ LLQAgVd5wZsSrAUwopcd3cqP0kKR9AM= X-MC-Unique: f7jyiDZCMQ-Fd4_C0TlmBA-1 X-Mimecast-MFC-AGG-ID: f7jyiDZCMQ-Fd4_C0TlmBA_1779314007 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Thu, 21 May 2026 01:49:35 +0400 Subject: [PATCH 34/40] 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: <20260521-qemu-no-hmp-v1-34-d104f809e145@redhat.com> References: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> In-Reply-To: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= 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/ZANAwAKAdro4Ql1lpzlAcsmYgBqDiyEYRx+qsbU28Pdc7J8yrvkAvvS06c5QAvFG LNVeWI/VMOJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCag4shAAKCRDa6OEJdZac 5Ve9EACUp+iPKWWmZmSVvxM0G00/aqmjBrek3BkDZeEevQSVZxWu5149MJiwoIqrpB8FwK236R8 VgTvmpmCI4SKzqATEWX6Iv4kQOv8GmyfdolaS0AO2zUb7Jko7aZ7H5r+ItIbdJPNNHWt7wK6tb2 ATqr4gP1UDa59HkshGCcg1dahOiODd3dtSt/1T+oHj7T/onN7KscZ4yeX2WwdNSiimzSfUI9jqC c3bDeoO9qn5u0Cy9WuLHugOeTF1X/tmMkaBKY+a2Llv4yJPCpi/yrhqCMZ8QIl6Cjddw0tegrtE DPXeOzRYtR4CE49ZoIdZ3kyWFOo2AP/Dev2dWESoZ6Pj+ahJMBZ1/mKkMySM41I/non1NBHq27s Ww3mEhHhTFzdYRfGXceGOBF/QRN7Qs47PcHGApF4Judt9IheYGMmL6Qdvw6F90Uw04Wm0Cea6ZV KnrS148uGfIKV4zF5E5aPmecFUsa8yUuKBf8rNZtOgRA4nX6SXSlEsFuSpCEVtytRzRDdHfeA4z EPSul6eWlsI6m2mJyf9K6vN+/gTiB/0I2BsAVuH/3wFEAGMxSkak3XPtG0zgY2sU4GneSo1InQ0 SYgPy5M5uh8iCWkYQ6mgnbPo3Rag9gXqSAKy9F56Eu6ZuMgIlfGPj/8yZCkW4fK0hML/WdtpRiS mjxnZsofCab/G+g== 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_H5=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: 1779314220371158500 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 Sat May 30 17:44:36 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=1779314049; cv=none; d=zohomail.com; s=zohoarc; b=S6x3XGhON64cfIXe4QHCBHkFLXlPHRpGX3z7JMSU1iso4B3KEODRSsp3eDfVb06YqW2A7hKjoy6GES7izlc13YRJc1gNDjfx81qHlEEKcRHMZiF5/ZoanhtaYmm9KecV1seKfhiWnE2REoRJzNHWEuAuPVDE0G/Kg+mXuCxHVzg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1779314049; 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=i6WHRLVUsnP7EUiju8qFp03LMKX3by7HkCwwST9bmis=; b=EEmBiCPx4g/sGWH+Cnl3N8jYcYeAR923y/MV+lHQCAiJrkSb9bSj46ChN5jxZR7UrtjlKkU3sFZUWoCj6oNNFkpmoaofWp9U5SdEmri3yb+gbuaqM/PIyyvjr2CJwe2B2LUUu3N3wCQ1n5PN0ZDwpg1tFIY8R80Itrfktegl1Vs= 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 1779314049206927.222331927363; Wed, 20 May 2026 14:54:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wPorX-0000Eh-O8; Wed, 20 May 2026 17:53: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 1wPorA-0007xC-Up for qemu-devel@nongnu.org; Wed, 20 May 2026 17:53:41 -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 1wPor9-00052Q-Dc for qemu-devel@nongnu.org; Wed, 20 May 2026 17:53:36 -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-634-7Wr-pcJ3Oh62k6_LrCImYg-1; Wed, 20 May 2026 17:53:33 -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 6E5251956096 for ; Wed, 20 May 2026 21:53:32 +0000 (UTC) Received: from localhost (unknown [10.44.24.26]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 490FF180056E; Wed, 20 May 2026 21:53:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779314014; 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=i6WHRLVUsnP7EUiju8qFp03LMKX3by7HkCwwST9bmis=; b=AZu8UQd4SG9pUjuNqCn1jOSs80jBNNeINJ4STPEtPdckda9PgJGeQNCt/ysugS43XAQR1c FRgvzj1S9zPfJrLPCqv9HUDDkdVRgBG92tkhlxhYJOEx6czZci/7ty2CnsUFCbEOPewVnu ejU2jJakOc2Orl6RlfWmUk7UNjdcAL4= X-MC-Unique: 7Wr-pcJ3Oh62k6_LrCImYg-1 X-Mimecast-MFC-AGG-ID: 7Wr-pcJ3Oh62k6_LrCImYg_1779314012 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Thu, 21 May 2026 01:49:36 +0400 Subject: [PATCH 35/40] 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: <20260521-qemu-no-hmp-v1-35-d104f809e145@redhat.com> References: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> In-Reply-To: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Developer-Signature: v=1; a=openpgp-sha256; l=3542; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=HOXNpMG984jVPJUtTcl7zB1C3dRAMxcXx7pr//mD/Cc=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqDiyEIczIz5obFoLC+g7eie3H2ex69ZTrmp3FY W6YmQCrCFCJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCag4shAAKCRDa6OEJdZac 5SzYEACnK+/S+FSNLz7HmPI4d+IpU88rCGc5/5jrH8ulgezmqkcBRnxQxS9Rnzr5Jy7k98D8KXC 9evw0V7zBt5zeqo1VrFjuVWAsyzSFRRk0KQb85kAhuXRkX74/2R0uUhzzNOpDylQNKvHm73xUuU wjAv1XG8zjLf+stsyz//Nf9MAhX1ARXhl3Ch3eFwHTJOp2OEzQU+JPiGsGjiZ5gwO5RoNdcZ5lK E2covjYDVJm0Vl2qqwUYnHnTimsBsonky2I/fwt4EAMplNwg9NDt2hG2zRpToPlpS/7thBjPa4c MVmG01Gl/dyBy+vWiJ5mYtrmZS4uUZJeRSNupUx01+4Z3Gfm0mtrWb6PVDfbtEsJFIm3jAhQJmP 1DNppck4fa0J2QDt7Ex6SQ7uowdq69Y8wxN6wCa8qr++nNx/rNWKlaLlwyCqaaLjm5uhyQ73nkO wXK+xDL3QE5MzpRBomXwRSbs+AwhheLjDhLjMKDu2QSPp3Z2Mo4uwvaX8aA9UVcQoTqWZLMcb35 ymWVBnlABzoJgBE7qHKWOn6AnN9yFYcDTb++FPQySjE7xY/8LOPKC7gq47YB0EJwK0BxSsJawzH X6ymY/KF6XEmOV8jNmYNMu4XqmseC7igu6a7OobuU0fCG80xgnD1qI9QKBHtnH2vIl6ymhA2EfK /kO5dKLyUxMiUWQ== 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_H5=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: 1779314051326158500 - 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 e86c5870abc..0c282c9c491 100644 --- a/gdbstub/system.c +++ b/gdbstub/system.c @@ -385,10 +385,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; @@ -529,10 +533,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 4797700abd5..f9fa00de07b 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 4c1b32713e0..d788467b83f 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -4941,7 +4941,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 Sat May 30 17:44:36 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=1779314064; cv=none; d=zohomail.com; s=zohoarc; b=PSYjBbhhb+Rmk9UDN1yEqGBlitq4Vem7I/QVAB73DehSWdpiDQ6vOc58pbl+AnYBhJElnt07zS0aqA3RA6x7ESH/WpoaEmC4xr5Pa4PWkfJEpdSF1VAiYcOYgv5bJoiG0DcosN+fckTcyHeKTMHMYPUW3GTq2CziPO+9mE66Ncw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1779314064; 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=D1/Vzw2Y3LIUw5pYZS7KurEux7ztNC/IdWyyYaMXw5Y=; b=aDpOh74ZNA/iePXlcIC5nvnTa+wCyOV2Q3/qEdBOMrCDcO41x2Uu1NkWxYo3pO+NzJyrz7eWHeOLxEDHsHP5Z0V4yH3nTEdRnImoQ2m1jPulzN5VuSw3CGXX0kKL5MOy/NRc2i6oqUbWxu5x4hCXCCtsrpER62BWN9iBXSNi66w= 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 1779314064313461.8986159201338; Wed, 20 May 2026 14:54:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wPord-0000qX-NH; Wed, 20 May 2026 17:54: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 1wPorI-00082Z-AJ for qemu-devel@nongnu.org; Wed, 20 May 2026 17:53:44 -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 1wPorF-000537-7a for qemu-devel@nongnu.org; Wed, 20 May 2026 17:53:44 -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-632-SH6ilo03OMqyIdw8iA3BSw-1; Wed, 20 May 2026 17:53:39 -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 3CDF1195608F for ; Wed, 20 May 2026 21:53:38 +0000 (UTC) Received: from localhost (unknown [10.44.24.26]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D17E81956053; Wed, 20 May 2026 21:53:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779314020; 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=D1/Vzw2Y3LIUw5pYZS7KurEux7ztNC/IdWyyYaMXw5Y=; b=SHwwFaWN/QA2IDds4xIb0e3lLQMKsa2IQKpIE8EedahceJ3cGEpUxX2Bt8yynOV30gBPUn 6ZQvWJArVwkYY35XWJO8pOlqugRucd9w448stoSZtXCnhRBI5/Wws1vjncdmx6fmmTZC31 AP4oZg11CuLW7hT4jtefwOqDNbNl9m4= X-MC-Unique: SH6ilo03OMqyIdw8iA3BSw-1 X-Mimecast-MFC-AGG-ID: SH6ilo03OMqyIdw8iA3BSw_1779314018 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Thu, 21 May 2026 01:49:37 +0400 Subject: [PATCH 36/40] 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: <20260521-qemu-no-hmp-v1-36-d104f809e145@redhat.com> References: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> In-Reply-To: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Developer-Signature: v=1; a=openpgp-sha256; l=10016; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=9G23734F58rnWXSfmVKDClokceOql9t+p0azHa4YjYA=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqDiyEDgBjCrRfAUxoRPdxiEYgiG6EbGT19MLjN FxdvNE85TiJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCag4shAAKCRDa6OEJdZac 5SL1EACPYy2CZIqWg5yAc5qKkz2Awe8jSikWcVQ8lffr9rbSONTiEhYlqKhrTKoTRwwfk831+sg 5pTRLKFNK6Cqh0/5XoUALWAgSv5bNg6+dOQusPDczGqfGx2t+jzVmxDu1/ELJ6zDzL5Xf00NGOh yEOH6/09ofuz6gEYjOIeyxqNYUre30zvFRt2wpnO9YNzHErOIZoVGUby6332lpRq5e5U6KD4PtK GGy+QV06WXn5UQAjI5LHsWlf8Ug7+2GMnV0xtVs6thvoPh2hKbItBAyX0GDxov4ZCBEfkZewYKu 9UKxlgOdsfi6CuInjFmDyHnOxEgBy7mdpKnqypN4Q/zTFwj4CnI3K7bWwdb1LV0QRTpwjO0Dkb8 IwoEZm1rzsBchTTaZ/yCGvTKuXGdgv52jMLKKXoE1vswYlIZlcyVA+8aDB3kwTcgkN66sFR9jJm O9ZyksYDI+WYW0XJp3ZSBii+WV3ruAqZdgulQJlg/DtOcy0DJFkaug6Tq7LsODJqMo+ACILtaN+ bYJ3jNv3fFRcz2/uTRGbc1uEjW/34qc+A0PPoPbNsG76SnK9r5zhUxTjBYCxL4RboGlcMOMh88f lSNkyL+rJcqK2nlnoa3IwvEpxik9EQi11HKXzqWNpcLJC5Y1Nxw8QgQMaWuncoBBluCUFIWsKpS v2o0guctvD8xK2Q== 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_H5=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: 1779314065543158500 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 ++++ system/qdev-monitor.c | 2 ++ 9 files changed, 41 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 4298adf5a0a..c67aeb67f4c 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -283,7 +283,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; diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c index e5b55e3004c..7ed2008d81f 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 =20 void qmp_device_add(QDict *qdict, QObject **ret_data, Error **errp) { --=20 2.54.0 From nobody Sat May 30 17:44:36 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=1779314110; cv=none; d=zohomail.com; s=zohoarc; b=mAD4xj2pJG1RL9r7RyBwas5gpxyxZ75OBZss881TzPjyXUa3JBmE8iW6f9GFA5TnyeIdiHHEBiTA9FrJaGL7Guaye8waq6Hn7XaMQZPu0JnpxxvypD39w47XhN2w/QGbHx9NRAQsFoRMLIDFnqaXscDBMqymgCzDH0ZJaDLuC5I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1779314110; 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=Rbde7J4noGUK2MfUX87k3osUtabW4MGls+AziR37TyQ=; b=ZzWaDTx9VN1bYkyPVTUa1ScvdyroZpMjxYZtMYJS0ubhXQ8ZGoHHfFkdlac8bV2k6gY3LWKIK0Qe4WfNKPxww78qNepxLMq/+22X64mUu5qKKxYq4lwKgR6EPLPEwJVtG6ANScTAx1zaKJ6q0dwWvslPna34wxJSdWbduhHnpC0= 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 1779314110292522.255285170523; Wed, 20 May 2026 14:55:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wPorY-0000GU-4H; Wed, 20 May 2026 17:54: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 1wPorM-0008EQ-Ko for qemu-devel@nongnu.org; Wed, 20 May 2026 17:53:48 -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 1wPorK-00054n-UL for qemu-devel@nongnu.org; Wed, 20 May 2026 17:53:48 -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-694-4dT9_m78MOmb9BizJbRJtg-1; Wed, 20 May 2026 17:53:44 -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 D9036195608F for ; Wed, 20 May 2026 21:53:43 +0000 (UTC) Received: from localhost (unknown [10.44.24.26]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8592C1684; Wed, 20 May 2026 21:53:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779314026; 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=Rbde7J4noGUK2MfUX87k3osUtabW4MGls+AziR37TyQ=; b=b3uWXguCSAqF5/EYUL4EAEv+A/9sWV4c6ef3i2XH8qs3HO3N2yGue2T2JvOMJBG3rjzEIt NgwVon1rQCn9eAvNZIgB4NdPoTPRXIzNUEjAwf9MFHDWl/KqRv8RFLxgHSJeTBbtsuxn8I w9YCPI2fq04KcLk4RF3YiRvBkfu53fY= X-MC-Unique: 4dT9_m78MOmb9BizJbRJtg-1 X-Mimecast-MFC-AGG-ID: 4dT9_m78MOmb9BizJbRJtg_1779314024 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Thu, 21 May 2026 01:49:38 +0400 Subject: [PATCH 37/40] 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: <20260521-qemu-no-hmp-v1-37-d104f809e145@redhat.com> References: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> In-Reply-To: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Developer-Signature: v=1; a=openpgp-sha256; l=3872; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=fPLNL/qowoRbvoQJmVKnuNiLGgQtbWe5YeI8gm0Ziuk=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqDiyEPz9pQbwdWIMwSy1QzxoQDaaw5wIEmlnPg 6x/XGCZrYCJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCag4shAAKCRDa6OEJdZac 5T8xD/9n3bBVkdIc0hEX7x6Z6rq9vds23H7oABMuvngzoinCljQ2ETJrbipqkFBOM8snmhosP/Y SRvIkjCvPwmHpwR+j9QMjdV8uKsRia2u2PrRDu1e69ENp3erz12dGLndBwUl8Sr51/HSTz+EWut 11Y3armcfp1B0E6l6K0ZZcavvc5JcplYhZ0Rz2R+9eggXrQINJkZm2bl1WVRrpxMwcN12+StrPc V7HGAVjf5xuyHalyQMMrY6VAzBx2E918OvrTOeXi7rFoBWVidWFEpgv2zxbbNjXRPgKSnvEip5h gFMDyqSGLYVpp0I9qxiYzDm8U2thrhuvx+9HljsFBQXehE0mgrSDIqtIwBk+UXOD8JUI7IJNG+1 f8610U9sALjfjZRuEwmllVvFoO9+WGc9d3OX3NfqMBmvyJjVZX55sX3dc1UTdEU2vXyMsXYvCmo UAc/nc34CDrkfK8vyJU3g9UKEnMGyND8GiE4/SLHSRrEjZc5bbKeowXecCWV+RSRq61wfGh7js6 OiLUH/AmpgC1Q23TjXD40MVf0lvcmBMFdq5zbjT7kimkwPYTfYvlo/rt2tKntsmnYBLynTx6j5Q whWMwNcEdbO1Q0BxMrGgLEpUAkS/yxlrMdY3SeVwmPO7qtn/WuvKlWeT3oyRDRIH+4Zf7vwdiaZ zM4248o5CtdqPXQ== 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_H5=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: 1779314111672154100 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 ++ target/i386/cpu.c | 4 ++++ target/m68k/cpu.c | 4 ++++ target/sparc/cpu.c | 5 +++-- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/include/hw/core/sysemu-cpu-ops.h b/include/hw/core/sysemu-cpu-= ops.h index 441901fae8e..1d7d3700c93 100644 --- a/include/hw/core/sysemu-cpu-ops.h +++ b/include/hw/core/sysemu-cpu-ops.h @@ -120,11 +120,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/target/i386/cpu.c b/target/i386/cpu.c index 7248720a0eb..7efc223c787 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 3df199ada7b..46af64c6a86 100644 --- a/target/sparc/cpu.c +++ b/target/sparc/cpu.c @@ -996,7 +996,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) }, @@ -1008,6 +1008,7 @@ static const MonitorDef sparc64_monitor_defs[] =3D { { NULL }, }; #endif +#endif =20 #include "hw/core/sysemu-cpu-ops.h" =20 @@ -1015,7 +1016,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 Sat May 30 17:44:36 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=1779314174; cv=none; d=zohomail.com; s=zohoarc; b=Vn8b+lw2/votIuDJXvBMOP3pxF6F4wdOlQDvI/76wR0uKqEfjYQCU2i/izb/INsEUhqtqOqLXeYyX8IvnwRdemnyR1YzY52TCsvg2M6T5pdR//uHX3pIF5Gl5HHcIKAcL5RtPzrjHTjFzV0I2MxmMG2das9GjKbu6pw/oAl/TRs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1779314174; 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=P8PlZo+VsLNCyGfzCKo/xbELvH4TzcPG7BrdXDIfoXQ=; b=hTeU1UNuqV1QGUX28LT7qX+AY4pdGN0tW71SvgRcy5vuZonHJIs5LKToieMvXREk9nKDzG9BWDH+9ZnCplobcpHLrIirbpIQXJ5xWAOk3AOtWo7c5O6JEbebFJIngV+M3SXi3MksFxTiviuwBxDzoSaO4IltEXS1oXCMENFDR3I= 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 1779314174875285.9319879191012; Wed, 20 May 2026 14:56:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wPorf-0000zj-JD; Wed, 20 May 2026 17:54:08 -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 1wPorV-0000Cd-Ke for qemu-devel@nongnu.org; Wed, 20 May 2026 17:53: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 1wPorS-00056Y-JN for qemu-devel@nongnu.org; Wed, 20 May 2026 17:53:57 -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-61-mxbgokV5PPisYHBrdkjKZg-1; Wed, 20 May 2026 17:53:51 -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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3287719560B4 for ; Wed, 20 May 2026 21:53:50 +0000 (UTC) Received: from localhost (unknown [10.44.24.26]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 48AC5180056E; Wed, 20 May 2026 21:53:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779314033; 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=P8PlZo+VsLNCyGfzCKo/xbELvH4TzcPG7BrdXDIfoXQ=; b=As0KZHHuP8PYDsSmJP0+A/mmbRx6ZjYycGHskwnsG6//3Km4ZcVepjxReAsNwIPu7t2lge mqGljaIsMs3Nm+arYSkxFWmeg5hDdr09oZKaN0j8dh8aKi/7YlATPJpwPKH+T0/lskXkSs OvxZnByWO0gf/jey2NqqaweeSO0rBB8= X-MC-Unique: mxbgokV5PPisYHBrdkjKZg-1 X-Mimecast-MFC-AGG-ID: mxbgokV5PPisYHBrdkjKZg_1779314030 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Thu, 21 May 2026 01:49:39 +0400 Subject: [PATCH 38/40] 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: <20260521-qemu-no-hmp-v1-38-d104f809e145@redhat.com> References: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> In-Reply-To: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Developer-Signature: v=1; a=openpgp-sha256; l=20725; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=XPQpftslDjilYGbj/gGcaKvB4lxedUul1aHrnTML4as=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqDiyETM5DVq/TIB0YDxCX21Y3N7lmdR46Rfrdd Zl1xmwS1XOJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCag4shAAKCRDa6OEJdZac 5UZED/9+rB3ra4HYh5r30DW4mcosDTQ3RnGy3KYwwdDM+4tucRMqd05RiP64jpgiYBGfBVCcPpV j4g49H7GrZd7oQTznHR7GbA3eIURPKofw3Nqswzi1n6R+VDnqiv6WJ5qicmxhZ0kVW5upZy+nwa 96TO2KYettRO5C8ezKPENNMWDAQDi7ygVnk0yox0L+hDTIqNMG0HB997od0y1n0kAM+C/j/sWyC t1eE/EmTBO68qIsQxiaGlr/DSfbD4zv85/8mI95d1cyGfjNE+izPEQTDT6+9NiC6CQQVsLe8Mpk 8P0CjWuCZu+3PE9nlC6TjkLo9PWT6YscbQrn6TEXe6vDg6+Jv5PAcjEg2gANNuQJL036kxYYdyZ buyHK9VfoHNM2gWW9vN6PUXxlPvvM9edvriS0JWoOFLRwGzmyAF/tobAmB1IuZoVS/q820XXYGh Rr7Kh+fHB83D28Cu74oOKzzN31a7WXPuco3cTzqx294Vy2P9qvWB+tralCzFsJsXYekAGIpAMx7 k+Era8uBB4xLYlrzX4rsyyCsd6mI0eBPwPJpjTr8c7HQpCIuGYf8cH4LsHliyGEwquK1WuiI6Lc mnsp31vs6nzGNJQZ0XHZI/Ts5fCq5WBzBCYxfJA/jimpoNwL+bT6+7KiO98tnylcD64VvqPJ5Yv c2Y5OEqd+4LQxoQ== 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: 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: 1779314176979154100 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. 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 ++ net/slirp.c | 7 ++++++- replay/replay-debugging.c | 8 ++++++++ replay/stubs-system.c | 6 ++++++ system/dirtylimit.c | 6 ++++++ system/qdev-monitor.c | 2 ++ 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 ++ 27 files changed, 80 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/net/slirp.c b/net/slirp.c index d3ed5ec9cb8..0d41370e345 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -709,6 +709,7 @@ error: return -1; } =20 +#ifdef CONFIG_HMP static SlirpState *slirp_lookup(Monitor *mon, const char *id) { if (id) { @@ -799,6 +800,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) { @@ -955,6 +957,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; @@ -975,8 +978,8 @@ void hmp_hostfwd_add(Monitor *mon, const QDict *qdict) error_report_err(err); } } - } +#endif =20 #if defined(CONFIG_SMBD_COMMAND) =20 @@ -1222,6 +1225,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; @@ -1235,6 +1239,7 @@ void hmp_info_usernet(Monitor *mon, const QDict *qdic= t) ui->hub_name, ui->info); } } +#endif =20 static void net_init_slirp_configs(const StringList *fwd, int flags) 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 b2c52bc4043..f253875bab4 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 7ed2008d81f..86afb14a6dd 100644 --- a/system/qdev-monitor.c +++ b/system/qdev-monitor.c @@ -1003,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; @@ -1045,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 5599a4675c5..0ceb5536328 100644 --- a/target/i386/cpu-apic.c +++ b/target/i386/cpu-apic.c @@ -84,6 +84,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; @@ -106,3 +107,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 785a13dd710..c9d1e2b14f2 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) { @@ -593,3 +595,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 b44b5a1c2b9..4d636c90ee0 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 63806002417..bf4f9fdfc77 100644 --- a/target/riscv/monitor.c +++ b/target/riscv/monitor.c @@ -38,6 +38,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) { @@ -243,6 +245,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 Sat May 30 17:44:36 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=1779314172; cv=none; d=zohomail.com; s=zohoarc; b=EQ0eC6/DJ0uWLauHE5U8RHCcQ3tNj7dUpz2W/Uvmg/kz+7Gx2zH3gpKLI0yvS/zDpKmsHTN560Q0C02wL66m7lqnB3q6M1zzmc+d3RDFkn/hB2LwIOhKNEO3cjHxIk27x+FuNLAQDPsd0Xnb8e+2nvNJLzek2G/HQC5aicH0Vvo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1779314172; 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=P78ckPc3ZPybKo5juuBAaJzw+Cy9pLdmq2erCPFjXPs=; b=IZzQKUFNvwK7jUHEUTri7ztvscmo8q8EuBLGGo5ELnM6+oznZ7x06lO/ELApEWjugGXxgUEt8Koetu4tGZw8xRHX7PG+UJWCBBLaKbLO8epHSKZgehYQySbKPdZD2HpzO2EZ0VhhmJD0pfUSDQOxO2mEiWOJ8/SCMOHx07wFUsQ= 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 1779314172113678.575079558758; Wed, 20 May 2026 14:56:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wPorg-0000zo-C2; Wed, 20 May 2026 17:54:08 -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 1wPorZ-0000QM-F3 for qemu-devel@nongnu.org; Wed, 20 May 2026 17:54:02 -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 1wPorW-00059r-Va for qemu-devel@nongnu.org; Wed, 20 May 2026 17:54:01 -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-67-fPD1x9S7N-Oc_PVpdi9kWA-1; Wed, 20 May 2026 17:53:56 -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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6D7131800283 for ; Wed, 20 May 2026 21:53:55 +0000 (UTC) Received: from localhost (unknown [10.44.24.26]) by mx-prod-int-10.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 74B4F1684; Wed, 20 May 2026 21:53:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779314038; 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=P78ckPc3ZPybKo5juuBAaJzw+Cy9pLdmq2erCPFjXPs=; b=HKqevWHtvGIVl9X2PFvbcupAoJ0VFZiPzijl3ffK0ykW/6fJ5OIHRFJGVDqNBPcQUrOrfS /FGk+0cQyimbRxItTYfMAdUnY2/Pf0YYyZ7nDfXtpIhz6R8MWmjzKFITmzr9SyyMqq0E/k KQ6vDddWdUw+x7P+ODLR3uecOweVilk= X-MC-Unique: fPD1x9S7N-Oc_PVpdi9kWA-1 X-Mimecast-MFC-AGG-ID: fPD1x9S7N-Oc_PVpdi9kWA_1779314035 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Thu, 21 May 2026 01:49:40 +0400 Subject: [PATCH 39/40] 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: <20260521-qemu-no-hmp-v1-39-d104f809e145@redhat.com> References: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> In-Reply-To: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Developer-Signature: v=1; a=openpgp-sha256; l=12291; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=kPuxRSfsK1rprdQnXUjLN4BoAarEMBpDqza6xvogyjg=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqDiyELy9KzkmoWHgEbSWczEFAWuGKee5MIEEEI F349rnrtuyJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCag4shAAKCRDa6OEJdZac 5fGJD/9feTW0I/ye6kGXRzisebWhLbfZ4zC/cBdP5RFQJHYzzLT4hCdZd6my/mGD6OqF3M2FYd/ LDrlQ8t8dzVlOb8QZhUloFwUgbw3bmBTWqLBUleoFyGkGAxe0i52O6Irb2NnJrMFw92tgDFuHbq 3HnqdeDgQ2EOL+Dq9X1HiAWeTFkIEzkzmABlnFmusDtbjnzZJ2RPaQLwdNiqJTf+eKDS2nWNpKQ f7TVioruAqMevi+XFP9KumAvLqGS/jHWURXH+8eiKOOwPDe8Rg1/VZrJkUv+zPo1coUBG01ZYqb J/5DrPb9BSwb3BnQnahNnO30sNnH5f5Nh86Vx2ApxImgDmgQ+jvot4EOQwE+QcdEr1SDFVVAbYb uA6nQDS3HlqylDKH9E2n2N3SFxtF606eSZ4I6eo+HKlA9NktzExGaj4WezwXyMViArWy1V69R/N mrxQQ/r3cCA1DNVu1MJe+jPPQ5urbVDFZBArlRzcaT9aIF2YPxKN4YsXyFT1AIbRWL78CWDwrXs 0muuPA8zxzHjLfnqNe1vv3mQhsamFziFYyrFmdrfw4y9SEZXzUfxjcOsI69Z41U9ADyHj9vlUzz 8TNxkbthb5vw36hD5ZZ4CgJqa5OLTy8+x56BrN6+3b7yH0p+8BYYRtjkmkw+dl4PqUW0Mi2GJL2 pGWIUZj4U5ZtH7A== 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_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: 1779314173001154100 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. Together with the preceding CONFIG_HMP guards, this makes QEMU buildable with -Dhmp=3Ddisabled. Signed-off-by: Marc-Andr=C3=A9 Lureau --- meson.build | 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 +++- 22 files changed, 85 insertions(+), 29 deletions(-) diff --git a/meson.build b/meson.build index e83cfe56cf3..63f2d687b69 100644 --- a/meson.build +++ b/meson.build @@ -3538,7 +3538,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/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 31025874699..76fe3d7dda6 100644 --- a/hw/net/meson.build +++ b/hw/net/meson.build @@ -68,6 +68,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 e0566a60de7..4b80e4e1c87 100644 --- a/hw/virtio/meson.build +++ b/hw/virtio/meson.build @@ -97,6 +97,8 @@ stub_ss.add(files('vhost-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 e583822dec6..bb39d987110 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 da6ea635e95..bb7d70c6c36 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 9cdfe1b3e75..a1afc6fee5f 100644 --- a/system/meson.build +++ b/system/meson.build @@ -21,12 +21,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 728dde54b3f..acd175a679c 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 1b8f71796e4..66790c29f44 100644 --- a/ui/meson.build +++ b/ui/meson.build @@ -57,10 +57,12 @@ system_ss.add(files( 'input-legacy.c', '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 Sat May 30 17:44:36 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=1779314079; cv=none; d=zohomail.com; s=zohoarc; b=hidAPqwHUNfuTFjgi9C4sS4mW/n57G+D88MBdoGAzOpouEEVbE8l0mYOePqs1gicjvQ5qy7OawBG6GKex17VSoxQQlwsuj6OSHKSW+oJqJ1x3+cKhdeCOEcdL8jGp9A8hdkEiciKg5P2ufjH9KKLukGcM3kL7azywPiXCSB7zo0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1779314079; 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=V+i1b5mPHmFf4rxh+RWTQ6he4SOTkWF6HcUmeuWlKoY=; b=QqUxL3mXfMBSMsJWKijKnI/Xr+Kh4jNRzQMksE8mcwj9kyhlDJvmgoYHjhdXzo7zrnLaQ8WacM2vb2R4e8k4F7ciZF54a8NJ2s1J3RFjkO7XAJZBZIq26cpREWnFHsEnfNHlwWN4XzTAi8ZsNf8i6vKhM+7y8v+1V2spI7WBwhE= 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 1779314079974507.22948021681964; Wed, 20 May 2026 14:54:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wPorj-0001G2-G3; Wed, 20 May 2026 17:54:11 -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 1wPord-0000rH-Dq for qemu-devel@nongnu.org; Wed, 20 May 2026 17:54:05 -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 1wPorb-0005BW-TD for qemu-devel@nongnu.org; Wed, 20 May 2026 17:54:05 -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-222-wCzTq9oLOGuinhReFPthPw-1; Wed, 20 May 2026 17:54:01 -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 ED62518005B5 for ; Wed, 20 May 2026 21:54:00 +0000 (UTC) Received: from localhost (unknown [10.44.24.26]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9206B1956053; Wed, 20 May 2026 21:53:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779314043; 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=V+i1b5mPHmFf4rxh+RWTQ6he4SOTkWF6HcUmeuWlKoY=; b=ZlfzmFE5LbrXlIvAbso49jhOeMskQMtKPjVSYjAPvpwpf3CXLuKjca9956Lh9sGdZr9ELM v+6zJJxRXHg86TqL+q2ZAjFBJ66ebXHrFxAcHO3Rb3zPyEDlKInpybbLoaiy75JYIkYwGU G0zlaMSGV5UFmU3oJcgAgl55cOTr0CU= X-MC-Unique: wCzTq9oLOGuinhReFPthPw-1 X-Mimecast-MFC-AGG-ID: wCzTq9oLOGuinhReFPthPw_1779314041 From: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Date: Thu, 21 May 2026 01:49:41 +0400 Subject: [PATCH 40/40] gitlab-ci: add --disable-hmp to build-without-defaults MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260521-qemu-no-hmp-v1-40-d104f809e145@redhat.com> References: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> In-Reply-To: <20260521-qemu-no-hmp-v1-0-d104f809e145@redhat.com> To: qemu-devel@nongnu.org Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Developer-Signature: v=1; a=openpgp-sha256; l=668; i=marcandre.lureau@redhat.com; h=from:subject:message-id; bh=mZ8OMPN2Q+JQ1r4midLfoS8ytaGoD+qhLAUx/0/VcKo=; b=owEBbQKS/ZANAwAKAdro4Ql1lpzlAcsmYgBqDiyEkW6sse0ISidGi+o47FQKHfeP8JGjb9vwx QcixwMk9SWJAjMEAAEKAB0WIQSHqb2TP4fGBtJ29i3a6OEJdZac5QUCag4shAAKCRDa6OEJdZac 5dyYD/42lBuW4gB3E4VKJOp75IqfUN47phmnFC40xl0OdTG8AY+q9+uZB09aXOrVKIkZEZHQYMs SIL0ArMBnCfKBj9ZH/Ns/+QS/G+kJBYrLA1bHggiDq151CUvzMkfh+3Fg6fs2hqJAeM4tx2WGT0 Jz5yOrQLORHfXXJkiziuPQbyDuCQba6ay9kk/J+w3YfpVts8po2rcSpGiuPkxh/3hgmGOnIcNC4 LkLStbrNgFdlrxE48706+JszF2+NalFpI3zuPcuJ1mKlVc4fiJ6UqQOiyNbFnitsJAnISRVYAKB MSqsviQd18985x6vNuH1rD9mG343dv1U9kBJuiZD5M+7UXS93Mhcqlt9/bNhmbqdM4Q8goxRNQz OTa8kRhi4fKs6957ZqSzB/4CqWDoHlgEHT13JwIOQz6N2nYrr7XxBOC2pm9b853OEN3/lhe/QYT B2ew9O742tj92JiXjOH2kD4tumrPJeK6nd0CBcKZ9L+eIkw17ZXlmXQeryR3FabvCdWfdL6TwyU l4xeu5FhI6DZSuBAs8zf005H6w0vrDfVYTNkHNLB4xexfx37pt48wdn4vBfWwZcGTF23F2GAxCk wW4Ltbq0r4CrIjWheGQ/E1NEF0Wltl2fs9C89+hIgYv7+KQhVajk2LkDHlEiNOhEqj+7A0TpYZL qAcg26XAIMkCVdg== 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_H5=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: 1779314081132154100 Test the HMP-disabled build configuration in CI to catch regressions when HMP is compiled out. Signed-off-by: Marc-Andr=C3=A9 Lureau --- .gitlab-ci.d/buildtest.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.d/buildtest.yml b/.gitlab-ci.d/buildtest.yml index 4b1949a3a52..e10b68820d6 100644 --- a/.gitlab-ci.d/buildtest.yml +++ b/.gitlab-ci.d/buildtest.yml @@ -661,6 +661,7 @@ build-without-defaults: --without-default-devices --without-default-features --disable-fdt + --disable-hmp --disable-pie --disable-qom-cast-debug --disable-strip --=20 2.54.0