From patchwork Thu Aug 17 14:44:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Liu X-Patchwork-Id: 9906485 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 EBA3D6038C for ; Thu, 17 Aug 2017 14:47:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DDCC328B2C for ; Thu, 17 Aug 2017 14:47:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D290A28B30; Thu, 17 Aug 2017 14:47:41 +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 70B8428B2C for ; Thu, 17 Aug 2017 14:47:41 +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 1diM3J-0001Ac-U0; Thu, 17 Aug 2017 14:45:41 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1diM3J-00019t-1H for xen-devel@lists.xenproject.org; Thu, 17 Aug 2017 14:45:41 +0000 Received: from [193.109.254.147] by server-6.bemta-6.messagelabs.com id 80/BA-03937-41CA5995; Thu, 17 Aug 2017 14:45:40 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupnkeJIrShJLcpLzFFi42JxWrrBXld4zdR IgwMNFhbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8b/HU1MBV+FKvqv/mRuYOzn72Lk5JAQ8Je4 tnM7I4jNJqAs8bOzlw3EFhHQk2g68BwozsXBLDCHUWLq3C4gh4NDWMBDYuYbeRCTRUBV4lSvM YjJK2Ah8WZdMsREeYldbRdZQWxOAUuJQ5MWM4PYQkAlsz+0s0PYChId048xgdi8AoISJ2c+YQ GxmQUkJA6+eME8gZF3FpLULCSpBYxMqxg1ilOLylKLdI2N9ZKKMtMzSnITM3N0DQ3M9HJTi4s T01NzEpOK9ZLzczcxAgOHAQh2MO5cH3iIUZKDSUmU9/esKZFCfEn5KZUZicUZ8UWlOanFhxhl ODiUJHgfr5oaKSRYlJqeWpGWmQMMYZi0BAePkgjvf5A0b3FBYm5xZjpE6hSjLserCf+/MQmx5 OXnpUqJ80auBioSACnKKM2DGwGLp0uMslLCvIxARwnxFKQW5WaWoMq/YhTnYFQS5r0OsoonM6 8EbtMroCOYgI640j4J5IiSRISUVAMje7Fc+FWzJ+bTZSZbrF24fHM0/3vRht9cZhu0Tv2dtZ5 R+d/fB0YtP06xCl6bPDFknW/Y6ddCZy5pX821TtebZvNilsKpCas3/eTf8l7GMulZiZRaxe/+ QPlmRmHzusk/Yze7HH/SXmfPu6DyvMOhRc+Zviw/csl2Kufz1vpE+e49CZurJq5+rsRSnJFoq MVcVJwIAG9u30yiAgAA X-Env-Sender: prvs=395e6b081=wei.liu2@citrix.com X-Msg-Ref: server-10.tower-27.messagelabs.com!1502981136!89057399!2 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: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 40485 invoked from network); 17 Aug 2017 14:45:39 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-10.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 17 Aug 2017 14:45:39 -0000 X-IronPort-AV: E=Sophos;i="5.41,388,1498521600"; d="scan'208";a="444178353" From: Wei Liu To: Xen-devel Date: Thu, 17 Aug 2017 15:44:31 +0100 Message-ID: <20170817144456.18989-7-wei.liu2@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170817144456.18989-1-wei.liu2@citrix.com> References: <20170817144456.18989-1-wei.liu2@citrix.com> MIME-Version: 1.0 Cc: George Dunlap , Andrew Cooper , Wei Liu , Jan Beulich Subject: [Xen-devel] [PATCH v4 06/31] x86: move pv_emul_is_mem_write to pv/emulate.c 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 Export it via pv/emulate.h. In the mean time it is required to include pv/emulate.h in x86/mm.c. The said function will be used later by different emulation handlers in later patches. Signed-off-by: Wei Liu Acked-by: Andrew Cooper --- xen/arch/x86/mm.c | 9 ++------- xen/arch/x86/pv/emulate.c | 7 +++++++ xen/arch/x86/pv/emulate.h | 3 +++ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index 5983a56811..e0e655ac31 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -126,6 +126,8 @@ #include #include +#include "pv/emulate.h" + /* Mapping of the fixmap space needed early. */ l1_pgentry_t __section(".bss.page_aligned") __aligned(PAGE_SIZE) l1_fixmap[L1_PAGETABLE_ENTRIES]; @@ -5138,13 +5140,6 @@ static int ptwr_emulated_cmpxchg( container_of(ctxt, struct ptwr_emulate_ctxt, ctxt)); } -static int pv_emul_is_mem_write(const struct x86_emulate_state *state, - struct x86_emulate_ctxt *ctxt) -{ - return x86_insn_is_mem_write(state, ctxt) ? X86EMUL_OKAY - : X86EMUL_UNHANDLEABLE; -} - static const struct x86_emulate_ops ptwr_emulate_ops = { .read = ptwr_emulated_read, .insn_fetch = ptwr_emulated_read, diff --git a/xen/arch/x86/pv/emulate.c b/xen/arch/x86/pv/emulate.c index 5750c7699b..1c4d6eab28 100644 --- a/xen/arch/x86/pv/emulate.c +++ b/xen/arch/x86/pv/emulate.c @@ -87,6 +87,13 @@ void pv_emul_instruction_done(struct cpu_user_regs *regs, unsigned long rip) } } +int pv_emul_is_mem_write(const struct x86_emulate_state *state, + struct x86_emulate_ctxt *ctxt) +{ + return x86_insn_is_mem_write(state, ctxt) ? X86EMUL_OKAY + : X86EMUL_UNHANDLEABLE; +} + /* * Local variables: * mode: C diff --git a/xen/arch/x86/pv/emulate.h b/xen/arch/x86/pv/emulate.h index b2b1192d48..89abbe010f 100644 --- a/xen/arch/x86/pv/emulate.h +++ b/xen/arch/x86/pv/emulate.h @@ -7,4 +7,7 @@ int pv_emul_read_descriptor(unsigned int sel, const struct vcpu *v, void pv_emul_instruction_done(struct cpu_user_regs *regs, unsigned long rip); +int pv_emul_is_mem_write(const struct x86_emulate_state *state, + struct x86_emulate_ctxt *ctxt); + #endif /* __PV_EMULATE_H__ */