xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Egger <Christoph.Egger@amd.com>
To: xen-devel@lists.xensource.com
Subject: Re: RFC: Nested VMX patch series 02: wrap APIs
Date: Wed, 1 Jun 2011 11:13:00 +0200	[thread overview]
Message-ID: <4DE6029C.2090609@amd.com> (raw)
In-Reply-To: <1A42CE6F5F474C41B63392A5F80372B256148074@shsmsx501.ccr.corp.intel.com>

On 06/01/11 05:51, Dong, Eddie wrote:
> Wrap for common nested APIs.
> Thx, Eddie
>
> 	Signed-off-by: Qing He<qing.he@intel.com>
> 	Signed-off-by: Eddie Dong<eddie.dong@intel.com>
>
> diff -r 70ee714947fb xen/arch/x86/hvm/hvm.c
> --- a/xen/arch/x86/hvm/hvm.c	Sat May 28 09:49:25 2011 +0800
> +++ b/xen/arch/x86/hvm/hvm.c	Mon May 30 17:15:52 2011 +0800
> @@ -3502,7 +3502,7 @@
>                   /* Remove the check below once we have
>                    * shadow-on-shadow.
>                    */
> -                if ( !paging_mode_hap(d)&&  a.value )
> +                if ( cpu_has_svm&&  !paging_mode_hap(d)&&  a.value )
>                       rc = -EINVAL;

Are you going to implement shadow-on-shadow ?

Christoph


