Home | History | Annotate | Download | only in pci
History log of /src/sys/dev/pci/virtio_pci.c
RevisionDateAuthorComments
 1.55  25-Sep-2024  christos Wrong byte order of config space write in big-endian (gorg)

In virtio_pci.c, the function virtio_pci_bus_space_write_8 writes
the first 4 bytes and second 4 bytes of an 8-byte value in the same
or swapped order within the device's config space depending on the
endianness of the system it is compiled for. However, the BUS_ADDR_LO32
and BUS_ADDR_HI32 always produce the least-significant and
most-significant 4 bytes of an 8-byte value, respectively, regardless
of the endianness of the system. Since virtio_pci_bus_space_write_8
is always used only for writing to little-endian parts of the config
space, the least significant 4 bytes must always be written to the
first 4 bytes in the config space value, and the most significant
4 bytes must always be written to the last 4 bytes of the config
space value. Therefore, swapping the byte order produces incorrect
behaviour on big-endian systems.

The incorrect behaviour seems to have been introduced in revision
1.19 of virtio_pci.c, which this change would mostly reversed
 1.54  25-Jun-2024  riastradh virtio_pci.c: Use container_of, not cast.
 1.53  25-Jun-2024  riastradh virtio_pci.c: Sprinkle const.

No functional change intended.
 1.52  25-Jun-2024  riastradh virtio_pci.c: Sprinkle KNF.

- No parameter names in function prototypes.
- Fix indentation.
- Break overlong lines.
- Blank line between declarations and rest of block.
 1.51  25-Jun-2024  riastradh virtio_pci.c: Omit needless blank lines and commented code.

No functional change intended.
 1.50  25-Jun-2024  riastradh virtio_pci.c: Sort includes.

No functional change intended.
 1.49  25-Jun-2024  riastradh virtio@pci: Zero sc_bars_iosize[i] on unmap.

No functional change intended, but this makes the code less brittle.

Prompted by PR kern/58335.
 1.48  25-Jun-2024  riastradh virtio@pci: Don't detach on shutdown.

The virtio bus does not keep state in memory that needs to flushed to
persistent storage. Typically DVF_DETACH_SHUTDOWN is only needed by,
e.g., disk drivers to flush disk caches (although really, vfs sync
should do that anyway, so maybe we should just nix the option
altogether).

Prompted by PR kern/58335.
 1.47  25-Jun-2024  riastradh virtio@pci: Nix useless sc_mapped_iosize.

This appears to have been a mistaken attempt to pass the subregion
length through to bus_space_unmap, which doesn't make any sense --
bus_space_subregion does not allocate anything and the resulting
handle must not be passed to bus_space_unmap.

Once we pass the size that was actually returned by pci_mapreg_map to
bus_space_unmap, which matches the size passed internally by
pci_mapreg_map to bus_space_map, sc_mapped_iosize is no longer used
and can be flushed.

Prompted by PR kern/58335.
 1.46  25-Jun-2024  riastradh virtio@pci: Unmap the BARs we actually mapped on >=1.0 detach.

PR kern/58335
 1.45  25-Jun-2024  riastradh virtio_pci.c: Nix trailing whitespace.
 1.44  19-Nov-2023  thorpej On alpha and sparc64, use VirtIO 1.0 and VIRTIO_F_ACCESS_PLATFORM so
that DMA to PCI-attached VirtIO devices works properly. This is needed
for Qemu to select the appropriate address space for PCI DMA.
 1.43  07-Jul-2023  rin virtio(4): Fix byte order of DMA data for armeb in the same manner as
aarch64eb.

Fix comments to explain what is going on for {arm,aarch64}eb on QEMU.
This is not due to QEMU bugs; it correctly configures everything for
little-endian environment, and we forcibly change byte order only for
CPU cores during kernel bootstrap.
 1.42  19-Apr-2023  yamaguchi Use enumeration for state of a child driver instead of flags
and check its detaching by using sc->sc_child in virtio_softc

