Commit graph

5163 commits

Author SHA1 Message Date
Brooks Davis
d9d2e3ab7c sysent: regen comments 2024-10-01 18:46:40 +01:00
Brooks Davis
13227efc5b sysent: regen removing comment alignment 2024-10-01 17:10:08 +01:00
Bjoern A. Zeeb
0b325167f6 LinuxKPI: 802.11: move functions between header files
Move some ieee8022_{is,has,get}_... functions working on header fields
from mac80211.h to ieee80211.h to avoid problems with #includes.

No functional changes.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2024-09-27 17:54:16 +00:00
Konstantin Belousov
927f379180 Regen 2024-09-27 18:02:23 +03:00
Ed Maste
3cf834d069 linuxulator: ignore AT_NO_AUTOMOUNT for all stat variants
Commit ff39d74aa9 ignored AT_NO_AUTOMOUNT for statx(), but did not
change fstat64() or newfstatat(), which also take an equivalent flags
argument.  Add a linux_to_bsd_stat_flags() helper and use it in all
three places.

PR:		281526
Reviewed by:	trasz
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D46711
2024-09-24 13:58:42 -04:00
Bjoern A. Zeeb
c1c989588d LinuxKPI: 802.11: add futher defines to ieee80211.h and nl80211.h
Upstream new defines, enum values, etc. for coming driver updates which
are non-conflicting with the current state.

The only notable change is the rename of the enum ieee80211_ap_reg_power
but the enum name had not been used so far by any driver in the tree
(only in mac80211.h) but an updated version of ath11k does use it so we
need to correct our initial naming.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2024-09-13 00:26:26 +00:00
Bjoern A. Zeeb
4b972f77a1 LinuxKPI: some additions for mt76
Add changes required for later mt76 drivers.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2024-09-13 00:25:31 +00:00
Bjoern A. Zeeb
6ed447b51a LinuxKPI; add more defintions to netdevice.h
Add new enums to netdevice.h (including one which is referenced but
no value of it is used in a driver so we have to add a "dummy" value
to avoid an empty enum).

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2024-09-13 00:24:48 +00:00
Bjoern A. Zeeb
c12e3a0525 LinuxKPI: add more fields to mhi.h
Add more fields required by updated wireless drivers to mhi.h.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2024-09-13 00:23:35 +00:00
Bjoern A. Zeeb
01e1131e4a LinuxKPI: add pci_err()
Add pci_err() as a wrapper to dev_err() as needed by an updated driver.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D46660
2024-09-13 00:20:53 +00:00
Mikhail Pchelin
f5a58c2da2 linux80211: fix default deflink.rx_nss
Native Linux implementation sets this as a maximum between 1 and
ht/vht/eht rx SS'es, FreeBSD does the same, but uses 0 as a minimum,
which leads setting it to 0 if we're not in ht/vht case.

This 0 was breaking rtw89 driver, when it was trying to determine
SS number by subtracting 1 from rx_nss and passing the value to the
hardware.

After this patch rtw89 association and simple ping work reliably,
but more work is needed to make the driver robust with heavy traffic
(iperf3) and being long idle.

Reviewed by:	bz
Approved by:	bz
Sponsored by:	Future Crew LLC
Differential Revision:	https://reviews.freebsd.org/D46528
2024-09-06 21:04:52 +03:00
Bjoern A. Zeeb
f5c7feee71 LinuxKPI: add general module_driver(), use it for module_pci_driver()
Factor out module_pci_driver() from 366d68f283 into a general
module_driver() so other bus attachments can also use the same kind
of macro without duplicating all the lines.

Redefine module_pci_driver() using the new general macro.

No functional changes intended.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	manu
Differential Revision: https://reviews.freebsd.org/D46467
2024-09-05 12:46:21 +00:00
Zhenlei Huang
7bcb122855 LinuxKPI: 802.11: Stop checking for failures from malloc(M_WAITOK)
As a consequence lkpi_ieee80211_ifalloc() now does not fail. Remove
unneeded NULL check.

MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D45852
2024-09-03 18:25:21 +08:00
Bjoern A. Zeeb
1847e63d63 LinuxKPI: add no_printk
Add a version of no_printk(), which seems to be there to have format
string checking while never calling the printk.  It seems a very weird
thing and it needs a return code and for some reason my initial
while (0) { } version hadn't worked while porting over new code but
could have been further downstream format string problems.
if (0) seems to do the job though I would have expected that to more
likely simply get optimised out without any futher format checking.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D46463
2024-08-31 21:36:01 +00:00
Bjoern A. Zeeb
273cf7d363 LinuxKPI: add eth_hdr()
Add an implementation of eth_hdr() needed by a wireless driver.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D46462
2024-08-31 21:35:02 +00:00
Bjoern A. Zeeb
8adb745dc9 LinuxKPI: add ENAVAIL error code
Used by an updated wireless driver.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D46461
2024-08-31 21:34:01 +00:00
Bjoern A. Zeeb
f29e915bc0 LinuxKPI: add get_random_u8()
Add a get_random_u8() implementation following the u36 and u64 versions.
We'll likely want to macro-ify them in the future and add all the types
which makes sense just to be done.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D46464
2024-08-31 21:32:11 +00:00
Evgenii Khramtsov
84f46335ab linuxkpi: chase spinlock_t in DECLARE_WAIT_QUEUE_HEAD
Remove member m to unbreak consumers, e.g. drm-kmod 5.10-lts branch.

[...]
/tmp/drm-kmod/drivers/gpu/drm/ttm/ttm_module.c:38:8: error: no member named 'm' in 'struct mtx'
   38 | static DECLARE_WAIT_QUEUE_HEAD(exit_q);
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/src/sys/compat/linuxkpi/common/include/linux/wait.h:113:33: note: expanded from macro 'DECLARE_WAIT_QUEUE_HEAD'
  113 |         MTX_SYSINIT(name, &(name).lock.m, spin_lock_name("wqhead"), MTX_DEF)
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/src/sys/sys/mutex.h:528:4: note: expanded from macro 'MTX_SYSINIT'
  528 |                 (mtx),                                                  \
      |                  ^~~
/tmp/drm-kmod/drivers/gpu/drm/ttm/ttm_module.c:38:8: error: no member named 'm' in 'struct mtx'
   38 | static DECLARE_WAIT_QUEUE_HEAD(exit_q);
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/src/sys/compat/linuxkpi/common/include/linux/wait.h:113:33: note: expanded from macro 'DECLARE_WAIT_QUEUE_HEAD'
  113 |         MTX_SYSINIT(name, &(name).lock.m, spin_lock_name("wqhead"), MTX_DEF)
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[...]

Fixes:		ae38a1a1bf ("linuxkpi: spinlock: Simplify code")
MFC after:	?
2024-08-28 09:29:40 +02:00
Mariusz Zaborski
24b1cf7a8a sysent: regen after d0675399 2024-08-27 17:24:54 +02:00
John Baldwin
c0c1b1cd89 freebsd32: Fix a few typos in syscalls.conf comments
Sponsored by:	AFRL, DARPA
2024-08-21 17:14:56 -04:00
Doug Moore
d48524e21f dev_pager: define free_page for mgt devices
Callers of cdev_pager_free_page in the kernel always have object->type
== OBJT_MGTDEVICE. Define a function for them to call that skips the
runtime type check in cdev_pager_free.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D46389
2024-08-21 15:48:59 -05:00
Warner Losh
ce7fac64ba Revert "nvme: Separate total failures from I/O failures"
All kinds of crazy stuff was mixed into this commit. Revert
it and do it again.

This reverts commit d5507f9e43.

