FreeBSD/src df34ccfsys/dev/e1000 e1000_hw.h e1000_phy.h

e1000: Retry transient MDIC failures on modern PCH

Some Meteor Lake and newer systems sporadically fail an MDIC PHY
transaction while the MAC and PHY clocks synchronize.  Retry twice
before reporting the transaction failure.

Disable retries around PHY interface transitions where an MDI error
is expected.  Preserve and restore the configured retry count on every
exit from those flows.

This follows DPDK commit bdca22d62ff0, extended to the PTP and NVP PCH
types.

MFC after:      2 weeks
DeltaFile
+117-79sys/dev/e1000/e1000_phy.c
+26-0sys/dev/e1000/e1000_ich8lan.c
+4-0sys/dev/e1000/e1000_phy.h
+1-0sys/dev/e1000/e1000_hw.h
+148-794 files

FreeBSD/src ea2e8b0sys/dev/e1000 e1000_defines.h e1000_mac.c

e1000: fix semaphore timeout value

DPDK commit message

net/e1000/base: fix semaphore timeout value

According to datasheet, software ownership of SWSM.SWESMBI bit should
not exceed 100ms. Current implementation caused incorrect timeout
counter values, where each iteration equals 50us delay. Because of that
driver was allowed to wait for semaphore even for 1.5s. This might
trigger DPC timeout.

This implementation hardcodes value to 2000, which multiplied by 50us,
gives 100ms of possible wait time.

Fixes: af75078fece3 ("first public release")
Cc: stable at dpdk.org

Signed-off-by: Pawel Malinowski <pawel.malinowski at intel.com>

    [5 lines not shown]
DeltaFile
+1-1sys/dev/e1000/e1000_mac.c
+1-0sys/dev/e1000/e1000_defines.h
+2-12 files

FreeBSD/src 2625192sys/dev/e1000 e1000_mac.h e1000_i210.h

e1000: Separate hardware semaphore policies by family

The shared semaphore helper accesses both the 82571 retry counter and
the I210 one-time-clear flag.  Those fields occupy overlapping members
of the device-specific union.  On 82571, incrementing the counter thus
enables the I210 recovery and clears SMBI after the first timeout.

Give 82571, generic 80003/82575, and I210/I211 users distinct acquire
paths.  Preserve the legacy peer-driver policy on 82571 and one-time
recovery on I210.

The separation follows the Intel e1000 base code in DPDK.

MFC after:      2 weeks
DeltaFile
+124-2sys/dev/e1000/e1000_i210.c
+59-3sys/dev/e1000/e1000_82571.c
+11-40sys/dev/e1000/e1000_mac.c
+4-1sys/dev/e1000/e1000_82575.c
+1-1sys/dev/e1000/e1000_mac.h
+2-0sys/dev/e1000/e1000_i210.h
+201-476 files

FreeBSD/src ccb8ad1sys/dev/e1000 e1000_defines.h e1000_nvm.c

e1000: Accept uninitialized Tiger Lake NVM checksums

Some transitional Tiger Lake systems shipped with an uninitialized
checksum word.  Accept that state while continuing to validate newer
read-only NVM images.

MFC after:      2 weeks
DeltaFile
+7-0sys/dev/e1000/e1000_nvm.c
+1-0sys/dev/e1000/e1000_defines.h
+8-02 files

FreeBSD/src 8e8755esys/dev/e1000 e1000_ich8lan.c

e1000: improve NVM checksum handling

DPDK commit message

net/e1000/base: improve NVM checksum handling

When reading NVM checksum, we may encounter the following scenarios:

- Checksum may be invalid, and can be updated
- Checksum may be invalid but cannot be updated because NVM is read-only

For the latter case, we should just ignore invalid checksum and not
attempt to update it.

Signed-off-by: Sasha Neftin <sasha.neftin at intel.com>
Signed-off-by: Anatoly Burakov <anatoly.burakov at intel.com>
Acked-by: Bruce Richardson <bruce.richardson at intel.com>

