aboutsummaryrefslogtreecommitdiffstats
path: root/arch/riscv/errata/thead/errata.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/riscv/errata/thead/errata.c')
-rw-r--r--arch/riscv/errata/thead/errata.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/arch/riscv/errata/thead/errata.c b/arch/riscv/errata/thead/errata.c
index 6e7ee1f16bee3e..bf6a0a6318ee30 100644
--- a/arch/riscv/errata/thead/errata.c
+++ b/arch/riscv/errata/thead/errata.c
@@ -19,6 +19,9 @@
#include <asm/patch.h>
#include <asm/vendorid_list.h>
+#define CSR_TH_SXSTATUS 0x5c0
+#define SXSTATUS_MAEE _AC(0x200000, UL)
+
static bool errata_probe_mae(unsigned int stage,
unsigned long arch_id, unsigned long impid)
{
@@ -28,11 +31,14 @@ static bool errata_probe_mae(unsigned int stage,
if (arch_id != 0 || impid != 0)
return false;
- if (stage == RISCV_ALTERNATIVES_EARLY_BOOT ||
- stage == RISCV_ALTERNATIVES_MODULE)
- return true;
+ if (stage != RISCV_ALTERNATIVES_EARLY_BOOT &&
+ stage != RISCV_ALTERNATIVES_MODULE)
+ return false;
- return false;
+ if (!(csr_read(CSR_TH_SXSTATUS) & SXSTATUS_MAEE))
+ return false;
+
+ return true;
}
/*