[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20a204f5-5606-2b4d-9342-f3d1f0146f20@redhat.com>
Date: Wed, 15 Jun 2022 15:49:50 +0200
From: Paolo Bonzini <pbonzini@...hat.com>
To: Sean Christopherson <seanjc@...gle.com>
Cc: Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org,
Lai Jiangshan <jiangshan.ljs@...group.com>
Subject: Re: [PATCH v2 5/8] KVM: x86/mmu: Use separate namespaces for guest
PTEs and shadow PTEs
On 6/15/22 01:33, Sean Christopherson wrote:
> @@ -2027,8 +2013,8 @@ static struct kvm_mmu_page *kvm_mmu_get_page(struct kvm_vcpu *vcpu,
> role.direct = direct;
> role.access = access;
> if (role.has_4_byte_gpte) {
> - quadrant = gaddr >> (PAGE_SHIFT + (PT64_PT_BITS * level));
> - quadrant &= (1 << ((PT32_PT_BITS - PT64_PT_BITS) * level)) - 1;
> + quadrant = gaddr >> (PAGE_SHIFT + (SPTE_LEVEL_BITS * level));
> + quadrant &= (1 << ((PT32_LEVEL_BITS - SPTE_LEVEL_BITS) * level)) - 1;
> role.quadrant = quadrant;
That's just a fancy 1, though, and this is just
/*
* Isolate the bits of the address that have already been used by the
* 8-byte shadow page table structures, but not yet in the 4-byte guest
* page tables. For example, a 4-byte PDE consumes bits 31:22 and an
* 8-byte PDE consumes bits 29:21, so bits 31:30 go in the hash
* key. The hash table look up up ensures that each sPTE points to
* the page for the correct portion of the guest page table structure.
*/
quadrant = gaddr >> (PAGE_SHIFT + (SPTE_LEVEL_BITS * level));
quadrant &= (1 << level) - 1;
(Not the best comment, understood).
Paolo
Powered by blists - more mailing lists