lkml.org 
[lkml]   [2021]   [Jul]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 02/16] KVM: arm64: Don't issue CMOs when the physical address is invalid
    Date
    Make sure we don't issue CMOs when mapping something that
    is not a memory address in the S2 page tables.

    Signed-off-by: Marc Zyngier <maz@kernel.org>
    ---
    arch/arm64/kvm/hyp/pgtable.c | 16 ++++++++++------
    1 file changed, 10 insertions(+), 6 deletions(-)

    diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c
    index 05321f4165e3..a5874ebd0354 100644
    --- a/arch/arm64/kvm/hyp/pgtable.c
    +++ b/arch/arm64/kvm/hyp/pgtable.c
    @@ -619,12 +619,16 @@ static int stage2_map_walker_try_leaf(u64 addr, u64 end, u32 level,
    }

    /* Perform CMOs before installation of the guest stage-2 PTE */
    - if (mm_ops->dcache_clean_inval_poc && stage2_pte_cacheable(pgt, new))
    - mm_ops->dcache_clean_inval_poc(kvm_pte_follow(new, mm_ops),
    - granule);
    -
    - if (mm_ops->icache_inval_pou && stage2_pte_executable(new))
    - mm_ops->icache_inval_pou(kvm_pte_follow(new, mm_ops), granule);
    + if (kvm_phys_is_valid(phys)) {
    + if (mm_ops->dcache_clean_inval_poc &&
    + stage2_pte_cacheable(pgt, new))
    + mm_ops->dcache_clean_inval_poc(kvm_pte_follow(new,
    + mm_ops),
    + granule);
    + if (mm_ops->icache_inval_pou && stage2_pte_executable(new))
    + mm_ops->icache_inval_pou(kvm_pte_follow(new, mm_ops),
    + granule);
    + }

    smp_store_release(ptep, new);
    if (stage2_pte_is_counted(new))
    --
    2.30.2
    \
     
     \ /
      Last update: 2021-07-15 18:33    [W:4.821 / U:0.336 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site