lkml.org 
[lkml]   [2021]   [Feb]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[RFC PATCH 2/4] KVM: arm64: Add an independent API for coalescing tables
    Date
    Process of coalescing page mappings back to a block mapping is different
    from normal map path, such as TLB invalidation and CMOs, so here add an
    independent API for this case.

    Signed-off-by: Yanan Wang <wangyanan55@huawei.com>
    ---
    arch/arm64/kvm/hyp/pgtable.c | 18 ++++++++++++++++++
    1 file changed, 18 insertions(+)

    diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c
    index 2f4f87021980..78a560446f80 100644
    --- a/arch/arm64/kvm/hyp/pgtable.c
    +++ b/arch/arm64/kvm/hyp/pgtable.c
    @@ -525,6 +525,24 @@ static int stage2_map_walker_try_leaf(u64 addr, u64 end, u32 level,
    return 0;
    }

    +static void stage2_coalesce_tables_into_block(u64 addr, u32 level,
    + kvm_pte_t *ptep,
    + struct stage2_map_data *data)
    +{
    + u64 granule = kvm_granule_size(level), phys = data->phys;
    + kvm_pte_t new = kvm_init_valid_leaf_pte(phys, data->attr, level);
    +
    + kvm_set_invalid_pte(ptep);
    +
    + /*
    + * Invalidate the whole stage-2, as we may have numerous leaf entries
    + * below us which would otherwise need invalidating individually.
    + */
    + kvm_call_hyp(__kvm_tlb_flush_vmid, data->mmu);
    + smp_store_release(ptep, new);
    + data->phys += granule;
    +}
    +
    static int stage2_map_walk_table_pre(u64 addr, u64 end, u32 level,
    kvm_pte_t *ptep,
    struct stage2_map_data *data)
    --
    2.23.0
    \
     
     \ /
      Last update: 2021-02-08 12:45    [W:2.102 / U:0.192 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site