[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v5 14/18] qapi/qdev.json: unite DEVICE_* event data into single s
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[PATCH v5 14/18] qapi/qdev.json: unite DEVICE_* event data into single structure |
Date: |
Thu, 16 Feb 2023 21:03:52 +0300 |
DEVICE_DELETED and DEVICE_UNPLUG_GUEST_ERROR has equal data, let's
refactor it to one structure. That also helps to add new events
consistently.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
---
qapi/qdev.json | 39 +++++++++++++++++++++++++++------------
1 file changed, 27 insertions(+), 12 deletions(-)
diff --git a/qapi/qdev.json b/qapi/qdev.json
index 2708fb4e99..135cd81586 100644
--- a/qapi/qdev.json
+++ b/qapi/qdev.json
@@ -114,16 +114,37 @@
{ 'command': 'device_del', 'data': {'id': 'str'} }
##
-# @DEVICE_DELETED:
+# @DeviceAndPath:
#
-# Emitted whenever the device removal completion is acknowledged by the guest.
-# At this point, it's safe to reuse the specified device ID. Device removal can
-# be initiated by the guest or by HMP/QMP commands.
+# In events we designate devices by both their ID (if the device has one)
+# and QOM path.
+#
+# Why we need ID? User specify ID in device_add command and in command line
+# and expects same identifier in the event data.
+#
+# Why we need QOM path? Some devices don't have ID and we still want to emit
+# events for them.
+#
+# So, we have a bit of redundancy, as QOM path for device that has ID is
+# always /machine/peripheral/ID. But that's hard to change keeping both
+# simple interface for most users and universality for the generic case.
#
# @device: the device's ID if it has one
#
# @path: the device's QOM path
#
+# Since: 8.0
+##
+{ 'struct': 'DeviceAndPath',
+ 'data': { '*device': 'str', 'path': 'str' } }
+
+##
+# @DEVICE_DELETED:
+#
+# Emitted whenever the device removal completion is acknowledged by the guest.
+# At this point, it's safe to reuse the specified device ID. Device removal can
+# be initiated by the guest or by HMP/QMP commands.
+#
# Since: 1.5
#
# Example:
@@ -134,18 +155,13 @@
# "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
#
##
-{ 'event': 'DEVICE_DELETED',
- 'data': { '*device': 'str', 'path': 'str' } }
+{ 'event': 'DEVICE_DELETED', 'data': 'DeviceAndPath' }
##
# @DEVICE_UNPLUG_GUEST_ERROR:
#
# Emitted when a device hot unplug fails due to a guest reported error.
#
-# @device: the device's ID if it has one
-#
-# @path: the device's QOM path
-#
# Since: 6.2
#
# Example:
@@ -156,5 +172,4 @@
# "timestamp": { "seconds": 1615570772, "microseconds": 202844 } }
#
##
-{ 'event': 'DEVICE_UNPLUG_GUEST_ERROR',
- 'data': { '*device': 'str', 'path': 'str' } }
+{ 'event': 'DEVICE_UNPLUG_GUEST_ERROR', 'data': 'DeviceAndPath' }
--
2.34.1
- [PATCH v5 04/18] pci/shpc: more generic handle hot-unplug in shpc_slot_command(), (continued)
- [PATCH v5 04/18] pci/shpc: more generic handle hot-unplug in shpc_slot_command(), Vladimir Sementsov-Ogievskiy, 2023/02/16
- [PATCH v5 03/18] pci/shpc: shpc_slot_command(): handle PWRONLY -> ENABLED transition, Vladimir Sementsov-Ogievskiy, 2023/02/16
- [PATCH v5 05/18] pci/shpc: pass PCIDevice pointer to shpc_slot_command(), Vladimir Sementsov-Ogievskiy, 2023/02/16
- [PATCH v5 07/18] pcie: pcie_cap_slot_write_config(): use correct macro, Vladimir Sementsov-Ogievskiy, 2023/02/16
- [PATCH v5 09/18] pcie: drop unused PCIExpressIndicator, Vladimir Sementsov-Ogievskiy, 2023/02/16
- [PATCH v5 11/18] pcie: introduce pcie_sltctl_powered_off() helper, Vladimir Sementsov-Ogievskiy, 2023/02/16
- [PATCH v5 08/18] pcie_regs: drop duplicated indicator value macros, Vladimir Sementsov-Ogievskiy, 2023/02/16
- [PATCH v5 10/18] pcie: pcie_cap_slot_enable_power() use correct helper, Vladimir Sementsov-Ogievskiy, 2023/02/16
- [PATCH v5 12/18] pcie: set power indicator to off on reset by default, Vladimir Sementsov-Ogievskiy, 2023/02/16
- [PATCH v5 13/18] pci: introduce pci_find_the_only_child(), Vladimir Sementsov-Ogievskiy, 2023/02/16
- [PATCH v5 14/18] qapi/qdev.json: unite DEVICE_* event data into single structure,
Vladimir Sementsov-Ogievskiy <=
- [PATCH v5 15/18] qapi: add HOTPLUG_STATE infrastructure, Vladimir Sementsov-Ogievskiy, 2023/02/16
- [PATCH v5 16/18] shpc: implement HOTPLUG_STATE event and query-hotplug, Vladimir Sementsov-Ogievskiy, 2023/02/16
- [PATCH v5 17/18] pcie: implement HOTPLUG_STATE event and query-hotplug, Vladimir Sementsov-Ogievskiy, 2023/02/16
- [PATCH v5 18/18] qapi: introduce DEVICE_ON event, Vladimir Sementsov-Ogievskiy, 2023/02/16