>                   /* Set up NHVM state for any vcpus that are already up */
>                   if ( !d->arch.hvm_domain.params[HVM_PARAM_NESTEDHVM] )
> diff -r 70ee714947fb xen/arch/x86/hvm/vmx/Makefile
> --- a/xen/arch/x86/hvm/vmx/Makefile	Sat May 28 09:49:25 2011 +0800
> +++ b/xen/arch/x86/hvm/vmx/Makefile	Mon May 30 17:15:52 2011 +0800
> @@ -4,3 +4,4 @@
>   obj-y += vmcs.o
>   obj-y += vmx.o
>   obj-y += vpmu_core2.o
> +obj-y += vvmx.o
> diff -r 70ee714947fb xen/arch/x86/hvm/vmx/intr.c
> --- a/xen/arch/x86/hvm/vmx/intr.c	Sat May 28 09:49:25 2011 +0800
> +++ b/xen/arch/x86/hvm/vmx/intr.c	Mon May 30 17:15:52 2011 +0800
> @@ -109,6 +109,11 @@
>       }
>   }
>
> +enum hvm_intblk nvmx_intr_blocked(struct vcpu *v)
> +{
> +    return hvm_intblk_none;
> +}
> +
>   asmlinkage void vmx_intr_assist(void)
>   {
>       struct hvm_intack intack;
> diff -r 70ee714947fb xen/arch/x86/hvm/vmx/vmx.c
> --- a/xen/arch/x86/hvm/vmx/vmx.c	Sat May 28 09:49:25 2011 +0800
> +++ b/xen/arch/x86/hvm/vmx/vmx.c	Mon May 30 17:15:52 2011 +0800
> @@ -1407,7 +1407,14 @@
>       .invlpg_intercept     = vmx_invlpg_intercept,
>       .set_uc_mode          = vmx_set_uc_mode,
>       .set_info_guest       = vmx_set_info_guest,
> -    .set_rdtsc_exiting    = vmx_set_rdtsc_exiting
> +    .set_rdtsc_exiting    = vmx_set_rdtsc_exiting,
> +    .nhvm_vcpu_initialise = nvmx_vcpu_initialise,
> +    .nhvm_vcpu_destroy    = nvmx_vcpu_destroy,
> +    .nhvm_vcpu_reset      = nvmx_vcpu_reset,
> +    .nhvm_vcpu_guestcr3   = nvmx_vcpu_guestcr3,
> +    .nhvm_vcpu_hostcr3    = nvmx_vcpu_hostcr3,
> +    .nhvm_vcpu_asid       = nvmx_vcpu_asid,
> +    .nhvm_intr_blocked    = nvmx_intr_blocked
>   };
>
>   struct hvm_function_table * __init start_vmx(void)
> diff -r 70ee714947fb xen/arch/x86/hvm/vmx/vvmx.c
> --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
> +++ b/xen/arch/x86/hvm/vmx/vvmx.c	Mon May 30 17:15:52 2011 +0800
> @@ -0,0 +1,93 @@
> +/*
> + * vvmx.c: Support virtual VMX for nested virtualization.
> + *
> + * Copyright (c) 2010, Intel Corporation.
> + * Author: Qing He<qing.he@intel.com>
> + *         Eddie Dong<eddie.dong@intel.com>
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms and conditions of the GNU General Public License,
> + * version 2, as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope it will be useful, but WITHOUT
> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
> + * more details.
> + *
> + * You should have received a copy of the GNU General Public License along with
> + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
> + * Place - Suite 330, Boston, MA 02111-1307 USA.
> + *
> + */
> +
> +#include<xen/config.h>
> +#include<asm/types.h>
> +#include<asm/p2m.h>
> +#include<asm/hvm/vmx/vmx.h>
> +#include<asm/hvm/vmx/vvmx.h>
> +
> +int nvmx_vcpu_initialise(struct vcpu *v)
> +{
> +    struct nestedvmx *nvmx =&vcpu_2_nvmx(v);
> +    struct nestedvcpu *nvcpu =&vcpu_nestedhvm(v);
> +
> +    nvcpu->nv_n2vmcx = alloc_xenheap_page();
> +    if ( !nvcpu->nv_n2vmcx )
> +    {
> +        gdprintk(XENLOG_ERR, "nest: allocation for shadow vmcs failed\n");
> +	goto out;
> +    }
> +    nvmx->vmxon_region_pa = 0;
> +    nvcpu->nv_vvmcx = NULL;
> +    nvcpu->nv_vvmcxaddr = VMCX_EADDR;
> +    nvmx->intr.intr_info = 0;
> +    nvmx->intr.error_code = 0;
> +    nvmx->iobitmap[0] = NULL;
> +    nvmx->iobitmap[1] = NULL;
> +    return 0;
> +out:
> +    return -ENOMEM;
> +}
> +
> +void nvmx_vcpu_destroy(struct vcpu *v)
> +{
> +    struct nestedvcpu *nvcpu =&vcpu_nestedhvm(v);
> +
> +    if ( nvcpu->nv_n2vmcx ) {
> +        __vmpclear(virt_to_maddr(nvcpu->nv_n2vmcx));
> +        free_xenheap_page(nvcpu->nv_n2vmcx);
> +        nvcpu->nv_n2vmcx = NULL;
> +    }
> +    if ( nvcpu->nv_vvmcx ) {
> +        unmap_domain_page_global(nvcpu->nv_vvmcx);
> +        nvcpu->nv_vvmcx == NULL;
> +    }
> +    nvcpu->nv_vvmcxaddr = VMCX_EADDR;
> +}
> +
> +int nvmx_vcpu_reset(struct vcpu *v)
> +{
> +    return 0;
> +}
> +
> +uint64_t nvmx_vcpu_guestcr3(struct vcpu *v)
> +{
> +    /* TODO */
> +    ASSERT(0);
> +    return 0;
> +}
> +
> +uint64_t nvmx_vcpu_hostcr3(struct vcpu *v)
> +{
> +    /* TODO */
> +    ASSERT(0);
> +    return 0;
> +}
> +
> +uint32_t nvmx_vcpu_asid(struct vcpu *v)
> +{
> +    /* TODO */
> +    ASSERT(0);
> +    return 0;
> +}
> +
> diff -r 70ee714947fb xen/include/asm-x86/hvm/vmx/vvmx.h
> --- a/xen/include/asm-x86/hvm/vmx/vvmx.h	Sat May 28 09:49:25 2011 +0800
> +++ b/xen/include/asm-x86/hvm/vmx/vvmx.h	Mon May 30 17:15:52 2011 +0800
> @@ -37,5 +37,14 @@
>
>   #define nvcpu_2_nvmx(nv)	((*(nv)).u.nvmx)
>   #define vcpu_2_nvmx(v)	(nvcpu_2_nvmx(&vcpu_nestedhvm(v)))
> +
> +int nvmx_vcpu_initialise(struct vcpu *v);
> +void nvmx_vcpu_destroy(struct vcpu *v);
> +int nvmx_vcpu_reset(struct vcpu *v);
> +uint64_t nvmx_vcpu_guestcr3(struct vcpu *v);
> +uint64_t nvmx_vcpu_hostcr3(struct vcpu *v);
> +uint32_t nvmx_vcpu_asid(struct vcpu *v);
> +enum hvm_intblk nvmx_intr_blocked(struct vcpu *v);
> +
>   #endif /* __ASM_X86_HVM_VVMX_H__ */
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
>


