From patchwork Thu Mar 2 17:53:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vitaly Kuznetsov X-Patchwork-Id: 9601231 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 2686F60522 for ; Thu, 2 Mar 2017 17:56:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D2AB285CC for ; Thu, 2 Mar 2017 17:56:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 11F55285D0; Thu, 2 Mar 2017 17:56:05 +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 8370D285CD for ; Thu, 2 Mar 2017 17:56:04 +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 1cjUvz-0003uv-Ez; Thu, 02 Mar 2017 17:54:35 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cjUvy-0003sH-2k for xen-devel@lists.xenproject.org; Thu, 02 Mar 2017 17:54:34 +0000 Received: from [85.158.137.68] by server-11.bemta-3.messagelabs.com id 85/85-23940-95C58B85; Thu, 02 Mar 2017 17:54:33 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrCLMWRWlGSWpSXmKPExsVysWW7jG5EzI4 Ig6NTFC2+b5nM5MDocfjDFZYAxijWzLyk/IoE1oxtq/4xFRwRqtj3Lr+B8TF/FyMXh5DAbiaJ JUu2MkE4hxkl7pzpZ+9i5ORgE9CR+P70FDOILSKgJHFv1WSwImaBTYwSD1pPgxUJC/hKXH42g RXEZhFQlfix8gkLiM0rYCEx8ctBsDgnkH1z0mVGEFtIwFxi0pUZYHEJAW2Jsw2/2EGGSgj0MU pMONrCOIGRZwEjwypGjeLUorLUIl0jY72kosz0jJLcxMwcXUMDY73c1OLixPTUnMSkYr3k/Nx NjEDf1zMwMO5g7Nvrd4hRkoNJSZTXKnpHhBBfUn5KZUZicUZ8UWlOavEhRhkODiUJ3nqQnGBR anpqRVpmDjAIYdISHDxKIryqIGne4oLE3OLMdIjUKUZFKXHeBpCEAEgiozQPrg0W+JcYZaWEe RkZGBiEeApSi3IzS1DlXzGKczAqCfPWgEzhycwrgZv+CmgxE9DiFypbQRaXJCKkpBoYexyVEh 64/12Xw/OiyGWvS81G28a4dIWcz2dCXDMuhQm6pM29FLRggUXNt9I1x4y/6kjLK2gzclxYtcj 3+6Jty9+p+n74OkNdqubr8aRfTWqpFvLLOXg9BXT2zzn8ZerZdZ7nDBbIL99pFbyj9GcGU9CX DQ2+JzlzDt8SMBKZcsK2skk7OLhNiaU4I9FQi7moOBEAFFw72ncCAAA= X-Env-Sender: vkuznets@redhat.com X-Msg-Ref: server-11.tower-31.messagelabs.com!1488477271!57401580!1 X-Originating-IP: [209.132.183.28] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMjA5LjEzMi4xODMuMjggPT4gNTQwNjQ=\n X-StarScan-Received: X-StarScan-Version: 9.2.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 29227 invoked from network); 2 Mar 2017 17:54:32 -0000 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by server-11.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 2 Mar 2017 17:54:32 -0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BB8EEA429E; Thu, 2 Mar 2017 17:54:31 +0000 (UTC) Received: from vitty.brq.redhat.com (vitty.brq.redhat.com [10.34.26.3]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v22HrwkD010760; Thu, 2 Mar 2017 12:54:30 -0500 From: Vitaly Kuznetsov To: xen-devel@lists.xenproject.org Date: Thu, 2 Mar 2017 18:53:53 +0100 Message-Id: <20170302175357.8222-18-vkuznets@redhat.com> In-Reply-To: <20170302175357.8222-1-vkuznets@redhat.com> References: <20170302175357.8222-1-vkuznets@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 02 Mar 2017 17:54:31 +0000 (UTC) Cc: Juergen Gross , Boris Ostrovsky , x86@kernel.org, Andrew Jones , linux-kernel@vger.kernel.org Subject: [Xen-devel] [PATCH v2 17/21] x86/xen: create stubs for HVM-only builds in page.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: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP __pfn_to_mfn() is only used from PV code (mmu_pv.c, p2m.c) and from page.h where all functions calling it check for xen_feature(XENFEAT_auto_translated_physmap) first so we can replace it with any stub to make build happy. set_foreign_p2m_mapping()/clear_foreign_p2m_mapping() are used from grant-table.c but only if !xen_feature(XENFEAT_auto_translated_physmap). Signed-off-by: Vitaly Kuznetsov Reviewed-by: Juergen Gross --- arch/x86/include/asm/xen/page.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/arch/x86/include/asm/xen/page.h b/arch/x86/include/asm/xen/page.h index 33cbd3d..0bf4bb34 100644 --- a/arch/x86/include/asm/xen/page.h +++ b/arch/x86/include/asm/xen/page.h @@ -51,12 +51,30 @@ extern bool __set_phys_to_machine(unsigned long pfn, unsigned long mfn); extern unsigned long __init set_phys_range_identity(unsigned long pfn_s, unsigned long pfn_e); +#ifdef CONFIG_XEN_PV extern int set_foreign_p2m_mapping(struct gnttab_map_grant_ref *map_ops, struct gnttab_map_grant_ref *kmap_ops, struct page **pages, unsigned int count); extern int clear_foreign_p2m_mapping(struct gnttab_unmap_grant_ref *unmap_ops, struct gnttab_unmap_grant_ref *kunmap_ops, struct page **pages, unsigned int count); +#else +static inline int +set_foreign_p2m_mapping(struct gnttab_map_grant_ref *map_ops, + struct gnttab_map_grant_ref *kmap_ops, + struct page **pages, unsigned int count) +{ + return 0; +} + +static inline int +clear_foreign_p2m_mapping(struct gnttab_unmap_grant_ref *unmap_ops, + struct gnttab_unmap_grant_ref *kunmap_ops, + struct page **pages, unsigned int count) +{ + return 0; +} +#endif /* * Helper functions to write or read unsigned long values to/from @@ -72,6 +90,7 @@ static inline int xen_safe_read_ulong(unsigned long *addr, unsigned long *val) return __get_user(*val, (unsigned long __user *)addr); } +#ifdef CONFIG_XEN_PV /* * When to use pfn_to_mfn(), __pfn_to_mfn() or get_phys_to_machine(): * - pfn_to_mfn() returns either INVALID_P2M_ENTRY or the mfn. No indicator @@ -98,6 +117,12 @@ static inline unsigned long __pfn_to_mfn(unsigned long pfn) return mfn; } +#else +static inline unsigned long __pfn_to_mfn(unsigned long pfn) +{ + return pfn; +} +#endif static inline unsigned long pfn_to_mfn(unsigned long pfn) {