summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorRaj Vishwanathan <[email protected]>2025-04-23 15:50:45 -0700
committerAnup Patel <[email protected]>2025-04-24 09:23:47 +0530
commit99aabc6b8431a2bcf2b28a2423952e529de9fbc5 (patch)
tree98113aa1ca54567d010931e7f9f3799ca208e435 /platform
parent4d0128ec58e109faed3f6357f982a0079361075a (diff)
lib: sbi: Set the scratch allocation to alignment to cacheline size
Set the scratch allocation alignment to cacheline size specified by riscv,cbom-block-size in the DTS file to avoid two atomic variables from the same cache line causing livelock on some platforms. If the cacheline is not specified, we set it a default value. Signed-off-by: Raj Vishwanathan <[email protected]> Reviewed-by: Anup Patel <[email protected]> Reviewed-by: Samuel Holland <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Anup Patel <[email protected]>
Diffstat (limited to 'platform')
-rw-r--r--platform/generic/platform.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/platform/generic/platform.c b/platform/generic/platform.c
index f3072be8..2e856642 100644
--- a/platform/generic/platform.c
+++ b/platform/generic/platform.c
@@ -147,6 +147,8 @@ unsigned long fw_platform_init(unsigned long arg0, unsigned long arg1,
const void *fdt = (void *)arg1;
u32 hartid, hart_count = 0;
int rc, root_offset, cpus_offset, cpu_offset, len;
+ unsigned long cbom_block_size = 0;
+ unsigned long tmp = 0;
root_offset = fdt_path_offset(fdt, "/");
if (root_offset < 0)
@@ -174,11 +176,17 @@ unsigned long fw_platform_init(unsigned long arg0, unsigned long arg1,
continue;
generic_hart_index2id[hart_count++] = hartid;
+
+ rc = fdt_parse_cbom_block_size(fdt, cpu_offset, &tmp);
+ if (rc)
+ continue;
+ cbom_block_size = MAX(tmp, cbom_block_size);
}
platform.hart_count = hart_count;
platform.heap_size = fw_platform_get_heap_size(fdt, hart_count);
platform_has_mlevel_imsic = fdt_check_imsic_mlevel(fdt);
+ platform.cbom_block_size = cbom_block_size;
fw_platform_coldboot_harts_init(fdt);