NetBSD Problem Report #60297
From www@netbsd.org Thu May 28 04:04:53 2026
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits)
client-signature RSA-PSS (2048 bits))
(Client CN "mail.netbsd.org", Issuer "R13" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id A48B91A9239
for <gnats-bugs@gnats.NetBSD.org>; Thu, 28 May 2026 04:04:53 +0000 (UTC)
Message-Id: <20260528040452.817E01A923B@mollari.NetBSD.org>
Date: Thu, 28 May 2026 04:04:52 +0000 (UTC)
From: isaki@pastel-flower.jp
Reply-To: isaki@pastel-flower.jp
To: gnats-bugs@NetBSD.org
Subject: virtio(4) polling is not properly supported for MMIO
X-Send-Pr-Version: www-1.0
X-From4GNATS: "isaki@pastel-flower.jp via gnats" <gnats-admin@NetBSD.org>
>Number: 60297
>Category: kern
>Synopsis: virtio(4) polling is not properly supported for MMIO
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu May 28 04:05:01 +0000 2026
>Originator: Tetsuya Isaki
>Release: NetBSD-current 20260520
>Organization:
>Environment:
NetBSD 11.99.6 virt68k
>Description:
Current virtio(4) implementation does not perform interrupt
acknowledge when polling in MMIO.
In VirtIO specification
( https://docs.oasis-open.org/virtio/virtio/v1.3/virtio-v1.3.html ),
for PCI, the interrupt signal is automatically de-asserted when
the ISR is read. However, for MMIO, the interrupt signal must be
de-asserted manually after reading the ISR.
| 4.1 Virtio Over PCI Bus
...
| 4.1.4.5 ISR status capability
...
| To avoid an extra access, simply reading this register resets it to 0
| and causes the device to de-assert the interrupt.
| In this way, driver read of ISR status causes the device to de-assert
| an interrupt.
| 4.2 Virtio Over MMIO
...
| 4.2.3.4.1 Driver Requirements: Notifications From The Device
...
| After the interrupt is handled, the driver MUST acknowledge it by
| writing a bit mask corresponding to the handled events to the
| InterruptACK register
In MMIO mode, this interrupt acknowledge is properly performed by the
interrupt handler, virtio_mmio_intr (sys/dev/virtio/virtio_mmio.c).
However, this is not performed in the polling.
This is cause of spurious interrupt on virt68k that uses MMIO.
1. ld_virtio_attach issues a VirtIO command and waits by polling.
2. When the command completes, the interrupt status is asserted (but
system interrupts are disabled at this point).
3. the virtio driver dequeues the result.
4. Once device enumeration finished, the kernel enables the system
interrupts.
5. Then, virtio interrupt is immediately raised (because
the interrupt is still asserted).
6. virtio interrupt handler then checks the virtio queue but the queue
is empty (because already dequeued at step 3). So the interrupt
handler returns 0 (= not handled).
>How-To-Repeat:
Boot NetBSD/virt68k-current with ld@virtio.
Even QEMU can reproduce it.
>Fix:
N/A
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.