On Tue, Jan 17 2023, Peter Maydell <peter.maydell@xxxxxxxxxx> wrote: > On Wed, 11 Jan 2023 at 16:13, Cornelia Huck <cohuck@xxxxxxxxxx> wrote: >> >> Introduce a new cpu feature flag to control MTE support. To preserve >> backwards compatibility for tcg, MTE will continue to be enabled as >> long as tag memory has been provided. >> >> If MTE has been enabled, we need to disable migration, as we do not >> yet have a way to migrate the tags as well. Therefore, MTE will stay >> off with KVM unless requested explicitly. >> >> Signed-off-by: Cornelia Huck <cohuck@xxxxxxxxxx> >> --- >> docs/system/arm/cpu-features.rst | 21 +++++ >> hw/arm/virt.c | 2 +- >> target/arm/cpu.c | 18 ++--- >> target/arm/cpu.h | 1 + >> target/arm/cpu64.c | 133 +++++++++++++++++++++++++++++++ >> target/arm/internals.h | 1 + >> target/arm/kvm64.c | 5 ++ >> target/arm/kvm_arm.h | 12 +++ >> target/arm/monitor.c | 1 + >> 9 files changed, 181 insertions(+), 13 deletions(-) >> >> diff --git a/docs/system/arm/cpu-features.rst b/docs/system/arm/cpu-features.rst >> index 00c444042ff5..e278650c837e 100644 >> --- a/docs/system/arm/cpu-features.rst >> +++ b/docs/system/arm/cpu-features.rst >> @@ -443,3 +443,24 @@ As with ``sve-default-vector-length``, if the default length is larger >> than the maximum vector length enabled, the actual vector length will >> be reduced. If this property is set to ``-1`` then the default vector >> length is set to the maximum possible length. >> + >> +MTE CPU Property >> +================ >> + >> +The ``mte`` property controls the Memory Tagging Extension. For TCG, it requires >> +presence of tag memory (which can be turned on for the ``virt`` machine via >> +``mte=on``). For KVM, it requires the ``KVM_CAP_ARM_MTE`` capability; until >> +proper migration support is implemented, enabling MTE will install a migration >> +blocker. >> + >> +If not specified explicitly via ``on`` or ``off``, MTE will be available >> +according to the following rules: >> + >> +* When TCG is used, MTE will be available iff tag memory is available; i.e. it >> + preserves the behaviour prior to introduction of the feature. >> + >> +* When KVM is used, MTE will default to off, so that migration will not >> + unintentionally be blocked. >> + >> +* Other accelerators currently don't support MTE. > > Minor nits for the documentation: > we should expand out "if and only if" -- not everybody recognizes > "iff", especially if they're not native English speakers or not > mathematicians. Ok, will change that. > > Should we write specifically that in a future QEMU version KVM > might change to defaulting to "on if available" when migration > support is implemented? I can certainly add "Future QEMU versions might change that behaviour." We should be able to add compat handling for that.