/*1* pvcalls.h -- Xen PV Calls Protocol2*3* Refer to docs/misc/pvcalls.markdown for the specification4*5* The header is provided as a C reference for the specification. In6* case of conflict, the specification is authoritative.7*8* Permission is hereby granted, free of charge, to any person obtaining a copy9* of this software and associated documentation files (the "Software"), to10* deal in the Software without restriction, including without limitation the11* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or12* sell copies of the Software, and to permit persons to whom the Software is13* furnished to do so, subject to the following conditions:14*15* The above copyright notice and this permission notice shall be included in16* all copies or substantial portions of the Software.17*18* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR19* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,20* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE21* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER22* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING23* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER24* DEALINGS IN THE SOFTWARE.25*26* Copyright (C) 2017 Stefano Stabellini <[email protected]>27*/2829#ifndef __XEN_PUBLIC_IO_PVCALLS_H__30#define __XEN_PUBLIC_IO_PVCALLS_H__3132#include "../grant_table.h"33#include "ring.h"3435/*36* See docs/misc/pvcalls.markdown in xen.git for the full specification:37* https://xenbits.xen.org/docs/unstable/misc/pvcalls.html38*/39struct pvcalls_data_intf {40RING_IDX in_cons, in_prod, in_error;4142uint8_t pad1[52];4344RING_IDX out_cons, out_prod, out_error;4546uint8_t pad2[52];4748RING_IDX ring_order;49grant_ref_t ref[];50};51DEFINE_XEN_FLEX_RING(pvcalls);5253#define PVCALLS_SOCKET 054#define PVCALLS_CONNECT 155#define PVCALLS_RELEASE 256#define PVCALLS_BIND 357#define PVCALLS_LISTEN 458#define PVCALLS_ACCEPT 559#define PVCALLS_POLL 66061struct xen_pvcalls_request {62uint32_t req_id; /* private to guest, echoed in response */63uint32_t cmd; /* command to execute */64union {65struct xen_pvcalls_socket {66uint64_t id;67uint32_t domain;68uint32_t type;69uint32_t protocol;70uint8_t pad[4];71} socket;72struct xen_pvcalls_connect {73uint64_t id;74uint8_t addr[28];75uint32_t len;76uint32_t flags;77grant_ref_t ref;78uint32_t evtchn;79uint8_t pad[4];80} connect;81struct xen_pvcalls_release {82uint64_t id;83uint8_t reuse;84uint8_t pad[7];85} release;86struct xen_pvcalls_bind {87uint64_t id;88uint8_t addr[28];89uint32_t len;90} bind;91struct xen_pvcalls_listen {92uint64_t id;93uint32_t backlog;94uint8_t pad[4];95} listen;96struct xen_pvcalls_accept {97uint64_t id;98uint64_t id_new;99grant_ref_t ref;100uint32_t evtchn;101} accept;102struct xen_pvcalls_poll {103uint64_t id;104} poll;105/* dummy member to force sizeof(struct xen_pvcalls_request)106* to match across archs */107struct xen_pvcalls_dummy {108uint8_t dummy[56];109} dummy;110} u;111};112113struct xen_pvcalls_response {114uint32_t req_id;115uint32_t cmd;116int32_t ret;117uint32_t pad;118union {119struct _xen_pvcalls_socket {120uint64_t id;121} socket;122struct _xen_pvcalls_connect {123uint64_t id;124} connect;125struct _xen_pvcalls_release {126uint64_t id;127} release;128struct _xen_pvcalls_bind {129uint64_t id;130} bind;131struct _xen_pvcalls_listen {132uint64_t id;133} listen;134struct _xen_pvcalls_accept {135uint64_t id;136} accept;137struct _xen_pvcalls_poll {138uint64_t id;139} poll;140struct _xen_pvcalls_dummy {141uint8_t dummy[8];142} dummy;143} u;144};145146DEFINE_RING_TYPES(xen_pvcalls, struct xen_pvcalls_request,147struct xen_pvcalls_response);148149#endif150151/*152* Local variables:153* mode: C154* c-file-style: "BSD"155* c-basic-offset: 4156* tab-width: 4157* indent-tabs-mode: nil158* End:159*/160161162