Obtained from:  DPDK (5241c17f0d)
MFC after:      2 weeks
DeltaFile
+14-7sys/dev/e1000/e1000_ich8lan.c
+14-71 files

FreeBSD/src 0fc3078sys/dev/e1000 e1000_manage.c e1000_82575.c

e1000: fix NVM loop bounds and pointer access

DPDK commit message

net/e1000/base: fix NVM loop bounds and pointer access

Improve the NVM checksum routines by ensuring loop bounds are compared
at the correct integer width. Use array indexing instead of explicit
pointer arithmetic.

Fixes: af75078fece3 ("first public release")
Cc: stable at dpdk.org

Signed-off-by: Menachem Fogel <menachem.fogel at intel.com>
Signed-off-by: Dima Ruinskiy <dima.ruinskiy at intel.com>
Signed-off-by: Ciara Loftus <ciara.loftus at intel.com>
Acked-by: Bruce Richardson <bruce.richardson at intel.com>

Obtained from:  DPDK (39fba42d04)
MFC after:      2 weeks
DeltaFile
+2-2sys/dev/e1000/e1000_manage.c
+2-2sys/dev/e1000/e1000_82575.c
+4-42 files

FreeBSD/src 146ae81sys/dev/e1000 e1000_nvm.c

e1000: fix NVM data type in bit shift

DPDK commit message

net/e1000/base: fix NVM data type in bit shift

There is a static analysis warning due to wrong data types being used
for NVM read data shifts. Fix it via explicit type cast.

Fixes: 38db3f7f50bd ("e1000: update base driver")
Cc: stable at dpdk.org

Signed-off-by: Przemyslaw Ciesielski <przemyslaw.ciesielski at intel.com>
Signed-off-by: Anatoly Burakov <anatoly.burakov at intel.com>
Acked-by: Bruce Richardson <bruce.richardson at intel.com>

Obtained from:  DPDK (b932270c66)
MFC after:      2 weeks
DeltaFile
+2-2sys/dev/e1000/e1000_nvm.c
+2-21 files

FreeBSD/src b3bdffdsys/dev/e1000 e1000_mac.c

e1000: fix possible variable overflow

DPDK commit message

net/e1000/base: fix possible variable overflow

Bits can be lost as temporary math is done on signed variables and the
result is assigned to an unsigned variable. Cast to u32 to force the
compiler to do operations on unsigned temporary variables.

Fixes: af75078fece3 ("first public release")
Cc: stable at dpdk.org

Signed-off-by: Lukasz Czapnik <lukasz.czapnik at intel.com>
Signed-off-by: Ciara Loftus <ciara.loftus at intel.com>
Acked-by: Bruce Richardson <bruce.richardson at intel.com>

Obtained from:  DPDK (214cb0d7f1)
MFC after:      2 weeks
DeltaFile
+1-1sys/dev/e1000/e1000_mac.c
+1-11 files

FreeBSD/src 15a0db2sys/dev/e1000 e1000_phy.c

e1000: fix iterator type

DPDK commit message

net/e1000/base: fix iterator type

Fix static analysis warning about comparison between types of
incompatible width, which might lead to an infinite loop due to
overflow.

Fixes: af75078fece3 ("first public release")
Cc: stable at dpdk.org

Signed-off-by: Amir Avivi <amir.avivi at intel.com>
Signed-off-by: Anatoly Burakov <anatoly.burakov at intel.com>
Acked-by: Bruce Richardson <bruce.richardson at intel.com>

Obtained from:  DPDK (3d36053991)
MFC after:      2 weeks
DeltaFile
+2-1sys/dev/e1000/e1000_phy.c
+2-11 files

FreeBSD/src afe56eesys/dev/sound/pci csavar.h csa.c, sys/dev/sound/pcm buffer.c dsp.c

sound: Use unsigned long instead of legacy u_long

