diff options
| author | Inochi Amaoto <[email protected]> | 2023-08-11 08:24:43 +0800 |
|---|---|---|
| committer | Anup Patel <[email protected]> | 2023-08-22 13:26:09 +0530 |
| commit | ee1f83ca848d3639b808e52719bc7111f5a1be7c (patch) | |
| tree | 43c0926985596609254bdb6004886f4fa5360909 /include | |
| parent | e7e73aa532fa5813f457b9b09899413f41885d37 (diff) | |
lib: sbi_pmu: remove mhpm_count field in hart feature
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]>
Diffstat (limited to 'include')
| -rw-r--r-- | include/sbi/sbi_bitops.h | 16 | ||||
| -rw-r--r-- | include/sbi/sbi_hart.h | 2 |
2 files changed, 16 insertions, 2 deletions
diff --git a/include/sbi/sbi_bitops.h b/include/sbi/sbi_bitops.h index 2e08947b..48a20901 100644 --- a/include/sbi/sbi_bitops.h +++ b/include/sbi/sbi_bitops.h @@ -112,6 +112,22 @@ static inline unsigned long sbi_fls(unsigned long word) return num; } +/** + * sbi_popcount - find the number of set bit in a long word + * @word: the word to search + */ +static inline unsigned long sbi_popcount(unsigned long word) +{ + unsigned long count = 0; + + while (word) { + word &= word - 1; + count++; + } + + return count; +} + #define for_each_set_bit(bit, addr, size) \ for ((bit) = find_first_bit((addr), (size)); \ (bit) < (size); \ diff --git a/include/sbi/sbi_hart.h b/include/sbi/sbi_hart.h index 17d3ada9..e60f4150 100644 --- a/include/sbi/sbi_hart.h +++ b/include/sbi/sbi_hart.h @@ -69,7 +69,6 @@ struct sbi_hart_features { unsigned int pmp_count; unsigned int pmp_addr_bits; unsigned long pmp_gran; - unsigned int mhpm_count; unsigned int mhpm_mask; unsigned int mhpm_bits; }; @@ -85,7 +84,6 @@ static inline ulong sbi_hart_expected_trap_addr(void) return (ulong)sbi_hart_expected_trap; } -unsigned int sbi_hart_mhpm_count(struct sbi_scratch *scratch); unsigned int sbi_hart_mhpm_mask(struct sbi_scratch *scratch); void sbi_hart_delegation_dump(struct sbi_scratch *scratch, const char *prefix, const char *suffix); |
