From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Igor Mammedov <imammedo@redhat.com>, qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
deller@gmx.de, mark.cave-ayland@ilande.co.uk,
qemu-ppc@nongnu.org, hpoussin@reactos.org,
david@gibson.dropbear.id.au, atar4qemu@gmail.com,
rth@twiddle.net
Subject: Re: [PATCH 1/3] sparc64: use memory_region_allocate_system_memory() only for '-m' specified RAM
Date: Tue, 8 Oct 2019 14:09:28 +0200 [thread overview]
Message-ID: <d1d15a4c-a8a3-2bd3-3421-088dd8fc8d2d@redhat.com> (raw)
In-Reply-To: <20191008113318.7012-2-imammedo@redhat.com>
On 10/8/19 1:33 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 167143bffe..5987693659 100644
> --- a/hw/sparc64/niagara.c
> +++ b/hw/sparc64/niagara.c
> @@ -36,6 +36,7 @@
> #include "qemu/error-report.h"
> #include "sysemu/qtest.h"
> #include "sysemu/sysemu.h"
> +#include "qapi/error.h"
>
> typedef struct NiagaraBoardState {
> MemoryRegion hv_ram;
> @@ -106,8 +107,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,
Did we have an issue calling memory_region_allocate_system_memory()
*after* memory_region_init_ram() by the past?
Maybe not, or it is fixed, and your patch is fine:
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> @@ -116,17 +117,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);
> @@ -143,8 +144,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-10-08 12:10 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-08 11:33 [PATCH 0/3] eliminate remaining places that abuse memory_region_allocate_system_memory() Igor Mammedov
2019-10-08 11:33 ` [PATCH 1/3] sparc64: use memory_region_allocate_system_memory() only for '-m' specified RAM Igor Mammedov
2019-10-08 12:09 ` Philippe Mathieu-Daudé [this message]
2019-10-08 13:55 ` Igor Mammedov
2019-10-08 11:33 ` [PATCH 2/3] ppc: rs6000_mc: drop usage of memory_region_allocate_system_memory() Igor Mammedov
2019-10-08 12:24 ` Philippe Mathieu-Daudé
2019-10-09 1:21 ` David Gibson
2019-10-09 11:19 ` Igor Mammedov
2019-10-09 12:02 ` David Gibson
2019-10-08 11:33 ` [PATCH 3/3] hppa: drop usage of memory_region_allocate_system_memory() for ROM Igor Mammedov
2019-10-08 12:30 ` Philippe Mathieu-Daudé
2019-10-20 21:49 ` Philippe Mathieu-Daudé
2019-10-08 12:41 ` [PATCH 0/3] eliminate remaining places that abuse memory_region_allocate_system_memory() Philippe Mathieu-Daudé
2019-10-08 13:52 ` Igor Mammedov
2019-10-10 17:35 ` Igor Mammedov
2019-10-11 15:23 ` Igor Mammedov
2019-10-20 14:38 ` Philippe Mathieu-Daudé
2019-10-22 22:09 ` Eduardo Habkost
2019-10-21 8:59 ` Philippe Mathieu-Daudé
2019-10-21 9:18 ` Igor Mammedov
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=d1d15a4c-a8a3-2bd3-3421-088dd8fc8d2d@redhat.com \
--to=philmd@redhat.com \
--cc=atar4qemu@gmail.com \
--cc=david@gibson.dropbear.id.au \
--cc=deller@gmx.de \
--cc=hpoussin@reactos.org \
--cc=imammedo@redhat.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).