riscv-software-src/opensbi

Detect extensions from $menvcfg

Opened this issue · 2 comments

Hi @avpatel,

Currently "Boot HART ISA Extensions" only shows extensions which can be detected by test and set their CSR. Maybe we can detect more extensions from $menvcfg?

static int hart_detect_features(struct sbi_scratch *scratch)
{
    ...
    if (hfeatures->priv_version >= SBI_HART_PRIV_VER_1_12) {
        csr_write(CSR_MENVCFG, ~0);
        csr_read(CSR_MENVCFG, menvcfg_val);

        if (menvcfg_val | ENVCFG_CBZE)
            __sbi_hart_update_extension(hfeatures,
					SBI_HART_EXT_ZICBOZ, true);
        ...
    }
    ...
}

Generally, we should move away from WARL based detection mechanism as it will be unmanageable in the future with more number of extensions.

Hi @atishp04,
Thank you!
OpenSBI can detect extensions from the ISA string since d72f5f1. It appears that we can consider removing all extension detection within hart_detect_features()?