You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: spec/std/isa/csr/mseccfg.yaml
+89-20Lines changed: 89 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -11,15 +11,12 @@ address: 0x747
11
11
writable: true
12
12
priv_mode: M
13
13
length: MXLEN
14
-
description: Machine Security Configuration register is used for configuring various security mechanisms present on the hart and only accessible in Machine mode.
14
+
description: Machine Security Configuration register is used for configuring various security mechanisms present on the hart.
15
15
definedBy:
16
-
allOf:
17
-
- name: Sm
18
-
version: ">=1.12"
19
-
- name: Smepmp
20
-
version: ">= 1.0.0"
16
+
name: Smepmp
17
+
version: ~> 1.0.0
21
18
fields:
22
-
MML:
19
+
MMsL:
23
20
location: 0
24
21
description: |
25
22
Machine Mode Lockdown (mseccfg.MML) enforces strong isolation between Machine Mode and lower-privilege modes. This is a _sticky bit_
@@ -91,29 +88,101 @@ fields:
91
88
type: RW
92
89
definedBy: Smepmp
93
90
reset_value: UNDEFINED_LEGAL
94
-
MMWP:
95
-
location: 1
91
+
MML:
92
+
location: 0
93
+
definedBy: Smepmp
96
94
description: |
97
-
Machine Mode Whitelist Policy (mseccfg.MMWP). This is a _sticky bit_ meaning that once set, it can only be reset on PMP Reset.
95
+
Machine Mode Lockdown (mseccfg.MML) is a sticky bit, meaning that once set it cannot be unset until a PMP reset. When `mseccfg.MML` is set
96
+
the system's behavior changes in the following way:
98
97
99
-
When 1 (set), it changes the default PMP policy for M-mode when accessing memory regions that do not have a matching PMP rule, to
100
-
*denied* instead of *ignored*.
98
+
a. The meaning of `pmpcfg.L` changes: Instead of marking a rule as locked and enforced in all modes, it now marks a rule as M-mode-only
99
+
when set and S/U-mode-only when unset. The formerly reserved encoding of `pmpcfg.RW=01`, and the encoding `pmpcfg.LRWX=1111`, now encode
100
+
a Shared-Region.
101
101
102
-
When set to 0, `mseccfg.MMWP` enables the default PMP behavior in Machine mode, meaning that M-mode can access any memory region
103
-
even if it is not explicitly covered by a PMP rule.
102
+
An M-mode-only rule is enforced on Machine mode and denied in Supervisor or User mode. It also remains locked so that any further
103
+
modifications to its associated configuration or address registers are ignored until a PMP reset, unless `mseccfg.RLB` is set.
104
104
105
-
type: RW
105
+
An S/U-mode-only rule is enforced on Supervisor and User modes and denied on Machine mode.
106
+
107
+
A Shared-Region rule is enforced on all modes, with restrictions depending on the `pmpcfg.L` and `pmpcfg.X` bits:
108
+
109
+
- A Shared-Region rule where `pmpcfg.L` is not set can be used for sharing data between M-mode and S/U-mode, so is not executable. M-mode
110
+
has read/write access to that region, and S/U-mode has read access if `pmpcfg.X` is not set, or read/write access if `pmpcfg.X` is set.
111
+
112
+
- A Shared-Region rule where `pmpcfg.L` is set can be used for sharing code between M-mode and S/U-mode, so is not writable. Both M-mode and
113
+
S/U-mode have execute access on the region, and M-mode also has read access if `pmpcfg.X` is set. The rule remains locked so that any further
114
+
modifications to its associated configuration or address registers are ignored until a PMP reset, unless `mseccfg.RLB` is set.
115
+
116
+
- The encoding `pmpcfg.LRWX=1111` can be used for sharing data between M-mode and S/U mode, where both modes only have read-only access to the
117
+
region. The rule remains locked so that any further modifications to its associated configuration or address registers are ignored until a PMP
118
+
reset, unless `mseccfg.RLB` is set.
119
+
120
+
b. Adding a rule with executable privileges that either is M-mode-only or a locked Shared-Region is not possible and such pmpcfg writes are ignored,
121
+
leaving pmpcfg unchanged. This restriction can be temporarily lifted by setting `mseccfg.RLB` e.g. during the boot process.
122
+
123
+
c. Executing code with Machine mode privileges is only possible from memory regions with a matching M-mode-only rule or a locked Shared-Region rule
124
+
with executable privileges. Executing code from a region without a matching rule or with a matching S/U-mode-only rule is denied.
125
+
126
+
d. If mseccfg.MML is not set, the combination of `pmpcfg.RW=01` remains reserved for future standard use.
0 commit comments