lkml.org 
[lkml]   [2011]   [Jul]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 4/7] KVM: SVM: Use seperate VMCB for L2 guests
On 07/13/2011 06:32 PM, Joerg Roedel wrote:
> From: Joerg Roedel<joro@8bytes.org>
>
> Move torwards emulation of VMCB-clean-bits by using a
> seperate VMCB when running L2 guests.
>
>
> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
> index f81e35e..6dacf59 100644
> --- a/arch/x86/kvm/svm.c
> +++ b/arch/x86/kvm/svm.c
> @@ -105,6 +105,8 @@ struct nested_state {
>
> /* Nested Paging related state */
> u64 nested_cr3;
> +
> + struct vmcb *n_vmcb;
> };
>
> #define MSRPM_OFFSETS 16
> @@ -974,6 +976,26 @@ static u64 svm_compute_tsc_offset(struct kvm_vcpu *vcpu, u64 target_tsc)
> return target_tsc - tsc;
> }
>
> +static bool init_nested_vmcb(struct vcpu_svm *svm)
> +{
> + struct vmcb_control_area *hc, *nc;
> +
> + svm->nested.n_vmcb = (void *)get_zeroed_page(GFP_KERNEL);
> + if (svm->nested.n_vmcb == NULL)
> + return false;
> +
> + nc =&svm->nested.n_vmcb->control;
> + hc =&svm->host_vmcb->control;
> +
> + nc->iopm_base_pa = hc->iopm_base_pa;
> + nc->msrpm_base_pa = hc->msrpm_base_pa;
> + nc->nested_ctl = hc->nested_ctl;
> + nc->pause_filter_count = hc->pause_filter_count;
> + svm->nested.n_vmcb->save.g_pat = svm->host_vmcb->save.g_pat;
> +
> + return true;
> +}
> +

Instead of initializing the non-nested vmcb and then copying it,
separate out the bits you're copying here into a separate function (i.e.
init_vmcb_host_state()) and call it for both vmcbs.

I had practically the same comment for nvmx (see
vmx_set_constant_host_state()).

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



\
 
 \ /
  Last update: 2011-07-14 13:41    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site