FreeBSD/src 65d7503sys/dev/ahci ahci_pci.c

ahci(4): Add another device ID for Marvell 9128 SATA controller: 0x91a3

This was encountered on a Gigabyte GA-P55A-UD4 motherboard identifying itself
as:
ahci0 at pci0:2:0:0:       class=0x01018f rev=0x11 hdr=0x00 vendor=0x1b4b device=0x91a3 subvendor=0x1458 subdevice=0xb000
    vendor     = 'Marvell Technology Group Ltd.'
    class      = mass storage
    subclass   = ATA

The physical chip has "88SE9128-NAA2" printed on it.

Similar code has been in Linux for a long time:
https://github.com/torvalds/linux/commit/50be5e3657cd2851a297dc0b3fd459f25829d29b

Co-authored-by: Michael Osipov <michaelo at FreeBSD.org>
PR:             288526
Reviewed by:    jhb
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D56464

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

FreeBSD/src 487eedasys/dev/ahci ahci_pci.c

ahci(4): Add another device ID for Marvell 9128 SATA controller: 0x91a3

This was encountered on a Gigabyte GA-P55A-UD4 motherboard identifying itself
as:
ahci0 at pci0:2:0:0:       class=0x01018f rev=0x11 hdr=0x00 vendor=0x1b4b device=0x91a3 subvendor=0x1458 subdevice=0xb000
    vendor     = 'Marvell Technology Group Ltd.'
    class      = mass storage
    subclass   = ATA

The physical chip has "88SE9128-NAA2" printed on it.

Similar code has been in Linux for a long time:
https://github.com/torvalds/linux/commit/50be5e3657cd2851a297dc0b3fd459f25829d29b

Co-authored-by: Michael Osipov <michaelo at FreeBSD.org>
PR:             288526
Reviewed by:    jhb
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D56464

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

FreeBSD/src bcef442sys/dev/ahci ahci_pci.c

ahci(4): Add another device ID for Marvell 9128 SATA controller: 0x91a3

This was encountered on a Gigabyte GA-P55A-UD4 motherboard identifying itself
as:
ahci0 at pci0:2:0:0:       class=0x01018f rev=0x11 hdr=0x00 vendor=0x1b4b device=0x91a3 subvendor=0x1458 subdevice=0xb000
    vendor     = 'Marvell Technology Group Ltd.'
    class      = mass storage
    subclass   = ATA

The physical chip has "88SE9128-NAA2" printed on it.

Similar code has been in Linux for a long time:
https://github.com/torvalds/linux/commit/50be5e3657cd2851a297dc0b3fd459f25829d29b

Co-authored-by: Michael Osipov <michaelo at FreeBSD.org>
PR:             288526
Reviewed by:    jhb
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D56464

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

FreeBSD/src 796fff5sys/compat/linuxkpi/common/include/linux xarray.h

linuxkpi: Define `DEFINE_XARRAY*()` macros

The `DEFINE_XARRAY*()` macros are used to declare a static xarray.

As the structure embeds a mutex(9), we also need to declare the static
mutex after the `struct xarray`. Thus the slightly awkward definition
of `DEFINE_XARRAY_FLAGS()`.

The DRM generic code started to use `DEFINE_XARRAY_ALLOC()` in Linux
6.12.

Reviewed by:    bz
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D56446
DeltaFile
+12-0sys/compat/linuxkpi/common/include/linux/xarray.h
+12-01 files

FreeBSD/src 713b4cesys/compat/linuxkpi/common/include/linux uaccess.h

linuxkpi: Add `copy_from_user_inatomic_nontemporal()` function

In Linux 7.1, `__copy_from_user_inatomic_nocache()` was renamed to
`copy_from_user_inatomic_nontemporal()`. This change was backported to
several LTS branches.

This includes Linux 6.12.x and the i915 DRM driver started to use it in
that version.

Reviewed by:    bz
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D56719
DeltaFile
+7-0sys/compat/linuxkpi/common/include/linux/uaccess.h
+7-01 files

FreeBSD/src 783d018sys/compat/linuxkpi/common/include/linux xarray.h, sys/compat/linuxkpi/common/src linux_xarray.c

linuxkpi: Add `struct xa_limit` support to xarray

