opnsense-src/sys/arm
Mitchell Horne a89262079e Consistently provide ffs/fls using builtins
Use of compiler builtin ffs/ctz functions will result in optimized
instruction sequences when possible, and fall back to calling a function
provided by the compiler run-time library. We have slowly shifted our
platforms to take advantage of these builtins in 60645781d6 (arm64),
1c76d3a9fb (arm), 9e319462a0 (powerpc, partial).

Some platforms still rely on the libkern implementations of these
functions provided by libkern, namely riscv, powerpc (ffs*, flsll), and
i386 (ffsll and flsll). These routines are slow, as they perform a
linear search for the bit in question. Even on platforms lacking
dedicated bit-search instructions, such as riscv, the compiler library
will provide better-optimized routines, e.g. by using binary search.

Consolidate all definitions of these functions (whether currently using
builtins or not) to libkern.h. This should result in equivalent or
better performing routines in all cases.

One wart in all of this is the existing HAVE_INLINE_F*** macros, which
we use in a few places to conditionally avoid the slow libkern routines.
These aren't easily removed in one commit. For now, provide these
defines unconditionally, but marked for removal after subsequent
cleanup.

Removal of the now unused libkern routines will follow in the next
commit.

Reviewed by:	dougm, imp (previous version)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D40698
2023-07-06 14:46:41 -03:00
..
allwinner spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
altera/socfpga arm altera: Remove unused devclass arguments to DRIVER_MODULE. 2022-05-09 14:26:44 -07:00
annapurna/alpine ofw_cpu_early_foreach: Change callback to return bool instead of boolean_t. 2023-05-04 12:33:39 -07:00
arm sysarch: Add includes required for ktrcapfail() calls to be compiled 2023-06-01 17:18:23 -04:00
broadcom/bcm2835 bcm2835_gpio: Handle BCM2711 pin configuration 2023-05-29 15:47:12 -03:00
conf arm: Remove TI code from GENERIC 2023-05-01 08:32:21 +02:00
freescale spdx: Simplify BSD-2-Clause AND BSD-2-Clause 2023-05-12 10:44:04 -06:00
include Consistently provide ffs/fls using builtins 2023-07-06 14:46:41 -03:00
mv spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
nvidia Map arm64 pci config memory as non-posted 2023-03-05 20:17:21 +00:00
qemu ofw_cpu_early_foreach: Change callback to return bool instead of boolean_t. 2023-05-04 12:33:39 -07:00
qualcomm fix qcom_cpu_kpssv2 compile on ASUS_AC1300 2023-06-12 08:30:15 -06:00
rockchip spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
ti spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
xilinx spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00