riscv-software-src / riscv-software-src/opensbi

Is there RISC-V privilege specification version detection SBI call?

Open
#290 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
1.5k
Forks
712
PR merge metrics
No merged PRs in 30d

Description

Hi @avpatel
In my understanding, we use system register to check the privilege specification version.

        /* Detect if hart supports Priv v1.10 */
        val = csr_read_allowed(CSR_MCOUNTEREN, (unsigned long)&trap);
        if (!trap.cause)
                hfeatures->priv_version = SBI_HART_PRIV_VER_1_10;

        /* Detect if hart supports Priv v1.11 */
        val = csr_read_allowed(CSR_MCOUNTINHIBIT, (unsigned long)&trap);
        if (!trap.cause &&
            (hfeatures->priv_version >= SBI_HART_PRIV_VER_1_10))
                hfeatures->priv_version = SBI_HART_PRIV_VER_1_11;

        /* Detect if hart supports Priv v1.12 */
        csr_read_allowed(CSR_MENVCFG, (unsigned long)&trap);
        if (!trap.cause &&
            (hfeatures->priv_version >= SBI_HART_PRIV_VER_1_11))
                hfeatures->priv_version = SBI_HART_PRIV_VER_1_12;


But for riscv-state-enable feature, If we want to check in S-mode if it supports it, we haven't any function for this.

so maybe we need to add a new SBI call for privilege specification version detection?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the shown csr_read_allowed privilege-version detection and the linked riscv-state-enable requirement. Review how OpenSBI exposes SBI calls and whether S-mode can determine support from the existing CSR checks. Done means a decided interface or documented conclusion about whether a new privilege-version detection call is needed.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.