[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v3 4/4] nested vmx: enable VMCS shadowing feature



>>> On 21.01.13 at 09:13, Dongxiao Xu <dongxiao.xu@xxxxxxxxx> wrote:
> @@ -843,6 +857,47 @@ static int construct_vmcs(struct vcpu *v)
>          }
>      }
>  
> +    /* non-root VMREAD/VMWRITE bitmap. */
> +    if ( cpu_has_vmx_vmcs_shadowing && nestedhvm_enabled(d) )
> +    {
> +        struct page_info *vmread_bitmap, *vmwrite_bitmap;
> +
> +        vmread_bitmap = alloc_domheap_page(d, 0);
> +        if ( !vmread_bitmap )
> +        {
> +            gdprintk(XENLOG_ERR, "nest: allocation for vmread bitmap 
> failed\n");
> +            ret = -ENOMEM;
> +            goto out1;
> +        }
> +        v->arch.hvm_vmx.vmread_bitmap = page_to_virt(vmread_bitmap);

__map_domain_page() (the result of which must not be stored in
a global variable; you store to track MFN of struct page_info
instead).

> +
> +        vmwrite_bitmap = alloc_domheap_page(d, 0);
> +        if ( !vmwrite_bitmap )
> +        {
> +            gdprintk(XENLOG_ERR, "nest: allocation for vmwrite bitmap 
> failed\n");
> +            ret = -ENOMEM;
> +            goto out2;
> +        }
> +        v->arch.hvm_vmx.vmwrite_bitmap = page_to_virt(vmwrite_bitmap);
> +
> +        clear_page(v->arch.hvm_vmx.vmread_bitmap);
> +        clear_page(v->arch.hvm_vmx.vmwrite_bitmap);
> +
> +        /* 
> +         * For the following 4 encodings, we need to handle them in VMM.
> +         * Let them vmexit as usual.
> +         */
> +        set_bit(IO_BITMAP_A, v->arch.hvm_vmx.vmwrite_bitmap);
> +        set_bit(IO_BITMAP_A_HIGH, v->arch.hvm_vmx.vmwrite_bitmap);
> +        set_bit(IO_BITMAP_B, v->arch.hvm_vmx.vmwrite_bitmap);
> +        set_bit(IO_BITMAP_B_HIGH, v->arch.hvm_vmx.vmwrite_bitmap);
> +
> +        __vmwrite(VMREAD_BITMAP,
> +                  virt_to_maddr(v->arch.hvm_vmx.vmread_bitmap));
> +        __vmwrite(VMWRITE_BITMAP,
> +                  virt_to_maddr(v->arch.hvm_vmx.vmwrite_bitmap));
> +    }

Also I don't think this is correct wrt enabling nested virtualization
on an already running VM. I.e. I believe at least part of this needs
to go into nvmx_vcpu_initialise().

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.