#
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. 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
|
#
180c0240 |
|
18-Sep-2023 |
Mina Galić <freebsd@igalic.co> |
virtio: remove virtio_alloc_virtqueues' flags arg Summary: the flags argument is unused. Its initial design idea has been superceded by the addition of virtio_setup_intr and related APIs. Sponsored by: The FreeBSD Foundation Reviewers: bryanv Reviewed By: bryanv Subscribers: cognet, imp Differential Revision: https://reviews.freebsd.org/D41850
|
#
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_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
|
#
685dc743 |
|
16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove $FreeBSD$: one-line .c pattern Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
|
#
926cedd9 |
|
17-Aug-2022 |
Bryan Venteicher <bryanv@FreeBSD.org> |
virtio_mmio: Improve V1 spec conformance Implement the virtio_bus_finalize_features method so the FEATURES_OK status bit is set. Implement the virtio_bus_config_generation method to ensure larger than 4-byte reads are consistent. Reviewed by: cperciva MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D36150
|
#
90178705 |
|
11-Oct-2021 |
Alex Richardson <arichardson@FreeBSD.org> |
Add missing const after 6c4f95161d6e I accidentally didn't include hunk in the committed patch. Fixes: 6c4f95161d6e ("virtio: make the write_config buffer argument const")
|
#
6c4f9516 |
|
11-Oct-2021 |
Alex Richardson <arichardson@FreeBSD.org> |
virtio: make the write_config buffer argument const 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
|
#
ddfc9c4c |
|
22-Jun-2021 |
Warner Losh <imp@FreeBSD.org> |
newbus: Move from bus_child_{pnpinfo,location}_src to bus_child_{pnpinfo,location} with sbuf Now that the upper layers all go through a layer to tie into these information functions that translates an sbuf into char * and len. The current interface suffers issues of what to do in cases of truncation, etc. Instead, migrate all these functions to using struct sbuf and these issues go away. The caller is also in charge of any memory allocation and/or expansion that's needed during this process. Create a bus_generic_child_{pnpinfo,location} and make it default. It just returns success. This is for those busses that have no information for these items. Migrate the now-empty routines to using this as appropriate. Document these new interfaces with man pages, and oversight from before. Reviewed by: jhb, bcr Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D29937
|
#
85ad7f8d |
|
20-Jan-2021 |
Jessica Clarke <jrtc27@FreeBSD.org> |
virtio_mmio: Delete a stale #if 0'ed debug print This was blindly moved in r360722 but the variable being printed is not yet initialised. It's of little use and can easily be added back in the right place if needed by someone debugging, so just delete it. Reported by: bryanv
|
#
be79a2c6 |
|
20-Jan-2021 |
Jessica Clarke <jrtc27@FreeBSD.org> |
virtio_mmio: Fix V1 device probing spec conformance (section 4.2.3.1.1) We must check MagicValue not just Version before anything else, and then we must check DeviceID and immediately abort if zero (and this must not be an error). Do all this when probing rather than at the start of attaching as that's where this belongs, and provides a clear boundary between the device detection and device initialisation parts of the specified driver initialisation process. This also means we don't create empty device instances for placeholder devices, reducing clutter on systems that pre-allocate a large number, such as QEMU's AArch64 virt machine (which provides 32). Reviewed by: bryanv Differential Revision: https://reviews.freebsd.org/D28070
|
#
0e72f2c5 |
|
20-Jan-2021 |
Jessica Clarke <jrtc27@FreeBSD.org> |
virtio_mmio: Fix a style(9) issue
|
#
9da9560c |
|
18-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 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
|
#
e324f1e9 |
|
23-Dec-2020 |
Andrew Turner <andrew@FreeBSD.org> |
Stop redefining PAGE_SHIFT in virtio-mmio This is alreaady defined by each architecture as that is the only place we can know what the correct page shift should be. Sponsored by: Innovate UK
|
#
50a6b28a |
|
18-Dec-2020 |
Jessica Clarke <jrtc27@FreeBSD.org> |
virtio_mmio: Fix feature negotiation copy-paste issue in r361943 This caused us to write to the low half of the feature word twice, once with the high bits and once with the low bits. Common legacy device implementations seem to be fairly lenient about being able to write to the feature bits multiple times, but Arm's models use a stricter implementation that will ignore the second write. This fixes using vtnet(4) on those models. Reported by: Jean-Philippe Brucker <jean-philippe@linaro.org> Pointy hat: jrtc27
|
#
7377c1df |
|
21-Jul-2020 |
Andrew Turner <andrew@FreeBSD.org> |
Only write to VIRTIO_MMIO_GUEST_PAGE_SIZE with virtio mmio version 1 This register is only defined for the legacy v1 interface so only write to it when interacting with a legacy device. Sponsored by: Innovate UK
|
#
16ca3d0f |
|
08-Jun-2020 |
Jessica Clarke <jrtc27@FreeBSD.org> |
virtio_mmio: Negotiate the upper half of the feature bits too The feature bits are exposed as a 32-bit register with 2 banks, so we should negotiate both halves. Notably, VIRTIO_F_VERSION_1 is in the upper half, and will be used in an upcoming commit. The PCI bus driver also has this bug, but the legacy BAR layout did not include selector registers and is rather different from the modern layout, so it remains solely as legacy. Reviewed by: br, brooks (mentor), jhb (mentor) Approved by: br, brooks (mentor), jhb (mentor) Differential Revision: https://reviews.freebsd.org/D25131
|
#
cfe6a221 |
|
07-May-2020 |
Jessica Clarke <jrtc27@FreeBSD.org> |
virtio_mmio: Add casts missing from r360722 This fixes -Wshift-count-overflow warnings/errors on architectures using 32-bit physical addresses. Reported by: lwhsu
|
#
046096d5 |
|
06-May-2020 |
Jessica Clarke <jrtc27@FreeBSD.org> |
virtio_mmio: Support non-transitional version 2 devices The non-legacy virtio MMIO specification drops the use of PFNs and replaces them with physical addresses. Whilst many implementations are so-called transitional devices, also implementing the legacy specification, TinyEMU[1] does not. Device-specific configuration registers have also changed to being little-endian, and must be accessed using a single aligned access for registers up to 32 bits, and two 32-bit aligned accesses for 64-bit registers. [1] https://bellard.org/tinyemu/ Reviewed by: br, brooks (mentor) Approved by: br, brooks (mentor) Differential Revision: https://reviews.freebsd.org/D24681
|
#
55cd9324 |
|
20-Feb-2020 |
Kristof Provost <kp@FreeBSD.org> |
virtio: Pass the interrupt type in mmio mode When we register an interrupt handler we need to pass the intr_type along in bus_setup_intr(). The interrupt type matters because it is used to decide if we need to enter NET_EPOCH. That meant that vtmmio-based if_vtnet did not, which led to panics with INVARIANTS set. Sponsored by: Axiado
|
#
776d3d59 |
|
26-Jul-2019 |
Kristof Provost <kp@FreeBSD.org> |
virtio: Fix running on machines with memory above 0xffffffff We want to allocate a contiguous memory block anywhere in memory, but expressed this as having to be between 0 and 0xffffffff. This limits us on 64-bit machines, and outright breaks on machines where memory is mapped above that address range. Allow the full address range to be used for this allocation. Sponsored by: Axiado
|
#
dfca0a8b |
|
03-Jun-2019 |
Conrad Meyer <cem@FreeBSD.org> |
virtio(4): Expose PNP metadata through newbus 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
|
#
a3609b82 |
|
21-Oct-2018 |
Andrew Turner <andrew@FreeBSD.org> |
Split out the virtio mmio FDT attachment and add an ACPI attachment. This allows the memory mapped I/O virtio driver to attach when we boot with ACPI tables, for example in some cases with QEMU emulating arm64. MFC after: 1 month
|
#
1147face |
|
15-Jun-2018 |
Ruslan Bukin <br@FreeBSD.org> |
Make virtio queue re-initialization steps to be similar to original initialization, so we don't miss few registers to configure. This fixes vtnet(4) operation with QEMU's virtio-net-device. Tested in QEMU with FreeBSD/RISC-V. Reviewed by: bryanv Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D15821
|
#
ac2fffa4 |
|
21-Jan-2018 |
Pedro F. Giffuni <pfg@FreeBSD.org> |
Revert r327828, r327949, r327953, r328016-r328026, r328041: Uses of mallocarray(9). The use of mallocarray(9) has rocketed the required swap to build FreeBSD. This is likely caused by the allocation size attributes which put extra pressure on the compiler. Given that most of these checks are superfluous we have to choose better where to use mallocarray(9). We still have more uses of mallocarray(9) but hopefully this is enough to bring swap usage to a reasonable level. Reported by: wosch PR: 225197
|
#
26c1d774 |
|
13-Jan-2018 |
Pedro F. Giffuni <pfg@FreeBSD.org> |
dev: make some use of mallocarray(9). Focus on code where we are doing multiplications within malloc(9). None of these is likely to overflow, however the change is still useful as some static checkers can benefit from the allocation attributes we use for mallocarray. This initial sweep only covers malloc(9) calls with M_NOWAIT. No good reason but I started doing the changes before r327796 and at that time it was convenient to make sure the sorrounding code could handle NULL values.
|
#
116b8d2b |
|
03-Jul-2015 |
Ruslan Bukin <br@FreeBSD.org> |
Add 'prewrite' method allowing us to run some platform-specific code before each write happens, e.g. write-back caches. This will help booting in Bluespec simulator of CHERI processor.
|
#
61cefb9b |
|
15-Mar-2015 |
Alexander Motin <mav@FreeBSD.org> |
Hide virtio features negotiation messages under bootverbose. Those messages are noisy, but useless for average user. MFC after: 2 weeks
|
#
7c5c5b97 |
|
29-Dec-2014 |
Andrew Turner <andrew@FreeBSD.org> |
Set the page size in the virtio-mmio driver. Some backends, e.g QEMU, assume a 1 byte page size until told otherwise. Sponsored by: The FreeBSD Foundation
|
#
82ba170c |
|
29-Dec-2014 |
Andrew Turner <andrew@FreeBSD.org> |
Allow virtio_mmio to attach to ofwbus. Qemu places these here on at least the AArch64 virtual platform with the Linaro UEFI. Sponsored by: The FreeBSD Foundation
|
#
156b97fa |
|
12-Dec-2014 |
Ruslan Bukin <br@FreeBSD.org> |
Add virtio bus 'poll' method allowing us to inform backend we are going to poll virtqueue. Use on BERI soft-core to invalidate cpu caches. Reviewed by: bryanv Sponsored by: DARPA, AFRL
|
#
a8098016 |
|
09-Dec-2014 |
Ruslan Bukin <br@FreeBSD.org> |
o Add BERI Virtio Networking Frontend (if_vtbe) o Move similar block/networking methods to common file o Follow r275640 and correct MMIO registers width o Pass value to MMIO platform_note method. Sponsored by: DARPA, AFRL
|
#
4dbff239 |
|
09-Dec-2014 |
Andrew Turner <andrew@FreeBSD.org> |
Update the virtio driver to work on the ARM AArch64 Foundation Model. There are two main parts to get it to work, 1) most of the register accesses need to be word sized, other than the config register which needs to be byte aligned, and 2) we don't need the platform driver for this to work on the Foundation Model, allow it to be NULL. Differential Revision: https://reviews.freebsd.org/D1240 Reviewed by: bryanv Sponsored by: The FreeBSD Foundation
|
#
c141c5c6 |
|
18-Nov-2014 |
Ruslan Bukin <br@FreeBSD.org> |
Add Virtio MMIO bus driver. Sponsored by: DARPA, AFRL
|