This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] RME MEC instructions and system registers
ClosedPublic

Authored by keith.walker.arm on Nov 4 2022, 8:27 AM.

Details

Summary

This patch adds assembler/disassembler support for
RME MEC (Memory Encryption Contexts).

Cache maintence instructions added:

  • DC CIPAPA
  • DC CIGDPAPA

System registers added:

  • MECIDR_EL2
  • MECID_P0_EL2
  • MECID_A0_EL2
  • MECID_P1_EL2
  • MECID_A1_EL2
  • VMECID_P_EL2
  • VMECID_A_EL2
  • MECID_RL_A_EL3

Memory Encryption Contexts were announced in

https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/arm-a-profile-architecture-2022

The instruction encodings for the MEC feature is available at

https://developer.arm.com/documentation/ddi0602/2022-09/Base-Instructions/DC--Data-Cache-operation--an-alias-of-SYS-?lang=en

The system register encodings available at

https://developer.arm.com/documentation/ddi0601/2022-09/AArch64-Registers?lang=en

Based on patches by Son Tuan Vu

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptNov 4 2022, 8:27 AM
keith.walker.arm requested review of this revision.Nov 4 2022, 8:27 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 4 2022, 8:27 AM
keith.walker.arm edited reviewers, added: dmgreen; removed: dmgaust.Nov 4 2022, 8:31 AM
lenary added a subscriber: lenary.Nov 8 2022, 3:59 AM

Sorry, a quick drive-by comment. I'll try to get back to this to do a fuller review on Wednesday.

llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
3500

This should not be included. These names are supposed to be the same as command-line extension options, which MEC doesn't have.

At the very least, it's also untested, but I think it should be removed, not tested.

llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
3500

So I assume we want uses of MEC to be gated on the use of AArch64::FeatureRME instead.

lenary added inline comments.Nov 8 2022, 7:37 AM
llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
3500

Not quite. This array is only for allowing .arch_extension <string> to enable specific features, which is part of the public interface, and we don't want if there's not a corresponding extension for -march=<version>+<string>

FeatureMEC in AArch64.td should remain.

llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
3500

The reason I asked is because removing just this line causes the tests to fail with an errors like:

error: DC CIGDPAE requires: (unknown)

and

error: expected writable system register or pstate

So it looks to me like this line is required.

lenary added inline comments.Nov 8 2022, 10:24 AM
llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
3500

Ah, my mistake. This is annoying it's used for both, but for this patch leave this in.

lenary accepted this revision.Nov 10 2022, 5:41 AM

Cool, did a more in-depth review against the specification. LGTM!

This revision is now accepted and ready to land.Nov 10 2022, 5:41 AM