[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 028/136] arm/sabrelite: use memdev for RAM
From: |
Paolo Bonzini |
Subject: |
[PULL 028/136] arm/sabrelite: use memdev for RAM |
Date: |
Tue, 25 Feb 2020 12:49:18 +0100 |
From: Igor Mammedov <address@hidden>
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 IMX6Sabrelite
Signed-off-by: Igor Mammedov <address@hidden>
Reviewed-by: Andrew Jones <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
Message-Id: <address@hidden>
---
hw/arm/sabrelite.c | 23 ++++++++---------------
1 file changed, 8 insertions(+), 15 deletions(-)
diff --git a/hw/arm/sabrelite.c b/hw/arm/sabrelite.c
index 96cc455..e31694b 100644
--- a/hw/arm/sabrelite.c
+++ b/hw/arm/sabrelite.c
@@ -19,11 +19,6 @@
#include "qemu/error-report.h"
#include "sysemu/qtest.h"
-typedef struct IMX6Sabrelite {
- FslIMX6State soc;
- MemoryRegion ram;
-} IMX6Sabrelite;
-
static struct arm_boot_info sabrelite_binfo = {
/* DDR memory start */
.loader_start = FSL_IMX6_MMDC_ADDR,
@@ -45,7 +40,7 @@ static void sabrelite_reset_secondary(ARMCPU *cpu,
static void sabrelite_init(MachineState *machine)
{
- IMX6Sabrelite *s = g_new0(IMX6Sabrelite, 1);
+ FslIMX6State *s;
Error *err = NULL;
/* Check the amount of memory is compatible with the SOC */
@@ -55,19 +50,16 @@ static void sabrelite_init(MachineState *machine)
exit(1);
}
- object_initialize_child(OBJECT(machine), "soc", &s->soc, sizeof(s->soc),
- TYPE_FSL_IMX6, &error_abort, NULL);
-
- object_property_set_bool(OBJECT(&s->soc), true, "realized", &err);
+ s = FSL_IMX6(object_new(TYPE_FSL_IMX6));
+ object_property_add_child(OBJECT(machine), "soc", OBJECT(s), &error_fatal);
+ object_property_set_bool(OBJECT(s), true, "realized", &err);
if (err != NULL) {
error_report("%s", error_get_pretty(err));
exit(1);
}
- memory_region_allocate_system_memory(&s->ram, NULL, "sabrelite.ram",
- machine->ram_size);
memory_region_add_subregion(get_system_memory(), FSL_IMX6_MMDC_ADDR,
- &s->ram);
+ machine->ram);
{
/*
@@ -78,7 +70,7 @@ static void sabrelite_init(MachineState *machine)
/* Add the sst25vf016b NOR FLASH memory to first SPI */
Object *spi_dev;
- spi_dev = object_resolve_path_component(OBJECT(&s->soc), "spi1");
+ spi_dev = object_resolve_path_component(OBJECT(s), "spi1");
if (spi_dev) {
SSIBus *spi_bus;
@@ -109,7 +101,7 @@ static void sabrelite_init(MachineState *machine)
sabrelite_binfo.secondary_cpu_reset_hook = sabrelite_reset_secondary;
if (!qtest_enabled()) {
- arm_load_kernel(&s->soc.cpu[0], machine, &sabrelite_binfo);
+ arm_load_kernel(&s->cpu[0], machine, &sabrelite_binfo);
}
}
@@ -119,6 +111,7 @@ static void sabrelite_machine_init(MachineClass *mc)
mc->init = sabrelite_init;
mc->max_cpus = FSL_IMX6_NUM_CPUS;
mc->ignore_memory_transaction_failures = true;
+ mc->default_ram_id = "sabrelite.ram";
}
DEFINE_MACHINE("sabrelite", sabrelite_machine_init)
--
1.8.3.1
- [PULL 015/136] arm/imx25_pdk: drop RAM size fixup, (continued)
- [PULL 015/136] arm/imx25_pdk: drop RAM size fixup, Paolo Bonzini, 2020/02/25
- [PULL 022/136] arm/mps2-tz: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 023/136] arm/mps2: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 025/136] arm/nseries: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 017/136] arm/integratorcp: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 027/136] arm/palm: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 024/136] arm/musicpal: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 019/136] arm/kzm: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 020/136] arm/mcimx6ul-evk: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 021/136] arm/mcimx7d-sabre: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 028/136] arm/sabrelite: use memdev for RAM,
Paolo Bonzini <=
- [PULL 032/136] arm/vexpress: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 026/136] arm/omap_sx1: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 031/136] arm/versatilepb: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 029/136] arm/raspi: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 035/136] arm/xilinx_zynq: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 039/136] null-machine: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 034/136] arm/xilinx_zynq: drop RAM size fixup, Paolo Bonzini, 2020/02/25
- [PULL 038/136] s390x/s390-virtio-ccw: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 033/136] arm/virt: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 030/136] arm/sbsa-ref: use memdev for RAM, Paolo Bonzini, 2020/02/25