Sponsored by:		Netflix
2024-08-15 21:29:53 -06:00
Warner Losh
d5507f9e43 nvme: Separate total failures from I/O failures
When it's a I/O failure, we can still send admin commands. Separate out
the admin failures and flag them as such so that we can still send admin
commands on half-failed drives.

Fixes: 9229b3105d (nvme: Fail passthrough commands right away in failed state)
Sponsored by: Netflix
2024-08-15 20:22:18 -06:00
Fernando Apesteguía
5ab6ed93cd faccessat(2): Honor AT_SYMLINK_NOFOLLOW
Make the system call honor `AT_SYMLINK_NOFOLLOW`.

Also enable this from `linux_faccessat2` where the issue arised the first time.
Update manual pages accordingly.

PR:			275295
Reported by:		kenrap@kennethraplee.com
Approved by:		kib@
Differential Revision:	https://reviews.freebsd.org/D46267
2024-08-11 17:49:06 +02:00
Ed Maste
a1295b2484 linuxkpi: use canonical tests for is_{zero,broadcast}_ether_addr
They are functionally equivalent, but the updated form mirrors the tests
in sys/net/ethernet.h and avoids confusion.

Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D21037
2024-08-08 12:39:14 -04:00
Vladimir Kondratyev
c89d94ad5d LinuxKPI: update linuxkpi_video to Linux 6.6
disable hdmi_audio_infoframe_pack_for_dp function for now as it depends
on not imported yet drm sources and is not used by drm-kmod.

Reviewed by:	manu
Sponsored by:	Serenity CyberSecurity, LLC
Differential Revision:	https://reviews.freebsd.org/D46224
2024-08-07 23:38:38 +03:00
Mark Johnston
01518f5eed sleepqueue: Remove kernel stack swapping support, part 10
- Remove kick_proc0().
- Make the return type of sleepq_broadcast(), sleepq_signal(), etc.,
  void.
- Fix up callers.

Tested by:	pho
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D46128
2024-07-29 01:43:59 +00:00
Mark Johnston
d37286b9bf proc: Remove kernel stack swapping support, part 7
Remove some uses of PHOLD which were there only to prevent the process'
threads from being swapped out.

Tested by:	pho
Reviewed by:	imp, kib
Differential Revision:	https://reviews.freebsd.org/D46118
2024-07-29 01:43:49 +00:00
Bjoern A. Zeeb
1f7df75701 LinuxKPI: move __kmalloc from slab.h to slab.c
In order to allow the allocator to change in the future move it into
the implementation file from being an inline function in the header.

While here factor out the size calculation and add a comment as-to why
this is done.  We will need the size (_s) in the future to make a
decision on how to allocate.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D45815
2024-07-26 11:51:04 +00:00
Bjoern A. Zeeb
5668c22a13 LinuxKPI/lindebugfs: stop panicing in lindebugfs, fix simple_read_from_buffer
Trying to use lindebugfs for debugging wirless drivers two issues
became apparent:
(a) a panic in lindebugfs calling a hard coded release function if the
    caller had not provided one.  This seems to be based on assumptions
    that no longer hold up.  Remove the hard coded release function to
    prevent panics.
