Commit graph

153981 commits

Author SHA1 Message Date
Bjoern A. Zeeb
b4886c4ece rtw88/rtw89: avoid duplicate top-level directory with debugfs
If people like me having multiple cards in the same system
creating the debugfs dirctory leads to a panic upon attaching
the 2nd card due to the duplicate name.
Rather than using the hard coded driver name, use the device name
(e.g., rtw880, rtw881, rtw882).
This solves two issues: it avoids the duplicate name and we get
individual debugging/statistic information for each card.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
X-Note:		ath1[01]k and mt76 likely will need a similar change
2025-01-31 23:53:31 +00:00
Bjoern A. Zeeb
446eab491e rtw89: turn on debugfs support
Following 07f6575585 also turn on debugfs support for rtw89.

Sponnsored by:	The FreeBSD Foundation
MFC after:	3 days
2025-01-31 23:53:31 +00:00
Bjoern A. Zeeb
1b840f09b6 LinuxKPI: 802.11: remove rate_lowest_index()
rate_lowest_index() is no longer used anywhere in our code.
Garbage collect it.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2025-01-31 23:53:31 +00:00
Bjoern A. Zeeb
c75a558d07 LinuxKPI: 802.11: implement ieee80211_get_{he,eht}_iftype_cap{,_vif}
Implement the combination of all four functions, the *_vif versions
from mac80211.h as a wrapper to the non-*_vif ones in cfg80211.h.
Put the function pairs next to each other and in the right files
and harmonize argument naming, etc.

Both of them have shown up too often in the todo-tracing to bother
enough to implement them now for a time in the future when we will
support HE/EHT.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2025-01-31 23:53:30 +00:00
Bjoern A. Zeeb
ecb2e5f9c3 LinuxKPI; 802.11 initalize ic_vht_cap.supp_mcs
Given the channel struct has an extra bool we cannot assign the
information 1:1 to net80211.  While the caps where assigned the
suppoerted mcs sets were not.  Fix that.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2025-01-31 23:53:30 +00:00
Gleb Smirnoff
2d99af9410 tcp: remove check for condition that never happens
A tcpcb in TCPS_LISTEN has always socket in SO_ACCEPTCONN.  One block
above there is an assertion that proves that this never happens.  We
stopped ever clearing SO_ACCEPTCONN back in 779f106aa1.

This reverts commit 982c1675ff.

Reviewed by:		cc, markj
Differential Revision:	https://reviews.freebsd.org/D48710
2025-01-31 14:24:24 -08:00
John Baldwin
38e1083940 nvmf: Add NVMF_CONNECTION_STATUS ioctl
This returns an nvlist indicating if a Fabrics host is connected and
the time of the most recent disconnection.

Reviewed by:	imp
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D48219
2025-01-31 15:47:58 -05:00
John Baldwin
4298ce72f6 nvme/nvmf: Add NVME_GET_CONTROLLER_DATA ioctl to fetch cached cdata
Both nvme and nvmf cache a copy of the controller's identify data in
the softc.  Add an ioctl to fetch this copy of the cdata.  This is
primarily useful for allowing commands like 'nvmecontrol devlist' to
work against a disconnected Fabrics host.

Reviewed by:	dab, imp
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D48218
2025-01-31 15:46:49 -05:00
Alfredo Mazzinghi
88b187401d iflib: Simplify CACHE_PTR_NEXT
Reviewed by:	Krzysztof Galazka <krzysztof.galazka@intel.com>
Obtained from:	CheriBSD
Sponsored by:	AFRL, DARPA
Differential Revision:	https://reviews.freebsd.org/D48446
2025-01-31 15:41:45 -05:00
John Baldwin
f66a407de2 sys: Add cpu_update_pcb hook
This MD function is invoked before dumping register set notes when
writing out a core dump to ensure that the PCB for a given thread is
up to date.  This provides a centralized place to update the PCB with
values of the current thread for each arch rather than doing this work
in each register set's get method.

Discussed with:	jrtc27
Reviewed by:	kib, markj
Sponsored by:	AFRL, DARPA
Differential Revision:	https://reviews.freebsd.org/D44910
2025-01-31 15:40:29 -05:00
John Baldwin
17b7a0c595 nvmft: Don't offline a port being removed if it is already offline
This is generally harmless but can trigger spurious warnings on the
console due to duplicate attempts to disable LUNs.

Sponsored by:	Chelsio Communications
2025-01-31 15:13:52 -05:00
Jessica Clarke
4015ff43cb vm: Fix overflow issues in vm_page_startup
Firstly, pagecount is a u_long so we should ensure j is the same for the
sake of 64-bit systems. Secondly, ptoa is just a macro, and does not
cast its argument, so in order to handle PAE systems correctly we need
to cast j to vm_paddr_t (the type of startp).

