Skip to content

Commit 164666f

Browse files
DemiMariejgross1
authored andcommitted
Improve docs for IOCTL_GNTDEV_MAP_GRANT_REF
--------------cKY3Ggs6VDUCSn4I6iN78sHA Content-Type: multipart/mixed; boundary="------------g0T69ASidFiPhh4eOY4XzIg1" --------------g0T69ASidFiPhh4eOY4XzIg1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable The current implementation of gntdev guarantees that the first call to IOCTL_GNTDEV_MAP_GRANT_REF will set @index to 0. This is required to use gntdev for Wayland, which is a future desire of Qubes OS. Additionally, requesting zero grants results in an error, but this was not documented either. Document both of these. Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com> Reviewed-by: Juergen Gross <jgross@suse.com> Link: https://lore.kernel.org/r/f66c5a4e-2034-00b5-a635-6983bd999c07@gmail.com Signed-off-by: Juergen Gross <jgross@suse.com>
1 parent 4564661 commit 164666f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

include/uapi/xen/gntdev.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,13 @@ struct ioctl_gntdev_grant_ref {
4747
/*
4848
* Inserts the grant references into the mapping table of an instance
4949
* of gntdev. N.B. This does not perform the mapping, which is deferred
50-
* until mmap() is called with @index as the offset.
50+
* until mmap() is called with @index as the offset. @index should be
51+
* considered opaque to userspace, with one exception: if no grant
52+
* references have ever been inserted into the mapping table of this
53+
* instance, @index will be set to 0. This is necessary to use gntdev
54+
* with userspace APIs that expect a file descriptor that can be
55+
* mmap()'d at offset 0, such as Wayland. If @count is set to 0, this
56+
* ioctl will fail.
5157
*/
5258
#define IOCTL_GNTDEV_MAP_GRANT_REF \
5359
_IOC(_IOC_NONE, 'G', 0, sizeof(struct ioctl_gntdev_map_grant_ref))

0 commit comments

Comments
 (0)