Skip to content

hw: Sanitize various MemoryRegion calls

Philippe Mathieu-Daudé qemu-arm qemu-devel qemu-riscv 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest25 patches 2 repliesIn review
  2. v2 posting 2/232 patches 8 repliesSuperseded
  3. v2 posting 1/28 of 32 patches 4 repliesSuperseded

Changes in v3 from the cover letter

- only keep generated/automatic patches
- add reviewers tags

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/25memory: Correctly return alias region typememory.c+3 -00 replies
2/25memory: Simplify memory_region_init_rom_nomigrate() to ease reviewmemory.c+1 -120 replies
3/25scripts/cocci: Rename memory-region-{init-ram -> housekeeping}MAINTAINERS scripts/coccinelle/memory-region-housekeeping.cocci+14 -00 replies
4/25scripts/cocci: Patch to replace memory_region_init_{ram, readonly -> rom}scripts/coccinelle/memory-region-housekeeping.cocci+18 -00 replies
5/25hw/arm: Use memory_region_init_rom() with read-only regionshw/arm/exynos4210.c hw/arm/mainstone.c hw/arm/omap_sx1.c +4 more+8 -160 replies
6/25hw/display: Use memory_region_init_rom() with read-only regionshw/display/cg3.c hw/display/tcx.c+4 -60 replies
7/25hw/m68k: Use memory_region_init_rom() with read-only regionshw/m68k/q800.c+1 -20 replies
8/25hw/net: Use memory_region_init_rom() with read-only regionshw/net/dp8393x.c+2 -30 replies
9/25hw/pci-host: Use memory_region_init_rom() with read-only regionshw/pci-host/prep.c+2 -30 replies
10/25hw/ppc: Use memory_region_init_rom() with read-only regionshw/ppc/mac_newworld.c hw/ppc/mac_oldworld.c+2 -40 replies
11/25hw/riscv: Use memory_region_init_rom() with read-only regionshw/riscv/sifive_e.c+2 -30 replies
12/25hw/sh4: Use memory_region_init_rom() with read-only regionshw/sh4/shix.c+1 -20 replies
13/25hw/sparc: Use memory_region_init_rom() with read-only regionshw/sparc/leon3.c+1 -20 replies
14/25scripts/cocci: Patch to detect potential use of memory_region_init_romscripts/coccinelle/memory-region-housekeeping.cocci+19 -00 replies
15/25scripts/cocci: Patch to remove unnecessary memory_region_set_readonly()scripts/coccinelle/memory-region-housekeeping.cocci+15 -00 replies
16/25scripts/cocci: Patch to let devices own their MemoryRegionsscripts/coccinelle/memory-region-housekeeping.cocci+56 -00 replies
17/25hw/core: Let devices own the MemoryRegion they createhw/core/platform-bus.c+2 -10 replies
18/25hw/display: Let devices own the MemoryRegion they createhw/display/g364fb.c hw/display/macfb.c+4 -30 replies
19/25hw/dma: Let devices own the MemoryRegion they createhw/dma/i8257.c hw/dma/rc4030.c+3 -30 replies
20/25hw/riscv: Let devices own the MemoryRegion they createhw/riscv/sifive_e.c hw/riscv/sifive_u.c+4 -41 reply
21/25hw/char: Let devices own the MemoryRegion they createhw/char/serial.c+4 -30 replies
22/25hw/arm/stm32: Use memory_region_init_rom() with read-only regionshw/arm/stm32f205_soc.c hw/arm/stm32f405_soc.c+2 -60 replies
23/25hw/ppc/ppc405: Use memory_region_init_rom() with read-only regionshw/ppc/ppc405_boards.c+2 -40 replies
24/25hw/arm: Remove unnecessary memory_region_set_readonly() on ROM aliashw/arm/exynos4210.c hw/arm/stm32f205_soc.c hw/arm/stm32f405_soc.c+0 -30 replies
25/25hw/arm: Let devices own the MemoryRegion they createhw/arm/exynos4210.c hw/arm/fsl-imx25.c hw/arm/fsl-imx31.c +7 more+40 -390 replies

Reviews trailers per patch

6 of 25 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchDavid GibsonAlistair FrancisKONRAD FredericAleksandar Markovic
SeriesR-b
1/25
2/25R-b
3/25
4/25
5/25
6/25
7/25
8/25
9/25A-b
10/25A-b
11/25
12/25
13/25R-b
14/25
15/25
16/25
17/25
18/25
19/25
20/25R-b
21/25
22/25
23/25A-b
24/25
25/25

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v3 thread

