From: Penny Zheng <penny.zheng@arm.com>
To: <xen-devel@lists.xenproject.org>, <sstabellini@kernel.org>,
<julien@xen.org>
Cc: <Bertrand.Marquis@arm.com>, <Penny.Zheng@arm.com>,
<Wei.Chen@arm.com>, <jbeulich@suse.com>, <nd@arm.com>
Subject: [PATCH V3 03/10] xen/arm: handle static memory in dt_unreserved_regions
Date: Thu, 15 Jul 2021 05:18:12 +0000 [thread overview]
Message-ID: <20210715051819.3073628-4-penny.zheng@arm.com> (raw)
In-Reply-To: <20210715051819.3073628-1-penny.zheng@arm.com>
static memory regions overlap with memory nodes. The
overlapping memory is reserved-memory and should be
handled accordingly:
dt_unreserved_regions should skip these regions the
same way they are already skipping mem-reserved regions.
Signed-off-by: Penny Zheng <penny.zheng@arm.com>
---
v3 changes:
- extract common codes for dealing with reserved memory stored in
bootinfo
---
xen/arch/arm/setup.c | 47 ++++++++++++++++++++++++++++----------------
1 file changed, 30 insertions(+), 17 deletions(-)
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 63a908e325..f569134317 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -200,6 +200,13 @@ static void __init dt_unreserved_regions(paddr_t s, paddr_t e,
int first)
{
int i, nr = fdt_num_mem_rsv(device_tree_flattened);
+ /*
+ * There are two types of reserved memory stored in bootinfo, one defines
+ * in /reserved-memory node, the other refers to domain on static allocation
+ * through "xen,static-mem" property.
+ */
+ int nr_rsv_type = 2, t = 0, prev_nr;
+ struct meminfo *rsv_type[2] = {&bootinfo.reserved_mem, &bootinfo.static_mem};
for ( i = first; i < nr ; i++ )
{
@@ -219,26 +226,32 @@ static void __init dt_unreserved_regions(paddr_t s, paddr_t e,
}
}
- /*
- * i is the current bootmodule we are evaluating across all possible
- * kinds.
- *
- * When retrieving the corresponding reserved-memory addresses
- * below, we need to index the bootinfo.reserved_mem bank starting
- * from 0, and only counting the reserved-memory modules. Hence,
- * we need to use i - nr.
- */
- for ( ; i - nr < bootinfo.reserved_mem.nr_banks; i++ )
+ prev_nr = nr;
+ while ( t < nr_rsv_type )
{
- paddr_t r_s = bootinfo.reserved_mem.bank[i - nr].start;
- paddr_t r_e = r_s + bootinfo.reserved_mem.bank[i - nr].size;
-
- if ( s < r_e && r_s < e )
+ /*
+ * i is the current bootmodule we are evaluating across all possible
+ * kinds.
+ *
+ * When retrieving the corresponding reserved-memory addresses
+ * below, we need to index the reserved mem bank starting
+ * from 0, and only counting the reserved-memory modules. Hence,
+ * we need to use i - prev_nr.
+ */
+ i = i - prev_nr;
+ for ( ; i < rsv_type[t]->nr_banks; i++ )
{
- dt_unreserved_regions(r_e, e, cb, i + 1);
- dt_unreserved_regions(s, r_s, cb, i + 1);
- return;
+ paddr_t r_s = rsv_type[t]->bank[i].start;
+ paddr_t r_e = r_s + rsv_type[t]->bank[i].size;
+
+ if ( s < r_e && r_s < e )
+ {
+ dt_unreserved_regions(r_e, e, cb, i + 1);
+ dt_unreserved_regions(s, r_s, cb, i + 1);
+ return;
+ }
}
+ prev_nr = rsv_type[t++]->nr_banks;
}
cb(s, e);
--
2.25.1
next prev parent reply other threads:[~2021-07-15 5:19 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-15 5:18 [PATCH V3 00/10] Domain on Static Allocation Penny Zheng
2021-07-15 5:18 ` [PATCH V3 01/10] xen/arm: introduce domain " Penny Zheng
2021-07-15 5:18 ` [PATCH V3 02/10] xen/arm: introduce new helper device_tree_get_meminfo Penny Zheng
2021-07-15 5:18 ` Penny Zheng [this message]
2021-07-15 5:18 ` [PATCH V3 04/10] xen: introduce mark_page_free Penny Zheng
2021-07-19 8:13 ` Jan Beulich
2021-07-15 5:18 ` [PATCH V3 05/10] xen/arm: static memory initialization Penny Zheng
2021-07-19 8:20 ` Jan Beulich
2021-07-21 3:07 ` Penny Zheng
2021-07-21 8:15 ` Jan Beulich
2021-07-19 8:25 ` Jan Beulich
2021-07-15 5:18 ` [PATCH V3 06/10] xen/arm: introduce PGC_reserved Penny Zheng
2021-07-15 5:18 ` [PATCH V3 07/10] xen: re-define assign_pages and introduce assign_page Penny Zheng
2021-07-19 8:41 ` Jan Beulich
2021-07-21 5:53 ` Penny Zheng
2021-07-15 5:18 ` [PATCH V3 08/10] xen/arm: introduce acquire_staticmem_pages and acquire_domstatic_pages Penny Zheng
2021-07-19 9:26 ` Jan Beulich
2021-07-19 10:00 ` Julien Grall
2021-07-21 7:52 ` Penny Zheng
2021-07-21 7:37 ` Penny Zheng
2021-07-15 5:18 ` [PATCH V3 09/10] xen/arm: check "xen,static-mem" property during domain construction Penny Zheng
2021-07-15 5:18 ` [PATCH V3 10/10] xen/arm: introduce allocate_static_memory Penny Zheng
2021-07-27 3:44 ` Penny Zheng
2021-07-27 6:18 ` Penny Zheng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210715051819.3073628-4-penny.zheng@arm.com \
--to=penny.zheng@arm.com \
--cc=Bertrand.Marquis@arm.com \
--cc=Wei.Chen@arm.com \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=nd@arm.com \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).