From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Dong, Eddie" Subject: RE: [PATCH 04/16] vmx: nest: nested control structure Date: Wed, 15 Sep 2010 21:06:03 +0800 Message-ID: <1A42CE6F5F474C41B63392A5F80372B22A8C237B@shsmsx501.ccr.corp.intel.com> References: <1283959344-3837-1-git-send-email-qing.he@intel.com> <1283959344-3837-5-git-send-email-qing.he@intel.com> <201009151327.41017.Christoph.Egger@amd.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <201009151327.41017.Christoph.Egger@amd.com> Content-Language: en-US List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Christoph Egger , "xen-devel@lists.xensource.com" Cc: "Dong, Eddie" , "He, Qing" List-Id: xen-devel@lists.xenproject.org Christoph Egger wrote: > On Wednesday 08 September 2010 17:22:12 Qing He wrote: >> v->arch.hvm_vmx.nest as control structure >>=20 >> Signed-off-by: Qing He >> Signed-off-by: Eddie Dong >>=20 >> --- >> diff -r fc4de5eedd1d xen/include/asm-x86/hvm/vmx/nest.h >> --- /dev/null Thu Jan 01 00:00:00 1970 +0000 >> +++ b/xen/include/asm-x86/hvm/vmx/nest.h Wed Sep 08 21:03:41 2010 >> +0800 @@ -0,0 +1,45 @@ +/* >> + * nest.h: nested virtualization for VMX. >> + * >> + * Copyright (c) 2010, Intel Corporation. >> + * Author: Qing He >> + * >> + * 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. + * + */ >> +#ifndef __ASM_X86_HVM_NEST_H__ >> +#define __ASM_X86_HVM_NEST_H__ >> + >> +struct vmcs_struct; >> + >> +struct vmx_nest_struct { >=20 > Is it ok to name it 'struct nestedvmx' ? Fine, renamed to nested_vmx. >=20 >> + paddr_t guest_vmxon_pa; >> + >> + /* Saved host vmcs for vcpu itself */ >> + struct vmcs_struct *hvmcs; >> + >> + /* >> + * Guest's `current vmcs' of vcpu >> + * - gvmcs_pa: guest VMCS region physical address >> + * - vvmcs: (guest) virtual vmcs >> + * - svmcs: effective vmcs for the guest of this vcpu >> + * - valid: launch state: invalid on clear, valid on ld + =20 >> */ + paddr_t gvmcs_pa; >> + void *vvmcs; >> + struct vmcs_struct *svmcs; >> + int vmcs_valid; >> +}; >> + >> +#endif /* __ASM_X86_HVM_NEST_H__ */ >> diff -r fc4de5eedd1d xen/include/asm-x86/hvm/vmx/vmcs.h >> --- a/xen/include/asm-x86/hvm/vmx/vmcs.h Wed Sep 08 21:00:00 2010 >> +0800 +++ b/xen/include/asm-x86/hvm/vmx/vmcs.h Wed Sep 08 21:03:41 >> 2010 +0800 @@ -22,6 +22,7 @@ #include >> #include >> #include >> +#include >>=20 >> extern void vmcs_dump_vcpu(struct vcpu *v); >> extern void setup_vmcs_dump(void); >> @@ -99,6 +100,9 @@ >> u32 secondary_exec_control; >> u32 exception_bitmap; >>=20 >> + /* nested virtualization */ >> + struct vmx_nest_struct nest; >> + >> #ifdef __x86_64__ >> struct vmx_msr_state msr_state; >> unsigned long shadow_gs; >=20 >=20 > I think, the structure should be allocated in the > nestedhvm_vcpu_initialise() function hook and assigned to the nh_arch > pointer in struct nestedhvm.=20 Well, the structure itself is pretty small, so dynamic allocation is really= not a good idea. Instead, the internal field such as vvmcs/svmcs are big and thus we use a p= ointer, but they are allocated on demand. This follows the style of arch_vmx_struct in vcpu data structure. I am fine with your nestedhvm_vcpu_initialise "design", but VMX doesn't nee= d to use the wrapper so far. Thx, Eddie