From mboxrd@z Thu Jan 1 00:00:00 1970 From: veeruyours Subject: Re: HVM hypercalls Date: Tue, 24 May 2011 06:58:35 -0700 (PDT) Message-ID: References: <706335.39543.qm@web113616.mail.gq1.yahoo.com> <4C512E15.60909@ts.fujitsu.com> <1306136918478-4418332.post@n5.nabble.com> <1306138923.20576.20.camel@zakaz.uk.xensource.com> <1306238808.20576.171.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1313111923==" Return-path: In-Reply-To: <1306238808.20576.171.camel@zakaz.uk.xensource.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 --===============1313111923== Content-Type: multipart/alternative; boundary="----=_Part_5548_24132814.1306245515188" ------=_Part_5548_24132814.1306245515188 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit I am running 2.6.30 (downloaded from kernel.org) on top of CENTOS 5.4. Do u mean i should enable following option --> Processor type and features [*] Paravirtualized guest support ---> --> [ ] Xen guest support (NEW) But enabling this also selects PARAVIRT and does it make my guest PV guest or PVHVM guest? --- Paravirtualized guest support [*] Xen guest support (32) Maximum allowed size of a domain in gigabytes (NEW) [ ] Enable Xen debug and tuning parameters in debugfs [ ] KVM paravirtualized clock (NEW) [ ] KVM Guest support (NEW) -*- Enable paravirtualization code [ ] Paravirtualization layer for spinlocks Could you please suggest how to enable only PVHVM support? I am fine for moving to recent kernels if required. Thanks & Regards, VSR. On Tue, May 24, 2011 at 5:38 PM, Ian Campbell-12 [via Xen] < ml-node+4421864-1644938153-207502@n5.nabble.com> wrote: > On Mon, 2011-05-23 at 14:52 +0100, veerasena reddy wrote: > > > Hi, > > > > Thanks a lot for quick reply. > > > > I modified my code to get physical page address and now i do not see > > error message on XEN hypervisor. > > Could you please correct if am writing proper physical address or not? > > > > We can write the page address to hypervisor using wrmsr() but who > > should set hypercall_page which is declared as extern in hypercall.h > > on HVM? Because when i try to invoke HYPERCALL_xxxx(), it reported > > hypercall_page not declared. Do we need to enable CONFIG_XEN in HVM > > kernel in order to invoke hypercalls to hypervisor? > > Which kernel are you running with? > > This should all be taken care of for you in a kernel with PVHVM support > enabled. > > > Could you please share any sample code if you have to get a clear > > understanding of HVM hypercalls. > > > > { > > char id[13]; > > unsigned int msr1; > > unsigned long my_hpage_phys; > > int my_hpage_lo, my_hpage_hi; > > > > __asm__ __volatile__( > > "cpuid" > > : "=b" (*(int *)(&id[0])), > > "=d" (*(int *)(&id[8])), > > "=c" (*(int *)(&id[4])) > > : "a" (0x40000000) > > ); > > id[12]='\0'; > > printk("CPU ID read- %s\n", id); > > > > /* Read MSR register */ > > __asm__ __volatile__( > > "cpuid" > > : "=b" (*(int *)(&msr1)) > > : "a" (0x40000002) > > ); > > > > my_hpage_phys = __get_free_page(GFP_ATOMIC); > > hypercall_page = virt_to_phys(my_hpage_phys); > > printk("my_hpage_phys get_free = %lx\n", my_hpage_phys); > > printk("hypercal_page = %p\n", hypercall_page); > > > > my_hpage_lo = (unsigned long)hypercall_page & 0xffffffff; > > my_hpage_hi = (unsigned long)hypercall_page >> 32; > > printk("my_hpage lo = %x hi = %x\n", my_hpage_lo, > > my_hpage_hi); > > /* Write hypercall page address to MSR */ > > wrmsr(msr1, my_hpage_lo, my_hpage_hi); > > > > return 0; > > } > > > > ================= output on HVM ========== > > [root@localhost src]# dmesg > > my_hypercall_page @ ffffffffa0388000 > > CPU ID read- XenVMMXenVMM > > my_hpage_phys get_free = ffff880005c0b000 > > hypercal_page = 0000000005c0b000 > > my_hpage lo = 5c0b000 hi = 0 > > ============================ > > > > Thanks & Regards, > > VSR. > > > > On Mon, May 23, 2011 at 1:52 PM, Ian Campbell > > <[hidden email] > > wrote: > > On Mon, 2011-05-23 at 08:48 +0100, veeruyours wrote: > > > Hi, > > > > > > I recently started working on XEN, and I am looking for ways > > to invoke > > > hypercalls from HVM. > > > I followed your instructions and succeeded in reading MSR > > register. > > > But when i attempt to write the physical address of a 4K > > page from my HVM > > > guest (2.6.30 kernel), i observed the XEN hypervisor > > reporting it as bad > > > GMFN as follows. > > > > > > [root@f13 ~]# xm dmesg -c > > > (XEN) traps.c:664:d17 Bad GMFN ffff88001e925 (MFN > > ffffffffffffffff) to MSR > > > 40000000 > > > > > > That supposed GMFN (fff88001e925) looks an awful lot like a > > virtual > > address and not a physical one to me, unless your guest really > > has >4TB > > of RAM assigned... > > > > > > > > > > Could you please help me in understanding what went wrong in > > my > > > implementation. > > > > > > I am running XEN 4.0.1 on AMD 64bit machine with svm support > > and the dom0 > > > kernel running 2.6.32.39. > > > > > > The > > > Thanks & Regards, > > > VSR. > > > > > > > > > -- > > > View this message in context: > > > http://xen.1045712.n5.nabble.com/HVM-hypercalls-tp2541346p4418332.html > > > Sent from the Xen - Dev mailing list archive at Nabble.com. > > > > > > _______________________________________________ > > > Xen-devel mailing list > > > [hidden email] > > > http://lists.xensource.com/xen-devel > > > > > > > > > > > > _______________________________________________ > Xen-devel mailing list > [hidden email] > http://lists.xensource.com/xen-devel > > > ------------------------------ > If you reply to this email, your message will be added to the discussion > below: > http://xen.1045712.n5.nabble.com/HVM-hypercalls-tp2541346p4421864.html > To unsubscribe from HVM hypercalls, click here. > > -- View this message in context: http://xen.1045712.n5.nabble.com/HVM-hypercalls-tp2541346p4422128.html Sent from the Xen - Dev mailing list archive at Nabble.com. ------=_Part_5548_24132814.1306245515188 Content-Type: text/html; charset=UTF8 Content-Transfer-Encoding: quoted-printable I am running 2.6.30 (downloaded from kernel.org) on top of CENT= OS 5.4.
Do u mean i should enable following option

