From patchwork Tue Sep 6 10:12:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 9316315 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 D31A8601C0 for ; Tue, 6 Sep 2016 10:15:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C460228C31 for ; Tue, 6 Sep 2016 10:15:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B927028C39; Tue, 6 Sep 2016 10:15:21 +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 7033328C31 for ; Tue, 6 Sep 2016 10:15:19 +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 1bhDNL-0005f5-Mx; Tue, 06 Sep 2016 10:13: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 1bhDNJ-0005dk-S0 for xen-devel@lists.xen.org; Tue, 06 Sep 2016 10:13:05 +0000 Received: from [85.158.137.68] by server-7.bemta-3.messagelabs.com id 77/A2-03271-1B69EC75; Tue, 06 Sep 2016 10:13:05 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupnkeJIrShJLcpLzFFi42JxWrohUnfjtHP hBktbuS2WfFzM4sDocXT3b6YAxijWzLyk/IoE1oyPH1cxFxyTqJjy9DxjA+NK4S5GTg4JAX+J r1ces4LYbAL6ErtffGICsUUE1CVOd1wEinNwMAvoSqz6qQESFhZIlZh9bQILiM0ioCLRenAXW CuvgKfEmyPzmCBGykmcP/6TGcTmFPCSONb3CMwWAqrZ8KKVBcJWk7jWf4kdoldQ4uTMJ2BxZg EJiYMvXjCDrJUQ4Jb4220/gZFvFpKqWUiqFjAyrWLUKE4tKkst0jU20EsqykzPKMlNzMzRNTQ w1stNLS5OTE/NSUwq1kvOz93ECAyoegYGxh2MnSf8DjFKcjApifKqBZ4LF+JLyk+pzEgszogv Ks1JLT7EKMPBoSTBO28qUE6wKDU9tSItMwcY2jBpCQ4eJRHeAJA0b3FBYm5xZjpE6hSjopQ4b xFIQgAkkVGaB9cGi6dLjLJSwryMDAwMQjwFqUW5mSWo8q8YxTkYlYR5J4BM4cnMK4Gb/gpoMR PQ4nW7T4MsLklESEk1MGZOeuiy+PLOoyti7q367bBx+Ydraf1R05z/6jy78S4mo187OHmnf/C Wz9Xcu/81pPYISmktZ38RlLNWbn3+GZkUw802Tj/adxhvWFm9qUfX6mF77efQu3bHtLbHvVVb Id5wOuhMb9cfxQvyqWtVzolPsl9hrNm4rPhi2MyDxousXO+zz2FoEFRiKc5INNRiLipOBABQp 6rVogIAAA== X-Env-Sender: prvs=05022f6da=Andrew.Cooper3@citrix.com X-Msg-Ref: server-13.tower-31.messagelabs.com!1473156781!58575174!3 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 57187 invoked from network); 6 Sep 2016 10:13:04 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-13.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 6 Sep 2016 10:13:04 -0000 X-IronPort-AV: E=Sophos;i="5.30,291,1470700800"; d="scan'208";a="376488447" From: Andrew Cooper To: Xen-devel Date: Tue, 6 Sep 2016 11:12:51 +0100 Message-ID: <1473156779-11759-2-git-send-email-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1473156779-11759-1-git-send-email-andrew.cooper3@citrix.com> References: <1473156779-11759-1-git-send-email-andrew.cooper3@citrix.com> MIME-Version: 1.0 X-DLP: MIA1 Cc: Andrew Cooper Subject: [Xen-devel] [PATCH v2 1/9] x86/hypercall: Move some of the hvm hypercall infrastructure into hypercall.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 It will be reused for PV hypercalls in subsequent changes. * Rename hvm_hypercall_t to hypercall_fn_t * Introduce hypercall_table_t Finally, rework the #includes for hypercall.h so it may be included in isolation. Signed-off-by: Andrew Cooper Acked-by: Jan Beulich --- xen/arch/x86/hvm/hvm.c | 19 +++++-------------- xen/include/asm-x86/hypercall.h | 14 +++++++++++++- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 58a40b6..9002e3c 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -4117,17 +4117,13 @@ static long hvm_physdev_op_compat32( } } -typedef unsigned long hvm_hypercall_t( - unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, - unsigned long); - #define HYPERCALL(x) \ - [ __HYPERVISOR_ ## x ] = { (hvm_hypercall_t *) do_ ## x, \ - (hvm_hypercall_t *) do_ ## x } + [ __HYPERVISOR_ ## x ] = { (hypercall_fn_t *) do_ ## x, \ + (hypercall_fn_t *) do_ ## x } #define COMPAT_CALL(x) \ - [ __HYPERVISOR_ ## x ] = { (hvm_hypercall_t *) do_ ## x, \ - (hvm_hypercall_t *) compat_ ## x } + [ __HYPERVISOR_ ## x ] = { (hypercall_fn_t *) do_ ## x, \ + (hypercall_fn_t *) compat_ ## x } #define do_memory_op hvm_memory_op #define compat_memory_op hvm_memory_op_compat32 @@ -4137,10 +4133,7 @@ typedef unsigned long hvm_hypercall_t( #define compat_grant_table_op hvm_grant_table_op_compat32 #define do_arch_1 paging_domctl_continuation -static const struct { - hvm_hypercall_t *native; - hvm_hypercall_t *compat; -} hvm_hypercall_table[NR_hypercalls] = { +static const hypercall_table_t hvm_hypercall_table[NR_hypercalls] = { COMPAT_CALL(memory_op), COMPAT_CALL(grant_table_op), COMPAT_CALL(vcpu_op), @@ -4172,8 +4165,6 @@ static const struct { #undef HYPERCALL #undef COMPAT_CALL -extern const uint8_t hypercall_args_table[], compat_hypercall_args_table[]; - int hvm_do_hypercall(struct cpu_user_regs *regs) { struct vcpu *curr = current; diff --git a/xen/include/asm-x86/hypercall.h b/xen/include/asm-x86/hypercall.h index 945d58a..731f3a8 100644 --- a/xen/include/asm-x86/hypercall.h +++ b/xen/include/asm-x86/hypercall.h @@ -5,9 +5,21 @@ #ifndef __ASM_X86_HYPERCALL_H__ #define __ASM_X86_HYPERCALL_H__ +#include #include +#include #include /* for do_mca */ -#include + +typedef unsigned long hypercall_fn_t( + unsigned long, unsigned long, unsigned long, + unsigned long, unsigned long, unsigned long); + +typedef struct { + hypercall_fn_t *native, *compat; +} hypercall_table_t; + +extern const uint8_t hypercall_args_table[NR_hypercalls], + compat_hypercall_args_table[NR_hypercalls]; /* * Both do_mmuext_op() and do_mmu_update():