scripts/cocci: Patch to let devices own their MemoryRegions
authorPhilippe Mathieu-Daudé <philmd@redhat.com>
Fri, 21 Feb 2020 15:05:08 +0000 (16:05 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 17 Mar 2020 14:18:48 +0000 (15:18 +0100)
commit84969111e656eb594ac123a23aa120ff5e157ee4
treecfb49f8cd74f03722fc72117d76a76ac386d3d81
parentbb2f4e8d77c4b39ffc04614e0bbd71b3b3c3b340
scripts/cocci: Patch to let devices own their MemoryRegions

When a device creates a MemoryRegion without setting its ownership,
the MemoryRegion is added to the machine "/unattached" container in
the QOM tree.

Example with the Samsung SMDKC210 board:

  $ arm-softmmu/qemu-system-arm -M smdkc210 -S -monitor stdio
  (qemu) info qom-tree
  /machine (smdkc210-machine)
    /unattached (container)
      /io[0] (qemu:memory-region)
      /exynos4210.dram0[0] (qemu:memory-region)
      /exynos4210.irom[0] (qemu:memory-region)
      /exynos4210.iram[0] (qemu:memory-region)
      /exynos4210.chipid[0] (qemu:memory-region)
      ...
      /device[26] (exynos4210.uart)
        /exynos4210.uart[0] (qemu:memory-region)
    /soc (exynos4210)
      ^
       \__ [*]

The irom/iram/chipid regions should go under 'soc' at [*].

Add a semantic patch to let the device own the memory region.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
scripts/coccinelle/memory-region-housekeeping.cocci