aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorNick Hu <nick.hu@sifive.com>2024-11-15 15:33:08 +0800
committerAnup Patel <anup@brainfault.org>2024-11-28 12:13:38 +0530
commit23ef9c5f00b81cffbbf7ff6894f241fad07ee4b7 (patch)
treefcb104cf8fc457dff7c419fb70be2f9492d365fb /lib
parent111772353f4a334dfc4a94a17ebbec8e3edc0b5e (diff)
downloadopensbi-23ef9c5f00b81cffbbf7ff6894f241fad07ee4b7.zip
opensbi-23ef9c5f00b81cffbbf7ff6894f241fad07ee4b7.tar.gz
opensbi-23ef9c5f00b81cffbbf7ff6894f241fad07ee4b7.tar.bz2
sbi: fwft: clear the config lock when warm boot
The hotplug cpu should clear the fwft config's SBI_FWFT_SET_FLAG_LOCK in the warm boot flow otherwise the cpu can't set the menvcfg.sse by SBI_EXT_FWFT_SET sbi call and cause the illegal instruction when accessing the CSR_SSP in kernel. Signed-off-by: Nick Hu <nick.hu@sifive.com> Reviewed-by: Anup Patel <anup@brainfault.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/sbi/sbi_fwft.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/sbi/sbi_fwft.c b/lib/sbi/sbi_fwft.c
index 9cf14c1..0cb165b 100644
--- a/lib/sbi/sbi_fwft.c
+++ b/lib/sbi/sbi_fwft.c
@@ -311,6 +311,18 @@ static int fwft_get_feature(enum sbi_fwft_feature_t feature,
return SBI_SUCCESS;
}
+static void fwft_clear_config_lock(enum sbi_fwft_feature_t feature)
+{
+ int ret;
+ struct fwft_config *conf;
+
+ ret = fwft_get_feature(feature, &conf);
+ if (ret)
+ return;
+
+ conf->flags &= ~SBI_FWFT_SET_FLAG_LOCK;
+}
+
int sbi_fwft_set(enum sbi_fwft_feature_t feature, unsigned long value,
unsigned long flags)
{
@@ -414,5 +426,8 @@ int sbi_fwft_init(struct sbi_scratch *scratch, bool cold_boot)
fwft_set_hart_state_ptr(scratch, fhs);
}
+ for (i = 0; i < array_size(features); i++)
+ fwft_clear_config_lock(features[i].id);
+
return 0;
}