From: Konrad Rzeszutek Wilk Date: Wed, 13 Feb 2013 15:23:43 +0000 (-0500) Subject: Merge branch 'stable/pvh.v7' into stable/for-linus-3.9 X-Git-Tag: next-20130218~34^2~3^2~1 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=46d362eff6fd29fd6fa6a0ae31accbb309c034bd;p=karo-tx-linux.git Merge branch 'stable/pvh.v7' into stable/for-linus-3.9 * stable/pvh.v7: xen/pvh: Use ballooning to allocate grant table pages [v2] Revert "xen/pvh linux: Use ballooning to allocate grant table pages" xen/pvh linux: Use ballooning to allocate grant table pages xen/pvh: remove code to map iomem from guest Conflicts: drivers/xen/grant-table.c --- 46d362eff6fd29fd6fa6a0ae31accbb309c034bd diff --cc drivers/xen/grant-table.c index b6655a1f200c,45a33b4af006..a08a6247f857 --- a/drivers/xen/grant-table.c +++ b/drivers/xen/grant-table.c @@@ -1141,11 -1154,40 +1156,39 @@@ static void gnttab_request_version(void grant_table_version); } + /* + * PVH: we need three things: virtual address, pfns, and mfns. The pfns + * are allocated via ballooning, then we call arch_gnttab_map_shared to + * allocate the VA and put pfn's in the pte's for the VA. The mfn's are + * finally allocated in gnttab_map() by xen which also populates the P2M. + */ + static int xlated_setup_gnttab_pages(unsigned long numpages, void **addr) + { + int i, rc; + unsigned long pfns[numpages]; + struct page *pages[numpages]; + + rc = alloc_xenballooned_pages(numpages, pages, 0); + if (rc != 0) { + pr_warn("%s Couldn't balloon alloc %ld pfns rc:%d\n", __func__, + numpages, rc); + return rc; + } + for (i = 0; i < numpages; i++) + pfns[i] = page_to_pfn(pages[i]); + + rc = arch_gnttab_map_shared(pfns, numpages, numpages, addr); + if (rc != 0) + free_xenballooned_pages(numpages, pages); + + return rc; + } + -int gnttab_resume(void) +static int gnttab_setup(void) { + int rc; unsigned int max_nr_gframes; - char *kmsg = "Failed to kmalloc pages for pv in hvm grant frames\n"; - gnttab_request_version(); max_nr_gframes = gnttab_max_grant_frames(); if (max_nr_gframes < nr_grant_frames) return -ENOSYS;