qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

hw/display: Let devices own the MemoryRegion they create

Avoid orphan memory regions being added in the /unattached QOM
container.

This commit was produced with the Coccinelle script
scripts/coccinelle/memory-region-housekeeping.cocci.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>

authored by

Philippe Mathieu-Daudé and committed by
Paolo Bonzini
b9fc4f6e de95af99

+4 -3
+2 -1
hw/display/g364fb.c
··· 477 477 478 478 s->con = graphic_console_init(dev, 0, &g364fb_ops, s); 479 479 480 - memory_region_init_io(&s->mem_ctrl, NULL, &g364fb_ctrl_ops, s, "ctrl", 0x180000); 480 + memory_region_init_io(&s->mem_ctrl, OBJECT(dev), &g364fb_ctrl_ops, s, 481 + "ctrl", 0x180000); 481 482 memory_region_init_ram_ptr(&s->mem_vram, NULL, "vram", 482 483 s->vram_size, s->vram); 483 484 vmstate_register_ram(&s->mem_vram, dev);
+2 -2
hw/display/macfb.c
··· 362 362 return; 363 363 } 364 364 365 - memory_region_init_io(&s->mem_ctrl, NULL, &macfb_ctrl_ops, s, "macfb-ctrl", 366 - 0x1000); 365 + memory_region_init_io(&s->mem_ctrl, OBJECT(dev), &macfb_ctrl_ops, s, 366 + "macfb-ctrl", 0x1000); 367 367 368 368 memory_region_init_ram_nomigrate(&s->mem_vram, OBJECT(s), "macfb-vram", 369 369 MACFB_VRAM_SIZE, errp);