aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/linuxkpi/common/include/linux
Commit message (Collapse)AuthorAgeFilesLines
* Fix O(n^2) behavior in sysctlAlan Somers20 hours1-1/+1
| | | | | | | | | | | | | | | | | Sysctl OIDs were internally stored in linked lists, triggering O(n^2) behavior when userland iterates over many of them. The slowdown is noticeable for MIBs that have > 100 children (for example, vm.uma). But it's unignorable for kstat.zfs when a pool has > 1000 datasets. Convert the linked lists into RB trees. This produces a ~25x speedup for listing kstat.zfs with 4100 datasets, and no measurable penalty for small dataset counts. Bump __FreeBSD_version for the KPI change. Sponsored by: Axcient Reviewed by: mjg Differential Revision: https://reviews.freebsd.org/D36500
* LinuxKPI: add DMA_MAPPING_ERRORBjoern A. Zeeb24 hours1-1/+5
| | | | | | | | | While we deal with 0 returned, some drivers directly use and check for DMA_MAPPING_ERROR. Add the case and check for both in dma_mapping_error(). MFC after: 1 week Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D36686
* LinuxKPI: add struct dmi_header and unsupported dmi_walk()Bjoern A. Zeeb24 hours1-0/+13
| | | | | | | | | | | Add a structure definition as well as a dummy dmi_walk for now which returns an error as not supported. Our current dmi implementation is special but does not give access to all details but rather only information from kenv which does not suffice all use cases. MFC after: 1 week Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D36687
* kmem_malloc/free: Use void * instead of vm_offset_t for kernel pointers.John Baldwin5 days1-1/+1
| | | | | | Reviewed by: kib, markj Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D36549
* LinuxKPI: cache.h add L1_CACHE_ALIGN()Bjoern A. Zeeb5 days1-0/+1
| | | | | | | Sponsored by: The FreeBSD Foundation MFC after: 7 days Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D36655
* LinuxKPI: pci.h split up pcim_iomap_regions_request_all()Bjoern A. Zeeb5 days1-17/+35
| | | | | | | | | | Factor out parts of pcim_iomap_regions_request_all() into pcim_iomap_regions() now needed for a driver. Sponsored by: The FreeBSD Foundation MFC after: 7 days Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D36654
* LinuxKPI: if_ether.h add more constantsBjoern A. Zeeb5 days1-0/+9
| | | | | | | | | | In addition to the ones added last year add more found in modern drivers. Sponsored by: The FreeBSD Foundation MFC after: 7 days Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D36656
* LinuxKPI: io.h constify arguments and add more functionsBjoern A. Zeeb5 days1-4/+30
| | | | | | | | | | Constify "*from" arguments and add __ioread32_copy() and __ioread64_copy() based on the already existing implementations. Sponsored by: The FreeBSD Foundation MFC after: 7 days Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D36657
* LinuxKPI: dma-mapping: add dmam_alloc_coherent()Bjoern A. Zeeb5 days1-0/+10
| | | | | | | | | | Add the devres version dmam_alloc_coherent() of dma_alloc_coherent() along with the ancillary free function. Sponsored by: The FreeBSD Foundation MFC after: 7 days Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D36661
* LinuxKPI: tracepoint.h add more definesBjoern A. Zeeb5 days1-1/+7
| | | | | | | | Add some more defines used in drivers to make it easier to compile. MFC after: 7 days Reviewed by: hselasky, emaste Differential Revision: https://reviews.freebsd.org/D36660
* LinuxKPI: pci_ids.h Add more Vendor IDs.Bjoern A. Zeeb5 days1-0/+4
| | | | | | | | | Add PCI vendor IDs found in ath and mt76 drivers. This should make it easier for me and others not having to re-define them locally. MFC after: 7 days Reviewed by: hselasky, emaste Differential Revision: https://reviews.freebsd.org/D36659
* LinuxKPI: lockdep.h add lockdep_{,un}register_key()Bjoern A. Zeeb5 days1-0/+2
| | | | | | | | | Add NOPs for lockdep_{,un}register_key(). Sponsored by: The FreeBSD Foundation MFC after: 7 days Reviewed by: hselasky, emaste Differential Revision: https://reviews.freebsd.org/D36658
* LinuxKPI: pci.h add more defines and functionsBjoern A. Zeeb5 days1-2/+27
| | | | | | | | | | | Add #defines for PCI_DEVICE_ID and repoint the PCI_VENDOR_ID one. Add dev_is_pci(). Add pcie_capability_clear_word() according to similar implementations. Sponsored by: The FreeBSD Foundation MFC after: 7 days Reviewed by: hselasky, emaste Differential Revision: https://reviews.freebsd.org/D36653
* LinuxKPI: device.h add devm_kmemdup()Bjoern A. Zeeb5 days1-0/+19
| | | | | | | | | Add devm_kmemdup() as needed by a networking driver. Sponsored by: The FreeBSD Foundation MFC after: 7 days eviewed by: hselasky, emaste Differential Revision: https://reviews.freebsd.org/D36652
* LinuxKPI: device.h remove duplicate #includeBjoern A. Zeeb6 days1-1/+0
| | | | | | | linux/types.h is included twice; reduce to the first. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11: add more header compat bitsBjoern A. Zeeb6 days2-0/+17
| | | | | | | First part adding more bits in order to synch up drivers to the same level and enable a new ones. MFC after: 3 days
* linuxkpi: Resolve duplicate global symbol name to fix LINT kernel build.Hans Petter Selasky7 days1-2/+5
| | | | | | | | | | | seq_printf() is defined in both spl_procfs_list.c and linux_seq_file.c . Fix this by renaming the LinuxKPI ones and use macros to invoke the correct function. Reported by: jfree@ Differential Revision: https://reviews.freebsd.org/D35883 MFC after: 1 week Sponsored by: NVIDIA Networking
* linuxkpi: drm-kmod debugfs supportJake Freeland7 days4-14/+123
| | | | | | | | | | | | This diff extends LinuxKPI to support simple attribute files in debugfs. These simple attributes are an essential component for compiling drm-kmod with CONFIG_DEBUG_FS enabled. This will allow for easier graphics driver debugging using Intel's igt-gpu-tools. Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D35883 Sponsored by: Google, Inc. (GSoC 2022)
* linuxkpi: Add strndup_userJake Freeland7 days1-0/+9
| | | | | | Reviewed by: hselasky, markj Differential Revision: https://reviews.freebsd.org/D36350 Sponsored by: Google, Inc. (GSoC 2022)
* linuxkpi: Add EPOLL aliasesJake Freeland7 days2-0/+46
| | | | | | Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D36527 Sponsored by: Google, Inc. (GSoC 2022)
* linuxkpi: Add down_read_killable()Jake Freeland7 days1-0/+2
| | | | | | Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D36528 Sponsored by: Google, Inc. (GSoC 2022)
* rb_tree: pass parent to RB_INSERT_COLORDoug Moore2022-09-131-3/+8
| | | | | | | | | Change RB_COLOR_INSERT to take a parent parameter, to avoid looking up a value already available. Make adjustments to a linux rbtree header, which invokes it. Reviewed by: alc, hselasky Differential Revision: https://reviews.freebsd.org/D36114
* LinuxKPI: 80211 (+net80211): update and cleanup headersBjoern A. Zeeb2022-09-092-18/+19
| | | | | | | | | | | | | | | | | | | | | | Fix types for various struct fields (initially added as int). Move structs and inline functions logically together, e.g., for wowlan. Add more skeleton functions and #defines needed for iwlwifi d3.c in the future. Add struct ieee80211_vht_cap (without "_ie") to net80211 and remove duplicate definitions in LinuxKPI headers now using net80211 structs. For now leave ieee80211_ie_vhtcap in net80211. I am not sure yet if we actually need it as such. That'll be cleaned up with more VHT updates in net80211 in the future. No functional changes in currently compiled code intended. Try to implement ieee80211_action_contains_tpc() as I ran into it with an older iwlwifi chipset. This depends on c994352a8841eb453. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
* linuxkpi: Add non-atomic readq()/writeq()Felix Palmen2022-09-091-0/+65
| | | | | | | | The non-atomic versions are required by drm-510-kmod to build on 32-bit architectures. Approved by: hselasky, manu, tcberner (mentor) Differential Revision: https://reviews.freebsd.org/D36507
* rb_tree: reduce duplication in balancing codeDoug Moore2022-09-081-6/+6
| | | | | | | | | | | | | | | Change RB_INSERT_COLOR and RB_REMOVE_COLOR so that the blocks of code that are identical except for left and right being exchanged are made only one block with a variable to indicate left- or right-handedness. Rename RB macros so that those not intended for external use begin with an underscore. Add comments to the balancing code so that another might understand it. Reviewed by: alc, kib MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D36393
* LinuxKPI: netdev: expose napi stateBjoern A. Zeeb2022-09-071-2/+27
| | | | | | | | | | | | | There are drivers directly accessing napi->state testing for bits (NAPI_STATE_SCHED encountered so far). Rename the internal _flags struct field to state and expose our internal state flag bits along with the one official aliased. As I left in a comment, I wished Linux would hide these accesses behind inline functions or by other means and not public expose the implementation details. MFC after: 1 week
* LinuxKPI: firmware: add request_partial_firmware_into_buf()Bjoern A. Zeeb2022-09-071-0/+13
| | | | | | | | | | A (so far out-of-tree) driver update needs request_partial_firmware_into_buf(). Given we load the full .ko file using firmware(9) just do that and copy the requeste data into the buffer (rather than poissibly only reading portions of the firmware file). MFC after: 1 week
* net80211 / drivers: rename to IEEE80211_FC0_SUBTYPE_QOS_DATABjoern A. Zeeb2022-09-031-4/+4
| | | | | | | | | | | | | | Going through the Frame (Sub)types the "QOS Data" being called "QOS" scheme leads to a naming conflict for QOS_CFPOLL and QOS_CFACKPOLL (if added). Rename QOS* to QOS_DATA* to avoid the conflict and to also better match the standards name. No functional changes intended. Sponsored by: The FreeBSD Foundation MFC after: 5 days Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D36409
* linuxkpi: unbreak linux_i2cbbEmmanuel Vadot2022-08-241-2/+2
| | | | | | | | | | | | | | | | | | | | This is a joint work with manu. - fixed conditions in do_i2c_transfer and i2c_transfer as linux_i2cbb does not set adapter->algo->master_xfer but does set adapter->algo_data; - fixed parent bus specification for linux_i2cbb driver module; - actually implemented iicbb_transfer method; - added iicbb_pre_xfer and iicbb_post_xfer methods; - removed unnecessary and harmful delays (and other extra logic) from iicbb methods as iicbb driver already has them; - added setting of iicbb speed based on algo_data->udelay, so that iicbb uses correct delays; PR: 265920 Fixes: 1961a14a4743 linuxkpi: Add i2c support MFC after: 2 weeks Sponsored by: Beckhoff Automation GmbH & Co. KG (manu's work)
* rb_tree: speed-up double rotationDoug Moore2022-08-191-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | RB_ROTATE_LEFT (and it symmetric twin) modify the rb-tree, adjusting pointers so that what started as a proper tree ends up a proper tree. When two consecutive rotations move the same node up the tree, some of the pointers changed in the first rotation are immediately changed again in the second - namely, the pointer from the rising node to its new parent, and the pointer from that parent back to the rising node. This change removes from RB_ROTATE macros the responsibility for managing those two pointers, and leaves it to the code that calls for rotations to fix up those pointers afterward. That drops a comparison and a pair of assignments from every INSERT_COLOR or REMOVE_COLOR call that ends in a double rotation. A side-effect of this change is that the SWAP_CHILD macro must take as a parameter a pointer to the node that is changing children, where it is now computed from the old child. Since this macro is called in a couple of places besides the RB_ROTATE macros, those calls are also affected. Reviewed by: alc MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D36266
* LinuxKPI: extend kfifo to be usableBjoern A. Zeeb2022-08-181-0/+89
| | | | | | | | Implement some basic kfifo pieces as needed by drivers. MFC after: 2 weeks Reviewed by: wulf, hselasky Differential Revision: https://reviews.freebsd.org/D35829
* linuxkpi: Add I2C_NAME_SIZE and I2C_MODULE_PREFIX definesEmmanuel Vadot2022-08-181-0/+3
| | | | | | | | Both are needed by drm-kmod Obtained from: drm-kmod Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: //reviews.freebsd.org/D36212
* linuxkpi: Add linux/vgaarb.hEmmanuel Vadot2022-08-181-0/+254
| | | | | | | | | Needed by drm-kmod. Reviewed by: bz Obtained from: Linux Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D36104
* linuxkpi: Add __copy_to_user_inatomic and __copy_from_user_inatomicEmmanuel Vadot2022-08-181-0/+25
| | | | | | | Reviewed by: bz Obtained from: drm-kmod Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D36113
* linuxkpi: Add add_taint stubEmmanuel Vadot2022-08-181-0/+2
| | | | | | | Needed by drm-kmod. Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D36112
* linuxkpi: Add few more include in linux/kernel.hEmmanuel Vadot2022-08-181-0/+3
| | | | | | | | Those are needed and also included in linux (via polution). Reviewed by: bz Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D36111
* linuxkpi: swap.h: Fix includeEmmanuel Vadot2022-08-181-0/+7
| | | | | | | | | Add needed includes so we can use it. Reviewed by: bz Fixes: c3f4f28c63da ("linuxkpi: Add some basic swap functions") Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D36109
* linuxkpi: Add stub kmem_cache_shrinkEmmanuel Vadot2022-08-181-0/+1
| | | | | | | | Needed by drm-kmod. Reviewed by: bz Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D36108
* linuxkpi: Add dma_{un,}map_sgtableEmmanuel Vadot2022-08-181-0/+20
| | | | | | | | | Variant of dma_{un,}map_sg_attrs for struct sg_table. Reviewed by: bz Obtained from: drm-kmod Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D36106
* linuxkpi: Add linux/stackdepot.hEmmanuel Vadot2022-08-181-0/+32
| | | | | | | | | With a typedef needed by drm-kmod. Reviewed by: bz Obtained from: drm-kmod Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D36105
* linuxkpi: Add sched/mm.hEmmanuel Vadot2022-08-181-0/+40
| | | | | | | | With stubs needed by drm-kmod. Obtained from: drm-kmod Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D36100
* linuxkpi: Add refcount_dec_and_testEmmanuel Vadot2022-08-182-0/+12
| | | | | | | | | | In Linux this takes a refcount_t argument but in linuxkpi struct kref uses an atomic_t for the refcount and code in drm directly uses this function with a kref so use an atomic_t here. Reviewed by: bz Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D36099
* linuxkpi: Add for_each_sgtable_{sg,page}Emmanuel Vadot2022-08-181-0/+6
| | | | | | | | | Needed by drm-kmod. Reviewed by: bz Obtained from: drm-kmod Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D36098
* protosw: refactor protosw and domain static declaration and loadGleb Smirnoff2022-08-171-2/+2
| | | | | | | | | | | | | | | | | | | o Assert that every protosw has pr_attach. Now this structure is only for socket protocols declarations and nothing else. o Merge struct pr_usrreqs into struct protosw. This was suggested in 1996 by wollman@ (see 7b187005d18ef), and later reiterated in 2006 by rwatson@ (see 6fbb9cf860dcd). o Make struct domain hold a variable sized array of protosw pointers. For most protocols these pointers are initialized statically. Those domains that may have loadable protocols have spacers. IPv4 and IPv6 have 8 spacers each (andre@ dff3237ee54ea). o For inetsw and inet6sw leave a comment noting that many protosw entries very likely are dead code. o Refactor pf_proto_[un]register() into protosw_[un]register(). o Isolate pr_*_notsupp() methods into uipc_domain.c Reviewed by: melifaro Differential revision: https://reviews.freebsd.org/D36232
* linuxkpi: io.h: Only exclude armv6 and armv7 for asm/set_memory.hEmmanuel Vadot2022-08-081-1/+1
| | | | | | | | Other arches like powerpc* needs it. Fixes: d387a1b4b1996 ("linuxkpi: io.h: Do not include asm/set_memory.h for armv6 and armv7") Fixes: 789dbdbb48574 ("linuxkpi: Add arch_io_{reserve,free}_memtype_wc") Sponsored by: Beckhoff Automation GmbH & Co. KG
* linuxkpi: io.h: Do not include asm/set_memory.h for armv6 and armv7Emmanuel Vadot2022-08-081-0/+2
| | | | | | | They do not have the same pmap api and this cannot work for those arch. Fixes: 789dbdbb48574 ("linuxkpi: Add arch_io_{reserve,free}_memtype_wc") Sponsored by: Beckhoff Automation GmbH & Co. KG
* linuxkpi: pm: Add more defines and includesEmmanuel Vadot2022-08-081-0/+10
| | | | | | | | | Needed by drm-kmod. Reviewed By: emaste, hselasky Obtained from: drm-kmod Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D36024
* linuxkpi: Include highmem.h in pagemap.hEmmanuel Vadot2022-08-081-0/+1
| | | | | | | | Linux does the same. Reviewed by: bz, emaste, hselasky Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D36023
* linuxkpi: Add arch_io_{reserve,free}_memtype_wcEmmanuel Vadot2022-08-081-0/+16
| | | | | | | Reviewed by: hselasky Obtained from: drm-kmod Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D36022
* linuxkpi: Add dev_info_onceEmmanuel Vadot2022-08-081-0/+8
| | | | | | Obtained from: drm-kmod Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D36021