Fixes:	0078df5f02 ("vm_phys: reduce touching of page->pool fields")
2025-01-31 18:37:27 +00:00
Jean-Sébastien Pédron
e5764cf075
linuxkpi: Don't destroy the mutex in xa_destroy()
[Why]
The mutex initialized in `xa_init_flags()` is not destroyed here on
purpose. The reason is that on Linux, the xarray remains usable after a
call to `xa_destroy()`. For instance the i915 DRM driver relies on that
during the initialixation of its GuC. Basically, `xa_destroy()` "resets"
the structure to zero but doesn't really destroy it.

Reviewed by:	manu
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48762
2025-01-31 17:00:50 +01:00
Jean-Sébastien Pédron
2ee1311820
lindebugfs: Add debugfs_lookup()
[Why]
This function is used by hhe DRM generic code starting with Linux 6.7.

Reviewed by:	manu
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48761
2025-01-31 17:00:50 +01:00
Jean-Sébastien Pédron
f570760e5f
linuxkpi: Add several headers to reproduce namespace pollution
[Why]
The i915 DRM driver relies on this chain of includes to access the
definition of `struct tasklet_struct` in `<linux/interrupt.h>`.

Reviewed by:	imp, manu
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48760
2025-01-31 17:00:49 +01:00
Jean-Sébastien Pédron
73281513fc
linuxkpi: Add pci_wake_from_d3()
[Why]
This is used by the amdgpu DRM driver starting with Linux 6.7.

[How]
The function just returns 0 for now.

Reviewed by:	manu
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48759
2025-01-31 17:00:49 +01:00
Jean-Sébastien Pédron
8bdb76f202
linuxkpi: Add dev_is_removable()
[Why]
This is used by the amdgpy DRM driver starting from Linux 6.7.

[How]
The function always returns false, like `pci_is_thunderbolt_attached()`
because we don't have an API for this in FreeBSD yet.

Reviewed by:	manu
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48758
2025-01-31 17:00:49 +01:00
Jean-Sébastien Pédron
e3cf2321b0
linuxkpi: Add get_file_active()
[Why]
This is used by the i915 DRM driver starting from Linux 6.7.

Reviewed by:	manu
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48757
2025-01-31 17:00:49 +01:00
Jean-Sébastien Pédron
1de8fcf419
linuxkpi: Add Linux 6.7 get_file_rcu() variant
[Why]
In Linux 6.7, the signature of `get_file_rcu()` changed significantly,
going from:

    bool get_file_rcu(struct linux_file *f);

... to:

    struct linux_file * get_file_rcu(struct linux_file **f);

I.e., both the argument and the return value changed in an incompatible
way.

This is used by the i915 DRM driver.

[How]
This patch introduces the variant and hide the new prototype behind
`LINUXKPI_VERSION >= 60700`.

Reviewed by:	manu
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48756
2025-01-31 17:00:49 +01:00
Jean-Sébastien Pédron
be818f265e
linuxkpi: Use same field names in struct xarray as Linux
[Why]
The i915 DRM driver started to access the `xa_lock` field in Linux 6.7.

Reviewed by:	manu
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48754
2025-01-31 17:00:48 +01:00
Jean-Sébastien Pédron
668fe90dc8
linuxkpi: Add xa_alloc_cyclic_irq()
[Why]
This function is used by the i915 DRM driver starting with Linux 6.7.

Reviewed by:	manu
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48753
2025-01-31 17:00:48 +01:00
Jean-Sébastien Pédron
3fd7fd4974
linuxkpi: Add __assign_bit()
[Why]
This function is used by the i915 DRM driver in Linux 6.7.

Reviewed by:	manu
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48752
2025-01-31 17:00:48 +01:00
Jean-Sébastien Pédron
2da778e62e
linuxkpi: Include <linux/{types,io}.h> from <video/vga.h>
[Why]
Some files in the i915 DRM driver in Linux 6.7 depend on these implicit
inclusions.

Reviewed by:	manu
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48751
2025-01-31 17:00:48 +01:00
Jean-Sébastien Pédron
08c2f6cf46
linuxkpi: Unify definition of outb()
[Why]
It is already defined in <asm-generic/io.h> to use the FreeBSD versions.

Reviewed by:	manu
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48750
2025-01-31 17:00:48 +01:00
Jean-Sébastien Pédron
d526b2115e
linuxkpi: Add num_online_nodes()
[Why]
This is used by the amdkfd DRM driver in Linux 6.7.

