From nobody Sat Sep 28 21:52:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1548238916135679.1736336922545; Wed, 23 Jan 2019 02:21:56 -0800 (PST) Received: from localhost ([127.0.0.1]:59758 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gmFfL-0005rY-H3 for importer@patchew.org; Wed, 23 Jan 2019 05:21:51 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34620) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gmFZY-0001WX-7f for qemu-devel@nongnu.org; Wed, 23 Jan 2019 05:15:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gmFZT-0007JI-VL for qemu-devel@nongnu.org; Wed, 23 Jan 2019 05:15:50 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45084) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gmFZL-00078v-IN; Wed, 23 Jan 2019 05:15:39 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DC0A27A19B; Wed, 23 Jan 2019 10:15:34 +0000 (UTC) Received: from laptop.redhat.com (ovpn-117-91.ams2.redhat.com [10.36.117.91]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3C38460181; Wed, 23 Jan 2019 10:15:32 +0000 (UTC) From: Eric Auger To: eric.auger.pro@gmail.com, eric.auger@redhat.com, qemu-devel@nongnu.org, qemu-arm@nongnu.org, peter.maydell@linaro.org, shameerali.kolothum.thodi@huawei.com, imammedo@redhat.com, david@redhat.com Date: Wed, 23 Jan 2019 11:14:45 +0100 Message-Id: <20190123101458.12478-6-eric.auger@redhat.com> In-Reply-To: <20190123101458.12478-1-eric.auger@redhat.com> References: <20190123101458.12478-1-eric.auger@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 23 Jan 2019 10:15:34 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v5 05/18] hw/arm/virt: Move memory map initialization into machvirt_init X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: drjones@redhat.com, dgilbert@redhat.com, david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" This patch moves the memory map setup into machvirt_init(). The rationale is the memory map will be soon affected by the kvm_type() call that happens after virt_instance_init(). Signed-off-by: Eric Auger --- hw/arm/virt.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index ba4088895a..ea1fb3ddfd 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1359,6 +1359,22 @@ static uint64_t virt_cpu_mp_affinity(VirtMachineStat= e *vms, int idx) return arm_cpu_mp_affinity(idx, clustersz); } =20 +static void set_memory_map(VirtMachineState *vms) +{ + int i; + + vms->memmap =3D extended_memmap; + + for (i =3D 0; i < ARRAY_SIZE(a15memmap); i++) { + vms->memmap[i] =3D a15memmap[i]; + } + + for (i =3D VIRT_LOWMEMMAP_LAST; i < ARRAY_SIZE(extended_memmap); i++) { + vms->memmap[i].base =3D extended_memmap[i].base + vms->high_io_bas= e; + vms->memmap[i].size =3D extended_memmap[i].size; + } +} + static void machvirt_init(MachineState *machine) { VirtMachineState *vms =3D VIRT_MACHINE(machine); @@ -1373,6 +1389,8 @@ static void machvirt_init(MachineState *machine) bool firmware_loaded =3D bios_name || drive_get(IF_PFLASH, 0, 0); bool aarch64 =3D true; =20 + set_memory_map(vms); + /* We can probe only here because during property set * KVM is not available yet */ @@ -1786,7 +1804,6 @@ static void virt_instance_init(Object *obj) { VirtMachineState *vms =3D VIRT_MACHINE(obj); VirtMachineClass *vmc =3D VIRT_MACHINE_GET_CLASS(vms); - int i; =20 /* EL3 is disabled by default on virt: this makes us consistent * between KVM and TCG for this board, and it also allows us to @@ -1849,18 +1866,7 @@ static void virt_instance_init(Object *obj) "Valid values are none and smmuv3", NULL); =20 - vms->memmap =3D extended_memmap; - - for (i =3D 0; i < ARRAY_SIZE(a15memmap); i++) { - vms->memmap[i] =3D a15memmap[i]; - } - - vms->high_io_base =3D S_256GiB; /* Top of the RAM */ - - for (i =3D VIRT_LOWMEMMAP_LAST; i < ARRAY_SIZE(extended_memmap); i++) { - vms->memmap[i].base =3D extended_memmap[i].base + vms->high_io_bas= e; - vms->memmap[i].size =3D extended_memmap[i].size; - } + vms->high_io_base =3D S_256GiB; /* default RAM top */ vms->irqmap =3D a15irqmap; } =20 --=20 2.20.1