xref: /openbmc/qemu/qapi/cxl.json (revision cad9aa6fbdccd95e56e10cfa57c354a20a333717)
1# -*- Mode: Python -*-
2# vim: filetype=python
3
4##
5# ***********
6# CXL devices
7# ***********
8##
9
10##
11# @CxlEventLog:
12#
13# CXL has a number of separate event logs for different types of
14# events.  Each such event log is handled and signaled independently.
15#
16# @informational: Information Event Log
17#
18# @warning: Warning Event Log
19#
20# @failure: Failure Event Log
21#
22# @fatal: Fatal Event Log
23#
24# Since: 8.1
25##
26{ 'enum': 'CxlEventLog',
27  'data': ['informational',
28           'warning',
29           'failure',
30           'fatal']
31 }
32
33##
34# @cxl-inject-general-media-event:
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.
39#
40# @path: CXL type 3 device canonical QOM path
41#
42# @log: event log to add the event to
43#
44# @flags: Event Record Flags.  See CXL r3.0 Table 8-42 Common Event
45#     Record Format, Event Record Flags for subfield definitions.
46#
47# @dpa: Device Physical Address (relative to @path device).  Note
48#     lower bits include some flags.  See CXL r3.0 Table 8-43 General
49#     Media Event Record, Physical Address.
50#
51# @descriptor: Memory Event Descriptor with additional memory event
52#     information.  See CXL r3.0 Table 8-43 General Media Event
53#     Record, Memory Event Descriptor for bit definitions.
54#
55# @type: Type of memory event that occurred.  See CXL r3.0 Table 8-43
56#     General Media Event Record, Memory Event Type for possible
57#     values.
58#
59# @transaction-type: Type of first transaction that caused the event
60#     to occur.  See CXL r3.0 Table 8-43 General Media Event Record,
61#     Transaction Type for possible values.
62#
63# @channel: The channel of the memory event location.  A channel is an
64#     interface that can be independently accessed for a transaction.
65#
66# @rank: The rank of the memory event location.  A rank is a set of
67#     memory devices on a channel that together execute a transaction.
68#
69# @device: Bitmask that represents all devices in the rank associated
70#     with the memory event location.
71#
72# @component-id: Device specific component identifier for the event.
73#     May describe a field replaceable sub-component of the device.
74#
75# Since: 8.1
76##
77{ 'command': 'cxl-inject-general-media-event',
78  'data': { 'path': 'str', 'log': 'CxlEventLog', 'flags': 'uint8',
79            'dpa': 'uint64', 'descriptor': 'uint8',
80            'type': 'uint8', 'transaction-type': 'uint8',
81            '*channel': 'uint8', '*rank': 'uint8',
82            '*device': 'uint32', '*component-id': 'str' } }
83
84##
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.
90#
91# @path: CXL type 3 device canonical QOM path
92#
93# @log: Event log to add the event to
94#
95# @flags: Event Record Flags.  See CXL r3.0 Table 8-42 Common Event
96#     Record Format, Event Record Flags for subfield definitions.
97#
98# @dpa: Device Physical Address (relative to @path device).  Note
99#     lower bits include some flags.  See CXL r3.0 Table 8-44 DRAM
100#     Event Record, Physical Address.
101#
102# @descriptor: Memory Event Descriptor with additional memory event
103#     information.  See CXL r3.0 Table 8-44 DRAM Event Record, Memory
104#     Event Descriptor for bit definitions.
105#
106# @type: Type of memory event that occurred.  See CXL r3.0 Table 8-44
107#     DRAM Event Record, Memory Event Type for possible values.
108#
109# @transaction-type: Type of first transaction that caused the event
110#     to occur.  See CXL r3.0 Table 8-44 DRAM Event Record,
111#     Transaction Type for possible values.
112#
113# @channel: The channel of the memory event location.  A channel is an
114#     interface that can be independently accessed for a transaction.
115#
116# @rank: The rank of the memory event location.  A rank is a set of
117#     memory devices on a channel that together execute a transaction.
118#
119# @nibble-mask: Identifies one or more nibbles that the error affects
120#
121# @bank-group: Bank group of the memory event location, incorporating
122#     a number of banks.
123#
124# @bank: Bank of the memory event location.  A single bank is accessed
125#     per read or write of the memory.
126#
127# @row: Row address within the DRAM.
128#
129# @column: Column address within the DRAM.
130#
131# @correction-mask: Bits within each nibble.  Used in order of bits
132#     set in the nibble-mask.  Up to 4 nibbles may be covered.
133#
134# Since: 8.1
135##
136{ 'command': 'cxl-inject-dram-event',
137  'data': { 'path': 'str', 'log': 'CxlEventLog', 'flags': 'uint8',
138            'dpa': 'uint64', 'descriptor': 'uint8',
139            'type': 'uint8', 'transaction-type': 'uint8',
140            '*channel': 'uint8', '*rank': 'uint8', '*nibble-mask': 'uint32',
141            '*bank-group': 'uint8', '*bank': 'uint8', '*row': 'uint32',
142            '*column': 'uint16', '*correction-mask': [ 'uint64' ]
143           }}
144
145##
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.
151#
152# @path: CXL type 3 device canonical QOM path
153#
154# @log: Event Log to add the event to
155#
156# @flags: Event Record Flags.  See CXL r3.0 Table 8-42 Common Event
157#     Record Format, Event Record Flags for subfield definitions.
158#
159# @type: Device Event Type.  See CXL r3.0 Table 8-45 Memory Module
160#     Event Record for bit definitions for bit definiions.
161#
162# @health-status: Overall health summary bitmap.  See CXL r3.0 Table
163#     8-100 Get Health Info Output Payload, Health Status for bit
164#     definitions.
165#
166# @media-status: Overall media health summary.  See CXL r3.0 Table
167#     8-100 Get Health Info Output Payload, Media Status for bit
168#     definitions.
169#
170# @additional-status: See CXL r3.0 Table 8-100 Get Health Info Output
171#     Payload, Additional Status for subfield definitions.
172#
173# @life-used: Percentage (0-100) of factory expected life span.
174#
175# @temperature: Device temperature in degrees Celsius.
176#
177# @dirty-shutdown-count: Number of times the device has been unable to
178#     determine whether data loss may have occurred.
179#
180# @corrected-volatile-error-count: Total number of correctable errors
181#     in volatile memory.
182#
183# @corrected-persistent-error-count: Total number of correctable
184#     errors in persistent memory
185#
186# Since: 8.1
187##
188{ 'command': 'cxl-inject-memory-module-event',
189  'data': { 'path': 'str', 'log': 'CxlEventLog', 'flags' : 'uint8',
190            'type': 'uint8', 'health-status': 'uint8',
191            'media-status': 'uint8', 'additional-status': 'uint8',
192            'life-used': 'uint8', 'temperature' : 'int16',
193            'dirty-shutdown-count': 'uint32',
194            'corrected-volatile-error-count': 'uint32',
195            'corrected-persistent-error-count': 'uint32'
196            }}
197
198##
199# @cxl-inject-poison:
200#
201# Poison records indicate that a CXL memory device knows that a
202# particular memory region may be corrupted.  This may be because of
203# locally detected errors (e.g. ECC failure) or poisoned writes
204# received from other components in the system.  This injection
205# mechanism enables testing of the OS handling of poison records which
206# may be queried via the CXL mailbox.
207#
208# @path: CXL type 3 device canonical QOM path
209#
210# @start: Start address; must be 64 byte aligned.
211#
212# @length: Length of poison to inject; must be a multiple of 64 bytes.
213#
214# Since: 8.1
215##
216{ 'command': 'cxl-inject-poison',
217  'data': { 'path': 'str', 'start': 'uint64', 'length': 'size' }}
218
219##
220# @CxlUncorErrorType:
221#
222# Type of uncorrectable CXL error to inject.  These errors are
223# reported via an AER uncorrectable internal error with additional
224# information logged at the CXL device.
225#
226# @cache-data-parity: Data error such as data parity or data ECC error
227#     CXL.cache
228#
229# @cache-address-parity: Address parity or other errors associated
230#     with the address field on CXL.cache
231#
232# @cache-be-parity: Byte enable parity or other byte enable errors on
233#     CXL.cache
234#
235# @cache-data-ecc: ECC error on CXL.cache
236#
237# @mem-data-parity: Data error such as data parity or data ECC error
238#     on CXL.mem
239#
240# @mem-address-parity: Address parity or other errors associated with
241#     the address field on CXL.mem
242#
243# @mem-be-parity: Byte enable parity or other byte enable errors on
244#     CXL.mem.
245#
246# @mem-data-ecc: Data ECC error on CXL.mem.
247#
248# @reinit-threshold: REINIT threshold hit.
249#
250# @rsvd-encoding: Received unrecognized encoding.
251#
252# @poison-received: Received poison from the peer.
253#
254# @receiver-overflow: Buffer overflows (first 3 bits of header log
255#     indicate which)
256#
257# @internal: Component specific error
258#
259# @cxl-ide-tx: Integrity and data encryption tx error.
260#
261# @cxl-ide-rx: Integrity and data encryption rx error.
262#
263# Since: 8.0
264##
265
266{ 'enum': 'CxlUncorErrorType',
267  'data': ['cache-data-parity',
268           'cache-address-parity',
269           'cache-be-parity',
270           'cache-data-ecc',
271           'mem-data-parity',
272           'mem-address-parity',
273           'mem-be-parity',
274           'mem-data-ecc',
275           'reinit-threshold',
276           'rsvd-encoding',
277           'poison-received',
278           'receiver-overflow',
279           'internal',
280           'cxl-ide-tx',
281           'cxl-ide-rx'
282           ]
283 }
284
285##
286# @CXLUncorErrorRecord:
287#
288# Record of a single error including header log.
289#
290# @type: Type of error
291#
292# @header: 16 DWORD of header.
293#
294# Since: 8.0
295##
296{ 'struct': 'CXLUncorErrorRecord',
297  'data': {
298      'type': 'CxlUncorErrorType',
299      'header': [ 'uint32' ]
300  }
301}
302
303##
304# @cxl-inject-uncorrectable-errors:
305#
306# Command to allow injection of multiple errors in one go.  This
307# allows testing of multiple header log handling in the OS.
308#
309# @path: CXL Type 3 device canonical QOM path
310#
311# @errors: Errors to inject
312#
313# Since: 8.0
314##
315{ 'command': 'cxl-inject-uncorrectable-errors',
316  'data': { 'path': 'str',
317             'errors': [ 'CXLUncorErrorRecord' ] }}
318
319##
320# @CxlCorErrorType:
321#
322# Type of CXL correctable error to inject
323#
324# @cache-data-ecc: Data ECC error on CXL.cache
325#
326# @mem-data-ecc: Data ECC error on CXL.mem
327#
328# @crc-threshold: Component specific and applicable to 68 byte Flit
329#     mode only.
330#
331# @retry-threshold: Retry threshold hit in the Local Retry State
332#     Machine, 68B Flits only.
333#
334# @cache-poison-received: Received poison from a peer on CXL.cache.
335#
336# @mem-poison-received: Received poison from a peer on CXL.mem
337#
338# @physical: Received error indication from the physical layer.
339#
340# Since: 8.0
341##
342{ 'enum': 'CxlCorErrorType',
343  'data': ['cache-data-ecc',
344           'mem-data-ecc',
345           'crc-threshold',
346           'retry-threshold',
347           'cache-poison-received',
348           'mem-poison-received',
349           'physical']
350}
351
352##
353# @cxl-inject-correctable-error:
354#
355# Command to inject a single correctable error.  Multiple error
356# injection of this error type is not interesting as there is no
357# associated header log.  These errors are reported via AER as a
358# correctable internal error, with additional detail available from
359# the CXL device.
360#
361# @path: CXL Type 3 device canonical QOM path
362#
363# @type: Type of error.
364#
365# Since: 8.0
366##
367{'command': 'cxl-inject-correctable-error',
368 'data': {'path': 'str', 'type': 'CxlCorErrorType'}}
369
370##
371# @CxlDynamicCapacityExtent:
372#
373# A single dynamic capacity extent.  This is a contiguous allocation
374# of memory by Device Physical Address within a single Dynamic
375# Capacity Region on a CXL Type 3 Device.
376#
377# @offset: The offset (in bytes) to the start of the region where the
378#     extent belongs to.
379#
380# @len: The length of the extent in bytes.
381#
382# Since: 9.1
383##
384{ 'struct': 'CxlDynamicCapacityExtent',
385  'data': {
386      'offset':'uint64',
387      'len': 'uint64'
388  }
389}
390
391##
392# @CxlExtentSelectionPolicy:
393#
394# The policy to use for selecting which extents comprise the added
395# capacity, as defined in Compute Express Link (CXL) Specification,
396# Revision 3.1, Table 7-70.
397#
398# @free: Device is responsible for allocating the requested memory
399#     capacity and is free to do this using any combination of
400#     supported extents.
401#
402# @contiguous: Device is responsible for allocating the requested
403#     memory capacity but must do so as a single contiguous
404#     extent.
405#
406# @prescriptive: The precise set of extents to be allocated is
407#     specified by the command.  Thus allocation is being managed
408#     by the issuer of the allocation command, not the device.
409#
410# @enable-shared-access: Capacity has already been allocated to a
411#     different host using free, contiguous or prescriptive policy
412#     with a known tag.  This policy then instructs the device to make
413#     the capacity with the specified tag available to an additional
414#     host.  Capacity is implicit as it matches that already
415#     associated with the tag.  Note that the extent list (and hence
416#     Device Physical Addresses) used are per host, so a device may
417#     use different representations on each host.  The ordering of the
418#     extents provided to each host is indicated to the host using per
419#     extent sequence numbers generated by the device.  Has a similar
420#     meaning for temporal sharing, but in that case there may be only
421#     one host involved.
422#
423# Since: 9.1
424##
425{ 'enum': 'CxlExtentSelectionPolicy',
426  'data': ['free',
427           'contiguous',
428           'prescriptive',
429           'enable-shared-access']
430}
431
432##
433# @cxl-add-dynamic-capacity:
434#
435# Initiate adding dynamic capacity extents to a host.  This simulates
436# operations defined in Compute Express Link (CXL) Specification,
437# Revision 3.1, Section 7.6.7.6.5.  Note that, currently, establishing
438# success or failure of the full Add Dynamic Capacity flow requires
439# out of band communication with the OS of the CXL host.
440#
441# @path: path to the CXL Dynamic Capacity Device in the QOM tree.
442#
443# @host-id: The "Host ID" field as defined in Compute Express Link
444#     (CXL) Specification, Revision 3.1, Table 7-70.
445#
446# @selection-policy: The "Selection Policy" bits as defined in
447#     Compute Express Link (CXL) Specification, Revision 3.1,
448#     Table 7-70.  It specifies the policy to use for selecting
449#     which extents comprise the added capacity.
450#
451# @region: The "Region Number" field as defined in Compute Express
452#     Link (CXL) Specification, Revision 3.1, Table 7-70.  Valid
453#     range is from 0-7.
454#
455# @tag: The "Tag" field as defined in Compute Express Link (CXL)
456#     Specification, Revision 3.1, Table 7-70.
457#
458# @extents: The "Extent List" field as defined in Compute Express Link
459#     (CXL) Specification, Revision 3.1, Table 7-70.
460#
461# Features:
462#
463# @unstable: For now this command is subject to change.
464#
465# Since: 9.1
466##
467{ 'command': 'cxl-add-dynamic-capacity',
468  'data': { 'path': 'str',
469            'host-id': 'uint16',
470            'selection-policy': 'CxlExtentSelectionPolicy',
471            'region': 'uint8',
472            '*tag': 'str',
473            'extents': [ 'CxlDynamicCapacityExtent' ]
474           },
475  'features': [ 'unstable' ]
476}
477
478##
479# @CxlExtentRemovalPolicy:
480#
481# The policy to use for selecting which extents comprise the released
482# capacity, defined in the "Flags" field in Compute Express Link (CXL)
483# Specification, Revision 3.1, Table 7-71.
484#
485# @tag-based: Extents are selected by the device based on tag, with
486#     no requirement for contiguous extents.
487#
488# @prescriptive: Extent list of capacity to release is included in
489#     the request payload.
490#
491# Since: 9.1
492##
493{ 'enum': 'CxlExtentRemovalPolicy',
494  'data': ['tag-based',
495           'prescriptive']
496}
497
498##
499# @cxl-release-dynamic-capacity:
500#
501# Initiate release of dynamic capacity extents from a host.  This
502# simulates operations defined in Compute Express Link (CXL)
503# Specification, Revision 3.1, Section 7.6.7.6.6.  Note that,
504# currently, success or failure of the full Release Dynamic Capacity
505# flow requires out of band communication with the OS of the CXL host.
506#
507# @path: path to the CXL Dynamic Capacity Device in the QOM tree.
508#
509# @host-id: The "Host ID" field as defined in Compute Express Link
510#     (CXL) Specification, Revision 3.1, Table 7-71.
511#
512# @removal-policy: Bit[3:0] of the "Flags" field as defined in
513#     Compute Express Link (CXL) Specification, Revision 3.1,
514#     Table 7-71.
515#
516# @forced-removal: Bit[4] of the "Flags" field in Compute Express
517#     Link (CXL) Specification, Revision 3.1, Table 7-71.  When set,
518#     the device does not wait for a Release Dynamic Capacity command
519#     from the host.  Instead, the host immediately looses access to
520#     the released capacity.
521#
522# @sanitize-on-release: Bit[5] of the "Flags" field in Compute Express
523#     Link (CXL) Specification, Revision 3.1, Table 7-71.  When set,
524#     the device should sanitize all released capacity as a result of
525#     this request.  This ensures that all user data and metadata is
526#     made permanently unavailable by whatever means is appropriate
527#     for the media type.  Note that changing encryption keys is not
528#     sufficient.
529#
530# @region: The "Region Number" field as defined in Compute Express
531#     Link Specification, Revision 3.1, Table 7-71.  Valid range
532#     is from 0-7.
533#
534# @tag: The "Tag" field as defined in Compute Express Link (CXL)
535#     Specification, Revision 3.1, Table 7-71.
536#
537# @extents: The "Extent List" field as defined in Compute Express
538#     Link (CXL) Specification, Revision 3.1, Table 7-71.
539#
540# Features:
541#
542# @unstable: For now this command is subject to change.
543#
544# Since: 9.1
545##
546{ 'command': 'cxl-release-dynamic-capacity',
547  'data': { 'path': 'str',
548            'host-id': 'uint16',
549            'removal-policy': 'CxlExtentRemovalPolicy',
550            '*forced-removal': 'bool',
551            '*sanitize-on-release': 'bool',
552            'region': 'uint8',
553            '*tag': 'str',
554            'extents': [ 'CxlDynamicCapacityExtent' ]
555           },
556  'features': [ 'unstable' ]
557}
558