Reviewed by:	manu
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48749
2025-01-31 17:00:47 +01:00
Jean-Sébastien Pédron
f4ffe67739
linuxkpi: Add private_data to struct shrinker
[Why]
This field is used by the i915 DRM driver in Linux 6.7.

Reviewed by:	manu
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48748
2025-01-31 17:00:47 +01:00
Jean-Sébastien Pédron
479c61bd5f
linuxkpi: Add pci_get_base_class()
[Why]
This new API is used by the amdgpu DRM driver is Linux 6.7.

[How]
This is the same as `pci_get_class()` except that it searches a PCI
device matching the base class only; the subclass is ignored.

Reviewed by:	manu
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48746
2025-01-31 17:00:47 +01:00
Jean-Sébastien Pédron
c118e4da12
pci: Add pci_find_base_class_from()
[Why]
linuxkpi needs to export `pci_get_base_class()` for DRM drivers from
Linux 6.7.

[How]
This new function searches a PCI device with the given base class and
returns it, regardless of its subclass.

The behavior is the same as `pci_find_class_from()` but the subclass is
ignored.

Reviewed by:	manu
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48745
2025-01-31 17:00:47 +01:00
Jean-Sébastien Pédron
cd245b7941
linuxkpi: Add kstrtou32()
[Why]
This is used by the amdgpu DRM driver in Linux 6.7.

Reviewed by:	manu
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48744
2025-01-31 17:00:47 +01:00
Jean-Sébastien Pédron
03e39d3d42
linuxkpi: Declare PCI_IRQ_LEGACY even for linuxkpi 6.7
[Why]
DRM drivers in Linux 6.7 already use this constant.

Reviewed by:	manu
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48742
2025-01-31 17:00:46 +01:00
Jean-Sébastien Pédron
2cd5324153
linuxkpi: Add idr.h -> radix-tree.h -> rcupdate.h includes
[Why]
Some files in DRM rely on namespace pollution: they use the
<linux/rcupdate.h> API without including it explicitly.

[How]
Reproduce the Linux chain of includes even if it means nothing on
FreeBSD. This allows consumers of <linux/idr.h> to "inherit"
<linux/rcupdate.h> API.

Reviewed by:	manu
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48741
2025-01-31 17:00:46 +01:00
Jean-Sébastien Pédron
9136a44a2d
linuxkpi: Add <linux/cec.h>
Reviewed by:	manu
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48740
2025-01-31 17:00:42 +01:00
Andrew Gallatin
36fdc42c6a mlx5en: Fix SIOCSIFCAPNV
In 4cc5d081d8, a change was introduced that manipulated
drv_ioctl_data->reqcap using IFCAP2 bits.  This was noticed
when creating a mixed lagg with mce0 and ixl0 caused the
interfaces' txcsum caps to be disabled.

Fixes: 4cc5d081d8
Reviewed by: glebius
Sponsored by: Netflix
MFC After: 7 days
2025-01-30 20:57:35 -05:00
Kirk McKusick
1111a44301 Defer the January 19, 2038 date limit in UFS1 filesystems to February 7, 2106
UFS1 uses a signed 32-bit value for its times. Zero is
January 1, 1970 UTC. Negative values of 32-bit time predate
January 1, 1970 back to December 13, 1901. The maximum positive
value for 32-bit time is on January 19, 2038 (my 84th birthday).
On that date, time will go negative and start registering from
December 13, 1901. Note that this issue only affects UFS1 filesystems
since UFS2 has 64-bit times. This fix changes UFS1 times from
signed to unsigned 32-bit values. With this change it will no longer
be possible to represent time from before January 1, 1970, but it
will accurately track time until February 7, 2106. Hopefully there
will not be any FreeBSD systems using UFS1 still in existence by
that time (and by then I will have been dead long enough that no-one
will know at whom to yell :-).

It is possible that some existing UFS1 systems will have set times
predating January 1, 1970. With this commit they will appear as
later than the current time. This commit checks inode times when
they are read into memory and if they are greater than the current
time resets them to the current time. By default this reset happens
silently, but setting the sysctl vfs.ffs.prttimechgs=1 will cause
console messages to be printed whenever a future time is changed.

Reviewed-by: kib
Tested-by:   Peter Holm
MFC-after:   1 week
Differential Revision: https://reviews.freebsd.org/D48472
2025-01-30 17:31:08 -08:00
Zhenlei Huang
903c7cdac5 vnet: Fix style nits
MFC after:	3 days
2025-01-30 23:59:35 +08:00
Kristof Provost
a55197c322 if_ovpn: fix module load in NOINET6 kernels
PR:		284459
MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2025-01-30 12:07:15 +01:00
Enji Cooper
36d7d2044b mca_log: add missing breaks when handling thresholds
Per the "Intel® 64 and IA-32 Architectures Software Developer’s Manual
Combined Volumes: Vol. 3B 17-7", the Green and Yellow threshold
indicators are mutually exclusive. Add the missing `break` statements so
they're treated that way.

MFC after:	1 week
Reported by:	Coverity
Differential Revision:	https://reviews.freebsd.org/D48722
2025-01-29 19:42:18 -08:00
Gleb Smirnoff
cdacb12065 netlink/route: validate family attribute
PR:			283818
2025-01-29 15:48:55 -08:00
Gleb Smirnoff
031fbf8dc9 netlink/route: fix fib number validation in old Linux compat mode
The value passed via old field also needs to be validated.

PR:			283848
Fixes:			f34aca55ad
2025-01-29 15:48:55 -08:00
Gleb Smirnoff
49a6e21341 netlink/route: fix nlattr_get_multipath() to check length
of supplied nexthop sub-attributes.  While here, use unsigned types for
length calculations and improve style(9).

PR:			283860
2025-01-29 15:48:55 -08:00
Gleb Smirnoff
876b88a448 netlink: consistently use unsigned types in the parser
Use uint32_t for anything that is derived from message length, use
uint16_t for anything that represents attribute length and use u_int for
array indices.
2025-01-29 15:48:55 -08:00
Gleb Smirnoff
810c122695 netlink: use u_int as argument for ifnet_byindex() 2025-01-29 15:48:55 -08:00
Gleb Smirnoff
8b094a9801 netlink: style(9) pass over message parsing code
Mostly breaking long lines, few other changes.
2025-01-29 15:48:55 -08:00
John Baldwin
c06b504def simplebus: Stop accepting SYS_RES_IOPORT resources
Child devices handling I/O port resources (such as PCI-e bridges)
should map those to a memory resource and pass up a request for the
translated memory resource.

Differential Revision:	https://reviews.freebsd.org/D48501
2025-01-29 10:03:37 -05:00
Doug Moore
0078df5f02 vm_phys: reduce touching of page->pool fields
Change the usage of the pool field in vm_page structs.

Currently, every page belongs to a pool, and the pool field identifies
that pool, whether the page is allocated or free.

With this change, the pool field of the first page of a free block is
used by the buddy allocator to identify its pool, but the buddy
allocator makes no guarantees about the pool field value for allocated
pages. The buddy allocator requires that a pool parameter be passed as
part of freeing memory. A function that allocates memory may use the
pool field of a page to record what pool to pass as that parameter
when the memory is freed, but might not need to do so for every
allocated page.

Suggested by:	alc
Reviewed by:	markj (previous version)
Tested by:	pho
Differential Revision:	https://reviews.freebsd.org/D45409
2025-01-29 03:13:17 -06:00
Mark Johnston
94fb5ab904 Revert "dtrace/arm64: Simplify dtrace_getarg() slightly"
The change is clearly wrong as it removes a dereference of the pointer
into the stack.  Just revert for now.

This reverts commit 70c0670622.

Reported by:	jrtc27
2025-01-29 03:12:46 +00:00
Mark Johnston
4da070ce6c dtrace/arm64: Fix enumeration of FBT return probes
On arm64, the FBT provider treats tail calls as return probes.  Ignoring
the question of whether this is really correct, the implementation is
wrong: instr is a pointer to uint32_t, so the removed multiplication by
the instruction size is wrong.  As a result, FBT would create return
probes for intra-function branches.

MFC after:	2 weeks
Sponsored by:	Innovate UK
2025-01-29 02:03:02 +00:00
Mark Johnston
70c0670622 dtrace/arm64: Simplify dtrace_getarg() slightly
The use of memcpy here is redundant, and also incorrect since memcpy()
might be instrumented by fbt or kinst.  dtrace_bcopy() exists, but we
don't need it.

MFC after:	2 weeks
Sponsored by:	Innovate UK
2025-01-29 01:05:03 +00:00
Warner Losh
c64b3f32a5 umass: Add comment for ASC/ASCQ 24h/00h INVALID FIELD IN CDB
Add a comment for what this asc/ascq combo means. Very few people have
this memorized.

Sponsored by:		Netflix
2025-01-28 13:08:51 -07:00
Mark Johnston
5289625dfe zinject: Fix format string errors on 32-bit platforms
Fixes:	c6767dc1f2 ("zfs: merge openzfs/zfs@34205715e")
2025-01-28 15:11:24 +00:00