lkml.org 
[lkml]   [2020]   [Nov]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    Subject[RFC PATCH 22/27] KVM: arm64: Refactor __load_guest_stage2()
    From
    Refactor __load_guest_stage2() to introduce __load_stage2() which will
    be re-used when loading the host stage 2.

    Signed-off-by: Quentin Perret <qperret@google.com>
    ---
    arch/arm64/include/asm/kvm_mmu.h | 9 +++++++--
    1 file changed, 7 insertions(+), 2 deletions(-)

    diff --git a/arch/arm64/include/asm/kvm_mmu.h b/arch/arm64/include/asm/kvm_mmu.h
    index 5a76358e8c7a..96843b7b6eaa 100644
    --- a/arch/arm64/include/asm/kvm_mmu.h
    +++ b/arch/arm64/include/asm/kvm_mmu.h
    @@ -321,9 +321,9 @@ static __always_inline u64 kvm_get_vttbr(struct kvm_s2_mmu *mmu)
    * Must be called from hyp code running at EL2 with an updated VTTBR
    * and interrupts disabled.
    */
    -static __always_inline void __load_guest_stage2(struct kvm_s2_mmu *mmu)
    +static __always_inline void __load_stage2(struct kvm_s2_mmu *mmu, unsigned long vtcr)
    {
    - write_sysreg(kern_hyp_va(mmu->arch)->vtcr, vtcr_el2);
    + write_sysreg(vtcr, vtcr_el2);
    write_sysreg(kvm_get_vttbr(mmu), vttbr_el2);

    /*
    @@ -334,6 +334,11 @@ static __always_inline void __load_guest_stage2(struct kvm_s2_mmu *mmu)
    asm(ALTERNATIVE("nop", "isb", ARM64_WORKAROUND_SPECULATIVE_AT));
    }

    +static __always_inline void __load_guest_stage2(struct kvm_s2_mmu *mmu)
    +{
    + __load_stage2(mmu, kern_hyp_va(mmu->arch)->vtcr);
    +}
    +
    static inline struct kvm *kvm_s2_mmu_to_kvm(struct kvm_s2_mmu *mmu)
    {
    return container_of(mmu->arch, struct kvm, arch);
    --
    2.29.2.299.gdc1121823c-goog
    \
     
     \ /
      Last update: 2020-11-17 19:20    [W:4.248 / U:0.024 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site