1 #ifndef __V3_IO_CHAN_H__
2 #define __V3_IO_CHAN_H__
4 #ifndef __V3_PAL_SIDE__
6 #define PALACIOS_HOST_DEV_USER_REQUEST_READ_GUEST 1
7 #define PALACIOS_HOST_DEV_USER_REQUEST_WRITE_GUEST 2
8 #define PALACIOS_HOST_DEV_USER_REQUEST_IRQ_GUEST 3
10 #define PALACIOS_HOST_DEV_HOST_REQUEST_READ_IO 1
11 #define PALACIOS_HOST_DEV_HOST_REQUEST_WRITE_IO 2
12 #define PALACIOS_HOST_DEV_HOST_REQUEST_READ_MEM 3
13 #define PALACIOS_HOST_DEV_HOST_REQUEST_WRITE_MEM 4
14 #define PALACIOS_HOST_DEV_HOST_REQUEST_READ_CONF 5
15 #define PALACIOS_HOST_DEV_HOST_REQUEST_WRITE_CONF 6
17 struct palacios_host_dev_user_op {
18 uint32_t type; // type of operation (from the #defs above)
19 void *gpa; // physical address in guest to read or write
20 void *data; // user address of data that will be read or written
21 uint64_t len; // number of bytes to move
22 uint8_t irq; // irq to inject
26 struct palacios_host_dev_host_request_response {
27 // data_len must remain the first field in this structure
28 uint64_t data_len; // size of the structure + occupied data
29 uint64_t len; // size of the structure in total
30 uint32_t type; // one of the types given above
31 uint16_t port; // port number, for IO
32 void *gpa; // physical address in the guest for memory ops
33 uint64_t conf_addr; // address in the configuration for configuration ops
35 uint64_t op_len; // response: bytes read/written to the device
36 // request: bytes to read/write
38 uint8_t data[0]; // data (if any)
43 typedef struct palacios_host_dev_host_request_response pal_ioreq_t;
44 typedef struct palacios_host_dev_host_request_response pal_ioresp_t;
46 typedef long v3_io_chan_handle_t;
48 v3_io_chan_handle_t v3_io_chan_open (char * url, char * vmdev);
49 int v3_has_ioreq (v3_io_chan_handle_t chan);
50 void v3_io_chan_close(v3_io_chan_handle_t chan);
51 int v3_get_ioreq (v3_io_chan_handle_t chan, pal_ioresp_t ** req);
52 int v3_push_ioresp (v3_io_chan_handle_t chan, pal_ioresp_t * resp);
53 int v3_raise_pal_irq (v3_io_chan_handle_t chan, uint8_t irq);
54 int v3_lower_pal_irq (v3_io_chan_handle_t chan, uint8_t irq);
55 void v3_free_req_resp (pal_ioreq_t * reqresp);
56 uint64_t v3_read_guest_mem(v3_io_chan_handle_t chan, void *gpa, void * dest, uint64_t len);
57 uint64_t v3_write_guest_mem(v3_io_chan_handle_t chan, void *gpa, void *src, uint64_t len);