pointed out by riastradh, thanks.
fixes PR/57357
 1.41  16-Apr-2023  riastradh virtio@pci: Fix assertion on detach.

If the child never attached in the first place, it's OK for it to not
have detached.

XXX This should not be a set of flags; this should be a state
enumeration, because some flags make no sense, like FINISHED|FAILED.

XXX This should not be asserted separately in each bus; there should
be a single place in virtio.c to assert this, uniformly in all buses.

PR kern/57357

XXX pullup-10
 1.40  31-Mar-2023  yamaguchi Added flags to store status of attaching a virtio device

This prevents a panic on reboot after a virtio device had called
virtio_child_attach_failed().
 1.39  23-Mar-2023  yamaguchi Set virtqueues in virtio_child_attach_finish

The number of virtqueue maybe change in a part of VirtIO devices
(e.g. vioif(4)). And it is fixed after negotiation of features.
So the configuration is moved into the function.
 1.38  30-May-2022  riastradh branches: 1.38.4;
virtio at pci: Provide attribution in debug message.

Also make it only happen in the error case so success doesn't clutter
up the console output.
 1.37  13-Apr-2022  uwe virtio_pci: Don't use a cast for upcasting.

Same object code is generated.
 1.36  17-Mar-2022  uwe virtio_pci_bus_space_write_8: don't use bus_space_write_8.

The standard says:

4.1.3.1 Driver Requirements: PCI Device Layout

For device configuration access, the driver MUST use ... 32-bit
wide and aligned accesses for ... 64-bit wide fields. For 64-bit
fields, the driver MAY access each of the high and low 32-bit parts
of the field independently.

NB: "MAY" in this text refers to "independently" (i.e. the order of
accesses) not "32-bit" (which is restricted by the earlier "MUST").

Note also that virtio_{read,write}_device_config_8 in virtio.c already
uses two 32-bit accesses.
 1.35  17-Mar-2022  uwe virtio_pci.c: use PCI_BAR macro instead of open-coding it.
 1.34  14-Mar-2022  uwe virtio_pci_match: add TODO about PCI Revision ID.

The standard says:

Transitional devices MUST have a PCI Revision ID of 0.

Non-transitional devices SHOULD have a PCI Revision ID of 1 or higher.
Drivers MUST match any PCI Revision ID value.

so we must not check the revision id for non-transitional devices.
The code in attach relies on the revision being specifically(NB!) 1 so
this calls for a revision, but I can't test this properly at the
moment, so just leave a reminder. Comment change only.
 1.33  28-Oct-2021  yamaguchi virtio: stop reinit for safety when a device resetting is failed
 1.32  21-Oct-2021  yamaguchi virtio: reconfigure MSI-X vector on re-initialization

This may fix a problem that some interrupts, for example
link-state change of vioif(4) are not notified.
 1.31  21-Oct-2021  yamaguchi divide setup routine of virtio interrupts
into establishment and device configuration
 1.30  07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.29  24-Apr-2021  thorpej branches: 1.29.8;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.28  05-Feb-2021  reinoud branches: 1.28.2;
Second round of cleaning up endian code. No more tailored code to maintain.
 1.27  28-Jan-2021  reinoud Rewrite and streamline virtio device config read/write and explicitly cater
