From patchwork Tue Mar 21 22:19:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 9637685 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 9EAB2602D6 for ; Tue, 21 Mar 2017 22:22:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9077C2768C for ; Tue, 21 Mar 2017 22:22:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8480828306; Tue, 21 Mar 2017 22:22:32 +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 18C3E2768C for ; Tue, 21 Mar 2017 22:22:32 +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 1cqS8N-0000aB-Ku; Tue, 21 Mar 2017 22:20:07 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cqS8M-0000Z3-6W for xen-devel@lists.xenproject.org; Tue, 21 Mar 2017 22:20:06 +0000 Received: from [85.158.137.68] by server-13.bemta-3.messagelabs.com id A8/FA-05091-517A1D85; Tue, 21 Mar 2017 22:20:05 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpnkeJIrShJLcpLzFFi42I5NlG2Q1dk+cU IgyN3lCy+b5nM5MDocfjDFZYAxijWzLyk/IoE1owXW98yFaxSrzj/8hVrA+MemS5GLg4hgamM Eh+nr2TtYuQEcnYzSVw8YwViswkYSvx9sokNxBYRUJK4t2oyE4jNLBAnsXP1MWYQW1jARGJ1Z z+YzSKgKrHr1nRGEJtXwE3i+aZ7YPUSAnISJ49NBpvPKeAusfXwCTaIxe2MEs1P3zFDFGVIzO uZwwphe0ksunEJylaTuHpuE/MERr4FjAyrGDWKU4vKUot0jQz0kooy0zNKchMzc3QNDYz1clO LixPTU3MSk4r1kvNzNzECA6WegYFxB2PzCb9DjJIcTEqivCqCJyKE+JLyUyozEosz4otKc1KL DzHKcHAoSfBO6gDKCRalpqdWpGXmAEMWJi3BwaMkwpsLkuYtLkjMLc5Mh0idYtTlmDN79xsmI Za8/LxUKXHeNJAiAZCijNI8uBGw+LnEKCslzMvIwMAgxFOQWpSbWYIq/4pRnINRSZi3GGQKT2 ZeCdymV0BHMAEdkfjzCMgRJYkIKakGRnk1+wVTNSYaez69dMVlzYlet+9HF7//KeO10UBjVXZ zkV3OrKcFi401/R69lJq5YZuqtt8zN5fXa9xYospPR7MZGiUfD772+kO0/ttKmw09zUsqjNbr zLuyxjG+3NL0WNzGSVlvr1x6/HWXQ/qsO46m763X7+CJ8Hxl8/hm/qRld9Zz2BwDOpmlOCPRU Iu5qDgRAJ/28YyaAgAA X-Env-Sender: sstabellini@kernel.org X-Msg-Ref: server-3.tower-31.messagelabs.com!1490134803!91384581!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 3202 invoked from network); 21 Mar 2017 22:20:04 -0000 Received: from mail.kernel.org (HELO mail.kernel.org) (198.145.29.136) by server-3.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 21 Mar 2017 22:20:04 -0000 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 695C0203ED; Tue, 21 Mar 2017 22:20:01 +0000 (UTC) Received: from sstabellini-ThinkPad-X260.attlocal.net (104-6-25-238.lightspeed.sntcca.sbcglobal.net [104.6.25.238]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 091DB203F3; Tue, 21 Mar 2017 22:19:59 +0000 (UTC) From: Stefano Stabellini To: xen-devel@lists.xenproject.org Date: Tue, 21 Mar 2017 15:19:55 -0700 Message-Id: <1490134795-28810-3-git-send-email-sstabellini@kernel.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1490134795-28810-1-git-send-email-sstabellini@kernel.org> References: <1490134795-28810-1-git-send-email-sstabellini@kernel.org> X-Virus-Scanned: ClamAV using ClamSMTP Cc: Stefano Stabellini , sstabellini@kernel.org Subject: [Xen-devel] [PATCH v3 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 | 152 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 152 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..4123528 --- /dev/null +++ b/xen/include/public/io/pvcalls.h @@ -0,0 +1,152 @@ +/* + * 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" + +/* + * See docs/misc/pvcalls.markdown in xen.git for the full specification: + * https://xenbits.xen.org/docs/unstable/misc/pvcalls.html + */ +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 + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */