xref: /openbmc/linux/include/xen/interface/io/pvcalls.h (revision 60772e48)
1 #ifndef __XEN_PUBLIC_IO_XEN_PVCALLS_H__
2 #define __XEN_PUBLIC_IO_XEN_PVCALLS_H__
3 
4 #include <linux/net.h>
5 #include <xen/interface/io/ring.h>
6 #include <xen/interface/grant_table.h>
7 
8 /* "1" means socket, connect, release, bind, listen, accept and poll */
9 #define XENBUS_FUNCTIONS_CALLS "1"
10 
11 /*
12  * See docs/misc/pvcalls.markdown in xen.git for the full specification:
13  * https://xenbits.xen.org/docs/unstable/misc/pvcalls.html
14  */
15 struct pvcalls_data_intf {
16     RING_IDX in_cons, in_prod, in_error;
17 
18     uint8_t pad1[52];
19 
20     RING_IDX out_cons, out_prod, out_error;
21 
22     uint8_t pad2[52];
23 
24     RING_IDX ring_order;
25     grant_ref_t ref[];
26 };
27 DEFINE_XEN_FLEX_RING(pvcalls);
28 
29 #define PVCALLS_SOCKET         0
30 #define PVCALLS_CONNECT        1
31 #define PVCALLS_RELEASE        2
32 #define PVCALLS_BIND           3
33 #define PVCALLS_LISTEN         4
34 #define PVCALLS_ACCEPT         5
35 #define PVCALLS_POLL           6
36 
37 struct xen_pvcalls_request {
38     uint32_t req_id; /* private to guest, echoed in response */
39     uint32_t cmd;    /* command to execute */
40     union {
41         struct xen_pvcalls_socket {
42             uint64_t id;
43             uint32_t domain;
44             uint32_t type;
45             uint32_t protocol;
46         } socket;
47         struct xen_pvcalls_connect {
48             uint64_t id;
49             uint8_t addr[28];
50             uint32_t len;
51             uint32_t flags;
52             grant_ref_t ref;
53             uint32_t evtchn;
54         } connect;
55         struct xen_pvcalls_release {
56             uint64_t id;
57             uint8_t reuse;
58         } release;
59         struct xen_pvcalls_bind {
60             uint64_t id;
61             uint8_t addr[28];
62             uint32_t len;
63         } bind;
64         struct xen_pvcalls_listen {
65             uint64_t id;
66             uint32_t backlog;
67         } listen;
68         struct xen_pvcalls_accept {
69             uint64_t id;
70             uint64_t id_new;
71             grant_ref_t ref;
72             uint32_t evtchn;
73         } accept;
74         struct xen_pvcalls_poll {
75             uint64_t id;
76         } poll;
77         /* dummy member to force sizeof(struct xen_pvcalls_request)
78          * to match across archs */
79         struct xen_pvcalls_dummy {
80             uint8_t dummy[56];
81         } dummy;
82     } u;
83 };
84 
85 struct xen_pvcalls_response {
86     uint32_t req_id;
87     uint32_t cmd;
88     int32_t ret;
89     uint32_t pad;
90     union {
91         struct _xen_pvcalls_socket {
92             uint64_t id;
93         } socket;
94         struct _xen_pvcalls_connect {
95             uint64_t id;
96         } connect;
97         struct _xen_pvcalls_release {
98             uint64_t id;
99         } release;
100         struct _xen_pvcalls_bind {
101             uint64_t id;
102         } bind;
103         struct _xen_pvcalls_listen {
104             uint64_t id;
105         } listen;
106         struct _xen_pvcalls_accept {
107             uint64_t id;
108         } accept;
109         struct _xen_pvcalls_poll {
110             uint64_t id;
111         } poll;
112         struct _xen_pvcalls_dummy {
113             uint8_t dummy[8];
114         } dummy;
115     } u;
116 };
117 
118 DEFINE_RING_TYPES(xen_pvcalls, struct xen_pvcalls_request,
119                   struct xen_pvcalls_response);
120 
121 #endif
122