The `xa_alloc*()` functions family takes a `struct xa_limit` to describe
the range of IDs the caller wants to allocate. We were using a single
mask to qualify a maximum ID only.

This commit changes that to use the same `struct xa_limit`. The logic
did not change, except it now supports a minimum ID as well.

The definition of `XA_LIMIT()` macro is adapted, as well as the
definitions of `xa_limit_*` (only `xa_limit_32b` existed, the other two
are added with this commit).

The DRM generic code started to use this `struct xa_limit` in Linux
6.12.

Reviewed by:    bz
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D56445
DeltaFile
+18-23sys/compat/linuxkpi/common/src/linux_xarray.c
+16-10sys/compat/linuxkpi/common/include/linux/xarray.h
+34-332 files

FreeBSD/src b683fd0sys/kern subr_module.c subr_prf.c, sys/sys sbuf.h

preload: add "show preload" DDB command

This is the DDB equivalent of the debug.dump_modinfo sysctl which
outputs pretty-printed bootloader metadata.

Move sbuf_db_printf_drain to subr_prf.c and expose it for general use.

Reviewed By: jmg
Differential Revision: https://reviews.freebsd.org/D53763
DeltaFile
+20-0sys/kern/subr_module.c
+9-0sys/kern/subr_prf.c
+0-6sys/kern/subr_witness.c
+3-0sys/sys/sbuf.h
+32-64 files

FreeBSD/src 6403ef5bin/ps print.c keyword.c

/bin/ps: Fix display of negative nice values on ARMv7/aarch64

On Arm-based systems (and maybe others), 'char' defaults to unsigned,
causing negative nice values to be displayed incorrectly (e.g., 246
instead of -10). Explicitly using 'signed char' ensures consistent
behaviour across architectures.

[ tested on RPI2 and generic aarch64 qemu install ]

Before:
  # /usr/bin/nice --10 ps -l | awk '(NR == 1 || $(NF-1) == "ps")'
  UID   PID  PPID C PRI  NI  VSZ  RSS MWCHAN  STAT TT     TIME COMMAND
    0 23606 22800 2 -32 246 5400 2544 -       R<+   0  0:00.06 ps -l

After:
  # /usr/bin/nice --10 ps -l | awk '(NR == 1 || $(NF-1) == "ps")'
  UID   PID  PPID C PRI  NI  VSZ  RSS MWCHAN  STAT TT     TIME COMMAND
    0 23614 22800 3 -32 -10 5400 2544 -       R<+   0  0:00.05 ps -l


    [5 lines not shown]
DeltaFile
+3-0bin/ps/print.c
+1-1bin/ps/keyword.c
+1-1bin/ps/ps.h
+5-23 files

FreeBSD/src dcf54a1lib/geom/part geom_part.c

geom_part: Restore the human readable format of size

Prior to the change 4f809ffec69c, the sizes are formated by
humanize_number(3) with the flag HN_DECIMAL, which displays the result
using one decimal place when it is less than 10. That is more accurate
and useful. Add equivalent field modifier hn-decimal to xo_emit() to
restore the previous behavior.

Reported by:    Mark Millard
Reviewed by:    js
Fixes:          4f809ffec69c gpart: add libxo support for "show" subcommand + man page updates
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D56514

(cherry picked from commit 0d16792c6e983005581ed0176ed81e7302582196)
(cherry picked from commit d2bf940ec1447ca69ed605395455d07facf4d3ca)
DeltaFile
+4-4lib/geom/part/geom_part.c
+4-41 files

FreeBSD/src d2bf940lib/geom/part geom_part.c

geom_part: Restore the human readable format of size

Prior to the change 4f809ffec69c, the sizes are formated by
humanize_number(3) with the flag HN_DECIMAL, which displays the result
using one decimal place when it is less than 10. That is more accurate
and useful. Add equivalent field modifier hn-decimal to xo_emit() to
restore the previous behavior.

Reported by:    Mark Millard
Reviewed by:    js
Fixes:          4f809ffec69c gpart: add libxo support for "show" subcommand + man page updates
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D56514

(cherry picked from commit 0d16792c6e983005581ed0176ed81e7302582196)
DeltaFile
+4-4lib/geom/part/geom_part.c
+4-41 files

