On 8 November 2018 at 14:28, Alex Bennée <alex.bennee@xxxxxxxxxx> wrote: > > Mark Rutland <mark.rutland@xxxxxxx> writes: >> One problem is that I couldn't spot when we advance the PC for an MMIO >> trap. I presume we do that in the kernel, *after* the MMIO trap, but I >> can't see where that happens. > > Nope it gets done before during decode_hsr in mmio.c: > > /* > * The MMIO instruction is emulated and should not be re-executed > * in the guest. > */ > kvm_skip_instr(vcpu, kvm_vcpu_trap_il_is32bit(vcpu)); I think that this attempt to do the PC-advance early is probably an underlying problem that is not helping the code structure here. An enhancement that's been floated previously is that the MMIO emulation in userspace should be able to report back to KVM "nope, that access should generate a guest synchronous external abort (with ESR_EL1.EA = 0/1)". If we have that, then we definitely need to not advance the PC until after userspace has done the emulation and told us whether the memory access succeeded or not... thanks -- PMM