|
45 | 45 | #define VHOST_SET_LOG_BASE _IOW(VHOST_VIRTIO, 0x04, __u64)
|
46 | 46 | /* Specify an eventfd file descriptor to signal on log write. */
|
47 | 47 | #define VHOST_SET_LOG_FD _IOW(VHOST_VIRTIO, 0x07, int)
|
| 48 | +/* By default, a device gets one vhost_worker that its virtqueues share. This |
| 49 | + * command allows the owner of the device to create an additional vhost_worker |
| 50 | + * for the device. It can later be bound to 1 or more of its virtqueues using |
| 51 | + * the VHOST_ATTACH_VRING_WORKER command. |
| 52 | + * |
| 53 | + * This must be called after VHOST_SET_OWNER and the caller must be the owner |
| 54 | + * of the device. The new thread will inherit caller's cgroups and namespaces, |
| 55 | + * and will share the caller's memory space. The new thread will also be |
| 56 | + * counted against the caller's RLIMIT_NPROC value. |
| 57 | + * |
| 58 | + * The worker's ID used in other commands will be returned in |
| 59 | + * vhost_worker_state. |
| 60 | + */ |
| 61 | +#define VHOST_NEW_WORKER _IOR(VHOST_VIRTIO, 0x8, struct vhost_worker_state) |
| 62 | +/* Free a worker created with VHOST_NEW_WORKER if it's not attached to any |
| 63 | + * virtqueue. If userspace is not able to call this for workers its created, |
| 64 | + * the kernel will free all the device's workers when the device is closed. |
| 65 | + */ |
| 66 | +#define VHOST_FREE_WORKER _IOW(VHOST_VIRTIO, 0x9, struct vhost_worker_state) |
48 | 67 |
|
49 | 68 | /* Ring setup. */
|
50 | 69 | /* Set number of descriptors in ring. This parameter can not
|
|
70 | 89 | #define VHOST_VRING_BIG_ENDIAN 1
|
71 | 90 | #define VHOST_SET_VRING_ENDIAN _IOW(VHOST_VIRTIO, 0x13, struct vhost_vring_state)
|
72 | 91 | #define VHOST_GET_VRING_ENDIAN _IOW(VHOST_VIRTIO, 0x14, struct vhost_vring_state)
|
| 92 | +/* Attach a vhost_worker created with VHOST_NEW_WORKER to one of the device's |
| 93 | + * virtqueues. |
| 94 | + * |
| 95 | + * This will replace the virtqueue's existing worker. If the replaced worker |
| 96 | + * is no longer attached to any virtqueues, it can be freed with |
| 97 | + * VHOST_FREE_WORKER. |
| 98 | + */ |
| 99 | +#define VHOST_ATTACH_VRING_WORKER _IOW(VHOST_VIRTIO, 0x15, \ |
| 100 | + struct vhost_vring_worker) |
| 101 | +/* Return the vring worker's ID */ |
| 102 | +#define VHOST_GET_VRING_WORKER _IOWR(VHOST_VIRTIO, 0x16, \ |
| 103 | + struct vhost_vring_worker) |
73 | 104 |
|
74 | 105 | /* The following ioctls use eventfd file descriptors to signal and poll
|
75 | 106 | * for events. */
|
|
0 commit comments