+int gnttab_resume(void)
+{
+ unsigned long frames;
+ struct xen_add_to_physmap xatp;
+ unsigned int i;
+
+ frames = alloc_xen_mmio(PAGE_SIZE * NR_GRANT_FRAMES);
+
+ for (i = 0; i < NR_GRANT_FRAMES; i++) {
+ xatp.domid = DOMID_SELF;
+ xatp.idx = i;
+ xatp.space = XENMAPSPACE_grant_table;
+ xatp.gpfn = (frames >> PAGE_SHIFT) + i;
+ if (HYPERVISOR_memory_op(XENMEM_add_to_physmap, &xatp))
+ BUG();
+ }
+
+ shared = ioremap(frames, PAGE_SIZE * NR_GRANT_FRAMES);
+ if (shared == NULL) {
+ printk("error to ioremap gnttab share frames\n");
+ return -1;
+ }
+
+ return 0;
+}
+
+int gnttab_suspend(void)
+{
+ iounmap(shared);