On 12/07/2010 02:49 PM, Nadav Har'El wrote:
On Tue, Dec 07, 2010, Avi Kivity wrote about "Re: KVM call minutes for Nov 30":
>...
>  All it requires is a
>  kvm_set_cr3() which will load the PDPTEs into the PDPTRs if PAE is
>  enabled.  You may need to order the loading of CR0, CR3, CR4, and EFER
>  to achieve the desired effect.

I did this more explicitly as:

        vmcs_writel(GUEST_CR3, get_vmcs12_fields(vcpu)->guest_cr3);
        vcpu->arch.cr3 = get_vmcs12_fields(vcpu)->guest_cr3;
        load_pdptrs(vcpu, vcpu->arch.walk_mmu, vcpu->arch.cr3);
        vmcs_write64(GUEST_PDPTR0, vcpu->arch.mmu.pdptrs[0]);
        vmcs_write64(GUEST_PDPTR1, vcpu->arch.mmu.pdptrs[1]);
        vmcs_write64(GUEST_PDPTR2, vcpu->arch.mmu.pdptrs[2]);
        vmcs_write64(GUEST_PDPTR3, vcpu->arch.mmu.pdptrs[3]);

I'm still working on trying to simplify this code - I'll indeed try to see if
I can use kvm_set_cr3 instead. Thanks for the suggestion.
However, Even if it works, I have a concern on how nested vmx might brake in
the future if kvm_set_cr3 is changed in some way that is irrelevant to nested.

It's more correct to use kvm_set_cr3(), since that accounts for all side effects. For example unsynchronized shadow mmu pages need to be synced. If there are new side effects that we don't want in nesting, then we'll add a flag to avoid them.

Also need to do the same on the vmexit path (kvm_set_cr3(HOST_CR3)).

This is what svm does (though only for !npt; but it should also work unconditionally).

--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to