Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Merge branch 'devel' of newskysaw.cs.northwestern.edu:/home/palacios/palacios into...
[palacios.git] / linux_module / iface-host-dev.h
1 #ifndef _PALACIOS_HOST_DEV_USER_H_
2 #define _PALACIOS_HOST_DEV_USER_H_
3
4 /*
5  * Palacios Host Device Interface + User-space interface 
6  * (c) Peter Dinda, 2011
7  */
8
9
10 #define V3_VM_HOST_DEV_CONNECT (10244+1)
11
12 /* to detemine whether a host request is available, poll the fd for read */
13
14 /* make a request for reading/writing guest or injecting irq */
15 /* the arguemnt is a pointer to a palacios_host_dev_user_op struct */
16 /* return is negative on error, positive to indicate bytes read/written or irq injected*/
17 #define V3_HOST_DEV_USER_REQUEST_PUSH_IOCTL  (10244+2)
18
19 /* find out the size of the current host request, if one is pending */
20 /* you find out if one is pending by read poll/select on the fd */
21 /* the argument is a pointer to a uint64_t that will give the total size */
22 /* ioctl returns 1 if a request is ready, 0 if there is no request */
23 /* -EFAULT if there is a an error */
24 #define V3_HOST_DEV_HOST_REQUEST_SIZE_IOCTL  (10244+3)
25
26 /* get the current host request, if one is available */
27 /* the argument is a pointer to a palacios_host_dev_host_request_response */
28 /* of the needed size */
29 /* ioctl returns 1 if a request is ready+copied, 0 if there is no request */
30 /* -EFAULT if there is a an error */
31 #define V3_HOST_DEV_HOST_REQUEST_PULL_IOCTL  (10244+4)
32
33 /* write back the response to the previously pulled host request */
34 /* the argument is a pointer to a palacios_host_dev_host_request_response */
35 #define V3_HOST_DEV_USER_RESPONSE_PUSH_IOCTL (10244+5)
36
37
38 #ifdef __KERNEL__
39 #define USER __user
40 #else
41 #define USER
42 #endif
43
44 struct palacios_host_dev_user_op {
45 #define PALACIOS_HOST_DEV_USER_REQUEST_READ_GUEST  1
46 #define PALACIOS_HOST_DEV_USER_REQUEST_WRITE_GUEST 2
47 #define PALACIOS_HOST_DEV_USER_REQUEST_IRQ_GUEST   3
48     uint32_t        type;   // type of operation (from the #defs above)
49     void            *gpa;   // physical address in guest to read or write
50     void USER      *data;   // user address of data that will be read or written
51     uint64_t        len;    // number of bytes to move
52
53     uint8_t         irq;    // irq to inject
54 };
55
56
57 struct palacios_host_dev_host_request_response {
58     // data_len must remain the first field in this structure
59     uint64_t  data_len;    // size of the structure + occupied data
60     uint64_t  len;         // size of the structure in total
61 #define PALACIOS_HOST_DEV_HOST_REQUEST_READ_IO     1
62 #define PALACIOS_HOST_DEV_HOST_REQUEST_WRITE_IO    2
63 #define PALACIOS_HOST_DEV_HOST_REQUEST_READ_MEM    3
64 #define PALACIOS_HOST_DEV_HOST_REQUEST_WRITE_MEM   4
65 #define PALACIOS_HOST_DEV_HOST_REQUEST_READ_CONF   5
66 #define PALACIOS_HOST_DEV_HOST_REQUEST_WRITE_CONF  6
67     uint32_t  type;        // one of the types given above
68     uint16_t  port;        // port number, for IO
69     void      *gpa;         // physical address in the guest for memory ops
70     uint64_t  conf_addr;   // address in the configuration for configuration ops
71
72     uint64_t  op_len;      // response: bytes read/written to the device
73                            // request: bytes to read/write
74                             
75     uint8_t   data[0];     // data (if any)
76
77 } ;
78
79
80
81 #endif