@samitouri / QOSamiQemu / commits / 653f3b5a15

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

Without a proper owner, the memory regions show up in /machine/unattached in the QOM tree, which is something that should be avoided. Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Message-Id: <20260217141827.534426-1-thuth@redhat.com>

Thomas Huth committed Feb 17, 2026 at 15:18 UTC 653f3b5a15bbc3db564639f7ee50c547f61a002c
1 file changed +4 -2
hw/i386/pc.c
+4 -2
@@ -1051,10 +1051,12 @@ void pc_basic_device_init(struct PCMachineState *pcms,
1051 MemoryRegion *ioportF0_io = g_new(MemoryRegion, 1);
1052 X86MachineState *x86ms = X86_MACHINE(pcms);
1053
1054 - memory_region_init_io(ioport80_io, NULL, &ioport80_io_ops, NULL, "ioport80", 1);
1054 + memory_region_init_io(ioport80_io, OBJECT(pcms), &ioport80_io_ops, NULL,
1055 + "ioport80", 1);
1056 memory_region_add_subregion(isa_bus->address_space_io, 0x80, ioport80_io);
1057
1057 - memory_region_init_io(ioportF0_io, NULL, &ioportF0_io_ops, NULL, "ioportF0", 1);
1058 + memory_region_init_io(ioportF0_io, OBJECT(pcms), &ioportF0_io_ops, NULL,
1059 + "ioportF0", 1);
1060 memory_region_add_subregion(isa_bus->address_space_io, 0xf0, ioportF0_io);
1061
1062 /*