The branch main has been updated by andrew:

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

commit cbc2e34613c48c0b7955d5d970dcc08cd52da9b4
Author:     Andrew Turner <and...@freebsd.org>
AuthorDate: 2025-06-23 12:27:10 +0000
Commit:     Andrew Turner <and...@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.moul...@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));
 

Reply via email to