Skip to content

Commit 1f112d1

Browse files
committed
src/mte_tag: HLV/HSV support for opt-out based on PTE.MTAG for codepage
Guest might have set PTE.MTAG for code page and thus wouldn't be expecting tag checks even if data pointer had PTE.MTAG set. On an exit to hypervisor, hypervisor emulating this load/store must do emulation similarly and thus HLVX* is updated to collect to MTAG bit in hstatus. VMTAG_FETCH and use that during HLV/HSV. Signed-off-by: Deepak Gupta <[email protected]>
1 parent a208744 commit 1f112d1

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

src/mte_tag.adoc

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -392,11 +392,14 @@ tables is ignored.
392392
[[HYPERVISOR_LDST]]
393393
=== Memory tagging and hypervisor memory accesses
394394

395-
HLVX* instructions always generate unchecked loads. HLV*/HSV* instructions in
396-
HS and HU mode may generate checked accesses depending on effective privilege
397-
of VS or VU (as defined in privileged specification). Memory accesses generated
398-
from HLV*/HSV* instructions in HU mode may generate checked accesses when
399-
`hstatus.HU` is set.
395+
HLVX* instructions always generate unchecked loads. HLVX* instructions collect
396+
MTAG bit from VS-stage page table for code page of guest instruction and spill
397+
it in `hstatus.VMTAG_FETCH`.
398+
399+
If `hstatus.VMTAG_FETCH` is set, then HLV*/HSV* instructions do not generate
400+
checked accesses. If `hstatus.VMTAG_FETCH` is clear, then HLV*/HSV* instructions
401+
in HS and HU mode may generate checked accesses depending on effective privilege
402+
of VS or VU (as defined in privileged specification).
400403

401404
`xMT_MODE` (see <<MEM_TAG_EN>>) for HLV* and HSV* instructions is defined based
402405
on the effective privilege of VS or VU (as defined in privileged specification),
@@ -605,7 +608,7 @@ When `MT_MODE` is `0b00`, the following rules apply to VS-mode:
605608
{bits: 1, name: 'GVA'},
606609
{bits: 1, name: 'SPV'},
607610
{bits: 1, name: 'SPVP'},
608-
{bits: 1, name: 'HU'},
611+
{bits: 1, name: 'VMTAG_FETCH'},
609612
{bits: 2, name: 'WPRI'},
610613
{bits: 6, name: 'VGEIN'},
611614
{bits: 2, name: 'WPRI'},
@@ -621,9 +624,12 @@ When `MT_MODE` is `0b00`, the following rules apply to VS-mode:
621624
], config:{lanes: 4, hspace:1024}}
622625
....
623626

624-
The Zimt extension adds `VUMT_MODE` (bit 51:50) to `hstatus`. When the `HU`
625-
field is set, HLV*/HSV* may generate checked accesses in HU mode. `VUMT_MODE`
626-
selects the `xMT_MODE` if effective privilege mode is VU.
627+
The Zimt extension adds `VUMT_MODE` (bit 51:50) to `hstatus`. `VUMT_MODE`
628+
selects the `xMT_MODE` if execution environment is HU mode and effective
629+
privilege mode is VU. `hstatus.VMTAG_FETCH` bit emulates `MTAG` bit for
630+
instruction fetch from code page. HSX* instruction walks VS-stage page table
631+
to fetch instruction and additionally collects `MTAG` bit and deposits in the
632+
`hstatus.VMTAG_FETCH` bit.
627633

628634
<<<
629635

0 commit comments

Comments
 (0)