Skip to contentSkip to conversation

hw/i386/pc: Add a proper owner for the ioport memory regions

PATCH Applied Thomas Huth 3 participants 4 messages Feb 17 – May 27

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/i386/pc: Add a proper owner for the ioport memory regions

From: Thomas Huth <[email protected]>

Without a proper owner, the memory regions show up in /machine/unattached in the QOM tree, which is something that should be avoided.

---
 hw/i386/pc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
hw/i386/pc.c +4 -2
index 0dd3fd01d98..ee72dd47590 100644
@@ -1127,10 +1127,12 @@ void pc_basic_device_init(struct PCMachineState *pcms,
     MemoryRegion *ioportF0_io = g_new(MemoryRegion, 1);
     X86MachineState *x86ms = X86_MACHINE(pcms);
 
-    memory_region_init_io(ioport80_io, NULL, &ioport80_io_ops, NULL, "ioport80", 1);
+    memory_region_init_io(ioport80_io, OBJECT(pcms), &ioport80_io_ops, NULL,
+                          "ioport80", 1);
     memory_region_add_subregion(isa_bus->address_space_io, 0x80, ioport80_io);
 
-    memory_region_init_io(ioportF0_io, NULL, &ioportF0_io_ops, NULL, "ioportF0", 1);
+    memory_region_init_io(ioportF0_io, OBJECT(pcms), &ioportF0_io_ops, NULL,
+                          "ioportF0", 1);
     memory_region_add_subregion(isa_bus->address_space_io, 0xf0, ioportF0_io);
 
     /*
Signature · 1 line
2.53.0
#1 lore raw
Quoted 4 lines · Thomas Huth

From: Thomas Huth <[email protected]>

Without a proper owner, the memory regions show up in /machine/unattached in the QOM tree, which is something that should be avoided.

Does this break migration from/to older releases?

Thanks,

/mjt

Quoted 24 lines
---
  hw/i386/pc.c | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)
hw/i386/pc.c +4 -2
index 0dd3fd01d98..ee72dd47590 100644
@@ -1127,10 +1127,12 @@ void pc_basic_device_init(struct PCMachineState *pcms,
      MemoryRegion *ioportF0_io = g_new(MemoryRegion, 1);
      X86MachineState *x86ms = X86_MACHINE(pcms);
 
-    memory_region_init_io(ioport80_io, NULL, &ioport80_io_ops, NULL, "ioport80", 1);
+    memory_region_init_io(ioport80_io, OBJECT(pcms), &ioport80_io_ops, NULL,
+                          "ioport80", 1);
      memory_region_add_subregion(isa_bus->address_space_io, 0x80, ioport80_io);
 
-    memory_region_init_io(ioportF0_io, NULL, &ioportF0_io_ops, NULL, "ioportF0", 1);
+    memory_region_init_io(ioportF0_io, OBJECT(pcms), &ioportF0_io_ops, NULL,
+                          "ioportF0", 1);
      memory_region_add_subregion(isa_bus->address_space_io, 0xf0, ioportF0_io);
 
      /*
#2 lore raw
Quoted 7 lines · Michael Tokarev
Quoted 4 lines · Thomas Huth

From: Thomas Huth <[email protected]>

Without a proper owner, the memory regions show up in /machine/unattached in the QOM tree, which is something that should be avoided.

Does this break migration from/to older releases?

AFAIK the QOM tree ordering is orthogonal to the migration logic ... or did we ever have any problems with this in the past?

Thomas

#3 lore raw
In reply to Thomas Huth
Quoted 6 lines · Thomas Huth

From: Thomas Huth <[email protected]>

Without a proper owner, the memory regions show up in /machine/unattached in the QOM tree, which is something that should be avoided.

queued, thanks!

Quoted 25 lines
---
 hw/i386/pc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
hw/i386/pc.c +4 -2
index 0dd3fd01d98..ee72dd47590 100644
@@ -1127,10 +1127,12 @@ void pc_basic_device_init(struct PCMachineState *pcms,
     MemoryRegion *ioportF0_io = g_new(MemoryRegion, 1);
     X86MachineState *x86ms = X86_MACHINE(pcms);
 
-    memory_region_init_io(ioport80_io, NULL, &ioport80_io_ops, NULL, "ioport80", 1);
+    memory_region_init_io(ioport80_io, OBJECT(pcms), &ioport80_io_ops, NULL,
+                          "ioport80", 1);
     memory_region_add_subregion(isa_bus->address_space_io, 0x80, ioport80_io);
 
-    memory_region_init_io(ioportF0_io, NULL, &ioportF0_io_ops, NULL, "ioportF0", 1);
+    memory_region_init_io(ioportF0_io, OBJECT(pcms), &ioportF0_io_ops, NULL,
+                          "ioportF0", 1);
     memory_region_add_subregion(isa_bus->address_space_io, 0xf0, ioportF0_io);
 
     /*
Signature · 1 line
2.53.0