History log of /src/sys/compat/linuxkpi/common/include/linux/bitops.h (Results 1 – 25 of 76)
Revision Date Author Comments
# 7e4a2b38 20-Jan-2026 Bjoern A. Zeeb <bz@FreeBSD.org>

LinuxKPI: improve hweight<n> if complie time constant

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<

LinuxKPI: improve hweight<n> if complie time constant

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

show more ...


# 6c0bcd15 07-Jan-2026 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

linuxkpi: Add `rol32()`

`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

linuxkpi: Add `rol32()`

`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

show more ...


# a9462e32 07-Sep-2025 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

linuxkpi: Add `rol64()`

This is used by <linux/siphash.h> added in a separate future commit.

Reviewed by: bz
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/

linuxkpi: Add `rol64()`

This is used by <linux/siphash.h> added in a separate future commit.

Reviewed by: bz
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D54499

show more ...


# 34892a8e 15-Sep-2025 Bjoern A. Zeeb <bz@FreeBSD.org>

LinuxKPI: bitcount fix builds with gcc and older llvm

LLVM before 19 and gcc before 14 do not support __builtin_popcountg().
Use __const_bitcount<n> from sys/bitcount.h as a replacement in these
cas

LinuxKPI: bitcount fix builds with gcc and older llvm

LLVM before 19 and gcc before 14 do not support __builtin_popcountg().
Use __const_bitcount<n> from sys/bitcount.h as a replacement in these
cases. This should still allow drm-kmod to build where the size needs
to be known at compile-time.

Remove the conditional for gcc around the iwlwifi modules build,
which was collateral damage in all this.

Sponsored by: The FreeBSD Foundation
Fixes: 7cbc4d875971, 5e0a4859f28a
MFC after: 3 days
Reviewed by: brooks, emaste (without the sys/modules/Makefile change)
Differential Revision: https://reviews.freebsd.org/D54297

show more ...


# 3e9ad70a 22-Oct-2025 Mark Johnston <markj@FreeBSD.org>

linuxkpi: Fix the definition of BITS_PER_LONG

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 ad

linuxkpi: Fix the definition of BITS_PER_LONG

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

show more ...


# 7cbc4d87 22-Jun-2025 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

linuxkpi: Use `__builtin_popcountg()` instead of `bitcount*()`

The DRM drivers generic code started to use `HWEIGHT64()` in the
definition of an array field in a structure. Therefore, the array size

linuxkpi: Use `__builtin_popcountg()` instead of `bitcount*()`

The DRM drivers generic code started to use `HWEIGHT64()` in the
definition of an array field in a structure. Therefore, the array size
needs to be known at compile time. This was not the case with the
`HWEIGHT*()` macros based on `bitcount*()`. The use of
`__builtin_popcountg()` solves that problem.

Reviewed by: bz
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D50995

show more ...


# cdbff1b2 24-Jun-2025 Ed Maste <emaste@FreeBSD.org>

linuxkpi: Remove incorrect + 1 from HWEIGHT* macros

Fixes: 4cc8a9da491d ("LinuxKPI: add HWEIGHT32()")
Reviewed by: bz
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.free

linuxkpi: Remove incorrect + 1 from HWEIGHT* macros

Fixes: 4cc8a9da491d ("LinuxKPI: add HWEIGHT32()")
Reviewed by: bz
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D51010

show more ...


# 3fd7fd49 27-Dec-2024 Jean-Sébastien Pédron <dumbbell@FreeBSD.org>

linuxkpi: Add `__assign_bit()`

[Why]
This function is used by the i915 DRM driver in Linux 6.7.

Reviewed by: manu
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd

linuxkpi: Add `__assign_bit()`

[Why]
This function is used by the i915 DRM driver in Linux 6.7.

Reviewed by: manu
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48752

show more ...


# f674f016 02-Apr-2024 Bjoern A. Zeeb <bz@FreeBSD.org>

LinuxKPI: add BITS_TO_BYTES()

Just like BITS_TO_LONG() ... used in rtw89.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.o

LinuxKPI: add BITS_TO_BYTES()

Just like BITS_TO_LONG() ... used in rtw89.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D44603

show more ...


# 95ee2897 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: two-line .h pattern

Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/


# d17b78aa 09-Feb-2022 Bjoern A. Zeeb <bz@FreeBSD.org>

LinuxKPI: add __ffs64()

Add __ffs64() to linux/bitops.h needed by a driver.

Reviewed by: hselasky
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D34225


# 307f78f3 19-Dec-2021 Vladimir Kondratyev <wulf@FreeBSD.org>

