Port-xen archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: [suspend/resume] memory_op hypercall failure: XENMEM_maximum_gpfn
Forgot the diff, sorry. Rookie mistake :/
See attach.
--
Jean-Yves Migeon
jean-yves.migeon%espci.fr@localhost
Index: arch/xen/xen/hypervisor.c
===================================================================
RCS file: /cvsroot/src/sys/arch/xen/xen/hypervisor.c,v
retrieving revision 1.36
diff -u -r1.36 hypervisor.c
--- arch/xen/xen/hypervisor.c 16 Apr 2008 18:41:48 -0000 1.36
+++ arch/xen/xen/hypervisor.c 22 May 2008 20:58:29 -0000
@@ -382,6 +382,43 @@
ctrl_if_register_receiver(CMSG_SHUTDOWN,
hypervisor_shutdown_handler, CALLBACK_IN_BLOCKING_CONTEXT);
#endif
+ int i, j;
+ int fpp;
+ unsigned long cur_pfn, max_pfn;
+ unsigned long * l3_p2m_page;
+ unsigned long * l2_p2m_page;
+
+#define vtomfn(va) xpmap_phys_to_machine_mapping[vtophys(va) >> PAGE_SHIFT]
+
+ max_pfn = xen_start_info.nr_pages;
+ fpp = PAGE_SIZE / sizeof(unsigned long);
+ l3_p2m_page = kmem_alloc(PAGE_SIZE, KM_NOSLEEP);
+ if (l3_p2m_page == NULL)
+ panic("Could not allocate memory for l3_p2m_page");
+
+ for (i = 0; i < fpp; i++) {
+ l2_p2m_page = kmem_alloc(PAGE_SIZE, KM_NOSLEEP);
+ if (l2_p2m_page == NULL)
+ panic("Could not allocate memory for l2_p2m_page");
+ l3_p2m_page[i] = vtomfn((vaddr_t)l2_p2m_page);
+
+ for (j = 0; j < fpp; j++) {
+ /*
+ * index of the pseudo L1 page we are adding
+ * to l2 page
+ */
+ cur_pfn = (i + j) * fpp;
+ if (cur_pfn >= max_pfn)
+ goto exit_p2m;
+ l2_p2m_page[j] =
vtomfn((vaddr_t)&xpmap_phys_to_machine_mapping[cur_pfn]);
+ }
+ }
+
+exit_p2m:
+ printf("Mapped in p2m: cur_pfn: %lu, max_pfn: %lu\n", cur_pfn, max_pfn);
+
+ HYPERVISOR_shared_info->arch.pfn_to_mfn_frame_list_list =
vtomfn((vaddr_t)l3_p2m_page);
+ HYPERVISOR_shared_info->arch.max_pfn = max_pfn;
}
static int
Home |
Main Index |
Thread Index |
Old Index