aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/virtio/virtio.h
Commit message (Collapse)AuthorAgeFilesLines
* sys: Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-231-2/+0
| | | | | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/ Similar commit in current: (cherry picked from commit 95ee2897e98f)
* virtio: make the write_config buffer argument constAlex Richardson2022-05-071-1/+1
| | | | | | | | | | No functional change intended, but noticed that we could add const here while adding linuxkpi support for virtio. Reviewed By: bryanv, imp Differential Revision: https://reviews.freebsd.org/D32370 (cherry picked from commit 6c4f95161d6e38ba3fd50ca1cceee3110cbfa02e)
* bhyve: virtio shares definitions between sys/dev/virtioKa Ho Ng2021-08-121-0/+4
| | | | | | | | | | | | | | Definitions inside usr.sbin/bhyve/virtio.h are thrown away. Definitions in sys/dev/virtio are used instead. This reduces code duplication. Sponsored by: The FreeBSD Foundation Reviewed by: grehan Approved by: philip (mentor) Differential Revision: https://reviews.freebsd.org/D29084 (cherry picked from commit 54ac6f721efccdba5a09aa9f38be0a1c4ef6cf14)
* virtio: Reduce boilerplate for device driver module definitionsJessica Clarke2021-01-211-4/+9
| | | | | | | | | | | Rather than have every device register itself for both virtio_pci and virtio_mmio, provide a VIRTIO_DRIVER_MODULE wrapper to declare both, merge VIRTIO_SIMPLE_PNPTABLE with VIRTIO_SIMPLE_PNPINFO and make the latter register for both buses. This also has the benefit of abstracting away the available transports and their names. Reviewed by: bryanv Differential Revision: https://reviews.freebsd.org/D28073
* virtio_pci: Add sysctl to show current featuresBryan Venteicher2021-01-191-1/+4
| | | | | Reviewed by: grehan (mentor) Differential Revision: https://reviews.freebsd.org/D27898
* virtio: Add VirtIO PCI modern (V1) supportBryan Venteicher2021-01-191-0/+8
| | | | | | | | | | | | | | | | | | | | | | 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
* virtio(4): Add PNP match metadata for virtio devicesConrad Meyer2019-06-041-0/+25
| | | | | | | | | | | | | | Register MODULE_PNP_INFO for virtio devices using the newbus PNP information provided by the previous commit. Matching can be quite simple; existing probe routines only matched on bus (implicit) and device_type. The same matching criteria are retained exactly, but is now also available to devmatch(8). Reviewed by: bryanv, markj; imp (earlier version) Differential Revision: https://reviews.freebsd.org/D20407 Notes: svn path=/head/; revision=348599
* virtio(4): Expose PNP metadata through newbusConrad Meyer2019-06-041-0/+2
| | | | | | | | | | | | | | | | | | | Expose the same fields and widths from both vtio buses, even though they don't quite line up; several virtio drivers can attach to both buses, and sharing a PNP info table for both seems more convenient. In practice, I doubt any virtio driver really needs to match on anything other than bus and device_type (eliminating the unused entries for vtmmio), and also in practice device_type is << 2^16 (so far, values range from 1 to 20). So it might be fine to only expose a 16-bit device_type for PNP purposes. On the other hand, I don't see much harm in overkill here. Reviewed by: bryanv, markj (earlier version) Differential Revision: https://reviews.freebsd.org/D20406 Notes: svn path=/head/; revision=348598
* Add VirtIO bus config_generation methodBryan Venteicher2018-02-191-0/+1
| | | | | | | | | | VirtIO buses (PCI, MMIO) can provide a generation field so a driver can ensure either a 64-bit or array read was stable. MFC after: 2 weeks Notes: svn path=/head/; revision=329601
* sys/dev: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-201-0/+2
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 3-Clause license. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Notes: svn path=/head/; revision=326022
* Move the VIRTIO_RING_F_* defines out of virtqueue.h into virtio_config.hBryan Venteicher2014-06-161-0/+1
| | | | | | | | | | | | | | These defines are applicable to userland too, but virtqueue.h contains the kernel virtqueue interface, and is therefore not usable in userland. Note that Linux places these defines in virtio_ring.h, but I don't want the drivers including this header file to keep the VirtIO ring opaque to everything but the virtqueue. MFC after: 1 week Notes: svn path=/head/; revision=267522
* Split the virtio.h header file into multiple filesBryan Venteicher2014-06-011-54/+17
| | | | | | | | | | | Reorganize the previous contexts of the file as it is in Linux. The eventual goal is to install the header files and share them between the kernel and bhyve. MFC after: 1 week Notes: svn path=/head/; revision=266951
* Merge virtio_pci changes from projects/virtioBryan Venteicher2013-07-041-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | This commit is primarily a significant cleanup to the interrupt allocation code that had gotten a bit jumbled from having to support per-vq MSIX, shared MSIX, MSI, and legacy style interrupts. Contains projects/virtio commits: r246064: virtio_pci: Rewrite allocation of interrupts r246065: virtio_pci: Remove spaces before a tab r246066: virtio_pci: Dynamically allocate the virtqueue array r246304: virtio_pci: Clean up after failed virtqueue alloc attempt r246305: virtio_pci: Move no interrupt check into the PCI interrupt handlers r246308: virtio_pci: Remove unused variable MFC after: 1 month Notes: svn path=/head/; revision=252708
* Merge virtio changes from projects/virtioBryan Venteicher2013-07-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Contains projects/virtio commits: r245738: virtio: Minor man page tweaks r246060: virtio: Cleanup feature description printing r246306: virtio: Remove old debugging flag r247238: virtio: Remove PRIx64 macros from format strings r247239: virtio: Constify some fields r247240: virtio: Minor code simplifications r249962: virtio: Update to my freebsd.org email address MFC after: 1 month Notes: svn path=/head/; revision=252707
* Virtio SCSI driverPeter Grehan2012-10-111-0/+1
| | | | | | | | Submitted by: Bryan Venteicher bryanv at daemoninthecloset dot org Reviewed by: grehan Notes: svn path=/head/; revision=241470
* No need to leak these into the includer's namespace.Peter Grehan2012-09-131-0/+6
| | | | | | | Submitted by: Bryan Venteicher bryanv at daemoninthecloset org Notes: svn path=/head/; revision=240430
* Various VirtIO improvementsPeter Grehan2012-07-111-3/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | PCI: - Properly handle interrupt fallback from MSIX to MSI to legacy. The host may not have sufficient resources to support MSIX, so we must be able to fallback to legacy interrupts. - Add interface to get the (sub) vendor and device IDs. - Rename flags to VTPCI_FLAG_* like other VirtIO drivers. Block: - No longer allocate vtblk_requests from separate UMA zone. malloc(9) from M_DEVBUF is sufficient. Assert segment counts at allocation. - More verbose error and debug messages. Network: - Remove stray write once variable. Virtqueue: - Shuffle code around in preparation of converting the mb()s to the appropriate atomic(9) operations. - Only walk the descriptor chain when freeing if INVARIANTS is defined since the result is only KASSERT()ed. Submitted by: Bryan Venteicher (bryanv@daemoninthecloset.org) Notes: svn path=/head/; revision=238360
* Do not include <sys/types.h> in the local headers. The .c files includingDavid E. O'Brien2012-07-031-2/+0
| | | | | | | them have already included <sys/param.h> before these headers are included. Notes: svn path=/head/; revision=238072
* Catch up with Bryan Venteicher's virtio Hg repo:Peter Grehan2011-12-061-1/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | c162516 Remove vtblk_sector_size c162515 Wrap long license lines c162514 Remove vtblk_unit c162513 Wrap long lines in the license. c162512 Remove verbose messages when link goes up/down. A similar message is printed elsewhere as a result of if_link_state_change(). c162511 Explicity compare pointer to NULL c162510 Allocate the mac filter table at attach time. c162509 Add real BSD licenses to the header files copied from Linux. The chases upstream changes made in Linux awhile ago. c162508 Only notify if we actually dequeued something. c162507 Change a couple of if () { KASSERT(...) } to just KASSERTs. In non-debug kernels, the if() { } probably get optomized away, but I guess this is clearer. c162506 Remove VIRTIO_BLK_F_TOPOLOGY fields in the config. TOPOLOGY has since been removed from the spec, and the FreeBSD didn't really do anything with the fields anyways. c162505 Move vtblk_enqueue_request() outside the locks when getting the ident. c162504 Remove soon to be uneeded trylock during dump [1]. http://lists.freebsd.org/pipermail/freebsd-current/2011-November/029226.html c162503 Remove emtpy line c162502 Drop frame if cannot allocate a vtnet_tx_header. If we don't, we set OACTIVE, but if there are no other frames in flight, vtnet_txeof() will never be called to unset OACTIVE. The interface would have to be down/up'ed in order to become usable. We could be cuter here and only do this if the virtqueue is emtpy, but its probably not worth the complication. c162501 Start mbuf replacement loop at 1 for clarity Obtained from: Bryan Venteicher bryanv at daemoninthecloset dot org Notes: svn path=/head/; revision=228301
* Import virtio base, PCI front-end, and net/block/balloon drivers.Peter Grehan2011-11-181-0/+130
Tested on Qemu/KVM, VirtualBox, and BHyVe. Currently built as modules-only on i386/amd64. Man pages not yet hooked up, pending review. Submitted by: Bryan Venteicher bryanv at daemoninthecloset dot org Reviewed by: bz MFC after: 4 weeks or so Notes: svn path=/head/; revision=227652