OPNSense/src a949f57sys/contrib/dev/iwlwifi zzz_fw_ports_fwget.sh

iwlwifi: firmware: reduce script to extract fwget information

Due to driver changes it is no longer feasible to extract the full
PCI ID / firmware / card type information in one go as we used to
be able to.
We have already changed the way we extract firmware information for
ports and marked the iwlwififw.4 man page as obsolete.

Reduce the script to simply extarct the fwget(8) information and,
compared to the old times, sort each section so diffs will be easier
to see in the future.  This was particular helpful this time to make
sure we do not lose entries with the change of technique.

We also keep the script in the best perl spirit to do the job but
not to win a price, especially given it seems we have to change
matters every (other) year.

Given we can no longer extract firmware information for the PCI IDs,
we need to "manually" check against the ports that names match.

    [7 lines not shown]
DeltaFile
+82-356sys/contrib/dev/iwlwifi/zzz_fw_ports_fwget.sh
+82-3561 files

FreeBSD/ports 866bd90devel/py-virtualenv distinfo Makefile

devel/py-virtualenv: Update to 21.11.0

- Enable tests. To this end, do not load automatically plugins
  that are not compatible with the current version of pytest, such as
  devel/py-pytest-black and textproc/py-pytest-markdown, if they are
  installed on the system.
- Update list of test dependencies

ChangeLog:

1. https://github.com/pypa/virtualenv/releases/tag/21.9.1
2. https://github.com/pypa/virtualenv/releases/tag/21.10.0
3. https://github.com/pypa/virtualenv/releases/tag/21.11.0

Reported by:    "github-actions[bot]" <notifications at github.com>
DeltaFile
+27-9devel/py-virtualenv/Makefile
+3-3devel/py-virtualenv/distinfo
+30-122 files

OPNSense/src 54d909csys/compat/linuxkpi/common/include/linux pci_ids.h pci.h

LinuxKPI: Add PCI_EXP_TYPE_UPSTREAM and PCI_VENDOR_ID_AMD defines

Required by drm-kmod v6.12.105

Reviewed by:    bz, emaste
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D59734

(cherry picked from commit 52d1a0c62be1b4bd8e78ee57c86288246d948046)
DeltaFile
+1-0sys/compat/linuxkpi/common/include/linux/pci_ids.h
+1-0sys/compat/linuxkpi/common/include/linux/pci.h
+2-02 files

OPNSense/src c30fff2sys/compat/linuxkpi/common/include/linux string.h

Implement vmemdup_{array}_user

This is what FreeBSD now does for memdup_user and memdup_array_user
(which is wrong for memdup, but correct for vmemdup).

The amdgpu DRM driver started this in Linux ~6.12.86+

Reviewed by:    wulf
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D57444

(cherry picked from commit 302c6d25da6907ec762ff8937fa86d380743b000)
DeltaFile
+26-0sys/compat/linuxkpi/common/include/linux/string.h
+26-01 files

OPNSense/src 0272713sys/compat/linuxkpi/common/include/linux pm.h, sys/compat/linuxkpi/common/src linux_compat.c

LinuxKPI: add can_wakeup option and accessor functions

We can implement device_set_wakeup_capable() in the !CONFIG_PM_SLEEP
case;  we do not have the infrastructure in place for the CONFIG_PM_SLEEP
case so leave a pr_debug TODO.

Needed by an upcoming wireless driver.

Reviewed by:    dumbbell
Differential Revision: https://reviews.freebsd.org/D58883

(cherry picked from commit a424fb3519ebf8fb972e7ba45ba19df322992b00)
DeltaFile
+17-0sys/compat/linuxkpi/common/include/linux/pm.h
+6-0sys/compat/linuxkpi/common/src/linux_compat.c
+23-02 files

OPNSense/src bfede84sys/compat/linuxkpi/common/include/linux file.h

linuxkpi: Add 'fd_empty()`

The DRM drivers generic code started to use it in Linux 6.13.

Reviewed by:    emaste
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57582

(cherry picked from commit 50aa145171bc88edde8cf3b7eb13dbbf88a3f8a7)
DeltaFile
+6-0sys/compat/linuxkpi/common/include/linux/file.h
+6-01 files

OPNSense/src 1a825d3sys/compat/linuxkpi/common/src linux_80211.c linux_80211_macops.c

LinuxKPI: 802.11: Always lock around lkpi_80211_mo_{remove_interface,stop}()

Add the missing locking to another two MO driver downcalls, as drivers
always expect it (e.g. rtw89 by assertion).

