Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Type of exception for write access to read-only scounovf from VS/VU-modes via Ssccfg #8

Open
oolegoon opened this issue Aug 7, 2024 · 3 comments

Comments

@oolegoon
Copy link

oolegoon commented Aug 7, 2024

According to the H extension of the Privileged ISA, write access to a read-only register from VS/VU mode causes an illegal instruction exception according to the rules of the HS-qualified instruction.

Ssccfg is based on Sscsrind, which states that this rule does not apply and exceptions on access are determined by the spec for which the window is used.

For alias CSRs sireg* and vsireg*, the hypervisor extension’s usual rules for when to raise a virtual
instruction exception (based on whether an instruction is HS-qualified) are not applicable. The
rules given in this section for sireg and vsireg apply instead, unless overridden by the
requirements specified in the section below, which take precedence over this section when
extension Smstateen is also implemented.

The Ssccfg spec says that access to scountovf generates a virtual instruction exception.

For implementations that support Smcdeleg/Ssccfg, Sscofpmf, and the H extension, when
menvcfg.CDE=1, attempts to access scountovf from VS-mode or VU-mode raise a virtual instruction
exception.

Could you please clarify: does both read and write access generate a virtual instruction exception?

On the one hand, the behavior is described quite clearly, on the other hand, the dualism in terms of different types of exceptions for writing to read-only from VS/VU-modes is a bit confusing.

@bcstrongx
Copy link
Collaborator

Good catch, I think this may be an oversight. Certainly reads of scountovf from VS/VU-mode should raise virtual-instruction exceptions. Writes should probably raise an illegal instruction exception, as normal. However, this spec is ratified, so let me check with ARC.

@bcstrongx
Copy link
Collaborator

We are hoping to fix the spec, see https://lists.riscv.org/g/tech-privileged/message/2094.

@oolegoon
Copy link
Author

Thanks for clarification!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants