lkml.org 
[lkml]   [2021]   [Dec]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.15 160/207] KVM: X86: Fix when shadow_root_level=5 && guest root_level<4
    Date
    From: Lai Jiangshan <laijs@linux.alibaba.com>

    [ Upstream commit 12ec33a705749e18d9588b0a0e69e02821371156 ]

    If the is an L1 with nNPT in 32bit, the shadow walk starts with
    pae_root.

    Fixes: a717a780fc4e ("KVM: x86/mmu: Support shadowing NPT when 5-level paging is enabled in host)
    Signed-off-by: Lai Jiangshan <laijs@linux.alibaba.com>
    Message-Id: <20211124122055.64424-2-jiangshanlai@gmail.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    arch/x86/kvm/mmu/mmu.c | 4 ++--
    1 file changed, 2 insertions(+), 2 deletions(-)

    diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
    index c9b1d63d3cfba..287fc1086db78 100644
    --- a/arch/x86/kvm/mmu/mmu.c
    +++ b/arch/x86/kvm/mmu/mmu.c
    @@ -2188,10 +2188,10 @@ static void shadow_walk_init_using_root(struct kvm_shadow_walk_iterator *iterato
    iterator->shadow_addr = root;
    iterator->level = vcpu->arch.mmu->shadow_root_level;

    - if (iterator->level == PT64_ROOT_4LEVEL &&
    + if (iterator->level >= PT64_ROOT_4LEVEL &&
    vcpu->arch.mmu->root_level < PT64_ROOT_4LEVEL &&
    !vcpu->arch.mmu->direct_map)
    - --iterator->level;
    + iterator->level = PT32E_ROOT_LEVEL;

    if (iterator->level == PT32E_ROOT_LEVEL) {
    /*
    --
    2.33.0


    \
     
     \ /
      Last update: 2021-12-06 17:10    [W:4.035 / U:0.104 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site