diff options
author | Jan Beulich <jbeulich@suse.com> | 2012-05-14 16:20:33 +0100 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2012-05-14 16:20:33 +0100 |
commit | bc934837c2ac48e4b5ca05b6e397f7f9f780ff82 (patch) | |
tree | 0209bcfdb8772702ade1500b6ceb93b7cdc02c49 /tools/libxc | |
parent | 688e95c3b338a33c73ae8493c823a98c3ebe7e86 (diff) | |
download | xen-bc934837c2ac48e4b5ca05b6e397f7f9f780ff82.tar.gz xen-bc934837c2ac48e4b5ca05b6e397f7f9f780ff82.tar.bz2 xen-bc934837c2ac48e4b5ca05b6e397f7f9f780ff82.zip |
libxc: implement gnttab.set_max_grants for Linux
Legacy (non-pvops) gntdev drivers may require this operation to be
performed when the number of grants intended to be used simultaneously
exceeds a certain driver specific default limit, and qemu's qdisk
driver is an example of needing to do so.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/libxc')
-rw-r--r-- | tools/libxc/xc_linux_osdep.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/libxc/xc_linux_osdep.c b/tools/libxc/xc_linux_osdep.c index b2c5449918..471cec5f3f 100644 --- a/tools/libxc/xc_linux_osdep.c +++ b/tools/libxc/xc_linux_osdep.c @@ -559,6 +559,27 @@ static int linux_gnttab_close(xc_gnttab *xcg, xc_osdep_handle h) return close(fd); } +static int linux_gnttab_set_max_grants(xc_gnttab *xch, xc_osdep_handle h, + uint32_t count) +{ + int fd = (int)h, rc; + struct ioctl_gntdev_set_max_grants max_grants = { .count = count }; + + rc = ioctl(fd, IOCTL_GNTDEV_SET_MAX_GRANTS, &max_grants); + if (rc) { + /* + * Newer (e.g. pv-ops) kernels don't implement this IOCTL, + * so ignore the resulting specific failure. + */ + if (errno == ENOTTY) + rc = 0; + else + PERROR("linux_gnttab_set_max_grants: ioctl SET_MAX_GRANTS failed"); + } + + return rc; +} + static void *linux_gnttab_grant_map(xc_gnttab *xch, xc_osdep_handle h, uint32_t count, int flags, int prot, uint32_t *domids, uint32_t *refs, @@ -714,6 +735,7 @@ static struct xc_osdep_ops linux_gnttab_ops = { .close = &linux_gnttab_close, .u.gnttab = { + .set_max_grants = linux_gnttab_set_max_grants, .grant_map = &linux_gnttab_grant_map, .munmap = &linux_gnttab_munmap, }, |