Skip to content

Commit 06ce13a

Browse files
authored
clarification on entropy source accesss in vs/vu modes
Merge pull request #141 from mjosaarinen/master
2 parents ecfaa03 + f80e52c commit 06ce13a

File tree

1 file changed

+30
-23
lines changed

1 file changed

+30
-23
lines changed

doc/scalar/riscv-crypto-scalar-entropy-source.adoc

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -246,16 +246,18 @@ The `seed` CSR is by default only available in M mode, but can be made
246246
available to other modes via the `mseccfg.sseed` and `mseccfg.useed`
247247
access control bits. `sseed` is bit `9` of and `useed` is
248248
bit `8` of the `mseccfg` CSR.
249-
Without the corresponding access control bit set to 1, an attempted
250-
read/write access to `seed` from U, S, or HS modes will raise an
251-
illegal instruction Exception.
252-
253-
Attempted access to `seed` from virtual modes VS and VU always raises an
254-
exception; a read-only instruction causes an illegal instruction Exception,
255-
while a read-write instruction (that can potentially be emulated) causes
256-
a virtual instruction Exception. Note that HS, VS, and VU modes are
257-
present in systems with Hypervisor (H) extension implemented. If desired,
258-
a hypervisor can emulate accesses to the seed CSR from a virtual machine.
249+
Without the corresponding access control bit set to 1, any attempted
250+
access to `seed` from U, S, or HS modes will raise an illegal instruction
251+
exception.
252+
253+
VS and VU modes are present in systems with Hypervisor (H) extension
254+
implemented. If desired, a hypervisor can emulate accesses to the seed CSR
255+
from a virtual machine. Attempted access to `seed` from virtual modes
256+
VS and VU always raises an exception; a read-only instruction causes an
257+
illegal instruction exception, while a read-write instruction (that can
258+
potentially be emulated) causes a virtual instruction exception only if
259+
`mseccfg.sseed=1`. Note that `mseccfg.useed` has no effect on the exception
260+
type for either VS or VU modes.
259261

260262
.Entropy Source Access Control.
261263

@@ -268,38 +270,43 @@ a hypervisor can emulate accesses to the seed CSR from a virtual machine.
268270
| `*`
269271
| The `seed` CSR is always available in machine mode as normal (with a
270272
CSR read-write instruction.) Attempted read without a write raises an
271-
illegal instruction Exception regardless of mode and access control bits.
273+
illegal instruction exception regardless of mode and access control bits.
272274

273-
| VS/VU
275+
| U
274276
| `*`
277+
| `0`
278+
| Any `seed` CSR access raises an illegal instruction exception.
279+
280+
| U
275281
| `*`
276-
| The `seed` CSR is never directly available from virtual (VS or VU)
277-
modes. A read-write instruction causes a virtual instruction Exception
278-
(while a read-only instruction always causes an illegal instruction Exception.)
282+
| `1`
283+
| The `seed` CSR is accessible as normal. No exception is raised for read-write.
279284

280285
| S/HS
281286
| `0`
282287
| `*`
283-
| Any `seed` CSR access raises an illegal instruction Exception.
288+
| Any `seed` CSR access raises an illegal instruction exception.
289+
284290

285291
| S/HS
286292
| `1`
287293
| `*`
288294
| The `seed` CSR is accessible as normal. No exception is raised for read-write.
289295

290-
| U
291-
| `*`
296+
| VS/VU
292297
| `0`
293-
| Any `seed` CSR access raises an illegal instruction Exception.
294-
295-
| U
296298
| `*`
297-
| `1`
298-
| The `seed` CSR is accessible as normal. No exception is raised for read-write.
299+
| Any `seed` CSR access raises an illegal instruction exception.
299300

301+
| VS/VU
302+
| `1`
303+
| `*`
304+
| A read-write `seed` access raises a virtual instruction exception,
305+
while other access conditions raise an illegal instruction exception.
300306

301307
|=======================================================================
302308

309+
303310
Systems should implement carefully considered access control policies from
304311
lower privilege modes to physical entropy sources. The system can trap
305312
attempted access to `seed` and feed a less privileged client

0 commit comments

Comments
 (0)