1*9e2b3e83SJuergen Gross /* SPDX-License-Identifier: MIT */ 2*9e2b3e83SJuergen Gross 375e3ea5bSStefano Stabellini #ifndef __XEN_PUBLIC_IO_XEN_PVCALLS_H__ 475e3ea5bSStefano Stabellini #define __XEN_PUBLIC_IO_XEN_PVCALLS_H__ 575e3ea5bSStefano Stabellini 675e3ea5bSStefano Stabellini #include <linux/net.h> 775e3ea5bSStefano Stabellini #include <xen/interface/io/ring.h> 875e3ea5bSStefano Stabellini #include <xen/interface/grant_table.h> 975e3ea5bSStefano Stabellini 1075e3ea5bSStefano Stabellini /* "1" means socket, connect, release, bind, listen, accept and poll */ 1175e3ea5bSStefano Stabellini #define XENBUS_FUNCTIONS_CALLS "1" 1275e3ea5bSStefano Stabellini 1375e3ea5bSStefano Stabellini /* 1475e3ea5bSStefano Stabellini * See docs/misc/pvcalls.markdown in xen.git for the full specification: 1575e3ea5bSStefano Stabellini * https://xenbits.xen.org/docs/unstable/misc/pvcalls.html 1675e3ea5bSStefano Stabellini */ 1775e3ea5bSStefano Stabellini struct pvcalls_data_intf { 1875e3ea5bSStefano Stabellini RING_IDX in_cons, in_prod, in_error; 1975e3ea5bSStefano Stabellini 2075e3ea5bSStefano Stabellini uint8_t pad1[52]; 2175e3ea5bSStefano Stabellini 2275e3ea5bSStefano Stabellini RING_IDX out_cons, out_prod, out_error; 2375e3ea5bSStefano Stabellini 2475e3ea5bSStefano Stabellini uint8_t pad2[52]; 2575e3ea5bSStefano Stabellini 2675e3ea5bSStefano Stabellini RING_IDX ring_order; 2775e3ea5bSStefano Stabellini grant_ref_t ref[]; 2875e3ea5bSStefano Stabellini }; 2975e3ea5bSStefano Stabellini DEFINE_XEN_FLEX_RING(pvcalls); 3075e3ea5bSStefano Stabellini 3175e3ea5bSStefano Stabellini #define PVCALLS_SOCKET 0 3275e3ea5bSStefano Stabellini #define PVCALLS_CONNECT 1 3375e3ea5bSStefano Stabellini #define PVCALLS_RELEASE 2 3475e3ea5bSStefano Stabellini #define PVCALLS_BIND 3 3575e3ea5bSStefano Stabellini #define PVCALLS_LISTEN 4 3675e3ea5bSStefano Stabellini #define PVCALLS_ACCEPT 5 3775e3ea5bSStefano Stabellini #define PVCALLS_POLL 6 3875e3ea5bSStefano Stabellini 3975e3ea5bSStefano Stabellini struct xen_pvcalls_request { 4075e3ea5bSStefano Stabellini uint32_t req_id; /* private to guest, echoed in response */ 4175e3ea5bSStefano Stabellini uint32_t cmd; /* command to execute */ 4275e3ea5bSStefano Stabellini union { 4375e3ea5bSStefano Stabellini struct xen_pvcalls_socket { 4475e3ea5bSStefano Stabellini uint64_t id; 4575e3ea5bSStefano Stabellini uint32_t domain; 4675e3ea5bSStefano Stabellini uint32_t type; 4775e3ea5bSStefano Stabellini uint32_t protocol; 4875e3ea5bSStefano Stabellini } socket; 4975e3ea5bSStefano Stabellini struct xen_pvcalls_connect { 5075e3ea5bSStefano Stabellini uint64_t id; 5175e3ea5bSStefano Stabellini uint8_t addr[28]; 5275e3ea5bSStefano Stabellini uint32_t len; 5375e3ea5bSStefano Stabellini uint32_t flags; 5475e3ea5bSStefano Stabellini grant_ref_t ref; 5575e3ea5bSStefano Stabellini uint32_t evtchn; 5675e3ea5bSStefano Stabellini } connect; 5775e3ea5bSStefano Stabellini struct xen_pvcalls_release { 5875e3ea5bSStefano Stabellini uint64_t id; 5975e3ea5bSStefano Stabellini uint8_t reuse; 6075e3ea5bSStefano Stabellini } release; 6175e3ea5bSStefano Stabellini struct xen_pvcalls_bind { 6275e3ea5bSStefano Stabellini uint64_t id; 6375e3ea5bSStefano Stabellini uint8_t addr[28]; 6475e3ea5bSStefano Stabellini uint32_t len; 6575e3ea5bSStefano Stabellini } bind; 6675e3ea5bSStefano Stabellini struct xen_pvcalls_listen { 6775e3ea5bSStefano Stabellini uint64_t id; 6875e3ea5bSStefano Stabellini uint32_t backlog; 6975e3ea5bSStefano Stabellini } listen; 7075e3ea5bSStefano Stabellini struct xen_pvcalls_accept { 7175e3ea5bSStefano Stabellini uint64_t id; 7275e3ea5bSStefano Stabellini uint64_t id_new; 7375e3ea5bSStefano Stabellini grant_ref_t ref; 7475e3ea5bSStefano Stabellini uint32_t evtchn; 7575e3ea5bSStefano Stabellini } accept; 7675e3ea5bSStefano Stabellini struct xen_pvcalls_poll { 7775e3ea5bSStefano Stabellini uint64_t id; 7875e3ea5bSStefano Stabellini } poll; 7975e3ea5bSStefano Stabellini /* dummy member to force sizeof(struct xen_pvcalls_request) 8075e3ea5bSStefano Stabellini * to match across archs */ 8175e3ea5bSStefano Stabellini struct xen_pvcalls_dummy { 8275e3ea5bSStefano Stabellini uint8_t dummy[56]; 8375e3ea5bSStefano Stabellini } dummy; 8475e3ea5bSStefano Stabellini } u; 8575e3ea5bSStefano Stabellini }; 8675e3ea5bSStefano Stabellini 8775e3ea5bSStefano Stabellini struct xen_pvcalls_response { 8875e3ea5bSStefano Stabellini uint32_t req_id; 8975e3ea5bSStefano Stabellini uint32_t cmd; 9075e3ea5bSStefano Stabellini int32_t ret; 9175e3ea5bSStefano Stabellini uint32_t pad; 9275e3ea5bSStefano Stabellini union { 9375e3ea5bSStefano Stabellini struct _xen_pvcalls_socket { 9475e3ea5bSStefano Stabellini uint64_t id; 9575e3ea5bSStefano Stabellini } socket; 9675e3ea5bSStefano Stabellini struct _xen_pvcalls_connect { 9775e3ea5bSStefano Stabellini uint64_t id; 9875e3ea5bSStefano Stabellini } connect; 9975e3ea5bSStefano Stabellini struct _xen_pvcalls_release { 10075e3ea5bSStefano Stabellini uint64_t id; 10175e3ea5bSStefano Stabellini } release; 10275e3ea5bSStefano Stabellini struct _xen_pvcalls_bind { 10375e3ea5bSStefano Stabellini uint64_t id; 10475e3ea5bSStefano Stabellini } bind; 10575e3ea5bSStefano Stabellini struct _xen_pvcalls_listen { 10675e3ea5bSStefano Stabellini uint64_t id; 10775e3ea5bSStefano Stabellini } listen; 10875e3ea5bSStefano Stabellini struct _xen_pvcalls_accept { 10975e3ea5bSStefano Stabellini uint64_t id; 11075e3ea5bSStefano Stabellini } accept; 11175e3ea5bSStefano Stabellini struct _xen_pvcalls_poll { 11275e3ea5bSStefano Stabellini uint64_t id; 11375e3ea5bSStefano Stabellini } poll; 11475e3ea5bSStefano Stabellini struct _xen_pvcalls_dummy { 11575e3ea5bSStefano Stabellini uint8_t dummy[8]; 11675e3ea5bSStefano Stabellini } dummy; 11775e3ea5bSStefano Stabellini } u; 11875e3ea5bSStefano Stabellini }; 11975e3ea5bSStefano Stabellini 12075e3ea5bSStefano Stabellini DEFINE_RING_TYPES(xen_pvcalls, struct xen_pvcalls_request, 12175e3ea5bSStefano Stabellini struct xen_pvcalls_response); 12275e3ea5bSStefano Stabellini 12375e3ea5bSStefano Stabellini #endif 124