FreeBSD/src f006f9esys/dev/acpica acpi_pci.c

acpi_pci: Honor device proximity for DMA tags

A PCI function with its own _PXM still inherits a DMA tag carrying
the upstream bridge's proximity domain. Resolving an SR-IOV VF's
locality through its PF therefore does not affect the domain used for
DMA allocations.

Create and cache a private child tag when the function, or a VF's
owning PF, has an explicit _PXM. Parent it to the existing PCI or IOMMU
tag so its constraints remain intact, then apply the function's domain
without mutating a shared tag.

pci_get_dma_tag() already performs the IOMMU lookup, so remove the
duplicated lookup in the ACPI subclass while here.

Reviewed by:    jhb
Sponsored by:   BBOX.io
Differential Revision:  https://reviews.freebsd.org/D59063

(cherry picked from commit f1f58bdf7b5fc58e6011c6ac2ae2ba129dc41991)
DeltaFile
+36-23sys/dev/acpica/acpi_pci.c
+36-231 files

FreeBSD/src 44f0c9dsys/dev/acpica acpivar.h acpi.c

acpi_pci: Cache PCI proximity domains

A PCI function's _PXM is stable for the lifetime of its device
instance, but CPU and DMA locality queries may evaluate it repeatedly.
SR-IOV amplifies this because every VF resolves locality through the
same PF.

Cache successful mappings and the stable absence of _PXM on the
locality source device, and share that result between CPU and domain
queries. Continue to retry generic evaluation or mapping errors rather
than making a potentially transient failure permanent.

Reviewed by:    jhb
Sponsored by:   BBOX.io
Differential Revision:  https://reviews.freebsd.org/D59207

(cherry picked from commit 5f78d024695b39208a6c92f6a96017bae53cdf2c)
DeltaFile
+32-5sys/dev/acpica/acpi_pci.c
+15-7sys/dev/acpica/acpi.c
+3-0sys/dev/acpica/acpivar.h
+50-123 files

FreeBSD/src 2bab696sys/dev/acpica acpi_pci.c

acpi_pci: Preserve CPU locality queries for descendants

bus_generic_get_cpus() preserves the original leaf device while
forwarding a request through the bus hierarchy. Consequently,
acpi_pci_get_cpus() may receive a descendant below a PCI function
rather than one of the PCI bus's direct children.

Only apply the SR-IOV PF-locality mapping to direct PCI children.
Preserve the previous ACPI CPU-locality lookup for descendants so their
unrelated bus ivars are not interpreted as PCI device information.

Reviewed by:    jhb
Sponsored by:   BBOX.io
Differential Revision:  https://reviews.freebsd.org/D59206

(cherry picked from commit dc4f80da18f0dcc557a969b4283a86569266eb5c)
DeltaFile
+3-0sys/dev/acpica/acpi_pci.c
+3-01 files

FreeBSD/src bf94f29sys/dev/acpica acpi_pci.c

acpi_pci: Inherit PF locality for SR-IOV VFs

SR-IOV VFs are instantiated from their PF and intentionally do not
receive an ACPI handle by matching their runtime BDF.  Consequently,
ACPI locality queries for a VF fall back to the upstream bus.  This is
usually sufficient, but loses a _PXM supplied specifically for the PF.

Use the PCI core's owning-PF accessor for BUS_GET_DOMAIN and
BUS_GET_CPUS requests made for a VF.  This preserves the VF's lack of
an ACPI handle while allowing its CPU and NUMA placement to follow the
PF.

Reviewed by:    jhb
Sponsored by:   BBOX.io
Differential Revision:  https://reviews.freebsd.org/D59062

(cherry picked from commit 1a2a88684a0126be8d7172362d5ec7dbb7a41c81)
DeltaFile
+24-1sys/dev/acpica/acpi_pci.c
+24-11 files

FreeBSD/src 197e0e3sys/dev/acpica acpi_pci.c

acpi_pci: Do not match SR-IOV VFs to ACPI devices

SR-IOV VFs are instantiated dynamically from their PF rather than
enumerated from ACPI.  A VF's runtime slot and function can match an
unrelated _ADR below the bridge.  acpi_pci_save_handle() stores that
handle in the VF's devinfo before acpi_pci_update_device() runs.

If the handle is already bound to another device_t whose parent is not
acpi0, acpi_pci_update_device() panics under INVARIANTS.  Without
INVARIANTS, the VF retains the unrelated handle, so subsequent ACPI
lookups, including NUMA and power-management operations, can act on the
wrong namespace node.

Skip ACPI namespace matching for VFs.

Reviewed by:    jhb
Sponsored by:   BBOX.io
Differential Revision:  https://reviews.freebsd.org/D59061

