On Tue, Dec 03, 2024 at 07:02:36PM +0000, Marc Zyngier wrote: > Catalin reports that a hypervisor lying to a guest about the size > of the ASID field may result in unexpected issues: > > - if the underlying HW does only supports 8 bit ASIDs, the ASID > field in a TLBI VAE1* operation is only 8 bits, and the HW will > ignore the other 8 bits > > - if on the contrary the HW is 16 bit capable, the ASID field > in the same TLBI operation is always 16 bits, irrespective of > the value of TCR_ELx.AS. > > This could lead to missed invalidations if the guest was lead to > assume that the HW had 8 bit ASIDs while they really are 16 bit wide. > > In order to avoid any potential disaster that would be hard to debug, > prenent the migration between a host with 8 bit ASIDs to one with > wider ASIDs (the converse was obviously always forbidden). This is > also consistent with what we already do for VMIDs. > > If it becomes absolutely mandatory to support such a migration path > in the future, we will have to trap and emulate all TLBIs, something > that nobody should look forward to. > > Fixes: d5a32b60dc18 ("KVM: arm64: Allow userspace to change ID_AA64MMFR{0-2}_EL1") > Reported-by: Catalin Marinas <catalin.marinas@xxxxxxx> > Signed-off-by: Marc Zyngier <maz@xxxxxxxxxx> > Cc: stable@xxxxxxxxxxxxxxx > Cc: Will Deacon <will@xxxxxxxxxx> > Cc: Mark Rutland <mark.rutland@xxxxxxx> > Cc: Marc Zyngier <maz@xxxxxxxxxx> > Cc: James Morse <james.morse@xxxxxxx> > Cc: Oliver Upton <oliver.upton@xxxxxxxxx> Acked-by: Catalin Marinas <catalin.marinas@xxxxxxx>