and bitmap_shift_right() functions to linux/bitmap.h
They perform calculation of two bitmaps intersection,
copying the contents of u32 array of bits to bitmap and
logical right shifting of the bits in a bitmap.
Sponsored by: Serenity Cyber Security, LLC
Reviewed by: manu
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D42812
(cherry picked from commit 5ae2e6f913fa1df5f3262255558b76af05409a09)
Cancel a work not waiting for it to finish.
Sponsored by: Serenity Cyber Security, LLC
Reviewed by: manu, kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D42811
(cherry picked from commit 1b2f43a7427ebf51561867f6c497833268014512)
Linux uses it only if SHRINKER_DEBUG config option is enabled. Ignore it.
Sponsored by: Serenity Cyber Security, LLC
Reviewers: manu, bz
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D42809
(cherry picked from commit a39ed121eab16bd2579422f71df7ef29b55965d1)
ida_alloc_min() allocates an unused ID. between min and INT_MAX.
While here allow end parameter of ida_simple_get() be larger than
INT_MAX. Linux caps the value to INT_MAX.
Sponsored by: Serenity Cyber Security, LLC
Reviewers: manu, bz
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D42806
(cherry picked from commit c7312643b7e5f01adc2a3094c5139f5dcab5f0a4)
It is implemented like ktime_get_raw_ns() function but uses less
precise getnanouptime() call.
Sponsored by: Serenity Cyber Security, LLC
Reviewed by: manu, bz
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D42804
(cherry picked from commit e964da141523e1eec2322082936cdb20ba0cf4a7)
And move it along BUILD_BUG family in to
linux/build_bug.h to match Linux.
Sponsored by: Serenity Cyber Security, LLC
Reviewed by: manu, bz
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D42800
(cherry picked from commit 31ef29091b0fbadefb4ccfb21e4b30ca7ddca3ed)
sys/rman.h defines `resource` structure which conflicts with the Linux
structure of the same name. To fix that remove reference to sys/rman.h
from linux/pci.h and move resource management code to linux_pci.c.
Update consumers which were depending on linux/pci.h pollution.
No functional changes intended.
Sponsored by: Serenity Cyber Security, LLC
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D42792
(cherry picked from commit 96ab16ebab6319dce9b3041961b0ab6e20a4fecc)
[Why]
The i915 DRM driver in Linux 5.18 relies on this indirect include.
Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D43030
(cherry picked from commit d6d1e73e5f66f3b12881fffceff58ca54b506792)
[Why]
This header and str_yes_no() are now used by the i915 DRM driver in
Linux 5.18.
Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D43014
(cherry picked from commit 38138beb42d1892dbd8ebb29c01c4471c86d8845)
[Why]
The passed structure may not have a `.store` field. This is the case in
the amdgpu DRM driver starting with Linux 5.18.
Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D43023
(cherry picked from commit d752a5e82ac92603fadf82e7de75878e1f5d054a)
[Why]
The amdgpu DRM driver started to use it in Linux 5.18.
[How]
The function is a no-op as I'm not sure how to implement this with
sysctls yet.
Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D43022
(cherry picked from commit 509707e8b6b7326c7f4793b6e291f0a8e6939412)
[Why]
The amdgpu DRM driver started to use it in Linux 5.18.
Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D43021
(cherry picked from commit b723bcd05a991d446491e914f2b9f35e66227398)
[Why]
`linux_compat.c` is already too long. I will need to add `struct kset`
in a follow-up commit, so let's move the existing `struct kobject` code
to its own file.
Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D43019
(cherry picked from commit 80446fc7b5e5d22e2bac28bc0474dbe2fec83e43)
[Why]
This is consistent with Linux.
[How]
The definition is moved from <linux/shmem_fs.h> to <linux/pagemap.h> and
the latter is included from the former. This is how it is done on Linux.
Prototypes are also expanded with argument names. I got a build failure
in the DRM 5.18 drivers because the compiler considered that the
`pgoff_t` argument was there twice.
Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D43018
(cherry picked from commit 4e0d3f7b3c3295e51ded2bab39f36842f405b4eb)
[Why]
We need this for the `bool` type.
Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D43016
(cherry picked from commit 50a56453dadbd05eb1c43addaf2773a1ef417445)
[Why]
Some files in DRM rely on this indirect include to use `struct rb_*`.
Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D42835
(cherry picked from commit b292c995cfa88cc73d5d77b6b94ae1b78296793f)
[Why]
This function takes an offset and a length as argument, not a physical
address and a number of pages.
This misuse caused the `set_memory_*()` and
`arch_io_reserve_memtype_wc()` functions to return EINVAL.
Another problem was the fact that they returned errors as a positive
integer, whereas Linux uses negative integers.
[How]
Physical addresses and number of pages are converted to offset+length in
the `set_memory_*()` functions.
`arch_io_reserve_memtype_wc()` now calls `pmap_change_attr()` directly
instead of using `set_memory_wc()`.
Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D42053
(cherry picked from commit 1e99b2ee90956f275c3668e92a408400f2dada1c)
Substituting 'uma_align_cache' by the appropriately named accessor
uma_get_cache_align_mask() made apparent that dma_get_cache_alignment()
was off by one, since it was defined to be the mask derived from the
alignment value.
Reviewed by: markj, bz
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D42264
(cherry picked from commit 2c7dd66d09a1b92a4698232996cded6e5315b3bd)
Create the uma_get_cache_align_mask() accessor and put it in a separate
private header so as to minimize namespace pollution in header/source
files that need only this function and not the whole 'uma.h' header.
Make sure the accessors have '_mask' as a suffix, so that callers are
aware that the real alignment is the power of two that is the mask plus
one. Rename the stem to something more explicit. Rename
uma_set_cache_align_mask()'s single parameter to 'mask'.
Hide 'uma_align_cache' to ensure that it cannot be set in any other way
then by a call to uma_set_cache_align_mask(), which will perform sanity
checks in a further commit. While here, rename it to
'uma_cache_align_mask'.
This is also in preparation for some further changes, such as improving
the sanity checks, eliminating internal resolving of UMA_ALIGN_CACHE and
changing the type of the 'uma_cache_align_mask' variable.
Reviewed by: markj, kib
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D42258
(cherry picked from commit dc8f7692fd1de628814f4eaf4a233dccf4c92199)
Commit 3f686532c9 tried to fix an issue with not properly starting
at the first page in the sg list to prevent a panic. This worked but
with the side effect of incrementing "s" during the final iteration
causing it to be NULL since the list had ended.
In cases non-DEBUG kernels this causes a panic with drm-5.15, since
"s" is NULL when we later pass it to sg_mark_end().
This change decouples the iteration sg from the return value so that
it is never incremented past the final page in the chain.
Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D41574
(cherry picked from commit 09b0401e91a92bcb58ea1873857b42f8211f660f)
It seems the mac_header can be set to offset 0 for frames received.
Remove the warning splattering messages to the console for each packet.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit f0e59b6903c881859d7f4eaf269b2336b774c7bc)
So we can use it in non-linuxkpi sources.
Reviewed by: emaste, mmel
Differential Revision: https://reviews.freebsd.org/D41767
Sponsored by: Beckhoff Automation GmbH & Co. KG
(cherry picked from commit 229c65a83fbe0ede8c617e35d8f8c14d5ebadc19)
This is a set of updates of the mt76 driver based on wireless-testing
(wt-2023-05-11) 711dca0ca3d77414f8f346e564e9c8640147f40d (after v6.4-rc1),
This adds support for mt7996 as well.
(wt-2023-06-09) 7bd20e011626ccc3ad53e57873452b1716fcfaaa (after v6.4-rc5),
(wt-2023-07-24) 62e409149b62a285e89018e49b2e115757fb9022 (after v6.5-rc3),
(wt-2023-08-06) 2a220a15be657a24868368892e3e2caba2115283 (after v6.5-rc4).
The current version of LinuxKPI lacks support for "page pool" which
needs enhancing and updating a decade or so old shortcut mapping
struct page directly to struct vm_page.
MFC after: 20 days
Adjust and add structs, fields, functions to make more modern versions
of LinuxKPI based wireless drivers (based on wireless-testing (
wt-2023-06-09, wt-2023-07-24, and later)) compile.
Some of these changes can only be applied once all drivers get
updated to not break the old versions currently in the tree.
Mark those changes with __FOR_LATER_DRV_UPDATE for now and flip the
switch at a later point.
Sponsored by: The FreeBSD Foundation
MFC after: 20 days
Fix arguments to a trace line and remove another trace line until we
actually will have the skb to trace along with a future implementation.
Sponsored by: The FreeBSD Foundation
MFC after: 10 days
Implement mul_u64_u64_div_u64() for an updated iwlwifi driver (though
we do not yet use it there; it is used for in-kernel ptp on wifi).
Sponsored by: The FreeBSD Foundation
Submitted by: cperciva
MFC after: 10 days
Reviewed by: cperciva, dwmalone
Differential Revision: https://reviews.freebsd.org/D40120
Replace FreeBSD native VM_PAGE_TO_PHYS() calls with page_to_phys()
allowing us to work on a struct page in the future using the one
single public Linux KPI interface to map to a native FreeBSD vm_page.
This should be a NOP.
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D41256
We currently define (Linux) page to (FreeBSD) vm_page.
Cleanup some of the direct struct vm_page and vm_page_t declarations
and usages in the Linux KPI and make them 'struct page' or
'struct page *' to prepare for more upcoming work.
This should be a NOP.
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D41255
Add two more PCI_EXP_LNKSTA_CLS constants to the compat defines
needed by wireless drivers.
Sponsored by: The FreeBSD Foundation
MFC after: 10 days
Reviewed by: manu, emaste
Differential Revision: https://reviews.freebsd.org/D41258
Implementation of get_random_u32_inclusive().
This is needed by an update for wireless drivers.
Sponsored by: The FreeBSD Foundation
MFC after: 10 days
Differential Revision: https://reviews.freebsd.org/D40121
Implement list_count_nodes() using a simple loop. This is needed by
an updated wireless driver.
Sponsored by: The FreeBSD Foundation
MFC after: 10 days
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D40757
jiffies_to_msecs() is expected to return an uint_t. In order to avoid
changing printf format strings, properly cast the result to the
expected type.
Sponsored by: The FreeBSD Foundation
MFC after: 10 days
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D40486