Skip to content

Commit d89dd28

Browse files
davidhildenbrandbonzini
authored andcommitted
qapi: Include qom-path in MEMORY_DEVICE_SIZE_CHANGE qapi events
As we might not always have a device id, it is impossible to always match MEMORY_DEVICE_SIZE_CHANGE events to an actual device. Let's include the qom-path in the event, which allows for reliable mapping of events to devices. Fixes: 722a3c7 ("virtio-pci: Send qapi events when the virtio-mem size changes") Suggested-by: Markus Armbruster <[email protected]> Reviewed-by: Markus Armbruster <[email protected]> Signed-off-by: David Hildenbrand <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 75b98cb commit d89dd28

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

hw/virtio/virtio-mem-pci.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,12 @@ static void virtio_mem_pci_size_change_notify(Notifier *notifier, void *data)
8787
VirtIOMEMPCI *pci_mem = container_of(notifier, VirtIOMEMPCI,
8888
size_change_notifier);
8989
DeviceState *dev = DEVICE(pci_mem);
90+
char *qom_path = object_get_canonical_path(OBJECT(dev));
9091
const uint64_t * const size_p = data;
9192

92-
qapi_event_send_memory_device_size_change(!!dev->id, dev->id, *size_p);
93+
qapi_event_send_memory_device_size_change(!!dev->id, dev->id, *size_p,
94+
qom_path);
95+
g_free(qom_path);
9396
}
9497

9598
static void virtio_mem_pci_class_init(ObjectClass *klass, void *data)

qapi/machine.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1336,8 +1336,11 @@
13361336
# action).
13371337
#
13381338
# @id: device's ID
1339+
#
13391340
# @size: the new size of memory that the device provides
13401341
#
1342+
# @qom-path: path to the device object in the QOM tree (since 6.2)
1343+
#
13411344
# Note: this event is rate-limited.
13421345
#
13431346
# Since: 5.1
@@ -1350,7 +1353,7 @@
13501353
#
13511354
##
13521355
{ 'event': 'MEMORY_DEVICE_SIZE_CHANGE',
1353-
'data': { '*id': 'str', 'size': 'size' } }
1356+
'data': { '*id': 'str', 'size': 'size', 'qom-path' : 'str'} }
13541357

13551358

13561359
##

0 commit comments

Comments
 (0)