No functional change intended.

Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
DeltaFile
+22-21sys/dev/sound/pci/csapcm.c
+12-10sys/dev/sound/pci/csa.c
+6-6sys/dev/sound/pci/csavar.h
+3-3sys/dev/sound/pcm/dsp.c
+3-2sys/dev/sound/usb/uaudio.c
+3-2sys/dev/sound/pcm/buffer.c
+49-446 files not shown
+61-5412 files

FreeBSD/src a46b854sys/fs/cuse cuse.c

cuse: Fix server reference leak in cuse_client_open()

If the server is closing (or the device node is going away), or if
devfs_set_cdevpriv() fails, cuse_client_open() returns with the server
reference taken at the top of the function still held and the newly
allocated client still linked on pcs->hcli.  Since cuse_client_free()
has not been registered as the cdevpriv destructor at that point,
nothing ever undoes this work: every open() that races the is_closing
window permanently leaks one server reference and one cuse_client.

A leaked reference is fatal on server exit: cuse_server_free()
busy-waits in an uninterruptible pause("W", hz) loop until pcs->refs
drops to 1, which now never happens, so the exiting server process
(e.g. virtual_oss(8)) is left wedged in state "D", immune to SIGKILL,
cuse.ko is pinned (kldunload hangs too), and only a reboot recovers.

Before 634e578ac7b0 the is_closing error path dropped the reference by
calling devfs_clear_cdevpriv(), which ran the cuse_client_free()
destructor.  That commit moved devfs_set_cdevpriv() after the

    [16 lines not shown]
DeltaFile
+10-2sys/fs/cuse/cuse.c
+10-21 files

FreeBSD/src cda2abfsys/dev/sound/pcm dsp.c

sound: Add missing newline in dsp_make_dev()'s device_printf()

Sponsored by:   The FreeBSD Foundation
MFC after:      1 week

(cherry picked from commit 2a2705a637cd67d0add7fe795fef9b7a722d76bd)
DeltaFile
+1-1sys/dev/sound/pcm/dsp.c
+1-11 files

FreeBSD/src 6886e8asys/dev/sound/usb uaudio.c

snd_uaudio: Don't let an idle stream reprogram a shared UAC2 clock

Some UAC2 devices expose a single Clock Source entity that is shared
between their playback and capture interfaces (it appears in both the
output and input clock bitmaps).  On such a device uaudio(4) programs
the sample rate for both directions when a stream starts.  If playback
runs at a 44.1 kHz-family rate while the idle capture channel is left
at its 48 kHz-family default, the capture
SET_CUR(UA20_CS_SAM_FREQ_CONTROL) is issued after the playback one and
overwrites the rate on the shared clock.  The device then runs at
~48 kHz while the playback stream carries 44.1 kHz data.  Consuming
samples faster than they arrive, the device repeatedly runs out of
data, loses sync with the playback stream, and re-locks onto it
(audible dropouts, front-panel play/idle flicker).  The 48 kHz family
is unaffected because both directions then agree on the rate.

Fix it in three parts:

- Add a shared-clock guard: before issuing SET_CUR to a clock id, if

    [30 lines not shown]
DeltaFile
+95-8sys/dev/sound/usb/uaudio.c
+95-81 files

FreeBSD/src a5b10cesys/dev/sound/pcm dsp.c

sound: Propagate error value from dsp_make_dev()

It is better to propagate it to pcm_register(), and later to the device
drivers, than to simply ignore it and return ENXIO.

Sponsored by:   The FreeBSD Foundation
MFC after:      1 week

(cherry picked from commit a46c92aad16bf6c9d6c3967c8af3e8b3bdb59cda)
DeltaFile
+1-1sys/dev/sound/pcm/dsp.c
+1-11 files

FreeBSD/src 7af4af4sys/dev/sound/pci cs4281.c vibes.c

sound: Stop using legacy u_int types

No functional change intended.

Sponsored by:   The FreeBSD Foundation
MFC after:      1 week

