debuggers.hg
changeset 17270:c978ecfc4f41
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@cl.cam.ac.uk>
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@cl.cam.ac.uk>
author | Keir Fraser <keir.fraser@citrix.com> |
---|---|
date | Tue Mar 18 15:00:33 2008 +0000 (2008-03-18) |
parents | 13cba2e78a65 |
children | 64b19db801b6 |
files | tools/include/xen-sys/Linux/gntdev.h tools/libxc/xc_linux.c tools/libxc/xenctrl.h |
line diff
1.1 --- a/tools/include/xen-sys/Linux/gntdev.h Tue Mar 18 14:55:36 2008 +0000 1.2 +++ b/tools/include/xen-sys/Linux/gntdev.h Tue Mar 18 15:00:33 2008 +0000 1.3 @@ -102,4 +102,18 @@ struct ioctl_gntdev_get_offset_for_vaddr 1.4 uint32_t pad; 1.5 }; 1.6 1.7 +/* 1.8 + * Sets the maximum number of grants that may mapped at once by this gntdev 1.9 + * instance. 1.10 + * 1.11 + * N.B. This must be called before any other ioctl is performed on the device. 1.12 + */ 1.13 +#define IOCTL_GNTDEV_SET_MAX_GRANTS \ 1.14 +_IOC(_IOC_NONE, 'G', 3, sizeof(struct ioctl_gntdev_set_max_grants)) 1.15 +struct ioctl_gntdev_set_max_grants { 1.16 + /* IN parameter */ 1.17 + /* The maximum number of grants that may be mapped at once. */ 1.18 + uint32_t count; 1.19 +}; 1.20 + 1.21 #endif /* __LINUX_PUBLIC_GNTDEV_H__ */
2.1 --- a/tools/libxc/xc_linux.c Tue Mar 18 14:55:36 2008 +0000 2.2 +++ b/tools/libxc/xc_linux.c Tue Mar 18 15:00:33 2008 +0000 2.3 @@ -4,7 +4,7 @@ 2.4 * Use is subject to license terms. 2.5 * 2.6 * xc_gnttab functions: 2.7 - * Copyright (c) 2007, D G Murray <Derek.Murray@cl.cam.ac.uk> 2.8 + * Copyright (c) 2007-2008, D G Murray <Derek.Murray@cl.cam.ac.uk> 2.9 * 2.10 * This program is free software; you can redistribute it and/or 2.11 * modify it under the terms of the GNU General Public License as 2.12 @@ -505,6 +505,19 @@ int xc_gnttab_munmap(int xcg_handle, 2.13 return 0; 2.14 } 2.15 2.16 +int xc_gnttab_set_max_grants(int xcg_handle, 2.17 + uint32_t count) 2.18 +{ 2.19 + struct ioctl_gntdev_set_max_grants set_max; 2.20 + int rc; 2.21 + 2.22 + set_max.count = count; 2.23 + if ( (rc = ioctl(xcg_handle, IOCTL_GNTDEV_SET_MAX_GRANTS, &set_max)) ) 2.24 + return rc; 2.25 + 2.26 + return 0; 2.27 +} 2.28 + 2.29 /* 2.30 * Local variables: 2.31 * mode: C
3.1 --- a/tools/libxc/xenctrl.h Tue Mar 18 14:55:36 2008 +0000 3.2 +++ b/tools/libxc/xenctrl.h Tue Mar 18 15:00:33 2008 +0000 3.3 @@ -6,7 +6,7 @@ 3.4 * Copyright (c) 2003-2004, K A Fraser. 3.5 * 3.6 * xc_gnttab functions: 3.7 - * Copyright (c) 2007, D G Murray <Derek.Murray@cl.cam.ac.uk> 3.8 + * Copyright (c) 2007-2008, D G Murray <Derek.Murray@cl.cam.ac.uk> 3.9 */ 3.10 3.11 #ifndef XENCTRL_H 3.12 @@ -832,6 +832,20 @@ int xc_gnttab_munmap(int xcg_handle, 3.13 void *start_address, 3.14 uint32_t count); 3.15 3.16 +/* 3.17 + * Sets the maximum number of grants that may be mapped by the given instance 3.18 + * to @count. 3.19 + * 3.20 + * N.B. This function must be called after opening the handle, and before any 3.21 + * other functions are invoked on it. 3.22 + * 3.23 + * N.B. When variable-length grants are mapped, fragmentation may be observed, 3.24 + * and it may not be possible to satisfy requests up to the maximum number 3.25 + * of grants. 3.26 + */ 3.27 +int xc_gnttab_set_max_grants(int xcg_handle, 3.28 + uint32_t count); 3.29 + 3.30 int xc_hvm_set_pci_intx_level( 3.31 int xc_handle, domid_t dom, 3.32 uint8_t domain, uint8_t bus, uint8_t device, uint8_t intx,