On Tue, Jan 17 2023, "Dr. David Alan Gilbert" <dgilbert@xxxxxxxxxx> wrote: > * 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. >> >> Should we write specifically that in a future QEMU version KVM >> might change to defaulting to "on if available" when migration >> support is implemented? > > Please make sure if you do something like that, that the failure > is obious; 'on if available' gets messy for things like libvirt > and higher level tools detecting features that are available and > machines they can migrate to. I guess we can just keep the door open but decline walking through it if we fail to come up with a good solution...