summaryrefslogtreecommitdiff
path: root/include/sbi/sbi_bitops.h
AgeCommit message (Collapse)Author
2025-04-14sbi: Introduce sbi_hartmask_weightAndrew Jones
Provide a function to count the number of set bits in a hartmask, which builds on a new function for the same that operates on a bitmask. While at it, improve the performance of sbi_popcount() which is used in the implementation. Signed-off-by: Andrew Jones <[email protected]> Reviewed-by: Anup Patel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Anup Patel <[email protected]>
2024-09-23include: sbi_bitops: add ULL version for BIT and GENMASKZong Li
Add BIT_ULL and GENMASK_ULL for dealing with 64-bits data on 32-bits CPU, then we don't need to separate the operation to low part and high part. For instance, the MMIO register is 64 bits wide. Signed-off-by: Zong Li <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2023-12-11platform: recalculate heap size to support new tlb entry numberInochi Amaoto
Previous patch introduced a change that using hart count as the default number of tlb entries in the fifo. This makes the default tlb fifo size grow in square with the number of harts. So the default heap size is not enough to allocate tlb fifo when the hart count is big. Fixes: 52fd64b ("platform: Uses hart count as the default size of tlb info") Signed-off-by: Inochi Amaoto <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2023-08-22lib: sbi_pmu: remove mhpm_count field in hart featureInochi Amaoto
After supporting noncontigous hpm event and counters in opensbi, the number of hpm counters can be calculated by the mhpm_mask. So this field is unnecessary and can be removed to save some space. Signed-off-by: Inochi Amaoto <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2023-05-11lib: sbi: Simplify BITS_PER_LONG definitionXiang W
No need to use #elif ladder when defining BITS_PER_LONG. Signed-off-by: Xiang W <[email protected]> Reviewed-by: Andrew Jones <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2022-02-04lib: fix compilation when strings.h is includedPetro Karashchenko
In a systems that provide strings.h and it is included together with sbi_bitops.h the compilation error appears. The ffs() and fls() are provided by strings.h Signed-off-by: Petro Karashchenko <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2020-07-14include: sbi_bitops: Remove dead shift assignment in ffs/flsTobias Klauser
The value assigned to x by the shift assignment in the last if block of ffs/fls is never read. Remove it. Signed-off-by: Tobias Klauser <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2020-03-10lib: sbi: Fix coding style issuesBin Meng
This fixes various coding style issues found in the SBI codes. No functional changes. Signed-off-by: Bin Meng <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2020-03-08include: sbi_bitops: More useful bit operationsAnup Patel
This patch extends our bit operation library with mechanism to: 1. Iteratively traverse bits 2. Set bit 3. Clear bit 4. Change bit 5. ... other helpful functions ... Most the above is adopted from Xvisor sources. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-03-08include: Move bits related defines and macros to sbi_bitops.hAnup Patel
The right location for all bits related defines and macros is sbi_bitops.h hence this patch. With this patch, the sbi_bits.h is redundant so we remove it. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2019-12-23lib: Add IPI extension in SBIAtish Patra
This patch adds new IPI extension which replaces ipi related v0.1 extensions. This also adds a new API for ipi sending as trap handling is not necessary in v0.2 SBI IPI related extensions. It also modifies the IPI sending code which now accepts hart mask as a value instead of S-mode virtual address. Thus, the caller should set it to exact hart mask value everytime. Signed-off-by: Atish Patra <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2019-04-24all: run clang-format and update checked-in filesOlof Johansson
Noisy commit, no functional changes. Generated with an current upstream clang-format and: clang-format -i $(find . -name \*.[ch]) Signed-off-by: Olof Johansson <[email protected]>
2019-01-24all: Update copyright header in all filesAnup patel
This patch updates copyright header in all files as follows: 1. Makes "SPDX-License-Identifier: BSD-2-Clause" as first line 2. Change copyright year to 2019 for Western Digital Signed-off-by: Anup Patel <[email protected]>
2019-01-22lib: Add atomic bit set/clear operations.Atish Patra
Add addtional functionlities for set/clear bits atomically. Signed-off-by: Atish Patra <[email protected]>