WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-users

RE: [Xen-devel] calling the VMX instructions from HVM guest application

To: "Praveen Kushwaha" <praveen.kushwaha@xxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx, xen-users@xxxxxxxxxxxxxxxxxxx
Subject: RE: [Xen-devel] calling the VMX instructions from HVM guest application
From: "Petersson, Mats" <Mats.Petersson@xxxxxxx>
Date: Wed, 28 Mar 2007 10:59:04 +0200
Delivery-date: Wed, 28 Mar 2007 02:03:11 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <0A8CFEC45B7F4C419F7543867C474423809FD5@xxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcdwYnT0wvLVna0vRdyH00IoElN0MAAoTaSwAARGH0A=
Thread-topic: [Xen-devel] calling the VMX instructions from HVM guest application
 

> -----Original Message-----
> From: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx 
> [mailto:xen-devel-bounces@xxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Praveen Kushwaha
> Sent: 28 March 2007 07:56
> To: xen-devel@xxxxxxxxxxxxxxxxxxx; xen-users@xxxxxxxxxxxxxxxxxxx
> Subject: [Xen-devel] calling the VMX instructions from HVM 
> guest application
> 
>  
> 
> Hi 
> 
>         Since the xen(Intel) provide the VMX instruction set 
> (like VMPTRLD, VMREAD, VMWRITE, VMCLEAR VMCALL  etc.) to 
> manage the VMCS. 
> 
>         I have some queries regarding these instructions:
> 
>  
> 
> 1.      Can an application in HVM guest  call these VMX 
> instructions? If yes how to call these VMX instructions, is 
> it through the hyper calls or through other mechanism? 

There is ONE of these instructions that can be used (without problems)
by the guest: VMCALL, which forces a VMExit to the hypervisor. Ok, so if
you do a VMCLEAR for example in the guest, then it will actually just
cause a VMExit for that too - but with a different exit value (in this
particular example EXIT_REASON_VMCLEAR), which will be used by the
hypervisor to instruct the guest to do a "invalid opcode" [1] (using the
vmx_inject_exception function). See line 2754 in
.../xen/arch/x86/hvm/vmx/vmx.c). It seems like the svm.c code isn't
doing exactly the same thing (it's crashing the guest instead. I'll see
if I can fix that up - I don't think the current behaviour is correct).


[1] Invalid opcode is also the result if this instruction was executed
without enabling VMX/SVM in the first place. See AMD and Intel
documentation for the respective instructions.

> 
> 2.      Is VMCS structure is updated by the processor 
> automatically in case VMexit happens ? Suppose VMExit 
> operation caused due to VMcall then  
> 
>        Will the VMCS structure will be updated 
> automatically(i.e. Guest state information is saved on VMCS) 
> ?
Yes, the processor writes to VMCS with the current state of the
processor at the time of VMExit (regardless of the reason for te
Vmexit). 

> can the application in HVM guest also
>        store some information on VMCS?

Aside from register values stored by the processor (rAX, rSP), there is
no information that the guest has free control over that is stored in
the VMCS. As part of the VMEXIT handler, the rest of the registers from
the guest are also stored, so those can be seen and modified by the
hypervisor (this is for example the case on a mov %cr0,%rbx). 

> 
> 3.      what are the other way to pass information from HVM 
> guest to hypervisor. Though there is VMWRITE instruction is 
> there, but how actually it works? I mean to say that , if 
> VMWRITE instruction will be called then VMExit will happen. 
> Then how exactly to pass information to hypervisor using VMCS?

The VWWRITE instruction is only allowed within the hypervisor itself.
The guest is not allowed (and should never be allowed) to touch the
VMCS. The VMCS belongs to the hypervisor to control the guest, and
there's no reason why the guest should even know that such a think
exists. 

--
Mats
> 
>             
> 
>             Above of some questions might not be intelligent 
> enough. If anyone has  information regarding it please reply.
> 
>  
> 
> Thanks,
> 
> Praveen Kushwaha
> 
>  



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>