-- 
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Einsteinring 24, 85689 Dornach b. Muenchen
Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632

  reply	other threads:[~2011-06-01  9:13 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-01  2:14 [xen-4.1-testing test] 7468: tolerable FAIL - PUSHED xen.org
2011-06-01  3:44 ` pre-cleanup1 for nested VMX Dong, Eddie
2011-06-01  3:47 ` pre-cleanup2 " Dong, Eddie
2011-06-01  3:49 ` RFC: Nested VMX patch series 01: data structure Dong, Eddie
2011-06-01  3:51 ` RFC: Nested VMX patch series 02: wrap APIs Dong, Eddie
2011-06-01  9:13   ` Christoph Egger [this message]
2011-06-01  3:52 ` RFC: Nested VMX patch series 03: vmxon_off Dong, Eddie
2011-06-01  3:55 ` RFC: Nested VMX patch series 04: virtual VMCS structure and APIs Dong, Eddie
2011-06-01  3:57 ` RFC: Nested VMX patch series 05: vmptrld Dong, Eddie
2011-06-01  3:57 ` RFC: Nested VMX patch series 05: vmptrst Dong, Eddie
2011-06-01  3:58 ` RFC: Nested VMX patch series 07: vmclear Dong, Eddie
2011-06-01  3:59 ` RFC: Nested VMX patch series 08: vmwrite Dong, Eddie
2011-06-01  4:00 ` RFC: Nested VMX patch series 09: vmread Dong, Eddie
2011-06-01  4:01 ` RFC: Nested VMX patch series 10: vmcs switching API Dong, Eddie
2011-06-01  4:02 ` RFC: Nested VMX patch series 11: vmresume Dong, Eddie
2011-06-01  4:03 ` RFC: Nested VMX patch series 12: shadow vmcs control Dong, Eddie
2011-06-01  4:04 ` RFC: Nested VMX patch series 12: real VMCS switch Dong, Eddie
2011-06-01  4:05 ` RFC: Nested VMX patch series 14: exceptions Dong, Eddie
2011-06-01  4:06 ` RFC: Nested VMX patch series 15: exit from n2 guest Dong, Eddie
2011-06-01  4:07 ` RFC: Nested VMX patch series 16: fpu Dong, Eddie
2011-06-01  4:08 ` RFC: Nested VMX patch series 17: cr4 Dong, Eddie
2011-06-01  4:09 ` RFC: Nested VMX patch series 18: capability Dong, Eddie
2011-06-01  4:11 ` RFC: Nested VMX patch series 00 Dong, Eddie
2011-06-01  8:47   ` Ian Campbell
2011-06-01  9:50     ` Tim Deegan
2011-06-01  9:56   ` Christoph Egger
2011-06-01 10:15     ` Tim Deegan
2011-06-01 10:34       ` Christoph Egger
2011-06-01 10:39         ` Tim Deegan
2011-06-01 23:28           ` Dong, Eddie
2011-06-02  5:02         ` Tian, Kevin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DE6029C.2090609@amd.com \
    --to=christoph.egger@amd.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).