Cover letter [PATCH v3 00/25] hw: Sanitize various MemoryRegion calls

This series simplifies various memory API calls when creating memory regions.

Most of the patches are generated with Coccinelle semantic patches (provided).
Few more cleanups added while writting the patches have been added.

v1 was 'Let devices own the MemoryRegion they create':
https://www.mail-archive.com/[email protected]/msg681960.html

Since v2:
- only keep generated/automatic patches
- add reviewers tags

Since v1:
- understood a bit more Peter Maydell comments regarding how memory devices are migrated.

Philippe Mathieu-Daudé (25):
memory: Correctly return alias region type
memory: Simplify memory_region_init_rom_nomigrate() to ease review scripts/cocci: Rename memory-region-{init-ram -> housekeeping} scripts/cocci: Patch to replace memory_region_init_{ram,readonly ->

    rom}

hw/arm: Use memory_region_init_rom() with read-only regions hw/display: Use memory_region_init_rom() with read-only regions hw/m68k: Use memory_region_init_rom() with read-only regions hw/net: Use memory_region_init_rom() with read-only regions hw/pci-host: Use memory_region_init_rom() with read-only regions hw/ppc: Use memory_region_init_rom() with read-only regions hw/riscv: Use memory_region_init_rom() with read-only regions hw/sh4: Use memory_region_init_rom() with read-only regions hw/sparc: Use memory_region_init_rom() with read-only regions scripts/cocci: Patch to detect potential use of memory_region_init_rom scripts/cocci: Patch to remove unnecessary
memory_region_set_readonly()
scripts/cocci: Patch to let devices own their MemoryRegions hw/core: Let devices own the MemoryRegion they create hw/display: Let devices own the MemoryRegion they create hw/dma: Let devices own the MemoryRegion they create hw/riscv: Let devices own the MemoryRegion they create hw/char: Let devices own the MemoryRegion they create hw/arm/stm32: Use memory_region_init_rom() with read-only regions hw/ppc/ppc405: Use memory_region_init_rom() with read-only regions hw/arm: Remove unnecessary memory_region_set_readonly() on ROM alias hw/arm: Let devices own the MemoryRegion they create

 .../memory-region-housekeeping.cocci          | 159 ++++++++++++++++++
 .../coccinelle/memory-region-init-ram.cocci   |  38 -----
 hw/arm/exynos4210.c                           |  14 +-
 hw/arm/fsl-imx25.c                            |  10 +-
 hw/arm/fsl-imx31.c                            |   6 +-
 hw/arm/fsl-imx6.c                             |   6 +-
 hw/arm/fsl-imx6ul.c                           |   9 +-
 hw/arm/mainstone.c                            |   3 +-
 hw/arm/msf2-soc.c                             |   6 +-
 hw/arm/nrf51_soc.c                            |   2 +-
 hw/arm/omap_sx1.c                             |   6 +-
 hw/arm/palm.c                                 |   3 +-
 hw/arm/spitz.c                                |   3 +-
 hw/arm/stellaris.c                            |   3 +-
 hw/arm/stm32f205_soc.c                        |  11 +-
 hw/arm/stm32f405_soc.c                        |  12 +-
 hw/arm/tosa.c                                 |   3 +-
 hw/arm/xlnx-zynqmp.c                          |  11 +-
 hw/char/serial.c                              |   7 +-
 hw/core/platform-bus.c                        |   3 +-
 hw/display/cg3.c                              |   5 +-
 hw/display/g364fb.c                           |   3 +-
 hw/display/macfb.c                            |   4 +-
 hw/display/tcx.c                              |   5 +-
 hw/dma/i8257.c                                |   2 +-
 hw/dma/rc4030.c                               |   4 +-
 hw/m68k/q800.c                                |   3 +-
 hw/net/dp8393x.c                              |   5 +-
 hw/pci-host/prep.c                            |   5 +-
 hw/ppc/mac_newworld.c                         |   3 +-
 hw/ppc/mac_oldworld.c                         |   3 +-
 hw/ppc/ppc405_boards.c                        |   6 +-
 hw/riscv/sifive_e.c                           |   9 +-
 hw/riscv/sifive_u.c                           |   2 +-
 hw/sh4/shix.c                                 |   3 +-
 hw/sparc/leon3.c                              |   3 +-
 memory.c                                      |  16 +-
 MAINTAINERS                                   |   1 +
 38 files changed, 244 insertions(+), 153 deletions(-)
 create mode 100644 scripts/coccinelle/memory-region-housekeeping.cocci
 delete mode 100644 scripts/coccinelle/memory-region-init-ram.cocci
Signature · 1 line
2.21.1