Date: Tue, 28 Apr 2026 21:35:51 +0200 From: Michael Tuexen <tuexen@FreeBSD.org> To: Adrian Chadd <adrian@freebsd.org> Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org, =?utf-8?Q?Timo_V=C3=B6lker?= <timo.voelker@fh-muenster.de> Subject: Re: git: 0b39d72d0491 - main - virtio: use modern mode for transitional device by default Message-ID: <9DE75A83-7A39-4BE1-9663-DCF08D146584@FreeBSD.org> In-Reply-To: <CAJ-Vmo=HG0uqJijd_w49wPC7Yhd=tQjsc_ik8b1POb7GXYBGLg@mail.gmail.com> References: <69d12614.3d42a.5c3f48a2@gitrepo.freebsd.org> <CAJ-Vmo=HG0uqJijd_w49wPC7Yhd=tQjsc_ik8b1POb7GXYBGLg@mail.gmail.com>
index | next in thread | previous in thread | raw e-mail
> On 28. Apr 2026, at 18:54, Adrian Chadd <adrian@freebsd.org> wrote: > > hi! > > FWIW, this has broken virtio on qemu ppc64 pseries VMs: > > ``` > vtnet0: <VirtIO Networking Adapter> numa-domain 0 on virtio_pci0 > virtio_pci0: virtqueue 1 (vtnet0-tx0) does not exist (size is zero) > virtio_pci0: cannot allocate virtqueue 1: 19 > vtnet0: cannot allocate virtqueues > device_attach: vtnet0 attach returned 19 > virtio_pci1: <VirtIO PCI (modern) Block adapter> port 0x100-0x17f mem > 0x81040000-0x81040fff,0x210000010000-0x210000013fff irq 4611 at device > 3.0 numa-domain 0 on pci0 > vtblk0: <VirtIO Block Adapter> numa-domain 0 on virtio_pci1 > qemu-system-ppc64: wrong value for queue_enable 100 > ``` > > Is there any way to detect that we're running in an environment where > the new way won't work? > > The snippet in my qemu setup is: > > ``` > -drive file=ppc64be-1.qcow2,format=qcow2,id=hd0,if=none \ > -device virtio-blk-pci,drive=hd0 \ > -drive file=ppc64be-data.qcow2,format=qcow2,id=hd1,if=none \ > -device virtio-blk-pci,drive=hd1 \ > -netdev tap,id=nd0,ifname=tap1 -device > virtio-net,netdev=nd0,mac=00:08:01:13:00:01 > ``` > Hi Adrian, we are aware of the problem and Timo is investigating it. It seems to be a bug in the modern mode in FreeBSD and the bug is related to the guest OS being big endian. Until there is a fix, you can work around the problem by setting hw.virtio.pci.transitional=0 in /boot/loader.conf of the guest OS. Best regards Michael > > -adrian > > On Sat, 4 Apr 2026 at 07:54, Michael Tuexen <tuexen@freebsd.org> wrote: >> >> The branch main has been updated by tuexen: >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=0b39d72d0491c77e3e9883015b1fac46663c71de >> >> commit 0b39d72d0491c77e3e9883015b1fac46663c71de >> Author: Timo Völker <timo.voelker@fh-muenster.de> >> AuthorDate: 2026-04-04 14:49:54 +0000 >> Commit: Michael Tuexen <tuexen@FreeBSD.org> >> CommitDate: 2026-04-04 14:49:54 +0000 >> >> virtio: use modern mode for transitional device by default >> >> This patch changes the default value of the loader tunable >> hw.virtio.pci.transitional to 1. This means, virtio uses the >> modern mode for transitional devices by default. >> >> The return values of vtpci_modern_probe() and vtpci_legacy_probei() >> were chosen to prefer modern mode, but hw.virtio.pci.transitional=0 >> prevents modern mode. >> Setting hw.virtio.pci.transitional to 1 by default seems a better fit. >> >> Reviewed by: tuexen >> Differential Revision: https://reviews.freebsd.org/D55894 >> --- >> share/man/man4/virtio.4 | 2 +- >> sys/dev/virtio/pci/virtio_pci_modern.c | 2 +- >> 2 files changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/share/man/man4/virtio.4 b/share/man/man4/virtio.4 >> index 8252cc1b7954..6af6300b1cee 100644 >> --- a/share/man/man4/virtio.4 >> +++ b/share/man/man4/virtio.4 >> @@ -114,7 +114,7 @@ use the legacy >> .Nm >> driver >> .Pq 0 . >> -The default value is 0. >> +The default value is 1. >> .El >> .Sh SEE ALSO >> .Xr virtio_balloon 4 , >> diff --git a/sys/dev/virtio/pci/virtio_pci_modern.c b/sys/dev/virtio/pci/virtio_pci_modern.c >> index 108fd2b5f8e9..baf7c448bb95 100644 >> --- a/sys/dev/virtio/pci/virtio_pci_modern.c >> +++ b/sys/dev/virtio/pci/virtio_pci_modern.c >> @@ -191,7 +191,7 @@ static void vtpci_modern_write_device_8(struct vtpci_modern_softc *, >> /* Tunables. */ >> SYSCTL_DECL(_hw_virtio_pci); >> >> -static int vtpci_modern_transitional = 0; >> +static int vtpci_modern_transitional = 1; >> SYSCTL_INT(_hw_virtio_pci, OID_AUTO, transitional, CTLFLAG_RDTUN, >> &vtpci_modern_transitional, 0, >> "If 0, a transitional VirtIO device is used in legacy mode; otherwise, in modern mode."); >>home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9DE75A83-7A39-4BE1-9663-DCF08D146584>