(cherry picked from commit 95439b803fce86958e1db1927a8405bf939edda4)
DeltaFile
+107-107sys/dev/sound/pci/envy24.c
+100-100sys/dev/sound/pci/envy24ht.c
+84-84sys/dev/sound/pci/maestro3.c
+65-65sys/dev/sound/pci/emu10k1.c
+49-49sys/dev/sound/pci/vibes.c
+48-48sys/dev/sound/pci/cs4281.c
+453-45338 files not shown
+1,016-1,01644 files

FreeBSD/src 44b054dsys/dev/sound/pcm channel.h dsp.c

sound: Scale PCM secondary buffers by byte rate

The fixed 128 KiB secondary buffer cap dates from stereo-sized streams.
High channel-count or high sample-width OSS streams can consume most of
that budget in one graph quantum, leaving too little room for capture
catch-up or playback headroom.

Keep 128 KiB as the low-rate floor, but derive the effective soft-ring
cap from the channel byte rate, clamped to 4 MiB. Use that per-channel
cap when resizing the soft buffer and when clamping
SNDCTL_DSP_SETFRAGMENT requests.

Also clamp SNDCTL_DSP_LOW_WATER to the current soft-buffer size so an
impossible readiness threshold cannot make poll/select wait forever.

MFC after:      3 weeks
Reviewed by:    christos
Differential Revision:  https://reviews.freebsd.org/D58064

(cherry picked from commit 967e86d1ef2ac8711c0ae7be353a9c08186f4e6f)
DeltaFile
+46-16sys/dev/sound/pcm/channel.c
+27-11sys/dev/sound/pcm/dsp.c
+23-7sys/dev/sound/pcm/channel.h
+96-343 files

FreeBSD/src 34718e0sys/compat/linux linux.h linux_netlink.c

linuxulator: map IFF_LOWER_UP through NETLINK_ROUTE for Linux apps

rtnl_if_flags_to_linux() translated the usual IFF_* bits but dropped
FreeBSD's IFF_LOWER_UP (IFF_NETLINK_1).  Chromium's AddressTrackerLinux
only treats a link as online when ifi_flags has UP|LOWER_UP|RUNNING; with
LOWER_UP missing, online_links stays empty, ConnectionType is
CONNECTION_NONE, and navigator.onLine is false even though TCP/HTTPS
work.  Linux Chromium under the Linuxulator (e.g. www/linux-brave) then
shows a spurious Offline UI; sites that ignore navigator.onLine do not.
Native www/chromium is on a different notifier path.

Map IFF_LOWER_UP to Linux's IFF_LOWER_UP (1<<16) and define
LINUX_IFF_LOWER_UP alongside the existing LINUX_IFF_* constants.

PR:     297424

Reviewed by:    pouria, adrian (previous revision)
Differential Revision:  https://reviews.freebsd.org/D58774
DeltaFile
+4-1sys/compat/linux/linux_netlink.c
+3-0sys/compat/linux/linux.h
+7-12 files

FreeBSD/src b9db5a5sys/netinet in_mcast.c, sys/netinet6 in6_mcast.c

in_mcast: Fix uninitialized variable usage in inm_merge()

When the first loop in inm_merge() hits an error, generally because it
hit some limit on the number of source filters for a multicast group,
inm_merge() tries to atomically roll back changes to the group source
filter list.

To roll back, it iterates over the global source filter list for the
multicast group, starting at the last entry that we updated ("nims").
But, if we have not yet updated any entries, this variable is
uninitialized.  Initialize it to NULL, so that RB_FOREACH_REVERSE_FROM
doesn't visit any source filters in this case.

All of the above applies to the v6 case.

Reported by:    Daniel Birtwhistle
MFC after:      1 week
Sponsored by:   The FreeBSD Foundation
DeltaFile
+1-0sys/netinet6/in6_mcast.c
+1-0sys/netinet/in_mcast.c
+2-02 files

FreeBSD/src b7b73d0tools/tools/git git-mfc