LinuxKPI: Constantly use _LINUXKPI_ prefix in include guards

MFC after: 1 week
Reviewed by: bz, emaste, hselasky, manu
Differential Revision: https://reviews.freebsd.org/D33562


# ea4dea83 01-Jul-2021 Bjoern A. Zeeb <bz@FreeBSD.org>

LinuxKPI: add sign_extend32()

Add sign_extend32() replicating the 64 version. This is needed by
the rtw88 driver.

MFC after: 10 days
Reviewed by: imp, emaste, hselasky
Differential Revision: https

LinuxKPI: add sign_extend32()

Add sign_extend32() replicating the 64 version. This is needed by
the rtw88 driver.

MFC after: 10 days
Reviewed by: imp, emaste, hselasky
Differential Revision: https://reviews.freebsd.org/D30979

show more ...


# 4cc8a9da 27-May-2021 Bjoern A. Zeeb <bz@FreeBSD.org>

LinuxKPI: add HWEIGHT32()

Add HWEIGHT32() macro needed by iwlwifi and while here add the 8/16/64
variants likewise.

Sponsored by: The FreeBSD Foundation
MFC after: 12 days
Reviewed by: hselasky
Dif

LinuxKPI: add HWEIGHT32()

Add HWEIGHT32() macro needed by iwlwifi and while here add the 8/16/64
variants likewise.

Sponsored by: The FreeBSD Foundation
MFC after: 12 days
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D30501

show more ...


# a399cf13 07-Dec-2020 Hans Petter Selasky <hselasky@FreeBSD.org>

Prefer using the MIN() function macro over the min() inline function
in the LinuxKPI. Linux defines min() to be a macro, while in FreeBSD
min() is a static inline function clamping its arguments to
"

Prefer using the MIN() function macro over the min() inline function
in the LinuxKPI. Linux defines min() to be a macro, while in FreeBSD
min() is a static inline function clamping its arguments to
"unsigned int".

MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

show more ...


# de6fc2e3 15-Aug-2020 Dimitry Andric <dim@FreeBSD.org>

Merge ^/head r364082 through r364250.


# 440cec3f 12-Aug-2020 Glen Barber <gjb@FreeBSD.org>

MFH

Sponsored by: Rubicon Communications, LLC (netgate.com)


# 74d3a635 11-Aug-2020 Hans Petter Selasky <hselasky@FreeBSD.org>

Use atomic_clear_rel_long() to implement clear_bit_unlock() in the LinuxKPI
after r363842.

Suggested by: alc@
MFC after: 1 week
Sponsored by: Mellanox Technologies


# e383ec74 06-Aug-2020 Dimitry Andric <dim@FreeBSD.org>

Merge ^/head r363739 through r363986.


# 334680ab 04-Aug-2020 Emmanuel Vadot <manu@FreeBSD.org>

linuxkpi: Add clear_bit_unlock

This calls clear_bit and adds a memory barrier.

Sponsored by: The FreeBSD Foundation

Reviewed by: hselasky
MFC after: 1 week
Differential Revision: https://reviews.f

linuxkpi: Add clear_bit_unlock

This calls clear_bit and adds a memory barrier.

Sponsored by: The FreeBSD Foundation

Reviewed by: hselasky
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25943

show more ...


# 07fdea36 20-Apr-2020 Hans Petter Selasky <hselasky@FreeBSD.org>

Allow test_bit() in the LinuxKPI to accept a const pointer.

MFC after: 1 week
Sponsored by: Mellanox Technologies


# 2aaf9152 18-Mar-2019 Alan Somers <asomers@FreeBSD.org>

MFHead@r345275


# 884aaac6 13-Mar-2019 Hans Petter Selasky <hselasky@FreeBSD.org>

Implement BITS_PER_TYPE() function macro in the LinuxKPI.
Fix some style while at it.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 1 week
Sponsored by: Limelight Networks
Spons

Implement BITS_PER_TYPE() function macro in the LinuxKPI.
Fix some style while at it.

Submitted by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 1 week
Sponsored by: Limelight Networks
Sponsored by: Mellanox Technologies

show more ...


# f9c0a512 10-Aug-2018 Dimitry Andric <dim@FreeBSD.org>

Merge ^/head r337286 through r337585.


# 7e4a2b38 20-Jan-2026 Bjoern A. Zeeb <bz@FreeBSD.org>

LinuxKPI: improve hweight<n> if complie time constant

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<

LinuxKPI: improve hweight<n> if complie time constant

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

show more ...


1234