qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PULL 15/36] aspeed: allocate RAM after the memory controller has checked the size
Date: Thu, 22 Sep 2016 18:21:54 +0100	[thread overview]
Message-ID: <1474564935-23831-16-git-send-email-peter.maydell@linaro.org> (raw)
In-Reply-To: <1474564935-23831-1-git-send-email-peter.maydell@linaro.org>

From: Cédric Le Goater <clg@kaod.org>

If the RAM size is invalid, the memory controller will use a default
value.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Andrew Jeffery <andrew@aj.id.au>
Message-id: 1473438177-26079-15-git-send-email-clg@kaod.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/arm/aspeed.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index 562bbb2..6b18c7f 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -108,11 +108,6 @@ static void aspeed_board_init(MachineState *machine,
 
     sc = ASPEED_SOC_GET_CLASS(&bmc->soc);
 
-    memory_region_allocate_system_memory(&bmc->ram, NULL, "ram", ram_size);
-    memory_region_add_subregion(get_system_memory(), sc->info->sdram_base,
-                                &bmc->ram);
-    object_property_add_const_link(OBJECT(&bmc->soc), "ram", OBJECT(&bmc->ram),
-                                   &error_abort);
     object_property_set_int(OBJECT(&bmc->soc), ram_size, "ram-size",
                            &error_abort);
     object_property_set_int(OBJECT(&bmc->soc), cfg->hw_strap1, "hw-strap1",
@@ -120,6 +115,19 @@ static void aspeed_board_init(MachineState *machine,
     object_property_set_bool(OBJECT(&bmc->soc), true, "realized",
                              &error_abort);
 
+    /*
+     * Allocate RAM after the memory controller has checked the size
+     * was valid. If not, a default value is used.
+     */
+    ram_size = object_property_get_int(OBJECT(&bmc->soc), "ram-size",
+                                       &error_abort);
+
+    memory_region_allocate_system_memory(&bmc->ram, NULL, "ram", ram_size);
+    memory_region_add_subregion(get_system_memory(), sc->info->sdram_base,
+                                &bmc->ram);
+    object_property_add_const_link(OBJECT(&bmc->soc), "ram", OBJECT(&bmc->ram),
+                                   &error_abort);
+
     aspeed_board_init_flashes(&bmc->soc.smc, "n25q256a", &error_abort);
     aspeed_board_init_flashes(&bmc->soc.spi, "mx25l25635e", &error_abort);
 
-- 
2.7.4

  parent reply	other threads:[~2016-09-22 17:22 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-22 17:21 [Qemu-devel] [PULL 00/36] target-arm queue Peter Maydell
2016-09-22 17:21 ` [Qemu-devel] [PULL 01/36] arm: add Cortex A7 CPU parameters Peter Maydell
2016-09-22 17:21 ` [Qemu-devel] [PULL 02/36] ast2400: rename the Aspeed SoC files to aspeed_soc Peter Maydell
2016-09-22 17:21 ` [Qemu-devel] [PULL 03/36] ast2400: replace ast2400 with aspeed_soc Peter Maydell
2016-09-22 17:21 ` [Qemu-devel] [PULL 04/36] aspeed-soc: provide a framework to add new SoCs Peter Maydell
2016-09-22 17:21 ` [Qemu-devel] [PULL 05/36] palmetto-bmc: rename the Aspeed board file to aspeed.c Peter Maydell
2016-09-22 17:21 ` [Qemu-devel] [PULL 06/36] palmetto-bmc: replace palmetto_bmc with aspeed Peter Maydell
2016-09-22 17:21 ` [Qemu-devel] [PULL 07/36] palmetto-bmc: add board specific configuration Peter Maydell
2016-09-22 17:21 ` [Qemu-devel] [PULL 08/36] hw/misc: use macros to define hw-strap1 register on the AST2400 Aspeed SoC Peter Maydell
2016-09-22 17:21 ` [Qemu-devel] [PULL 09/36] aspeed: add a ast2500 SoC and support to the SCU and SDMC controllers Peter Maydell
2016-09-22 17:21 ` [Qemu-devel] [PULL 10/36] arm: add support for an ast2500 evaluation board Peter Maydell
2016-09-22 17:21 ` [Qemu-devel] [PULL 11/36] palmetto-bmc: remove extra no_sdcard assignement Peter Maydell
2016-09-22 17:21 ` [Qemu-devel] [PULL 12/36] aspeed: calculate the RAM size bits at realize time Peter Maydell
2016-09-22 17:21 ` [Qemu-devel] [PULL 13/36] aspeed: use error_report instead of LOG_GUEST_ERROR Peter Maydell
2016-09-22 17:21 ` [Qemu-devel] [PULL 14/36] aspeed: add a ram_size property to the memory controller Peter Maydell
2016-09-22 17:21 ` Peter Maydell [this message]
2016-09-22 17:21 ` [Qemu-devel] [PULL 16/36] hw/ptimer: Actually stop the timer in case of error Peter Maydell
2016-09-22 17:21 ` [Qemu-devel] [PULL 17/36] hw/ptimer: Introduce timer policy feature Peter Maydell
2016-09-22 17:21 ` [Qemu-devel] [PULL 18/36] hw/ptimer: Suppress error messages under qtest Peter Maydell
2016-09-22 17:21 ` [Qemu-devel] [PULL 19/36] tests: Add ptimer tests Peter Maydell
2016-09-22 17:21 ` [Qemu-devel] [PULL 20/36] cadence_gem: QOMify Cadence GEM Peter Maydell
2016-09-22 17:22 ` [Qemu-devel] [PULL 21/36] cadence_gem: Add the num-priority-queues property Peter Maydell
2016-09-22 17:22 ` [Qemu-devel] [PULL 22/36] cadence_gem: Add support for screening Peter Maydell
2016-09-22 17:22 ` [Qemu-devel] [PULL 23/36] cadence_gem: Add queue support Peter Maydell
2016-09-26 11:01   ` Paolo Bonzini
2016-09-26 17:43     ` Alistair Francis
2016-09-22 17:22 ` [Qemu-devel] [PULL 24/36] cadence_gem: Correct indentation Peter Maydell
2016-09-22 17:22 ` [Qemu-devel] [PULL 25/36] xlnx-zynqmp: Set the number of priority queues Peter Maydell
2016-09-22 17:22 ` [Qemu-devel] [PULL 26/36] loader: Allow ELF loader to auto-detect the ELF arch Peter Maydell
2016-09-22 17:22 ` [Qemu-devel] [PULL 27/36] loader: Use the specified MemoryRegion Peter Maydell
2016-09-22 17:22 ` [Qemu-devel] [PULL 28/36] loader: Allow a custom AddressSpace when loading ROMs Peter Maydell
2016-09-22 17:22 ` [Qemu-devel] [PULL 29/36] loader: Add AddressSpace loading support to ELFs Peter Maydell
2016-09-22 17:22 ` [Qemu-devel] [PULL 30/36] loader: Add AddressSpace loading support to uImages Peter Maydell
2016-09-22 17:22 ` [Qemu-devel] [PULL 31/36] loader: Add AddressSpace loading support to targphys Peter Maydell
2016-09-22 17:22 ` [Qemu-devel] [PULL 32/36] dma: xlnx-zynq-devcfg: Fix up XLNX_ZYNQ_DEVCFG_R_MAX Peter Maydell
2016-09-22 17:22 ` [Qemu-devel] [PULL 33/36] vmstateify ssd0323 display Peter Maydell
2016-09-22 17:22 ` [Qemu-devel] [PULL 34/36] vmstateify ssi-sd Peter Maydell
2016-09-22 17:22 ` [Qemu-devel] [PULL 35/36] disas/arm.c: Remove unused macro definitions Peter Maydell
2016-09-22 17:22 ` [Qemu-devel] [PULL 36/36] imx: Use 'const char', not 'char const' Peter Maydell
2016-09-22 19:58 ` [Qemu-devel] [PULL 00/36] target-arm queue no-reply
2016-09-23  9:57 ` Peter Maydell

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=1474564935-23831-16-git-send-email-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.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;
as well as URLs for NNTP newsgroup(s).