git-mfc: Make --pending work with releng branches

There is no timeout period for merging from stable to releng branches,
so we should ignore "MFC after" tags.

While here, lift some uses of re.compile() out of loops.

Reported by:    des
DeltaFile
+29-14tools/tools/git/git-mfc
+29-141 files

FreeBSD/src af3929csys/dev/hwpmc hwpmc_mod.c

hwpmc: fix false callchain assertion on the PMC_UR ring

pmc_capture_user_callchain() asserts that TDP_CALLCHAIN is set on the
current thread, but PMC_UR samples never set that flag -- only PMC_HR
and PMC_SR do. That makes the assertion always fail for PMC_UR,
panicking INVARIANTS kernels as soon as pmcstat -U is used.

Skip the assertion for PMC_UR. No functional change on kernels built
without INVARIANTS.

Signed-off-by:  Andre Silva <andasilv at amd.com>
Reviewed by:    mhorne
MFC after:      1 week
Sponsored by:   AMD
Differential Revision:  https://reviews.freebsd.org/D58572
DeltaFile
+1-1sys/dev/hwpmc/hwpmc_mod.c
+1-11 files

FreeBSD/src 66118c3sys/dev/hwpmc hwpmc_mod.c

hwpmc: fix false runcount assertion in user callchain capture

pmc_capture_user_callchain() checks a PMC's runcount before walking
the user stack, but reads it without holding the spinlock that
protects it. hardclock() can run on the same CPU during the capture
and drop the runcount to zero in between, tripping the assertion and
panicking INVARIANTS kernels under load.

Move the check inside the existing spinlock, right where the code
already confirms the sample is still valid. No functional change on
kernels built without INVARIANTS.

Signed-off-by:  Andre Silva <andasilv at amd.com>
Reviewed by:    mhorne
MFC after:      1 week
Sponsored by:   AMD
Differential Revision:  https://reviews.freebsd.org/D58571
DeltaFile
+4-3sys/dev/hwpmc/hwpmc_mod.c
+4-31 files

FreeBSD/src e85ae6fusr.sbin/bhyve bhyverun.c

fbsdrun_virtio_msix(): update virtio_msix to virtio.msix

Fixes:          2d985d577d79 ("bhyve: namescope virtio_msix to virtio.msix")
Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D58787
DeltaFile
+1-1usr.sbin/bhyve/bhyverun.c
+1-11 files

FreeBSD/src 0979b04sys/dev/e1000 e1000_defines.h e1000_ich8lan.c

e1000: Disable autonomous PCH power gating after reset

Panther Point changed the reset value of CTRL_EXT.DPG_EN to enable
autonomous power gating. Clear it after hardware reset on Panther Point
and Nova Point controllers to prevent unexpected Tx/Rx hangs, packet
loss, or corruption.

MFC after:      1 week
DeltaFile
+8-0sys/dev/e1000/e1000_ich8lan.c
+1-0sys/dev/e1000/e1000_defines.h
+9-02 files

FreeBSD/src 698c3b0sys/dev/e1000 e1000_hw.h e1000_api.c

e1000: Add Nova Lake I219 support

Add support for future client platform

MFC after:      1 week
DeltaFile
+9-0sys/dev/e1000/if_em.c
+7-0sys/dev/e1000/e1000_ich8lan.c
+5-1sys/dev/e1000/e1000_api.c
+3-0sys/dev/e1000/e1000_hw.h
+24-14 files

FreeBSD/src 8194c32sys/dev/ice ice_drv_info.h

ice(4): Add support for E835 CNSA 2.0 adapters

Added support for E835 adapters with post-quantum cryptographic (PQC)
algorithms in firmware/software signage and in SPDM attestation.

Signed-off-by: Pawel Sobczyk <pawel.sobczyk at intel.com>

Reviewed by:    Miłosz Linkiewicz <milosz.linkiewicz at intel.com>
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D57868
DeltaFile
+30-0sys/dev/ice/ice_drv_info.h
+30-01 files