(cherry picked from commit 8b74806161a188103666387013cdd93fb3f5dc07)
DeltaFile
+12-0sys/dev/acpica/acpi_pci.c
+12-01 files

FreeBSD/src 6c2e549sys/dev/acpica acpi_pci.c

acpi_pci: Honor device proximity for DMA tags

A PCI function with its own _PXM still inherits a DMA tag carrying
the upstream bridge's proximity domain. Resolving an SR-IOV VF's
locality through its PF therefore does not affect the domain used for
DMA allocations.

Create and cache a private child tag when the function, or a VF's
owning PF, has an explicit _PXM. Parent it to the existing PCI or IOMMU
tag so its constraints remain intact, then apply the function's domain
without mutating a shared tag.

pci_get_dma_tag() already performs the IOMMU lookup, so remove the
duplicated lookup in the ACPI subclass while here.

Reviewed by:    jhb
Sponsored by:   BBOX.io
Differential Revision:  https://reviews.freebsd.org/D59063

(cherry picked from commit f1f58bdf7b5fc58e6011c6ac2ae2ba129dc41991)
DeltaFile
+36-20sys/dev/acpica/acpi_pci.c
+36-201 files

FreeBSD/src 13e7b03sys/dev/acpica acpivar.h acpi.c

acpi_pci: Cache PCI proximity domains

A PCI function's _PXM is stable for the lifetime of its device
instance, but CPU and DMA locality queries may evaluate it repeatedly.
SR-IOV amplifies this because every VF resolves locality through the
same PF.

Cache successful mappings and the stable absence of _PXM on the
locality source device, and share that result between CPU and domain
queries. Continue to retry generic evaluation or mapping errors rather
than making a potentially transient failure permanent.

Reviewed by:    jhb
Sponsored by:   BBOX.io
Differential Revision:  https://reviews.freebsd.org/D59207

(cherry picked from commit 5f78d024695b39208a6c92f6a96017bae53cdf2c)
DeltaFile
+32-5sys/dev/acpica/acpi_pci.c
+15-7sys/dev/acpica/acpi.c
+3-0sys/dev/acpica/acpivar.h
+50-123 files

FreeBSD/src cac7fabsys/dev/acpica acpi_pci.c

acpi_pci: Preserve CPU locality queries for descendants

bus_generic_get_cpus() preserves the original leaf device while
forwarding a request through the bus hierarchy. Consequently,
acpi_pci_get_cpus() may receive a descendant below a PCI function
rather than one of the PCI bus's direct children.

Only apply the SR-IOV PF-locality mapping to direct PCI children.
Preserve the previous ACPI CPU-locality lookup for descendants so their
unrelated bus ivars are not interpreted as PCI device information.

Reviewed by:    jhb
Sponsored by:   BBOX.io
Differential Revision:  https://reviews.freebsd.org/D59206

(cherry picked from commit dc4f80da18f0dcc557a969b4283a86569266eb5c)
DeltaFile
+3-0sys/dev/acpica/acpi_pci.c
+3-01 files

FreeBSD/src 2dac650sys/dev/acpica acpi_pci.c

acpi_pci: Inherit PF locality for SR-IOV VFs

SR-IOV VFs are instantiated from their PF and intentionally do not
receive an ACPI handle by matching their runtime BDF.  Consequently,
ACPI locality queries for a VF fall back to the upstream bus.  This is
usually sufficient, but loses a _PXM supplied specifically for the PF.

Use the PCI core's owning-PF accessor for BUS_GET_DOMAIN and
BUS_GET_CPUS requests made for a VF.  This preserves the VF's lack of
an ACPI handle while allowing its CPU and NUMA placement to follow the
PF.

Reviewed by:    jhb
Sponsored by:   BBOX.io
Differential Revision:  https://reviews.freebsd.org/D59062

(cherry picked from commit 1a2a88684a0126be8d7172362d5ec7dbb7a41c81)
DeltaFile
+24-1sys/dev/acpica/acpi_pci.c
+24-11 files

FreeBSD/src 9b348b1sys/dev/acpica acpi_pci.c

acpi_pci: Do not match SR-IOV VFs to ACPI devices

SR-IOV VFs are instantiated dynamically from their PF rather than
enumerated from ACPI.  A VF's runtime slot and function can match an
unrelated _ADR below the bridge.  acpi_pci_save_handle() stores that
handle in the VF's devinfo before acpi_pci_update_device() runs.

If the handle is already bound to another device_t whose parent is not
acpi0, acpi_pci_update_device() panics under INVARIANTS.  Without
INVARIANTS, the VF retains the unrelated handle, so subsequent ACPI
lookups, including NUMA and power-management operations, can act on the
wrong namespace node.

Skip ACPI namespace matching for VFs.

Reviewed by:    jhb
Sponsored by:   BBOX.io
Differential Revision:  https://reviews.freebsd.org/D59061

