Module Name:    src
Committed By:   riastradh
Date:           Mon Aug  5 19:13:34 UTC 2024

Modified Files:
        src/sys/dev/virtio: viocon.c

Log Message:
viocon(4): Defer viocon_rx_fill til after virtio_child_attach_finish.

Since virtio.c 1.66, virtqueue_enqueue* can't be used until after
virtio_child_attach_finish completes.

https://mail-index.netbsd.org/source-changes/2023/03/23/msg143799.html

PR kern/58555: Kernel panic during boot when using viocon with PCIe


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/virtio/viocon.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/virtio/viocon.c
diff -u src/sys/dev/virtio/viocon.c:1.9 src/sys/dev/virtio/viocon.c:1.10
--- src/sys/dev/virtio/viocon.c:1.9	Sun Apr 16 18:37:16 2023
+++ src/sys/dev/virtio/viocon.c	Mon Aug  5 19:13:34 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: viocon.c,v 1.9 2023/04/16 18:37:16 riastradh Exp $	*/
+/*	$NetBSD: viocon.c,v 1.10 2024/08/05 19:13:34 riastradh Exp $	*/
 /*	$OpenBSD: viocon.c,v 1.8 2021/11/05 11:38:29 mpi Exp $	*/
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: viocon.c,v 1.9 2023/04/16 18:37:16 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: viocon.c,v 1.10 2024/08/05 19:13:34 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -222,12 +222,13 @@ viocon_attach(struct device *parent, str
 		printf("\n%s: viocon_port_create failed\n", __func__);
 		goto err;
 	}
-	viocon_rx_fill(sc->sc_ports[0]);
 
 	if (virtio_child_attach_finish(vsc, sc->sc_vqs, nvqs,
 	    /*config_change*/NULL, /*req_flags*/0) != 0)
 		goto err;
 
+	viocon_rx_fill(sc->sc_ports[0]);
+
 	return;
 err:
 	kmem_free(sc->sc_vqs, nvqs * sizeof(sc->sc_vqs[0]));

Reply via email to