From patchwork Sun Jul 30 15:43:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Liu X-Patchwork-Id: 9870547 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 E470B60353 for ; Sun, 30 Jul 2017 15:46:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D634928599 for ; Sun, 30 Jul 2017 15:46:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CACCB2859F; Sun, 30 Jul 2017 15:46:39 +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 5148528599 for ; Sun, 30 Jul 2017 15:46:39 +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 1dbqNc-0006M7-9D; Sun, 30 Jul 2017 15:43:44 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dbqNa-0006LG-G7 for xen-devel@lists.xenproject.org; Sun, 30 Jul 2017 15:43:42 +0000 Received: from [193.109.254.147] by server-5.bemta-6.messagelabs.com id 47/4A-03368-DAEFD795; Sun, 30 Jul 2017 15:43:41 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprIIsWRWlGSWpSXmKPExsXitHRDpO7af7W RBr/XSlt83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBlT/yxjLXgpXnHt1FPGBsZjgl2MnBwSAv4S t5ZcYgGx2QSUJX529rKB2CICehJNB54zdjFycTALzGGUmDq3ixEkISzgJ/F5Wx9rFyMHB4uAq sT+X7ogYV4BC4mXn3rYIGbKS+xqu8gKYnMKWEpsWtLFBGILCaRKnDm2gh3CVpDomH6MCaJXUO LkzCdgNzALSEgcfPGCeQIj7ywkqVlIUgsYmVYxahSnFpWlFukaG+olFWWmZ5TkJmbm6BoamOn lphYXJ6an5iQmFesl5+duYgQGDwMQ7GBsWhR4iFGSg0lJlHcdd22kEF9SfkplRmJxRnxRaU5q 8SFGGQ4OJQnewr9AOcGi1PTUirTMHGAYw6QlOHiURHingaR5iwsSc4sz0yFSpxh1OV5N+P+NS YglLz8vVUqctwGkSACkKKM0D24ELKYuMcpKCfMyAh0lxFOQWpSbWYIq/4pRnINRSZg3GWQKT2 ZeCdymV0BHMAEdIVkKdkRJIkJKqoHx+BWXkyy8KrZXROpNV/KkXumVr5ni+5m3teqB4s65Xaf i5hx7u9hm6fazGoX6q+MOv3Q++q3j6kfDXfLdTUnXuR4Fx4lzqIsbizx/yNE96/l3FYtQuYfK s9uNzb7ls9bd7pXbzL/MdJbFp8y4X4p+z3SmMCae0Xy+y+l+teWiYKaYpwVJVqeUWIozEg21m IuKEwFFlPo5pAIAAA== X-Env-Sender: prvs=37723ee83=wei.liu2@citrix.com X-Msg-Ref: server-3.tower-27.messagelabs.com!1501429419!109213908!2 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: 9.4.25; banners=-,-,- X-VirusChecked: Checked Received: (qmail 17811 invoked from network); 30 Jul 2017 15:43:41 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-3.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 30 Jul 2017 15:43:41 -0000 X-IronPort-AV: E=Sophos;i="5.40,437,1496102400"; d="scan'208";a="433622811" From: Wei Liu To: Xen-devel Date: Sun, 30 Jul 2017 16:43:28 +0100 Message-ID: <20170730154335.24313-5-wei.liu2@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170730154335.24313-1-wei.liu2@citrix.com> References: <20170720160426.2343-1-wei.liu2@citrix.com> <20170730154335.24313-1-wei.liu2@citrix.com> MIME-Version: 1.0 Cc: George Dunlap , Andrew Cooper , Wei Liu , Jan Beulich Subject: [Xen-devel] [PATCH v3 extra 04/11] x86/mm: move disallow_mask variable and macros 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 They will be used by both common mm code and PV mm code in the next few patches. Note that they might be moved again later if they aren't needed by common mm code any more. Signed-off-by: Wei Liu --- xen/arch/x86/mm.c | 19 +------------------ xen/include/asm-x86/mm.h | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index 0c6a6de1a9..5545a6f4de 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -146,24 +146,7 @@ bool __read_mostly machine_to_phys_mapping_valid; struct rangeset *__read_mostly mmio_ro_ranges; -static uint32_t base_disallow_mask; -/* Global bit is allowed to be set on L1 PTEs. Intended for user mappings. */ -#define L1_DISALLOW_MASK ((base_disallow_mask | _PAGE_GNTTAB) & ~_PAGE_GLOBAL) - -#define L2_DISALLOW_MASK base_disallow_mask - -#define l3_disallow_mask(d) (!is_pv_32bit_domain(d) ? \ - base_disallow_mask : 0xFFFFF198U) - -#define L4_DISALLOW_MASK (base_disallow_mask) - -#define l1_disallow_mask(d) \ - ((d != dom_io) && \ - (rangeset_is_empty((d)->iomem_caps) && \ - rangeset_is_empty((d)->arch.ioport_caps) && \ - !has_arch_pdevs(d) && \ - is_pv_domain(d)) ? \ - L1_DISALLOW_MASK : (L1_DISALLOW_MASK & ~PAGE_CACHE_ATTRS)) +uint32_t base_disallow_mask; static s8 __read_mostly opt_mmio_relax; static void __init parse_mmio_relax(const char *s) diff --git a/xen/include/asm-x86/mm.h b/xen/include/asm-x86/mm.h index 07d4c06fc3..6857651db1 100644 --- a/xen/include/asm-x86/mm.h +++ b/xen/include/asm-x86/mm.h @@ -334,6 +334,25 @@ const unsigned long *get_platform_badpages(unsigned int *array_size); int page_lock(struct page_info *page); void page_unlock(struct page_info *page); +extern uint32_t base_disallow_mask; +/* Global bit is allowed to be set on L1 PTEs. Intended for user mappings. */ +#define L1_DISALLOW_MASK ((base_disallow_mask | _PAGE_GNTTAB) & ~_PAGE_GLOBAL) + +#define L2_DISALLOW_MASK base_disallow_mask + +#define l3_disallow_mask(d) (!is_pv_32bit_domain(d) ? \ + base_disallow_mask : 0xFFFFF198U) + +#define L4_DISALLOW_MASK (base_disallow_mask) + +#define l1_disallow_mask(d) \ + ((d != dom_io) && \ + (rangeset_is_empty((d)->iomem_caps) && \ + rangeset_is_empty((d)->arch.ioport_caps) && \ + !has_arch_pdevs(d) && \ + is_pv_domain(d)) ? \ + L1_DISALLOW_MASK : (L1_DISALLOW_MASK & ~PAGE_CACHE_ATTRS)) + void put_page_type(struct page_info *page); int get_page_type(struct page_info *page, unsigned long type); int put_page_type_preemptible(struct page_info *page);