Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: [netbsd-10] src/sys/dev



Module Name:    src
Committed By:   martin
Date:           Wed Oct  2 18:20:48 UTC 2024

Modified Files:
        src/sys/dev/pci [netbsd-10]: ld_virtio.c vioscsi.c virtio.c
            virtio_pci.c
        src/sys/dev/virtio [netbsd-10]: viocon.c

Log Message:
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


To generate a diff of this commit:
cvs rdiff -u -r1.30.4.1 -r1.30.4.2 src/sys/dev/pci/ld_virtio.c
cvs rdiff -u -r1.30.2.1 -r1.30.2.2 src/sys/dev/pci/vioscsi.c
cvs rdiff -u -r1.63.2.5 -r1.63.2.6 src/sys/dev/pci/virtio.c
cvs rdiff -u -r1.38.4.3 -r1.38.4.4 src/sys/dev/pci/virtio_pci.c
cvs rdiff -u -r1.5.4.2 -r1.5.4.3 src/sys/dev/virtio/viocon.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.




Home | Main Index | Thread Index | Old Index