From nobody Fri May 17 16:48:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=arm.com Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1662362846377549.0944194653483; Mon, 5 Sep 2022 00:27:26 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.398529.639398 (Exim 4.92) (envelope-from ) id 1oV6Ve-0001pA-7Z; Mon, 05 Sep 2022 07:27:06 +0000 Received: by outflank-mailman (output) from mailman id 398529.639398; Mon, 05 Sep 2022 07:27:06 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oV6Ve-0001ow-4M; Mon, 05 Sep 2022 07:27:06 +0000 Received: by outflank-mailman (input) for mailman id 398529; Mon, 05 Sep 2022 07:27:05 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oV6Vd-0001oQ-6q for xen-devel@lists.xenproject.org; Mon, 05 Sep 2022 07:27:05 +0000 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by se1-gles-sth1.inumbo.com (Halon) with ESMTP id 2348637a-2cec-11ed-a016-b9edf5238543; Mon, 05 Sep 2022 09:27:03 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 43DA0ED1; Mon, 5 Sep 2022 00:27:09 -0700 (PDT) Received: from entos-skylake.shanghai.arm.com (entos-skylake.shanghai.arm.com [10.169.212.207]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C40923F73D; Mon, 5 Sep 2022 00:27:28 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 2348637a-2cec-11ed-a016-b9edf5238543 From: Henry Wang To: xen-devel@lists.xenproject.org Cc: Henry Wang , Stefano Stabellini , Julien Grall , Bertrand Marquis , Wei Chen , Volodymyr Babchuk , Penny Zheng Subject: [PATCH v2 1/4] docs, xen/arm: Introduce reserved heap memory Date: Mon, 5 Sep 2022 07:26:32 +0000 Message-Id: <20220905072635.16294-2-Henry.Wang@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220905072635.16294-1-Henry.Wang@arm.com> References: <20220905072635.16294-1-Henry.Wang@arm.com> X-ZM-MESSAGEID: 1662362846820100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This commit introduces the reserved heap memory, which is parts of RAM reserved in the beginning of the boot time for heap. Firstly, since a new type of memory bank is needed for marking the memory bank solely as the heap, this commit defines `enum membank_type` and use this enum in function device_tree_get_meminfo(). Changes of code are done accordingly following the introduction of this enum. Also, this commit introduces the logic to parse the reserved heap configuration in device tree by reusing the device tree entry definition of the static memory allocation feature. If the memory bank is reserved as heap through `xen,static-heap` property in device tree `chosen` node, the memory will be marked as heap type. A documentation section is added, describing the definition of reserved heap memory and the method of enabling the reserved heap memory through device tree at boot time. Signed-off-by: Henry Wang Signed-off-by: Penny Zheng --- Changes from v1 to v2: - Rename the device tree property to xen,static-heap to avoid confusion. - Change of commit msg and doc wording, correct typo in commit msg. - Do not change the process_chosen_node() return type. - Add an empty line in make_memory_node() memory type check to improve readability. - Use enum membank_type to make the memory type cleaner. Changes from RFC to v1: - Rename the terminology to reserved heap. --- docs/misc/arm/device-tree/booting.txt | 45 +++++++++++++++++++++++++++ xen/arch/arm/bootfdt.c | 31 +++++++++++++++--- xen/arch/arm/domain_build.c | 8 +++-- xen/arch/arm/include/asm/setup.h | 7 ++++- xen/arch/arm/setup.c | 2 +- 5 files changed, 84 insertions(+), 9 deletions(-) diff --git a/docs/misc/arm/device-tree/booting.txt b/docs/misc/arm/device-t= ree/booting.txt index 98253414b8..ff7ca36715 100644 --- a/docs/misc/arm/device-tree/booting.txt +++ b/docs/misc/arm/device-tree/booting.txt @@ -378,3 +378,48 @@ device-tree: =20 This will reserve a 512MB region starting at the host physical address 0x30000000 to be exclusively used by DomU1. + + +Reserved Heap Memory +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +The reserved heap memory (also known as the statically-configured heap) re= fers +to parts of RAM reserved in the beginning of boot time for heap. The memor= y is +reserved by configuration in the device tree using physical address ranges. + +The reserved heap memory declared in the device tree defines the memory ar= eas +that will be reserved to be used exclusively as heap. + +- For Arm32, since there are seperated heaps, the reserved heap will be us= ed +for both domheap and xenheap. +- For Arm64, since there is a single heap, the defined reserved heap areas +shall always go to the heap allocator. + +The reserved heap memory is an optional feature and can be enabled by addi= ng +below device tree properties in the `chosen` node. + +The dtb should have the following properties: + +- xen,static-heap + + Property under the top-level "chosen" node. It specifies the address + and size of Xen reserved heap memory. + +- #xen,static-heap-address-cells and #xen,static-heap-size-cells + + Specify the number of cells used for the address and size of the + "xen,static-heap" property under "chosen". + +Below is an example on how to specify the reserved heap in device tree: + + / { + chosen { + #xen,static-heap-address-cells =3D <0x2>; + #xen,static-heap-size-cells =3D <0x2>; + xen,static-heap =3D <0x0 0x30000000 0x0 0x40000000>; + ... + }; + }; + +RAM starting from the host physical address 0x30000000 of 1GB size will +be reserved as heap. diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c index ec81a45de9..5af71dc8ba 100644 --- a/xen/arch/arm/bootfdt.c +++ b/xen/arch/arm/bootfdt.c @@ -64,7 +64,7 @@ void __init device_tree_get_reg(const __be32 **cell, u32 = address_cells, static int __init device_tree_get_meminfo(const void *fdt, int node, const char *prop_name, u32 address_cells, u32 size_cell= s, - void *data, bool xen_domain) + void *data, membank_type type) { const struct fdt_property *prop; unsigned int i, banks; @@ -95,7 +95,7 @@ static int __init device_tree_get_meminfo(const void *fdt= , int node, continue; mem->bank[mem->nr_banks].start =3D start; mem->bank[mem->nr_banks].size =3D size; - mem->bank[mem->nr_banks].xen_domain =3D xen_domain; + mem->bank[mem->nr_banks].type =3D type; mem->nr_banks++; } =20 @@ -185,7 +185,7 @@ static int __init process_memory_node(const void *fdt, = int node, void *data) { return device_tree_get_meminfo(fdt, node, "reg", address_cells, size_c= ells, - data, false); + data, MEMBANK_MEMORY); } =20 static int __init process_reserved_memory_node(const void *fdt, int node, @@ -301,6 +301,28 @@ static void __init process_chosen_node(const void *fdt= , int node, paddr_t start, end; int len; =20 + if ( fdt_get_property(fdt, node, "xen,static-heap", NULL) ) + { + u32 address_cells =3D device_tree_get_u32(fdt, node, + "#xen,static-heap-address-cells", 0); + u32 size_cells =3D device_tree_get_u32(fdt, node, + "#xen,static-heap-size-cells"= , 0); + + printk("Checking for reserved heap in /chosen\n"); + if ( address_cells < 1 || size_cells < 1 ) + { + printk("fdt: node `%s': invalid #xen,static-heap-address-cells= or #xen,static-heap-size-cells\n", + name); + return; + } + + if ( device_tree_get_meminfo(fdt, node, "xen,static-heap", + address_cells, size_cells, + &bootinfo.reserved_mem, + MEMBANK_RSVD_HEAP) ) + return; + } + printk("Checking for initrd in /chosen\n"); =20 prop =3D fdt_get_property(fdt, node, "linux,initrd-start", &len); @@ -358,7 +380,8 @@ static int __init process_domain_node(const void *fdt, = int node, "#xen,static-mem-size-cells", 0); =20 return device_tree_get_meminfo(fdt, node, "xen,static-mem", address_ce= lls, - size_cells, &bootinfo.reserved_mem, tru= e); + size_cells, &bootinfo.reserved_mem, + MEMBANK_XEN_DOMAIN); } =20 static int __init early_scan_node(const void *fdt, diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 3fd1186b53..1e46b95f0b 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -1038,9 +1038,11 @@ static int __init make_memory_node(const struct doma= in *d, if ( mem->nr_banks =3D=3D 0 ) return -ENOENT; =20 - /* find first memory range not bound to a Xen domain */ - for ( i =3D 0; i < mem->nr_banks && mem->bank[i].xen_domain; i++ ) + /* find first memory range not bound to a Xen domain nor heap */ + for ( i =3D 0; i < mem->nr_banks && + (mem->bank[i].type !=3D MEMBANK_MEMORY); i++ ) ; + if ( i =3D=3D mem->nr_banks ) return 0; =20 @@ -1062,7 +1064,7 @@ static int __init make_memory_node(const struct domai= n *d, u64 start =3D mem->bank[i].start; u64 size =3D mem->bank[i].size; =20 - if ( mem->bank[i].xen_domain ) + if ( mem->bank[i].type =3D=3D MEMBANK_XEN_DOMAIN ) continue; =20 dt_dprintk(" Bank %d: %#"PRIx64"->%#"PRIx64"\n", diff --git a/xen/arch/arm/include/asm/setup.h b/xen/arch/arm/include/asm/se= tup.h index 5815ccf8c5..d0cc556833 100644 --- a/xen/arch/arm/include/asm/setup.h +++ b/xen/arch/arm/include/asm/setup.h @@ -22,11 +22,16 @@ typedef enum { BOOTMOD_UNKNOWN } bootmodule_kind; =20 +typedef enum { + MEMBANK_MEMORY, + MEMBANK_XEN_DOMAIN, /* whether the memory bank is bound to a Xen domai= n. */ + MEMBANK_RSVD_HEAP, /* whether the memory bank is reserved as heap. */ +} membank_type; =20 struct membank { paddr_t start; paddr_t size; - bool xen_domain; /* whether the memory bank is bound to a Xen domain. = */ + membank_type type; }; =20 struct meminfo { diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index 6e0398f3f6..8d3f859982 100644 --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -644,7 +644,7 @@ static void __init init_staticmem_pages(void) =20 for ( bank =3D 0 ; bank < bootinfo.reserved_mem.nr_banks; bank++ ) { - if ( bootinfo.reserved_mem.bank[bank].xen_domain ) + if ( bootinfo.reserved_mem.bank[bank].type =3D=3D MEMBANK_XEN_DOMA= IN ) { mfn_t bank_start =3D _mfn(PFN_UP(bootinfo.reserved_mem.bank[ba= nk].start)); unsigned long bank_pages =3D PFN_DOWN(bootinfo.reserved_mem.ba= nk[bank].size); --=20 2.17.1 From nobody Fri May 17 16:48:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=arm.com Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1662362850126895.1327866153633; Mon, 5 Sep 2022 00:27:30 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.398530.639409 (Exim 4.92) (envelope-from ) id 1oV6Vk-0002CJ-Fm; Mon, 05 Sep 2022 07:27:12 +0000 Received: by outflank-mailman (output) from mailman id 398530.639409; Mon, 05 Sep 2022 07:27:12 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oV6Vk-0002CC-CQ; Mon, 05 Sep 2022 07:27:12 +0000 Received: by outflank-mailman (input) for mailman id 398530; Mon, 05 Sep 2022 07:27:10 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oV6Vi-0001Wq-Es for xen-devel@lists.xenproject.org; Mon, 05 Sep 2022 07:27:10 +0000 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by se1-gles-flk1.inumbo.com (Halon) with ESMTP id 26ae17ad-2cec-11ed-af93-0125da4c0113; Mon, 05 Sep 2022 09:27:09 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 12251139F; Mon, 5 Sep 2022 00:27:15 -0700 (PDT) Received: from entos-skylake.shanghai.arm.com (entos-skylake.shanghai.arm.com [10.169.212.207]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id D1E7E3F73D; Mon, 5 Sep 2022 00:27:34 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 26ae17ad-2cec-11ed-af93-0125da4c0113 From: Henry Wang To: xen-devel@lists.xenproject.org Cc: Henry Wang , Stefano Stabellini , Julien Grall , Bertrand Marquis , Wei Chen , Volodymyr Babchuk Subject: [PATCH v2 2/4] xen/arm: bootfdt: Make process_chosen_node() return int Date: Mon, 5 Sep 2022 07:26:33 +0000 Message-Id: <20220905072635.16294-3-Henry.Wang@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220905072635.16294-1-Henry.Wang@arm.com> References: <20220905072635.16294-1-Henry.Wang@arm.com> X-ZM-MESSAGEID: 1662362850717100005 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" At the boot time, it is saner to stop booting early if an error occurs when parsing the device tree chosen node, rather than seeing random behavior afterwards. Therefore, this commit changes the return type of the process_chosen_node() from void to int, and return correct errno based on the error type. Signed-off-by: Henry Wang --- Changes from v1 to v2: - New commit. --- xen/arch/arm/bootfdt.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c index 5af71dc8ba..3796a4bd75 100644 --- a/xen/arch/arm/bootfdt.c +++ b/xen/arch/arm/bootfdt.c @@ -293,9 +293,9 @@ static void __init process_multiboot_node(const void *f= dt, int node, kind, start, domU); } =20 -static void __init process_chosen_node(const void *fdt, int node, - const char *name, - u32 address_cells, u32 size_cells) +static int __init process_chosen_node(const void *fdt, int node, + const char *name, + u32 address_cells, u32 size_cells) { const struct fdt_property *prop; paddr_t start, end; @@ -303,6 +303,7 @@ static void __init process_chosen_node(const void *fdt,= int node, =20 if ( fdt_get_property(fdt, node, "xen,static-heap", NULL) ) { + int rc; u32 address_cells =3D device_tree_get_u32(fdt, node, "#xen,static-heap-address-cells", 0); u32 size_cells =3D device_tree_get_u32(fdt, node, @@ -313,14 +314,14 @@ static void __init process_chosen_node(const void *fd= t, int node, { printk("fdt: node `%s': invalid #xen,static-heap-address-cells= or #xen,static-heap-size-cells\n", name); - return; + return -EINVAL; } =20 - if ( device_tree_get_meminfo(fdt, node, "xen,static-heap", + rc =3D device_tree_get_meminfo(fdt, node, "xen,static-heap", address_cells, size_cells, - &bootinfo.reserved_mem, - MEMBANK_RSVD_HEAP) ) - return; + &bootinfo.reserved_mem, MEMBANK_RSVD_= HEAP); + if ( rc ) + return rc; } =20 printk("Checking for initrd in /chosen\n"); @@ -328,11 +329,11 @@ static void __init process_chosen_node(const void *fd= t, int node, prop =3D fdt_get_property(fdt, node, "linux,initrd-start", &len); if ( !prop ) /* No initrd present. */ - return; + return 0; if ( len !=3D sizeof(u32) && len !=3D sizeof(u64) ) { printk("linux,initrd-start property has invalid length %d\n", len); - return; + return -EINVAL; } start =3D dt_read_number((void *)&prop->data, dt_size_to_cells(len)); =20 @@ -340,12 +341,12 @@ static void __init process_chosen_node(const void *fd= t, int node, if ( !prop ) { printk("linux,initrd-end not present but -start was\n"); - return; + return -EINVAL; } if ( len !=3D sizeof(u32) && len !=3D sizeof(u64) ) { printk("linux,initrd-end property has invalid length %d\n", len); - return; + return -EINVAL; } end =3D dt_read_number((void *)&prop->data, dt_size_to_cells(len)); =20 @@ -353,12 +354,14 @@ static void __init process_chosen_node(const void *fd= t, int node, { printk("linux,initrd limits invalid: %"PRIpaddr" >=3D %"PRIpaddr"\= n", start, end); - return; + return -EINVAL; } =20 printk("Initrd %"PRIpaddr"-%"PRIpaddr"\n", start, end); =20 add_boot_module(BOOTMOD_RAMDISK, start, end-start, false); + + return 0; } =20 static int __init process_domain_node(const void *fdt, int node, @@ -406,7 +409,7 @@ static int __init early_scan_node(const void *fdt, device_tree_node_compatible(fdt, node, "multiboot,module" ))) process_multiboot_node(fdt, node, name, address_cells, size_cells); else if ( depth =3D=3D 1 && device_tree_node_matches(fdt, node, "chose= n") ) - process_chosen_node(fdt, node, name, address_cells, size_cells); + rc =3D process_chosen_node(fdt, node, name, address_cells, size_ce= lls); else if ( depth =3D=3D 2 && device_tree_node_compatible(fdt, node, "xe= n,domain") ) rc =3D process_domain_node(fdt, node, name, address_cells, size_ce= lls); =20 --=20 2.17.1 From nobody Fri May 17 16:48:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=arm.com Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1662362856847288.38690314421206; Mon, 5 Sep 2022 00:27:36 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.398534.639419 (Exim 4.92) (envelope-from ) id 1oV6Vp-0002bj-OR; Mon, 05 Sep 2022 07:27:17 +0000 Received: by outflank-mailman (output) from mailman id 398534.639419; Mon, 05 Sep 2022 07:27:17 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oV6Vp-0002bZ-LE; Mon, 05 Sep 2022 07:27:17 +0000 Received: by outflank-mailman (input) for mailman id 398534; Mon, 05 Sep 2022 07:27:15 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oV6Vn-0001oQ-M0 for xen-devel@lists.xenproject.org; Mon, 05 Sep 2022 07:27:15 +0000 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by se1-gles-sth1.inumbo.com (Halon) with ESMTP id 29a410c7-2cec-11ed-a016-b9edf5238543; Mon, 05 Sep 2022 09:27:14 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EA22BED1; Mon, 5 Sep 2022 00:27:19 -0700 (PDT) Received: from entos-skylake.shanghai.arm.com (entos-skylake.shanghai.arm.com [10.169.212.207]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id B4F9A3F73D; Mon, 5 Sep 2022 00:27:39 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 29a410c7-2cec-11ed-a016-b9edf5238543 From: Henry Wang To: xen-devel@lists.xenproject.org Cc: Henry Wang , Stefano Stabellini , Julien Grall , Bertrand Marquis , Wei Chen , Volodymyr Babchuk Subject: [PATCH v2 3/4] xen/arm: Handle reserved heap pages in boot and heap allocator Date: Mon, 5 Sep 2022 07:26:34 +0000 Message-Id: <20220905072635.16294-4-Henry.Wang@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220905072635.16294-1-Henry.Wang@arm.com> References: <20220905072635.16294-1-Henry.Wang@arm.com> X-ZM-MESSAGEID: 1662362858888100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This commit firstly adds a bool field `reserved_heap` to bootinfo. This newly introduced field is set at the device tree parsing time if the reserved heap ranges are defined in the device tree chosen node. For Arm32, In `setup_mm`, if the reserved heap is enabled, we use the reserved heap region for both domheap and xenheap allocation. Note that the xenheap on Arm32 should be always contiguous, so also add a helper fit_xenheap_in_reserved_heap() for Arm32 to find the required xenheap in the reserved heap regions. For Arm64, In `setup_mm`, if the reserved heap is enabled and used, we make sure that only these reserved heap pages are added to the boot allocator. These reserved heap pages in the boot allocator are added to the heap allocator at `end_boot_allocator()`. If the reserved heap is disabled, we stick to current page allocation strategy at boot time. Also, take the chance to correct a "double not" print in Arm32 `setup_mm()` and replace the open-coding address ~0 by INVALID_PADDR. Signed-off-by: Henry Wang --- Changes from v1 to v2: - Move the global bool `reserved_heap` to bootinfo. - Replace the open open-coding address ~0 by INVALID_PADDR. - Do not use reverted logic in heap_pages calculation. - Remove unused Arm32 reserved_heap_start variable. - Decouple the arm32 reserved heap too small size check with region end check. - Reuse the arm32 original xenheap finding logic with the new helper to make sure xenheap on arm32 is contiguous. Changes from RFC to v1: - Rebase on top of latest `setup_mm()` changes. - Added Arm32 logic in `setup_mm()`. --- xen/arch/arm/bootfdt.c | 2 + xen/arch/arm/include/asm/setup.h | 1 + xen/arch/arm/setup.c | 116 +++++++++++++++++++++++++++---- 3 files changed, 104 insertions(+), 15 deletions(-) diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c index 3796a4bd75..616bf5ce47 100644 --- a/xen/arch/arm/bootfdt.c +++ b/xen/arch/arm/bootfdt.c @@ -322,6 +322,8 @@ static int __init process_chosen_node(const void *fdt, = int node, &bootinfo.reserved_mem, MEMBANK_RSVD_= HEAP); if ( rc ) return rc; + + bootinfo.reserved_heap =3D true; } =20 printk("Checking for initrd in /chosen\n"); diff --git a/xen/arch/arm/include/asm/setup.h b/xen/arch/arm/include/asm/se= tup.h index d0cc556833..22fb950bc8 100644 --- a/xen/arch/arm/include/asm/setup.h +++ b/xen/arch/arm/include/asm/setup.h @@ -82,6 +82,7 @@ struct bootinfo { #ifdef CONFIG_ACPI struct meminfo acpi; #endif + bool reserved_heap; }; =20 struct map_range_data diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index 8d3f859982..0b4f7cb909 100644 --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -556,6 +556,43 @@ static paddr_t __init consider_modules(paddr_t s, padd= r_t e, } return e; } + +/* + * Find the contiguous xenheap region that fits in the reserved heap regio= n with + * required size and alignment, and return the end address of xenheap. + */ +static paddr_t __init fit_xenheap_in_reserved_heap(uint32_t size, paddr_t = align) +{ + int i; + paddr_t end =3D 0, aligned_start, aligned_end; + paddr_t bank_start, bank_size, bank_end; + + for ( i =3D 0 ; i < bootinfo.reserved_mem.nr_banks; i++ ) + { + if ( bootinfo.reserved_mem.bank[i].type =3D=3D MEMBANK_RSVD_HEAP ) + { + bank_start =3D bootinfo.reserved_mem.bank[i].start; + bank_size =3D bootinfo.reserved_mem.bank[i].size; + bank_end =3D bank_start + bank_size; + + if ( bank_size < size ) + continue; + + aligned_end =3D bank_end & ~(align - 1); + aligned_start =3D (aligned_end - size) & ~(align - 1); + + if ( aligned_start > bank_start ) + /* + * Arm32 allocates xenheap from higher address to lower, s= o if + * there are multiple memory banks that satisfy the requir= ement, + * use the highest bank. + */ + end =3D max(end, aligned_end); + } + } + + return end; +} #endif =20 /* @@ -713,8 +750,9 @@ static void __init populate_boot_allocator(void) #ifdef CONFIG_ARM_32 static void __init setup_mm(void) { - paddr_t ram_start, ram_end, ram_size, e; - unsigned long ram_pages; + paddr_t ram_start, ram_end, ram_size, e, bank_start, bank_end, bank_si= ze; + paddr_t reserved_heap_end =3D 0, reserved_heap_size =3D 0; + unsigned long ram_pages, reserved_heap_pages =3D 0; unsigned long heap_pages, xenheap_pages, domheap_pages; unsigned int i; const uint32_t ctr =3D READ_CP32(CTR); @@ -734,9 +772,9 @@ static void __init setup_mm(void) =20 for ( i =3D 1; i < bootinfo.mem.nr_banks; i++ ) { - paddr_t bank_start =3D bootinfo.mem.bank[i].start; - paddr_t bank_size =3D bootinfo.mem.bank[i].size; - paddr_t bank_end =3D bank_start + bank_size; + bank_start =3D bootinfo.mem.bank[i].start; + bank_size =3D bootinfo.mem.bank[i].size; + bank_end =3D bank_start + bank_size; =20 ram_size =3D ram_size + bank_size; ram_start =3D min(ram_start,bank_start); @@ -745,19 +783,42 @@ static void __init setup_mm(void) =20 total_pages =3D ram_pages =3D ram_size >> PAGE_SHIFT; =20 + if ( bootinfo.reserved_heap ) + { + for ( i =3D 0 ; i < bootinfo.reserved_mem.nr_banks; i++ ) + { + if ( bootinfo.reserved_mem.bank[i].type =3D=3D MEMBANK_RSVD_HE= AP ) + { + bank_start =3D bootinfo.reserved_mem.bank[i].start; + bank_size =3D bootinfo.reserved_mem.bank[i].size; + bank_end =3D bank_start + bank_size; + + reserved_heap_size +=3D bank_size; + reserved_heap_end =3D max(reserved_heap_end, bank_end); + } + } + + reserved_heap_pages =3D reserved_heap_size >> PAGE_SHIFT; + if ( reserved_heap_pages < 32<<(20-PAGE_SHIFT) ) + panic("Too small reserved heap region, should be at least 32M\= n"); + } + /* * If the user has not requested otherwise via the command line * then locate the xenheap using these constraints: * * - must be 32 MiB aligned * - must not include Xen itself or the boot modules - * - must be at most 1GB or 1/32 the total RAM in the system if less + * - must be at most 1GB or 1/32 the total RAM in the system + * (there is no reserved heap) or 1/32 the total reserved + * heap region (there is reserved heap) if less * - must be at least 32M * * We try to allocate the largest xenheap possible within these * constraints. */ - heap_pages =3D ram_pages; + heap_pages =3D bootinfo.reserved_heap ? reserved_heap_pages : ram_page= s; + if ( opt_xenheap_megabytes ) xenheap_pages =3D opt_xenheap_megabytes << (20-PAGE_SHIFT); else @@ -767,9 +828,15 @@ static void __init setup_mm(void) xenheap_pages =3D min(xenheap_pages, 1UL<<(30-PAGE_SHIFT)); } =20 + /* + * On Arm32, xenheap must be contiguous, look for one of the region + * that matches the above-mentioned xenheap constraints. + */ do { - e =3D consider_modules(ram_start, ram_end, + e =3D bootinfo.reserved_heap ? + fit_xenheap_in_reserved_heap(pfn_to_paddr(xenheap_pages), 32<<= 20) : + consider_modules(ram_start, ram_end, pfn_to_paddr(xenheap_pages), 32<<20, 0); if ( e ) @@ -779,7 +846,7 @@ static void __init setup_mm(void) } while ( !opt_xenheap_megabytes && xenheap_pages > 32<<(20-PAGE_SHIFT= ) ); =20 if ( ! e ) - panic("Not not enough space for xenheap\n"); + panic("Not enough space for xenheap\n"); =20 domheap_pages =3D heap_pages - xenheap_pages; =20 @@ -824,9 +891,9 @@ static void __init setup_mm(void) static void __init setup_mm(void) { const struct meminfo *banks =3D &bootinfo.mem; - paddr_t ram_start =3D ~0; - paddr_t ram_end =3D 0; - paddr_t ram_size =3D 0; + paddr_t ram_start =3D INVALID_PADDR, bank_start =3D INVALID_PADDR; + paddr_t ram_end =3D 0, bank_end =3D 0; + paddr_t ram_size =3D 0, bank_size =3D 0; unsigned int i; =20 init_pdx(); @@ -835,17 +902,36 @@ static void __init setup_mm(void) * We need some memory to allocate the page-tables used for the xenheap * mappings. But some regions may contain memory already allocated * for other uses (e.g. modules, reserved-memory...). - * + * If there are non-empty reserved heap regions, (only) add these regi= ons + * in the boot allocator. + */ + if ( bootinfo.reserved_heap ) + { + for ( i =3D 0 ; i < bootinfo.reserved_mem.nr_banks; i++ ) + { + if ( bootinfo.reserved_mem.bank[i].type =3D=3D MEMBANK_RSVD_HE= AP ) + { + bank_start =3D bootinfo.reserved_mem.bank[i].start; + bank_size =3D bootinfo.reserved_mem.bank[i].size; + bank_end =3D bank_start + bank_size; + + init_boot_pages(bank_start, bank_end); + } + } + } + /* + * No reserved heap regions: * For simplicity, add all the free regions in the boot allocator. */ - populate_boot_allocator(); + else + populate_boot_allocator(); =20 total_pages =3D 0; =20 for ( i =3D 0; i < banks->nr_banks; i++ ) { const struct membank *bank =3D &banks->bank[i]; - paddr_t bank_end =3D bank->start + bank->size; + bank_end =3D bank->start + bank->size; =20 ram_size =3D ram_size + bank->size; ram_start =3D min(ram_start, bank->start); --=20 2.17.1 From nobody Fri May 17 16:48:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=arm.com Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1662362858220789.8265432928149; Mon, 5 Sep 2022 00:27:38 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.398536.639431 (Exim 4.92) (envelope-from ) id 1oV6Vt-00030G-7k; Mon, 05 Sep 2022 07:27:21 +0000 Received: by outflank-mailman (output) from mailman id 398536.639431; Mon, 05 Sep 2022 07:27:21 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oV6Vt-000305-40; Mon, 05 Sep 2022 07:27:21 +0000 Received: by outflank-mailman (input) for mailman id 398536; Mon, 05 Sep 2022 07:27:19 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oV6Vr-0001oQ-PV for xen-devel@lists.xenproject.org; Mon, 05 Sep 2022 07:27:19 +0000 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by se1-gles-sth1.inumbo.com (Halon) with ESMTP id 2c22bfe2-2cec-11ed-a016-b9edf5238543; Mon, 05 Sep 2022 09:27:18 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 23FEDED1; Mon, 5 Sep 2022 00:27:24 -0700 (PDT) Received: from entos-skylake.shanghai.arm.com (entos-skylake.shanghai.arm.com [10.169.212.207]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id E3FBF3F73D; Mon, 5 Sep 2022 00:27:43 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 2c22bfe2-2cec-11ed-a016-b9edf5238543 From: Henry Wang To: xen-devel@lists.xenproject.org Cc: Henry Wang , Stefano Stabellini , Julien Grall , Bertrand Marquis , Wei Chen , Volodymyr Babchuk Subject: [PATCH v2 4/4] xen/arm: mm: Rename xenheap_* variable to directmap_* Date: Mon, 5 Sep 2022 07:26:35 +0000 Message-Id: <20220905072635.16294-5-Henry.Wang@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220905072635.16294-1-Henry.Wang@arm.com> References: <20220905072635.16294-1-Henry.Wang@arm.com> X-ZM-MESSAGEID: 1662362858900100002 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" With the reserved heap setup, keep using xenheap_* in the function setup_xenheap_mappings() will make the code confusing to read, because we always need to map the full RAM on Arm64. Therefore, renaming all "xenheap_*" variables to "directmap_*" to make clear the area is used to access the RAM easily. On Arm32, only the xenheap is direct mapped today. So the renaming to "directmap_*" would be still valid for Arm32. No functional change is intended. Signed-off-by: Henry Wang --- Changes from v1 to v2: - New commit. --- xen/arch/arm/include/asm/config.h | 2 +- xen/arch/arm/include/asm/mm.h | 22 +++++++++++----------- xen/arch/arm/mm.c | 24 ++++++++++++------------ xen/arch/arm/setup.c | 27 ++++++++++++++------------- 4 files changed, 38 insertions(+), 37 deletions(-) diff --git a/xen/arch/arm/include/asm/config.h b/xen/arch/arm/include/asm/c= onfig.h index 2fafb9f228..0fefed1b8a 100644 --- a/xen/arch/arm/include/asm/config.h +++ b/xen/arch/arm/include/asm/config.h @@ -160,7 +160,7 @@ #define DIRECTMAP_SIZE (SLOT0_ENTRY_SIZE * (265-256)) #define DIRECTMAP_VIRT_END (DIRECTMAP_VIRT_START + DIRECTMAP_SIZE - 1) =20 -#define XENHEAP_VIRT_START xenheap_virt_start +#define XENHEAP_VIRT_START directmap_virt_start =20 #define HYPERVISOR_VIRT_END DIRECTMAP_VIRT_END =20 diff --git a/xen/arch/arm/include/asm/mm.h b/xen/arch/arm/include/asm/mm.h index da25251cda..1dcb0a093a 100644 --- a/xen/arch/arm/include/asm/mm.h +++ b/xen/arch/arm/include/asm/mm.h @@ -150,19 +150,19 @@ struct page_info #define _PGC_need_scrub _PGC_allocated #define PGC_need_scrub PGC_allocated =20 -extern mfn_t xenheap_mfn_start, xenheap_mfn_end; -extern vaddr_t xenheap_virt_end; +extern mfn_t directmap_mfn_start, directmap_mfn_end; +extern vaddr_t directmap_virt_end; #ifdef CONFIG_ARM_64 -extern vaddr_t xenheap_virt_start; -extern unsigned long xenheap_base_pdx; +extern vaddr_t directmap_virt_start; +extern unsigned long directmap_base_pdx; #endif =20 #ifdef CONFIG_ARM_32 #define is_xen_heap_page(page) is_xen_heap_mfn(page_to_mfn(page)) #define is_xen_heap_mfn(mfn) ({ \ unsigned long mfn_ =3D mfn_x(mfn); \ - (mfn_ >=3D mfn_x(xenheap_mfn_start) && \ - mfn_ < mfn_x(xenheap_mfn_end)); \ + (mfn_ >=3D mfn_x(directmap_mfn_start) && \ + mfn_ < mfn_x(directmap_mfn_end)); \ }) #else #define is_xen_heap_page(page) ((page)->count_info & PGC_xen_heap) @@ -263,16 +263,16 @@ static inline paddr_t __virt_to_maddr(vaddr_t va) static inline void *maddr_to_virt(paddr_t ma) { ASSERT(is_xen_heap_mfn(maddr_to_mfn(ma))); - ma -=3D mfn_to_maddr(xenheap_mfn_start); + ma -=3D mfn_to_maddr(directmap_mfn_start); return (void *)(unsigned long) ma + XENHEAP_VIRT_START; } #else static inline void *maddr_to_virt(paddr_t ma) { - ASSERT((mfn_to_pdx(maddr_to_mfn(ma)) - xenheap_base_pdx) < + ASSERT((mfn_to_pdx(maddr_to_mfn(ma)) - directmap_base_pdx) < (DIRECTMAP_SIZE >> PAGE_SHIFT)); return (void *)(XENHEAP_VIRT_START - - (xenheap_base_pdx << PAGE_SHIFT) + + (directmap_base_pdx << PAGE_SHIFT) + ((ma & ma_va_bottom_mask) | ((ma & ma_top_mask) >> pfn_pdx_hole_shift))); } @@ -315,10 +315,10 @@ static inline struct page_info *virt_to_page(const vo= id *v) unsigned long pdx; =20 ASSERT(va >=3D XENHEAP_VIRT_START); - ASSERT(va < xenheap_virt_end); + ASSERT(va < directmap_virt_end); =20 pdx =3D (va - XENHEAP_VIRT_START) >> PAGE_SHIFT; - pdx +=3D mfn_to_pdx(xenheap_mfn_start); + pdx +=3D mfn_to_pdx(directmap_mfn_start); return frame_table + pdx - frametable_base_pdx; } =20 diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index c81c706c8b..7d6814caf2 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -132,12 +132,12 @@ uint64_t init_ttbr; static paddr_t phys_offset; =20 /* Limits of the Xen heap */ -mfn_t xenheap_mfn_start __read_mostly =3D INVALID_MFN_INITIALIZER; -mfn_t xenheap_mfn_end __read_mostly; -vaddr_t xenheap_virt_end __read_mostly; +mfn_t directmap_mfn_start __read_mostly =3D INVALID_MFN_INITIALIZER; +mfn_t directmap_mfn_end __read_mostly; +vaddr_t directmap_virt_end __read_mostly; #ifdef CONFIG_ARM_64 -vaddr_t xenheap_virt_start __read_mostly; -unsigned long xenheap_base_pdx __read_mostly; +vaddr_t directmap_virt_start __read_mostly; +unsigned long directmap_base_pdx __read_mostly; #endif =20 unsigned long frametable_base_pdx __read_mostly; @@ -609,7 +609,7 @@ void __init setup_xenheap_mappings(unsigned long base_m= fn, panic("Unable to setup the xenheap mappings.\n"); =20 /* Record where the xenheap is, for translation routines. */ - xenheap_virt_end =3D XENHEAP_VIRT_START + nr_mfns * PAGE_SIZE; + directmap_virt_end =3D XENHEAP_VIRT_START + nr_mfns * PAGE_SIZE; } #else /* CONFIG_ARM_64 */ void __init setup_xenheap_mappings(unsigned long base_mfn, @@ -618,12 +618,12 @@ void __init setup_xenheap_mappings(unsigned long base= _mfn, int rc; =20 /* First call sets the xenheap physical and virtual offset. */ - if ( mfn_eq(xenheap_mfn_start, INVALID_MFN) ) + if ( mfn_eq(directmap_mfn_start, INVALID_MFN) ) { unsigned long mfn_gb =3D base_mfn & ~((FIRST_SIZE >> PAGE_SHIFT) -= 1); =20 - xenheap_mfn_start =3D _mfn(base_mfn); - xenheap_base_pdx =3D mfn_to_pdx(_mfn(base_mfn)); + directmap_mfn_start =3D _mfn(base_mfn); + directmap_base_pdx =3D mfn_to_pdx(_mfn(base_mfn)); /* * The base address may not be aligned to the first level * size (e.g. 1GB when using 4KB pages). This would prevent @@ -633,13 +633,13 @@ void __init setup_xenheap_mappings(unsigned long base= _mfn, * Prevent that by offsetting the start of the xenheap virtual * address. */ - xenheap_virt_start =3D DIRECTMAP_VIRT_START + + directmap_virt_start =3D DIRECTMAP_VIRT_START + (base_mfn - mfn_gb) * PAGE_SIZE; } =20 - if ( base_mfn < mfn_x(xenheap_mfn_start) ) + if ( base_mfn < mfn_x(directmap_mfn_start) ) panic("cannot add xenheap mapping at %lx below heap start %lx\n", - base_mfn, mfn_x(xenheap_mfn_start)); + base_mfn, mfn_x(directmap_mfn_start)); =20 rc =3D map_pages_to_xen((vaddr_t)__mfn_to_virt(base_mfn), _mfn(base_mfn), nr_mfns, diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index 0b4f7cb909..399a695ff6 100644 --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -733,11 +733,11 @@ static void __init populate_boot_allocator(void) =20 #ifdef CONFIG_ARM_32 /* Avoid the xenheap */ - if ( s < mfn_to_maddr(xenheap_mfn_end) && - mfn_to_maddr(xenheap_mfn_start) < e ) + if ( s < mfn_to_maddr(directmap_mfn_end) && + mfn_to_maddr(directmap_mfn_start) < e ) { - e =3D mfn_to_maddr(xenheap_mfn_start); - n =3D mfn_to_maddr(xenheap_mfn_end); + e =3D mfn_to_maddr(directmap_mfn_start); + n =3D mfn_to_maddr(directmap_mfn_end); } #endif =20 @@ -859,15 +859,16 @@ static void __init setup_mm(void) * We need some memory to allocate the page-tables used for the * xenheap mappings. So populate the boot allocator first. * - * This requires us to set xenheap_mfn_{start, end} first so the Xenhe= ap + * Note that currently xenheap is direct mapped on Arm32. + * This requires us to set directmap_mfn_{start, end} first so the Xen= heap * region can be avoided. */ - xenheap_mfn_start =3D _mfn((e >> PAGE_SHIFT) - xenheap_pages); - xenheap_mfn_end =3D mfn_add(xenheap_mfn_start, xenheap_pages); + directmap_mfn_start =3D _mfn((e >> PAGE_SHIFT) - xenheap_pages); + directmap_mfn_end =3D mfn_add(directmap_mfn_start, xenheap_pages); =20 populate_boot_allocator(); =20 - setup_xenheap_mappings(mfn_x(xenheap_mfn_start), xenheap_pages); + setup_xenheap_mappings(mfn_x(directmap_mfn_start), xenheap_pages); =20 /* Frame table covers all of RAM region, including holes */ setup_frametable_mappings(ram_start, ram_end); @@ -882,8 +883,8 @@ static void __init setup_mm(void) smp_processor_id()); =20 /* Add xenheap memory that was not already added to the boot allocator= . */ - init_xenheap_pages(mfn_to_maddr(xenheap_mfn_start), - mfn_to_maddr(xenheap_mfn_end)); + init_xenheap_pages(mfn_to_maddr(directmap_mfn_start), + mfn_to_maddr(directmap_mfn_end)); =20 init_staticmem_pages(); } @@ -943,9 +944,9 @@ static void __init setup_mm(void) =20 total_pages +=3D ram_size >> PAGE_SHIFT; =20 - xenheap_virt_end =3D XENHEAP_VIRT_START + ram_end - ram_start; - xenheap_mfn_start =3D maddr_to_mfn(ram_start); - xenheap_mfn_end =3D maddr_to_mfn(ram_end); + directmap_virt_end =3D XENHEAP_VIRT_START + ram_end - ram_start; + directmap_mfn_start =3D maddr_to_mfn(ram_start); + directmap_mfn_end =3D maddr_to_mfn(ram_end); =20 setup_frametable_mappings(ram_start, ram_end); max_page =3D PFN_DOWN(ram_end); --=20 2.17.1