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
Move Smmpm and Smnpm to machine and Ssnpm to machine/supervisor/hypervisor chapter (#2494)
* Move Smnpm to machine chapter
* Move Smmpm to Machine chapter
* Move Ssnpm to supervisor chapter
* Move Ssnpm additions to H to hypervisor chapter
* Clean up the movement of extension details
@@ -190,11 +190,9 @@ Pointer masking refers to a number of separate extensions, all of which are priv
190
190
191
191
**Extensions**:
192
192
193
-
* **Ssnpm**: A supervisor-level extension that provides pointer masking for the next lower privilege mode (U-mode), and for VS- and VU-modes if the H extension is present.
194
-
* **Smnpm**: A machine-level extension that provides pointer masking for the next lower privilege mode (S/HS if S-mode is implemented, or U-mode otherwise).
195
-
* **Smmpm**: A machine-level extension that provides pointer masking for M-mode.
196
-
197
-
See <<_isa_extensions>> for details on how each of these extensions is configured.
193
+
* **Ssnpm**: A supervisor-level extension that provides pointer masking for the next lower privilege mode (U-mode), and for VS- and VU-modes if the H extension is present. See <<sec:senvcfg>>, <<sec:henvcfg>>, <<sec:hstatus>>, and <<pm-two-stage>>.
194
+
* **Smnpm**: A machine-level extension that provides pointer masking for the next lower privilege mode (S/HS if S-mode is implemented, or U-mode otherwise). See <<sec:menvcfg>>.
195
+
* **Smmpm**: A machine-level extension that provides pointer masking for M-mode. See <<sec:mseccfg>>.
198
196
199
197
In addition, the pointer masking standard defines two extensions that describe an execution environment but have no bearing on hardware implementations. These extensions are intended to be used in profile specifications where a User profile or a Supervisor profile can only reference User level or Supervisor level pointer masking functionality, and not the associated CSR controls that exist at a higher privilege level (i.e., in the execution environment).
200
198
@@ -203,95 +201,18 @@ In addition, the pointer masking standard defines two extensions that describe a
203
201
204
202
The precise nature of these facilities is left to the respective execution environment.
205
203
206
-
Pointer masking only applies to RV64. In RV32, trying to enable pointer masking will result in an illegal WARL write and not update the pointer masking configuration bits (see <<_isa_extensions>> for details). The same is the case on RV64 or larger systems when UXL/SXL/MXL is set to 1 for the corresponding privilege mode. Note that in RV32, the CSR bits introduced by pointer masking are still present, for compatibility between RV32 and larger systems with UXL/SXL/MXL set to 1. Setting UXL/SXL/MXL to 1 will clear the corresponding pointer masking configuration bits.
204
+
Pointer masking only applies to RV64. In RV32, trying to enable pointer masking will result in an illegal WARL write and not update the pointer masking configuration bits (see <<sec:mseccfg>>, <<sec:menvcfg>>, <<sec:henvcfg>>, and <<sec:senvcfg>> for details). The same is the case on RV64 or larger systems when UXL/SXL/MXL is set to 1 for the corresponding privilege mode. Note that in RV32, the CSR bits introduced by pointer masking are still present, for compatibility between RV32 and larger systems with UXL/SXL/MXL set to 1. Setting UXL/SXL/MXL to 1 will clear the corresponding pointer masking configuration bits.
207
205
208
206
[NOTE]
209
207
====
210
208
Note that setting UXL/SXL/MXL to 1 and back to 0 does not preserve the previous values of the PMM bits. This includes the case of entering an RV32 virtual machine from an RV64 hypervisor and returning.
211
209
====
212
210
213
-
=== ISA Extensions
214
-
215
-
This section describes the pointer masking extensions `Smmpm`, `Smnpm` and `Ssnpm`. All of these extensions are privileged ISA extensions and do not add any new CSRs. For the definitions of `Sspm` and `Supm`, see <<_pointer_masking_extensions>>.
216
-
217
211
[NOTE]
218
212
====
219
213
Future extensions may introduce additional CSRs to allow different privilege modes to modify their own pointer masking settings. This may be required for future use cases in managed runtime systems that are not currently addressed as part of this extension.
220
214
====
221
215
222
-
Each extension introduces a 2-bit WARL field (`PMM`) that may take on the following values to set the pointer masking settings for a particular privilege mode.
223
-
224
-
[[pmm-values]]
225
-
226
-
[%header, cols="25%,75%", options="header"]
227
-
.Possible values of `PMM` WARL field.
228
-
|===
229
-
|Value|Description
230
-
|00|Pointer masking is disabled (PMLEN=0)
231
-
|01|Reserved
232
-
|10|Pointer masking is enabled with PMLEN=XLEN-57 (PMLEN=7 on RV64)
233
-
|11|Pointer masking is enabled with PMLEN=XLEN-48 (PMLEN=16 on RV64)
234
-
|===
235
-
236
-
All of these fields are read-only 0 on RV32 systems.
237
-
238
-
==== Ssnpm
239
-
240
-
`Ssnpm` adds a new 2-bit WARL field (`PMM`) to bits 33:32 of `senvcfg`. Setting `PMM` enables or disables pointer masking for the next lower privilege mode (U/VU mode), according to the values in <<pmm-values>>.
241
-
242
-
In systems where the H Extension is present, `Ssnpm` also adds a new 2-bit WARL field (`PMM`) to bits 33:32 of `henvcfg`. Setting `PMM` enables or disables pointer masking for VS-mode, according to the values in <<pmm-values>>. Further, a 2-bit WARL field (`HUPMM`) is added to bits 49:48 of `hstatus`. Setting `hstatus.HUPMM` enables or disables pointer masking for `HLV.\*` and `HSV.*` instructions in U-mode, according to the values in <<pmm-values>>, when their explicit memory access is performed as though in VU-mode. In HS- and M-modes, pointer masking for these instructions is enabled or disabled by `senvcfg.PMM`, when their explicit memory access is performed as though in VU-mode. Setting `henvcfg.PMM` enables or disables pointer masking for `HLV.\*` and `HSV.*` when their explicit memory access is performed as though in VS-mode.
243
-
244
-
[NOTE]
245
-
====
246
-
The hypervisor should copy the value written to `senvcfg.PMM` by the guest to the `hstatus.HUPMM` field prior to invoking `HLV.\*` or `HSV.*` instructions in U-mode.
247
-
====
248
-
249
-
The memory accesses performed by the `HLVX.*` instructions are not subject to pointer masking.
250
-
251
-
[NOTE]
252
-
====
253
-
`HLVX.*` instructions, designed for emulating implicit access to fetch instructions from guest memory, perform memory accesses that are exempt from pointer masking to facilitate this emulation. For the same reason, pointer masking does not apply when MXR is set.
254
-
====
255
-
256
-
==== Smnpm
257
-
258
-
`Smnpm` adds a new 2-bit WARL field (`PMM`) to bits 33:32 of `menvcfg`. Setting `PMM` enables or disables pointer masking for the next lower privilege mode (S-/HS-mode if S-mode is implemented, or U-mode otherwise), according to the values in <<pmm-values>>.
259
-
260
-
[NOTE]
261
-
====
262
-
The type of address determines which type of pointer masking is applied. For example, when running with virtualization in VS/VU mode with `vsatp.MODE` = Bare, physical address pointer masking (zero extension) applies.
263
-
====
264
-
265
-
==== Smmpm
266
-
267
-
`Smmpm` adds a new 2-bit WARL field (`PMM`) to bits 33:32 of `mseccfg`. The presence of `Smmpm` implies the presence of the `mseccfg` register, even if it would not otherwise be present. Setting `PMM` enables or disables pointer masking for M mode, according to the values in <<pmm-values>>.
268
-
269
-
==== Interaction with SFENCE.VMA
270
-
271
-
Since pointer masking applies to the effective address only and does not affect any memory-management data structures, no SFENCE.VMA is required after enabling/disabling pointer masking.
272
-
273
-
==== Interaction with Two-Stage Address Translation
274
-
275
-
Guest physical addresses (GPAs) are 2 bits wider than the corresponding virtual address translation modes, resulting in additional address translation schemes Sv32x4, Sv39x4, Sv48x4, and Sv57x4 for translating guest physical addresses to supervisor physical addresses. When running with virtualization in VS/VU mode with `vsatp.MODE` = Bare, this means that those two bits may be subject to pointer masking, depending on `hgatp.MODE` and `senvcfg.PMM`/`henvcfg.PMM` (for VU/VS mode). If `vsatp.MODE` != BARE, this issue does *not* apply.
276
-
277
-
[NOTE]
278
-
====
279
-
An implementation could mask those two bits on the TLB access path, but this can have a significant timing impact. Alternatively, an implementation may choose to "waste" TLB capacity by having up to 4 duplicate entries for each page. In this case, the pointer masking operation can be applied on the TLB refill path, where it is unlikely to affect timing. To support this approach, some TLB entries need to be flushed when PMLEN changes in a way that may affect these duplicate entries.
280
-
====
281
-
282
-
To support implementations where (XLEN-PMLEN) can be less than the GPA width supported by `hgatp.MODE`, hypervisors should execute an `HFENCE.GVMA` with _rs1_=`x0` if the `henvcfg.PMM` is changed from or to a value where (XLEN-PMLEN) is less than GPA width supported by the `hgatp` translation mode of that guest. Specifically, these cases are:
283
-
284
-
* `PMLEN=7` and `hgatp.MODE=sv57x4`
285
-
* `PMLEN=16` and `hgatp.MODE=sv57x4`
286
-
* `PMLEN=16` and `hgatp.MODE=sv48x4`
287
-
288
-
[NOTE]
289
-
====
290
-
`Smmpm` implementations need to satisfy max(largest supported virtual address size, largest supported supervisor physical address size) <= (XLEN - PMLEN) bits to avoid any masking logic on the TLB access path.
291
-
====
292
-
293
-
Implementation of an address-specific `HFENCE.GVMA` should either ignore the address argument, or should ignore the top masked GPA bits of entries when comparing for an address match.
294
-
295
216
==== Number of Masked Bits
296
217
297
218
As described in <<_determining_the_value_of_pmlen>>, the supported values of PMLEN may depend on the effective privilege mode. The current standard only defines PMLEN=XLEN-48 and PMLEN=XLEN-57, but this assumption may be relaxed in future extensions and profiles. Trying to enable pointer masking in an unsupported scenario represents an illegal write to the corresponding pointer masking enable bit and follows WARL semantics. Future profiles may choose to define certain combinations of privilege modes and supported values of PMLEN as mandatory.
0 commit comments