From: Igor Mammedov <imammedo@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: peter.maydell@linaro.org, qemu-arm@nongnu.org,
qemu-devel@nongnu.org, Andrew.Baumann@microsoft.com
Subject: Re: [PATCH v2 28/86] arm:raspi: use memdev for RAM
Date: Thu, 16 Jan 2020 17:55:09 +0100 [thread overview]
Message-ID: <20200116175509.36bafe7e@redhat.com> (raw)
In-Reply-To: <b2162130-041f-e709-a33d-56c0beb880b9@redhat.com>
On Wed, 15 Jan 2020 20:07:34 +0100
Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
> On 1/15/20 4:06 PM, Igor Mammedov wrote:
> > memory_region_allocate_system_memory() API is going away, so
> > replace it with memdev allocated MemoryRegion. The later is
> > initialized by generic code, so board only needs to opt in
> > to memdev scheme by providing
> > MachineClass::default_ram_id
> > and using MachineState::ram instead of manually initializing
> > RAM memory region.
> >
> > PS:
> > remove no longer needed RasPiState
> >
> > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > ---
> > CC: Andrew.Baumann@microsoft.com
> > CC: philmd@redhat.com
> > CC: peter.maydell@linaro.org
> > CC: qemu-arm@nongnu.org
> > ---
> > hw/arm/raspi.c | 34 +++++++++++++---------------------
> > 1 file changed, 13 insertions(+), 21 deletions(-)
> >
> > diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
> > index 6a510aa..33ace66 100644
> > --- a/hw/arm/raspi.c
> > +++ b/hw/arm/raspi.c
> > @@ -32,11 +32,6 @@
> > /* Table of Linux board IDs for different Pi versions */
> > static const int raspi_boardid[] = {[1] = 0xc42, [2] = 0xc43, [3] = 0xc44};
> >
> > -typedef struct RasPiState {
> > - BCM283XState soc;
> > - MemoryRegion ram;
> > -} RasPiState;
> > -
> > static void write_smpboot(ARMCPU *cpu, const struct arm_boot_info *info)
> > {
> > static const uint32_t smpboot[] = {
> > @@ -166,7 +161,7 @@ static void setup_boot(MachineState *machine, int version, size_t ram_size)
> >
> > static void raspi_init(MachineState *machine, int version)
> > {
> > - RasPiState *s = g_new0(RasPiState, 1);
> > + Object *soc;
> > uint32_t vcram_size;
> > DriveInfo *di;
> > BlockBackend *blk;
> > @@ -179,30 +174,26 @@ static void raspi_init(MachineState *machine, int version)
> > exit(1);
> > }
> >
> > - object_initialize_child(OBJECT(machine), "soc", &s->soc, sizeof(s->soc),
> > - version == 3 ? TYPE_BCM2837 : TYPE_BCM2836,
> > - &error_abort, NULL);
> > + soc = object_new(version == 3 ? TYPE_BCM2837 : TYPE_BCM2836);
> > + object_property_add_child(OBJECT(machine), "soc", soc, &error_fatal);
> >
> > - /* Allocate and map RAM */
> > - memory_region_allocate_system_memory(&s->ram, OBJECT(machine), "ram",
> > - machine->ram_size);
> > /* FIXME: Remove when we have custom CPU address space support */
> > - memory_region_add_subregion_overlap(get_system_memory(), 0, &s->ram, 0);
> > + memory_region_add_subregion_overlap(get_system_memory(), 0,
> > + machine->ram, 0);
> >
> > /* Setup the SOC */
> > - object_property_add_const_link(OBJECT(&s->soc), "ram", OBJECT(&s->ram),
> > + object_property_add_const_link(soc, "ram", OBJECT(machine->ram),
> > &error_abort);
> > - object_property_set_int(OBJECT(&s->soc), machine->smp.cpus, "enabled-cpus",
> > + object_property_set_int(soc, machine->smp.cpus, "enabled-cpus",
> > &error_abort);
> > int board_rev = version == 3 ? 0xa02082 : 0xa21041;
> > - object_property_set_int(OBJECT(&s->soc), board_rev, "board-rev",
> > - &error_abort);
> > - object_property_set_bool(OBJECT(&s->soc), true, "realized", &error_abort);
> > + object_property_set_int(soc, board_rev, "board-rev", &error_abort);
> > + object_property_set_bool(soc, true, "realized", &error_abort);
> >
> > /* Create and plug in the SD cards */
> > di = drive_get_next(IF_SD);
> > blk = di ? blk_by_legacy_dinfo(di) : NULL;
> > - bus = qdev_get_child_bus(DEVICE(&s->soc), "sd-bus");
> > + bus = qdev_get_child_bus(DEVICE(soc), "sd-bus");
> > if (bus == NULL) {
> > error_report("No SD bus found in SOC object");
> > exit(1);
> > @@ -211,8 +202,7 @@ static void raspi_init(MachineState *machine, int version)
> > qdev_prop_set_drive(carddev, "drive", blk, &error_fatal);
> > object_property_set_bool(OBJECT(carddev), true, "realized", &error_fatal);
> >
> > - vcram_size = object_property_get_uint(OBJECT(&s->soc), "vcram-size",
> > - &error_abort);
> > + vcram_size = object_property_get_uint(soc, "vcram-size", &error_abort);
> > setup_boot(machine, version, machine->ram_size - vcram_size);
> > }
> >
> > @@ -233,6 +223,7 @@ static void raspi2_machine_init(MachineClass *mc)
> > mc->min_cpus = BCM283X_NCPUS;
> > mc->default_cpus = BCM283X_NCPUS;
> > mc->default_ram_size = 1 * GiB;
> > + mc->default_ram_id = "ram";
> > mc->ignore_memory_transaction_failures = true;
> > };
> > DEFINE_MACHINE("raspi2", raspi2_machine_init)
> > @@ -255,6 +246,7 @@ static void raspi3_machine_init(MachineClass *mc)
> > mc->min_cpus = BCM283X_NCPUS;
> > mc->default_cpus = BCM283X_NCPUS;
> > mc->default_ram_size = 1 * GiB;
> > + mc->default_ram_id = "ram";
> > }
> > DEFINE_MACHINE("raspi3", raspi3_machine_init)
> > #endif
> >
>
> This patch diverges a lot from my current work:
> https://www.mail-archive.com/qemu-devel@nongnu.org/msg653818.html
perhaps we could generalize size checks on top of that.
there were some ideas in that direction in
"[PATCH v2 66/86] ppc/{ppc440_bamboo,sam460x}: drop RAM size fixup"
thread
> So I'm not very happy about it. Maybe my bad I should ping more
> aggressively my patches. I can respin mine preparing for your series on top.
this patch is trivial,
if your patches merged before this, than I'll just rebase.
>
> Meanwhile if you are in a hurry I tested yours, so:
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>
>
next prev parent reply other threads:[~2020-01-16 16:55 UTC|newest]
Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1579100861-73692-1-git-send-email-imammedo@redhat.com>
2020-01-15 15:06 ` [PATCH v2 07/86] arm:aspeed: convert valid RAM sizes to data Igor Mammedov
2020-01-16 1:45 ` Joel Stanley
2020-01-15 15:06 ` [PATCH v2 08/86] arm:aspeed: actually check RAM size Igor Mammedov
2020-01-16 8:41 ` Cédric Le Goater
2020-01-16 17:35 ` Igor Mammedov
2020-01-17 7:56 ` Cédric Le Goater
2020-01-20 14:21 ` [PATCH v3 07/84] hw/arm/aspeed: " Igor Mammedov
2020-01-20 15:33 ` Cédric Le Goater
2020-01-15 15:06 ` [PATCH v2 09/86] hw:aspeed: drop warning and bogus ram_size fixup Igor Mammedov
2020-01-15 15:06 ` [PATCH v2 10/86] arm:aspeed: use memdev for RAM Igor Mammedov
2020-01-15 19:19 ` Philippe Mathieu-Daudé
2020-01-16 9:24 ` Cédric Le Goater
2020-01-16 18:17 ` Philippe Mathieu-Daudé
2020-01-15 15:06 ` [PATCH v2 11/86] arm:collie: " Igor Mammedov
2020-01-15 15:06 ` [PATCH v2 12/86] arm:cubieboard: " Igor Mammedov
2020-01-15 15:06 ` [PATCH v2 13/86] arm:digic_boards: " Igor Mammedov
2020-01-15 15:06 ` [PATCH v2 14/86] arm:highbank: " Igor Mammedov
2020-01-15 19:18 ` Philippe Mathieu-Daudé
2020-01-15 15:06 ` [PATCH v2 15/86] arm:imx25_pdk: drop RAM size fixup Igor Mammedov
2020-01-15 15:06 ` [PATCH v2 16/86] arm:imx25_pdk: use memdev for RAM Igor Mammedov
2020-01-15 19:18 ` Philippe Mathieu-Daudé
2020-01-15 15:06 ` [PATCH v2 17/86] arm:integratorcp: " Igor Mammedov
2020-01-15 15:06 ` [PATCH v2 18/86] arm:kzm: drop RAM size fixup Igor Mammedov
2020-01-15 19:58 ` Chubb, Peter (Data61, Kensington NSW)
2020-01-16 17:26 ` [PATCH v3 " Igor Mammedov
2020-01-16 18:22 ` Philippe Mathieu-Daudé
2020-01-17 9:50 ` Igor Mammedov
2020-01-17 13:07 ` Philippe Mathieu-Daudé
2020-01-15 15:06 ` [PATCH v2 19/86] arm:kzm: use memdev for RAM Igor Mammedov
2020-01-15 20:09 ` Chubb, Peter (Data61, Kensington NSW)
2020-01-15 15:06 ` [PATCH v2 20/86] arm:mcimx6ul-evk: " Igor Mammedov
2020-01-15 15:06 ` [PATCH v2 21/86] arm:mcimx7d-sabre: " Igor Mammedov
2020-01-15 15:06 ` [PATCH v2 22/86] arm:mps2-tz: " Igor Mammedov
2020-01-15 15:06 ` [PATCH v2 23/86] arm:mps2: " Igor Mammedov
2020-01-15 15:06 ` [PATCH v2 24/86] arm:musicpal: " Igor Mammedov
2020-01-15 15:06 ` [PATCH v2 25/86] arm:nseries: " Igor Mammedov
2020-01-15 15:06 ` [PATCH v2 26/86] arm:omap_sx1: " Igor Mammedov
2020-01-15 15:06 ` [PATCH v2 27/86] arm:palm: " Igor Mammedov
2020-01-15 15:06 ` [PATCH v2 28/86] arm:raspi: " Igor Mammedov
2020-01-15 19:07 ` Philippe Mathieu-Daudé
2020-01-16 16:55 ` Igor Mammedov [this message]
2020-01-15 15:06 ` [PATCH v2 29/86] arm:sabrelite: " Igor Mammedov
2020-01-15 15:06 ` [PATCH v2 30/86] arm:sbsa-ref: " Igor Mammedov
2020-01-15 19:09 ` Philippe Mathieu-Daudé
2020-01-15 15:06 ` [PATCH v2 31/86] arm:versatilepb: " Igor Mammedov
2020-01-15 19:20 ` Philippe Mathieu-Daudé
2020-01-15 15:06 ` [PATCH v2 32/86] arm:vexpress: " Igor Mammedov
2020-01-15 19:21 ` Philippe Mathieu-Daudé
2020-01-15 15:06 ` [PATCH v2 33/86] arm:virt: " Igor Mammedov
2020-01-15 18:57 ` Philippe Mathieu-Daudé
2020-01-15 15:06 ` [PATCH v2 34/86] arm:xilinx_zynq: drop RAM size fixup Igor Mammedov
2020-01-15 22:59 ` Alistair Francis
2020-01-15 15:06 ` [PATCH v2 35/86] arm:xilinx_zynq: use memdev for RAM Igor Mammedov
2020-01-15 19:01 ` Philippe Mathieu-Daudé
2020-01-16 0:20 ` Alistair Francis
2020-01-15 15:06 ` [PATCH v2 37/86] arm:xlnx-zcu102: " Igor Mammedov
2020-01-15 19:21 ` Philippe Mathieu-Daudé
2020-01-16 0:19 ` Alistair Francis
2020-01-15 15:07 ` [PATCH v2 82/86] numa: forbid '-numa node, mem' for 5.0 and newer machine types Igor Mammedov
2020-01-15 15:34 ` [libvirt] " Peter Krempa
2020-01-15 16:52 ` Igor Mammedov
2020-01-16 10:42 ` Michal Privoznik
2020-01-16 12:37 ` Igor Mammedov
2020-01-16 13:03 ` Michal Privoznik
2020-01-16 13:49 ` Igor Mammedov
2020-01-16 13:06 ` Daniel P. Berrangé
2020-01-16 13:58 ` Igor Mammedov
2020-01-16 4:36 ` David Gibson
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=20200116175509.36bafe7e@redhat.com \
--to=imammedo@redhat.com \
--cc=Andrew.Baumann@microsoft.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@redhat.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
/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