This patch implements ARM's Enhanced Memory Tagging Extension (MTE4).
MTE4 guarantees the presence of several subfeatures:
FEAT_MTE_CANONICAL_TAGS, FEAT_MTE_TAGGED_FAR, FEAT_MTE_STORE_ONLY,
FEAT_MTE_NO_ADDRESS_TAGS, and FEAT_MTE_PERM, none of which are
currently implemented in QEMU.
According to the ARM ARM, the presence of any of these features (except
FEAT_MTE_PERM) implies the presence of all the others. For simplicity
and ease of review, I plan to introduce them one at a time. This patch
handles all features except FEAT_MTE_PERM, with the plan to introduce
FEAT_MTE_PERM in the next iteration of the patch.
Testing:
- To test this code, I used the tests included, plus modifications to
enable the EL1 control bits for the features being tested. These
features rely on EL1 control bits, which cannot be set in user-mode.
Please advise on the preferred strategy for testing EL1-dependent
behavior in user-mode tests.
The next version of this patch will include the MTE_PERM feature, since
MTE4 guarantees its existence.
Thanks,
Gabriel Brookman
Signed-off-by: Gabriel Brookman <[email protected]>
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3116
---
Changes in v2:
- Added tests for STORE_ONLY.
- Refined commit messages.
- Added FEAT_MTE_CANONICAL_TAGS and FEAT_MTE_NO_ADDRESS_TAGS + tests.
- fixed TCSO bit macro names.
- Link to v1:
https://lore.kernel.org/qemu-devel/[email protected]
---
Gabriel Brookman (10):
target/arm: explicitly disable MTE4 for max
tests/tcg: added test for MTE FAR
target/arm: add TCSO bitmasks to SCTLR
target/arm: add FEAT_MTE_STORE_ONLY logic
tests/tcg: added test for MTE write-only
target/arm: add canonical and no-address tag logic
target/arm: ldg on canonical tag loads the tag
target/arm: storing to canonical tags faults
tests/tcg: added test for MTE canonical and NAT
docs: added MTE4 features to docs
docs/system/arm/emulation.rst | 4 ++
target/arm/cpu.h | 2 +
target/arm/helper.c | 4 +-
target/arm/internals.h | 40 +++++++++++++++++
target/arm/tcg/cpu64.c | 8 ++++
target/arm/tcg/mte_helper.c | 95 ++++++++++++++++++++++++++++++++++++++-
tests/tcg/aarch64/Makefile.target | 2 +-
tests/tcg/aarch64/mte-10.c | 55 +++++++++++++++++++++++
tests/tcg/aarch64/mte-11.c | 46 +++++++++++++++++++
tests/tcg/aarch64/mte-9.c | 48 ++++++++++++++++++++
10 files changed, 299 insertions(+), 5 deletions(-)
---
base-commit: 9febfa94b69b7146582c48a868bd2330ac45037f
change-id: 20251109-feat-mte4-6740a6202e83
Best regards,
--
Gabriel Brookman <[email protected]>