Add the lock and might_sleep assertions to the respective lkpi_80211_mo_*
downcalls.

PR:             298417
Reviewed by:    bz
Differential Revision: https://reviews.freebsd.org/D59608

(cherry picked from commit 73166d21bd831db264509cbdce1ab3b63ab5b189)
DeltaFile
+6-0sys/compat/linuxkpi/common/src/linux_80211_macops.c
+2-0sys/compat/linuxkpi/common/src/linux_80211.c
+8-02 files

OPNSense/src 1dcd68dsys/compat/linuxkpi/common/include/linux compiler.h

LinuxKPI: implement __UNIQUE_ID() macro

Requred by drm-kmod v6.12.103

Obtained from:  OpenBSD

Reviewed by:    bz, emaste
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D59733

(cherry picked from commit 8b05d84be9e288d201e8631750ae180b07311ba7)
DeltaFile
+4-0sys/compat/linuxkpi/common/include/linux/compiler.h
+4-01 files

OPNSense/src 9f97f2esys/compat/linuxkpi/common/include/linux pci.h

LinuxKPI: pci: add reset_{prepare,done} to pci_error_handlers

Needed by an upcoming wireless driver.

Reviewed by:    dumbbell
Differential Revision: https://reviews.freebsd.org/D58882

(cherry picked from commit c40219c572df8b4b0c2392ee341d93bc82e6076b)
DeltaFile
+2-0sys/compat/linuxkpi/common/include/linux/pci.h
+2-01 files

OPNSense/src 31a9f04sys/compat/linuxkpi/common/include/linux pci.h, sys/compat/linuxkpi/common/src linux_pci.c

LinuxKPI: add PCI_IRQ_AFFINITY #define

Add the #define for PCI_IRQ_AFFINITY and leave a pr_debug note in
pci_alloc_irq_vectors() that it is unimplemented.

The flag is needed by an upcoming WiFi driver.

Reviewed by:    dumbbell
Differential Revision: https://reviews.freebsd.org/D58881

(cherry picked from commit b589e403a2c3bd2a94fb2ab88cd23255c68a9f05)
DeltaFile
+3-0sys/compat/linuxkpi/common/src/linux_pci.c
+1-0sys/compat/linuxkpi/common/include/linux/pci.h
+4-02 files

OPNSense/src f4f829asys/compat/linuxkpi/common/include/linux file.h cleanup.h

linuxkpi: Define `DEFINE_CLASS()` and `CLASS()`

`DEFINE_CLASS()` is in fact named `LINUXKPI_DEFINE_CLASS()` because it
conflicts with `DEFINE_CLASS()` defined in <sys/kobj.h>.

This macro defines a type and a pair of constructor/destructor
functions.

They are to be used by `CLASS()`: this one declares a variable,
initialise it with the constructor and set the `__cleanup()` attribute
to call the destructor once the variable goes out of scope.

The DRM drivers generic code started to use `CLASS()` in Linux 6.13. It
requires the `fd` class to be defined in <linux/file.h>.

Reviewed by:    bz
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57583

(cherry picked from commit f2a2e02ae54b836d1e23648756a050406f65111e)
DeltaFile
+26-0sys/compat/linuxkpi/common/include/linux/cleanup.h
+2-0sys/compat/linuxkpi/common/include/linux/file.h
+28-02 files

OPNSense/src e4f4048sys/compat/linuxkpi/common/include/linux pci.h

LinuxKPI: pci: add pci_select_bars() and pci_msix_vec_count()

For pci_select_bars() we use the LinuxKPI internal information, while
for pci_select_bars() we fall back to the native PCI stack.

Needed by a wifi driver.

Reviewed by:    dumbbell
Differential Revision: https://reviews.freebsd.org/D58878

(cherry picked from commit 55c07af60172b211116be47010fc0831aafc99e8)
DeltaFile
+29-0sys/compat/linuxkpi/common/include/linux/pci.h
+29-01 files

OPNSense/src 4ea2b7dsys/compat/linuxkpi/common/include/linux interrupt.h pci.h, sys/compat/linuxkpi/common/src linux_pci.c

LinuxKPI: fix argument type to lkpi_pci_msi_desc_alloc()

lkpi_pci_msi_desc_alloc() takes an unsigned int, not an int.
While here make sure the prototype is visibile in interrupt.h as
well before use to avoid -Wimplicit-function-declaration errors.

Discovered while working on a wireless driver.

Reviewed by:    dumbbell
Differential Revision: https://reviews.freebsd.org/D58879

