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