Message ID | 20250209033233.53853-1-j@getutm.app (mailing list archive) |
---|---|
Headers | show |
Series | hvf: use TCG emulation to handle data aborts | expand |
On Sun, 9 Feb 2025 at 03:33, Joelle van Dyne <j@getutm.app> wrote: > > When the VM exits with an data abort, we check the ISV field in the ESR and when > ISV=1, that means the processor has filled the remaining fields with information > needed to determine the access that caused the abort: address, access width, and > the register operand. However, only a limited set of instructions which can > cause a data abort is nice enough for the processor to decode this way. Many > instructions such as LDP/STP and SIMD can cause an data abort with ISV=0 and for > that the hypervisor needs to manually decode the instruction, find the operands, > and emulate the access. > > QEMU already ships with the ability to do this: TCG. However, TCG currently > operates as a stand-alone accelerator. This patch set enables HVF to call into > TCG when needed in order to perform a memory access that caused the abort. So one problem with this is that it immediately puts all of TCG onto the security boundary with the VM. We don't claim any kind of security or can't-escape guarantees for TCG, and it's a lot of code, some of which is old and some of which wasn't written with security as a top-of-mind concern. Our approach to these instructions with KVM on Arm is to say "don't do those in the guest to MMIO regions". Most sensible guest code doesn't do weird instruction forms for device accesses, and the performance is going to be bad anyway if you need to fully emulate them. (This includes in the past that Windows got fixed to not do this kind of insn to a device in at least one case.) > One thing this enables is the ability to use virtio-vga with Windows for ARM64. > Currently, graphics support for Windows is flakey because you must first boot > with ramfb to get to the desktop where you can then install the virtio-gpu > drivers and then start up with virtio-gpu. Even then, there is a known issue > where Windows mistakingly thinks there are two monitors connected because the > boot display does not share a framebuffer with the GPU. This results in > sometimes a black screen when updating Windows. It's not really a good idea to use virtio-vga in an Arm VM, because it requires FEAT_S2FWB in the host CPU to make it work properly, and not every CPU has that, at least in the KVM world. So you need to use virtio-gpu anyhow. thanks -- PMM