From nobody Mon Nov 09 03:13:59 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4jNFHX0bmNz70SCc for ; Mon, 09 Nov 2026 03:14:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jNFHW3Zmhz3FdX for ; Mon, 09 Nov 2026 03:13:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794194039; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TYx/iZdUXvKrsEu+rHdgOxMYmuofZk7DEIYTZ4pz8gY=; b=VuPU8X4P4cxRbq2Ka3f2PZCGHKah4l+7QR4Ip/lzu5yCPIePSyKZHhGnevjstwJUvtJTkF ZxDet9b8hx+m42dFTXcWuf0jxezonQny/j/hY41lJUIIEN9qwZB30h9kHFtWW8mvW0GTu9 905UcY8GqweYbjB4HguKAlR3oXGMUdQO7QFQ/i6qIqL3iA2qnHnvlxix1iqwfRB4x2/D3I PBqWsq90lm4oIEdvqeY3D9g3hhYOKCj0zmJC9bjxiMiN+AtA930ZyIy41QwAwfeefg4yMM 957HP0xm5sZC8IRab/hu9gttnC1JNqcFex0SZ7IP6Pk5UePETV2epMlnMV9khw== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1794194039; b=Y9jN6gSQHE8lqyxTb9xYTBfAO9OP3OPz2ObhSS2/4znqLsBAbPCyXtvzLQHrkTVjWGLLYd SjlGJ0EK4YrCXij6zd1xWMCJNdbEVOSAYo6Qp4Xzdg9qFDYj9Stcf7SaWS7YizN0YjstxB xe1966bIi3eywNCMC2TkkOTM4cx1W6R/zGFEJbIWq44G7o1k627fVNU6ZlutAof1pCGuBB qZpiQTpYwrBeGyxHt59N1V9qE5ff7Ba/Zl27XyaVViQDowF8teqitM+/T8ksxsUZqckwYV MNu1U7L5BejGoOna+ZrGC2Hkgzl0VrbFpH18utfaFZm22/z1YeXQ0UKJav+9Mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794194039; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TYx/iZdUXvKrsEu+rHdgOxMYmuofZk7DEIYTZ4pz8gY=; b=I3ggrWNmlZHlFuPPerqzY4l2gcCCQJaNR1I5yZ8O5YHBXqwWYsOpuaXYl8Z47/aO+XKoTC lpM2HPJ3w5rlGsnmKdO+/x0LvZa1M1U1GvcWSUVfKSzF5bjSKVFYzA9PmgJdAm1YIQAsec rlAHBrTSIafmmrAgeazpxu/aKSysbrd0nYTgOQb4+EHtMCgRsG1dmHH2vmFzutPT2jXscZ 6Be0CMfthX52xHMKz94jTI78vGPMJgcBRTgXxmxAhJI6ZuYGyFqXmyhlpDcsKDqn8LCk2w exyrc7qjSvSiL7C7BHZT9G6y5lkbnnM5h2n/hvGetewx5+fmnK6IsXXJwC93WQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4jNFHW3C44zL78 for ; Mon, 09 Nov 2026 03:13:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 10cec by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 09 Nov 2026 03:13:59 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 1a10bff4ce47 - stable/15 - virtio_random: defer first enqueue until after DRIVER_OK List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: Commit messages for all branches of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 1a10bff4ce4772bb1611c286df8728cace5dfb65 Auto-Submitted: auto-generated Date: Mon, 09 Nov 2026 03:13:59 +0000 Message-Id: <6af13a77.10cec.2d44c342@gitrepo.freebsd.org> The branch stable/15 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=1a10bff4ce4772bb1611c286df8728cace5dfb65 commit 1a10bff4ce4772bb1611c286df8728cace5dfb65 Author: Kyle Evans AuthorDate: 2026-11-05 21:53:30 +0000 Commit: Kyle Evans CommitDate: 2026-11-09 03:12:24 +0000 virtio_random: defer first enqueue until after DRIVER_OK According to the virtio spec: > The driver MUST NOT send any buffer available notifications to the > device before setting DRIVER_OK. DRIVER_OK isn't set until after attach completes, so defer the first enqueue. We haven't found any problems as a result of this to the best of my knowledge: q35 and other devices that we *have* been used with will apparently check when we go DRIVER_OK. Tested with q35 virtio-random, which still works. Reported by: llm-postcr Reviewed by: kfv, markj Fixes: f1c5a2e3a62505 ("virtio_random: Pipeline fetching the data") Sponsored by: Stormshield Sponsored by: Klara, Inc. (cherry picked from commit 12f90bbd3029fedea93e9bb0b1f02c3afafe237b) --- sys/dev/virtio/random/virtio_random.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/sys/dev/virtio/random/virtio_random.c b/sys/dev/virtio/random/virtio_random.c index 774221bd2bfd..75addaaf322f 100644 --- a/sys/dev/virtio/random/virtio_random.c +++ b/sys/dev/virtio/random/virtio_random.c @@ -47,6 +47,8 @@ #include #include +#include "virtio_if.h" + struct vtrnd_softc { device_t vtrnd_dev; uint64_t vtrnd_features; @@ -69,6 +71,7 @@ static int vtrnd_setup_features(struct vtrnd_softc *); static int vtrnd_alloc_virtqueue(struct vtrnd_softc *); static int vtrnd_harvest(struct vtrnd_softc *, void *, size_t *); static void vtrnd_enqueue(struct vtrnd_softc *sc); +static int vtrnd_attach_completed(device_t); static unsigned vtrnd_read(void *, unsigned); #define VTRND_FEATURES 0 @@ -93,6 +96,9 @@ static device_method_t vtrnd_methods[] = { DEVMETHOD(device_detach, vtrnd_detach), DEVMETHOD(device_shutdown, vtrnd_shutdown), + /* Virtio methods. */ + DEVMETHOD(virtio_attach_completed, vtrnd_attach_completed), + DEVMETHOD_END }; @@ -181,8 +187,6 @@ vtrnd_attach(device_t dev) sc->inactive = false; random_source_register(&random_vtrnd); - vtrnd_enqueue(sc); - fail: if (error != 0) { /* Parent will free the virtqueue. */ @@ -340,3 +344,13 @@ vtrnd_read(void *buf, unsigned usz) return (sz); } + +static int +vtrnd_attach_completed(device_t dev) +{ + struct vtrnd_softc *sc; + + sc = device_get_softc(dev); + vtrnd_enqueue(sc); + return (0); +}