From patchwork Wed Dec 2 14:49:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 11946319 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8A0BDC64E7B for ; Wed, 2 Dec 2020 14:50:12 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 168D9221EB for ; Wed, 2 Dec 2020 14:50:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 168D9221EB Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.42802.77035 (Exim 4.92) (envelope-from ) id 1kkTSB-00041z-6d; Wed, 02 Dec 2020 14:49:59 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 42802.77035; Wed, 02 Dec 2020 14:49:59 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kkTSB-00041s-3O; Wed, 02 Dec 2020 14:49:59 +0000 Received: by outflank-mailman (input) for mailman id 42802; Wed, 02 Dec 2020 14:49:57 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kkTS9-00041k-T7 for xen-devel@lists.xenproject.org; Wed, 02 Dec 2020 14:49:57 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 1f3c7dcf-7af3-42bd-aa4f-e4df48286bf8; Wed, 02 Dec 2020 14:49:56 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id A5FA1AB63; Wed, 2 Dec 2020 14:49:55 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 1f3c7dcf-7af3-42bd-aa4f-e4df48286bf8 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1606920595; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7+x+U2qTlkcoxC0HiG5vY4DnoiLDrqjJYZR5n9P0NNM=; b=iPOSzDxyS4dbHIQgSYsUTpxKCXTunemEYHw+KaOkv1nk2yTACyxAp8EgyTesSkvnRBr8KY RQabmeCDMRxtzM5kXaL7I/l3xO4tayyW9Nj8hBo/4KOLKuxO6nqeUI7BNURY3el//IAkHJ TihDkl3lyTKfByN++Km1df8S9KkL6YU= Subject: [PATCH 1/2] include: don't use asm/page.h from common headers From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu , Hongyan Xia References: <75484377-160c-a529-1cfc-96de86cfc550@suse.com> Message-ID: <04276039-a5d0-fefd-260e-ffaa8272fd6a@suse.com> Date: Wed, 2 Dec 2020 15:49:55 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <75484377-160c-a529-1cfc-96de86cfc550@suse.com> Content-Language: en-US Doing so limits what can be done in (in particular included by) this per- arch header. Abstract out page shift/size related #define-s, which is all the repsecitve headers care about. Extend the replacement / removal to some x86 headers as well; some others now need to include page.h (and they really should have before). Arm's VADDR_BITS gets restricted to 32-bit, as its current value is clearly wrong for 64-bit, but the constant also isn't used anywhere right now (i.e. the #define could also be dropped altogether). I wasn't sure about Arm's use of vaddr_t in PAGE_OFFSET(), and hence I kept it and provided a way to override the #define in the common header. Also drop the dead PAGE_FLAG_MASK altogether at this occasion. Signed-off-by: Jan Beulich --- a/xen/arch/arm/arm64/lib/clear_page.S +++ b/xen/arch/arm/arm64/lib/clear_page.S @@ -14,6 +14,8 @@ * along with this program. If not, see . */ +#include + /* * Clear page @dest * --- a/xen/include/asm-arm/config.h +++ b/xen/include/asm-arm/config.h @@ -176,11 +176,6 @@ #define FIXMAP_ACPI_BEGIN 2 /* Start mappings of ACPI tables */ #define FIXMAP_ACPI_END (FIXMAP_ACPI_BEGIN + NUM_FIXMAP_ACPI_PAGES - 1) /* End mappings of ACPI tables */ -#define PAGE_SHIFT 12 -#define PAGE_SIZE (_AC(1,L) << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE-1)) -#define PAGE_FLAG_MASK (~0) - #define NR_hypercalls 64 #define STACK_ORDER 3 --- a/xen/include/asm-arm/current.h +++ b/xen/include/asm-arm/current.h @@ -1,6 +1,7 @@ #ifndef __ARM_CURRENT_H__ #define __ARM_CURRENT_H__ +#include #include #include --- /dev/null +++ b/xen/include/asm-arm/page-shift.h @@ -0,0 +1,15 @@ +#ifndef __ARM_PAGE_SHIFT_H__ +#define __ARM_PAGE_SHIFT_H__ + +#define PAGE_SHIFT 12 + +#define PAGE_OFFSET(ptr) ((vaddr_t)(ptr) & ~PAGE_MASK) + +#ifdef CONFIG_ARM_64 +#define PADDR_BITS 48 +#else +#define PADDR_BITS 40 +#define VADDR_BITS 32 +#endif + +#endif /* __ARM_PAGE_SHIFT_H__ */ --- a/xen/include/asm-arm/page.h +++ b/xen/include/asm-arm/page.h @@ -2,21 +2,11 @@ #define __ARM_PAGE_H__ #include +#include #include #include #include -#ifdef CONFIG_ARM_64 -#define PADDR_BITS 48 -#else -#define PADDR_BITS 40 -#endif -#define PADDR_MASK ((1ULL << PADDR_BITS)-1) -#define PAGE_OFFSET(ptr) ((vaddr_t)(ptr) & ~PAGE_MASK) - -#define VADDR_BITS 32 -#define VADDR_MASK (~0UL) - /* Shareability values for the LPAE entries */ #define LPAE_SH_NON_SHAREABLE 0x0 #define LPAE_SH_UNPREDICTALE 0x1 --- a/xen/include/asm-x86/current.h +++ b/xen/include/asm-x86/current.h @@ -8,8 +8,8 @@ #define __X86_CURRENT_H__ #include +#include #include -#include /* * Xen's cpu stacks are 8 pages (8-page aligned), arranged as: --- a/xen/include/asm-x86/desc.h +++ b/xen/include/asm-x86/desc.h @@ -1,6 +1,8 @@ #ifndef __ARCH_DESC_H #define __ARCH_DESC_H +#include + /* * Xen reserves a memory page of GDT entries. * No guest GDT entries exist beyond the Xen reserved area. --- a/xen/include/asm-x86/fixmap.h +++ b/xen/include/asm-x86/fixmap.h @@ -12,7 +12,7 @@ #ifndef _ASM_FIXMAP_H #define _ASM_FIXMAP_H -#include +#include #define FIXADDR_TOP (VMAP_VIRT_END - PAGE_SIZE) #define FIXADDR_X_TOP (XEN_VIRT_END - PAGE_SIZE) --- a/xen/include/asm-x86/guest/hyperv-hcall.h +++ b/xen/include/asm-x86/guest/hyperv-hcall.h @@ -20,12 +20,12 @@ #define __X86_HYPERV_HCALL_H__ #include +#include #include #include #include #include -#include static inline uint64_t hv_do_hypercall(uint64_t control, paddr_t input_addr, paddr_t output_addr) --- a/xen/include/asm-x86/guest/hyperv-tlfs.h +++ b/xen/include/asm-x86/guest/hyperv-tlfs.h @@ -10,8 +10,8 @@ #define _ASM_X86_HYPERV_TLFS_H #include +#include #include -#include /* * While not explicitly listed in the TLFS, Hyper-V always runs with a page size --- a/xen/include/asm-x86/io.h +++ b/xen/include/asm-x86/io.h @@ -3,7 +3,6 @@ #include #include -#include #define readb(x) (*(volatile uint8_t *)(x)) #define readw(x) (*(volatile uint16_t *)(x)) --- a/xen/include/asm-x86/mm.h +++ b/xen/include/asm-x86/mm.h @@ -6,6 +6,7 @@ #include #include #include +#include #include #include --- /dev/null +++ b/xen/include/asm-x86/page-shift.h @@ -0,0 +1,26 @@ +#ifndef __X86_PAGE_SHIFT_H__ +#define __X86_PAGE_SHIFT_H__ + +#define L1_PAGETABLE_SHIFT 12 +#define L2_PAGETABLE_SHIFT 21 +#define L3_PAGETABLE_SHIFT 30 +#define L4_PAGETABLE_SHIFT 39 +#define PAGE_SHIFT L1_PAGETABLE_SHIFT +#define SUPERPAGE_SHIFT L2_PAGETABLE_SHIFT +#define ROOT_PAGETABLE_SHIFT L4_PAGETABLE_SHIFT + +#define PAGETABLE_ORDER 9 +#define L1_PAGETABLE_ENTRIES (1 << PAGETABLE_ORDER) +#define L2_PAGETABLE_ENTRIES (1 << PAGETABLE_ORDER) +#define L3_PAGETABLE_ENTRIES (1 << PAGETABLE_ORDER) +#define L4_PAGETABLE_ENTRIES (1 << PAGETABLE_ORDER) +#define ROOT_PAGETABLE_ENTRIES L4_PAGETABLE_ENTRIES + +#define SUPERPAGE_ORDER PAGETABLE_ORDER +#define SUPERPAGE_PAGES (1 << SUPERPAGE_ORDER) + +/* These are architectural limits. */ +#define PADDR_BITS 52 +#define VADDR_BITS 48 + +#endif /* __X86_PAGE_SHIFT_H__ */ --- a/xen/include/asm-x86/page.h +++ b/xen/include/asm-x86/page.h @@ -2,15 +2,7 @@ #define __X86_PAGE_H__ #include - -/* - * It is important that the masks are signed quantities. This ensures that - * the compiler sign-extends a 32-bit mask to 64 bits if that is required. - */ -#define PAGE_SIZE (_AC(1,L) << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE-1)) -#define PAGE_FLAG_MASK (~0) -#define PAGE_OFFSET(ptr) ((unsigned long)(ptr) & ~PAGE_MASK) +#include #define PAGE_ORDER_4K 0 #define PAGE_ORDER_2M 9 --- a/xen/include/asm-x86/uaccess.h +++ b/xen/include/asm-x86/uaccess.h @@ -6,7 +6,6 @@ #include #include #include -#include #include --- a/xen/include/asm-x86/x86_64/page.h +++ b/xen/include/asm-x86/x86_64/page.h @@ -2,31 +2,8 @@ #ifndef __X86_64_PAGE_H__ #define __X86_64_PAGE_H__ -#define L1_PAGETABLE_SHIFT 12 -#define L2_PAGETABLE_SHIFT 21 -#define L3_PAGETABLE_SHIFT 30 -#define L4_PAGETABLE_SHIFT 39 -#define PAGE_SHIFT L1_PAGETABLE_SHIFT -#define SUPERPAGE_SHIFT L2_PAGETABLE_SHIFT -#define ROOT_PAGETABLE_SHIFT L4_PAGETABLE_SHIFT - -#define PAGETABLE_ORDER 9 -#define L1_PAGETABLE_ENTRIES (1< #include -#include #ifdef CONFIG_CRASH_DEBUG --- a/xen/include/xen/grant_table.h +++ b/xen/include/xen/grant_table.h @@ -26,7 +26,6 @@ #include #include #include -#include #include #ifdef CONFIG_GRANT_TABLE --- /dev/null +++ b/xen/include/xen/page-size.h @@ -0,0 +1,21 @@ +#ifndef __XEN_PAGE_SIZE_H__ +#define __XEN_PAGE_SIZE_H__ + +#include +#include + +/* + * It is important that the masks are signed quantities. This ensures that + * the compiler sign-extends a 32-bit mask to 64 bits if that is required. + */ +#define PAGE_SIZE (_AC(1,L) << PAGE_SHIFT) +#define PAGE_MASK (~(PAGE_SIZE-1)) + +#ifndef PAGE_OFFSET +# define PAGE_OFFSET(ptr) ((unsigned long)(ptr) & ~PAGE_MASK) +#endif + +#define PADDR_MASK ((_AC(1,ULL) << PADDR_BITS) - 1) +#define VADDR_MASK (~_AC(0,UL) >> (BITS_PER_LONG - VADDR_BITS)) + +#endif /* __XEN_PAGE_SIZE__ */ --- a/xen/include/xen/pfn.h +++ b/xen/include/xen/pfn.h @@ -1,7 +1,7 @@ #ifndef __XEN_PFN_H__ #define __XEN_PFN_H__ -#include +#include #define PFN_DOWN(x) ((x) >> PAGE_SHIFT) #define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT) --- a/xen/include/xen/vmap.h +++ b/xen/include/xen/vmap.h @@ -2,7 +2,7 @@ #define __XEN_VMAP_H__ #include -#include +#include enum vmap_region { VMAP_DEFAULT, From patchwork Wed Dec 2 14:50:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 11946321 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46A2BC64E7C for ; Wed, 2 Dec 2020 14:50:47 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C46E3221FB for ; Wed, 2 Dec 2020 14:50:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C46E3221FB Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.42808.77048 (Exim 4.92) (envelope-from ) id 1kkTSn-0004oN-IB; Wed, 02 Dec 2020 14:50:37 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 42808.77048; Wed, 02 Dec 2020 14:50:37 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kkTSn-0004oG-DX; Wed, 02 Dec 2020 14:50:37 +0000 Received: by outflank-mailman (input) for mailman id 42808; Wed, 02 Dec 2020 14:50:36 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kkTSm-0004nm-T7 for xen-devel@lists.xenproject.org; Wed, 02 Dec 2020 14:50:36 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 7ecea57c-c1d9-4e4f-8a57-dddf8277fe9f; Wed, 02 Dec 2020 14:50:32 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 3CDE2ACC3; Wed, 2 Dec 2020 14:50:31 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 7ecea57c-c1d9-4e4f-8a57-dddf8277fe9f X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1606920631; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MHnA0jwUib1BTdgfMxgCIDNTuw+txuIpBV3gHXdrMEk=; b=BkESPxBEKvBcMktSuI8jpK4IsXRhEjxcLecUJl0O9VvZJbJMpdhEgCbVXIuhuvtmr3R3et YtKGMxtHgO5DUh4JqG2SZY2k4yw010BFb8jfklC5tOae2Krq1LppnkKZpQ7hzbnvDcP4cu 9qtwQ+jLdQghcwPd92tnItRepdAkPpw= Subject: [PATCH 2/2] mm: split out mfn_t / gfn_t / pfn_t definitions and helpers From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu , Hongyan Xia References: <75484377-160c-a529-1cfc-96de86cfc550@suse.com> Message-ID: Date: Wed, 2 Dec 2020 15:50:30 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <75484377-160c-a529-1cfc-96de86cfc550@suse.com> Content-Language: en-US xen/mm.h has heavy dependencies, while in a number of cases only these type definitions are needed. This separation then also allows pulling in these definitions when including xen/mm.h would cause cyclic dependencies. Replace xen/mm.h inclusion where possible in include/xen/. (In xen/iommu.h also take the opportunity and correct the few remaining sorting issues.) Signed-off-by: Jan Beulich --- a/xen/arch/x86/acpi/power.c +++ b/xen/arch/x86/acpi/power.c @@ -10,7 +10,6 @@ * Slimmed with Xen specific support. */ -#include #include #include #include --- a/xen/drivers/char/meson-uart.c +++ b/xen/drivers/char/meson-uart.c @@ -18,7 +18,9 @@ * License along with this program; If not, see . */ +#include #include +#include #include #include #include --- a/xen/drivers/char/mvebu-uart.c +++ b/xen/drivers/char/mvebu-uart.c @@ -18,7 +18,9 @@ * License along with this program; If not, see . */ +#include #include +#include #include #include #include --- a/xen/include/asm-x86/io.h +++ b/xen/include/asm-x86/io.h @@ -49,6 +49,7 @@ __OUT(l,,int) /* Function pointer used to handle platform specific I/O port emulation. */ #define IOEMUL_QUIRK_STUB_BYTES 9 +struct cpu_user_regs; extern unsigned int (*ioemul_handle_quirk)( u8 opcode, char *io_emul_stub, struct cpu_user_regs *regs); --- /dev/null +++ b/xen/include/xen/frame-num.h @@ -0,0 +1,96 @@ +#ifndef __XEN_FRAME_NUM_H__ +#define __XEN_FRAME_NUM_H__ + +#include +#include + +TYPE_SAFE(unsigned long, mfn); +#define PRI_mfn "05lx" +#define INVALID_MFN _mfn(~0UL) +/* + * To be used for global variable initialization. This workaround a bug + * in GCC < 5.0. + */ +#define INVALID_MFN_INITIALIZER { ~0UL } + +#ifndef mfn_t +#define mfn_t /* Grep fodder: mfn_t, _mfn() and mfn_x() are defined above */ +#define _mfn +#define mfn_x +#undef mfn_t +#undef _mfn +#undef mfn_x +#endif + +static inline mfn_t mfn_add(mfn_t mfn, unsigned long i) +{ + return _mfn(mfn_x(mfn) + i); +} + +static inline mfn_t mfn_max(mfn_t x, mfn_t y) +{ + return _mfn(max(mfn_x(x), mfn_x(y))); +} + +static inline mfn_t mfn_min(mfn_t x, mfn_t y) +{ + return _mfn(min(mfn_x(x), mfn_x(y))); +} + +static inline bool_t mfn_eq(mfn_t x, mfn_t y) +{ + return mfn_x(x) == mfn_x(y); +} + +TYPE_SAFE(unsigned long, gfn); +#define PRI_gfn "05lx" +#define INVALID_GFN _gfn(~0UL) +/* + * To be used for global variable initialization. This workaround a bug + * in GCC < 5.0 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64856 + */ +#define INVALID_GFN_INITIALIZER { ~0UL } + +#ifndef gfn_t +#define gfn_t /* Grep fodder: gfn_t, _gfn() and gfn_x() are defined above */ +#define _gfn +#define gfn_x +#undef gfn_t +#undef _gfn +#undef gfn_x +#endif + +static inline gfn_t gfn_add(gfn_t gfn, unsigned long i) +{ + return _gfn(gfn_x(gfn) + i); +} + +static inline gfn_t gfn_max(gfn_t x, gfn_t y) +{ + return _gfn(max(gfn_x(x), gfn_x(y))); +} + +static inline gfn_t gfn_min(gfn_t x, gfn_t y) +{ + return _gfn(min(gfn_x(x), gfn_x(y))); +} + +static inline bool_t gfn_eq(gfn_t x, gfn_t y) +{ + return gfn_x(x) == gfn_x(y); +} + +TYPE_SAFE(unsigned long, pfn); +#define PRI_pfn "05lx" +#define INVALID_PFN (~0UL) + +#ifndef pfn_t +#define pfn_t /* Grep fodder: pfn_t, _pfn() and pfn_x() are defined above */ +#define _pfn +#define pfn_x +#undef pfn_t +#undef _pfn +#undef pfn_x +#endif + +#endif /* __XEN_FRAME_NUM_H__ */ --- a/xen/include/xen/grant_table.h +++ b/xen/include/xen/grant_table.h @@ -23,7 +23,7 @@ #ifndef __XEN_GRANT_TABLE_H__ #define __XEN_GRANT_TABLE_H__ -#include +#include #include #include #include --- a/xen/include/xen/iommu.h +++ b/xen/include/xen/iommu.h @@ -19,14 +19,13 @@ #ifndef _IOMMU_H_ #define _IOMMU_H_ +#include #include #include -#include #include -#include -#include -#include +#include #include +#include #include TYPE_SAFE(uint64_t, dfn); --- a/xen/include/xen/mm.h +++ b/xen/include/xen/mm.h @@ -51,103 +51,13 @@ #define __XEN_MM_H__ #include +#include #include #include #include -#include -#include #include #include -TYPE_SAFE(unsigned long, mfn); -#define PRI_mfn "05lx" -#define INVALID_MFN _mfn(~0UL) -/* - * To be used for global variable initialization. This workaround a bug - * in GCC < 5.0. - */ -#define INVALID_MFN_INITIALIZER { ~0UL } - -#ifndef mfn_t -#define mfn_t /* Grep fodder: mfn_t, _mfn() and mfn_x() are defined above */ -#define _mfn -#define mfn_x -#undef mfn_t -#undef _mfn -#undef mfn_x -#endif - -static inline mfn_t mfn_add(mfn_t mfn, unsigned long i) -{ - return _mfn(mfn_x(mfn) + i); -} - -static inline mfn_t mfn_max(mfn_t x, mfn_t y) -{ - return _mfn(max(mfn_x(x), mfn_x(y))); -} - -static inline mfn_t mfn_min(mfn_t x, mfn_t y) -{ - return _mfn(min(mfn_x(x), mfn_x(y))); -} - -static inline bool_t mfn_eq(mfn_t x, mfn_t y) -{ - return mfn_x(x) == mfn_x(y); -} - -TYPE_SAFE(unsigned long, gfn); -#define PRI_gfn "05lx" -#define INVALID_GFN _gfn(~0UL) -/* - * To be used for global variable initialization. This workaround a bug - * in GCC < 5.0 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64856 - */ -#define INVALID_GFN_INITIALIZER { ~0UL } - -#ifndef gfn_t -#define gfn_t /* Grep fodder: gfn_t, _gfn() and gfn_x() are defined above */ -#define _gfn -#define gfn_x -#undef gfn_t -#undef _gfn -#undef gfn_x -#endif - -static inline gfn_t gfn_add(gfn_t gfn, unsigned long i) -{ - return _gfn(gfn_x(gfn) + i); -} - -static inline gfn_t gfn_max(gfn_t x, gfn_t y) -{ - return _gfn(max(gfn_x(x), gfn_x(y))); -} - -static inline gfn_t gfn_min(gfn_t x, gfn_t y) -{ - return _gfn(min(gfn_x(x), gfn_x(y))); -} - -static inline bool_t gfn_eq(gfn_t x, gfn_t y) -{ - return gfn_x(x) == gfn_x(y); -} - -TYPE_SAFE(unsigned long, pfn); -#define PRI_pfn "05lx" -#define INVALID_PFN (~0UL) - -#ifndef pfn_t -#define pfn_t /* Grep fodder: pfn_t, _pfn() and pfn_x() are defined above */ -#define _pfn -#define pfn_x -#undef pfn_t -#undef _pfn -#undef pfn_x -#endif - struct page_info; void put_page(struct page_info *); --- a/xen/include/xen/p2m-common.h +++ b/xen/include/xen/p2m-common.h @@ -1,7 +1,7 @@ #ifndef _XEN_P2M_COMMON_H #define _XEN_P2M_COMMON_H -#include +#include /* Remove a page from a domain's p2m table */ int __must_check --- a/xen/include/xen/vmap.h +++ b/xen/include/xen/vmap.h @@ -1,7 +1,7 @@ #if !defined(__XEN_VMAP_H__) && defined(VMAP_VIRT_START) #define __XEN_VMAP_H__ -#include +#include #include enum vmap_region {