(cherry picked from commit 8b74806161a188103666387013cdd93fb3f5dc07)
DeltaFile
+12-0sys/dev/acpica/acpi_pci.c
+12-01 files

FreeBSD/src 565b058lib/libmagic Makefile

MFC: libmagic: Add swap.c and magic.h to SRCS.

(cherry picked from commit 8929675e11c0c64ff96a2441082794980c9c6b2e)
DeltaFile
+4-2lib/libmagic/Makefile
+4-21 files

FreeBSD/src 2ae59e2contrib/file aclocal.m4 configure, contrib/file/magic/Magdir atari

MFC: MFV: file 5.48

(cherry picked from commit 7af41682a96bf7058b82665c33bb9b1bfa079c17)
DeltaFile
+419-140contrib/file/configure
+297-130contrib/file/aclocal.m4
+233-0contrib/file/magic/Magdir/atari
+115-77contrib/file/src/softmagic.c
+178-0contrib/file/src/landlock.c
+51-113contrib/file/src/apprentice.c
+1,293-46076 files not shown
+2,759-89282 files

FreeBSD/src 981bb14sbin/fsck_msdosfs boot.c

MFC: fsck_msdosfs: avoid signed integer overflow in readboot()

(cherry picked from commit 18094609d301540526d3d57e92705bc989d29986)
DeltaFile
+7-14sbin/fsck_msdosfs/boot.c
+7-141 files

FreeBSD/src 0011a18sbin/fsck_msdosfs dir.c

MFC: fsck_msdosfs: fix 32-bit overflow computing the LOST.DIR offset

(cherry picked from commit d3c5464fee7b178a39c189363e48806a11fd3da4)
DeltaFile
+2-2sbin/fsck_msdosfs/dir.c
+2-21 files

FreeBSD/src 8a702ccsbin/fsck_msdosfs fat.c

MFC: fsck_msdosfs: fix status accounting for lost cluster chains

(cherry picked from commit 6cf0d6c3b5777e053074200ff99dc4b750e62b96)
DeltaFile
+32-9sbin/fsck_msdosfs/fat.c
+32-91 files

FreeBSD/src 2643ff9sbin/fsck_msdosfs/tests Makefile fsck_msdosfs_large_test.sh

MFC: fsck_msdosfs: add a test for reconnecting on volumes larger than 4 GiB

MFC after:      1 week

(cherry picked from commit 37aec55d0a7165960f686e5277f030ab3d44cf45)
DeltaFile
+241-0sbin/fsck_msdosfs/tests/fsck_msdosfs_large_test.sh
+2-1sbin/fsck_msdosfs/tests/Makefile
+243-12 files

FreeBSD/src 741eb8asbin/fsck_msdosfs ext.h fat.c

MFC: fsck_msdosfs: fix memory leaks in checkfilesys()

(cherry picked from commit 6d49b0c0e7b8b77d8043593356e712307e894743)
DeltaFile
+4-1sbin/fsck_msdosfs/check.c
+1-1sbin/fsck_msdosfs/fat.c
+1-0sbin/fsck_msdosfs/ext.h
+6-23 files

FreeBSD/src 79e284asbin/fsck_msdosfs/tests Makefile fsck_msdosfs_boot_test.sh

MFC: fsck_msdosfs: add tests for the 32-bit boot block field decoding

(cherry picked from commit c4f458da4411872df4968e02ca292389df462b7b)
DeltaFile
+214-0sbin/fsck_msdosfs/tests/fsck_msdosfs_boot_test.sh
+2-1sbin/fsck_msdosfs/tests/Makefile
+216-12 files

FreeBSD/src 9af3236etc/mtree BSD.tests.dist, sbin/fsck_msdosfs Makefile

MFC: fsck_msdosfs: add tests for lost cluster chain repair accounting

(cherry picked from commit bbaf254293f7e19fa7b0f9ed1da21c7a43126d79)
DeltaFile
+261-0sbin/fsck_msdosfs/tests/fsck_msdosfs_test.sh
+5-0sbin/fsck_msdosfs/Makefile
+5-0sbin/fsck_msdosfs/tests/Makefile
+3-1etc/mtree/BSD.tests.dist
+274-14 files

FreeBSD/src 37ba8a2sbin/fsck_msdosfs boot.c

MFC: fsck_msdosfs: avoid signed integer overflow in readboot()

(cherry picked from commit 18094609d301540526d3d57e92705bc989d29986)
DeltaFile
+7-14sbin/fsck_msdosfs/boot.c
+7-141 files

FreeBSD/src 33bba26sbin/fsck_msdosfs fat.c

MFC: fsck_msdosfs: fix status accounting for lost cluster chains

