[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 51/61] scripts/cocci: Patch to remove unnecessary memory_region_se
From: |
Paolo Bonzini |
Subject: |
[PULL 51/61] scripts/cocci: Patch to remove unnecessary memory_region_set_readonly() |
Date: |
Mon, 16 Mar 2020 22:27:18 +0100 |
From: Philippe Mathieu-Daudé <address@hidden>
Add a semantic patch to remove memory_region_set_readonly() calls
on ROM memory regions.
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
scripts/coccinelle/memory-region-housekeeping.cocci | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/scripts/coccinelle/memory-region-housekeeping.cocci
b/scripts/coccinelle/memory-region-housekeeping.cocci
index 9cdde71..5e6b31d 100644
--- a/scripts/coccinelle/memory-region-housekeeping.cocci
+++ b/scripts/coccinelle/memory-region-housekeeping.cocci
@@ -48,6 +48,21 @@ p << possible_memory_region_init_rom.p;
cocci.print_main("potential use of memory_region_init_rom*() in ", p)
+// Do not call memory_region_set_readonly() on ROM alias
+@@
+expression ROM, E1, E2, E3, E4;
+expression ALIAS, E5, E6, E7, E8;
+@@
+(
+ memory_region_init_rom(ROM, E1, E2, E3, E4);
+|
+ memory_region_init_rom_nomigrate(ROM, E1, E2, E3, E4);
+)
+ ...
+ memory_region_init_alias(ALIAS, E5, E6, ROM, E7, E8);
+- memory_region_set_readonly(ALIAS, true);
+
+
// Replace by-hand memory_region_init_ram_nomigrate/vmstate_register_ram
// code sequences with use of the new memory_region_init_ram function.
// Similarly for the _rom and _rom_device functions.
--
1.8.3.1
- [PULL 39/61] scripts/cocci: Rename memory-region-{init-ram -> housekeeping}, (continued)
- [PULL 39/61] scripts/cocci: Rename memory-region-{init-ram -> housekeeping}, Paolo Bonzini, 2020/03/16
- [PULL 41/61] hw/arm: Use memory_region_init_rom() with read-only regions, Paolo Bonzini, 2020/03/16
- [PULL 44/61] hw/net: Use memory_region_init_rom() with read-only regions, Paolo Bonzini, 2020/03/16
- [PULL 45/61] hw/pci-host: Use memory_region_init_rom() with read-only regions, Paolo Bonzini, 2020/03/16
- [PULL 46/61] hw/ppc: Use memory_region_init_rom() with read-only regions, Paolo Bonzini, 2020/03/16
- [PULL 43/61] hw/m68k: Use memory_region_init_rom() with read-only regions, Paolo Bonzini, 2020/03/16
- [PULL 48/61] hw/sh4: Use memory_region_init_rom() with read-only regions, Paolo Bonzini, 2020/03/16
- [PULL 50/61] scripts/cocci: Patch to detect potential use of memory_region_init_rom, Paolo Bonzini, 2020/03/16
- [PULL 47/61] hw/riscv: Use memory_region_init_rom() with read-only regions, Paolo Bonzini, 2020/03/16
- [PULL 49/61] hw/sparc: Use memory_region_init_rom() with read-only regions, Paolo Bonzini, 2020/03/16
- [PULL 51/61] scripts/cocci: Patch to remove unnecessary memory_region_set_readonly(),
Paolo Bonzini <=
- [PULL 52/61] scripts/cocci: Patch to let devices own their MemoryRegions, Paolo Bonzini, 2020/03/16
- [PULL 53/61] hw/core: Let devices own the MemoryRegion they create, Paolo Bonzini, 2020/03/16
- [PULL 54/61] hw/display: Let devices own the MemoryRegion they create, Paolo Bonzini, 2020/03/16
- [PULL 55/61] hw/dma: Let devices own the MemoryRegion they create, Paolo Bonzini, 2020/03/16
- [PULL 56/61] hw/riscv: Let devices own the MemoryRegion they create, Paolo Bonzini, 2020/03/16
- [PULL 57/61] hw/char: Let devices own the MemoryRegion they create, Paolo Bonzini, 2020/03/16
- [PULL 60/61] hw/arm: Remove unnecessary memory_region_set_readonly() on ROM alias, Paolo Bonzini, 2020/03/16
- [PULL 58/61] hw/arm/stm32: Use memory_region_init_rom() with read-only regions, Paolo Bonzini, 2020/03/16
- [PULL 59/61] hw/ppc/ppc405: Use memory_region_init_rom() with read-only regions, Paolo Bonzini, 2020/03/16
- [PULL 61/61] hw/arm: Let devices own the MemoryRegion they create, Paolo Bonzini, 2020/03/16