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