diff options
author | Alvin Chang <alvinga@andestech.com> | 2025-03-26 14:20:51 +0800 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2025-04-23 17:51:01 +0530 |
commit | 4d0128ec58e109faed3f6357f982a0079361075a (patch) | |
tree | db9c9aef2e20c3fa4f2844b430db10cd19818df1 /lib/utils/cppc | |
parent | 2b09a987010865f37508897f01024c0e6e408169 (diff) | |
download | opensbi-4d0128ec58e109faed3f6357f982a0079361075a.zip opensbi-4d0128ec58e109faed3f6357f982a0079361075a.tar.gz opensbi-4d0128ec58e109faed3f6357f982a0079361075a.tar.bz2 |
lib: sbi_domain: Reduce memory usage of per-domain hart context
In current implementation, the length of hartindex_to_context_table[]
array is fixed as SBI_HARTMASK_MAX_BITS. However, the number of harts
supported by the platform might not be SBI_HARTMASK_MAX_BITS and is
usually smaller than SBI_HARTMASK_MAX_BITS. This means it is unnecessary
to allocate such fixed-length array here.
Precisely, current implementation always allocates 1024 bytes for
hartindex_to_context_table[128] on RV64 platform. However, a platform
supports two harts only needs hartindex_to_context_table[2], which only
needs 16 bytes.
This commit calculates needed size of hartindex_to_context_table[]
according to supported number of harts on the platform when registering
per-domain data, so that memory usage of per-domain context data can be
reduced.
Signed-off-by: Alvin Chang <alvinga@andestech.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Link: https://lore.kernel.org/r/20250326062051.3763530-1-alvinga@andestech.com
Signed-off-by: Anup Patel <anup@brainfault.org>
Diffstat (limited to 'lib/utils/cppc')
0 files changed, 0 insertions, 0 deletions