1 /*
2  * Intel MIC Platform Software Stack (MPSS)
3  *
4  * Copyright(c) 2013 Intel Corporation.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License, version 2, as
8  * published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * General Public License for more details.
14  *
15  * The full GNU General Public License is included in this distribution in
16  * the file called "COPYING".
17  *
18  * Intel MIC Host driver.
19  *
20  */
21 #ifndef _MIC_IOCTL_H_
22 #define _MIC_IOCTL_H_
23 
24 #include <linux/types.h>
25 
26 /*
27  * mic_copy - MIC virtio descriptor copy.
28  *
29  * @iov: An array of IOVEC structures containing user space buffers.
30  * @iovcnt: Number of IOVEC structures in iov.
31  * @vr_idx: The vring index.
32  * @update_used: A non zero value results in used index being updated.
33  * @out_len: The aggregate of the total length written to or read from
34  *	the virtio device.
35  */
36 struct mic_copy_desc {
37 #ifdef __KERNEL__
38 	struct iovec __user *iov;
39 #else
40 	struct iovec *iov;
41 #endif
42 	__u32 iovcnt;
43 	__u8 vr_idx;
44 	__u8 update_used;
45 	__u32 out_len;
46 };
47 
48 /*
49  * Add a new virtio device
50  * The (struct mic_device_desc *) pointer points to a device page entry
51  *	for the virtio device consisting of:
52  *	- struct mic_device_desc
53  *	- struct mic_vqconfig (num_vq of these)
54  *	- host and guest features
55  *	- virtio device config space
56  * The total size referenced by the pointer should equal the size returned
57  * by desc_size() in mic_common.h
58  */
59 #define MIC_VIRTIO_ADD_DEVICE _IOWR('s', 1, struct mic_device_desc *)
60 
61 /*
62  * Copy the number of entries in the iovec and update the used index
63  * if requested by the user.
64  */
65 #define MIC_VIRTIO_COPY_DESC	_IOWR('s', 2, struct mic_copy_desc *)
66 
67 /*
68  * Notify virtio device of a config change
69  * The (__u8 *) pointer points to config space values for the device
70  * as they should be written into the device page. The total size
71  * referenced by the pointer should equal the config_len field of struct
72  * mic_device_desc.
73  */
74 #define MIC_VIRTIO_CONFIG_CHANGE _IOWR('s', 5, __u8 *)
75 
76 #endif
77