From nobody Mon Feb 9 09:15:49 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1555334939; cv=none; d=zoho.com; s=zohoarc; b=MX4FTbML54GZaLas5AMTOKKJYqZx4mwwPBUF8Pp/gd65UQdwLhPY9dLKj3UryZL5Ri0kAScIjT2bwVYCY0sJHhZ7AjdBBoy0c4rh749gum9bKv05aWJMrqdh3fMsQSy6g1OL17wgrTjqUx5Wmwzcutpho2kOWscfyZQhTRmYJyU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1555334939; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Zsf095iuXuwOCRoZeoI/Oj302vUtB13A6SjUd2znC5M=; b=C8zf2HquJd8wJx4J8cwfkyD8sfeHhrTilsGApEDwFqIy8Da5piBpiuZbM3AnxPNYrhuAMg07h024pj1rm57uH5ygIEdeaHMuMBn95TliE8XhD6p2QVdaooo1FcMxf04XwMlvsB+ru1dAlTQIhpuuafqNST8XYzMAZvr3vMRgfg8= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1555334939112705.9219790110458; Mon, 15 Apr 2019 06:28:59 -0700 (PDT) Received: from localhost ([127.0.0.1]:50250 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hG1fL-0005oT-4Q for importer@patchew.org; Mon, 15 Apr 2019 09:28:55 -0400 Received: from eggs.gnu.org ([209.51.188.92]:42593) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hG1dm-0004eJ-Pw for qemu-devel@nongnu.org; Mon, 15 Apr 2019 09:27:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hG1dk-00052s-T0 for qemu-devel@nongnu.org; Mon, 15 Apr 2019 09:27:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46850) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hG1dj-00051g-09; Mon, 15 Apr 2019 09:27:16 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DB7DE3092645; Mon, 15 Apr 2019 13:27:12 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.37.153.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id EC53E1001E6D; Mon, 15 Apr 2019 13:27:06 +0000 (UTC) From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 15 Apr 2019 15:27:18 +0200 Message-Id: <1555334842-195718-2-git-send-email-imammedo@redhat.com> In-Reply-To: <1555334842-195718-1-git-send-email-imammedo@redhat.com> References: <1555334842-195718-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Mon, 15 Apr 2019 13:27:13 +0000 (UTC) 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 v1 1/5] sparc64: use memory_region_allocate_system_memory() only for '-m' specified RAM 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: qemu-ppc@nongnu.org, David Hildenbrand , Helge Deller , Cornelia Huck , Mark Cave-Ayland , Halil Pasic , Christian Borntraeger , qemu-s390x@nongnu.org, =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Paolo Bonzini , Richard Henderson , Artyom Tarasenko , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" memory_region_allocate_system_memory() was designed to be called for allocating inital RAM. Using it mutiple times within one board is not supported and could fail if -mem-path with non hugepage path is used. Keep using memory_region_allocate_system_memory() only for initial RAM and use memory_region_init_ram() for the rest fixed size regions. Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/sparc64/niagara.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/hw/sparc64/niagara.c b/hw/sparc64/niagara.c index f8a856f..39a4522 100644 --- a/hw/sparc64/niagara.c +++ b/hw/sparc64/niagara.c @@ -37,6 +37,7 @@ #include "sysemu/block-backend.h" #include "qemu/error-report.h" #include "sysemu/qtest.h" +#include "qapi/error.h" =20 =20 typedef struct NiagaraBoardState { @@ -108,8 +109,8 @@ static void niagara_init(MachineState *machine) /* init CPUs */ sparc64_cpu_devinit(machine->cpu_type, NIAGARA_PROM_BASE); /* set up devices */ - memory_region_allocate_system_memory(&s->hv_ram, NULL, "sun4v-hv.ram", - NIAGARA_HV_RAM_SIZE); + memory_region_init_ram(&s->hv_ram, NULL, "sun4v-hv.ram", + NIAGARA_HV_RAM_SIZE, &error_fatal); memory_region_add_subregion(sysmem, NIAGARA_HV_RAM_BASE, &s->hv_ram); =20 memory_region_allocate_system_memory(&s->partition_ram, NULL, @@ -118,17 +119,17 @@ static void niagara_init(MachineState *machine) memory_region_add_subregion(sysmem, NIAGARA_PARTITION_RAM_BASE, &s->partition_ram); =20 - memory_region_allocate_system_memory(&s->nvram, NULL, - "sun4v.nvram", NIAGARA_NVRAM_SIZE= ); + memory_region_init_ram(&s->nvram, NULL, "sun4v.nvram", NIAGARA_NVRAM_S= IZE, + &error_fatal); memory_region_add_subregion(sysmem, NIAGARA_NVRAM_BASE, &s->nvram); - memory_region_allocate_system_memory(&s->md_rom, NULL, - "sun4v-md.rom", NIAGARA_MD_ROM_SI= ZE); + memory_region_init_ram(&s->md_rom, NULL, "sun4v-md.rom", + NIAGARA_MD_ROM_SIZE, &error_fatal); memory_region_add_subregion(sysmem, NIAGARA_MD_ROM_BASE, &s->md_rom); - memory_region_allocate_system_memory(&s->hv_rom, NULL, - "sun4v-hv.rom", NIAGARA_HV_ROM_SI= ZE); + memory_region_init_ram(&s->hv_rom, NULL, "sun4v-hv.rom", + NIAGARA_HV_ROM_SIZE, &error_fatal); memory_region_add_subregion(sysmem, NIAGARA_HV_ROM_BASE, &s->hv_rom); - memory_region_allocate_system_memory(&s->prom, NULL, - "sun4v.prom", PROM_SIZE_MAX); + memory_region_init_ram(&s->prom, NULL, "sun4v.prom", PROM_SIZE_MAX, + &error_fatal); memory_region_add_subregion(sysmem, NIAGARA_PROM_BASE, &s->prom); =20 add_rom_or_fail("nvram1", NIAGARA_NVRAM_BASE); @@ -145,8 +146,8 @@ static void niagara_init(MachineState *machine) BlockBackend *blk =3D blk_by_legacy_dinfo(dinfo); int size =3D blk_getlength(blk); if (size > 0) { - memory_region_allocate_system_memory(&s->vdisk_ram, NULL, - "sun4v_vdisk.ram", size); + memory_region_init_ram(&s->vdisk_ram, NULL, "sun4v_vdisk.ram",= size, + &error_fatal); memory_region_add_subregion(get_system_memory(), NIAGARA_VDISK_BASE, &s->vdisk_ram); dinfo->is_default =3D 1; --=20 2.7.4