(cherry picked from commit cfb23b01e269e8a0a84066637b82b746f01b46b4)
DeltaFile
+2-1sys/compat/linuxkpi/common/include/linux/pci.h
+1-1sys/compat/linuxkpi/common/src/linux_pci.c
+1-0sys/compat/linuxkpi/common/include/linux/interrupt.h
+4-23 files

OPNSense/src 64a386bsys/compat/linuxkpi/common/include/linux ethtool.h

LinuxKPI: add #include of rculist.h to ethtool.h for Linux conformance

Add #include rculist.h to ethtool.h to fullfill expectations of
Linux drivers without having to modify them.

Reviewed by:    dumbbell, emaste
Differential Revision: https://reviews.freebsd.org/D58874

(cherry picked from commit 4570a1bf760a3cd63eb7dd9e3ebbc3cf103bda4d)
DeltaFile
+2-1sys/compat/linuxkpi/common/include/linux/ethtool.h
+2-11 files

OPNSense/src fbfd965sys/compat/linuxkpi/common/include/linux types.h

LinuxKPI: add typedef for clockid_t

Needed by a wireless driver (not really using it) to compile.

Reviewed by:    dumbbell
Differential Revision: https://reviews.freebsd.org/D58877

(cherry picked from commit 401d0922a4bfcf40d3ae1866a0d90f955264def0)
DeltaFile
+2-0sys/compat/linuxkpi/common/include/linux/types.h
+2-01 files

OPNSense/src 1f02532sys/compat/linuxkpi/common/include/linux rculist.h

LinuxKPI: rcu: add optional condition to list_for_each_entry_rcu()

list_for_each_entry_rcu() can take an optional condition.  Add the
macro argument so code remains compiling but do not do anything with
it just yet.

Leave comments as list_for_each_entry_rcu() likely should have a
different implementation.

Sponsored by:   The FreeBSD Foundation
Reviewed by:    dumbbell
Differential Revision: https://reviews.freebsd.org/D59292

(cherry picked from commit e975ce86ff11a330128f5b21c7cd11c28d3aff87)
DeltaFile
+4-2sys/compat/linuxkpi/common/include/linux/rculist.h
+4-21 files

OPNSense/src 93bc6ddsys/compat/linuxkpi/common/include/linux dma-mapping.h, sys/compat/linuxkpi/common/src linux_pci.c

LinuxKPI: implement dma_{alloc,free}_{noncoherent,attrs}

We use one to implement the other given direction stays unused.

This is needed by an upcoming wifi driver.

Reviewed by:    dumbbell
Differential Revision: https://reviews.freebsd.org/D58880

(cherry picked from commit c3fa17a6a331db8aad03e9cb89ba97e1811ab381)
DeltaFile
+50-0sys/compat/linuxkpi/common/src/linux_pci.c
+36-0sys/compat/linuxkpi/common/include/linux/dma-mapping.h
+86-02 files

OPNSense/src cb40e05sys/dev/pci pci_iov.c

pci_iov: Permit non-ARI VFs on a secondary bus

A non-zero VF device number does not always require ARI. The Intel
82576 and I350 [1] explicitly support a non-ARI layout that places VFs
on the next bus.

Check every requested VF RID and reject a non-zero device only when it
is on the PF bus. This retains the ARI guard for invalid same-bus
layouts while permitting the documented second-bus layout.

[1] Intel I350 Datasheet, sections 7.8.2.6.1.2, 9.6.4.6

Sponsored by:   BBOX.io

(cherry picked from commit e795a31cb4d66368bdbe5ac7f61c0899d3ed39f8)
DeltaFile
+18-3sys/dev/pci/pci_iov.c
+18-31 files

OPNSense/src 61272c8share/man/man9 Makefile pci.9, sys/compat/linuxkpi/common/include/linux pci.h

pci: Expose PME support by power state

The presence of the PCI power management capability does not imply that
a function can signal PME# from every power state.  Drivers which
advertise wake based only on pci_has_pm() can consequently expose wake
modes that cannot work.

Add pci_has_pme() to query the PME_Support bitmap for a specific state.
Use it to implement LinuxKPI pci_pme_capable(), removing its duplicate
PME_Support decoder.

Validated the helper against PCI PMC capability values from 82571EB,
82573L, 82579LM, I210, I225, and I226-V controllers.  The 82571 and
82573 reported PMC 0xc822, while the I226-V reported 0xc823.  In both
values, bits 15, 14, and 11 advertise PME from D3cold, D3hot, and D0;
the low-bit difference is only the PM capability version.

Sponsored by:   BBOX.io

