@samitouri / QOSamiQemu / commits / 2fc064e23e

qapi: cxl: Refactor CXL event injection for common commands arguments

Refactor CXL event injection to use struct for common command arguments. Suggested-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Shiju Jose <shiju.jose@huawei.com> Acked-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Ravi Jonnalagadda <ravis.opensrc@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Message-Id: <20260205112350.60681-2-Jonathan.Cameron@huawei.com>

Shiju Jose committed Feb 5, 2026 at 11:23 UTC 2fc064e23ecb1e83c26c7146aaa71ca5adec573e
1 file changed +58 -31
qapi/cxl.json
+58 -31
@@ -31,11 +31,10 @@
31 }
32
33 ##
34 -# @cxl-inject-general-media-event:
34 +# @CXLCommonEventBase:
35 #
36 -# Inject an event record for a General Media Event (CXL r3.0
37 -# 8.2.9.2.1.1). This event type is reported via one of the event logs
38 -# specified via the log parameter.
36 +# Common event base for a CXL Event (CXL r3.0 8.2.9.2.1
37 +# Table 8-42 Common Event Record Format).
38 #
39 # @path: CXL type 3 device canonical QOM path
40 #
@@ -44,6 +43,16 @@
43 # @flags: Event Record Flags. See CXL r3.0 Table 8-42 Common Event
44 # Record Format, Event Record Flags for subfield definitions.
45 #
46 +# Since: 8.1
47 +##
48 +{ 'struct': 'CXLCommonEventBase',
49 + 'data': { 'path': 'str', 'log': 'CxlEventLog', 'flags': 'uint8' } }
50 +
51 +##
52 +# @CXLGeneralMediaEvent:
53 +#
54 +# Event record for a General Media Event (CXL r3.0 8.2.9.2.1.1).
55 +#
56 # @dpa: Device Physical Address (relative to @path device). Note
57 # lower bits include some flags. See CXL r3.0 Table 8-43 General
58 # Media Event Record, Physical Address.
@@ -74,26 +83,29 @@
83 #
84 # Since: 8.1
85 ##
77 -{ 'command': 'cxl-inject-general-media-event',
78 - 'data': { 'path': 'str', 'log': 'CxlEventLog', 'flags': 'uint8',
79 - 'dpa': 'uint64', 'descriptor': 'uint8',
86 +{ 'struct': 'CXLGeneralMediaEvent',
87 + 'base': 'CXLCommonEventBase',
88 + 'data': { 'dpa': 'uint64', 'descriptor': 'uint8',
89 'type': 'uint8', 'transaction-type': 'uint8',
90 '*channel': 'uint8', '*rank': 'uint8',
91 '*device': 'uint32', '*component-id': 'str' } }
92
93 ##
85 -# @cxl-inject-dram-event:
86 -#
87 -# Inject an event record for a DRAM Event (CXL r3.0 8.2.9.2.1.2).
88 -# This event type is reported via one of the event logs specified via
89 -# the log parameter.
94 +# @cxl-inject-general-media-event:
95 #
91 -# @path: CXL type 3 device canonical QOM path
96 +# Inject an event record for a General Media Event (CXL r3.0
97 +# 8.2.9.2.1.1). This event type is reported via one of the event
98 +# logs specified via the log parameter.
99 #
93 -# @log: Event log to add the event to
100 +# Since: 8.1
101 +##
102 +{ 'command': 'cxl-inject-general-media-event',
103 + 'data': 'CXLGeneralMediaEvent' }
104 +
105 +##
106 +# @CXLDRAMEvent:
107 #
95 -# @flags: Event Record Flags. See CXL r3.0 Table 8-42 Common Event
96 -# Record Format, Event Record Flags for subfield definitions.
108 +# Event record for a DRAM Event (CXL r3.0 8.2.9.2.1.2).
109 #
110 # @dpa: Device Physical Address (relative to @path device). Note
111 # lower bits include some flags. See CXL r3.0 Table 8-44 DRAM
@@ -133,9 +145,9 @@
145 #
146 # Since: 8.1
147 ##
136 -{ 'command': 'cxl-inject-dram-event',
137 - 'data': { 'path': 'str', 'log': 'CxlEventLog', 'flags': 'uint8',
138 - 'dpa': 'uint64', 'descriptor': 'uint8',
148 +{ 'struct': 'CXLDRAMEvent',
149 + 'base': 'CXLCommonEventBase',
150 + 'data': { 'dpa': 'uint64', 'descriptor': 'uint8',
151 'type': 'uint8', 'transaction-type': 'uint8',
152 '*channel': 'uint8', '*rank': 'uint8', '*nibble-mask': 'uint32',
153 '*bank-group': 'uint8', '*bank': 'uint8', '*row': 'uint32',
@@ -143,18 +155,21 @@
155 }}
156
157 ##
146 -# @cxl-inject-memory-module-event:
147 -#
148 -# Inject an event record for a Memory Module Event (CXL r3.0
149 -# 8.2.9.2.1.3). This event includes a copy of the Device Health info
150 -# at the time of the event.
158 +# @cxl-inject-dram-event:
159 #
152 -# @path: CXL type 3 device canonical QOM path
160 +# Inject an event record for a DRAM Event (CXL r3.0 8.2.9.2.1.2).
161 +# This event type is reported via one of the event logs
162 +# specified via the log parameter.
163 #
154 -# @log: Event Log to add the event to
164 +# Since: 8.1
165 +##
166 +{ 'command': 'cxl-inject-dram-event',
167 + 'data': 'CXLDRAMEvent' }
168 +
169 +##
170 +# @CXLMemModuleEvent:
171 #
156 -# @flags: Event Record Flags. See CXL r3.0 Table 8-42 Common Event
157 -# Record Format, Event Record Flags for subfield definitions.
172 +# Event record for a Memory Module Event (CXL r3.0 8.2.9.2.1.3).
173 #
174 # @type: Device Event Type. See CXL r3.0 Table 8-45 Memory Module
175 # Event Record for bit definitions for bit definiions.
@@ -185,9 +200,9 @@
200 #
201 # Since: 8.1
202 ##
188 -{ 'command': 'cxl-inject-memory-module-event',
189 - 'data': { 'path': 'str', 'log': 'CxlEventLog', 'flags' : 'uint8',
190 - 'type': 'uint8', 'health-status': 'uint8',
203 +{ 'struct': 'CXLMemModuleEvent',
204 + 'base': 'CXLCommonEventBase',
205 + 'data': { 'type': 'uint8', 'health-status': 'uint8',
206 'media-status': 'uint8', 'additional-status': 'uint8',
207 'life-used': 'uint8', 'temperature' : 'int16',
208 'dirty-shutdown-count': 'uint32',
@@ -195,6 +210,18 @@
210 'corrected-persistent-error-count': 'uint32'
211 }}
212
213 +##
214 +# @cxl-inject-memory-module-event:
215 +#
216 +# Inject an event record for a Memory Module Event (CXL r3.0
217 +# 8.2.9.2.1.3). This event includes a copy of the Device Health info
218 +# at the time of the event.
219 +#
220 +# Since: 8.1
221 +##
222 +{ 'command': 'cxl-inject-memory-module-event',
223 + 'data': 'CXLMemModuleEvent' }
224 +
225 ##
226 # @cxl-inject-poison:
227 #