Jonathan Cameron <jonathan.came...@huawei.com> writes: > These events include a copy of the device health information at the > time of the event. Actually using the emulated device health would > require a lot of controls to manipulate that state. Given the aim > of this injection code is to just test the flows when events occur, > inject the contents of the device health state as well. > > Future work may add more sophisticate device health emulation > including direct generation of these records when events occur > (such as a temperature threshold being crossed). That does not > reduce the usefulness of this more basic generation of the events. > > Reviewed-by: Ira Weiny <ira.we...@intel.com> > Signed-off-by: Jonathan Cameron <jonathan.came...@huawei.com> > > --- > v7: Expanded docs for qapi and added a lot of cross references to > the CXL revision 3.0 specification. > --- > qapi/cxl.json | 54 ++++++++++++++++++++++++++++++++ > include/hw/cxl/cxl_events.h | 19 ++++++++++++ > hw/mem/cxl_type3.c | 62 +++++++++++++++++++++++++++++++++++++ > hw/mem/cxl_type3_stubs.c | 12 +++++++ > 4 files changed, 147 insertions(+) > > diff --git a/qapi/cxl.json b/qapi/cxl.json > index ce9adcbc55..05c560cfe5 100644 > --- a/qapi/cxl.json > +++ b/qapi/cxl.json > @@ -147,6 +147,60 @@ > '*column': 'uint16', '*correction-mask': [ 'uint64' ] > }} > > +## > +# @cxl-inject-memory-module-event: > +# > +# Inject an event record for a Memory Module Event (CXL r3.0 > +# 8.2.9.2.1.3). # This event includes a copy of the Device Health
Stray '#'. > +# info at the time of the event. > +# > +# @path: CXL type 3 device canonical QOM path > +# > +# @log: Event Log to add the event to > +# > +# @flags: Event Record Flags. See CXL r3.0 Table 8-42 Common Event > +# Record Format, Event Record Flags for subfield definitions. > +# > +# @type: Device Event Type. See CXL r3.0 Table 8-45 Memory Module > +# Event Record for bit definitions for bit definiions. > +# > +# @health-status: Overall health summary bitmap. See CXL r3.0 Table > +# 8-100 Get Health Info Output Payload, Health Status > +# for bit definitions. > +# > +# @media-status: Overall media health summary. See CXL r3.0 Table > +# 8-100 Get Health Info Output Payload, Media Status > +# for bit definitions. > +# > +# @additional-status: See CXL r3.0 Table 8-100 Get Health Info Output > +# Payload, Additional Status for subfield > +# definitions. > +# > +# @life-used: Percentage (0-100) of factory expected life span. > +# > +# @temperature: Device temperature in degrees Celsius. > +# > +# @dirty-shutdown-count: Number of time the device has been unable to Number of times > +# determine whether data loss may have occurred. > +# > +# @corrected-volatile-error-count: Total number of correctable errors in > +# volatile memory. > +# > +# @corrected-persistent-error-count: Total number correctable errors in > +# persistent memory Please format like # @flags: Event Record Flags. See CXL r3.0 Table 8-42 Common Event # Record Format, Event Record Flags for subfield definitions. # # @type: Device Event Type. See CXL r3.0 Table 8-45 Memory Module # Event Record for bit definitions for bit definiions. # # @health-status: Overall health summary bitmap. See CXL r3.0 Table # 8-100 Get Health Info Output Payload, Health Status for bit # definitions. # # @media-status: Overall media health summary. See CXL r3.0 Table # 8-100 Get Health Info Output Payload, Media Status for bit # definitions. # # @additional-status: See CXL r3.0 Table 8-100 Get Health Info Output # Payload, Additional Status for subfield definitions. # # @life-used: Percentage (0-100) of factory expected life span. # # @temperature: Device temperature in degrees Celsius. # # @dirty-shutdown-count: Number of time the device has been unable to # determine whether data loss may have occurred. # # @corrected-volatile-error-count: Total number of correctable errors # in volatile memory. # # @corrected-persistent-error-count: Total number correctable errors # in persistent memory to blend in with recent commit a937b6aa739 (qapi: Reformat doc comments to conform to current conventions). > +# > +# Since: 8.1 > +## > +{ 'command': 'cxl-inject-memory-module-event', > + 'data': { 'path': 'str', 'log': 'CxlEventLog', 'flags' : 'uint8', > + 'type': 'uint8', 'health-status': 'uint8', > + 'media-status': 'uint8', 'additional-status': 'uint8', > + 'life-used': 'uint8', 'temperature' : 'int16', > + 'dirty-shutdown-count': 'uint32', > + 'corrected-volatile-error-count': 'uint32', > + 'corrected-persistent-error-count': 'uint32' > + }} > + > ## > # @cxl-inject-poison: > # With these tweaks Acked-by: Markus Armbruster <arm...@redhat.com> [...]