(cherry picked from commit c4e24e95c3f905b817d4bfc6e93457eb297bfa4b)
DeltaFile
+2-18sys/compat/linuxkpi/common/include/linux/pci.h
+18-1share/man/man9/pci.9
+19-0sys/dev/pci/pci.c
+1-0sys/dev/pci/pcivar.h
+1-0share/man/man9/Makefile
+41-195 files

OPNSense/src e82714esys/dev/pci pci_iov.c pci_private.h

pci: Expose a VF's owning PF to bus subclasses

ofw_pcibus now uses pci_iov_get_pf() to inherit PF locality for
VFs, but the accessor was inadvertently left in an uncommited ACPI
change.  This breaks powerpc builds.

Expose the accessor from the PCI core and provide a stub when PCI_IOV
is omitted.  Record VF ownership before pci_add_child() so child added
callbacks can safely query it, and remove the later redundant
assignment.

Sponsored by:   BBOX.io

(cherry picked from commit 3481a9cdc4dc26ef583bb0f46a04d5d059cde466)
DeltaFile
+25-0sys/dev/pci/pci.c
+0-1sys/dev/pci/pci_iov.c
+1-0sys/dev/pci/pci_private.h
+26-13 files

OPNSense/src a5c515ashare/man/man4 pci.4, sys/dev/pci pci.c

pci: Optionally disable endpoints with unsafe MPS

Keep warn-only behavior as the default. Add an opt-in policy that
clears endpoint decoding and bus mastering when a newly discovered
function cannot match its active path, while never disabling bridge
functions and their subtrees.

(cherry picked from commit 114f4a68f21345e1e6680b7acf1bf733d9047002)
DeltaFile
+41-2sys/dev/pci/pci.c
+13-0share/man/man4/pci.4
+54-22 files

OPNSense/src eb3e5c4sys/dev/pci pci.c

pci: Do not reconcile MPS across PCI domains

A PCI function can provide a host bridge into a synthetic PCI domain.
Intel VMD does this: the host facing VMD function remains in its
original domain while the hidden Root Ports and endpoints appear in a
separate domain.  The VMD function's Device Control does not describe
an upstream link in that synthetic hierarchy.

The hierarchy wide cold pass incorrectly used the VMD function's MPS
to reprogram the hidden ports and their endpoints.  Stop both cold
reconciliation and runtime path walks at a PCI domain boundary.  The
real Root Ports within the VMD domain continue to reconcile their
endpoints normally.

Reviewed by:    imp
Tested by:      Michael Butler <imb at protected-networks.net>
Fixes:          8e9fe9996a1f ("pci: Reconcile MPS before attaching PCIe devices")
Sponsored by:   BBOX.io
Differential Revision:  https://reviews.freebsd.org/D58837

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

OPNSense/src d8801c0share/man/man4 pci.4, sys/dev/pci pci_private.h pcivar.h

pci: Reconcile MPS before attaching PCIe devices

Reconcile each newly enumerated link as a unit before child drivers
attach. Firmware may leave Bus Master Enable set after handoff, so use
the bus attachment state rather than that bit to identify the cold
phase.

Preserve an established hierarchy during rescan and hot-add. Refuse a
reduction below a switch because recursive enumeration may already have
made a sibling subtree live; lowering only the local port or Root Port
would produce an inconsistent path. Report capability and active-use
conflicts distinctly.

Handle OFW PCI buses that clone the generic enumeration path.

(cherry picked from commit 8e9fe9996a1fbdb79033b082e6a96b9e1266e33f)
DeltaFile
+271-24sys/dev/pci/pci.c
+3-1sys/dev/pci/pcivar.h
+3-0share/man/man4/pci.4
+2-0sys/dev/pci/pci_private.h
+1-0sys/powerpc/ofw/ofw_pcibus.c
+280-255 files

OPNSense/src c2c56a6sys/dev/pci pci_iov.c

pci_iov: Roll back failed VF enumeration

pci_iov_enumerate_vfs() logged a failed VF creation or driver
configuration but still reported the whole SR-IOV configuration as
successful.  The PF remained enabled with the requested NumVFs and
driver state even though one or more VF children were absent.

Make VF enumeration atomic.  Delete children created by the failed
attempt, invoke the PF driver cleanup, disable VF memory space and VF
Enable, release the IOV resources, and return the original error to
iovctl.  Also treat failure to create a VF child as an error instead
of silently accepting a partial configuration.

(cherry picked from commit 4b195f1a25d5003117653a1a323ad19561dc8705)
DeltaFile
+26-7sys/dev/pci/pci_iov.c
+26-71 files

OPNSense/src a8461f1sys/dev/pci pci.c