--> Processor type and features
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 [*] Pa= ravirtualized guest support=C2=A0 --->
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0=C2=A0 --> [ ]=C2=A0=C2=A0 Xen guest support (NEW)

But enabling this also selects PARAVIRT and does it make my guest PV guest = or PVHVM guest?

--- Paravirtualized guest support
[*]=C2=A0=C2=A0= Xen guest support
(32)=C2=A0=C2=A0=C2=A0 Maximum allowed size of a doma= in in gigabytes (NEW)
[ ]=C2=A0=C2=A0=C2=A0=C2=A0 Enable Xen debug and tuning parameters in debug= fs
[ ]=C2=A0=C2=A0 KVM paravirtualized clock (NEW)
[ ]=C2=A0=C2=A0 KV= M Guest support (NEW)
-*-=C2=A0=C2=A0 Enable paravirtualization code
= [ ]=C2=A0=C2=A0=C2=A0=C2=A0 Paravirtualization layer for spinlocks

Could you please suggest how to enable only PVHVM support? I am fine fo= r moving to recent kernels if required.

Thanks & Regards,
VSR.

On Tue, May 24, 2011 at 5:38 PM, Ian= Campbell-12 [via Xen] <[hidden email]> wrote:
=09On Mon, 2011-05-23 at 14:52 +0100, veerasena reddy wrote:

> Hi,
>=20
> Thanks a lot for quick reply.=20
>=20
> I modified my code to get physical page address and now i do not s= ee
> error message on XEN hypervisor.
> Could you please correct if am writing proper physical address or = not?
>=20
> We can write the page address to hypervisor using wrmsr() but who
> should set hypercall_page which is declared as extern in hypercall= .h
> on HVM? Because when i try to invoke HYPERCALL_xxxx(), it reported
> hypercall_page not declared. Do we need to enable CONFIG_XEN in HV= M
> kernel in order to invoke hypercalls to hypervisor?
Which kernel are you running with?

This should all be taken care of for you in a kernel with PVHVM sup= port
enabled.

> Could you please share any sample code if you have to get a = clear
> understanding of HVM hypercalls.
>=20
> {
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 char id[13];
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 unsigned int msr1;
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 unsigned long =C2=A0my_hpage_phys;
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 int my_hpage_lo, my_hpage_hi;
>=20
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 __asm__ __volatile__(
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "cpui= d"
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 : "= =3Db" (*(int *)(&id[0])),
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 &qu= ot;=3Dd" (*(int *)(&id[8])),
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 &qu= ot;=3Dc" (*(int *)(&id[4]))
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 : "a&= quot; (0x40000000)
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 );
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 id[12]=3D'\0';
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 printk("CPU ID read- %s\n", = id);
>=20
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* Read MSR register */
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 __asm__ __volatile__(
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "cpui= d"
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 : "= =3Db" (*(int *)(&msr1))
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 : "a&= quot; (0x40000002)
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 );
>=20
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 my_hpage_phys =3D __get_free_page(GFP_= ATOMIC);
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 hypercall_page =3D virt_to_phys(my_hpa= ge_phys);
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 printk("my_hpage_phys get_free = =3D %lx\n", my_hpage_phys);
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 printk("hypercal_page =3D %p\n&qu= ot;, hypercall_page);
>=20
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 my_hpage_lo =3D (unsigned long)hyperca= ll_page & 0xffffffff;
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 my_hpage_hi =3D (unsigned long)hyperca= ll_page >> 32;
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 printk("my_hpage lo =3D %x hi =3D= %x\n", my_hpage_lo,
> my_hpage_hi);
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* Write hypercall page address to MSR= */
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 wrmsr(msr1, my_hpage_lo, my_hpage_hi);
>=20
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 return 0;
> }
>=20
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D output on HVM = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> [root@localhost src]# dmesg
> my_hypercall_page @ ffffffffa0388000
> CPU ID read- XenVMMXenVMM
> my_hpage_phys get_free =3D ffff880005c0b000
> hypercal_page =3D 0000000005c0b000
> my_hpage lo =3D 5c0b000 hi =3D 0
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D
>=20
> Thanks & Regards,
> VSR.
>=20
> On Mon, May 23, 2011 at 1:52 PM, Ian Campbell
> <[hidden email]> wrote:

> =C2=A0 =C2=A0 =C2=A0 =C2=A0 On Mon= , 2011-05-23 at 08:48 +0100, veeruyours wrote:
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 > Hi,
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 >
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 > I recently started working on XEN= , and I am looking for ways
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 to invoke
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 > hypercalls from HVM.
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 > I followed your instructions and = succeeded in reading MSR
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 register.
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 > But when i attempt to write the p= hysical address of a 4K
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 page from my HVM
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 > guest (2.6.30 kernel), i observed= the XEN hypervisor
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 reporting it as bad
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 > GMFN as follows.
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 >
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 > [root@f13 ~]# xm dmesg -c
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 > (XEN) traps.c:664:d17 Bad GMFN ff= ff88001e925 (MFN
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 ffffffffffffffff) to MSR
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 > 40000000
> =C2=A0 =C2=A0 =C2=A0 =C2=A0=20
> =C2=A0 =C2=A0 =C2=A0 =C2=A0=20
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 That supposed GMFN (fff88001e925) look= s an awful lot like a
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 virtual
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 address and not a physical one to me, = unless your guest really
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 has >4TB
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 of RAM assigned...
> =C2=A0 =C2=A0 =C2=A0 =C2=A0=20
> =C2=A0 =C2=A0 =C2=A0 =C2=A0=20
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 >
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 > Could you please help me in under= standing what went wrong in
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 my
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 > implementation.
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 >
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 > I am running XEN 4.0.1 on AMD 64b= it machine with svm support
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 and the dom0
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 > kernel running 2.6.32.39.
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 >
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 > The
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 > Thanks & Regards,
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 > VSR.
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 >
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 >
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 > --
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 > View this message in context:
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 http://xen.1045712.n5.nabble.com/HVM-hypercalls-tp25= 41346p4418332.html
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 > Sent from the Xen - Dev mailing list = archive at Nabble.com.
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 >
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 > _________________________________= ______________
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 > Xen-devel mailing list
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 > [hidden email]
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 > http://lists.xensource.com/xen-devel
> =C2=A0 =C2=A0 = =C2=A0 =C2=A0=20
> =C2=A0 =C2=A0 =C2=A0 =C2=A0=20
> =C2=A0 =C2=A0 =C2=A0 =C2=A0=20
>=20



_________________________________= ______________
Xen-devel mailing list
[hidden email]=

=09
=09=09
If you reply to this email, your me= ssage will be added to the discussion below:
=09=09
ht= tp://xen.1045712.n5.nabble.com/HVM-hypercalls-tp2541346p4421864.html =09
=09
=09=09 =09=09To unsubscribe from HVM hypercalls, click here. =09

=09

View this message in context: Re: HVM hypercalls
Sent from the Xen - Dev mailing list archive at Nabble.com.
------=_Part_5548_24132814.1306245515188-- --===============1313111923== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============1313111923==--