for the Aarch64-eb bus problem with Qemu. This removes lots of bus_space
`magic' and cleans up the code.
 1.26  26-Jan-2021  reinoud Fix indexing bug in clean up code on error in virtio PCI v1.0 attach code.
Thanks go to Rin Okuyama for spotting it.
 1.25  24-Jan-2021  reinoud Remove incorrect comment. It would violate the specs.

VirtIO PCI v1.0 attachments can only happen on revision 1 devices as they have
a radical different register layout. Transitional devices have to use revision
0 and have to use the VirtIO PCI v0.9 attachment method but can allow for
features to be negotiated normally found in later versions.
 1.24  24-Jan-2021  thorpej Redefining bus_space functions in drivers is a bad idea, and we just
should't be in the habit of doing so. Besides, the previous "solutions"
still did not compile correctly, and this does, so let's be done with
this nonsense, shall we?
 1.23  24-Jan-2021  reinoud On error unmap the pci_mapreg_map()d regions using bus_space_unmap() as
suggested by jak@
 1.22  24-Jan-2021  reinoud Move definition of NMAPREG to the start
 1.21  24-Jan-2021  reinoud Prevent potential buffer over runs in number of BARS
 1.20  24-Jan-2021  christos Add a comment explaining why bus_space_write_8 is limited to virtio.
 1.19  23-Jan-2021  christos Provide a generic bus_space_write_8 function that is bi-endian.
 1.18  21-Jan-2021  reinoud Remove dependency on bus_space_write_8() for i386 and instead implement it as
two bus_space_write_4()'s as allowed in the spec.
 1.17  21-Jan-2021  martin Use PRIxBUSSIZE to print a bus_size_t value.
 1.16  20-Jan-2021  reinoud Remove the virtio child driver finalisation check KASSERT that, while it
should never trigger, a possible bug in a child driver shouldn't have to panic
the kernel. Instead report the internal error.
 1.15  20-Jan-2021  reinoud Add VirtIO PCI v1.0 attachments and fix the drivers affected.

The vioif, ld, scsi, viornd and viomb devices were adjusted when needed and
tested both in legacy 0.9 and v1.0 attachments trough PCI on amd64, sparc64,
aarch64 and aarch64-eb. ACPI/FDT attachments also tested on
aarch64/aarch64-eb.

Known issues

* viomb on aarch64 works only with ACPI/FDT attachment but not with PCI
attachment. PCI and ACPI/FDT attachment works on aarch64-eb.

* virtio on sparc64 attaches but is it not functioning though not a
regression.
 1.14  23-Sep-2020  jakllsch branches: 1.14.2;
whitespace fix
 1.13  17-Sep-2020  jakllsch Ensure MSI-X is disabled if allocation of MSI-X interrupts fail.

The virtio device config space moves out from under us when MSI-X
remains enabled, and/or INTx interrupts are masked if we don't ensure
this.

This un-breaks virtio devices that run out of MSI-X interrupts.
Particularly a problem on uniproc x86, where there are only 8 or 9
vectors available, allowing for only about 4 virtio devices to use
MSI-X.
 1.12  17-Sep-2020  jakllsch Ensure interrupt handles buffer is zeroed on allocation

Prevents crashes trying to deallocate interrupts at shutdown.

Found by kim and mlelstv, confirmed by me
 1.11  27-May-2020  yamaguchi Fix to allocate resources actuall used around interrupts
 1.10  25-May-2020  yamaguchi Set handlers implemented in child device of virtio(4) to virtqueue
instead of the commonized function
 1.9  25-May-2020  yamaguchi Register an interrupt handler for virtqueue to that for pci
to reduce function call
 1.8  25-May-2020  yamaguchi Remove VIRTIO_F_PCI_INTR_SOFTINT support for multiqueue

The functionality is no longer used by obsolating VIOIF_SOFTINT_INTR.
 1.7  27-Jan-2019  pgoyette branches: 1.7.4;
Merge the [pgoyette-compat] branch
 1.6  14-Jan-2019  yamaguchi Add multiqueue support, virtio(4)
 1.5  06-Jun-2018  jakllsch branches: 1.5.2;
fix up virtio module for current structure; add virtio_pci module
 1.4  02-Jun-2018  jakllsch Begin to detangle virtio from its PCI attachment
 1.3  02-Jun-2018  jakllsch fix CVS keyword in __KERNEL_RCSID
 1.2  15-Feb-2018  uwe branches: 1.2.2;
Explicitly enable PCI_COMMAND_MASTER_ENABLE and PCI_COMMAND_IO_ENABLE.
Recent versions of VirtualBox do not enable bus-mastering by default -
this will be fixed, but it doesn't hurt to do it ourselves too.
 1.1  02-Aug-2017  cherry branches: 1.1.2; 1.1.4;
Reorg the virtio(4) config(9) code to be explicitly pci specific.

We'll later use this for a non-pci virtio(4) usecase.

ok martin
 1.1.4.2  03-Dec-2017  jdolecek update from HEAD
 1.1.4.1  02-Aug-2017  jdolecek file virtio_pci.c was added on branch tls-maxphys on 2017-12-03 11:37:29 +0000
 1.1.2.2  28-Aug-2017  skrll Sync with HEAD
 1.1.2.1  02-Aug-2017  skrll file virtio_pci.c was added on branch nick-nhusb on 2017-08-28 17:52:25 +0000
 1.2.2.2  18-Jan-2019  pgoyette Synch with HEAD
 1.2.2.1  25-Jun-2018  pgoyette Sync with HEAD
 1.5.2.1  10-Jun-2019  christos Sync with HEAD
 1.7.4.2  20-Sep-2020  martin Pull up following revision(s) (requested by jakllsch in ticket #1090):

sys/dev/pci/virtio_pci.c: revision 1.13

Ensure MSI-X is disabled if allocation of MSI-X interrupts fail.

The virtio device config space moves out from under us when MSI-X
remains enabled, and/or INTx interrupts are masked if we don't ensure
this.

This un-breaks virtio devices that run out of MSI-X interrupts.
Particularly a problem on uniproc x86, where there are only 8 or 9
vectors available, allowing for only about 4 virtio devices to use
MSI-X.
 1.7.4.1  20-Sep-2020  martin Pull up following revision(s) (requested by jakllsch in ticket #1089):

sys/dev/pci/virtio_pci.c: revision 1.12

Ensure interrupt handles buffer is zeroed on allocation
Prevents crashes trying to deallocate interrupts at shutdown.

Found by kim and mlelstv, confirmed by me
 1.14.2.1  03-Apr-2021  thorpej Sync with HEAD.
 1.28.2.1  27-Mar-2021  thorpej - config_found_ia() -> config_found().
- virtio only carries a single interface attribute, so no need to
specify it explicitly.
 1.29.8.1  04-Aug-2021  thorpej Adapt to CFARGS().
 1.38.4.6  31-Dec-2024  snj Pull up following revision(s) (requested by martin in ticket #1032):
sys/dev/pci/virtioreg.h: 1.13
sys/dev/pci/virtio_pci.c: 1.44
Define the VIRTIO_F_ACCESS_PLATFORM, VIRTIO_F_RING_PACKED,
VIRTIO_F_ORDER_PLATFORM, and VIRTIO_F_SR_IOV feature bits.
--
On alpha and sparc64, use VirtIO 1.0 and VIRTIO_F_ACCESS_PLATFORM so
that DMA to PCI-attached VirtIO devices works properly. This is needed
for Qemu to select the appropriate address space for PCI DMA.
 1.38.4.5  28-Nov-2024  martin Pull up following revision(s) (requested by riastradh in ticket #1018):

sys/dev/pci/virtio_pci.c: revision 1.55

Wrong byte order of config space write in big-endian (gorg)

In virtio_pci.c, the function virtio_pci_bus_space_write_8 writes
the first 4 bytes and second 4 bytes of an 8-byte value in the same
or swapped order within the device's config space depending on the
endianness of the system it is compiled for. However, the BUS_ADDR_LO32
and BUS_ADDR_HI32 always produce the least-significant and
most-significant 4 bytes of an 8-byte value, respectively, regardless
of the endianness of the system. Since virtio_pci_bus_space_write_8
is always used only for writing to little-endian parts of the config
space, the least significant 4 bytes must always be written to the
first 4 bytes in the config space value, and the most significant
4 bytes must always be written to the last 4 bytes of the config
space value. Therefore, swapping the byte order produces incorrect
behaviour on big-endian systems.

The incorrect behaviour seems to have been introduced in revision
1.19 of virtio_pci.c, which this change would mostly reversed
 1.38.4.4  02-Oct-2024  martin Pull up following revision(s) (requested by rin in ticket #914):

sys/dev/pci/virtio_pci.c: revision 1.50
sys/dev/pci/virtio_pci.c: revision 1.51
sys/dev/pci/virtio_pci.c: revision 1.52
sys/dev/pci/virtio_pci.c: revision 1.53
sys/dev/pci/virtio_pci.c: revision 1.54
sys/dev/pci/vioscsi.c: revision 1.35
sys/dev/pci/ld_virtio.c: revision 1.33
sys/dev/pci/ld_virtio.c: revision 1.34
sys/dev/virtio/viocon.c: revision 1.9
sys/dev/pci/ld_virtio.c: revision 1.35
sys/dev/pci/virtio.c: revision 1.80
sys/dev/pci/virtio.c: revision 1.81
sys/dev/pci/virtio.c: revision 1.82
sys/dev/pci/virtio_pci.c: revision 1.45
sys/dev/pci/virtio_pci.c: revision 1.46
sys/dev/pci/virtio_pci.c: revision 1.47
sys/dev/pci/virtio_pci.c: revision 1.48
sys/dev/pci/virtio_pci.c: revision 1.49
sys/dev/pci/virtio.c: revision 1.79

A single SCSI request may require multiple slots in the virtio queue
but the queue isn't sized for the theoretical maximum. So just use
XS_BUSY to pace the scsipi layer.

viocon(4): Show error in assertion failure.

virtio_read_device_config_le_[24]: Fix for {aarch64,arm}eb
Stop byte-swapping for big-endian aarch64 and arm to fix
corrupted read for, e.g., sc_taglen for vio9p(4).

As described as comments in virtio_pci.c, big-endian aarch64 and
armv7 (armeb) are somewhat special. At the moment, all supported
virtual/real machines are configured as little-endian, and only
CPU cores are switched to big-endian mode during early boot stage.

Most peripheral buses for armeb are LSB as a result, and their
default bus_space(9) functions swap byte-order. Therefore, PIOed
data from memory-mapped devices, as well as pci(4) ones, are
actually LSB, but observed as MSB for armeb.

Therefore, we should not swap byte-order further in
virtio_read_device_config_le_[24] on armeb.

See virtio_pci.c and sys/dev/fdt/virtio_mmio_fdt.c also.
fix spelling mistakes, mainly in comments and log messages.

Split KASSERT(A && B) into KASSERT(A); KASSERT(B).

Fix typo in error message.

Modify a confused expression in ld_virtio_attach().

VIRTIO_BLK_MIN_SEGMENTS should be the total number of non-data segments,
so I rename it to VIRTIO_BLK_CTRL_SEGMENTS.
PR kern/57981.

ld@virtio(4): Fix maximum size parameters.
- SEG_MAX is the maximum number of segments.
- SIZE_MAX is the maximum number of bytes in a single segment.
The maximum transfer size is, therefore, SEG_MAX * SIZE_MAX.
=> Don't add two extra segments in the dmamap vr_payload for the
header and status -- we already have a separate dmamap vr_cmdsts
for that.
=> Don't recalculate payload dmamap parameters based on division by
NBPG, just use the ones specified by the host.
=> Allow SIZE_MAX below MAXPHYS as long as SIZE_MAX*SEG_MAX >=
MAXPHYS.
Even though ldattach clamps ld->sc_maxxfer to MAXPHYS, make sure to
clamp it in ld_virtio_attach before ld_virtio_alloc_reqs since it
determines the dmamap sizes and bounce buffer allocation and there's
no sense in allocating those larger than ld will use anyway.
PR kern/58338

virtio_pci.c: Nix trailing whitespace.

virtio@pci: Unmap the BARs we actually mapped on >=1.0 detach.
PR kern/58335

virtio@pci: Nix useless sc_mapped_iosize.
This appears to have been a mistaken attempt to pass the subregion
length through to bus_space_unmap, which doesn't make any sense --
bus_space_subregion does not allocate anything and the resulting
handle must not be passed to bus_space_unmap.

Once we pass the size that was actually returned by pci_mapreg_map to
bus_space_unmap, which matches the size passed internally by
pci_mapreg_map to bus_space_map, sc_mapped_iosize is no longer used
and can be flushed.
Prompted by PR kern/58335.

virtio@pci: Don't detach on shutdown.
The virtio bus does not keep state in memory that needs to flushed to
persistent storage. Typically DVF_DETACH_SHUTDOWN is only needed by,
e.g., disk drivers to flush disk caches (although really, vfs sync
should do that anyway, so maybe we should just nix the option
altogether).
Prompted by PR kern/58335.

virtio@pci: Zero sc_bars_iosize[i] on unmap.
No functional change intended, but this makes the code less brittle.
Prompted by PR kern/58335.

virtio_pci.c: Sort includes.
No functional change intended.

virtio_pci.c: Omit needless blank lines and commented code.
No functional change intended.

virtio_pci.c: Sprinkle KNF.
- No parameter names in function prototypes.
- Fix indentation.
- Break overlong lines.
- Blank line between declarations and rest of block.
virtio_pci.c: Sprinkle const.
No functional change intended.

virtio_pci.c: Use container_of, not cast.
virtio(4): Assert child attach finished before we allow queueing.
Should help catch mistakes like:
PR kern/58555: Kernel panic during boot when using viocon with PCIe
 1.38.4.3  09-Jul-2023  martin Pull up following revision(s) (requested by rin in ticket #229):

sys/dev/pci/virtio_pci.c: revision 1.43
sys/dev/virtio/virtio_mmio.c: revision 1.11

virtio(4): Fix byte order of DMA data for armeb in the same manner as
aarch64eb.

Fix comments to explain what is going on for {arm,aarch64}eb on QEMU.
This is not due to QEMU bugs; it correctly configures everything for
little-endian environment, and we forcibly change byte order only for
CPU cores during kernel bootstrap.
 1.38.4.2  03-Jun-2023  martin Pull up following revision(s) (requested by yamaguchi in ticket #186):

sys/dev/pci/virtio_pci.c: revision 1.41
sys/dev/pci/virtio_pci.c: revision 1.42
sys/dev/virtio/virtio_mmio.c: revision 1.10
sys/dev/pci/virtiovar.h: revision 1.29
sys/dev/pci/virtio.c: revision 1.75
sys/dev/pci/virtio.c: revision 1.76
sys/dev/pci/virtio.c: revision 1.77
sys/dev/pci/virtio.c: revision 1.78

virtio@pci: Fix assertion on detach.

If the child never attached in the first place, it's OK for it to not
have detached.

XXX This should not be a set of flags; this should be a state
enumeration, because some flags make no sense, like FINISHED|FAILED.

XXX This should not be asserted separately in each bus; there should
be a single place in virtio.c to assert this, uniformly in all buses.

PR kern/57357


Use enumeration for state of a child driver instead of flags
and check its detaching by using sc->sc_child in virtio_softc
pointed out by riastradh, thanks.
fixes PR/57357

Fix not to allocate unnecessary descriptor
fixes PR/57358

virtio(4): change variable name, nfc

virtio(4): change members of struct vring_desc_extra before free a slot

This prevents the following race condition.
1. Thread-A: calls virtio_dequeue_commit() and
puts a slot into free descriptor chain in vq_free_slot()
2. Thread-B: calls virtio_enqueue_prep() and get the slot stored by Thread-A
3. Thread-B: calls virtio_enqueue_reserve() and
changes desc_base and desc_free_idx for the slot
4. Thread-A: changes the same members updated by Thread-B
reported by hannken, thanks.
 1.38.4.1  13-May-2023  martin Pull up following revision(s) (requested by yamaguchi in ticket #139):

sys/dev/pci/vioscsi.c: revision 1.31
sys/dev/pci/vio9p.c: revision 1.10
sys/dev/pci/vioscsi.c: revision 1.32
sys/dev/pci/vio9p.c: revision 1.11
sys/dev/pci/vioscsi.c: revision 1.33
sys/dev/pci/ld_virtio.c: revision 1.31
sys/dev/virtio/viocon.c: revision 1.6
sys/dev/pci/vioscsi.c: revision 1.34
sys/dev/pci/ld_virtio.c: revision 1.32
sys/dev/virtio/viocon.c: revision 1.7
sys/dev/virtio/viocon.c: revision 1.8
sys/dev/pci/vioscsi.c: revision 1.36
sys/dev/pci/virtioreg.h: revision 1.12
sys/dev/pci/viornd.c: revision 1.19
sys/dev/pci/virtio.c: revision 1.66
sys/dev/pci/virtio.c: revision 1.67
sys/dev/pci/virtio.c: revision 1.68
sys/dev/pci/if_vioif.c: revision 1.103
sys/dev/pci/virtio.c: revision 1.69
sys/dev/pci/if_vioif.c: revision 1.104
sys/dev/pci/virtio_pci.c: revision 1.40
sys/dev/virtio/virtio_mmio.c: revision 1.8
sys/dev/virtio/virtio_mmio.c: revision 1.9
sys/dev/pci/viomb.c: revision 1.14
sys/dev/pci/viomb.c: revision 1.15
sys/dev/pci/viomb.c: revision 1.17
sys/dev/pci/viornd.c: revision 1.20
sys/dev/pci/viornd.c: revision 1.21
sys/dev/pci/virtiovar.h: revision 1.25
sys/dev/pci/virtiovar.h: revision 1.26
sys/dev/pci/virtiovar.h: revision 1.27
sys/dev/pci/virtiovar.h: revision 1.28
sys/dev/pci/virtio.c: revision 1.70
sys/dev/pci/virtio.c: revision 1.71
sys/dev/pci/virtio.c: revision 1.72
sys/dev/pci/virtio.c: revision 1.73
sys/dev/pci/virtio.c: revision 1.74
sys/dev/pci/virtio_pci.c: revision 1.39

Set virtqueues in virtio_child_attach_finish

The number of virtqueue maybe change in a part of VirtIO devices
(e.g. vioif(4)). And it is fixed after negotiation of features.
So the configuration is moved into the function.

viocon(4): fix not to allocate unused virtqueue

viocon(4) allocates 4 virtqueues but it only uses 2 (0 and 1) queues.

Added functions to set interrupt handler and index into virtqueue

Added check of pointer for allocated memory before release of resource

Setup virtqueues after registering them to virtio_softc
restore fetch of qsize.

Mark as MPSAFE.

virtio(4): Avoid name collision with global intrhand on sparc64.

Pacifies -Werror=shadow.
No functional change intended.

Use PRIuBUSSIZE to print bus_size_t variables.

virtio(4): Fix sizing of virtqueue allocation.
vq->vq_avail[0].ring is a zero-length array, and thus sizeof is zero;
likewise vq->vq_used[0].ring.
Use vq->vq_avail[0].ring[0] and vq->vq_used[0].ring[0] to fix this
and restore the previous allocation sizing logic.
XXX We shouldn't use zero-length arrays here -- they are asking for
trouble like this, and C99 has a standard way to express what we're
actually trying to get at it, flexible array members.
PR kern/57304

virtio(4): Use flexible array members, not zero-length arrays.
This enables the compiler to detect sizeof mistakes like
PR kern/57304.

Use descriptor chain for free slots instead of vq_entry list
Descriptors can be chained by themself. And descriptors added to
avail ring or used ring are already chained. But it was not used
for unused descriptors and another linked list structure named
vq_entry was used.

The chain is also used for unused descriptors to make virtio(4)
simpler.

Added flags to store status of attaching a virtio device

This prevents a panic on reboot after a virtio device had called
virtio_child_attach_failed().

Fix wrong variable names
This fixes build errors in virtio_mmio.c

RSS XML Feed