pci: Skip PF SR-IOV state handling for VFs

A VF's pci_devinfo references its PF's pcicfg_iov for resource
bookkeeping, but only the PF implements the SR-IOV capability.
pci_cfg_save() and pci_cfg_restore() treated any non-NULL cfg.iov as
an owned capability and accessed the PF capability offset in VF
configuration space. Saving a VF could therefore replace the shared
PF settings with unrelated VF register values.

Skip SR-IOV capability save and restore for PCICFG_VF children. The
generic PCI and PCIe state of the VF remains preserved. This is also
required by drivers that save VF state around a PF-driven
function-level reset.

(cherry picked from commit 78547d542f776d366c36b5a2fc747ddfe99523c6)
DeltaFile
+6-2sys/dev/pci/pci.c
+6-21 files

OPNSense/src 83d8500share/man/man9 pci.9, sys/dev/pci pcivar.h pci.c

pci: Export pcie_flr_supported()

Move the capability and quirk checks used by pcie_flr() into a public
side effect free helper.  This lets callers determine whether an FLR
can be attempted before quiescing a device or saving state.

The helper considers the advertised PCIe FLR capability and both the
enable and disable FLR quirks.

Sponsored by:   BBOX.io

(cherry picked from commit 5b48968c1a57bd1a7f086d7e09add59afa158340)
DeltaFile
+24-7sys/dev/pci/pci.c
+14-1share/man/man9/pci.9
+1-0sys/dev/pci/pcivar.h
+39-83 files

OPNSense/src f4ed8f7share/man/man4 pci.4, sys/dev/pci pci.c

pci: Add a hierarchy-wide MPS limit

Add a boot-time ceiling for MPS reconciliation. Apply it only while an
entire cold-enumerated link can be configured consistently, and leave
an established active path unchanged.

(cherry picked from commit 673cb5265a2df2228982fc220f4e7ea62ab765b2)
DeltaFile
+44-7sys/dev/pci/pci.c
+15-0share/man/man4/pci.4
+59-72 files

OPNSense/src 5888110sys/dev/pci pci_iov.c

pci_iov: Clear NumVFs when configuration fails

pci_iov_config() programs NumVFs before validating the final VF RID
layout and allocating all generic resources. A subsequent error ran the
driver uninit callback but left the hardware NumVFs register programmed
while the software VF count returned to zero.

Clear NumVFs in the error path after the driver uninit callback,
matching normal SR-IOV teardown ordering. This prevents stale hardware
state after a failed configuration and permits a clean retry.

Sponsored by:   BBOX.io

(cherry picked from commit 621498b58cdab36a237d5f0b5c902952ad743fa9)
DeltaFile
+3-1sys/dev/pci/pci_iov.c
+3-11 files

OPNSense/src 09dfd54share/man/man9 pci.9, sys/dev/pci pci.c

pci: Preserve adjusted PCIe control state

The PCI bus changes live capability registers after the initial
configuration snapshot has been saved. A later driver reprobe restores
that snapshot and can silently undo the adjustment.

Update the cached Device Control and Root Control bits together with
pcie_adjust_config() writes. Route the persistent Maximum Read Request
setter and the bus-owned AER control changes through that helper as
well, so they share the same restore semantics as MPS reconciliation.

Document the persistent-write contract. Merge only explicitly adjusted
bits into the saved image so unrelated or transient bits observed during
the hardware read-modify-write cannot become persistent.

(cherry picked from commit a9752e9ac8a635f49ca058dd7268298840c7e915)
DeltaFile
+25-16sys/dev/pci/pci.c
+10-1share/man/man9/pci.9
+35-172 files

OPNSense/src 98c5321sys/dev/pci pci.c

pci: Permit function-level reset of 82599 VFs

Intel 82599 supports FLR on VFs but reports FLR support only in the PF
Device Capabilities register.  The VF register therefore leaves the FLR
Capable bit clear, and pcie_flr() rejects the reset.

Intel documents the zeroed VF PCIe capability structure as erratum 35
in the 82599 Specification Update (B0=Yes; NoFix).

Add a positive FLR quirk for the 82599 VF.  Keep the capability check
for every other function, so an unknown nonconforming VF cannot make
pcie_flr() report success when its reset request was ignored.

SR-IOV requires VFs to support FLR, but a clear capability bit cannot
distinguish the 82599's misadvertisement from a VF that fails to
implement it.

(cherry picked from commit ee776a8e291cb73845a8611d3dec5a2a966106b9)
DeltaFile
+11-3sys/dev/pci/pci.c
+11-31 files