From patchwork Tue Jul 12 14:42:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony PERARD X-Patchwork-Id: 9225533 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 561AB6086B for ; Tue, 12 Jul 2016 14:48:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4677927D29 for ; Tue, 12 Jul 2016 14:48:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3B1C327E78; Tue, 12 Jul 2016 14:48:52 +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 BCE9627D29 for ; Tue, 12 Jul 2016 14:48:51 +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 1bMyxD-0003wx-BX; Tue, 12 Jul 2016 14:46:31 +0000 Received: from mail6.bemta6.messagelabs.com ([85.158.143.247]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bMyxC-0003u9-5j for xen-devel@lists.xen.org; Tue, 12 Jul 2016 14:46:30 +0000 Received: from [85.158.143.35] by server-2.bemta-6.messagelabs.com id 26/F8-11548-5C205875; Tue, 12 Jul 2016 14:46:29 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprAIsWRWlGSWpSXmKPExsXitHSDve4RptZ wg/8PrS2WfFzM4sDocXT3b6YAxijWzLyk/IoE1ox5x2YwFvzXq/iz4zlzA+N9pS5GTg4JAX+J 11c3MYPYbAIGEiumX2UEsUUEZCVWd81h72Lk4mAWeM8ksfVsFxNIQlggSeLho6lgRSwCqhK9P 3ezgdi8AjYSM+4tYYMYKifRcP4+2FBOAVuJttanYLYQUM3apbNYIWw1iRsLl7FA9ApKnJz5BM xmFpCQOPjiBVA9B9Acbom/3fYTGPlmIamahaRqASPTKkb14tSistQiXSO9pKLM9IyS3MTMHF1 DAzO93NTi4sT01JzEpGK95PzcTYzAkGIAgh2My/46HWKU5GBSEuVtZm4JF+JLyk+pzEgszogv Ks1JLT7EKMPBoSTBe5KxNVxIsCg1PbUiLTMHGNwwaQkOHiUR3i8gad7igsTc4sx0iNQpRkUpc d7jIAkBkERGaR5cGyyiLjHKSgnzMgIdIsRTkFqUm1mCKv+KUZyDUUmY9wzIFJ7MvBK46a+AFj MBLa51aAZZXJKIkJJqYCxlcTytd2RdatTVXewtV5WL1F2qONyqf1yaIlQmO4fXKtqQMZXJX9l GesHbSR4dS1XKjMMdfy69Umnt9+9+93TlvELrmJva//15oh/U3ipyrgvpecV74JHJI03H3GLt jDPnVfrCCizXyP1ZLspczefy78S/5Xb6HRzH//au+utwlsOmpO+oEktxRqKhFnNRcSIA1sguO aMCAAA= X-Env-Sender: prvs=994f31c19=anthony.perard@citrix.com X-Msg-Ref: server-2.tower-21.messagelabs.com!1468334785!9588118!4 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 8.77; banners=-,-,- X-VirusChecked: Checked Received: (qmail 37437 invoked from network); 12 Jul 2016 14:46:28 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-2.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 12 Jul 2016 14:46:28 -0000 X-IronPort-AV: E=Sophos;i="5.28,352,1464652800"; d="scan'208";a="372679189" From: Anthony PERARD To: Date: Tue, 12 Jul 2016 15:42:43 +0100 Message-ID: <20160712144251.558-7-anthony.perard@citrix.com> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20160712144251.558-1-anthony.perard@citrix.com> References: <20160712144251.558-1-anthony.perard@citrix.com> MIME-Version: 1.0 X-DLP: MIA1 Cc: Stefano Stabellini , Wei Liu , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Jan Beulich , Anthony PERARD Subject: [Xen-devel] [PATCH v6 06/14] xen: Move the hvm_start_info C representation from libxc to public/xen.h 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: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Instead of having several representation of hvm_start_info in C, define it in public/xen.h so both libxc and hvmloader can use it. Signed-off-by: Anthony PERARD --- Changes in V6: - move C representation to public/arch-x86/hvm/start_info.h instead of public/xen.h Change in V5: - remove packed attribute. New in V4. --- tools/libxc/include/xc_dom.h | 31 ---------------- tools/libxc/xc_dom_x86.c | 1 + xen/include/public/arch-x86/hvm/start_info.h | 53 ++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 31 deletions(-) create mode 100644 xen/include/public/arch-x86/hvm/start_info.h diff --git a/tools/libxc/include/xc_dom.h b/tools/libxc/include/xc_dom.h index 0629971..de7dca9 100644 --- a/tools/libxc/include/xc_dom.h +++ b/tools/libxc/include/xc_dom.h @@ -219,37 +219,6 @@ struct xc_dom_image { struct xc_hvm_firmware_module smbios_module; }; -#if defined(__i386__) || defined(__x86_64__) -/* C representation of the x86/HVM start info layout. - * - * The canonical definition of this layout resides in public/xen.h, this - * is just a way to represent the layout described there using C types. - * - * NB: the packed attribute is not really needed, but it helps us enforce - * the fact this this is just a representation, and it might indeed - * be required in the future if there are alignment changes. - */ -struct hvm_start_info { - uint32_t magic; /* Contains the magic value 0x336ec578 */ - /* ("xEn3" with the 0x80 bit of the "E" set).*/ - uint32_t version; /* Version of this structure. */ - uint32_t flags; /* SIF_xxx flags. */ - uint32_t nr_modules; /* Number of modules passed to the kernel. */ - uint64_t modlist_paddr; /* Physical address of an array of */ - /* hvm_modlist_entry. */ - uint64_t cmdline_paddr; /* Physical address of the command line. */ - uint64_t rsdp_paddr; /* Physical address of the RSDP ACPI data */ - /* structure. */ -} __attribute__((packed)); - -struct hvm_modlist_entry { - uint64_t paddr; /* Physical address of the module. */ - uint64_t size; /* Size of the module in bytes. */ - uint64_t cmdline_paddr; /* Physical address of the command line. */ - uint64_t reserved; -} __attribute__((packed)); -#endif /* x86 */ - /* --- pluggable kernel loader ------------------------------------- */ struct xc_dom_loader { diff --git a/tools/libxc/xc_dom_x86.c b/tools/libxc/xc_dom_x86.c index bc2dbb2..0eab8a7 100644 --- a/tools/libxc/xc_dom_x86.c +++ b/tools/libxc/xc_dom_x86.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include "xg_private.h" diff --git a/xen/include/public/arch-x86/hvm/start_info.h b/xen/include/public/arch-x86/hvm/start_info.h new file mode 100644 index 0000000..6981187 --- /dev/null +++ b/xen/include/public/arch-x86/hvm/start_info.h @@ -0,0 +1,53 @@ +/* + * 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) 2016, Citrix Systems, Inc. + */ + +#ifndef __XEN_PUBLIC_ARCH_X86_HVM_START_INFO_H__ +#define __XEN_PUBLIC_ARCH_X86_HVM_START_INFO_H__ + +/* + * C representation of the x86/HVM start info layout. + * + * The canonical definition of this layout resides in public/xen.h, this + * is just a way to represent the layout described there using C types. + * + */ +struct hvm_start_info { + uint32_t magic; /* Contains the magic value 0x336ec578 */ + /* ("xEn3" with the 0x80 bit of the "E" set).*/ + uint32_t version; /* Version of this structure. */ + uint32_t flags; /* SIF_xxx flags. */ + uint32_t nr_modules; /* Number of modules passed to the kernel. */ + uint64_t modlist_paddr; /* Physical address of an array of */ + /* hvm_modlist_entry. */ + uint64_t cmdline_paddr; /* Physical address of the command line. */ + uint64_t rsdp_paddr; /* Physical address of the RSDP ACPI data */ + /* structure. */ +}; + +struct hvm_modlist_entry { + uint64_t paddr; /* Physical address of the module. */ + uint64_t size; /* Size of the module in bytes. */ + uint64_t cmdline_paddr; /* Physical address of the command line. */ + uint64_t reserved; +}; + +#endif /* __XEN_PUBLIC_ARCH_X86_HVM_START_INFO_H__ */