From: David Gibson <david@gibson.dropbear.id.au> To: Igor Mammedov <imammedo@redhat.com> Cc: qemu-devel@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>, "Richard Henderson" <rth@twiddle.net>, "Helge Deller" <deller@gmx.de>, "Hervé Poussineau" <hpoussin@reactos.org>, "Cornelia Huck" <cohuck@redhat.com>, "Halil Pasic" <pasic@linux.ibm.com>, "Christian Borntraeger" <borntraeger@de.ibm.com>, "David Hildenbrand" <david@redhat.com>, "Artyom Tarasenko" <atar4qemu@gmail.com>, "Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>, qemu-ppc@nongnu.org, qemu-s390x@nongnu.org Subject: Re: [Qemu-devel] [PATCH v1 2/5] ppc: rs6000_mc: drop usage of memory_region_allocate_system_memory() Date: Tue, 16 Apr 2019 14:13:35 +1000 [thread overview] Message-ID: <20190416041334.GF32705@umbus.fritz.box> (raw) In-Reply-To: <1555334842-195718-3-git-send-email-imammedo@redhat.com> [-- Attachment #1: Type: text/plain, Size: 2857 bytes --] On Mon, Apr 15, 2019 at 03:27:19PM +0200, Igor Mammedov wrote: > rs6000mc_realize() violates memory_region_allocate_system_memory() contract > by calling it multiple times which could break -mem-path. Replace it with > plain memory_region_init_ram() instead. > > Signed-off-by: Igor Mammedov <imammedo@redhat.com> Acked-by: David Gibson <david@gibson.dropbear.id.au> LGTM, though I've no idea if the rs6000 machine even works at the moment. > --- > hw/ppc/rs6000_mc.c | 15 ++++++++++----- > 1 file changed, 10 insertions(+), 5 deletions(-) > > diff --git a/hw/ppc/rs6000_mc.c b/hw/ppc/rs6000_mc.c > index 45cb95e..ea174f1 100644 > --- a/hw/ppc/rs6000_mc.c > +++ b/hw/ppc/rs6000_mc.c > @@ -142,6 +142,7 @@ static void rs6000mc_realize(DeviceState *dev, Error **errp) > RS6000MCState *s = RS6000MC_DEVICE(dev); > int socket = 0; > unsigned int ram_size = s->ram_size / MiB; > + Error *local_err = NULL; > > while (socket < 6) { > if (ram_size >= 64) { > @@ -163,19 +164,21 @@ static void rs6000mc_realize(DeviceState *dev, Error **errp) > if (s->simm_size[socket]) { > char name[] = "simm.?"; > name[5] = socket + '0'; > - memory_region_allocate_system_memory(&s->simm[socket], OBJECT(dev), > - name, > - s->simm_size[socket] * MiB); > + memory_region_init_ram(&s->simm[socket], OBJECT(dev), name, > + s->simm_size[socket] * MiB, &local_err); > + if (local_err) { > + goto out; > + } > memory_region_add_subregion_overlap(get_system_memory(), 0, > &s->simm[socket], socket); > } > } > if (ram_size) { > /* unable to push all requested RAM in SIMMs */ > - error_setg(errp, "RAM size incompatible with this board. " > + error_setg(&local_err, "RAM size incompatible with this board. " > "Try again with something else, like %" PRId64 " MB", > s->ram_size / MiB - ram_size); > - return; > + goto out; > } > > if (s->autoconfigure) { > @@ -191,6 +194,8 @@ static void rs6000mc_realize(DeviceState *dev, Error **errp) > > isa_register_portio_list(ISA_DEVICE(dev), &s->portio, 0x0, > rs6000mc_port_list, s, "rs6000mc"); > +out: > + error_propagate(errp, local_err); > } > > static const VMStateDescription vmstate_rs6000mc = { -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: David Gibson <david@gibson.dropbear.id.au> To: Igor Mammedov <imammedo@redhat.com> 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>, qemu-devel@nongnu.org, "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>, "Artyom Tarasenko" <atar4qemu@gmail.com>, "Richard Henderson" <rth@twiddle.net> Subject: Re: [Qemu-devel] [PATCH v1 2/5] ppc: rs6000_mc: drop usage of memory_region_allocate_system_memory() Date: Tue, 16 Apr 2019 14:13:35 +1000 [thread overview] Message-ID: <20190416041334.GF32705@umbus.fritz.box> (raw) Message-ID: <20190416041335.DXGHk1bncHR5TFmQRQetFwgJsej8F7nTR8tA5L70zAU@z> (raw) In-Reply-To: <1555334842-195718-3-git-send-email-imammedo@redhat.com> [-- Attachment #1: Type: text/plain, Size: 2857 bytes --] On Mon, Apr 15, 2019 at 03:27:19PM +0200, Igor Mammedov wrote: > rs6000mc_realize() violates memory_region_allocate_system_memory() contract > by calling it multiple times which could break -mem-path. Replace it with > plain memory_region_init_ram() instead. > > Signed-off-by: Igor Mammedov <imammedo@redhat.com> Acked-by: David Gibson <david@gibson.dropbear.id.au> LGTM, though I've no idea if the rs6000 machine even works at the moment. > --- > hw/ppc/rs6000_mc.c | 15 ++++++++++----- > 1 file changed, 10 insertions(+), 5 deletions(-) > > diff --git a/hw/ppc/rs6000_mc.c b/hw/ppc/rs6000_mc.c > index 45cb95e..ea174f1 100644 > --- a/hw/ppc/rs6000_mc.c > +++ b/hw/ppc/rs6000_mc.c > @@ -142,6 +142,7 @@ static void rs6000mc_realize(DeviceState *dev, Error **errp) > RS6000MCState *s = RS6000MC_DEVICE(dev); > int socket = 0; > unsigned int ram_size = s->ram_size / MiB; > + Error *local_err = NULL; > > while (socket < 6) { > if (ram_size >= 64) { > @@ -163,19 +164,21 @@ static void rs6000mc_realize(DeviceState *dev, Error **errp) > if (s->simm_size[socket]) { > char name[] = "simm.?"; > name[5] = socket + '0'; > - memory_region_allocate_system_memory(&s->simm[socket], OBJECT(dev), > - name, > - s->simm_size[socket] * MiB); > + memory_region_init_ram(&s->simm[socket], OBJECT(dev), name, > + s->simm_size[socket] * MiB, &local_err); > + if (local_err) { > + goto out; > + } > memory_region_add_subregion_overlap(get_system_memory(), 0, > &s->simm[socket], socket); > } > } > if (ram_size) { > /* unable to push all requested RAM in SIMMs */ > - error_setg(errp, "RAM size incompatible with this board. " > + error_setg(&local_err, "RAM size incompatible with this board. " > "Try again with something else, like %" PRId64 " MB", > s->ram_size / MiB - ram_size); > - return; > + goto out; > } > > if (s->autoconfigure) { > @@ -191,6 +194,8 @@ static void rs6000mc_realize(DeviceState *dev, Error **errp) > > isa_register_portio_list(ISA_DEVICE(dev), &s->portio, 0x0, > rs6000mc_port_list, s, "rs6000mc"); > +out: > + error_propagate(errp, local_err); > } > > static const VMStateDescription vmstate_rs6000mc = { -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2019-04-16 10:22 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é 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 [this message] 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=20190416041334.GF32705@umbus.fritz.box \ --to=david@gibson.dropbear.id.au \ --cc=atar4qemu@gmail.com \ --cc=borntraeger@de.ibm.com \ --cc=cohuck@redhat.com \ --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 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).