mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2026-06-12 22:31:45 +01:00
platform: generic: Optimize extensions_init() to parse ISA extensions once
Instead of parsing ISA extensions separately for each hart in the generic_extensions_init() function, it is better to parse ISA extensions for all available harts in the cold boot path. Also, this allows us to remove fdt_isa_bitmap from scratch space and directly initialize "extensions" in struct sbi_hart_features for each hart. Signed-off-by: Anup Patel <anup.patel@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260521082625.1520870-3-anup.patel@oss.qualcomm.com Signed-off-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
+3
-4
@@ -508,7 +508,7 @@ static int hart_mhpm_get_allowed_bits(void)
|
||||
return num_bits;
|
||||
}
|
||||
|
||||
static int hart_detect_features(struct sbi_scratch *scratch)
|
||||
static int hart_detect_features(struct sbi_scratch *scratch, bool cold_boot)
|
||||
{
|
||||
struct sbi_trap_info trap = {0};
|
||||
struct sbi_hart_features *hfeatures =
|
||||
@@ -525,8 +525,7 @@ static int hart_detect_features(struct sbi_scratch *scratch)
|
||||
* Needed to detect Smrnmi and install NMI handlers before CSR probes
|
||||
* that may trigger traps.
|
||||
*/
|
||||
rc = sbi_platform_extensions_init(sbi_platform_thishart_ptr(),
|
||||
hfeatures);
|
||||
rc = sbi_platform_extensions_init(sbi_platform_ptr(scratch), cold_boot);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
@@ -764,7 +763,7 @@ int sbi_hart_init(struct sbi_scratch *scratch, bool cold_boot)
|
||||
return SBI_ENOMEM;
|
||||
}
|
||||
|
||||
rc = hart_detect_features(scratch);
|
||||
rc = hart_detect_features(scratch, cold_boot);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user