From: "Philippe Mathieu-Daudé" <philmd@redhat.com> To: Igor Mammedov <imammedo@redhat.com>, qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, "David Hildenbrand" <david@redhat.com>, "Helge Deller" <deller@gmx.de>, "Cornelia Huck" <cohuck@redhat.com>, "Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>, "Halil Pasic" <pasic@linux.ibm.com>, "Christian Borntraeger" <borntraeger@de.ibm.com>, qemu-s390x@nongnu.org, "Hervé Poussineau" <hpoussin@reactos.org>, "Paolo Bonzini" <pbonzini@redhat.com>, "Richard Henderson" <rth@twiddle.net>, "Artyom Tarasenko" <atar4qemu@gmail.com>, "David Gibson" <david@gibson.dropbear.id.au> Subject: Re: [Qemu-devel] [PATCH v1 1/5] sparc64: use memory_region_allocate_system_memory() only for '-m' specified RAM Date: Mon, 15 Apr 2019 17:07:42 +0200 [thread overview] Message-ID: <efbf9e4e-8be1-04b4-3743-ce384de2b58d@redhat.com> (raw) In-Reply-To: <1555334842-195718-2-git-send-email-imammedo@redhat.com> On 4/15/19 3:27 PM, Igor Mammedov wrote: > 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 <imammedo@redhat.com> > --- > 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" > > > 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); > > memory_region_allocate_system_memory(&s->partition_ram, NULL, Using the partition RAM as system memory rather than HV one seems the correct choice. Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> > @@ -118,17 +119,17 @@ static void niagara_init(MachineState *machine) > memory_region_add_subregion(sysmem, NIAGARA_PARTITION_RAM_BASE, > &s->partition_ram); > > - memory_region_allocate_system_memory(&s->nvram, NULL, > - "sun4v.nvram", NIAGARA_NVRAM_SIZE); > + memory_region_init_ram(&s->nvram, NULL, "sun4v.nvram", NIAGARA_NVRAM_SIZE, > + &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_SIZE); > + 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_SIZE); > + 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); > > add_rom_or_fail("nvram1", NIAGARA_NVRAM_BASE); > @@ -145,8 +146,8 @@ static void niagara_init(MachineState *machine) > BlockBackend *blk = blk_by_legacy_dinfo(dinfo); > int size = 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 = 1; >
WARNING: multiple messages have this Message-ID (diff)
From: "Philippe Mathieu-Daudé" <philmd@redhat.com> To: Igor Mammedov <imammedo@redhat.com>, qemu-devel@nongnu.org Cc: "David Hildenbrand" <david@redhat.com>, "Helge Deller" <deller@gmx.de>, "Cornelia Huck" <cohuck@redhat.com>, "Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>, "Halil Pasic" <pasic@linux.ibm.com>, "Christian Borntraeger" <borntraeger@de.ibm.com>, qemu-s390x@nongnu.org, qemu-ppc@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>, "Hervé Poussineau" <hpoussin@reactos.org>, "David Gibson" <david@gibson.dropbear.id.au>, "Artyom Tarasenko" <atar4qemu@gmail.com>, "Richard Henderson" <rth@twiddle.net> Subject: Re: [Qemu-devel] [PATCH v1 1/5] sparc64: use memory_region_allocate_system_memory() only for '-m' specified RAM Date: Mon, 15 Apr 2019 17:07:42 +0200 [thread overview] Message-ID: <efbf9e4e-8be1-04b4-3743-ce384de2b58d@redhat.com> (raw) Message-ID: <20190415150742.dn9ulCvocKI7kD8tLSnjduoe1UTkXwXs0r8deb3VpxA@z> (raw) In-Reply-To: <1555334842-195718-2-git-send-email-imammedo@redhat.com> On 4/15/19 3:27 PM, Igor Mammedov wrote: > 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 <imammedo@redhat.com> > --- > 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" > > > 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); > > memory_region_allocate_system_memory(&s->partition_ram, NULL, Using the partition RAM as system memory rather than HV one seems the correct choice. Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> > @@ -118,17 +119,17 @@ static void niagara_init(MachineState *machine) > memory_region_add_subregion(sysmem, NIAGARA_PARTITION_RAM_BASE, > &s->partition_ram); > > - memory_region_allocate_system_memory(&s->nvram, NULL, > - "sun4v.nvram", NIAGARA_NVRAM_SIZE); > + memory_region_init_ram(&s->nvram, NULL, "sun4v.nvram", NIAGARA_NVRAM_SIZE, > + &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_SIZE); > + 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_SIZE); > + 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); > > add_rom_or_fail("nvram1", NIAGARA_NVRAM_BASE); > @@ -145,8 +146,8 @@ static void niagara_init(MachineState *machine) > BlockBackend *blk = blk_by_legacy_dinfo(dinfo); > int size = 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 = 1; >
next prev parent reply other threads:[~2019-04-15 15:07 UTC|newest] Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-04-15 13:27 [Qemu-devel] [PATCH v1 0/5] Fix misuses of memory_region_allocate_system_memory() Igor Mammedov 2019-04-15 13:27 ` Igor Mammedov 2019-04-15 13:27 ` [Qemu-devel] [PATCH v1 1/5] sparc64: use memory_region_allocate_system_memory() only for '-m' specified RAM Igor Mammedov 2019-04-15 13:27 ` Igor Mammedov 2019-04-15 15:07 ` Philippe Mathieu-Daudé [this message] 2019-04-15 15:07 ` Philippe Mathieu-Daudé 2019-04-15 13:27 ` [Qemu-devel] [PATCH v1 2/5] ppc: rs6000_mc: drop usage of memory_region_allocate_system_memory() Igor Mammedov 2019-04-15 13:27 ` Igor Mammedov 2019-04-16 4:13 ` David Gibson 2019-04-16 4:13 ` David Gibson 2019-04-15 13:27 ` [Qemu-devel] [PATCH v1 3/5] hppa: drop usage of memory_region_allocate_system_memory() for ROM Igor Mammedov 2019-04-15 13:27 ` Igor Mammedov 2019-04-15 15:16 ` Philippe Mathieu-Daudé 2019-04-15 15:16 ` Philippe Mathieu-Daudé 2019-04-15 13:27 ` [Qemu-devel] [PATCH v1 4/5] memory: make MemoryRegion alias migratable Igor Mammedov 2019-04-15 13:27 ` Igor Mammedov 2019-04-15 13:27 ` [Qemu-devel] [PATCH v1 5/5] s390: do not call memory_region_allocate_system_memory() multiple times Igor Mammedov 2019-04-15 13:27 ` Igor Mammedov 2019-04-16 11:01 ` Christian Borntraeger 2019-04-16 11:01 ` Christian Borntraeger 2019-04-16 11:02 ` Christian Borntraeger 2019-04-16 11:02 ` Christian Borntraeger 2019-04-16 11:09 ` Christian Borntraeger 2019-04-16 11:09 ` Christian Borntraeger 2019-04-17 14:30 ` Igor Mammedov 2019-04-17 14:30 ` Igor Mammedov 2019-04-18 9:38 ` Igor Mammedov 2019-04-18 9:38 ` Igor Mammedov 2019-04-18 11:24 ` David Hildenbrand 2019-04-18 11:24 ` David Hildenbrand 2019-04-18 12:01 ` Igor Mammedov 2019-04-18 12:01 ` Igor Mammedov 2019-04-18 12:06 ` David Hildenbrand 2019-04-18 12:06 ` David Hildenbrand 2019-04-18 14:56 ` Igor Mammedov 2019-04-18 14:56 ` Igor Mammedov 2019-04-18 15:01 ` David Hildenbrand 2019-04-18 15:01 ` David Hildenbrand
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=efbf9e4e-8be1-04b4-3743-ce384de2b58d@redhat.com \ --to=philmd@redhat.com \ --cc=atar4qemu@gmail.com \ --cc=borntraeger@de.ibm.com \ --cc=cohuck@redhat.com \ --cc=david@gibson.dropbear.id.au \ --cc=david@redhat.com \ --cc=deller@gmx.de \ --cc=hpoussin@reactos.org \ --cc=imammedo@redhat.com \ --cc=mark.cave-ayland@ilande.co.uk \ --cc=pasic@linux.ibm.com \ --cc=pbonzini@redhat.com \ --cc=qemu-devel@nongnu.org \ --cc=qemu-ppc@nongnu.org \ --cc=qemu-s390x@nongnu.org \ --cc=rth@twiddle.net \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.