FreeBSD/src 87b21f3sys/sys kernel.h, sys/x86/acpica srat.c

SYSINIT: add SI_SUB_NUMA

This allows to parse ACPI tables and initialize VM domains before
SI_SUB_VM w/o a hack.

Reviewed by:            markj
Differential Revision:  https://reviews.freebsd.org/D58713
DeltaFile
+1-1sys/x86/acpica/srat.c
+1-0sys/sys/kernel.h
+2-12 files

FreeBSD/src 4f24652sys/kern subr_smp.c, sys/sys kernel.h

SYSINIT: add SI_SUB_FIRST

This allows to initialize mp_maxid, mp_ncpus and register APICs at the
most early stage, guaranteeing that those values will already be available
at SI_SUB_TUNABLES.

Reviewed by:            markj
Differential Revision:  https://reviews.freebsd.org/D58712
DeltaFile
+1-2sys/x86/x86/mptable.c
+1-1sys/x86/x86/local_apic.c
+1-1sys/x86/acpica/madt.c
+1-1sys/kern/subr_smp.c
+1-0sys/sys/kernel.h
+5-55 files

FreeBSD/src 662497dsys/amd64/amd64 pmap.c, sys/compat/linuxkpi/common/src linux_current.c

SYSINIT: add explicit SI_ORDER_LAST

Working on cleansing use of (SI_SUB_FOO + 1) construct through the kernel
I found a repeating pattern.  Often a developer adds a module that depends
on certain subsystem to be fully instantiated and they want to put their
module SYSINIT right at the end of the SI_SUB_FOO.  Such module usually
expects that nothing else within this subsystem shall depend on the
module.

The problem with SI_ORDER_ANY which practically was "the last" until this
change is that it is used very widely and people treat it literally as
"any", well, because this is what the name says.  This lead to many parts
that could have dependencies later to be added as SI_ORDER_ANY.

So, our developer with the new subsystem that depends on SI_SUB_FOO has
three options:

1) Use SI_ORDER_ANY, but grep around ther kernel for other SI_SUB_FOO
entries to make sure that no dependencies are set to SI_ORDER_ANY.  And in

    [16 lines not shown]
DeltaFile
+1-7sys/dev/random/fenestrasX/fx_brng.c
+3-3sys/compat/linuxkpi/common/src/linux_current.c
+2-2sys/amd64/amd64/pmap.c
+2-1sys/sys/kernel.h
+1-1sys/x86/x86/ucode.c
+1-1sys/netinet/tcp_ratelimit.c
+10-155 files not shown
+15-2011 files

FreeBSD/src 2d985d5usr.sbin/bhyve bhyve_config.5, usr.sbin/bhyve/aarch64 bhyverun_machdep.c

bhyve: namescope virtio_msix to virtio.msix

The bhyve_config(5) variable `virtio_msix` is namescoped to
`virtio.msix`. Configurations that have the old variable will
automatically be mapped to the new one, with a warning message printed
out.

Relnotes:       yes
Reviewed by:    ziaee, markj
Differential Revision:  https://reviews.freebsd.org/D58390
DeltaFile
+4-1usr.sbin/bhyve/riscv/bhyverun_machdep.c
+4-1usr.sbin/bhyve/aarch64/bhyverun_machdep.c
+2-2usr.sbin/bhyve/bhyve_config.5
+2-1usr.sbin/bhyve/amd64/bhyverun_machdep.c
+12-54 files

FreeBSD/src 80d82fcusr.sbin/bhyve bhyverun.h bhyverun.c, usr.sbin/bhyve/amd64 bhyverun_machdep.c

bhyve: add deprecation warning function

Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D58636
DeltaFile
+2-10usr.sbin/bhyve/amd64/bhyverun_machdep.c
+10-0usr.sbin/bhyve/bhyverun.c
+1-0usr.sbin/bhyve/bhyverun.h
+13-103 files