mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
[IA64] Fix Vti
Use new foreign page mapping interface Signed-off-by: Xu Anthony <Anthony.xu@intel.com> Signed-off-by: Zhang Xiantao <xiantao.zhang@intel.com> Signed-off-by: Zhang Xin <xing.z.zhang@intel.com>
This commit is contained in:
1 parent
cd8fb13cb4
commit
75890339a9
2 files changed
+16
-41
No files matched your search
+12
-20
@@ -6378,6 +6378,10 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
#if defined (__ia64__)
|
||||
/* ram_size passed from xend has added on GFW memory,
|
||||
so we must subtract it here */
|
||||
ram_size -= 16 * MEM_M;
|
||||
|
||||
if (ram_size > MMIO_START)
|
||||
ram_size += 1 * MEM_G; /* skip 3G-4G MMIO, LEGACY_IO_SPACE etc. */
|
||||
#endif
|
||||
@@ -6443,36 +6447,24 @@ int main(int argc, char **argv)
|
||||
free(page_array);
|
||||
|
||||
#elif defined(__ia64__)
|
||||
|
||||
if (xc_ia64_get_pfn_list(xc_handle, domid, page_array,
|
||||
IO_PAGE_START >> PAGE_SHIFT, 3) != 3) {
|
||||
fprintf(logfile, "xc_ia64_get_pfn_list returned error %d\n", errno);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
shared_page = xc_map_foreign_range(xc_handle, domid, PAGE_SIZE,
|
||||
PROT_READ|PROT_WRITE,
|
||||
page_array[0]);
|
||||
|
||||
fprintf(logfile, "shared page at pfn:%lx, mfn: %016lx\n",
|
||||
IO_PAGE_START >> PAGE_SHIFT, page_array[0]);
|
||||
IO_PAGE_START >> PAGE_SHIFT);
|
||||
|
||||
buffered_io_page =xc_map_foreign_range(xc_handle, domid, PAGE_SIZE,
|
||||
PROT_READ|PROT_WRITE,
|
||||
page_array[2]);
|
||||
fprintf(logfile, "Buffered IO page at pfn:%lx, mfn: %016lx\n",
|
||||
BUFFER_IO_PAGE_START >> PAGE_SHIFT, page_array[2]);
|
||||
|
||||
if (xc_ia64_get_pfn_list(xc_handle, domid,
|
||||
page_array, 0, nr_pages) != nr_pages) {
|
||||
fprintf(logfile, "xc_ia64_get_pfn_list returned error %d\n", errno);
|
||||
exit(-1);
|
||||
}
|
||||
BUFFER_IO_PAGE_START >> PAGE_SHIFT);
|
||||
|
||||
for (i = 0; i < tmp_nr_pages; i++)
|
||||
page_array[i] = i;
|
||||
|
||||
/* VTI will not use memory between 3G~4G, so we just pass a legal pfn
|
||||
to make QEMU map continuous virtual memory space */
|
||||
if (ram_size > MMIO_START) {
|
||||
for (i = 0 ; i < (MEM_G >> PAGE_SHIFT); i++)
|
||||
page_array[(MMIO_START >> PAGE_SHIFT) + i] =
|
||||
page_array[(IO_PAGE_START >> PAGE_SHIFT) + 1];
|
||||
(STORE_PAGE_START >> PAGE_SHIFT);
|
||||
}
|
||||
|
||||
phys_ram_base = xc_map_foreign_batch(xc_handle, domid,
|
||||
|
||||
@@ -13,32 +13,15 @@ xc_ia64_copy_to_domain_pages(int xc_handle, uint32_t domid, void* src_page,
|
||||
unsigned long dst_pfn, int nr_pages)
|
||||
{
|
||||
// N.B. gva should be page aligned
|
||||
|
||||
xen_pfn_t *page_array = NULL;
|
||||
int i;
|
||||
|
||||
page_array = malloc(nr_pages * sizeof(xen_pfn_t));
|
||||
if (page_array == NULL) {
|
||||
PERROR("Could not allocate memory");
|
||||
goto error_out;
|
||||
}
|
||||
if (xc_ia64_get_pfn_list(xc_handle, domid, page_array,
|
||||
dst_pfn, nr_pages) != nr_pages) {
|
||||
PERROR("Could not get the page frame list");
|
||||
goto error_out;
|
||||
}
|
||||
|
||||
for (i = 0; i < nr_pages; i++) {
|
||||
if (xc_copy_to_domain_page(xc_handle, domid, page_array[i],
|
||||
if (xc_copy_to_domain_page(xc_handle, domid, dst_pfn + i,
|
||||
src_page + (i << PAGE_SHIFT)))
|
||||
goto error_out;
|
||||
return -1;
|
||||
}
|
||||
free(page_array);
|
||||
return 0;
|
||||
|
||||
error_out:
|
||||
free(page_array);
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
@@ -657,7 +640,7 @@ setup_guest(int xc_handle, uint32_t dom, unsigned long memsize,
|
||||
rc = xc_domain_memory_populate_physmap(xc_handle, dom, 3,
|
||||
0, 0, &pfn_list[nr_pages - 3]);
|
||||
if (rc != 0) {
|
||||
PERROR("Could not allocate GFW memory for Vti guest.\n");
|
||||
PERROR("Could not allocate IO page or store page or buffer io page.\n");
|
||||
goto error_out;
|
||||
}
|
||||
|
||||
|
||||