From nobody Sat Apr 11 17:07:31 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=none dis=none) header.from=linux.microsoft.com ARC-Seal: i=1; a=rsa-sha256; t=1775735644; cv=none; d=zohomail.com; s=zohoarc; b=f4tB/uJOeLKbisKKms1HO3AFLGFuooGxJMdOZhoE7yS6VP0+0HcRXJvH5vf47X+8YoQoT3Sng+MgbgeML/Mpjrwu0ki3m4hgnKLXRGK9pL2eGyA5L9h3oLAQfSRBKo019Am5CHpGiOMdf3xor9okYD1seViZAu+u1KWeuCFTaIw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1775735644; 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=A2gkHzyyrgJ48tKH/NCs6vPTaw/e/Fxg1+vebw64BvU=; b=gCm3Thx3ObMxa0AvAFp5fbthKM4h2wQrGuGfMpguWrZQdkyidBt4cj5tqI1Drkh4yLoIDc7IOIhyQbnklRSDAmtsc5h/oYhTqf/iZ6kTAjlTTo0T8na6Iw25Kvp/+ItovQU0VYbAa2Dvu4etsmpwlndwYqtBA7IsWoadTB3MW18= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1775735644475244.8947806384823; Thu, 9 Apr 2026 04:54:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wAnx9-0006Fm-SO; Thu, 09 Apr 2026 07:53: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 1wAnx8-0006FR-Ue for qemu-devel@nongnu.org; Thu, 09 Apr 2026 07:53:42 -0400 Received: from linux.microsoft.com ([13.77.154.182]) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wAnx7-0000DX-E8 for qemu-devel@nongnu.org; Thu, 09 Apr 2026 07:53:42 -0400 Received: from localhost (unknown [131.107.147.136]) by linux.microsoft.com (Postfix) with ESMTPSA id 5106420B710C; Thu, 9 Apr 2026 04:53:39 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 5106420B710C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1775735619; bh=A2gkHzyyrgJ48tKH/NCs6vPTaw/e/Fxg1+vebw64BvU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=d0QaIUOGkgNgLtMF7F4SnXDYriMh3mO/8k0r79DN+v/69py14Pylv09AVzopb6gnS Q7AE3YQJzqJfhJy8/cr3HfiOY/8ADXbVSclCGK/5YvziSDgkN1lTl6xq6xx0EXWE1i QVSK5GaUtyQco7vIHjTghA3KVIoEvSh4roepkzrE= From: Aastha Rawat Date: Thu, 09 Apr 2026 11:53:06 +0000 Subject: [PATCH 1/2] accel/mshv: fix ioeventfd deassignment to forward correct datamatch value MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260409-fix_ioevent-v1-1-053b810ae6fb@linux.microsoft.com> References: <20260409-fix_ioevent-v1-0-053b810ae6fb@linux.microsoft.com> In-Reply-To: <20260409-fix_ioevent-v1-0-053b810ae6fb@linux.microsoft.com> To: qemu-devel@nongnu.org Cc: Magnus Kulke , Wei Liu , Aastha Rawat X-Mailer: b4 0.15.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=13.77.154.182; envelope-from=aastharawat@linux.microsoft.com; helo=linux.microsoft.com X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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 @linux.microsoft.com) X-ZM-MESSAGEID: 1775735647224154100 unregister_ioevent() is not forwarding the datamatch (queue index) to the mshv driver, causing only the first VirtIO-MMIO queue to be deassigned correctly. Subsequent queues fail with `-ENOENT`, triggering a fatal abort(). This failure was discovered while booting arm64 EDK2 firmware with mshv accel. Signed-off-by: Aastha Rawat Reviewed-by: Magnus Kulke --- accel/mshv/mshv-all.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/accel/mshv/mshv-all.c b/accel/mshv/mshv-all.c index d4cc7f5371..e1a8d62f8d 100644 --- a/accel/mshv/mshv-all.c +++ b/accel/mshv/mshv-all.c @@ -278,13 +278,22 @@ static int ioeventfd(int vm_fd, int event_fd, uint64_= t addr, Datamatch dm, return ioctl(vm_fd, MSHV_IOEVENTFD, &args); } =20 -static int unregister_ioevent(int vm_fd, int event_fd, uint64_t mmio_addr) +static int unregister_ioevent(int vm_fd, int event_fd, uint64_t mmio_addr, + uint64_t data, uint32_t len, bool data_match) { uint32_t flags =3D 0; Datamatch dm =3D {0}; =20 flags |=3D BIT(MSHV_IOEVENTFD_BIT_DEASSIGN); - dm.tag =3D DATAMATCH_NONE; + if (!data_match) { + dm.tag =3D DATAMATCH_NONE; + } else if (len =3D=3D sizeof(uint64_t)) { + dm.tag =3D DATAMATCH_U64; + dm.value.u64 =3D data; + } else { + dm.tag =3D DATAMATCH_U32; + dm.value.u32 =3D data; + } =20 return ioeventfd(vm_fd, event_fd, mmio_addr, dm, flags); } @@ -337,11 +346,12 @@ static void mem_ioeventfd_del(MemoryListener *listene= r, int fd =3D event_notifier_get_fd(e); int ret; uint64_t addr =3D section->offset_within_address_space; + uint64_t len =3D int128_get64(section->size); =20 trace_mshv_mem_ioeventfd_del(section->offset_within_address_space, int128_get64(section->size), data); =20 - ret =3D unregister_ioevent(mshv_state->vm, fd, addr); + ret =3D unregister_ioevent(mshv_state->vm, fd, addr, data, len, match_= data); if (ret < 0) { error_report("Failed to unregister ioeventfd: %s (%d)", strerror(-= ret), -ret); --=20 2.45.4 From nobody Sat Apr 11 17:07:31 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=none dis=none) header.from=linux.microsoft.com ARC-Seal: i=1; a=rsa-sha256; t=1775735650; cv=none; d=zohomail.com; s=zohoarc; b=Nd8OBTJSETbWMplYXkndirMy72hPMoaR+nY9et0F/3Chuy/OknxvKUB55KBSSI2WIu+oZQptvIzdb8lqDmUdB2xzFC+ta0mDVC8ZTuCh471iSMBZLHAmcWaM6U0LlMV9ejUhwzBBE8yREbzQeCy83Pcm2XbxA3qUHl+zropmkcw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1775735650; 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=968+R5QinbpCMEGNp1o9WJBEA7Zubhh3wG4nw0uiz5U=; b=kLlDXmr3mYPb0vdMBPAQh8SEZEUccfJJb8bgcVdra6MY1ldj2SqC59pzMM4CcZ5VmOs9degvSxNsljiZUDAWoa2DlWgLjTONhzgqe0KNAdpz/jN8iRBMud9iWJNJPy0z+TzgLizNbgPjmeq87RQQeoCsCFdIvzRk0lzzZYXd+sE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1775735650660793.2092460795627; Thu, 9 Apr 2026 04:54:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wAnxB-0006Gg-7l; Thu, 09 Apr 2026 07:53: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 1wAnx9-0006Fo-UN for qemu-devel@nongnu.org; Thu, 09 Apr 2026 07:53:43 -0400 Received: from linux.microsoft.com ([13.77.154.182]) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wAnx7-0000Fi-Oq for qemu-devel@nongnu.org; Thu, 09 Apr 2026 07:53:43 -0400 Received: from localhost (unknown [131.107.147.136]) by linux.microsoft.com (Postfix) with ESMTPSA id EAAD420B7129; Thu, 9 Apr 2026 04:53:39 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com EAAD420B7129 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1775735620; bh=968+R5QinbpCMEGNp1o9WJBEA7Zubhh3wG4nw0uiz5U=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=KJ/69FkYLGBQbAY9zNUksU0eKSJW/rU/B7jj/92p7dHfZVWCz0P7L0tC6Au/unfKd 3tt2BVlCsrJfuf8jkHmuVKI8WIzHIbth7WuXv2wZ396MLCbxvDQeVUxSLgr+j7v6Zq M/VXJc3e1mN6In/VOCJbSLWRyyXKjEDG9aIPV7os= From: Aastha Rawat Date: Thu, 09 Apr 2026 11:53:07 +0000 Subject: [PATCH 2/2] accel/mshv: return correct errno value from ioeventfd failure MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260409-fix_ioevent-v1-2-053b810ae6fb@linux.microsoft.com> References: <20260409-fix_ioevent-v1-0-053b810ae6fb@linux.microsoft.com> In-Reply-To: <20260409-fix_ioevent-v1-0-053b810ae6fb@linux.microsoft.com> To: qemu-devel@nongnu.org Cc: Magnus Kulke , Wei Liu , Aastha Rawat X-Mailer: b4 0.15.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=13.77.154.182; envelope-from=aastharawat@linux.microsoft.com; helo=linux.microsoft.com X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=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 @linux.microsoft.com) X-ZM-MESSAGEID: 1775735653102154100 Returning the raw ioctl return value results in misleading error message. Ensure that actual failure reason is propagated by returning -errno for ioeventfd failure. Signed-off-by: Aastha Rawat Reviewed-by: Magnus Kulke --- accel/mshv/mshv-all.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/accel/mshv/mshv-all.c b/accel/mshv/mshv-all.c index e1a8d62f8d..58af674bd9 100644 --- a/accel/mshv/mshv-all.c +++ b/accel/mshv/mshv-all.c @@ -275,7 +275,12 @@ static int ioeventfd(int vm_fd, int event_fd, uint64_t= addr, Datamatch dm, } } =20 - return ioctl(vm_fd, MSHV_IOEVENTFD, &args); + int ret =3D ioctl(vm_fd, MSHV_IOEVENTFD, &args); + if (ret < 0) { + return -errno; + } + + return ret; } =20 static int unregister_ioevent(int vm_fd, int event_fd, uint64_t mmio_addr, --=20 2.45.4