18c2ecf20Sopenharmony_ci#ifndef __XEN_PUBLIC_IO_XEN_PVCALLS_H__ 28c2ecf20Sopenharmony_ci#define __XEN_PUBLIC_IO_XEN_PVCALLS_H__ 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ci#include <linux/net.h> 58c2ecf20Sopenharmony_ci#include <xen/interface/io/ring.h> 68c2ecf20Sopenharmony_ci#include <xen/interface/grant_table.h> 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci/* "1" means socket, connect, release, bind, listen, accept and poll */ 98c2ecf20Sopenharmony_ci#define XENBUS_FUNCTIONS_CALLS "1" 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci/* 128c2ecf20Sopenharmony_ci * See docs/misc/pvcalls.markdown in xen.git for the full specification: 138c2ecf20Sopenharmony_ci * https://xenbits.xen.org/docs/unstable/misc/pvcalls.html 148c2ecf20Sopenharmony_ci */ 158c2ecf20Sopenharmony_cistruct pvcalls_data_intf { 168c2ecf20Sopenharmony_ci RING_IDX in_cons, in_prod, in_error; 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci uint8_t pad1[52]; 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci RING_IDX out_cons, out_prod, out_error; 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci uint8_t pad2[52]; 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci RING_IDX ring_order; 258c2ecf20Sopenharmony_ci grant_ref_t ref[]; 268c2ecf20Sopenharmony_ci}; 278c2ecf20Sopenharmony_ciDEFINE_XEN_FLEX_RING(pvcalls); 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci#define PVCALLS_SOCKET 0 308c2ecf20Sopenharmony_ci#define PVCALLS_CONNECT 1 318c2ecf20Sopenharmony_ci#define PVCALLS_RELEASE 2 328c2ecf20Sopenharmony_ci#define PVCALLS_BIND 3 338c2ecf20Sopenharmony_ci#define PVCALLS_LISTEN 4 348c2ecf20Sopenharmony_ci#define PVCALLS_ACCEPT 5 358c2ecf20Sopenharmony_ci#define PVCALLS_POLL 6 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_cistruct xen_pvcalls_request { 388c2ecf20Sopenharmony_ci uint32_t req_id; /* private to guest, echoed in response */ 398c2ecf20Sopenharmony_ci uint32_t cmd; /* command to execute */ 408c2ecf20Sopenharmony_ci union { 418c2ecf20Sopenharmony_ci struct xen_pvcalls_socket { 428c2ecf20Sopenharmony_ci uint64_t id; 438c2ecf20Sopenharmony_ci uint32_t domain; 448c2ecf20Sopenharmony_ci uint32_t type; 458c2ecf20Sopenharmony_ci uint32_t protocol; 468c2ecf20Sopenharmony_ci } socket; 478c2ecf20Sopenharmony_ci struct xen_pvcalls_connect { 488c2ecf20Sopenharmony_ci uint64_t id; 498c2ecf20Sopenharmony_ci uint8_t addr[28]; 508c2ecf20Sopenharmony_ci uint32_t len; 518c2ecf20Sopenharmony_ci uint32_t flags; 528c2ecf20Sopenharmony_ci grant_ref_t ref; 538c2ecf20Sopenharmony_ci uint32_t evtchn; 548c2ecf20Sopenharmony_ci } connect; 558c2ecf20Sopenharmony_ci struct xen_pvcalls_release { 568c2ecf20Sopenharmony_ci uint64_t id; 578c2ecf20Sopenharmony_ci uint8_t reuse; 588c2ecf20Sopenharmony_ci } release; 598c2ecf20Sopenharmony_ci struct xen_pvcalls_bind { 608c2ecf20Sopenharmony_ci uint64_t id; 618c2ecf20Sopenharmony_ci uint8_t addr[28]; 628c2ecf20Sopenharmony_ci uint32_t len; 638c2ecf20Sopenharmony_ci } bind; 648c2ecf20Sopenharmony_ci struct xen_pvcalls_listen { 658c2ecf20Sopenharmony_ci uint64_t id; 668c2ecf20Sopenharmony_ci uint32_t backlog; 678c2ecf20Sopenharmony_ci } listen; 688c2ecf20Sopenharmony_ci struct xen_pvcalls_accept { 698c2ecf20Sopenharmony_ci uint64_t id; 708c2ecf20Sopenharmony_ci uint64_t id_new; 718c2ecf20Sopenharmony_ci grant_ref_t ref; 728c2ecf20Sopenharmony_ci uint32_t evtchn; 738c2ecf20Sopenharmony_ci } accept; 748c2ecf20Sopenharmony_ci struct xen_pvcalls_poll { 758c2ecf20Sopenharmony_ci uint64_t id; 768c2ecf20Sopenharmony_ci } poll; 778c2ecf20Sopenharmony_ci /* dummy member to force sizeof(struct xen_pvcalls_request) 788c2ecf20Sopenharmony_ci * to match across archs */ 798c2ecf20Sopenharmony_ci struct xen_pvcalls_dummy { 808c2ecf20Sopenharmony_ci uint8_t dummy[56]; 818c2ecf20Sopenharmony_ci } dummy; 828c2ecf20Sopenharmony_ci } u; 838c2ecf20Sopenharmony_ci}; 848c2ecf20Sopenharmony_ci 858c2ecf20Sopenharmony_cistruct xen_pvcalls_response { 868c2ecf20Sopenharmony_ci uint32_t req_id; 878c2ecf20Sopenharmony_ci uint32_t cmd; 888c2ecf20Sopenharmony_ci int32_t ret; 898c2ecf20Sopenharmony_ci uint32_t pad; 908c2ecf20Sopenharmony_ci union { 918c2ecf20Sopenharmony_ci struct _xen_pvcalls_socket { 928c2ecf20Sopenharmony_ci uint64_t id; 938c2ecf20Sopenharmony_ci } socket; 948c2ecf20Sopenharmony_ci struct _xen_pvcalls_connect { 958c2ecf20Sopenharmony_ci uint64_t id; 968c2ecf20Sopenharmony_ci } connect; 978c2ecf20Sopenharmony_ci struct _xen_pvcalls_release { 988c2ecf20Sopenharmony_ci uint64_t id; 998c2ecf20Sopenharmony_ci } release; 1008c2ecf20Sopenharmony_ci struct _xen_pvcalls_bind { 1018c2ecf20Sopenharmony_ci uint64_t id; 1028c2ecf20Sopenharmony_ci } bind; 1038c2ecf20Sopenharmony_ci struct _xen_pvcalls_listen { 1048c2ecf20Sopenharmony_ci uint64_t id; 1058c2ecf20Sopenharmony_ci } listen; 1068c2ecf20Sopenharmony_ci struct _xen_pvcalls_accept { 1078c2ecf20Sopenharmony_ci uint64_t id; 1088c2ecf20Sopenharmony_ci } accept; 1098c2ecf20Sopenharmony_ci struct _xen_pvcalls_poll { 1108c2ecf20Sopenharmony_ci uint64_t id; 1118c2ecf20Sopenharmony_ci } poll; 1128c2ecf20Sopenharmony_ci struct _xen_pvcalls_dummy { 1138c2ecf20Sopenharmony_ci uint8_t dummy[8]; 1148c2ecf20Sopenharmony_ci } dummy; 1158c2ecf20Sopenharmony_ci } u; 1168c2ecf20Sopenharmony_ci}; 1178c2ecf20Sopenharmony_ci 1188c2ecf20Sopenharmony_ciDEFINE_RING_TYPES(xen_pvcalls, struct xen_pvcalls_request, 1198c2ecf20Sopenharmony_ci struct xen_pvcalls_response); 1208c2ecf20Sopenharmony_ci 1218c2ecf20Sopenharmony_ci#endif 122