Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] no Spike configuration to disable S-mode [compliance, csr and tests-p failing on master] #1599

Closed
1 task done
cathales opened this issue Nov 6, 2023 · 8 comments
Closed
1 task done
Assignees
Labels
Component:SpikeTandem Issue that impacts Spike Tandem operation Component:Tool-and-build For issues in the tool and build flow (e.g. Makefile, FuseSoc, etc.) PARAM:CSR CSR Status:New Newly created issue, nobody has looked at it yet. Type:Bug For bugs in the RTL, Documentation, Verification environment or Tool and Build system

Comments

@cathales
Copy link
Contributor

cathales commented Nov 6, 2023

Is there an existing CVA6 bug for this?

  • I have searched the existing bug issues

Bug Description

master branch has 3 failing tests since 4b67475:

  • compliance (regress)
  • tests-p (regress)
  • csr (verif)

These three jobs pass on the direct parent commit 53d3880

So #1574 revealed issues with these tests, and the CI is red since.

@cathales cathales added the Type:Bug For bugs in the RTL, Documentation, Verification environment or Tool and Build system label Nov 6, 2023
@cathales cathales added Component:Verif For issues in the verification environment or test cases (e.g. for testbench, C code, etc.) Status:New Newly created issue, nobody has looked at it yet. labels Nov 6, 2023
@ASintzoff
Copy link
Contributor

@AEzzejjari could you take a look at this issue (related to condition on S-mode)?

@ASintzoff ASintzoff removed their assignment Nov 8, 2023
@ASintzoff ASintzoff added Component:RTL For issues in the RTL (e.g. for files in the rtl directory) and removed Component:Verif For issues in the verification environment or test cases (e.g. for testbench, C code, etc.) labels Nov 8, 2023
@AEzzejjari
Copy link
Member

This bug is caused by Spike, which supports supervisor mode unlike the embedded version of cva6. Therefore, we need to modify Spike's configuration to disable SMODE and trigger an exception when accessing a supervisor mode register, as cva6 did.

@ASintzoff ASintzoff changed the title [BUG] compliance, csr and tests-p failing on master [BUG] no Spike configuration to disable S-mode [compliance, csr and tests-p failing on master] Nov 14, 2023
@ASintzoff ASintzoff added Component:Tool-and-build For issues in the tool and build flow (e.g. Makefile, FuseSoc, etc.) and removed Component:RTL For issues in the RTL (e.g. for files in the rtl directory) labels Nov 14, 2023
@zarubaf
Copy link
Contributor

zarubaf commented Nov 20, 2023

I think you need to disable S mode in spike. If you ./configure you can run:

  --with-isa=RV64IMAFDC_zicntr_zihpm
                          Sets the default RISC-V ISA
  --with-priv=MSU         Sets the default RISC-V privilege modes supported

Maybe --with-priv=M could do it?

@ASintzoff
Copy link
Contributor

I would suggest to use the option --priv=<m|mu|msu> RISC-V privilege modes supported [default MSU] when executing spike. This will avoid building multiple spike executables.

@MarioOpenHWGroup
Copy link
Contributor

There is a bug in current spike implementation that does not let to change priv with the param, I am working on fixing it.

@MikeOpenHWGroup MikeOpenHWGroup added the Component:SpikeTandem Issue that impacts Spike Tandem operation label Nov 23, 2023
@zchamski
Copy link
Contributor

There's another potential issue with Spike: at first analysis, the Spike model instantiates all CSRs from the RISC-V specs no matter what restrictions are imposed on the current privilege set. This means that there is no way to "remove" (mark as "inexistent") the CSRs of a temporarily unsupported privilege level. E.g., with the privilege set restricted to Machine only (--priv=M), the sstatus CSR will still be present and usable from machine mode.

@zchamski
Copy link
Contributor

zchamski commented Dec 12, 2023

Chapter 3 of The Privileged Spec V20211203 says:

The RISC-V machine-level ISA contains a common core that is extended depending on which other privilege levels are supported and other details of the hardware implementation.

The next paragraph (start of Section 3.1) states that;

In addition to the machine-level CSRs described in this section, M-mode code can access all CSRs at lower privilege levels.

According to the first quoted text, if no privilege levels lower than M-mode are supported and the hardware implementation decides so, the CSRs at lower privilege levels can be omitted (and treated as non-existent).

@MarioOpenHWGroup
Copy link
Contributor

Already solved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component:SpikeTandem Issue that impacts Spike Tandem operation Component:Tool-and-build For issues in the tool and build flow (e.g. Makefile, FuseSoc, etc.) PARAM:CSR CSR Status:New Newly created issue, nobody has looked at it yet. Type:Bug For bugs in the RTL, Documentation, Verification environment or Tool and Build system
Projects
None yet
Development

No branches or pull requests

8 participants