From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 02/10] nEPT: MMU context for nested EPT Date: Thu, 10 Nov 2011 14:49:12 +0200 Message-ID: <4EBBC848.7050400@redhat.com> References: <1320919040-nyh@il.ibm.com> <201111100958.pAA9wrIv019614@rice.haifa.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, "Roedel, Joerg" , owasserm@redhat.com, abelg@il.ibm.com To: "Nadav Har'El" Return-path: Received: from mx1.redhat.com ([209.132.183.28]:60452 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753591Ab1KJMtX (ORCPT ); Thu, 10 Nov 2011 07:49:23 -0500 In-Reply-To: <201111100958.pAA9wrIv019614@rice.haifa.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: On 11/10/2011 11:58 AM, Nadav Har'El wrote: > KVM's existing shadow MMU code already supports nested TDP. To use it, we > need to set up a new "MMU context" for nested EPT, and create a few callbacks > for it (nested_ept_*()). We then need to switch back and forth between this > nested context and the regular MMU context when switching between L1 and L2. > > +static int nested_ept_init_mmu_context(struct kvm_vcpu *vcpu) > +{ > + int r = kvm_init_shadow_mmu(vcpu, &vcpu->arch.mmu); > + > + vcpu->arch.mmu.set_cr3 = vmx_set_cr3; > + vcpu->arch.mmu.get_cr3 = nested_ept_get_cr3; > + vcpu->arch.mmu.get_pdptr = nested_ept_get_pdptr; > + vcpu->arch.mmu.inject_page_fault = nested_ept_inject_page_fault; > + vcpu->arch.mmu.shadow_root_level = get_ept_level(); > + > + vcpu->arch.walk_mmu = &vcpu->arch.nested_mmu; > + > + return r; > +} > + > kvm_init_shadow_mmu() will cause ->page_fault to be set to something like paging64_page_fault(), which is geared to reading EPT ptes. How does this work? -- error compiling committee.c: too many arguments to function