FreeBSD/src cd4426a — sys/dev/e1000 e1000_defines.h if_em.c

e1000: Separate DH89xxCC memory errors

DH89xxCC shares the 82580 MAC type but reserves several of its memory
error control and status registers.  Accessing the full 82580 register
set breaks normal RX/TX operation on affected adapters.

Give DH89xxCC separate configuration, accounting, and recovery paths.
Use its transmit packet-buffer ECC counter and DMA/LAN parity status
with device-specific masks, avoiding the reserved receive-buffer ECC
and PCIe error registers.  Retain the port-reset sequence for fatal
memory-error recovery without waiting for the absent STATUS.RST_DONE.

Tested by:      chuck2k (https://github.com/opnsense/src/issues/329)
Fixes:          915c628c4f49 ("igb: Report 82580 memory ECC errors")
Sponsored by:   BBOX.io
Differential Revision:  https://reviews.freebsd.org/D61138

(cherry picked from commit 0857b57787cb2bdd2bb123b12638ea5e4c10eabd)
DeltaFile
+144-16sys/dev/e1000/if_em.c
+9-1sys/dev/e1000/e1000_defines.h
+153-172 files

FreeBSD/src 12d2217 — sys/dev/sound/pci hdsp.h hdsp.c

snd_hdsp: Use saved resource IDs on detach

Release resources with the IDs used to allocate them.
Rename irqid to rid to reflect that it stores a resource ID.

This mirrors the corresponding snd_hdspe change.

Sponsored by:   BBOX.io

(cherry picked from commit 96e2a9a40a05716a444dc217629374c387efd159)
DeltaFile
+5-5sys/dev/sound/pci/hdsp.c
+1-1sys/dev/sound/pci/hdsp.h
+6-62 files

FreeBSD/src 94d836a — sys/dev/sound/pci hdspe.h hdspe.c

snd_hdspe: Use saved resource IDs on detach

Release resources with the IDs used to allocate them.
Rename irqid to rid to reflect that it stores a resource ID.

Reviewed by:    br
Sponsored by:   BBOX.io
Differential Revision:  https://reviews.freebsd.org/D58373

(cherry picked from commit d33ab9dae2f5f5421e4cb5a141751924e35eeb2d)
DeltaFile
+5-5sys/dev/sound/pci/hdspe.c
+1-1sys/dev/sound/pci/hdspe.h
+6-62 files

FreeBSD/src 76cb1db — sys/dev/sound/pci hdsp.h hdsp-pcm.c

snd_hdsp: Use busdma for DMA buffers

Program DMA buffer registers with the bus addresses returned by busdma.
Require one full-size contiguous DMA segment per direction and validate
its alignment and 32-bit address range.

Synchronize buffer ownership around playback, capture, clearing, and
teardown.  Disable channels before clearing their DMA buffers, and unwind
partially allocated resources on failure.

This mirrors snd_hdspe's DMA handling, adapted to HDSP's single base
address per direction.

Sponsored by:   BBOX.io

(cherry picked from commit 5355c97e129a004f013570be0b7a99c8610e1757)
DeltaFile
+84-29sys/dev/sound/pci/hdsp.c
+20-4sys/dev/sound/pci/hdsp-pcm.c
+3-0sys/dev/sound/pci/hdsp.h
+107-333 files

FreeBSD/src 06ee388 — sys/dev/sound/pci hdspe.h hdspe-pcm.c

snd_hdspe: Use busdma for DMA buffers

Program DMA pages from busdma segments and synchronize buffer ownership.
Unwind partially allocated resources on failure.

Reviewed by:    br
Sponsored by:   BBOX.io
Differential Revision:  https://reviews.freebsd.org/D58372

(cherry picked from commit 46b338381400cb8106d6d2af945e7950553c16f4)
DeltaFile
+101-31sys/dev/sound/pci/hdspe.c
+20-4sys/dev/sound/pci/hdspe-pcm.c
+5-0sys/dev/sound/pci/hdspe.h
+126-353 files

FreeBSD/src 4c43db6 — sys/dev/sound/pci hdsp-pcm.c

snd_hdsp: Serialize rate and latency updates

Protect running-state checks and register updates with the softc lock.
Keep the pointer reset and the HDSP 9632 frequency rewrite in the same
critical section as the latency update.

Drop the lock around sndbuf_resize(), which may sleep, and recheck the
running state after reacquiring it.  Preserve resize error handling so
that a failed resize leaves the hardware unchanged.

This mirrors the locking in snd_hdspe.

Sponsored by:   BBOX.io

(cherry picked from commit a25ad366d51d52ef30b8bc4e2a7dd377255a409b)
DeltaFile
+16-2sys/dev/sound/pci/hdsp-pcm.c
+16-21 files

FreeBSD/src adc4792 — sys/dev/sound/pci hdspe-pcm.c

snd_hdspe: Serialize rate and latency updates

Protect running-state checks and register updates with the softc lock.

Drop the lock around sndbuf_resize(), which may sleep, and recheck the
running state after reacquiring it.  Keep the resize ahead of the latency
register update so that a failed resize leaves the hardware unchanged.

Reviewed by:    br
Sponsored by:   BBOX.io
Differential Revision:  https://reviews.freebsd.org/D58371

(cherry picked from commit d1dcb2b117a3c128c8e8eda047f93739f06d6099)
DeltaFile
+18-2sys/dev/sound/pci/hdspe-pcm.c
+18-21 files

FreeBSD/src d49c205 — . Makefile.inc1

Makefile.inc1: Make sure mandoc bootstrap tool depends on libz

It links against both libopenbsd and libz, so reflect this in the
bootstrap tool's dependencies in case of races from highly-parallel
builds.

Reported by:    jkh
MFC after:      1 week

(cherry picked from commit 1dbcc7ee92c427480802cd1a40e1a1e3395d9bac)
DeltaFile
+1-1Makefile.inc1
+1-11 files

FreeBSD/src 8f83a7a — . Makefile.inc1

Makefile.inc1: Make bootstrap mandoc's bootstrap libz dependency conditional

We bootstrap libz unconditionally on macOS and Linux, and conditionally
on FreeBSD if pre-1600029 or DISK_IMAGE_TOOLS_BOOTSTRAP is enabled, but
if building on new enough -CURRENT without DISK_IMAGE_TOOLS_BOOTSTRAP
then libz is not bootstrapped and so this libz dependency does not
exist. Add the dependency whenever we are bootstrapping libz but not
otherwise, and do so without duplicating the condition.

Fixes:          1dbcc7ee92c4 ("Makefile.inc1: Make sure mandoc bootstrap tool depends on libz")
MFC after:      1 week

(cherry picked from commit 983cb64c05fabe2b83338d4c2087a9114ed27a1c)
DeltaFile
+6-1Makefile.inc1
+6-11 files

FreeBSD/src c8119d2 — . Makefile.inc1

Makefile.inc1: Make sure mandoc bootstrap tool depends on libz

It links against both libopenbsd and libz, so reflect this in the
bootstrap tool's dependencies in case of races from highly-parallel
builds.

Reported by:    jkh
MFC after:      1 week

(cherry picked from commit 1dbcc7ee92c427480802cd1a40e1a1e3395d9bac)
DeltaFile
+1-1Makefile.inc1
+1-11 files

FreeBSD/src ded58ef — . Makefile.inc1

Makefile.inc1: Make bootstrap mandoc's bootstrap libz dependency conditional

We bootstrap libz unconditionally on macOS and Linux, and conditionally
on FreeBSD if pre-1600029 or DISK_IMAGE_TOOLS_BOOTSTRAP is enabled, but
if building on new enough -CURRENT without DISK_IMAGE_TOOLS_BOOTSTRAP
then libz is not bootstrapped and so this libz dependency does not
exist. Add the dependency whenever we are bootstrapping libz but not
otherwise, and do so without duplicating the condition.

Fixes:          1dbcc7ee92c4 ("Makefile.inc1: Make sure mandoc bootstrap tool depends on libz")
MFC after:      1 week

(cherry picked from commit 983cb64c05fabe2b83338d4c2087a9114ed27a1c)
DeltaFile
+6-1Makefile.inc1
+6-11 files

FreeBSD/src 7806832 — lib/libthr/thread thr_private.h thr_pshared.c

libthr: Cache recent pshared_key

For a pshare key, we can actually cache the last one as a fast path
instead of trapping into kernel directly. It makes sense as a lock and
unlock should be a pair on the same key and at the same time. For
example, lock(A) -> unlock(A) -> lock(B) -> unlock(B). Each unlock is
a hit and refresh later (50% hit).

For a single pshare lock, it is evne a 100% hit as the key never
changed.

For nested lock lock(A) -> lock(B) -> lock(C) -> unlock(C) ->
unlock(B) -> unlock(A). It only cache the last one. However, we should
really think about rewritting this logic as it is a pshare lock shared
by many processes and nested should be uncommon.

Reviewed by:    kib
MFC after:      2 weeks
Differential Revision: https://reviews.freebsd.org/D60957
DeltaFile
+45-4lib/libthr/thread/thr_pshared.c
+4-0lib/libthr/thread/thr_private.h
+49-42 files

FreeBSD/src 9d48e88 — sys/dev/gve gve_tx_dqo.c gve_rx_dqo.c

gve: Page-align DQO descriptor and completion rings

Currently, gve_rx_alloc_ring_dqo() and gve_tx_alloc_ring_dqo() request
CACHE_LINE_SIZE alignment when allocating DMA memory for the DQO TX/RX
descriptor and completion rings. The device requires stronger alignment
than cache line alignment, which was incidentally being met due to how
the kernel allocates memory. Explicitly meet this requirement by
requesting page aligned memory.

Signed-off-by: Tim Hostetler <thostet at google.com>

Reviewed by:    markj, Jasper Tran O'Leary <jtranoleary at google.com>
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D61211
DeltaFile
+2-2sys/dev/gve/gve_tx_dqo.c
+2-2sys/dev/gve/gve_rx_dqo.c
+4-42 files

FreeBSD/src 64ea2b9 — sys/dev/gve gve_main.c gve_adminq.c

gve: Fix AdminQ buffer DMA sync directions

In gve_verify_driver_compatibility(), the driver populates the
gve_driver_info buffer for the device to read. Sync this buffer with
BUS_DMASYNC_PREWRITE instead of BUS_DMASYNC_PREREAD before issuing
the command.

In gve_adminq_describe_device(), the device populates the
gve_device_descriptor buffer for the driver to read. Sync this buffer
with BUS_DMASYNC_PREREAD instead of BUS_DMASYNC_PREWRITE before
issuing the command.

In gve_adminq_get_ptype_map_dqo(), the device populates the
gve_ptype_map buffer for the driver to read. Add the missing
BUS_DMASYNC_PREREAD and BUS_DMASYNC_POSTREAD syncs around the
command.

In normal GCP environments this did not cause a functional failure
because the underlying platforms are DMA cache-coherent and

    [12 lines not shown]
DeltaFile
+5-1sys/dev/gve/gve_adminq.c
+1-1sys/dev/gve/gve_main.c
+6-22 files

FreeBSD/src 12b3c29 — sys/compat/linuxkpi/common/include/linux ioctl.h, sys/dev/sound/pcm mixer.c dsp.c

ioctl: Add a macro for extracting the ioctl number from a command

Sprinkle it in various drivers which hard-coded the command layout.

No functional change intended.

Reviewed by:    dumbbell, emaste
MFC after:      1 week
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D61045
DeltaFile
+6-5sys/dev/syscons/scvesactl.c
+2-2sys/dev/syscons/scvidctl.c
+1-1sys/netgraph/ng_eiface.c
+1-1sys/dev/sound/pcm/mixer.c
+1-1sys/dev/sound/pcm/dsp.c
+1-1sys/compat/linuxkpi/common/include/linux/ioctl.h
+12-111 files not shown
+13-117 files

FreeBSD/src 9ca2cfe — lib/libsecureboot vesigned.c libsecureboot-priv.h

libsecureboot: add support for more signatures

For 2027 we need to support new, stronger signatures and hashes.

Re-work Makefile.inc and local.trust.mk to define
VE_SIGN_URL_LIST or VE_SIGNATURE_LIST (can be derrived from
VE_SIGN_URL_LIST) containing tuples of sig/method/hash/flags and
for VE_SIGN_URL_LIST the same plus /url.

From VE_SIGNATURE_LIST we derrive VE_SIGNATURE_EXT_LIST used to populate
signature_ext_list which defines the order in which we look for
signatures for a manifest.

We also populate signature_info_list which maps a signature ext to the
needed hash and flags to indicate whether that hash needs to be repeated.

verify_sig will lookup signature_info_list, no match means not
supported.  For asc we just call verify_asc() otherwise we call
verify_ec() or verify_rsa() depending on the key type found in the

    [15 lines not shown]
DeltaFile
+90-25lib/libsecureboot/vets.c
+63-31lib/libsecureboot/Makefile.inc
+37-35lib/libsecureboot/local.trust.mk
+44-3lib/libsecureboot/README.rst
+18-0lib/libsecureboot/libsecureboot-priv.h
+1-5lib/libsecureboot/vesigned.c
+253-991 files not shown
+254-1007 files

FreeBSD/src ca19042 — sys/fs/nfsclient nfs_clrpcops.c

nfs_clrpcops.c: Fix typo in commit db8444c1b7e4

Reported by:    markj
MFC after:      1 month
Fixes:  884ee8d6c9b4 ("nfscl: Add some glue for client side NFS over RDMA")
DeltaFile
+1-1sys/fs/nfsclient/nfs_clrpcops.c
+1-11 files

FreeBSD/src 0ecbb75 — sys/compat/linuxkpi/common/src linux_pci.c

LinuxKPI: set pci_dev msi_cap and msix_cap

Linux drivers find their MSI and MSI-X registers through pdev->msi_cap and
pdev->msix_cap, which hold where those capabilities start in PCI config
space.  LinuxKPI never set them, so they stayed 0, and every access meant
for the MSI registers went to the start of config space instead.

Drivers using these fields, e.g. ath11k and amdgpu, are affected.

Fill in both fields from the capability offsets that the native PCI code
already records.

Reviewed by:    dumbbell
Differential Revision:  https://reviews.freebsd.org/D61125
Event: NetApp/Vendor Summit Hackathon 202611
DeltaFile
+2-0sys/compat/linuxkpi/common/src/linux_pci.c
+2-01 files

FreeBSD/src a743c95 — contrib/mandoc test-fgetln.c man-cgi.css

mandoc: Drop obsolete files

These were removed by upstream long ago. Nothing in the
tree uses them.  Remove them to reduce our diff to upstream.

Reviewed by:            carlavilla, wosch
Reported by:            Ingo Schwarze <schwarze at openbsd.org>
Differential Revision:  https://reviews.freebsd.org/D61198
DeltaFile
+0-34contrib/mandoc/manpath.h
+0-13contrib/mandoc/man-cgi.css
+0-11contrib/mandoc/test-fgetln.c
+0-583 files

FreeBSD/src c67e695 — sys/dev/virtio/pci virtio_pci_modern.c

virtio_pci_modern: enable virtqueues before completing attach

Most of our drivers setup interrupt(s) and virtqueues are enabled at
that time, but nothing will currently enable them for devices that we're
only going to poll.  This most notably affects virtio-random, and the
problem can be observed with qemu's q35 emulation and a random device
attached.  The q35 implementation ignores the ring unless it's enabled,
so vtrnd_harvest() will consistently EAGAIN rather than contribute
anything of value, but with this patch it becomes functional.

This can be reproduced with a qemu invocation like so:

qemu-system-x86_64 -machine q35,accel=tcg -cpu max -smp 2 -m 2G \
  -drive file=FreeBSD-16.0-CURRENT-amd64-ufs.qcow2,if=virtio \
  -device pcie-root-port,id=rp1,bus=pcie.0,chassis=1 \
  -object rng-random,id=rng0,filename=/dev/urandom \
  -device virtio-rng-pci,rng=rng0,bus=rp1 \
  -display curses


    [4 lines not shown]
DeltaFile
+10-0sys/dev/virtio/pci/virtio_pci_modern.c
+10-01 files

FreeBSD/src cce5228 — sys/dev/virtio/random virtio_random.c

virtio_random: stop on detach, don't poll

If the device is hung, then polling will block the detach and hang us.
Stop it and drain the queue instead.  This fixes a hang on detach in
some circumstances without the upcoming virtio_pci_modern fix.

Reviewed by:    bnovkov, kfv
Sponsored by:   Stormshield
Sponsored by:   Klara, Inc.
Differential Revision:  https://reviews.freebsd.org/D61051
DeltaFile
+9-3sys/dev/virtio/random/virtio_random.c
+9-31 files

FreeBSD/src 26ba71f — sys/dev/virtio/random virtio_random.c

virtio_random: avoid using vtrnd_detach in the failure path

On the off chance that we discover more than one virtio-random device,
the second one will deregister the global instance or trip an invariant
when it fails to attach and calls vtrnd_detach().

We don't have that many resources to free, so just inline those.  This
is purely a hygiene thing, we haven't seen an instance of this in the
wild (to my knowledge).

Reviewed by:    bnovkov, kfv
Sponsored by:   Stormshield
Sponsored by:   Klara, Inc.
Differential Revision:  https://reviews.freebsd.org/D61050
DeltaFile
+9-2sys/dev/virtio/random/virtio_random.c
+9-21 files

FreeBSD/src 8ce9a86 — sys/dev/ena ena.c

ena: Reinit RSS components during queue count change flow

The io_queues_nb sysctl is writable while the interface is down, and
setting it destroys the RSS components. When the interface is not UP
nothing reinitialises them, so the indirection table is left referencing
queues that no longer exist until the next ifconfig up.

Call ena_rss_configure() after the queue count changes when the
interface is down. When it is up, this happens through ena_up().

This can configure RSS twice if the interface is brought up afterwards,
costing three redundant admin commands. That is preferred over changing
ena_up(), which the reset path also uses.

Reviewed by: cperciva
Fixes: 56d41ad5fe9c ("Add sysctl node for ENA IO queues number adjustment")
MFC after: 3 days
Sponsored by: Amazon, Inc.

(cherry picked from commit 2a27dd0076c55789a43415559906f795fd10c2da)
DeltaFile
+5-0sys/dev/ena/ena.c
+5-01 files

FreeBSD/src aca97e8 — sys/dev/ena ena.c ena_rss.c

ena: Set ENA_FLAG_RSS_ACTIVE only when RSS is really configured

If the device does not report support for the RSS indirection table,
ena_rss_init_default() destroys the RSS state and returns EOPNOTSUPP.
ena_rss_configure() treats EOPNOTSUPP as success and returns 0, and
ena_up_complete() sets ENA_FLAG_RSS_ACTIVE on any 0 return.
Reading dev.ena.N.rss.key at this point causes kernel panic.

Every current device reports the indirection table, so reaching this
needs a device that is broken or misreporting.

The SYSINIT removed by a6205766b300 called ena_rss_init_default()
directly, saw the EOPNOTSUPP and cleared the flag. Routing the decision
through ena_rss_configure(), which hides EOPNOTSUPP, lost that.

Move the flag set into ena_rss_configure(), which can see whether a
table exists, and clear it when tbl_log_size is 0.

Reviewed by: cperciva

    [6 lines not shown]
DeltaFile
+7-0sys/dev/ena/ena_rss.c
+0-1sys/dev/ena/ena.c
+7-12 files

FreeBSD/src 5fc3c7c — sys/dev/ena ena.h

ena: Update driver version to v2.8.5

New Features:
* Retrieve RSS indirection table size from device

Bug Fixes:
* Limit IO IRQ setup loop to active queues only
* Reinit RSS table on device restore when queue count shrinks
* Fix RSS not working after driver reload
* Fix NULL deref before NULL check in RSS sysctl
* Reinit RSS components during queue count change flow

Minor Changes:
* Fix ENA_MEM_FREE_COHERENT with an expression size argument

Reviewed by: cperciva
MFC after: 3 days
Sponsored by: Amazon, Inc.

(cherry picked from commit 5e66bf0df3104e212c1b24ff65284b6d1a694c59)
DeltaFile
+1-1sys/dev/ena/ena.h
+1-11 files

FreeBSD/src 670e850 — sys/dev/ena ena.h

ena: Update driver version to v2.8.6

Bug Fixes:
* Revert "Reinit RSS components during queue count change flow"
* Fix RSS sysctl panic when the RSS table is destroyed
* Set ENA_FLAG_RSS_ACTIVE only when RSS is really configured

Reviewed by: cperciva
MFC after: 3 days
Sponsored by: Amazon, Inc.
Differential Revision: https://reviews.freebsd.org/D61059

(cherry picked from commit 6c177745c58e526bcf7451ad2765df6c63f35f97)
DeltaFile
+1-1sys/dev/ena/ena.h
+1-11 files

FreeBSD/src 0c72405 — sys/dev/ena ena.c

ena: Fix RSS sysctl panic when the RSS table is destroyed

ena_set_io_queue_count() destroys the ena-com RSS state but left
ENA_FLAG_RSS_ACTIVE set. The RSS sysctl handlers gate on that flag, so
they ran against state that was gone.

This causes 2 types of issues:
1. Kernel panic when reading dev.ena.0.rss.key or writing to
   dev.ena.0.rss.indir_table
2. Returning a stale cached RSS table when reading
   dev.ena.0.rss.indir_table, or a bogus 1 when reading
   dev.ena.0.rss.indir_table_size

ena_set_io_queue_count() is called in 2 cases:
1. The io_queues_nb sysctl.
2. Device restore when the device comes back with fewer MSI-X vectors
   than before.

Clear ENA_FLAG_RSS_ACTIVE when the RSS table is destroyed. The handlers

    [14 lines not shown]
DeltaFile
+1-0sys/dev/ena/ena.c
+1-01 files

FreeBSD/src 9edaecd — sys/dev/ena ena.c

Revert "ena: Reinit RSS components during queue count change flow"

This reverts commit 2a27dd0076c5.

Changing the IO queue count destroys the RSS table, and if this is done
while the device is down a new table is not rebuilt until the next
ena_up(). That leaves 2 problems in the meantime:
1. A stale copy of the destroyed table is still returned via sysctl.
2. Reading the destroyed key, or writing the table, panics.

That commit addressed 1 by creating a new RSS table, so that sysctl
returns a fresh default table with the new number of queues. It did not
set out to fix 2, but the rebuild hid it by accident.

The rebuilt table is the default round-robin one, wired to no queues and
unusable: a write still fails, because programming the device needs the
IO queues that only exist after ena_up(). ena_up() builds that same
table anyway.


    [12 lines not shown]
DeltaFile
+0-5sys/dev/ena/ena.c
+0-51 files

FreeBSD/src 2240b51 — sys/dev/ena ena_sysctl.c

ena: Fix NULL deref before NULL check in RSS sysctl

In ena_sysctl_rss_indir_table(), the code dereferenced
indir->sysctl_buf before checking whether indir itself is NULL.
Move the NULL check above the dereference so the early-return path
fires before any access through indir.

Reviewed by: cperciva
Fixes: 6d1ef2abd330 ("ena: Implement full RSS reconfiguration")
MFC after: 3 days
Sponsored by: Amazon, Inc.

(cherry picked from commit 462b6c50c7089e96c54cbd34378467f32fc709d4)
DeltaFile
+1-2sys/dev/ena/ena_sysctl.c
+1-21 files

FreeBSD/src fa816a0 — share/man/man4 ena.4, sys/dev/ena ena.h ena.c

ena: Retrieve RSS table size from device

The current driver assumes a default RSS table size of 128 entries,
expecting the device's RSS table size to match this assumption.

This patch allows the driver to create RSS indirection table
with the size advertised by the device.

Reviewed by: cperciva
MFC after: 3 days
Sponsored by: Amazon, Inc.

(cherry picked from commit 3d1e732a43eda16f20dea3fe2671ce6fca8a03a6)
DeltaFile
+40-6sys/dev/ena/ena_rss.c
+29-6sys/dev/ena/ena_rss.h
+24-8sys/dev/ena/ena_sysctl.c
+4-1sys/dev/ena/ena.c
+0-3sys/dev/ena/ena.h
+0-1share/man/man4/ena.4
+97-256 files