Re: [Xen-devel] Re: HVM hypercalls
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?
Could you please share any sample code if you have to get a clear understanding of HVM hypercalls.
unsigned int msr1;
unsigned long my_hpage_phys;
int my_hpage_lo, my_hpage_hi;
: "=b" (*(int *)(&id)),
"=d" (*(int *)(&id)),
"=c" (*(int *)(&id))
: "a" (0x40000000)
printk("CPU ID read- %s\n", id);
/* Read MSR register */
: "=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);
================= 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,
On Mon, May 23, 2011 at 1:52 PM, Ian Campbell <Ian.Campbell@xxxxxxxxxx>
On Mon, 2011-05-23 at 08:48 +0100, veeruyours wrote:That supposed GMFN (fff88001e925) looks an awful lot like a virtual
> 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
address and not a physical one to me, unless your guest really has >4TB
of RAM assigned...
Xen-devel mailing list