mbox series

[v3,00/25] hw: Sanitize various MemoryRegion calls

Message ID 20200316185006.576-1-philmd@redhat.com
Headers show
Series hw: Sanitize various MemoryRegion calls | expand

Message

Philippe Mathieu-Daudé March 16, 2020, 6:49 p.m. UTC
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/qemu-devel@nongnu.org/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

Comments

Aleksandar Markovic March 16, 2020, 7:50 p.m. UTC | #1
On Mon, Mar 16, 2020 at 8:15 PM Philippe Mathieu-Daudé
<philmd@redhat.com> wrote:
>
> 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.
>

FWIW, for the whole series:

Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>

> v1 was 'Let devices own the MemoryRegion they create':
> https://www.mail-archive.com/qemu-devel@nongnu.org/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
>
> --
> 2.21.1
>
>