(b) In LinuxKPI simple_read_from_buffer() would call copy_to_user() but
    buffers weren't setup for this (lindebugfs copies data from its
    own buffer) and then pseudofs will do another copyout to the user
    on this;  remove the copy_to_user() and simply copy the data over
    to the provided buffer; this works for as long as the only consumers
    remain debugfs callers (which currently seems to be the case).
    [the only out-of-tree consumers I am aware off are two drm-kmod
    drivers/gpu/drm/amd/pm/* debugfs functions I cannot test].

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Tested by:	jfree
Differential Revision: https://reviews.freebsd.org/D45755
2024-07-26 10:53:55 +00:00
Bjoern A. Zeeb
d1bdc2821f Deprecate contigfree(9) in favour of free(9)
As of 9e6544dd6e contigfree(9) is no longer
needed and should not be used anymore.  We leave a wrapper for 3rd party
code in at least 15.x but remove (almost) all other cases from the tree.

This leaves one use of contigfree(9) untouched; that was the original
trigger for 9e6544dd6e and is handled in D45813 (to be committed
seperately later).

Sponsored by:	The FreeBSD Foundation
Reviewed by:	markj, kib
Tested by:	pho (10h stress test run)
Differential Revision: https://reviews.freebsd.org/D46099
2024-07-26 10:45:01 +00:00
Bjoern A. Zeeb
4aff4048f5 LinuxKPI: 802.11: support manual lladdr changes
Allow a user to change the "ether" address by ifconfig while a VAP is
not UP.  Compared to net80211 (given we have no callback) we register
an eventhandler per-vif (a global one would force us to use hacks to
derive if a vap is indeed also a lkpi_80211 vif).

Sponsored by:	The FreeBSD Foundation
PR:		277356
Tested by:	lwhsu
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D46121
2024-07-25 18:42:26 +00:00
Bjoern A. Zeeb
59d262fe96 LinuxKPI: 802.11 compile in debugging based on IEEE80211 debugging
If IEEE80211 debugging is turned on in kernel configs also turn on
LinuxKPI 802.11 and SKB debugging (sysctls) to have them available.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D45820
2024-07-25 15:06:46 +00:00
Bjoern A. Zeeb
db8b357862 LinuxKPI: 802.11: implement ieee80211_sn_*()
Implement ieee80211_sn_*() using the equivalent net80211 macros.
We need those implemented for at least 11n.
While here also sort all the BA functions together next to the
"sn" functions.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D45819
2024-07-25 15:03:42 +00:00
Bjoern A. Zeeb
bd206a6f4a LinuxKPI: 802.11: consistently spell TRACE-RX: as such
We have TRACE in one place and TRACE-RX in another.  Spell it
"TRACE-RX: %s: ..." everywhere.  Helps with pattern matching.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D45818
2024-07-25 13:52:57 +00:00
Bjoern A. Zeeb
4d8c65b466 LinuxKPI: remove dummy kstrtox.h
kstrtox.h has an implementation nowadays.  Remove the dummy file
which is no longer needed.

Sponsored by:	The FreeBSD Foundation
2024-07-25 12:42:49 +00:00
Vladimir Kondratyev
14fc33ea3a LinuxKPI: Fix resource leak on pci_iounmap-ing of PCI BAR
If the resource was allocated with want_iomap_res flag set.

Sponsored by:	Serenity CyberSecurity, LLC
MFC after:	1 week
Reviewed by:	manu, bz
Differential Revision:	https://reviews.freebsd.org/D45905
2024-07-21 16:10:44 +03:00
Vladimir Kondratyev
fcc350c375 LinuxKPI: Add pci_iomap_range function
pci_iomap_range creates a virtual mapping cookie for a PCI BAR.
As compared with pci_iomap it got extra offset parameter.

Sponsored by:	Serenity CyberSecurity, LLC
MFC after:	1 week
Reviewed by:	manu, bz
Differential Revision:	https://reviews.freebsd.org/D45904
2024-07-21 16:10:25 +03:00
Vladimir Kondratyev
d42136e361 LinuxKPI: Remove vmas argument from get_user_pages on KBI layer
To chase Linux kernel 6.5

Sponsored by:	Serenity Cyber Security, LLC
Reviewed by:	manu
Differential Revision:	https://reviews.freebsd.org/D45850
2024-07-21 16:10:14 +03:00
Vladimir Kondratyev
1fe7cd0243 LinuxKPI: Remove owner argument from class_create function on KBI layer
To chase Linux 6.4

Sponsored by:   Serenity Cyber Security, LLC
Differential Revision:	https://reviews.freebsd.org/D45849
2024-07-21 16:09:58 +03:00
Vladimir Kondratyev
7774e08adf LinuxKPI: Add linux/eventfd.h and linux/memremap.h dummy headers
Sponsored by:	Serenity Cyber Security, LLC
MFC after:	1 week
Reviewed by:	manu
Differential Revision:	https://reviews.freebsd.org/D45848
2024-07-21 16:09:48 +03:00
Vladimir Kondratyev
3e90716331 LinuxKPI: Add acpi_dev_get_first_match_dev and acpi_device_handle
acpi_dev_get_first_match_dev returns the first match of ACPI device
and acpi_device_handle returns its ACPI handle.

Sponsored by:	Serenity Cyber Security, LLC
MFC after:	1 week
Reviewed by:	manu
Differential Revision:	https://reviews.freebsd.org/D45847
2024-07-21 16:09:37 +03:00
Vladimir Kondratyev
5b1171a0b7 LinuxKPI: Add pci_match_id to linux/pci.h
It finds out if a given PCI device matches a given pci_id table.

Sponsored by:	Serenity Cyber Security, LLC
MFC after:	1 week
Reviewed by:	manu
Differential Revision:	https://reviews.freebsd.org/D45846
2024-07-21 16:09:27 +03:00
Vladimir Kondratyev
a1181662d3 LinuxKPI: Add devm_device_add_group to linux/device.h
devm_device_add_group creates a managed attribute group for a device.

Sponsored by:	Serenity Cyber Security, LLC
MFC after:	1 week
Reviewed by:	manu
Differential Revision:	https://reviews.freebsd.org/D45845
2024-07-21 16:09:12 +03:00
Vladimir Kondratyev
80aa295a52 LinuxKPI: Add page_to_virt function
Sponsored by:	Serenity Cyber Security, LLC
MFC after:	1 week
Reviewed by:	manu
Differential Revision:	https://reviews.freebsd.org/D45843
2024-07-21 16:09:01 +03:00
Vladimir Kondratyev
742088d9fb LinuxKPI: Add __diag macros
__diag macros turn individual warnings and errors on and off locally,
depending on version of compiler. Add dummy implementation as drm-kmod
set warnings separately for each file.

Sponsored by:	Serenity Cyber Security, LLC
MFC after:	1 week
Reviewed by:	manu, emaste
Differential Revision:	https://reviews.freebsd.org/D45842
2024-07-21 16:08:48 +03:00
Vladimir Kondratyev
ab1a5d8e2a LinuxKPI: Add kmalloc_size_roundup function
kmalloc_size_roundup reports allocation bucket size for the given size.

Sponsored by:	Serenity CyberSecurity, LLC
MFC after:	1 week
Reviewed by:	manu, emaste
Differential Revision:	https://reviews.freebsd.org/D45841
2024-07-21 16:08:37 +03:00
Vladimir Kondratyev
ab6e116790 LinuxKPI: Add kvrealloc to linux/slab.h
Sponsored by:	Serenity Cyber Security, LLC
MFC after:	1 week
Reviewed by:	manu
Differential Revision:	https://reviews.freebsd.org/D45616
2024-07-21 16:08:28 +03:00
Vladimir Kondratyev
5d20075f8b LinuxKPI: Automatically enable drm support for devices named "drmn"
This allows replace linux_pci_(un)register_drm_driver calls with driver
renaming to FreeBSD name.

Sponsored by:	Serenity CyberSecurity, LLC
MFC after:	1 week
Reviewed by:	manu, bz
Differential Revision:	https://reviews.freebsd.org/D45906
2024-07-21 16:02:08 +03:00
Vladimir Kondratyev
8c5c572125 LinuxKPI: Add DEFINE_DEBUGFS_ATTRIBUTE_SIGNED to linux/debugfs.h
Sponsored by:	Serenity CyberSecurity, LLC
MFC after:	1 week
Reviewed by:	manu
Differential Revision:	https://reviews.freebsd.org/D45615
2024-06-26 23:51:34 +03:00