Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Jun 2025 13:20:04 GMT
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: cbc2e34613c4 - main - virtio_blk: Limit use of indirect descriptors
Message-ID:  <202506231320.55NDK4A1094245@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by andrew:

URL: https://cgit.FreeBSD.org/src/commit/?id=cbc2e34613c48c0b7955d5d970dcc08cd52da9b4

commit cbc2e34613c48c0b7955d5d970dcc08cd52da9b4
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2025-06-23 12:27:10 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2025-06-23 12:55:24 +0000

    virtio_blk: Limit use of indirect descriptors
    
    Pass 0 as the number of indirect descriptors when they are not
    supported.
    
    This fixes an issue on the Arm FVP model where we don't negotiate
    them, however pass a number of segments greater than
    VIRTIO_MAX_INDIRECT. This leads to virtqueue_alloc failing and
    virtio_blk failing to attach.
    
    Reviewed by:    Harry Moulton <harry.moulton@arm.com>
    Sponsored by:   Arm Ltd
    Differential Revision:  https://reviews.freebsd.org/D50909
---
 sys/dev/virtio/block/virtio_blk.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/sys/dev/virtio/block/virtio_blk.c b/sys/dev/virtio/block/virtio_blk.c
index 76068c91df11..5eb681128e9c 100644
--- a/sys/dev/virtio/block/virtio_blk.c
+++ b/sys/dev/virtio/block/virtio_blk.c
@@ -699,10 +699,14 @@ vtblk_alloc_virtqueue(struct vtblk_softc *sc)
 {
 	device_t dev;
 	struct vq_alloc_info vq_info;
+	int indir_segs;
 
 	dev = sc->vtblk_dev;
 
-	VQ_ALLOC_INFO_INIT(&vq_info, sc->vtblk_max_nsegs,
+	indir_segs = 0;
+	if (sc->vtblk_flags & VTBLK_FLAG_INDIRECT)
+		indir_segs = sc->vtblk_max_nsegs;
+	VQ_ALLOC_INFO_INIT(&vq_info, indir_segs,
 	    vtblk_vq_intr, sc, &sc->vtblk_vq,
 	    "%s request", device_get_nameunit(dev));
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202506231320.55NDK4A1094245>