From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Jones Subject: [PATCH kvm-unit-tests v2 05/12] arm/arm64: setup: don't allow gaps in phys range Date: Wed, 17 Jan 2018 11:39:58 +0100 Message-ID: <20180117104005.29211-6-drjones@redhat.com> References: <20180117104005.29211-1-drjones@redhat.com> Cc: pbonzini@redhat.com, rkrcmar@redhat.com, cdall@linaro.org, david@redhat.com, lvivier@redhat.com, thuth@redhat.com To: kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:43070 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752640AbeAQKk2 (ORCPT ); Wed, 17 Jan 2018 05:40:28 -0500 In-Reply-To: <20180117104005.29211-1-drjones@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Set the basic range parameters PHYS_OFFSET and PHYS_END to the primary memory region range parameters to ensure there are no gaps, as the regions in the device tree may not be contiguous. If a unit test wants to use memory in another region, then it can get it from mem_regions. Signed-off-by: Andrew Jones --- lib/arm/setup.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/arm/setup.c b/lib/arm/setup.c index 326e78f15ecd..04169da179bc 100644 --- a/lib/arm/setup.c +++ b/lib/arm/setup.c @@ -75,7 +75,7 @@ static void mem_init(phys_addr_t freemem_start) nr_regs = dt_get_memory_params(regs, NR_MEM_REGIONS); assert(nr_regs > 0); - primary.end = 0; + primary = (struct mem_region){ 0 }; for (i = 0; i < nr_regs; ++i) { mem_regions[i].start = regs[i].addr; @@ -102,8 +102,8 @@ static void mem_init(phys_addr_t freemem_start) assert(primary.end != 0); assert(!(mem.start & ~PHYS_MASK) && !((mem.end - 1) & ~PHYS_MASK)); - __phys_offset = mem.start; /* PHYS_OFFSET */ - __phys_end = mem.end; /* PHYS_END */ + __phys_offset = primary.start; /* PHYS_OFFSET */ + __phys_end = primary.end; /* PHYS_END */ phys_alloc_init(freemem_start, primary.end - freemem_start); phys_alloc_set_minimum_alignment(SMP_CACHE_BYTES); -- 2.13.6