xen/arm: handle reserved-memory in consider_modules and dt_unreserved_regions

reserved-memory regions overlap with memory nodes. The overlapping
memory is reserved-memory and should be handled accordingly:
consider_modules and dt_unreserved_regions should skip these regions the
same way they are already skipping mem-reserve regions.

Signed-off-by: Stefano Stabellini <stefanos@xilinx.com>
Acked-by: Julien Grall <julien.grall@arm.com>
This commit is contained in:
Stefano Stabellini authored and Julien Grall committed 2019-08-20 13:40:00 +01:00
1 parent e91c0d4f41
commit 99cd953c53
1 file changed
+50 -3
+50 -3
View File
@@ -206,6 +206,28 @@ 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++ )
{
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 )
{
dt_unreserved_regions(r_e, e, cb, i + 1);
dt_unreserved_regions(s, r_s, cb, i + 1);
return;
}
}
cb(s, e);
}
@@ -392,7 +414,7 @@ static paddr_t __init consider_modules(paddr_t s, paddr_t e,
{
const struct bootmodules *mi = &bootinfo.modules;
int i;
int nr_rsvd;
int nr;
s = (s+align-1) & ~(align-1);
e = e & ~(align-1);
@@ -418,9 +440,9 @@ static paddr_t __init consider_modules(paddr_t s, paddr_t e,
/* Now check any fdt reserved areas. */
nr_rsvd = fdt_num_mem_rsv(device_tree_flattened);
nr = fdt_num_mem_rsv(device_tree_flattened);
for ( ; i < mi->nr_mods + nr_rsvd; i++ )
for ( ; i < mi->nr_mods + nr; i++ )
{
paddr_t mod_s, mod_e;
@@ -442,6 +464,31 @@ static paddr_t __init consider_modules(paddr_t s, paddr_t e,
return consider_modules(s, mod_s, size, align, i+1);
}
}
/*
* i is the current bootmodule we are evaluating, across all
* possible kinds of bootmodules.
*
* When retrieving the corresponding reserved-memory addresses, 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.
*/
nr += mi->nr_mods;
for ( ; i - nr < bootinfo.reserved_mem.nr_banks; i++ )
{
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 )
{
r_e = consider_modules(r_e, e, size, align, i + 1);
if ( r_e )
return r_e;
return consider_modules(s, r_s, size, align, i + 1);
}
}
return e;
}
#endif
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.