From: Ruslan Nikolaev Subject: Re: HVM hypercalls Date: Thu, 29 Jul 2010 11:55:41 -0700 (PDT) Message-ID: <559459.12230.qm@web113620.mail.gq1.yahoo.com> References: <4C512E15.60909@ts.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <4C512E15.60909@ts.fujitsu.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org Thank you very much! I'll try this. BTW is it required to do this for every= module with HVM hypercalls or there is some shared initialization code in = HVM guest (Linux) similar to one used in paravirtualized guests?=0A=0AIf it= 's supposed to be in a module, is there any good example I can look at?=0A= =0AAFAIK hypercall_page is being initialized on Xen side with appropriate v= mcall/vmmcall code. Is this CPUID mechanism a standard way to obtain hyperc= all_page reference on HVM domain?=0A=0AThank you!=0ARuslan.=0A=0A--- On Thu= , 7/29/10, Juergen Gross wrote:=0A=0A> From:= Juergen Gross =0A> Subject: Re: [Xen-devel] = HVM hypercalls=0A> To: "Ruslan Nikolaev" =0A> Cc: = xen-devel@lists.xensource.com=0A> Date: Thursday, July 29, 2010, 11:30 AM= =0A> On 07/28/2010 09:22 PM, Ruslan=0A> Nikolaev wrote:=0A> > Hi=0A> > =0A>= > I need to use hypercalls from HVM domain (e.g.=0A> HYPERVISOR_add_to_phy= smap). However, it does not work when I=0A> am trying to invoke it from HVM= Linux guest. Basically, I=0A> don't see that anything happens on hyperviso= r's side. I also=0A> grep'ed the guest code for 'vmmcall'/'vmcall' and did = not=0A> find anything. Is it possible to do it at all? Is it=0A> possible t= o make hypercalls from HVM domains or are they=0A> simply used for tools re= sponsible to load HVM domain? Also,=0A> are they allowed (if allowed at all= ) from stubdom, ioemu, or=0A> both configurations?=0A> > =0A> > I am using = latest Xen version (xen-4.0.1-rc). I also=0A> tried both official Linux dis= tribution as an HVM domain and=0A> the version from Xen repositary. The com= puter has Nehalem=0A> processor with VMX.=0A> =0A> This should work.=0A> We= are using hypercalls from HVM domains without any=0A> problem on xen 3.3 a= nd=0A> 4.0, one of them being HYPERVISOR_add_to_physmap. There=0A> must be = something=0A> you are doing wrong.=0A> =0A> The following steps are require= d:=0A> =0A> - use the cpuid instruction to search for Xen signature.=0A> Yo= u should begin with=0A> =A0 index 0x40000000 and look for the text=0A> "Xen= VMMXenVMM" in the returned=0A> =A0 registers ebx, ecx and edx. Increment th= e index by=0A> 0x100 up to 0x40001000 if=0A> =A0 necessary.=0A> - get the x= en msr register number via cpuid with index=0A> 0x40000x002 (x from=0A> =A0= step 1). The msr register number will be in register=0A> ebx.=0A> - write = the physical address of a 4k page to the obtained=0A> msr register via=0A> = =A0 wrmsr. This page will be used by the hypervisor to=0A> write the approp= riate=0A> =A0 code for the hypercalls to.=0A> - each entry in that page occ= upies 32 bytes. You can do a=0A> specific hypercall=0A> =A0 by calling the = function at the specific entry with=0A> the hypercall number as=0A> =A0 ind= ex=0A> =0A> =0A> Juergen=0A> =0A> -- Juergen Gross=A0 =A0 =A0 =A0 =A0 =A0= =0A> =A0 =A0=A0=A0Principal Developer Operating=0A> Systems=0A> TSP ES&S SW= E OS6=A0 =A0 =A0 =A0 =A0=0A> =A0 =A0 =A0 =A0 =A0=0A> =A0=A0=A0Telephone: +4= 9 (0) 89 3222 2967=0A> Fujitsu Technology Solutions=A0 =A0 =A0 =A0=0A> =A0 = =A0 =A0 e-mail: juergen.gross@ts.fujitsu.com=0A> Domagkstr. 28=A0 =A0 =A0 = =A0 =A0 =A0=0A> =A0 =A0 =A0 =A0 =A0 =A0=0A> =A0=A0=A0Internet: ts.fujitsu.c= om=0A> D-80807 Muenchen=A0 =A0 =A0 =A0 =A0 =A0=0A> =A0 =A0=A0=A0Company det= ails:=0A> ts.fujitsu.com/imprint.html=0A> =0A> ____________________________= ___________________=0A> Xen-devel mailing list=0A> Xen-devel@lists.xensourc= e.com=0A> http://lists.xensource.com/xen-devel=0A> =0A=0A=0A