# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1205852433 0
# Node ID c978ecfc4f41a1dced268ff31f377156d392aaf2
# Parent 13cba2e78a65f636f3b0aeb0af5a3cfd291f7c04
libxc: Variable-size gntdev support
This patch adds the ability to set the number of slots that may be
used for mapping grant references, using the gntdev user-space grant
reference mapping driver.
Signed-off-by: Derek Murray <Derek.Murray@xxxxxxxxxxxx>
---
tools/include/xen-sys/Linux/gntdev.h | 14 ++++++++++++++
tools/libxc/xc_linux.c | 15 ++++++++++++++-
tools/libxc/xenctrl.h | 16 +++++++++++++++-
3 files changed, 43 insertions(+), 2 deletions(-)
diff -r 13cba2e78a65 -r c978ecfc4f41 tools/include/xen-sys/Linux/gntdev.h
--- a/tools/include/xen-sys/Linux/gntdev.h Tue Mar 18 14:55:36 2008 +0000
+++ b/tools/include/xen-sys/Linux/gntdev.h Tue Mar 18 15:00:33 2008 +0000
@@ -102,4 +102,18 @@ struct ioctl_gntdev_get_offset_for_vaddr
uint32_t pad;
};
+/*
+ * Sets the maximum number of grants that may mapped at once by this gntdev
+ * instance.
+ *
+ * N.B. This must be called before any other ioctl is performed on the device.
+ */
+#define IOCTL_GNTDEV_SET_MAX_GRANTS \
+_IOC(_IOC_NONE, 'G', 3, sizeof(struct ioctl_gntdev_set_max_grants))
+struct ioctl_gntdev_set_max_grants {
+ /* IN parameter */
+ /* The maximum number of grants that may be mapped at once. */
+ uint32_t count;
+};
+
#endif /* __LINUX_PUBLIC_GNTDEV_H__ */
diff -r 13cba2e78a65 -r c978ecfc4f41 tools/libxc/xc_linux.c
--- a/tools/libxc/xc_linux.c Tue Mar 18 14:55:36 2008 +0000
+++ b/tools/libxc/xc_linux.c Tue Mar 18 15:00:33 2008 +0000
@@ -4,7 +4,7 @@
* Use is subject to license terms.
*
* xc_gnttab functions:
- * Copyright (c) 2007, D G Murray <Derek.Murray@xxxxxxxxxxxx>
+ * Copyright (c) 2007-2008, D G Murray <Derek.Murray@xxxxxxxxxxxx>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -505,6 +505,19 @@ int xc_gnttab_munmap(int xcg_handle,
return 0;
}
+int xc_gnttab_set_max_grants(int xcg_handle,
+ uint32_t count)
+{
+ struct ioctl_gntdev_set_max_grants set_max;
+ int rc;
+
+ set_max.count = count;
+ if ( (rc = ioctl(xcg_handle, IOCTL_GNTDEV_SET_MAX_GRANTS, &set_max)) )
+ return rc;
+
+ return 0;
+}
+
/*
* Local variables:
* mode: C
diff -r 13cba2e78a65 -r c978ecfc4f41 tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h Tue Mar 18 14:55:36 2008 +0000
+++ b/tools/libxc/xenctrl.h Tue Mar 18 15:00:33 2008 +0000
@@ -6,7 +6,7 @@
* Copyright (c) 2003-2004, K A Fraser.
*
* xc_gnttab functions:
- * Copyright (c) 2007, D G Murray <Derek.Murray@xxxxxxxxxxxx>
+ * Copyright (c) 2007-2008, D G Murray <Derek.Murray@xxxxxxxxxxxx>
*/
#ifndef XENCTRL_H
@@ -832,6 +832,20 @@ int xc_gnttab_munmap(int xcg_handle,
void *start_address,
uint32_t count);
+/*
+ * Sets the maximum number of grants that may be mapped by the given instance
+ * to @count.
+ *
+ * N.B. This function must be called after opening the handle, and before any
+ * other functions are invoked on it.
+ *
+ * N.B. When variable-length grants are mapped, fragmentation may be observed,
+ * and it may not be possible to satisfy requests up to the maximum number
+ * of grants.
+ */
+int xc_gnttab_set_max_grants(int xcg_handle,
+ uint32_t count);
+
int xc_hvm_set_pci_intx_level(
int xc_handle, domid_t dom,
uint8_t domain, uint8_t bus, uint8_t device, uint8_t intx,
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|