Now that the common variety of fruity arm64 systems makes a pretty remarkable KVM host, I have decided to run the collection of selftests on it. Nothing works. Oh no! As it turns out, the tests have a notion of "default mode" (40bit PA, 4kB), which cannot work in general on arm64 because there no such thing as an IPA size that would be valid everywhere (apart from the minimal 32bit), nor a guaranteed to be supported page size. This small series is a first attempt at making these things computed at runtime by making the default something else on systems that do not support it. It also makes the supported page sizes dynamically discovered, which allows us to implement support for 16kB pages. With that, the selftests do run on the M1, with the exception of the memslot tests that are freaked out by the use of 16kB pages on the host and 4kB in the guest (these tests are hardcoded to use 4kB pages even if the VM uses something else -- oh well...). * From v1: - Rebased on 5.16-rc7 and dropped the initial patch, now that non-x86 systems are up and running again - Used Andrew's trick to initialise the default mode as a constructor instead of hacking every single test (I decided to make it an arm64-special instead of an all-arch thing though) - Reworked the way TCR_EL1 gets configured for easier integration of new modes - Added support for various 16kB modes - Various cleanups as requested by Andrew Marc Zyngier (6): KVM: selftests: arm64: Initialise default guest mode at test startup time KVM: selftests: arm64: Introduce a variable default IPA size KVM: selftests: arm64: Check for supported page sizes KVM: selftests: arm64: Rework TCR_EL1 configuration KVM: selftests: arm64: Add support for VM_MODE_P36V48_{4K,64K} KVM: selftests: arm64: Add support for various modes with 16kB page size .../selftests/kvm/include/aarch64/processor.h | 3 + .../testing/selftests/kvm/include/kvm_util.h | 10 ++- .../selftests/kvm/lib/aarch64/processor.c | 82 +++++++++++++++++-- tools/testing/selftests/kvm/lib/guest_modes.c | 49 +++++++++-- tools/testing/selftests/kvm/lib/kvm_util.c | 22 +++++ 5 files changed, 152 insertions(+), 14 deletions(-) -- 2.30.2