aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/linuxkpi
Commit message (Collapse)AuthorAgeFilesLines
* LinuxKPI: 802.11: lock down the "txq_scheduled" tailqBjoern A. Zeeb3 days2-12/+42
| | | | | | | | | | | | | | | | | | For consistency rename the "scheduled_txqs" tailq to "txq_scheduled" and add a lock per txq ("txq_scheduled_lock[]"). We use the "_bh" locking as this called from the device driver. This fixes panics due to concurrent access to the tailq, especially in between "first" and "remove" on the out-direction and between "insert" and "elem_init" on the in-direction. This was easily reproducible just running iperf3 at basic rates for a few seconds to minutes with multiple chipsets, not only rtw89. Sponsored by: The FreeBSD Foundation PR: 290636 Reported by: arved, and others before MFC after: 3 days
* linuxkpi: clean up stray pctrie_iter_resetAustin Shafer4 days1-3/+1
| | | | | | | | | | | | This removes an extraneous pctrie_iter_reset before returning. This is not needed as it simply clears a local variable that will get cleaned up anyway as we immediately return from the function. MFC after: 1 week Sponsored by: NVIDIA Reviewed by: alc Differential Revision: https://reviews.freebsd.org/D54153
* pci_reserve_map: Pass rid by valueJohn Baldwin4 days1-1/+1
| | | | | Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D53404
* linuxkpi: Take const root in read-only radix tree functionsJean-Sébastien Pédron4 days2-6/+6
| | | | | | | | This is a preparation step for a future addition to this file. This is also closer to what Linux does. Reviewed by: emaste Sponsored by: The FreeBSD Foundation
* LinuxKPI: ath10k: adjust for led changes to keep ath10k compilingBjoern A. Zeeb8 days1-1/+4
| | | | | | | | | Add the conditional compile time option defaulting to off as we do not support leds in LinuxKPI to ath10k for the new file. Add empty struct gpio_led to LinuxKPI. MFC after: 3 days
* linuxkpi: Add dummy <linux/percpu{,-defs}.h>Jean-Sébastien Pédron8 days2-0/+0
| | | | | | | | | | There are no consumers right now except the upcoming <linux/eventfd.h>. This is meant to reproduce the same includes as Linux, in case consumers of <linux/eventfd.h> implicitly rely on namespace pollution. Reviewed by: bz, emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D50851
* LinuxKPI: mt76: depend on CONFIG_NET_MEDIATEK_SOC_WEDBjoern A. Zeeb10 days1-1/+27
| | | | | | | | | If CONFIG_NET_MEDIATEK_SOC_WED is not set then be silent; if CONFIG_NET_MEDIATEK_SOC_WED is set we will enable logic or rather te pr_debug("TODO") calls for now. Spsonsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: move ieee80211_offload_flagsBjoern A. Zeeb10 days1-7/+7
| | | | | | | | | | Move the enum and leave a comment on the struct member for the vif about the type. No functional changes. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: fill in more skeleton functionsBjoern A. Zeeb10 days2-31/+141
| | | | | | | | | | | | Some of these are used by mt76 and while I was here and it only was a handfull I figured I should just clean this all up. There is one problem in that between 802.11az and 802.11-2024 action frame formats have changed; I got compile errors from iwlwifi(4) given I updated them to -2024 so we remain on older versions for the moment. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: device: add a pr_debug("TODO") call to device_release_driver()Bjoern A. Zeeb11 days1-0/+1
| | | | | | | | | The logic in device_release_driver() got disabled in 93b14194acaf2 and since left alone. Add a pr_debug() call so we have a chance to notice if that code is actually still in need to be fixed and re-enabled. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: make airtime fairness an IMPROVEBjoern A. Zeeb11 days1-1/+1
| | | | | | | | | We are ways away from implementing "airtime fairness" in LinuxKPI (or rather net80211). For now make it an 'improve' rather than a 'todo' to get the logging away. Everything will work without it. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: page.c: remove a spurious character from a commentBjoern A. Zeeb11 days1-1/+1
| | | | | | | No functional changes. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: when synching HT and VHT cap, mask rx_mcsBjoern A. Zeeb11 days1-28/+71
| | | | | | | | | | | | | | | | | | | | | | | When we sync the sta data, mask the rx_mcs with what the hardware is able to do so that we do not leave, e.g., a 2nd stream enabled on a 1x1 chipset. iwlwifi(4) has a further check for the smps_mode to limit to NSS=1 but I believe that is historic and not actually in use anymore. This fixes firmware crashes on TLC updates with nss=1 but the nss=2 array index also being populated (with HT/VHT80/160 mcs information): data being populated: iwlwifi0: 0x20101A0D | ADVANCED_SYSASSERT iwlwifi0: 0x00000006 | umac data1 iwlwifi0: 0x00000001 | umac data2 iwlwifi0: 0x000003FF | umac data3 iwlwifi0: 0x____050F | last host cmd Reported by: Claudio Zumbo (claudiozumbo gmail.com), Erik Power Tested by: Claudio Zumbo, Erik Power (eppower umich.edu) PR: 290622 MFC after: 3 days Sponsored by: The FreeBSD Foundation
* LinuxKPI: pci: undo the pci_resource_len() check in lkpi_pci_request_region()Bjoern A. Zeeb11 days1-10/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Creating non-passthru SR-IOV interfaces on a mlx5en(4) failed. The problem lies in the pci_resource_len() call but not that the BAR length is tmeporary 0 but in that we call lkpi_pci_get_bar() with a true argument which will create the BAR resource for us and report the approriate length back. However, the later call to bus_alloc_resource_any() will then fail given the resource already exists. Restore the previous behaviour and let bus_alloc_resource_any() do the work. Adjust the return values from -ENODEV to -EBUSY to match callers expectations. In linuxkpi_pcim_request_all_regions(), like in linuxkpi_pci_request_regions(), filter out the -EBUSY errors as "not an error" and try the next bar. This also seems to be consistent with the expectations of the callers. PR: 290793 Reported by: David BOYER (jcduss13 gmail.com) Tested on: mlx5en, iwlwifi, mt7921 Reviewed by: kib Fixes: 7e21158d44cd "implement [linuxkpi_]pcim_request_all_regions()" Sponsored by: The FreeBSD Foundation MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D53902
* LinuxKPI: 802.11: initialize a backpointer on the link_staBjoern A. Zeeb2025-11-191-0/+1
| | | | | | | | | iwlwifi/mld uses the back pointer in iwl_mld_link_sta_from_mac80211(). Initialize it to make BE200 cards work again. Sponsored by: The FreeBSD Foundation MFC after: 3 days PR; 290808
* LinuxKPI: 802.11: implement mtx support for ieee80211_iterate_interfacesBjoern A. Zeeb2025-11-191-2/+8
| | | | | | | | | | | | Implement the lockdep_assert_wiphy call for ieee80211_iterate_active_interfaces_mtx() to avoid a warning when used and to make sure callers comply with assumptions. Leave an "IMPROVE" note as we can likely switch another of the multiple callers to RCU. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: use a _check rather than a _protected version for linkstaBjoern A. Zeeb2025-11-191-1/+1
| | | | | | | | Switch to link_sta_dereference_check rather than _protected to access the value. The actual problem we hit was elsewhere though. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: initialize the passed in chandef in cfg80211_chandef_createBjoern A. Zeeb2025-11-171-1/+1
| | | | | | | | | | | | | cfg80211_chandef_create() gets passed a pointer to a cfg80211_chan_def. It seems that several users are passing in an uninitialized variable from the stack and expect cfg80211_chandef_create() to initialize it. Run memset() on the struct, which for all callers currently seems to do the right thing, to avoid later accesses to uninitialized struct members like "punctured". Reported by: CI (gcc build) MFC after: 3 days Sponsonred by: The FreeBSD Foundation
* LinuxKPI: 802.11: clear CONF_IDLE earlierBjoern A. Zeeb2025-11-101-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | When starting to scan and ending a scan we clear/set the hardware to idle. Similarly we set the hw to idle when we remove the channel context but when starting we only set it to non-idle when we went from assoc to run. This apparently was not a problem most of the time as the switch from a failed hardware scan to a software scan was racing against net80211. ad4ddc83ebf8 fixed that specifically for rtw88 and while we were more consistently scanning, this broke authentication as the setting of idle at the end of the scan was now happening reliably. Move the unsetting of idle from assoc_to_run to scan_to_auth for when we create the chanctx to keep it symmetrical. This makes authentication work again for rtw88. This likely also fixes the problems in the listed PRs. iwlwifi(4) mvm and mld driver parts do not use this information at all and were never affected. Sponsored by: The FreeBSD Foundation MFC after: 3 days Reported by: Oleg Nauman (oleg.nauman gmail.com) PR: 290850, 288186, 281979 PR: 272145 (the non skb-mem-limit parts)
* linuxkpi: gracefully handle page lookup failure in ↵Austin Shafer2025-10-291-0/+4
| | | | | | | | | | | | | | | | | | | | lkpi_vmf_insert_pfn_prot_locked Currently lkpi_vmf_insert_pfn_prot_locked will check the page iter to find a usage of the page. If no page was found, it continues on to try using PHYS_TO_VM_PAGE() to get a page. Currently it does not check if a valid page was found before passing it to vm_page_busy_acquire, which can cause a kernel page fault as vm_page_busy_acquire expects a valid page pointer. This can easily be triggered while starting KDE6 in wayland mode, which many users have been reporting. With this change plasma6 starts properly in wayland mode. Sponsored by: NVIDIA PR: 288565 Reviewed by: markj, kbowling (mentor) Differential Revision: https://reviews.freebsd.org/D53412
* linuxkpi: add stub implementation of pm_vt_switch_(un)registerAustin Shafer2025-10-291-0/+14
| | | | | | | | | | This adds empty implementations of pm_vt_switch_(un)register which are used by nvidia-drm. We do not need to specify anything here as a VT switch always happens on suspend/resume. Sponsored by: NVIDIA Reviewed by: kbowling (mentor), emaste Differential Revision: https://reviews.freebsd.org/D53400
* LinuxKPI: 802.11: additions for Linux v6.17 based wireless driversBjoern A. Zeeb2025-10-232-11/+15
| | | | | | | This includes the conflicting changes from previous driver versions (v6.11/v6.14), mostly being function pointer or function arguments. MFC after: 3 days
* linuxkpi: Fix the definition of BITS_PER_LONGMark Johnston2025-10-221-7/+2
| | | | | | | | | | | Don't use __LP64__ to decide the value, as it gives the wrong result on CHERI platforms. Just define it in terms of __SIZEOF_LONG__. Make a similar adjustment for BITS_PER_LONG_LONG while here. Reviewed by: bz, dumbbell, emaste MFC after: 1 week Sponsored by: CHERI Research Centre (EPSRC grant UKRI3001) Differential Revision: https://reviews.freebsd.org/D53135
* LinuxKPI: 802.11: additions for Linux v6.17 based wireless driversBjoern A. Zeeb2025-10-216-136/+247
| | | | | | | | | | | | This includes some type cleanups as well as some shuffling of structs and functions to sort dependencies out. Few new functions and defines as well as new struct members. Minor fixes to style and debug logging. This is the majority of changes. None of these should conflict with current in-tree drivers. The final bit of changes will come along with the driver updates adding an extra argument to function pointers. MFC after: 3 days
* LinuxKPI: netdevice add attach/detach skeleton functionsBjoern A. Zeeb2025-10-211-0/+15
| | | | | | | For the moment add skeleton functions for netif_device_attach/detach() needed by rtw8[89] v6.17. MFC after; 3 days
* LinuxKPI: skbuff: add a misplaced socket operation to skbuff.h for nowBjoern A. Zeeb2025-10-211-0/+3
| | | | | | | This likely belongs in socket code which we do not have in LinuxKPI. Needed by a wirless driver at v6.17. MFC after: 3 days
* LinuxKPI: soc/mediatek add pr_debug callsBjoern A. Zeeb2025-10-211-32/+15
| | | | | | | | We do not support Wireless Ethernet Dispatch (wed) on the mt76 (yet). Add pr_debug calls with TODO in case we run into the calls anyway so we could deal with them. MFC after: 3 days
* LinuxKPI: page_pool headers moved; add netmem.hBjoern A. Zeeb2025-10-214-119/+136
| | | | | | | | | page_pool headers were not used yet; they were created for mt76 but are without functionality. Upstream has migrated them for v6.17 and split them up into multiple files. Also add netmem.h which the little needed is directly related to page pools. MFC after: 3 days
* LinuxKPI: add skeleton pci_enable_wake()Bjoern A. Zeeb2025-10-211-0/+13
| | | | | | | | | | | | Given we do not yet support "wake" bits in device there is little need doing it in PCI if we cannot check if we are supposed to do the operation in first place. Once we would implement this, we would need to also do the appropriate PCI (pme) checks before enabling (disabling) it. MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D53208
* LinuxKPI: add fips.hBjoern A. Zeeb2025-10-211-0/+12
| | | | | | | | | We do not currently aim to support crypto FIPS compliance in LinuxKPI so keep this turned off. MFC after: 3 days Reviewed by: emaste, dumbbell Differential Revision: https://reviews.freebsd.org/D53207
* LinuxKPI: device_driver add (*coredump)()Bjoern A. Zeeb2025-10-211-0/+1
| | | | | | | | | Needed by multiple wireless driver for the v6.17 update (likely earlier versions already). MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D53206
* LinuxKPI: platform_device return type changeBjoern A. Zeeb2025-10-211-1/+1
| | | | | | | | | | The return type now is void; I believe no one ever used this so we can just chnage it. The only active platform_driver_register() calls seems to be in ath1[01]k and mt76 and there in unsupported code. MFC after: 3 days Reviewed by: dumbbell, emaste Differential Revision: https://reviews.freebsd.org/D53205
* LinuxKPI: add three skeleton functions to etherdevice.hBjoern A. Zeeb2025-10-211-0/+23
| | | | | | | | We will see how much we will need them and how to fill them at that point. They are left with a pr_debug("TODO") for now. MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D53204
* LinuxKPI: add __counted_by_le() and __counted_by_be()Bjoern A. Zeeb2025-10-211-0/+8
| | | | | | | | The former is needed by a wireless driver at v6.17. MFC after: 3 days Reviewed by: dumbbell, emaste Differential Revision: https://reviews.freebsd.org/D53203
* knotes: kqueue: handle copy for trivial filtersKonstantin Belousov2025-10-181-0/+2
| | | | | | | | Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D52045
* linuxkpi: Support s2idle in `pm_suspend_target_state`Aymeric Wibo2025-10-061-10/+20
| | | | | | | | | | | | | | | When going to s2idle, set Linux' pm_suspend_target_state to PM_SUSPEND_TO_IDLE instead of setting PM_SUSPEND_MEM (for S3) in all cases. This is necessary because more recent versions of the amdgpu DRM drivers have different paths for when entering s2idle & S0ix is supported than S3. Reviewed by: bz Approved by: bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D51591
* power: Add stype parameter in power_suspend/resume eventhandlersAymeric Wibo2025-10-061-2/+5
| | | | | | | | | | Add enum sleep_type stype parameter in power_suspend/resume event handlers, as with the introduction of s2idle there are more than one type of suspend. Reviewed by: bz Approved by: bz Sponsored by: The FreeBSD Foundation
* LinuxKPI: pci: implementation of [lkpi_]pci_get_slot()Bjoern A. Zeeb2025-09-292-0/+21
| | | | | | | | | | | | | | | | | Like lkpi_pci_get_domain_bus_and_slot() implement lkpi_pci_get_slot() using pci_find_bsf() instead of pci_find_dbsf() (no domain). This is needed for a wireless driver. Unfortunately the name [pci_get_slot()] collides with the native PCI function. Add a guard around it and disable the use when the native version is required (in lkpifill_pci_dev() and in bnxt/bnxt_en; if the latter gets fixed we can probably also fix work around it in the former; further conflicts in drm-kmod 6.1-lts, 6.6-lts, and master were resolved). Sponsored by: The FreeBSD Foundation (initially) MFC aftre: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52065
* Reapply "LinuxKPI: pci: allocate entire pci_dev hiereachy up to root port on ↵Bjoern A. Zeeb2025-09-291-7/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | attach" In linux_pci_attach_device() allocate a LinuxKPI pci_dev for each device in the hierarchy up to the root port[1] as we cannot do that later on demand as we may be in a context where we may not sleep. Take special care of DRM as there is a non-PCI device in the chain which needs to be skipped. iwlwifi(4) can hit this case called from a callout. While here leave a comment sa the cleanup order of linux_pci_attach_device() needs correction seperately. This reverts commit 3860afe99ec39b9942967941181f28f27f3fc548. Sponsored by: The FreeBSD Foundation (initially) PR: 283027 PR: 289647 Suggested by: jhb [1] MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52069
* linuxkpi: Move string_helpers.h to string_choices.hEd Maste2025-09-192-63/+75
| | | | | | | | | | | | Chace Linux change fca76071bab2 ("lib/string_helpers: Split out string_choices.h") from v6.5. Everything that we implemented from string_helpers.h has moved, so rename the file, update the include guards, and add a new dummy string_helpers.h that just #includes it. This matches Linux for the functionality that we have. Reviewed by: bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D52606
* LinuxKPI: 802.11: avoid recursive wiphy lockBjoern A. Zeeb2025-09-111-18/+36
| | | | | | | | | | | When freeing the last reference of the net80211 node the net80211 node_free() code may directly call into the crypto code to delete the keys. While we still holding the wiphy lock this would lead to a recursion on the non-recursive wiphy lock. Defer freeing the reference until we are back under the net80211 com lock. Reported by: Mark Phillips (mark freebsdfoundation.org) on 15.0-ALPHA1 MFC after: 3 days
* Revert "LinuxKPI: pci: allocate entire pci_dev hiereachy up to root port on ↵Bjoern A. Zeeb2025-09-081-40/+7
| | | | | | | | | attach" It turns out this breaks the nvidia-drm drviers. We'll try to rework things and put it back later. This reverts commit bbeeb585315645db20118ef349a4e3dc83b148cc.
* LinuxKPI: devres: divorce dem_kfree from lkpi_devm_kmalloc_releaseBjoern A. Zeeb2025-09-052-3/+28
| | | | | | | | | | | | | | dem_kfree() is called from all over the place and should actually do something; contrary to lkpi_devm_kmalloc_release() it can also take a const void *. We have to __DECONST() that though as the entire devres framework does otherwise not take a const argument. This was discovered during the rtw89 upadte to 6.16. Sponsored by: The FreeBSD Foundation (initially) MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52082
* LinuxKPI: maths64: implement roundup_u64()Bjoern A. Zeeb2025-09-051-0/+6
| | | | | | | | | Needed by a wifi driver update. Sponsored by: The FreeBSD Foundation (initially) MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52080
* LinuxKPI: kunit: add static_stub.h and more dummy headersBjoern A. Zeeb2025-09-054-0/+15
| | | | | | | | | These came up during a wifi driver update. Sponsored by: The FreeBSD Foundation (initially) MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52079
* LinuxKPI: sync overflow.h from Linux v6.16Bjoern A. Zeeb2025-09-051-27/+153
| | | | | | | | | | | | It seems overflow.h wsa imported directly from Linux in 3208d4ad2b8320a. Update the file to the newer version as needed for wireless driver updates. Sponsored by: The FreeBSD Foundation (initially) MFC after: 3 days Obtained from: git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 038d61fd642278 (tag: v6.16) Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52078
* LinuxKPI: add __struct_sizeBjoern A. Zeeb2025-09-051-0/+6
| | | | | | | | | | | | | | Use __builtin_object_size() by default. If __builtin_dynamic_object_size() is available use that instead. I would hope that in a future version we can remove the conditional checks but in order to be able to MFC this without checking all compiler versions simply keep it this way for now. Sponsored by: The FreeBSD Foundation (initially) MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52077
* LinuxKPI: add DEFINE_LOCK_GUARD_0 for rcuBjoern A. Zeeb2025-09-052-1/+39
| | | | | | | | | | | | | This adds guard support for non-real-types like rcu locking meaning that we need to keep the lock state separately ourselves. _T is still special and needs to be updated. Given it may not be used it needs an __unused attribute (we are using the LinuxKPI __maybe_unused which indeed is more expressive in this case). Sponsored by: The FreeBSD Foundation (initially) MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52076
* LinuxKPI: cleanup: implement __free() and DEFINE_FREE(); use for kfree()Bjoern A. Zeeb2025-09-052-1/+17
| | | | | | | | | A wifi driver update needs this. Sponsored by: The FreeBSD Foundation (initially) MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52075
* LinuxKPI: timer KPI *_timer -> timer_*Bjoern A. Zeeb2025-09-052-11/+16
| | | | | | | | | | | | | | del_timer() got renamed to timer_delete() approximately in Linux 6.2 (similar for *_sync and likely others). Keep the old functions as compat; unclear when we can gc them. We should also re-define them with a linuxkpi_ prefix to avoid possible conflicts in the future if we do a full pass over this at some point. Sponsored by: The FreeBSD Foundation (intiially) MFC after: 3 days X-MFC; preserve symbols, not inline Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52074