• Kristina Martsenko's avatar
    KVM: arm/arm64: fix HYP ID map extension to 52 bits · 98732d1b
    Kristina Martsenko authored
    Commit fa2a8445 incorrectly masks the index of the HYP ID map pgd
    entry, causing a non-VHE kernel to hang during boot. This happens when
    VA_BITS=48 and the ID map text is in 52-bit physical memory. In this
    case we don't need an extra table level but need more entries in the
    top-level table, so we need to map into hyp_pgd and need to use
    __kvm_idmap_ptrs_per_pgd to mask in the extra bits. However,
    __create_hyp_mappings currently masks by PTRS_PER_PGD instead.
    
    Fix it so that we always use __kvm_idmap_ptrs_per_pgd for the HYP ID
    map. This ensures that we use the larger mask for the top-level ID map
    table when it has more entries. In all other cases, PTRS_PER_PGD is used
    as normal.
    
    Fixes: fa2a8445 ("arm64: allow ID map to be extended to 52 bits")
    Acked-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
    Signed-off-by: default avatarKristina Martsenko <kristina.martsenko@arm.com>
    Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
    98732d1b
mmu.c 52.8 KB