(cherry picked from commit 6cf0d6c3b5777e053074200ff99dc4b750e62b96)
DeltaFile
+32-9sbin/fsck_msdosfs/fat.c
+32-91 files

FreeBSD/src d3f8718sbin/fsck_msdosfs dir.c

MFC: fsck_msdosfs: fix 32-bit overflow computing the LOST.DIR offset

(cherry picked from commit d3c5464fee7b178a39c189363e48806a11fd3da4)
DeltaFile
+2-2sbin/fsck_msdosfs/dir.c
+2-21 files

FreeBSD/src c2e12dbsbin/fsck_msdosfs ext.h fat.c

MFC: fsck_msdosfs: fix memory leaks in checkfilesys()

(cherry picked from commit 6d49b0c0e7b8b77d8043593356e712307e894743)
DeltaFile
+4-1sbin/fsck_msdosfs/check.c
+1-1sbin/fsck_msdosfs/fat.c
+1-0sbin/fsck_msdosfs/ext.h
+6-23 files

FreeBSD/src fb2c070sbin/fsck_msdosfs/tests Makefile fsck_msdosfs_large_test.sh

MFC: fsck_msdosfs: add a test for reconnecting on volumes larger than 4 GiB

MFC after:      1 week

(cherry picked from commit 37aec55d0a7165960f686e5277f030ab3d44cf45)
DeltaFile
+241-0sbin/fsck_msdosfs/tests/fsck_msdosfs_large_test.sh
+2-1sbin/fsck_msdosfs/tests/Makefile
+243-12 files

FreeBSD/src 99af5f3sbin/fsck_msdosfs/tests Makefile fsck_msdosfs_boot_test.sh

MFC: fsck_msdosfs: add tests for the 32-bit boot block field decoding

(cherry picked from commit c4f458da4411872df4968e02ca292389df462b7b)
DeltaFile
+214-0sbin/fsck_msdosfs/tests/fsck_msdosfs_boot_test.sh
+2-1sbin/fsck_msdosfs/tests/Makefile
+216-12 files

FreeBSD/src 5693123etc/mtree BSD.tests.dist, sbin/fsck_msdosfs Makefile

MFC: fsck_msdosfs: add tests for lost cluster chain repair accounting

(cherry picked from commit bbaf254293f7e19fa7b0f9ed1da21c7a43126d79)
DeltaFile
+261-0sbin/fsck_msdosfs/tests/fsck_msdosfs_test.sh
+5-0sbin/fsck_msdosfs/Makefile
+5-0sbin/fsck_msdosfs/tests/Makefile
+2-0etc/mtree/BSD.tests.dist
+273-04 files

FreeBSD/src 1922ceflib/libmagic Makefile

MFC: libmagic: Add swap.c and magic.h to SRCS.

(cherry picked from commit 8929675e11c0c64ff96a2441082794980c9c6b2e)
DeltaFile
+4-2lib/libmagic/Makefile
+4-21 files

FreeBSD/src 811f6b4contrib/file aclocal.m4 configure, contrib/file/magic/Magdir atari

MFC: MFV: file 5.48

(cherry picked from commit 7af41682a96bf7058b82665c33bb9b1bfa079c17)
DeltaFile
+419-140contrib/file/configure
+297-130contrib/file/aclocal.m4
+233-0contrib/file/magic/Magdir/atari
+115-77contrib/file/src/softmagic.c
+178-0contrib/file/src/landlock.c
+51-113contrib/file/src/apprentice.c
+1,293-46076 files not shown
+2,759-89282 files

FreeBSD/src b2a270dlib/libjail jail.c, usr.sbin/jail/tests jail_basic_test.sh

libjail: fix fetching mac.label for multiple jails

When doing a basic `jls -n`, jls(8) will jailparam_get() the mac.label
for every jail on the system using the same set of jailparams, and thus
the same jp_value.  We only init the mac_t the first time, so the first
jail would populate it with `?` from /etc/mac.conf and the resulting
jail_get(2) would clobber it with the empty string, then a second jail
would try to pass the empty string to the kernel and fail because it
must have a non-zero length.

Fix it by invoking jps_get() every time.  Drop some comments to note
that jps_get() will be invoked with zero || garbage from previous call,
and be sure that we don't leak our previous mac_t.  There aren't any
other jps_get implementations at this time, so this shouldn't cause any
unexpected problems.

Reported by:    ivy
Reviewed by:    jamie
Differential Revision:  https://reviews.freebsd.org/D57280
DeltaFile
+25-6lib/libjail/jail.c
+4-1usr.sbin/jail/tests/jail_basic_test.sh
+29-72 files

FreeBSD/src f2a2e02sys/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
DeltaFile
+26-0sys/compat/linuxkpi/common/include/linux/cleanup.h
+2-0sys/compat/linuxkpi/common/include/linux/file.h
+28-02 files