From patchwork Tue Jan 16 18:53:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Jones X-Patchwork-Id: 10167939 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 65C7C600CA for ; Tue, 16 Jan 2018 18:54:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5211A20223 for ; Tue, 16 Jan 2018 18:54:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 45E66204FD; Tue, 16 Jan 2018 18:54:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD80B20223 for ; Tue, 16 Jan 2018 18:54:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751280AbeAPSyh (ORCPT ); Tue, 16 Jan 2018 13:54:37 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53844 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751118AbeAPSyg (ORCPT ); Tue, 16 Jan 2018 13:54:36 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 84296C04BD5A; Tue, 16 Jan 2018 18:54:31 +0000 (UTC) Received: from kamzik.brq.redhat.com (unknown [10.43.2.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0A29C609A6; Tue, 16 Jan 2018 18:54:18 +0000 (UTC) From: Andrew Jones To: kvm@vger.kernel.org Cc: pbonzini@redhat.com, rkrcmar@redhat.com, cdall@linaro.org, david@redhat.com, lvivier@redhat.com, thuth@redhat.com Subject: [PATCH kvm-unit-tests 05/11] arm/arm64: setup: don't allow gaps in phys range Date: Tue, 16 Jan 2018 19:53:06 +0100 Message-Id: <20180116185312.7257-6-drjones@redhat.com> In-Reply-To: <20180116185312.7257-1-drjones@redhat.com> References: <20180116185312.7257-1-drjones@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 16 Jan 2018 18:54:36 +0000 (UTC) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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);