Skip to contentSkip to conversation

ARVM7 Memory region variable tweaks

PATCH In review Peter Crosthwaite 2 participants 4 messages Aug 18, 2014 – Aug 19, 2014

lore
Share & tools
lore
#0 lore raw

v2 cover ARVM7 Memory region variable tweaks

Hi Peter,

A few trivial cleanup renamings to ARMv7 while auditing code.

Regards,
Peter

Changed since v1:
Add cover

Peter Crosthwaite (2):
arm: armv7m: Rename address_space_mem -> system_memory
arm: stellaris: Remove misleading address_space_mem var

 hw/arm/armv7m.c      | 8 ++++----
 hw/arm/stellaris.c   | 3 +--
 include/hw/arm/arm.h | 2 +-
 3 files changed, 6 insertions(+), 7 deletions(-)
Signature · 1 line
2.0.1.1.gfbfc394
#1 lore raw

PATCH v2 1/2 arm: armv7m: Rename address_space_mem -> system_memory

This argument is a MemoryRegion and not an AddressSpace.

"Address space" means something quite different to "memory region" in QEMU parlance so rename the variable to reduce confusion.

---

 hw/arm/armv7m.c      | 8 ++++----
 include/hw/arm/arm.h | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)
hw/arm/armv7m.c +4 -4
index 397e8df..aedef13 100644
@@ -166,7 +166,7 @@ static void armv7m_reset(void *opaque)
    flash_size and sram_size are in kb.
    Returns the NVIC array.  */
 
-qemu_irq *armv7m_init(MemoryRegion *address_space_mem,
+qemu_irq *armv7m_init(MemoryRegion *system_memory,
                       int flash_size, int sram_size,
                       const char *kernel_filename, const char *cpu_model)
 {
@@ -213,10 +213,10 @@ qemu_irq *armv7m_init(MemoryRegion *address_space_mem,
     memory_region_init_ram(flash, NULL, "armv7m.flash", flash_size);
     vmstate_register_ram_global(flash);
     memory_region_set_readonly(flash, true);
-    memory_region_add_subregion(address_space_mem, 0, flash);
+    memory_region_add_subregion(system_memory, 0, flash);
     memory_region_init_ram(sram, NULL, "armv7m.sram", sram_size);
     vmstate_register_ram_global(sram);
-    memory_region_add_subregion(address_space_mem, 0x20000000, sram);
+    memory_region_add_subregion(system_memory, 0x20000000, sram);
     armv7m_bitband_init();
 
     nvic = qdev_create(NULL, "armv7m_nvic");
@@ -257,7 +257,7 @@ qemu_irq *armv7m_init(MemoryRegion *address_space_mem,
        when returning from an exception.  */
     memory_region_init_ram(hack, NULL, "armv7m.hack", 0x1000);
     vmstate_register_ram_global(hack);
-    memory_region_add_subregion(address_space_mem, 0xfffff000, hack);
+    memory_region_add_subregion(system_memory, 0xfffff000, hack);
 
     qemu_register_reset(armv7m_reset, cpu);
     return pic;
include/hw/arm/arm.h +1 -1
index cbbf4ca..cefc9e6 100644
@@ -15,7 +15,7 @@
 #include "hw/irq.h"
 
 /* armv7m.c */
-qemu_irq *armv7m_init(MemoryRegion *address_space_mem,
+qemu_irq *armv7m_init(MemoryRegion *system_memory,
                       int flash_size, int sram_size,
                       const char *kernel_filename, const char *cpu_model);
 
Signature · 1 line
2.0.1.1.gfbfc394
#2 lore raw

PATCH v2 2/2 arm: stellaris: Remove misleading address_space_mem var

In reply to Peter Crosthwaite

It's a MemoryRegion and not an AddressSpace. But since it's single use, just inline the get_system_memory() call to the only usage to remove it.

---

 hw/arm/stellaris.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
hw/arm/stellaris.c +1 -2
index 80028e8..64bd4b4 100644
@@ -1208,7 +1208,6 @@ static void stellaris_init(const char *kernel_filename, const char *cpu_model,
         0x40024000, 0x40025000, 0x40026000};
     static const int gpio_irq[7] = {0, 1, 2, 3, 4, 30, 31};
 
-    MemoryRegion *address_space_mem = get_system_memory();
     qemu_irq *pic;
     DeviceState *gpio_dev[7];
     qemu_irq gpio_in[7][8];
@@ -1223,7 +1222,7 @@ static void stellaris_init(const char *kernel_filename, const char *cpu_model,
 
     flash_size = ((board->dc0 & 0xffff) + 1) << 1;
     sram_size = (board->dc0 >> 18) + 1;
-    pic = armv7m_init(address_space_mem,
+    pic = armv7m_init(get_system_memory(),
                       flash_size, sram_size, kernel_filename, cpu_model);
 
     if (board->dc1 & (1 << 16)) {
Signature · 1 line
2.0.1.1.gfbfc394