[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 114/136] hw/arm/stm32: Use memory_region_init_rom() with read-only
From: |
Paolo Bonzini |
Subject: |
[PULL 114/136] hw/arm/stm32: Use memory_region_init_rom() with read-only regions |
Date: |
Tue, 25 Feb 2020 13:07:12 +0100 |
From: Philippe Mathieu-Daudé <address@hidden>
The scripts/coccinelle/memory-region-housekeeping.cocci reported:
* TODO
[[view:./hw/arm/stm32f205_soc.c::face=ovl-face1::linb=96::colb=4::cole=26][potential
use of memory_region_init_rom*() in ./hw/arm/stm32f205_soc.c::96]]
* TODO
[[view:./hw/arm/stm32f405_soc.c::face=ovl-face1::linb=98::colb=4::cole=26][potential
use of memory_region_init_rom*() in ./hw/arm/stm32f405_soc.c::98]]
We can indeed replace the memory_region_init_ram() and
memory_region_set_readonly() calls by memory_region_init_rom().
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
Message-Id: <address@hidden>
Supersedes: <address@hidden>
---
hw/arm/stm32f205_soc.c | 4 +---
hw/arm/stm32f405_soc.c | 4 +---
2 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/hw/arm/stm32f205_soc.c b/hw/arm/stm32f205_soc.c
index 627fd44..2de5627 100644
--- a/hw/arm/stm32f205_soc.c
+++ b/hw/arm/stm32f205_soc.c
@@ -93,12 +93,10 @@ static void stm32f205_soc_realize(DeviceState *dev_soc,
Error **errp)
MemoryRegion *flash = g_new(MemoryRegion, 1);
MemoryRegion *flash_alias = g_new(MemoryRegion, 1);
- memory_region_init_ram(flash, NULL, "STM32F205.flash", FLASH_SIZE,
+ memory_region_init_rom(flash, NULL, "STM32F205.flash", FLASH_SIZE,
&error_fatal);
memory_region_init_alias(flash_alias, NULL, "STM32F205.flash.alias",
flash, 0, FLASH_SIZE);
-
- memory_region_set_readonly(flash, true);
memory_region_set_readonly(flash_alias, true);
memory_region_add_subregion(system_memory, FLASH_BASE_ADDRESS, flash);
diff --git a/hw/arm/stm32f405_soc.c b/hw/arm/stm32f405_soc.c
index 9bcad97..b8fca13 100644
--- a/hw/arm/stm32f405_soc.c
+++ b/hw/arm/stm32f405_soc.c
@@ -95,7 +95,7 @@ static void stm32f405_soc_realize(DeviceState *dev_soc, Error
**errp)
Error *err = NULL;
int i;
- memory_region_init_ram(&s->flash, NULL, "STM32F405.flash", FLASH_SIZE,
+ memory_region_init_rom(&s->flash, NULL, "STM32F405.flash", FLASH_SIZE,
&err);
if (err != NULL) {
error_propagate(errp, err);
@@ -103,8 +103,6 @@ static void stm32f405_soc_realize(DeviceState *dev_soc,
Error **errp)
}
memory_region_init_alias(&s->flash_alias, NULL, "STM32F405.flash.alias",
&s->flash, 0, FLASH_SIZE);
-
- memory_region_set_readonly(&s->flash, true);
memory_region_set_readonly(&s->flash_alias, true);
memory_region_add_subregion(system_memory, FLASH_BASE_ADDRESS, &s->flash);
--
1.8.3.1
- [PULL 103/136] hw/arm: Use memory_region_init_rom() with read-only regions, (continued)
- [PULL 103/136] hw/arm: Use memory_region_init_rom() with read-only regions, Paolo Bonzini, 2020/02/25
- [PULL 105/136] hw/mips: Use memory_region_init_rom() with read-only regions, Paolo Bonzini, 2020/02/25
- [PULL 106/136] hw/m68k: Use memory_region_init_rom() with read-only regions, Paolo Bonzini, 2020/02/25
- [PULL 107/136] hw/net: Use memory_region_init_rom() with read-only regions, Paolo Bonzini, 2020/02/25
- [PULL 108/136] hw/pci-host: Use memory_region_init_rom() with read-only regions, Paolo Bonzini, 2020/02/25
- [PULL 110/136] hw/riscv: Use memory_region_init_rom() with read-only regions, Paolo Bonzini, 2020/02/25
- [PULL 113/136] scripts/cocci: Patch to detect potential use of memory_region_init_rom, Paolo Bonzini, 2020/02/25
- [PULL 112/136] hw/sparc: Use memory_region_init_rom() with read-only regions, Paolo Bonzini, 2020/02/25
- [PULL 111/136] hw/sh4: Use memory_region_init_rom() with read-only regions, Paolo Bonzini, 2020/02/25
- [PULL 109/136] hw/ppc: Use memory_region_init_rom() with read-only regions, Paolo Bonzini, 2020/02/25
- [PULL 114/136] hw/arm/stm32: Use memory_region_init_rom() with read-only regions,
Paolo Bonzini <=
- [PULL 116/136] hw/i386/pc_sysfw: Simplify using memory_region_init_alias(), Paolo Bonzini, 2020/02/25
- [PULL 117/136] hw/i386/pc_sysfw: Remove unused 'ram_size' argument, Paolo Bonzini, 2020/02/25
- [PULL 118/136] scripts/cocci: Patch to remove unnecessary memory_region_set_readonly(), Paolo Bonzini, 2020/02/25
- [PULL 119/136] hw/arm: Remove unnecessary memory_region_set_readonly() on ROM alias, Paolo Bonzini, 2020/02/25
- [PULL 122/136] hw/char: Let devices own the MemoryRegion they create, Paolo Bonzini, 2020/02/25
- [PULL 123/136] hw/core: Let devices own the MemoryRegion they create, Paolo Bonzini, 2020/02/25
- [PULL 124/136] hw/display: Let devices own the MemoryRegion they create, Paolo Bonzini, 2020/02/25
- [PULL 115/136] hw/ppc/ppc405: Use memory_region_init_rom() with read-only regions, Paolo Bonzini, 2020/02/25
- [PULL 121/136] hw/arm: Let devices own the MemoryRegion they create, Paolo Bonzini, 2020/02/25
- [PULL 127/136] hw/input/milkymist-softusb: Remove unused 'pmem_ptr' field, Paolo Bonzini, 2020/02/25