aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc/xc_minios.c
diff options
context:
space:
mode:
authorDaniel De Graaf <dgdegra@tycho.nsa.gov>2011-10-06 19:28:53 +0100
committerDaniel De Graaf <dgdegra@tycho.nsa.gov>2011-10-06 19:28:53 +0100
commit1f5552006de96f879ea0bcf342dcf4d9b3b06354 (patch)
treeea023d0ddf2f20b6590c98f49c83fa4fdb811064 /tools/libxc/xc_minios.c
parentb7ee8d2f432f726a1154d172016d3f2b22757fe3 (diff)
downloadxen-1f5552006de96f879ea0bcf342dcf4d9b3b06354.tar.gz
xen-1f5552006de96f879ea0bcf342dcf4d9b3b06354.tar.bz2
xen-1f5552006de96f879ea0bcf342dcf4d9b3b06354.zip
libxc: add xc_gnttab_map_grant_ref_notify
Normally, when a userspace process mapping a grant crashes, the domain providing the reference receives no indication that its peer has crashed, possibly leading to unexpected freezes or timeouts. This function provides a notification of the unmap by signalling an event channel and/or clearing a specific byte in the page. This also unifies the 3 very similar grant-mapping osdep interfaces into a single function instead of introducing yet another minor variation. Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
Diffstat (limited to 'tools/libxc/xc_minios.c')
-rw-r--r--tools/libxc/xc_minios.c54
1 files changed, 15 insertions, 39 deletions
diff --git a/tools/libxc/xc_minios.c b/tools/libxc/xc_minios.c
index 3b366eb824..ff9c0d8d19 100644
--- a/tools/libxc/xc_minios.c
+++ b/tools/libxc/xc_minios.c
@@ -458,45 +458,23 @@ void minios_gnttab_close_fd(int fd)
files[fd].type = FTYPE_NONE;
}
-static void *minios_gnttab_map_grant_ref(xc_gnttab *xcg, xc_osdep_handle h,
- uint32_t domid,
- uint32_t ref,
- int prot)
-{
- int fd = (int)h;
- return gntmap_map_grant_refs(&files[fd].gntmap,
- 1,
- &domid, 0,
- &ref,
- prot & PROT_WRITE);
-}
-
-static void *minios_gnttab_map_grant_refs(xc_gnttab *xcg, xc_osdep_handle h,
- uint32_t count,
- uint32_t *domids,
- uint32_t *refs,
- int prot)
-{
- int fd = (int)h;
- return gntmap_map_grant_refs(&files[fd].gntmap,
- count,
- domids, 1,
- refs,
- prot & PROT_WRITE);
-}
-
-static void *minios_gnttab_map_domain_grant_refs(xc_gnttab *xcg, xc_osdep_handle h,
- uint32_t count,
- uint32_t domid,
- uint32_t *refs,
- int prot)
+static void *minios_gnttab_grant_map(xc_gnttab *xcg, xc_osdep_handle h,
+ uint32_t count, int flags, int prot,
+ uint32_t *domids, uint32_t *refs,
+ uint32_t notify_offset,
+ evtchn_port_t notify_port)
{
int fd = (int)h;
+ int stride = 1;
+ if (flags & XC_GRANT_MAP_SINGLE_DOMAIN)
+ stride = 0;
+ if (notify_offset != -1 || notify_port != -1) {
+ errno = ENOSYS;
+ return NULL;
+ }
return gntmap_map_grant_refs(&files[fd].gntmap,
- count,
- &domid, 0,
- refs,
- prot & PROT_WRITE);
+ count, domids, stride,
+ refs, prot & PROT_WRITE);
}
static int minios_gnttab_munmap(xc_gnttab *xcg, xc_osdep_handle h,
@@ -534,9 +512,7 @@ static struct xc_osdep_ops minios_gnttab_ops = {
.close = &minios_gnttab_close,
.u.gnttab = {
- .map_grant_ref = &minios_gnttab_map_grant_ref,
- .map_grant_refs = &minios_gnttab_map_grant_refs,
- .map_domain_grant_refs = &minios_gnttab_map_domain_grant_refs,
+ .grant_map = &minios_gnttab_grant_map,
.munmap = &minios_gnttab_munmap,
.set_max_grants = &minios_gnttab_set_max_grants,
},