All of lore.kernel.org
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: qemu-devel@nongnu.org
Subject: [PATCH v4 32/80] arm/vexpress: use memdev for RAM
Date: Fri, 31 Jan 2020 16:09:02 +0100	[thread overview]
Message-ID: <1580483390-131164-33-git-send-email-imammedo@redhat.com> (raw)
In-Reply-To: <1580483390-131164-1-git-send-email-imammedo@redhat.com>

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.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/arm/vexpress.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c
index 4673a88..ed683ee 100644
--- a/hw/arm/vexpress.c
+++ b/hw/arm/vexpress.c
@@ -273,7 +273,6 @@ static void a9_daughterboard_init(const VexpressMachineState *vms,
 {
     MachineState *machine = MACHINE(vms);
     MemoryRegion *sysmem = get_system_memory();
-    MemoryRegion *ram = g_new(MemoryRegion, 1);
     MemoryRegion *lowram = g_new(MemoryRegion, 1);
     ram_addr_t low_ram_size;
 
@@ -283,8 +282,6 @@ static void a9_daughterboard_init(const VexpressMachineState *vms,
         exit(1);
     }
 
-    memory_region_allocate_system_memory(ram, NULL, "vexpress.highmem",
-                                         ram_size);
     low_ram_size = ram_size;
     if (low_ram_size > 0x4000000) {
         low_ram_size = 0x4000000;
@@ -293,9 +290,10 @@ static void a9_daughterboard_init(const VexpressMachineState *vms,
      * address space should in theory be remappable to various
      * things including ROM or RAM; we always map the RAM there.
      */
-    memory_region_init_alias(lowram, NULL, "vexpress.lowmem", ram, 0, low_ram_size);
+    memory_region_init_alias(lowram, NULL, "vexpress.lowmem", machine->ram,
+                             0, low_ram_size);
     memory_region_add_subregion(sysmem, 0x0, lowram);
-    memory_region_add_subregion(sysmem, 0x60000000, ram);
+    memory_region_add_subregion(sysmem, 0x60000000, machine->ram);
 
     /* 0x1e000000 A9MPCore (SCU) private memory region */
     init_cpus(machine, cpu_type, TYPE_A9MPCORE_PRIV, 0x1e000000, pic,
@@ -360,7 +358,6 @@ static void a15_daughterboard_init(const VexpressMachineState *vms,
 {
     MachineState *machine = MACHINE(vms);
     MemoryRegion *sysmem = get_system_memory();
-    MemoryRegion *ram = g_new(MemoryRegion, 1);
     MemoryRegion *sram = g_new(MemoryRegion, 1);
 
     {
@@ -375,10 +372,8 @@ static void a15_daughterboard_init(const VexpressMachineState *vms,
         }
     }
 
-    memory_region_allocate_system_memory(ram, NULL, "vexpress.highmem",
-                                         ram_size);
     /* RAM is from 0x80000000 upwards; there is no low-memory alias for it. */
-    memory_region_add_subregion(sysmem, 0x80000000, ram);
+    memory_region_add_subregion(sysmem, 0x80000000, machine->ram);
 
     /* 0x2c000000 A15MPCore private memory region (GIC) */
     init_cpus(machine, cpu_type, TYPE_A15MPCORE_PRIV,
@@ -795,6 +790,7 @@ static void vexpress_class_init(ObjectClass *oc, void *data)
     mc->init = vexpress_common_init;
     mc->max_cpus = 4;
     mc->ignore_memory_transaction_failures = true;
+    mc->default_ram_id = "vexpress.highmem";
 }
 
 static void vexpress_a9_class_init(ObjectClass *oc, void *data)
-- 
2.7.4



  parent reply	other threads:[~2020-01-31 15:37 UTC|newest]

Thread overview: 102+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-31 15:08 [PATCH v4 00/80] refactor main RAM allocation to use hostmem backend Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 01/80] numa: remove deprecated -mem-path fallback to anonymous RAM Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 02/80] machine: introduce memory-backend property Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 03/80] machine: alias -mem-path and -mem-prealloc into memory-foo backend Igor Mammedov
2020-02-03  9:04   ` Michael S. Tsirkin
2020-02-03  9:27     ` Igor Mammedov
2020-02-03  9:42       ` Michael S. Tsirkin
2020-02-03 10:40         ` Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 04/80] machine: introduce convenience MachineState::ram Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 05/80] initialize MachineState::ram in NUMA case Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 06/80] vl.c: move -m parsing after memory backends has been processed Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 07/80] vl.c: ensure that ram_size matches size of machine.memory-backend Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 08/80] alpha/dp264: use memdev for RAM Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 09/80] arm/aspeed: actually check RAM size Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 10/80] arm/aspeed: use memdev for RAM Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 11/80] arm/collie: " Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 12/80] arm/cubieboard: " Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 13/80] arm/digic_boards: " Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 14/80] arm/highbank: " Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 15/80] arm/imx25_pdk: drop RAM size fixup Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 16/80] arm/imx25_pdk: use memdev for RAM Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 17/80] arm/integratorcp: " Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 18/80] arm/kzm: drop RAM size fixup Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 19/80] arm/kzm: use memdev for RAM Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 20/80] arm/mcimx6ul-evk: " Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 21/80] arm/mcimx7d-sabre: " Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 22/80] arm/mps2-tz: " Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 23/80] arm/mps2: " Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 24/80] arm/musicpal: " Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 25/80] arm/nseries: " Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 26/80] arm/omap_sx1: " Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 27/80] arm/palm: " Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 28/80] arm/raspi: " Igor Mammedov
2020-01-31 15:08 ` [PATCH v4 29/80] arm/sabrelite: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 30/80] arm/sbsa-ref: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 31/80] arm/versatilepb: " Igor Mammedov
2020-01-31 15:09 ` Igor Mammedov [this message]
2020-01-31 15:09 ` [PATCH v4 33/80] arm/virt: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 34/80] arm/xilinx_zynq: drop RAM size fixup Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 35/80] arm/xilinx_zynq: use memdev for RAM Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 36/80] arm/xlnx-versal-virt: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 37/80] arm/xlnx-zcu102: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 38/80] s390x/s390-virtio-ccw: " Igor Mammedov
2020-02-05 20:11   ` Halil Pasic
2020-02-06 13:15     ` Igor Mammedov
2020-02-10 19:33       ` Halil Pasic
2020-01-31 15:09 ` [PATCH v4 39/80] null-machine: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 40/80] cris/axis_dev88: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 41/80] hppa: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 42/80] x86/microvm: " Igor Mammedov
2020-02-03  8:58   ` Michael S. Tsirkin
2020-01-31 15:09 ` [PATCH v4 43/80] x86/pc: " Igor Mammedov
2020-02-03  9:07   ` Michael S. Tsirkin
2020-02-03  9:45     ` Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 44/80] lm32/lm32_boards: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 45/80] lm32/milkymist: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 46/80] m68k/an5206: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 47/80] m68k/q800: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 48/80] m68k/mcf5208: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 49/80] m68k/next-cube: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 50/80] mips/boston: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 51/80] mips/mips_fulong2e: drop RAM size fixup Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 52/80] mips/mips_fulong2e: use memdev for RAM Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 53/80] mips/mips_jazz: " Igor Mammedov
2020-02-09 16:41   ` Philippe Mathieu-Daudé
2020-02-10 15:06     ` [PATCH v5 81/80] mips/mips_jazz: add max ram size check Igor Mammedov
2020-02-10 17:04       ` Philippe Mathieu-Daudé
2020-01-31 15:09 ` [PATCH v4 54/80] mips/mips_malta: use memdev for RAM Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 55/80] mips/mips_mipssim: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 56/80] mips/mips_r4k: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 57/80] ppc/e500: drop RAM size fixup Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 58/80] ppc/e500: use memdev for RAM Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 59/80] ppc/mac_newworld: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 60/80] ppc/mac_oldworld: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 61/80] ppc/pnv: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 62/80] ppc/ppc405_boards: add RAM size checks Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 63/80] ppc/ppc405_boards: use memdev for RAM Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 64/80] ppc/{ppc440_bamboo, sam460ex}: drop RAM size fixup Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 65/80] ppc/{ppc440_bamboo, sam460ex}: use memdev for RAM Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 66/80] ppc/prep: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 67/80] ppc/spapr: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 68/80] ppc/virtex_ml507: remove unused arguments Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 69/80] ppc/virtex_ml507: use memdev for RAM Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 70/80] sparc/leon3: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 71/80] sparc/sun4m: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 72/80] sparc/niagara: " Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 73/80] remove no longer used memory_region_allocate_system_memory() Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 74/80] exec: cleanup qemu_minrampagesize()/qemu_maxrampagesize() Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 75/80] exec: drop bogus mem_path from qemu_ram_alloc_from_fd() Igor Mammedov
2020-02-07 14:42   ` Marc-André Lureau
2020-01-31 15:09 ` [PATCH v4 76/80] make mem_path local variable Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 77/80] hostmem: introduce "prealloc-threads" property Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 78/80] hostmem: fix strict bind policy Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 79/80] tests/numa-test: make top level args dynamic and g_autofree(cli) cleanups Igor Mammedov
2020-01-31 15:09 ` [PATCH v4 80/80] tests:numa-test: use explicit memdev to specify node RAM Igor Mammedov
2020-01-31 16:16 ` [PATCH v4 00/80] refactor main RAM allocation to use hostmem backend no-reply
2020-01-31 16:28 ` no-reply
2020-02-03  9:49   ` Igor Mammedov
2020-02-04 15:08 ` Igor Mammedov
2020-02-04 15:39   ` Igor Mammedov
2020-02-04 22:05     ` Paolo Bonzini
2020-02-05 13:20       ` Philippe Mathieu-Daudé

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=1580483390-131164-33-git-send-email-imammedo@redhat.com \
    --to=imammedo@redhat.com \
    --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 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.