lib: sbi: Fix AIA feature detection

The AIA feature detection uses unnecessary goto which is not need
and AIA case in sbi_hart_feature_id2string() does not break. This
patch fixes both issues in AIA feature detection.

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Reviewed-by: Atish Patra <atishp@rivosinc.com>
This commit is contained in:
Anup Patel
2022-04-28 19:35:39 +05:30
committed by Anup Patel
parent 97a17c2e5c
commit a6ab94fdbf

View File

@@ -408,6 +408,7 @@ static inline char *sbi_hart_feature_id2string(unsigned long feature)
break; break;
case SBI_HART_HAS_AIA: case SBI_HART_HAS_AIA:
fstr = "aia"; fstr = "aia";
break;
case SBI_HART_HAS_SSTC: case SBI_HART_HAS_SSTC:
fstr = "sstc"; fstr = "sstc";
break; break;
@@ -632,10 +633,8 @@ __mhpm_skip:
/* Detect if hart has AIA local interrupt CSRs */ /* Detect if hart has AIA local interrupt CSRs */
csr_read_allowed(CSR_MTOPI, (unsigned long)&trap); csr_read_allowed(CSR_MTOPI, (unsigned long)&trap);
if (trap.cause) if (!trap.cause)
goto __aia_skip; hfeatures->features |= SBI_HART_HAS_AIA;
hfeatures->features |= SBI_HART_HAS_AIA;
__aia_skip:
/* Detect if hart supports stimecmp CSR(Sstc extension) */ /* Detect if hart supports stimecmp CSR(Sstc extension) */
if (hfeatures->priv_version >= SBI_HART_PRIV_VER_1_12) { if (hfeatures->priv_version >= SBI_HART_PRIV_VER_1_12) {