FreeBSD/src d11419esys/net iflib.c

iflib: Add a missing CURVNET_RESTORE() in the error path

Signed-off-by:  Peter Ganzhorn <peter.ganzhorn at gmail.com>
Reviewed by:    zlei
Fixes:          6d49b41ee84b iflib: Add pfil hooks
MFC after:      3 days
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2150

(cherry picked from commit f49f61f19463c21125bb1215cf8e0530f52953e3)
DeltaFile
+3-1sys/net/iflib.c
+3-11 files

FreeBSD/src e7eef56bin/ps print.c keyword.c

/bin/ps: Fix display of negative nice values on ARMv7/aarch64

On Arm-based systems (and maybe others), 'char' defaults to unsigned,
causing negative nice values to be displayed incorrectly (e.g., 246
instead of -10). Explicitly using 'signed char' ensures consistent
behaviour across architectures.

[ tested on RPI2 and generic aarch64 qemu install ]

Before:
  # /usr/bin/nice --10 ps -l | awk '(NR == 1 || $(NF-1) == "ps")'
  UID   PID  PPID C PRI  NI  VSZ  RSS MWCHAN  STAT TT     TIME COMMAND
    0 23606 22800 2 -32 246 5400 2544 -       R<+   0  0:00.06 ps -l

After:
  # /usr/bin/nice --10 ps -l | awk '(NR == 1 || $(NF-1) == "ps")'
  UID   PID  PPID C PRI  NI  VSZ  RSS MWCHAN  STAT TT     TIME COMMAND
    0 23614 22800 3 -32 -10 5400 2544 -       R<+   0  0:00.05 ps -l


    [4 lines not shown]
DeltaFile
+3-0bin/ps/print.c
+1-1bin/ps/keyword.c
+1-1bin/ps/ps.h
+5-23 files

FreeBSD/src e7f4269sys/dev/asmc asmc.c asmcvar.h

asmc: replace hardcoded model table with universal probing

Probe SMC keys at attach time to detect hardware capabilities,
supporting all Intel Apple machines without per-model entries.

Sensors are discovered by scanning sorted SMC key ranges for
known prefixes and types. Capabilities such as SMS, fan safe
speed, and ambient light are detected by key presence.

A global key description table provides human-readable names
for well-known temperature sensors.

Tested on:
 - MacBook Pro (Early 2007, Mid 2014, Mid 2015)
 - MacBook Air (Early 2015, Mid 2017)
 - iMac (Mid 2011, Late 2013)
 - Mac mini (Mid 2011)

Reviewed by:    adrian
Differential Revision:  https://reviews.freebsd.org/D56405
DeltaFile
+529-642sys/dev/asmc/asmc.c
+17-944sys/dev/asmc/asmcvar.h
+546-1,5862 files

FreeBSD/src 59a844bsys/powerpc/mpc85xx pci_mpc85xx.c

mpc85xx/msi: Add compat string for T208x/T4xxx SoCs
DeltaFile
+2-1sys/powerpc/mpc85xx/pci_mpc85xx.c
+2-11 files

FreeBSD/src 787b5e1sys/conf files.powerpc

dtrace: Add missing file for powerpc kernel build
DeltaFile
+1-0sys/conf/files.powerpc
+1-01 files

FreeBSD/src 0a70558sys/dev/iicbus/mux iicmux.c

iicmux: Return the right error codes

I2C subsystem errors belong in the IIC_* error space.  It's pretty clear
this is what is intended in the code.
DeltaFile
+3-3sys/dev/iicbus/mux/iicmux.c
+3-31 files

FreeBSD/src 40bcad5sys/powerpc/include pcpu.h, sys/powerpc/powerpc openpic.c pic_if.m

powerpc/pic: Add a PIC_AP_INIT() to set up AP PIC info

pc_cpuid may not match the PIC's idea of a given CPU.  Since openpic
has a WHOAMI register, we can use that to get the PIC's idea of the CPU.
This needs to be done on each AP, so add a PIC_AP_INIT device method so
the PIC can perform any AP-specific initialization at AP bootstrap time.

This fixes SMP on e6500, which is still lacking SMT support.

