From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gui Jianfeng Subject: [PATCH 3/3] KVM MMU: Take sp level into account when calculating quadran Date: Thu, 22 Apr 2010 17:34:24 +0800 Message-ID: <4BD01820.3050809@cn.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Avi Kivity Return-path: Received: from cn.fujitsu.com ([222.73.24.84]:57537 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1753659Ab0DVJfZ (ORCPT ); Thu, 22 Apr 2010 05:35:25 -0400 Sender: kvm-owner@vger.kernel.org List-ID: Take sp level into account when calculating quadrant, because only when level == PT_PAGE_TABLE_LEVEL, quadrant is needed. Signed-off-by: Gui Jianfeng --- arch/x86/kvm/mmu.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 640b82d..2a35a65 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -1324,7 +1324,8 @@ static struct kvm_mmu_page *kvm_mmu_get_page(struct kvm_vcpu *vcpu, if (role.direct) role.cr4_pae = 0; role.access = access; - if (vcpu->arch.mmu.root_level <= PT32_ROOT_LEVEL) { + if (vcpu->arch.mmu.root_level <= PT32_ROOT_LEVEL && + level == PT_PAGE_TABLE_LEVEL) { quadrant = gaddr >> (PAGE_SHIFT + (PT64_PT_BITS * level)); quadrant &= (1 << ((PT32_PT_BITS - PT64_PT_BITS) * level)) - 1; role.quadrant = quadrant; -- 1.6.5.2