[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v4 2/9] xen/arm: implement domU extended regions
From: Stefano Stabellini <stefano.stabellini@xxxxxxxxxx> Implement extended regions for dom0less domUs. The implementation is based on the libxl implementation. Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxx> --- xen/arch/arm/domain_build.c | 42 ++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 8be01678de..b6189b935d 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -1324,6 +1324,35 @@ out: return res; } +#define ALIGN_UP_TO_2MB(x) (((x) + MB(2) - 1) & (~(MB(2) - 1))) + +static int __init find_domU_holes(const struct kernel_info *kinfo, + struct meminfo *ext_regions) +{ + unsigned int i; + uint64_t bankend[GUEST_RAM_BANKS]; + const uint64_t bankbase[] = GUEST_RAM_BANK_BASES; + const uint64_t banksize[] = GUEST_RAM_BANK_SIZES; + + for ( i = 0; i < GUEST_RAM_BANKS; i++ ) + { + ext_regions->bank[ext_regions->nr_banks].start = + ALIGN_UP_TO_2MB(bankbase[i] + kinfo->mem.bank[i].size); + + bankend[i] = ~0ULL >> (64 - p2m_ipa_bits); + bankend[i] = min(bankend[i], bankbase[i] + banksize[i] - 1); + if (bankend[i] > ext_regions->bank[ext_regions->nr_banks].start) + ext_regions->bank[ext_regions->nr_banks].size = + bankend[i] - ext_regions->bank[ext_regions->nr_banks].start + 1; + + /* 64MB is the minimum size of an extended region */ + if ( ext_regions->bank[ext_regions->nr_banks].size < MB(64) ) + continue; + ext_regions->nr_banks++; + } + return 0; +} + static int __init make_hypervisor_node(struct domain *d, const struct kernel_info *kinfo, int addrcells, int sizecells) @@ -1374,10 +1403,17 @@ static int __init make_hypervisor_node(struct domain *d, if ( !ext_regions ) return -ENOMEM; - if ( !is_iommu_enabled(d) ) - res = find_unallocated_memory(kinfo, ext_regions); + if ( is_domain_direct_mapped(d) ) + { + if ( !is_iommu_enabled(d) ) + res = find_unallocated_memory(kinfo, ext_regions); + else + res = find_memory_holes(kinfo, ext_regions); + } else - res = find_memory_holes(kinfo, ext_regions); + { + res = find_domU_holes(kinfo, ext_regions); + } if ( res ) printk(XENLOG_WARNING "Failed to allocate extended regions\n"); -- 2.25.1
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |