• Quentin Perret's avatar
    KVM: arm64: Enable forcing page-level stage-2 mappings · 56513119
    Quentin Perret authored
    Much of the stage-2 manipulation logic relies on being able to destroy
    block mappings if e.g. installing a smaller mapping in the range. The
    rationale for this behaviour is that stage-2 mappings can always be
    re-created lazily. However, this gets more complicated when the stage-2
    page-table is used to store metadata about the underlying pages. In such
    cases, destroying a block mapping may lead to losing part of the state,
    and confuse the user of those metadata (such as the hypervisor in nVHE
    protected mode).
    
    To avoid this, introduce a callback function in the pgtable struct which
    is called during all map operations to determine whether the mappings
    can use blocks, or should be forced to page granularity. This is used by
    the hypervisor when creating the host stage-2 to force page-level
    mappings when using non-default protection attributes.
    Signed-off-by: default avatarQuentin Perret <qperret@google.com>
    Reviewed-by: default avatarFuad Tabba <tabba@google.com>
    Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
    Link: https://lore.kernel.org/r/20210809152448.1810400-11-qperret@google.com
    56513119
pgtable.c 27.7 KB