History log of /src/sys/dev/virtio/virtqueue.c (Results 1 – 25 of 194)
Revision Date Author Comments
# 1d13d938 17-Mar-2026 Sarah Walker <sarah.walker2@arm.com>

virtio: Ensure power-of-two alignment for indirect queue

Some platforms enforce power-of-two alignment for bus_dma tags. Rounding up
the natural size may result in over-alignment, but should be safe

virtio: Ensure power-of-two alignment for indirect queue

Some platforms enforce power-of-two alignment for bus_dma tags. Rounding up
the natural size may result in over-alignment, but should be safe.

PR: 293770
Reviewed by: andrew
Fixes: c499ad6f997c ("virtio: Use bus_dma for ring and indirect buffer allocations")
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D55843

show more ...


# 1a92fc9c 10-Mar-2026 Sarah Walker <sarah.walker2@arm.com>

virtio: Restore mb() calls

Until an issue seen on amd64 can be investigated restore two mb() calls
to virtio.

Reviewed by: andrew
Fixes: c499ad6f997c ("virtio: Use bus_dma for ring and indirect buf

virtio: Restore mb() calls

Until an issue seen on amd64 can be investigated restore two mb() calls
to virtio.

Reviewed by: andrew
Fixes: c499ad6f997c ("virtio: Use bus_dma for ring and indirect buffer allocations")
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D55766

show more ...


# 522012c8 10-Mar-2026 Andrew Turner <andrew@FreeBSD.org>

Revert "virtio: Restore mb() calls"

This reverts commit d99e725c26a7745aa349eab01ae56ca630b6d0f5.


# d99e725c 10-Mar-2026 Andrew Turner <andrew@FreeBSD.org>

virtio: Restore mb() calls

Until an issue seen on amd64 can be investigated restore two mb() calls
to virtio.

Reviewed by: andrew
Fixes: c499ad6f997c ("virtio: Use bus_dma for ring and indirect buf

virtio: Restore mb() calls

Until an issue seen on amd64 can be investigated restore two mb() calls
to virtio.

Reviewed by: andrew
Fixes: c499ad6f997c ("virtio: Use bus_dma for ring and indirect buffer allocations")
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D55766

show more ...


# c499ad6f 03-Mar-2026 Sarah Walker <sarah.walker2@arm.com>

virtio: Use bus_dma for ring and indirect buffer allocations

While the majority of virtio platforms will be fully coherent, some may
require cache maintenance or other specific device memory handlin

virtio: Use bus_dma for ring and indirect buffer allocations

While the majority of virtio platforms will be fully coherent, some may
require cache maintenance or other specific device memory handling (eg for
secure partitioning). Using bus_dma allows for these usecases.

The virtio buffers are marked as coherent; this should ensure that sync
calls are no-ops in the common cases.

Reviewed by: andrew
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D54959

show more ...


# f999ffdc 04-Nov-2025 Mark Johnston <markj@FreeBSD.org>

virtio: Fix polling in virtqueue_dequeue()

The access of vq->vq_ring.used->idx needs to be volatile-qualified,
otherwise the compiler may optimize virtqueue_poll() into an infinite
loop if there is

virtio: Fix polling in virtqueue_dequeue()

The access of vq->vq_ring.used->idx needs to be volatile-qualified,
otherwise the compiler may optimize virtqueue_poll() into an infinite
loop if there is no data available upon the first poll.

Prior to commit ad17789a8569 this wasn't a problem since an external
function call after each poll inhibited the optimization.

PR: 289930
MFC after: 3 days
Sponsored by: Klara, Inc.
Fixes: ad17789a8569 ("virtio: Remove the unused poll method")

show more ...


# ad17789a 20-Aug-2025 Andrew Turner <andrew@FreeBSD.org>

virtio: Remove the unused poll method

This was used by virtio_mmio to poll via another driver. This support
has been removed so we can remove it from here too.

Reviewed by: br
Sponsored by: Arm Ltd

virtio: Remove the unused poll method

This was used by virtio_mmio to poll via another driver. This support
has been removed so we can remove it from here too.

Reviewed by: br
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D51993

show more ...


# d1bdc282 23-Jul-2024 Bjoern A. Zeeb <bz@FreeBSD.org>

Deprecate contigfree(9) in favour of free(9)

As of 9e6544dd6e02c46b805d11ab925c4f3b18ad7a4b contigfree(9) is no longer
needed and should not be used anymore. We leave a wrapper for 3rd party
code i

Deprecate contigfree(9) in favour of free(9)

As of 9e6544dd6e02c46b805d11ab925c4f3b18ad7a4b contigfree(9) is no longer
needed and should not be used anymore. We leave a wrapper for 3rd party
code in at least 15.x but remove (almost) all other cases from the tree.

This leaves one use of contigfree(9) untouched; that was the original
trigger for 9e6544dd6e02 and is handled in D45813 (to be committed
seperately later).

Sponsored by: The FreeBSD Foundation
Reviewed by: markj, kib
Tested by: pho (10h stress test run)
Differential Revision: https://reviews.freebsd.org/D46099

show more ...


# fdafd315 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

sys: Automated cleanup of cdefs and other formatting

Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remov

sys: Automated cleanup of cdefs and other formatting

Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by: Netflix

show more ...


# ccb576a8 18-Sep-2023 Mina Galić <freebsd@igalic.co>

virtio: use bool for boolean functions

Summary:
these static functions:
- vq_ring_use_indirect

and these public functions:
- virtio_bus_is_modern
- virtio_with_feature
- virtqueue_empty
- virtqueue

virtio: use bool for boolean functions

Summary:
these static functions:
- vq_ring_use_indirect

and these public functions:
- virtio_bus_is_modern
- virtio_with_feature
- virtqueue_empty
- virtqueue_full

exclusively return a boolean value.
Change their return values to bool.

Sponsored by: The FreeBSD Foundation

Reviewers: bryanv

Reviewed By: bryanv

Subscribers: cognet, imp

Differential Revision: https://reviews.freebsd.org/D41848

show more ...


# 685dc743 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 4d846d26 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix

show more ...


# fd80208a 27-Aug-2021 Stephen J. Kiernan <stevek@FreeBSD.org>

Add SDT probes virtqueue::enqueue_segments:{entry,return}

This allows one to be able to map the sglist entries passed into the
vq_ring_enqueue_segments() function to the segment indexes used in
the

Add SDT probes virtqueue::enqueue_segments:{entry,return}

This allows one to be able to map the sglist entries passed into the
vq_ring_enqueue_segments() function to the segment indexes used in
the virtqueue.

This function normally gets inlined and may not available via FBT
probes.

Differential Revision: https://reviews.freebsd.org/D31620

show more ...


# fbe0c4f4 19-Jan-2021 Bryan Venteicher <bryanv@FreeBSD.org>

virtio: Add modern (v1) virtqueue support

This only supports the legacy virtqueue format that is now called
"Split Virtqueues". Support for the new "Packed Virtqueues" described
in v1.1 is left for

virtio: Add modern (v1) virtqueue support

This only supports the legacy virtqueue format that is now called
"Split Virtqueues". Support for the new "Packed Virtqueues" described
in v1.1 is left for a later date.

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27857

show more ...


# 9da9560c 19-Jan-2021 Bryan Venteicher <bryanv@FreeBSD.org>

virtio: Add VirtIO PCI modern (V1) support

Use the existing legacy PCI driver as the basis for shared code
between the legacy and modern PCI drivers. The existing virtio_pci
kernel module will conta

virtio: Add VirtIO PCI modern (V1) support

Use the existing legacy PCI driver as the basis for shared code
between the legacy and modern PCI drivers. The existing virtio_pci
kernel module will contain both the legacy and modern drivers.

Changes to the virtqueue and each device driver (network, block, etc)
for V1 support come in later commits.

Update the MMIO driver to reflect the VirtIO bus method changes, but
the modern compliance can be improved on later.

Note that the modern PCI driver requires bus_map_resource() to be
implemented, which is not the case on all archs.

The hw.virtio.pci.transitional tunable default value is zero so
transitional devices will continue to be driven via the legacy
driver.

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27856

show more ...


# 1cd1ed3f 19-Jan-2021 Bryan Venteicher <bryanv@FreeBSD.org>

Revert: virtio: Support non-legacy network device and queue

And subsequent fix 576b099a.

By adding the mergable header to the vtnet_rx_header structure, the size
was increased by 2 bytes, breaking

Revert: virtio: Support non-legacy network device and queue

And subsequent fix 576b099a.

By adding the mergable header to the vtnet_rx_header structure, the size
was increased by 2 bytes, breaking the alignment of this structure as
described the in preceding comments.

Furthermore, the mergable header does not belong the structure. With the
mergable feature, the header is placed in line with the data, so there is
no need for a separate segment, and misleading to follow the mergable
header with any padding.

The V1 header is effectively identical to mergable header, and the driver
has long supported the mergable feature. Revert this so the later changes
that add V1 support can show how V1 is derived from the existing mergable
buffers support, and to facilitate a later MFC.

Reviewed by: grehan (mentor)
Differential Revision: https://reviews.freebsd.org/D27855

show more ...


# 8c3988df 08-Jun-2020 Jessica Clarke <jrtc27@FreeBSD.org>

virtio: Support non-legacy network device and queue

The non-legacy interface always defines num_buffers in the header,
regardless of whether VIRTIO_NET_F_MRG_RXBUF, just leaving it unused. We
also n

virtio: Support non-legacy network device and queue

The non-legacy interface always defines num_buffers in the header,
regardless of whether VIRTIO_NET_F_MRG_RXBUF, just leaving it unused. We
also need to ensure our virtqueue doesn't filter out VIRTIO_F_VERSION_1
during negotiation, as it supports non-legacy transports just fine. This
fixes network packet transmission on TinyEMU.

Reviewed by: br, brooks (mentor), jhb (mentor)
Approved by: br, brooks (mentor), jhb (mentor)
Differential Revision: https://reviews.freebsd.org/D25132

show more ...


# f999ffdc 04-Nov-2025 Mark Johnston <markj@FreeBSD.org>

virtio: Fix polling in virtqueue_dequeue()

The access of vq->vq_ring.used->idx needs to be volatile-qualified,
otherwise the compiler may optimize virtqueue_poll() into an infinite
loop if there is

virtio: Fix polling in virtqueue_dequeue()

The access of vq->vq_ring.used->idx needs to be volatile-qualified,
otherwise the compiler may optimize virtqueue_poll() into an infinite
loop if there is no data available upon the first poll.

Prior to commit ad17789a8569 this wasn't a problem since an external
function call after each poll inhibited the optimization.

PR: 289930
MFC after: 3 days
Sponsored by: Klara, Inc.
Fixes: ad17789a8569 ("virtio: Remove the unused poll method")

show more ...


# ad17789a 20-Aug-2025 Andrew Turner <andrew@FreeBSD.org>

virtio: Remove the unused poll method

This was used by virtio_mmio to poll via another driver. This support
has been removed so we can remove it from here too.

Reviewed by: br
Sponsored by: Arm Ltd

virtio: Remove the unused poll method

This was used by virtio_mmio to poll via another driver. This support
has been removed so we can remove it from here too.

Reviewed by: br
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D51993

show more ...


# d1bdc282 23-Jul-2024 Bjoern A. Zeeb <bz@FreeBSD.org>

Deprecate contigfree(9) in favour of free(9)

As of 9e6544dd6e02c46b805d11ab925c4f3b18ad7a4b contigfree(9) is no longer
needed and should not be used anymore. We leave a wrapper for 3rd party
code i

Deprecate contigfree(9) in favour of free(9)

As of 9e6544dd6e02c46b805d11ab925c4f3b18ad7a4b contigfree(9) is no longer
needed and should not be used anymore. We leave a wrapper for 3rd party
code in at least 15.x but remove (almost) all other cases from the tree.

This leaves one use of contigfree(9) untouched; that was the original
trigger for 9e6544dd6e02 and is handled in D45813 (to be committed
seperately later).

Sponsored by: The FreeBSD Foundation
Reviewed by: markj, kib
Tested by: pho (10h stress test run)
Differential Revision: https://reviews.freebsd.org/D46099

show more ...


# fdafd315 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

sys: Automated cleanup of cdefs and other formatting

Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remov

sys: Automated cleanup of cdefs and other formatting

Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by: Netflix

show more ...


# ccb576a8 18-Sep-2023 Mina Galić <freebsd@igalic.co>

virtio: use bool for boolean functions

Summary:
these static functions:
- vq_ring_use_indirect

and these public functions:
- virtio_bus_is_modern
- virtio_with_feature
- virtqueue_empty
- virtqueue

virtio: use bool for boolean functions

Summary:
these static functions:
- vq_ring_use_indirect

and these public functions:
- virtio_bus_is_modern
- virtio_with_feature
- virtqueue_empty
- virtqueue_full

exclusively return a boolean value.
Change their return values to bool.

Sponsored by: The FreeBSD Foundation

Reviewers: bryanv

Reviewed By: bryanv

Subscribers: cognet, imp

Differential Revision: https://reviews.freebsd.org/D41848

show more ...


# 685dc743 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 4d846d26 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix

show more ...


# fd80208a 27-Aug-2021 Stephen J. Kiernan <stevek@FreeBSD.org>

Add SDT probes virtqueue::enqueue_segments:{entry,return}

This allows one to be able to map the sglist entries passed into the
vq_ring_enqueue_segments() function to the segment indexes used in
the

Add SDT probes virtqueue::enqueue_segments:{entry,return}

This allows one to be able to map the sglist entries passed into the
vq_ring_enqueue_segments() function to the segment indexes used in
the virtqueue.

This function normally gets inlined and may not available via FBT
probes.

Differential Revision: https://reviews.freebsd.org/D31620

show more ...


12345678