Hi All,
This series adds bare minimum required to support kvm virtual machines. The majority of changes make sure that executing Morello instructions by the hypervisor/guest is safe and that core capability registers are properly set and maintained across context switches. Additionally, support for COMPAT64 allows plain aarch64 tools to still manage virtual machines. Support for purecap guests is yet to come.
The changes have been tested with KVM kselftests (in plain aarch64) in their default setup (some of the tests do expose number of options and those have not been fully exercised).
The changes are available at: https://git.morello-project.org/Bea/linux/-/tree/morello/kvm_base_2?ref_type...
Beata Michalska (12): KVM: arm64: Provide explicit capability annotations KVM: arm64: morello: Add (V)TCR_EL2 HW field descriptors KVM: arm64: morello: Enable page-based hw attributes arm64/sysreg: morello: Support for capability registers arm64/sysreg: morello: Add capability-aware sysreg helpers KVM: arm64: morello: Add sysreg access capability variants KVM: arm64: morello: Extend the context by capability sysregs KVM: arm64: morello: Provide valid capability on return from exception KVM: arm64: morello: Disable trapping of Morello instructions KVM: arm64: morello: Preserve capabilities on context save / restore KVM: arm64: morello: Enable support for COMPAT64 KVM: arm64: morello: Enable KVM
Documentation/virt/kvm/api.rst | 10 +- arch/arm64/include/asm/kvm_arm.h | 12 ++ arch/arm64/include/asm/kvm_asm.h | 108 ++++++++++- arch/arm64/include/asm/kvm_emulate.h | 5 + arch/arm64/include/asm/kvm_host.h | 38 ++++ arch/arm64/include/asm/kvm_hyp.h | 74 ++++++-- arch/arm64/include/asm/kvm_pgtable.h | 20 ++ arch/arm64/include/asm/sysreg.h | 83 +++++++++ arch/arm64/include/uapi/asm/kvm.h | 6 +- arch/arm64/kernel/asm-offsets.c | 3 + arch/arm64/kernel/hyp-stub.S | 5 + arch/arm64/kvm/Kconfig | 1 - arch/arm64/kvm/arch_timer.c | 4 +- arch/arm64/kvm/arm.c | 207 ++++++++++++++------- arch/arm64/kvm/guest.c | 10 +- arch/arm64/kvm/hyp/entry.S | 12 +- arch/arm64/kvm/hyp/include/hyp/switch.h | 4 +- arch/arm64/kvm/hyp/include/hyp/sysreg-sr.h | 58 +++++- arch/arm64/kvm/hyp/nvhe/host.S | 66 ++++++- arch/arm64/kvm/hyp/nvhe/hyp-init.S | 14 ++ arch/arm64/kvm/hyp/nvhe/switch.c | 9 +- arch/arm64/kvm/hyp/nvhe/sys_regs.c | 4 +- arch/arm64/kvm/hyp/pgtable.c | 10 +- arch/arm64/kvm/hyp/vhe/switch.c | 11 +- arch/arm64/kvm/hypercalls.c | 4 +- arch/arm64/kvm/pmu-emul.c | 8 +- arch/arm64/kvm/sys_regs.c | 21 ++- arch/arm64/kvm/vgic/vgic-its.c | 8 +- arch/arm64/kvm/vgic/vgic-kvm-device.c | 11 +- include/linux/kvm_host.h | 8 +- include/uapi/linux/kvm.h | 10 +- tools/arch/arm64/include/uapi/asm/kvm.h | 6 +- tools/include/uapi/linux/kvm.h | 12 +- virt/kvm/Kconfig | 2 +- virt/kvm/kvm_main.c | 99 +++++++--- virt/kvm/vfio.c | 2 +- 36 files changed, 776 insertions(+), 189 deletions(-)