Differential Revision:  https://reviews.freebsd.org/D56421
DeltaFile
+21-7sys/powerpc/powerpc/openpic.c
+3-0sys/powerpc/powerpc/pic_if.m
+1-0sys/powerpc/powerpc/mp_machdep.c
+1-0sys/powerpc/include/pcpu.h
+26-74 files

FreeBSD/src 605f537sys/powerpc/include openpicvar.h openpicreg.h, sys/powerpc/powerpc openpic.c

powerpc/openpic: Increase the maximum number of IRQs allowed

The Freescale MPIC supports up to 2048 IRQs, but since we only build an
array of 768 interrupts in intr_machdep, clamp the max at 512.  The most
any Freescale PowerPC chip actually supports is 452 on the T4240, so 512
is sufficient.

As part of this, increase the vector mask to the full openpic vector
mask, and use this limit as the terminator for the dispatch loop,
instead of a hard-coded 255.

Differential Revision:  https://reviews.freebsd.org/D56422
DeltaFile
+8-2sys/powerpc/powerpc/openpic.c
+2-1sys/powerpc/include/openpicvar.h
+1-1sys/powerpc/include/openpicreg.h
+11-43 files

FreeBSD/src 72e2ae5sys/netinet tcp_timewait.c, sys/sys ktls.h

tcp: release nic ktls send tags when entering time wait

When under heavy load or churn, inline ktls offload NICs may run out
of hardware resources described by ktls send tags.  Rather than
waiting for connections to pass through the time_wait state, reclaim
the ktls send tags early, at entry to time_wait. By preventing
potentially tens or hundreds of thousands of sessions from holding
send tags in time_wait, this allows more ktls sessions to be offloaded
to hardware.

Reviewed by: glebius, kib, nickbanks_netflix.com, rrs, tuexen
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D56610
DeltaFile
+12-0sys/sys/ktls.h
+10-0sys/netinet/tcp_timewait.c
+22-02 files

FreeBSD/src 0216ea8sys/dev/netmap netmap.c

netmap: check for possible out-of-bound write with options

Submitted by:   hari.thirusangu at sophos.com
MFC after:      2 weeks
DeltaFile
+1-0sys/dev/netmap/netmap.c
+1-01 files

FreeBSD/src bffaea6sys/compat/linuxkpi/common/include/linux gfp.h, sys/compat/linuxkpi/common/src linux_page.c

linuxkpi: Implement __GFP_THISNODE in alloc_pages()

It indicates to `alloc_pages()` to allocate the pages from the current
NUMA domain. If it couldn't, it should not retry elsewhere and return
failure.

Reviewed by:    bz
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit 06a51a510a60ca29193b2cdb8120b630ea9ef18c)
DeltaFile
+12-3sys/compat/linuxkpi/common/src/linux_page.c
+1-1sys/compat/linuxkpi/common/include/linux/gfp.h
+13-42 files

FreeBSD/src 1feb0efsys/compat/linuxkpi/common/include/linux gfp.h

linuxkpi: Define `GFP_KERNEL_ACCOUNT` flag

This flag combines `GFP_KERNEL` and `__GFP_ACCOUNT`. The latter is also
defined in this commit. It is defined as a no-op flag as it is not
implemented.

The DRM generic code started to use it in Linux 6.12.x.

Reviewed by:    bz
Sponsored by:   The FreeBSD Foundation

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

FreeBSD/src 5450393sys/compat/linuxkpi/common/include/linux bits.h bitops.h

linuxkpi: Move `GENMASK()` to <linux/bits.h>

... from <linux/bitops.h>.

This matches the location on Linux.

<linux/bits.h> is also included from <linux/bitops.h>. Therefore it will
not break anything.

Reviewed by:    bz
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit 47e1ca7f3720c76fdc729e03034fa53c798b9318)
DeltaFile
+14-0sys/compat/linuxkpi/common/include/linux/bits.h
+2-2sys/compat/linuxkpi/common/include/linux/bitops.h
+16-22 files

FreeBSD/src 73efadesys/compat/linuxkpi/common/include/linux pci.h

linuxkpi: Add `pci_dev_is_disconnected()`

For now, it is an empty stub that always return false. On Linux, it
looks at an internal error state of the device to determine if it is
disconnected.

