• Alexandru Elisei's avatar
    KVM: arm64: Don't BUG_ON() if emulated register table is unsorted · f1f0c0cf
    Alexandru Elisei authored
    To emulate a register access, KVM uses a table of registers sorted by
    register encoding to speed up queries using binary search.
    
    When Linux boots, KVM checks that the table is sorted and uses a BUG_ON()
    statement to let the user know if it's not. The unfortunate side effect is
    that an unsorted sysreg table brings down the whole kernel, not just KVM,
    even though the rest of the kernel can function just fine without KVM. To
    make matters worse, on machines which lack a serial console, the user is
    left pondering why the machine is taking so long to boot.
    
    Improve this situation by returning an error from kvm_arch_init() if the
    sysreg tables are not in the correct order. The machine is still very much
    usable for the user, with the exception of virtualization, who can now
    easily determine what went wrong.
    
    A minor typo has also been corrected in the check_sysreg_table() function.
    Signed-off-by: default avatarAlexandru Elisei <alexandru.elisei@arm.com>
    Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
    Link: https://lore.kernel.org/r/20220428103405.70884-2-alexandru.elisei@arm.com
    f1f0c0cf
arm.c 51.5 KB