[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 5/7] hw/display: Let devices own the MemoryRegion they create
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 5/7] hw/display: Let devices own the MemoryRegion they create |
Date: |
Fri, 21 Feb 2020 18:30:47 +0100 |
To avoid orphean memory regions being added in the /unattached
QOM container, use the memory_region_owner_nonnull.cocci script
to set the correct ownership.
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
hw/display/cg3.c | 4 ++--
hw/display/g364fb.c | 5 +++--
hw/display/macfb.c | 4 ++--
hw/display/vmware_vga.c | 4 ++--
4 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/hw/display/cg3.c b/hw/display/cg3.c
index 4fb67c6b1c..db2e291d16 100644
--- a/hw/display/cg3.c
+++ b/hw/display/cg3.c
@@ -315,8 +315,8 @@ static void cg3_realizefn(DeviceState *dev, Error **errp)
}
}
- memory_region_init_ram(&s->vram_mem, NULL, "cg3.vram", s->vram_size,
- &error_fatal);
+ memory_region_init_ram(&s->vram_mem, OBJECT(dev), "cg3.vram",
+ s->vram_size, &error_fatal);
memory_region_set_log(&s->vram_mem, true, DIRTY_MEMORY_VGA);
sysbus_init_mmio(sbd, &s->vram_mem);
diff --git a/hw/display/g364fb.c b/hw/display/g364fb.c
index 55185c95c6..28785cceda 100644
--- a/hw/display/g364fb.c
+++ b/hw/display/g364fb.c
@@ -477,8 +477,9 @@ static void g364fb_init(DeviceState *dev, G364State *s)
s->con = graphic_console_init(dev, 0, &g364fb_ops, s);
- memory_region_init_io(&s->mem_ctrl, NULL, &g364fb_ctrl_ops, s, "ctrl",
0x180000);
- memory_region_init_ram_ptr(&s->mem_vram, NULL, "vram",
+ memory_region_init_io(&s->mem_ctrl, OBJECT(dev), &g364fb_ctrl_ops, s,
+ "ctrl", 0x180000);
+ memory_region_init_ram_ptr(&s->mem_vram, OBJECT(dev), "vram",
s->vram_size, s->vram);
vmstate_register_ram(&s->mem_vram, dev);
memory_region_set_log(&s->mem_vram, true, DIRTY_MEMORY_VGA);
diff --git a/hw/display/macfb.c b/hw/display/macfb.c
index 8bff16d535..b68faff4bb 100644
--- a/hw/display/macfb.c
+++ b/hw/display/macfb.c
@@ -362,8 +362,8 @@ static void macfb_common_realize(DeviceState *dev,
MacfbState *s, Error **errp)
return;
}
- memory_region_init_io(&s->mem_ctrl, NULL, &macfb_ctrl_ops, s, "macfb-ctrl",
- 0x1000);
+ memory_region_init_io(&s->mem_ctrl, OBJECT(dev), &macfb_ctrl_ops, s,
+ "macfb-ctrl", 0x1000);
memory_region_init_ram_nomigrate(&s->mem_vram, OBJECT(s), "macfb-vram",
MACFB_VRAM_SIZE, errp);
diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c
index 58ea82e3e5..79574e3c46 100644
--- a/hw/display/vmware_vga.c
+++ b/hw/display/vmware_vga.c
@@ -1238,8 +1238,8 @@ static void vmsvga_init(DeviceState *dev, struct
vmsvga_state_s *s,
s->vga.con = graphic_console_init(dev, 0, &vmsvga_ops, s);
s->fifo_size = SVGA_FIFO_SIZE;
- memory_region_init_ram(&s->fifo_ram, NULL, "vmsvga.fifo", s->fifo_size,
- &error_fatal);
+ memory_region_init_ram(&s->fifo_ram, OBJECT(dev), "vmsvga.fifo",
+ s->fifo_size, &error_fatal);
s->fifo_ptr = memory_region_get_ram_ptr(&s->fifo_ram);
vga_common_init(&s->vga, OBJECT(dev));
--
2.21.1
- [PATCH 0/7] hw: Let devices own the MemoryRegion they create, Philippe Mathieu-Daudé, 2020/02/21
- [PATCH 1/7] scripts/coccinelle: Add a script to let devices own their MemoryRegions, Philippe Mathieu-Daudé, 2020/02/21
- [PATCH 3/7] hw/char: Let devices own the MemoryRegion they create, Philippe Mathieu-Daudé, 2020/02/21
- [PATCH 2/7] hw/arm: Let devices own the MemoryRegion they create, Philippe Mathieu-Daudé, 2020/02/21
- [PATCH 4/7] hw/core: Let devices own the MemoryRegion they create, Philippe Mathieu-Daudé, 2020/02/21
- [PATCH 5/7] hw/display: Let devices own the MemoryRegion they create,
Philippe Mathieu-Daudé <=
- [PATCH 7/7] hw/riscv: Let devices own the MemoryRegion they create, Philippe Mathieu-Daudé, 2020/02/21
- [PATCH 6/7] hw/dma: Let devices own the MemoryRegion they create, Philippe Mathieu-Daudé, 2020/02/21