aboutsummaryrefslogtreecommitdiff
path: root/sys/compat
Commit message (Collapse)AuthorAgeFilesLines
...
* sys/abi_compat.h: move freebsd32_uint64_t and FU64_CP() thereKonstantin Belousov2026-02-091-18/+0
| | | | | | | | | | Use private names for uintXX_t types. Remove conflicting (but equal) PTR_IN() definition from dev/mfi.c. Reviewed by: brooks Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D55135
* kern/vfs_unmount.c: promote flags to uint64_tKonstantin Belousov2026-02-091-1/+1
| | | | | | | | | | to prevent sign-extension, causing unexpected flags to be passed to dounmount(). The mnt_flags and MNT_* constants are 64bit wide. Suggested and reviewed by: jah Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D55197
* linux_file.c: Fix handling of NFS getdents() emulationRick Macklem2026-02-071-68/+110
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bugzilla PR#292282 reports a problem, where a Linux binary running in the Linuxulator gets bogus entries in a readdir()/getdents() reply when the directory is an NFS mount. This appears to be caused by the NFS client including entries with d_fileno == 0, which are always ignored by BSD, but are not ignored by Linux. This patch filters out the "d_fileno == 0" entries and the reporter of the bugzilla PR notes that it fixes the problem for him. It could be argued that the NFS client should filter out the "d_fileno == 0" entries, but the NFS client readdir code is "fragile" and any change to it runs a significant risk of causing regression type problems. As such, since the LInuxulator is already broken for this case, it seems safer to filter them out there. PR: 292282 Tested by: Jerry Williams <jwillia3@proton.me> Reviewed by: markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D54679
* LinuxKPI: 802.11: catch possible NULL pointer deref with mt76Bjoern A. Zeeb2026-02-071-3/+13
| | | | | | | | | | With mt76 we, for the first time, see that txstat->skb or txstat->info may not be filled in linuxkpi_ieee80211_tx_status_ext(). Guard for these cases checking for skb and info to be not NULL and assume a TX failure in case info is NULL. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: make sure we are scheduled before wake_tx_queue()Bjoern A. Zeeb2026-02-073-8/+15
| | | | | | | | | | | | | If we are not scheduled before calling wake_tx_queue() packets may never go out, which at first will look like EAPOL fails (as wpa_supplicant suggest possibly with a wrong key). Using monitor mode it will be clear what is going on. Pass a flag down to wake_tx_queue() to call ieee80211_schedule_txq() in case (*wake_tx_queue)() is supported or not, which solves the problem for the lkpi_80211_txq_tx_one() which was failing. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: set extra tx info flag for EAPOL for mt76Bjoern A. Zeeb2026-02-071-1/+3
| | | | | | | | mt76 requires IEEE80211_TX_CTL_USE_MINRATE to be set for EAPOL, so add it. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: string_choices.h: use ternary operatorBjoern A. Zeeb2026-02-031-20/+5
| | | | | | | | | | | Switch from using if () else to a direct return (?:) code. No functional changes. Suggested by: kib (D55029) Sponosred by: The FreeBSD Foundation MFC after: 3 days Reviewed by: emaste (before removing more () as suggested by him) Differential Revision: https://reviews.freebsd.org/D55088
* LinuxKPI: add str_read_write()Bjoern A. Zeeb2026-02-031-0/+9
| | | | | | | | | Needed by a wireless driver. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: kib, emaste Differential Revision: https://reviews.freebsd.org/D55029
* lindebugfs: check that name is set as otherwise pfs_alloc_node_flags() panicsBjoern A. Zeeb2026-01-291-0/+3
| | | | | | | | | | | | | | | | | | | | | | I have hit the case multiple times that some LinuxKPI field may not be set during driver bringup and lindebugfs would cause a panic. The backtrace goes like: strlen() at strlen+0x54 pfs_create_dir() at pfs_create_dir+0x41 debugfs_create_dir() at debugfs_create_dir+0xa1 ... While the problem is clearly in LinuxKPI or the driver, we likely should at least add an assert to pfs_create_dir() if name is NULL like we have for pfs_add_node() but for lindebugfs at least make this a graceful error and continue without creating the dir instead of panicing. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D54944
* LinuxKPI: 802.11: only announce netdev_features if any are setBjoern A. Zeeb2026-01-291-1/+3
| | | | | | | | Printing an empty netdev_features= line makes little sense even under bootverbose. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* linuxkpi: Add tag support to radix treeJean-Sébastien Pédron2026-01-283-10/+242
| | | | | | | | | | | | | | | | | | | | | The tag is used to perform lookup in a different way. New functions were introduced: * to set, check and clear a tag * to walk through a radix tree based on a given tag Furthermore, the `radix_tree_delete()` function was modified to clear tags on deletion. The amdgpu DRM driver started to use this in Linux 6.10. While here, the `radix_tree_gang_lookup()` function was added because it is very close to `radix_tree_gang_lookup_tag()`, but it is not used by the DRM drivers as of this commit. Reviewed by: emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D54503
* freebsd32: Fix includesDag-Erling Smørgrav2026-01-261-1/+1
| | | | | | | | | | The previous commit added <sys/cdefs.h>, which isn't actually needed. Conversely, <sys/event.h> is needed (and has been for a long time) but was not included. MFC after: 1 week Fixes: a11d132f6c62 ("devstat: Provide 32-bit compatibility") Reported by: gallatin@
* devstat: Provide 32-bit compatibilityDag-Erling Smørgrav2026-01-261-0/+27
| | | | | | | | | | | | | If a 32-bit process running on a 64-bit kernel requests kern.devstat.all, translate each struct devstat to its 32-bit equivalent before copying it out. Also fix a bug where an early error would be ignored if there were no devices to report. MFC after: 1 week Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D54591
* linuxkpi: Add eventfd_*()Jean-Sébastien Pédron2026-01-253-0/+117
| | | | | | | | | | | | Add <linux/eventfd.h> and expose the `eventfd_*()` API. This is used by DRM drivers for some time, but the code was commented out so far. Note that Linux uses `struct eventfd_ctx`, but FreeBSD defines `struct eventfd`. We define `eventfd_ctx` as a synonym to `eventfd`. Reviewed by: christos, markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D50853
* Regen syscall tables after pdfork(2) and pdwait(2) additionsKonstantin Belousov2026-01-255-1/+84
|
* Add pdwait(2)Konstantin Belousov2026-01-251-0/+31
| | | | | | | | Reviewed by: asomers, markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D54592
* freebsd32_rusage_out(): bzero the compat32 structureKonstantin Belousov2026-01-251-0/+1
| | | | | | | | | | | | There is some padding on non-x86. Unconditionally bzero the memory to avoid a leak. Noted by: markj Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D54592
* LinuxKPI: improve hweight<n> if complie time constantBjoern A. Zeeb2026-01-251-6/+6
| | | | | | | | | | | rtw89(4) uses a static_assert() with hweight<n> calls. In order to avoid compile time errors, deal with the case when the arguments to hweight<n> are complie time constant. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D54806
* LinuxKPI: add umin()Bjoern A. Zeeb2026-01-251-0/+3
| | | | | | | | | | Add a version of umin() simply using MIN() assuming that the Linux upstream code properly check that the arguments are unsigned, etc. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D54807
* LinuxKPI: implement dmam_free_coherent()Bjoern A. Zeeb2026-01-252-0/+45
| | | | | | | | | | | dmam_free_coherent() is used by an updated mt76 driver at v6.19-rc6. We need to surgically find the devres information and destroy it before calling dma_free_coherent. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D54810
* LinuxKPI: PTP add (*settime64) to struct ptp_clock_infoBjoern A. Zeeb2026-01-251-0/+1
| | | | | | | | | | | | While iwlwifi supportes PTP, LinuxKPI does not and we only add the definitons to avoid mangling upstream drivers. iwlwifi(4) does not even support the (*settime64) callback but only returns -EOPNOTSUPP. Sponosred by: The FreeBSD Foundation MFC after: 3 days Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D54802
* linuxkpi: Implement <linux/seq_buf.h>Jean-Sébastien Pédron2026-01-242-0/+137
| | | | | | | | | | | | It is a wrapper above a `char *` to track the overall available space in the buffer as well as the used space. This wrapper does not manage memory allocation. The DRM generic code started to use this in Linux 6.10. Reviewed by: bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D54488
* mt76: update Mediatek's mt76 driverBjoern A. Zeeb2026-01-232-1/+61
| | | | | | | | | | | | | | | This version is based on git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 24d479d26b25bce5faea3ddd9fa8f3a6c3129ea7 ( tag: v6.19-rc6 ). Notable change: license got switched from ISC to BSD-3-Clause-Clear. util.h is now imported from upstream given it is no longer GPL-only. See the upstream repository 909675fd4344f73aad5f75f123bd271ada2ab9fb and a96fed2825d8dfb068bf640419c619b5f2df4218. For us the new version should also help with page pools and DMA32. Sponsored by: The FreeBSD Foundation
* LinuxKPI: netdevice: add structs net_device_path, net_device_path_ctxBjoern A. Zeeb2026-01-211-0/+24
| | | | | | | | mt76(4) is using this along with a mac80211.h functiontion pointer to resolve a path in an offload case. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPi: 802.11: add more definesBjoern A. Zeeb2026-01-213-0/+4
| | | | | | | | Add more defines and a mac80211 op function pointer used by mt76(4) at Linux v6.19-rc6. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: skbuff: implement skb_queue_splice()Bjoern A. Zeeb2026-01-211-1/+8
| | | | | | | | | Add skb_queue_splice() and use it in skb_queue_splice_init() which already had that functionality (plus the init bit). The new function is used by rtw89(4). Sponosred by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: rename enum ieee80211_tx_rate_flags and move fileBjoern A. Zeeb2026-01-212-14/+13
| | | | | | | | | | What we used to call enum ieee80211_tx_rate_flags is now used as enum mac80211_rate_control_flags for the ieee80211_tx_rate.flags in rtw89(4). Rename the enum and move it to mac80211 as it seems to belong there. Sponsonred by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: add new field to struct cfg80211_bitrate_maskBjoern A. Zeeb2026-01-211-0/+3
| | | | | | | | rtw89(4) accesses eht_mcs[]. Add the field to struct cfg80211_bitrate_mask. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: Management MIC element can have 8 or 16 octets MICBjoern A. Zeeb2026-01-211-3/+11
| | | | | | | | | Management MIC element (MME) can have 8 or 16 octets MIC. Add a second structure used by at least iwlwifi and update reference to latest standard version. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: fix build for non-debug kernelsBjoern A. Zeeb2026-01-201-0/+2
| | | | | | | | | | | | | lkpi_nl80211_band_name() is only available under LINUXKPI_DEBUG_80211. IMPROVE in theory should be as well or defined to nothing but we cannot do that in cfg80211.h mac80211.h where we possibly (re-)define this. Put an #ifdef around the IMPROVE call for now (untested). Sponsored by: The FreeBSD Foundation MFC after: 3 days Fixes: 768332d61948 Reported by: CI
* LinuxKPI: 802.11: factor out rate logic for mandatory channelsBjoern A. Zeeb2026-01-203-27/+100
| | | | | | | | | | | | | | | I was looking at rate work for another problem and found more flags in ath9k (which we will likely never need). The documentation then revealed the "mandatory" flags as well and with discussions about cfg80211 going on I decided to use the momentum and split our "supp_rates" setup between lkpi_lsta_alloc() and wiphy_register(). There should be no functional change. While there also initialize max_rc_amsdu_len. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* sys/abi_compat.h: fix UB for bintime32 handlingKonstantin Belousov2026-01-201-1/+1
| | | | | | | | | | | Do not cast and then access potentially unaligned uint64_t in the BT_CP() macro. Use freebsd32_uint64_t type and FU64_CP() for the frac member. Noted by: des Reviewed by: des, emaste Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D54663
* compat32: provide a type and a macro for (u)int64_t handling on non-x86 archesKonstantin Belousov2026-01-201-1/+10
| | | | | | | | | | | | uint64_t is 4-byte aligned on i386, but is 8-bytes aligned on all other 32bit arches FreeBSD supports. Provide the freebsd32_uint64_t type and the FU64_CP() macro, which are intended to be used where 32bit ABI uses (u)int64_t type, and do proper layout and copying for the aggregate type. Reviewed by: des, emaste Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D54663
* linux: on vnet detach call clean_unrhdr(9) alwaysGleb Smirnoff2026-01-151-5/+6
| | | | | | | | The assumption was incorrect, and the current VIMAGE implementation leaves a possibility for some interfaces still exist in a jail that is going away. Fixes: 607f11055d2d421770963162a4d9a99cdd136152
* linuxkpi: Clean up linux_shmem_file_setup() a bitMark Johnston2026-01-151-4/+3
| | | | | | | | | | | - Free the pointer that was returned by the allocator, instead of the address of the first member. These will be equal in practice, but it's sketchy and won't work on CHERI with subobject bounds checking. - Use an anonymous struct, there's no need to name it. Reviewed by: bz, brooks, emaste MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D54673
* linuxkpi: Avoid a potential null pointer dereference in an error pathMark Johnston2026-01-151-1/+2
| | | | | | | Reported by: Kevin Day <kevin@your.org> Reviewed by: bz, emaste MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D54672
* linuxkpi: Fix an error path in linux_alloc_current()Mark Johnston2026-01-151-8/+2
| | | | | | | | | | | If the allocation fails we should free the task struct. While here get rid of a couple of unnecessary assertions. Reported by: Kevin Day <kevin@your.org> Reviewed by: emaste MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D54671
* LinuxKPI: pci: fix pcie_get_speed_cap()Bjoern A. Zeeb2026-01-141-9/+18
| | | | | | | | | | | | | pcie_get_speed_cap() has a hard coded skip of 3 devices at the beginning. It is either called on a pdev or on a result from pci_upstream_bridge(). In the latter case skipping another three devices might get us to acpi0 or nexus, neither of which is a PCI device still and pci_get_vendor() will panic() on that. Sponsored by: The FreeBSD Foundation (commit) GHI: https://github.com/freebsd/drm-kmod/issues/393 MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D53862
* LinuxKPI: include acpi headers for RISC-VBjoern A. Zeeb2026-01-141-1/+1
| | | | | | | | | | | | In order to compile iwlwifi(4), which is reported to work on RISC-V, include the ACPI headers to avoid adding further FreeBSD-specific #ifdefs to the driver. With this iwlwifi(4) just compiles on RISC-V (at least if ACPI support is turned off in the module Makefile). Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D54692
* linux: add hidraw ioctl handlerAlex S2026-01-092-0/+70
| | | | | | | | | | First step towards getting the Linux version of SDL with HIDAPI gamepad drivers to work. Not quite complte as SDL expects to find some information in sysfs as well. Signed-off-by: Alex S <iwtcex@gmail.com> Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1938
* linux: support termios2 ioctlsmothcompute2026-01-092-1/+78
| | | | | | Signed-off-by: mothcompute <mothcompute@protonmail.com> Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1949
* linuxkpi: Add `rol32()`Jean-Sébastien Pédron2026-01-071-0/+6
| | | | | | | | | | | `rol64()` and `rol32()` are used by <linux/siphash.h>. The former was added previously, before <linux/siphash.h> was added. However the latter was not, and it broke the build on armv7. Reported by: adrian Reviewed by: adrian, rpokala Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D54588
* linuxkpi: Replicate the chain of #include in the `cec*.h` headersJean-Sébastien Pédron2026-01-075-0/+59
| | | | | | | | | | The i915 DRM driver depends on this namespace pollution to access `debugfs_*` functions, after several explicit #include of <linux/debugfs.h> were removed in Linux 6.10. Reviewed by: bz, christos Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D54494
* linuxkpi: Add WARN_RATELIMIT()Jean-Sébastien Pédron2026-01-071-0/+7
| | | | | | | | The i915 DRM driver started to use it in Linux 6.10. Reviewed by: bz, christos Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D54493
* linuxkpi: Add <linux/kmsg_dump.h>Jean-Sébastien Pédron2026-01-071-0/+51
| | | | | | | | | | | | | This header declares register/unregister functions to allow a piece of code to tell what function to call in case of a panic. Several panic handlers may be registered. The DRM generic code started to use it in Linux 6.10 as part of the panic handler. Reviewed by: bz, christos Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D54492
* linuxkpi: Add <linux/font.h>Jean-Sébastien Pédron2026-01-071-0/+33
| | | | | | | | | | | | | | | | The header defines the minimum to allow the DRM generic code to build. The only function used so far is `get_default_font()`, as part of a DRM-specific panic handler. We do not use this panic handler on FreeBSD. For now, it returns a NULL value. It should probably map to a vt(4) font. The DRM generic code started to use it in Linux 6.10 as part of the panic handler. Reviewed by: bz, christos Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D54491
* linuxkpi: Define `raw_spinlock_t` in <linux/spinlock.h>Jean-Sébastien Pédron2026-01-071-0/+20
| | | | | | | | | | | | | For now, it is synonymous to `spinlock_t`. The DRM generic code uses the `struct raw_spinlock` and not `raw_spinlock_t`, that's why the definition is a struct embedding a `struct mtx`, compared to `spinlock_t` which is a simpler typedef. The DRM generic code started to use it in Linux 6.10. Reviewed by: bz, christos Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D54489
* linuxkpi: Add `radix_tree_deref_slot()`Jean-Sébastien Pédron2026-01-051-0/+6
| | | | | | | | | | | We don't do reference counting, we only dereference the pointer and retunr the value. The amdgpu DRM driver started to use it in Linux 6.10. Reviewed by: bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D54502
* linuxkpi: Add <linux/siphash.h>Jean-Sébastien Pédron2026-01-052-0/+714
| | | | | | | | | | | The file is copied as is from Linux 6.10 as it dual-licensend under the GPLv2 and BSD 3-clause. The amdgpu DRM driver started to use it in Linux 6.10. Reviewed by: bz, emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D54501
* linuxkpi: Add get_unaligned_le64()Jean-Sébastien Pédron2026-01-051-0/+7
| | | | | | | | | | | This function was the only one missing in the `get_unaligned_*()` family. This is going to be used by the imported `linux_siphash.c` in a future commit, which itself is used by DRM drivers starting from Linux 6.10. Reviewed by: bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D54500