@@ -1387,16 +1387,6 @@ void *xc_map_foreign_pages(xc_interface *xch, uint32_t dom, int prot,
const xen_pfn_t *arr, int num );
/**
- * DEPRECATED - use xc_map_foreign_bulk() instead.
- *
- * Like xc_map_foreign_pages(), except it can succeeed partially.
- * When a page cannot be mapped, its PFN in @arr is or'ed with
- * 0xF0000000 to indicate the error.
- */
-void *xc_map_foreign_batch(xc_interface *xch, uint32_t dom, int prot,
- xen_pfn_t *arr, int num );
-
-/**
* Like xc_map_foreign_pages(), except it can succeed partially.
* When a page cannot be mapped, its respective field in @err is
* set to the corresponding errno value.
@@ -55,6 +55,8 @@ void *xc_map_foreign_pages(xc_interface *xch, uint32_t dom, int prot,
* just implement xc_map_foreign_bulk.
*/
#if defined(__NetBSD__) || defined(__sun__)
+void *osdep_map_foreign_batch(xc_interface *xch, uint32_t dom, int prot,
+ xen_pfn_t *arr, int num );
void *xc_map_foreign_bulk(xc_interface *xch,
uint32_t dom, int prot,
const xen_pfn_t *arr, int *err, unsigned int num)
@@ -75,7 +77,7 @@ void *xc_map_foreign_bulk(xc_interface *xch,
}
memcpy(pfn, arr, num * sizeof(*arr));
- ret = xc_map_foreign_batch(xch, dom, prot, pfn, num);
+ ret = osdep_map_foreign_batch(xch, dom, prot, pfn, num);
if (ret) {
for (i = 0; i < num; ++i)
@@ -91,8 +91,8 @@ int osdep_privcmd_close(xc_interface *xch)
return close(fd);
}
-static int xc_map_foreign_batch_single(int fd, uint32_t dom,
- xen_pfn_t *mfn, unsigned long addr)
+static int map_foreign_batch_single(int fd, uint32_t dom,
+ xen_pfn_t *mfn, unsigned long addr)
{
privcmd_mmapbatch_t ioctlx;
int rc;
@@ -113,59 +113,6 @@ static int xc_map_foreign_batch_single(int fd, uint32_t dom,
return rc;
}
-void *xc_map_foreign_batch(xc_interface *xch,
- uint32_t dom, int prot,
- xen_pfn_t *arr, int num)
-{
- int fd = xch->privcmdfd;
- privcmd_mmapbatch_t ioctlx;
- void *addr;
- int rc;
-
- addr = mmap(NULL, num << XC_PAGE_SHIFT, prot, MAP_SHARED, fd, 0);
- if ( addr == MAP_FAILED )
- {
- PERROR("xc_map_foreign_batch: mmap failed");
- return NULL;
- }
-
- ioctlx.num = num;
- ioctlx.dom = dom;
- ioctlx.addr = (unsigned long)addr;
- ioctlx.arr = arr;
-
- rc = ioctl(fd, IOCTL_PRIVCMD_MMAPBATCH, &ioctlx);
- if ( (rc < 0) && (errno == ENOENT) )
- {
- int i;
-
- for ( i = 0; i < num; i++ )
- {
- if ( (arr[i] & PRIVCMD_MMAPBATCH_MFN_ERROR) ==
- PRIVCMD_MMAPBATCH_PAGED_ERROR )
- {
- unsigned long paged_addr = (unsigned long)addr + (i << XC_PAGE_SHIFT);
- rc = xc_map_foreign_batch_single(fd, dom, &arr[i],
- paged_addr);
- if ( rc < 0 )
- goto out;
- }
- }
- }
-
- out:
- if ( rc < 0 )
- {
- int saved_errno = errno;
- PERROR("xc_map_foreign_batch: ioctl failed");
- (void)munmap(addr, num << XC_PAGE_SHIFT);
- errno = saved_errno;
- return NULL;
- }
-
- return addr;
-}
-
/*
* Retry mmap of all paged gfns in batches
* retuns < 0 on fatal error
@@ -305,7 +252,7 @@ void *xc_map_foreign_bulk(xc_interface *xch,
err[i] = rc ?: -EINVAL;
continue;
}
- rc = xc_map_foreign_batch_single(fd, dom, pfn + i,
+ rc = map_foreign_batch_single(fd, dom, pfn + i,
(unsigned long)addr + ((unsigned long)i<<XC_PAGE_SHIFT));
if ( rc < 0 )
{
@@ -73,28 +73,6 @@ void *xc_map_foreign_bulk(xc_interface *xch,
return map_frames_ex(arr, num, 1, 0, 1, dom, err, pt_prot);
}
-void *xc_map_foreign_batch(xc_interface *xch,
- uint32_t dom, int prot,
- xen_pfn_t *arr, int num)
-{
- unsigned long pt_prot = 0;
- int err[num];
- int i;
- unsigned long addr;
-
- if (prot & PROT_READ)
- pt_prot = L1_PROT_RO;
- if (prot & PROT_WRITE)
- pt_prot = L1_PROT;
-
- addr = (unsigned long) map_frames_ex(arr, num, 1, 0, 1, dom, err, pt_prot);
- for (i = 0; i < num; i++) {
- if (err[i])
- arr[i] |= 0xF0000000;
- }
- return (void *) addr;
-}
-
void *xc_map_foreign_range(xc_interface *xch,
uint32_t dom,
int size, int prot,
@@ -67,16 +67,16 @@ int osdep_privcmd_close(xc_interface *xch)
return close(fd);
}
-void *xc_map_foreign_batch(xc_interface *xch,
- uint32_t dom, int prot,
- xen_pfn_t *arr, int num)
+void *osdep_map_foreign_batch(xc_interface *xch,
+ uint32_t dom, int prot,
+ xen_pfn_t *arr, int num)
{
int fd = xch->privcmdfd;
privcmd_mmapbatch_t ioctlx;
void *addr;
addr = mmap(NULL, num*XC_PAGE_SIZE, prot, MAP_ANON | MAP_SHARED, -1, 0);
if ( addr == MAP_FAILED ) {
- PERROR("xc_map_foreign_batch: mmap failed");
+ PERROR("osdep_map_foreign_batch: mmap failed");
return NULL;
}
@@ -87,7 +87,7 @@ void *xc_map_foreign_batch(xc_interface *xch,
if ( ioctl(fd, IOCTL_PRIVCMD_MMAPBATCH, &ioctlx) < 0 )
{
int saved_errno = errno;
- PERROR("xc_map_foreign_batch: ioctl failed");
+ PERROR("osdep_map_foreign_batch: ioctl failed");
(void)munmap(addr, num*XC_PAGE_SIZE);
errno = saved_errno;
return NULL;
@@ -67,9 +67,9 @@ int osdep_privcmd_close(xc_interface *xch)
return close(fd);
}
-void *xc_map_foreign_batch(xc_interface *xch,
- uint32_t dom, int prot,
- xen_pfn_t *arr, int num)
+void *osdep_map_foreign_batch(xc_interface *xch,
+ uint32_t dom, int prot,
+ xen_pfn_t *arr, int num)
{
int fd = xch->privcmdfd;
privcmd_mmapbatch_t ioctlx;
@@ -72,9 +72,9 @@ void *xc_vm_event_enable(xc_interface *xch, domid_t domain_id, int param,
ring_pfn = pfn;
mmap_pfn = pfn;
- ring_page = xc_map_foreign_batch(xch, domain_id, PROT_READ | PROT_WRITE,
+ ring_page = xc_map_foreign_pages(xch, domain_id, PROT_READ | PROT_WRITE,
&mmap_pfn, 1);
- if ( mmap_pfn & XEN_DOMCTL_PFINFO_XTAB )
+ if ( !ring_page )
{
/* Map failed, populate ring page */
rc1 = xc_domain_populate_physmap_exact(xch, domain_id, 1, 0, 0,
@@ -86,9 +86,9 @@ void *xc_vm_event_enable(xc_interface *xch, domid_t domain_id, int param,
}
mmap_pfn = ring_pfn;
- ring_page = xc_map_foreign_batch(xch, domain_id, PROT_READ | PROT_WRITE,
+ ring_page = xc_map_foreign_pages(xch, domain_id, PROT_READ | PROT_WRITE,
&mmap_pfn, 1);
- if ( mmap_pfn & XEN_DOMCTL_PFINFO_XTAB )
+ if ( !ring_page )
{
PERROR("Could not map the ring page\n");
goto out;
@@ -156,3 +156,13 @@ void *xc_vm_event_enable(xc_interface *xch, domid_t domain_id, int param,
return ring_page;
}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
@@ -411,7 +411,7 @@ static struct t_struct *map_tbufs(unsigned long tbufs_mfn, unsigned int num,
for ( j=0; j<tbufs.t_info->tbuf_size; j++)
pfn_list[j] = (xen_pfn_t)mfn_list[j];
- tbufs.meta[i] = xc_map_foreign_batch(xc_handle, DOMID_XEN,
+ tbufs.meta[i] = xc_map_foreign_pages(xc_handle, DOMID_XEN,
PROT_READ | PROT_WRITE,
pfn_list,
tbufs.t_info->tbuf_size);
@@ -1175,3 +1175,13 @@ static int process_record(int cpu, struct t_rec *r)
return 4 + (r->cycles_included ? 8 : 0) + (r->extra_u32 * 4);
}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
@@ -342,9 +342,9 @@ static struct xenpaging *xenpaging_init(int argc, char *argv[])
HVM_PARAM_PAGING_RING_PFN, &ring_pfn);
mmap_pfn = ring_pfn;
paging->vm_event.ring_page =
- xc_map_foreign_batch(xch, paging->vm_event.domain_id,
- PROT_READ | PROT_WRITE, &mmap_pfn, 1);
- if ( mmap_pfn & XEN_DOMCTL_PFINFO_XTAB )
+ xc_map_foreign_pages(xch, paging->vm_event.domain_id,
+ PROT_READ | PROT_WRITE, &mmap_pfn, 1);
+ if ( !paging->vm_event.ring_page )
{
/* Map failed, populate ring page */
rc = xc_domain_populate_physmap_exact(paging->xc_handle,
@@ -356,11 +356,11 @@ static struct xenpaging *xenpaging_init(int argc, char *argv[])
goto err;
}
- mmap_pfn = ring_pfn;
paging->vm_event.ring_page =
- xc_map_foreign_batch(xch, paging->vm_event.domain_id,
- PROT_READ | PROT_WRITE, &mmap_pfn, 1);
- if ( mmap_pfn & XEN_DOMCTL_PFINFO_XTAB )
+ xc_map_foreign_pages(xch, paging->vm_event.domain_id,
+ PROT_READ | PROT_WRITE,
+ &mmap_pfn, 1);
+ if ( !paging->vm_event.ring_page )
{
PERROR("Could not map the ring page\n");
goto err;
@@ -508,7 +508,7 @@ static struct t_struct *map_tbufs(unsigned long tbufs_mfn, unsigned int num,
for ( j=0; j<tbufs.t_info->tbuf_size; j++)
pfn_list[j] = (xen_pfn_t)mfn_list[j];
- tbufs.meta[i] = xc_map_foreign_batch(xc_handle, DOMID_XEN,
+ tbufs.meta[i] = xc_map_foreign_pages(xc_handle, DOMID_XEN,
PROT_READ | PROT_WRITE,
pfn_list,
tbufs.t_info->tbuf_size);
@@ -1221,6 +1221,7 @@ int main(int argc, char **argv)
return ret;
}
+
/*
* Local variables:
* mode: C