From patchwork Tue Mar 14 22:18:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 9624625 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D9F4960244 for ; Tue, 14 Mar 2017 22:21:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CB908285A1 for ; Tue, 14 Mar 2017 22:21:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C06E4285CC; Tue, 14 Mar 2017 22:21:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 49464285A1 for ; Tue, 14 Mar 2017 22:21:29 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cnumG-0006kh-MF; Tue, 14 Mar 2017 22:18:48 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cnumF-0006kF-9E for xen-devel@lists.xenproject.org; Tue, 14 Mar 2017 22:18:47 +0000 Received: from [85.158.143.35] by server-3.bemta-6.messagelabs.com id 42/EF-27751-64C68C85; Tue, 14 Mar 2017 22:18:46 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpnkeJIrShJLcpLzFFi42I5NlG2Q9c150S EwfEVVhbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8aJo69YCnpVKzr7u9gbGM9JdTFycQgJTGWU 6J93iAXCOcgksWrnUdYuRk4ONgFDib9PNrGB2CICShL3Vk1mArGZBeIkepb3gtUIA9UsvHgSr IZFQFXi3tk1LCA2r4CbRN/ke8wgtoSAnMTJY5PB6jkF3CWet25mB7GFgGrOb21kh6jJkJjXM4 cVwvaSWHTjEpStJnH13CbmCYx8CxgZVjFqFKcWlaUW6Roa6SUVZaZnlOQmZuboGhqY6eWmFhc npqfmJCYV6yXn525iBAYKAxDsYLy8MeAQoyQHk5Ior4rgiQghvqT8lMqMxOKM+KLSnNTiQ4wy HBxKErx+2UA5waLU9NSKtMwcYMjCpCU4eJREeD1B0rzFBYm5xZnpEKlTjLocc2bvfsMkxJKXn 5cqJc5rBVIkAFKUUZoHNwIWP5cYZaWEeRmBjhLiKUgtys0sQZV/xSjOwagkzCsBMoUnM68Ebt MroCOYgI5I/HkE5IiSRISUVAPj/uePJ0qeOM6Y+G+zH/+njY2yLU2sgikTXxt+jpq7lCVUQqQ +eUnC6dWKiuazDtn8/envqSZrvNRV4Oj7HyfTvX5vtrJ9em1Xe9Juxq0K/mL/3f5Paz7as1rJ OaJXnnd9c0Hf3KUvfLdfOcPEWVvT/Duh/UDPwSkOq/uLI0SCdm68vXTh5bRHSizFGYmGWsxFx YkAroleUJoCAAA= X-Env-Sender: sstabellini@kernel.org X-Msg-Ref: server-7.tower-21.messagelabs.com!1489529924!62348182!1 X-Originating-IP: [198.145.29.136] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.2.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 42050 invoked from network); 14 Mar 2017 22:18:45 -0000 Received: from mail.kernel.org (HELO mail.kernel.org) (198.145.29.136) by server-7.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 14 Mar 2017 22:18:45 -0000 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 14304203E9; Tue, 14 Mar 2017 22:18:43 +0000 (UTC) Received: from sstabellini-ThinkPad-X260.hsd1.ca.comcast.net (96-82-76-110-static.hfc.comcastbusiness.net [96.82.76.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DB52120416; Tue, 14 Mar 2017 22:18:41 +0000 (UTC) From: Stefano Stabellini To: xen-devel@lists.xenproject.org Date: Tue, 14 Mar 2017 15:18:36 -0700 Message-Id: <1489529916-27730-3-git-send-email-sstabellini@kernel.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1489529916-27730-1-git-send-email-sstabellini@kernel.org> References: <1489529916-27730-1-git-send-email-sstabellini@kernel.org> X-Virus-Scanned: ClamAV using ClamSMTP Cc: Stefano Stabellini , sstabellini@kernel.org Subject: [Xen-devel] [PATCH 3/3] Introduce the pvcalls header X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Define the ring and request and response structs according to the specification. Use the new DEFINE_XEN_FLEX_RING macro. Signed-off-by: Stefano Stabellini CC: konrad.wilk@oracle.com --- xen/include/public/io/pvcalls.h | 138 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 xen/include/public/io/pvcalls.h diff --git a/xen/include/public/io/pvcalls.h b/xen/include/public/io/pvcalls.h new file mode 100644 index 0000000..074f52f --- /dev/null +++ b/xen/include/public/io/pvcalls.h @@ -0,0 +1,138 @@ +/* + * pvcalls.h -- Xen PV Calls Protocol + * + * Refer to docs/misc/pvcalls.markdown for the specification + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Copyright (C) 2017 Stefano Stabellini + */ + +#ifndef __XEN_PUBLIC_IO_PVCALLS_H__ +#define __XEN_PUBLIC_IO_PVCALLS_H__ + +#include "ring.h" + +struct pvcalls_data_intf { + RING_IDX in_cons, in_prod, in_error; + + uint8_t pad1[52]; + + RING_IDX out_cons, out_prod, out_error; + + uint8_t pad2[52]; + + RING_IDX ring_order; + grant_ref_t ref[]; +}; +DEFINE_XEN_FLEX_RING(pvcalls); + +#define PVCALLS_SOCKET 0 +#define PVCALLS_CONNECT 1 +#define PVCALLS_RELEASE 2 +#define PVCALLS_BIND 3 +#define PVCALLS_LISTEN 4 +#define PVCALLS_ACCEPT 5 +#define PVCALLS_POLL 6 + +struct xen_pvcalls_request { + uint32_t req_id; /* private to guest, echoed in response */ + uint32_t cmd; /* command to execute */ + union { + struct xen_pvcalls_socket { + uint64_t id; + uint32_t domain; + uint32_t type; + uint32_t protocol; + } socket; + struct xen_pvcalls_connect { + uint64_t id; + uint8_t addr[28]; + uint32_t len; + uint32_t flags; + grant_ref_t ref; + uint32_t evtchn; + } connect; + struct xen_pvcalls_release { + uint64_t id; + uint8_t reuse; + } release; + struct xen_pvcalls_bind { + uint64_t id; + uint8_t addr[28]; + uint32_t len; + } bind; + struct xen_pvcalls_listen { + uint64_t id; + uint32_t backlog; + } listen; + struct xen_pvcalls_accept { + uint64_t id; + uint64_t id_new; + grant_ref_t ref; + uint32_t evtchn; + } accept; + struct xen_pvcalls_poll { + uint64_t id; + } poll; + /* dummy member to force sizeof(struct xen_pvcalls_request) + * to match across archs */ + struct xen_pvcalls_dummy { + uint8_t dummy[56]; + } dummy; + } u; +}; + +struct xen_pvcalls_response { + uint32_t req_id; + uint32_t cmd; + int32_t ret; + uint32_t pad; + union { + struct _xen_pvcalls_socket { + uint64_t id; + } socket; + struct _xen_pvcalls_connect { + uint64_t id; + } connect; + struct _xen_pvcalls_release { + uint64_t id; + } release; + struct _xen_pvcalls_bind { + uint64_t id; + } bind; + struct _xen_pvcalls_listen { + uint64_t id; + } listen; + struct _xen_pvcalls_accept { + uint64_t id; + } accept; + struct _xen_pvcalls_poll { + uint64_t id; + } poll; + struct _xen_pvcalls_dummy { + uint8_t dummy[8]; + } dummy; + } u; +}; + +DEFINE_RING_TYPES(xen_pvcalls, struct xen_pvcalls_request, + struct xen_pvcalls_response); + +#endif