The amdgpu DRM driver started this in Linux 6.12.x.

Reviewed by:    bz
Sponsored by:   The FreeBSD Foundation

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

FreeBSD/src 8f8af33sys/compat/linuxkpi/common/include/linux minmax.h

linuxkpi: Define `min_array()` and `max_array()`

They are macros that return the minimum or maximum values of an array of
integers. They assume that the array contains elements.

The i915 DRM driver started to use `min_array()` in Linux 6.12.x.

Reviewed by:    bz
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit 9a2de1d2042d1c2730dd3049c26d481813b5f2bd)
DeltaFile
+10-0sys/compat/linuxkpi/common/include/linux/minmax.h
+10-01 files

FreeBSD/src 12d558dsys/compat/linuxkpi/common/include/linux string.h

linuxkpi: Add `memdup_array_user()`

The amdgpu DRM driver started this in Linux 6.12.x.

Reviewed by:    bz
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit 5dfbc6593cdacd5b4e4939e09d595b3a9c8e47da)
DeltaFile
+11-0sys/compat/linuxkpi/common/include/linux/string.h
+11-01 files

FreeBSD/src dd7e503sys/compat/linuxkpi/common/include/linux array_size.h kernel.h

linuxkpi: Move `ARRAY_SIZE` to <linux/array_size.h>

The DRM generic code started to import this header directly in Linux
6.12.x. Let's move the definition of `ARRAY_SIZE()` (the only thing that
<linux/array_size.h> defines) to this header.

Also, include <linux/array_size.h> from the same headers as Linux. This
includes <linux/kernel.h>, so the change should not break anything.

Reviewed by:    bz
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit 1c641d0436e377c57a767e37f56ce65253817d67)
DeltaFile
+17-0sys/compat/linuxkpi/common/include/linux/array_size.h
+1-2sys/compat/linuxkpi/common/include/linux/kernel.h
+1-0sys/compat/linuxkpi/common/include/linux/kfifo.h
+1-0sys/compat/linuxkpi/common/include/linux/string.h
+20-24 files

FreeBSD/src ce3348bsys/compat/linuxkpi/common/include/linux slab.h, sys/compat/linuxkpi/common/src linux_slab.c

linuxkpi: Add Linux 6.12 variant of `kvrealloc()`

In Linux 6.12, the API changed to be closer to `krealloc()`:
* The function does not take the old size anymore
* The function becomes a wrapper around `krealloc()` with a fallback
  mechanism.

Reviewed by:    bz
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit d74fa49d0c0476353af137d22b5ef8711c67b854)
DeltaFile
+25-18sys/compat/linuxkpi/common/include/linux/slab.h
+38-0sys/compat/linuxkpi/common/src/linux_slab.c
+63-182 files

FreeBSD/src 9fb9b04sys/compat/linuxkpi/common/include/linux wordpart.h compiler.h

linuxkpi: Move {lower,upper}_32_bits macros to <linux/wordpart.h>

... from <linux/compiler.h>.

<linux/wordpart.h> is the header defining them on Linux 6.12 (I didn't
check older versions).

<linux/wordpart.h> is also included from <linux/kernel.h>.

The DRM generic code started to depend on <linux/wordpart.h> in Linux
6.12.

Reviewed by:    bz
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit 0a2f3b8ef16786a44fc88afd8862920df4527a3c)
DeltaFile
+13-0sys/compat/linuxkpi/common/include/linux/wordpart.h
+0-3sys/compat/linuxkpi/common/include/linux/compiler.h
+1-0sys/compat/linuxkpi/common/include/linux/kernel.h
+14-33 files

FreeBSD/src b34aa6bsys/compat/linuxkpi/common/include/linux rbtree.h

linuxkpi: Add `rb_add()`

It is the same as `rb_add_cached()` but it works on `struct rb_root`, not
a `struc rb_root_cached`. It also does not return anything.

The DRM generic code started to use this in Linux 6.12.x.

Reviewed by:    bz
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit cff716c2854c167ef7ff3a4785f5faed9b0a4f98)
DeltaFile
+20-0sys/compat/linuxkpi/common/include/linux/rbtree.h
+20-01 files