On Tue, 28 Feb 2023 at 15:02, 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 | 110 +++++++++++++++++++++++++++++++ > target/arm/internals.h | 1 + > target/arm/kvm.c | 29 ++++++++ > target/arm/kvm64.c | 5 ++ > target/arm/kvm_arm.h | 19 ++++++ > target/arm/monitor.c | 1 + > 10 files changed, 194 insertions(+), 13 deletions(-) > +static inline bool arm_machine_has_tag_memory(void) > +{ > +#ifndef CONFIG_USER_ONLY > + Object *obj = object_dynamic_cast(qdev_get_machine(), TYPE_VIRT_MACHINE); > + > + /* so far, only the virt machine has support for tag memory */ > + if (obj) { > + VirtMachineState *vms = VIRT_MACHINE(obj); > + > + return vms->mte; > + } Code inside target/arm shouldn't be fishing around inside the details of the board model like this. For TCG I think that at this point (i.e. at realize) you should be able to tell if the board has set up tag memory, because it will have set cpu->tag_memory to non-NULL. thanks -- PMM