On Thu, Mar 02 2023, Peter Maydell <peter.maydell@xxxxxxxxxx> wrote: > On Thu, 2 Mar 2023 at 14:29, Cornelia Huck <cohuck@xxxxxxxxxx> wrote: >> >> On Thu, Mar 02 2023, Peter Maydell <peter.maydell@xxxxxxxxxx> wrote: >> > I think having MTE in the specific case of KVM behave differently >> > to how we've done all these existing properties and how we've >> > done MTE for TCG would be confusing. The simplest thing is to just >> > follow the existing UI for TCG MTE. >> > >> > The underlying reason for this is that MTE in general is not a feature >> > only of the CPU, but also of the whole system design. It happens >> > that KVM gives us tagged RAM "for free" but that's an oddity >> > of the KVM implementation -- in real hardware there needs to >> > be system level support for tagging. >> >> Hm... the Linux kernel actually seems to consider MTE to be a cpu >> feature (at least, it lists it in the cpu features). >> >> So, is your suggestion to use the 'mte' prop of the virt machine to mean >> "enable all prereqs for MTE, i.e. allocate tag memory for TCG and enable >> MTE in the kernel for KVM"? For TCG, we'll get MTE for the max cpu >> model; for KVM, we'd get MTE for host (== max), but I'm wondering what >> should happen if we get named cpu models and the user specifies one >> where we won't have MTE (i.e. some pre-8.5 one)? > > I think we can probably cross that bridge when we get to it, > but I imagine the semantics would be "cortex-foo plus MTE" > (in the same way that -cpu cortex-foo,+x,-y can add and > subtract features from a baseline). I'm wondering how we should try to model this, given that cpu_model_advertised_features is a bit of a weird mix of architecture flags and implementation-specific knobs. Given that there are some KVM patchsets floating around to allow userspace to limit some features for migration compat handling, I don't think it will be too long before we'll try to figure out how to do cpu models for KVM in QEMU as well...