@samitouri / QOSamiQemu / commits / 1fc57dd250

hw/cxl/events: Updates for rev3.2 memory module event record

CXL spec rev3.2 section 8.2.10.2.1.3 Table 8-59, memory module event record has updated with following new fields. 1. Validity Flags 2. Component Identifier 3. Device Event Sub-Type Add updates for the above spec changes in the CXL memory module event reporting and QMP command to inject memory module event. Updated all references for this command to the CXL r3.2 specification. Signed-off-by: Shiju Jose <shiju.jose@huawei.com> Acked-by: Markus Armbruster <armbru@redhat.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-6-Jonathan.Cameron@huawei.com>

Shiju Jose committed Feb 5, 2026 at 11:23 UTC 1fc57dd250944805a5d5f498ebf0775234be3851
4 files changed +49 -12
hw/mem/cxl_type3.c
+20
@@ -1937,6 +1937,9 @@ void qmp_cxl_inject_dram_event(const char *path, CxlEventLog log,
1937 }
1938 }
1939
1940 +#define CXL_MMER_VALID_COMPONENT BIT(0)
1941 +#define CXL_MMER_VALID_COMPONENT_ID_FORMAT BIT(1)
1942 +
1943 void qmp_cxl_inject_memory_module_event(const char *path, CxlEventLog log,
1944 uint32_t flags, bool has_maint_op_class,
1945 uint8_t maint_op_class,
@@ -1953,11 +1956,16 @@ void qmp_cxl_inject_memory_module_event(const char *path, CxlEventLog log,
1956 uint32_t dirty_shutdown_count,
1957 uint32_t corrected_volatile_error_count,
1958 uint32_t corrected_persist_error_count,
1959 + const char *component_id,
1960 + bool has_comp_id_pldm,
1961 + bool is_comp_id_pldm,
1962 + uint8_t sub_type,
1963 Error **errp)
1964 {
1965 Object *obj = object_resolve_path(path, NULL);
1966 CXLEventMemoryModule module;
1967 CXLEventRecordHdr *hdr = &module.hdr;
1968 + uint16_t valid_flags = 0;
1969 CXLDeviceState *cxlds;
1970 CXLType3Dev *ct3d;
1971 uint8_t enc_log;
@@ -2000,6 +2008,18 @@ void qmp_cxl_inject_memory_module_event(const char *path, CxlEventLog log,
2008 stl_le_p(&module.corrected_persistent_error_count,
2009 corrected_persist_error_count);
2010
2011 + if (component_id) {
2012 + strncpy((char *)module.component_id, component_id,
2013 + sizeof(module.component_id) - 1);
2014 + valid_flags |= CXL_MMER_VALID_COMPONENT;
2015 + if (has_comp_id_pldm && is_comp_id_pldm) {
2016 + valid_flags |= CXL_MMER_VALID_COMPONENT_ID_FORMAT;
2017 + }
2018 + }
2019 + module.sub_type = sub_type;
2020 +
2021 + stw_le_p(&module.validity_flags, valid_flags);
2022 +
2023 if (cxl_event_insert(cxlds, enc_log, (CXLEventRecordRaw *)&module)) {
2024 cxl_event_irq_assert(ct3d);
2025 }
hw/mem/cxl_type3_stubs.c
+4
@@ -78,6 +78,10 @@ void qmp_cxl_inject_memory_module_event(const char *path, CxlEventLog log,
78 uint32_t dirty_shutdown_count,
79 uint32_t corrected_volatile_error_count,
80 uint32_t corrected_persist_error_count,
81 + const char *component_id,
82 + bool has_comp_id_pldm,
83 + bool is_comp_id_pldm,
84 + uint8_t sub_type,
85 Error **errp) {}
86
87 void qmp_cxl_inject_poison(const char *path, uint64_t start, uint64_t length,
include/hw/cxl/cxl_events.h
+5 -2
@@ -166,7 +166,7 @@ typedef struct CXLEventDram {
166
167 /*
168 * Memory Module Event Record
169 - * CXL r3.1 Section 8.2.9.2.1.3: Table 8-47
169 + * CXL r3.2 Section 8.2.10.2.1.3: Table 8-59
170 * All fields little endian.
171 */
172 typedef struct CXLEventMemoryModule {
@@ -180,7 +180,10 @@ typedef struct CXLEventMemoryModule {
180 uint32_t dirty_shutdown_count;
181 uint32_t corrected_volatile_error_count;
182 uint32_t corrected_persistent_error_count;
183 - uint8_t reserved[0x3d];
183 + uint16_t validity_flags;
184 + uint8_t component_id[CXL_EVENT_GEN_MED_COMP_ID_SIZE];
185 + uint8_t sub_type;
186 + uint8_t reserved[0x2a];
187 } QEMU_PACKED CXLEventMemoryModule;
188
189 /*
qapi/cxl.json
+20 -10
@@ -214,20 +214,20 @@
214 ##
215 # @CXLMemModuleEvent:
216 #
217 -# Event record for a Memory Module Event (CXL r3.0 8.2.9.2.1.3).
217 +# Event record for a Memory Module Event (CXL r3.2 8.2.10.2.1.3).
218 #
219 -# @type: Device Event Type. See CXL r3.0 Table 8-45 Memory Module
219 +# @type: Device Event Type. See CXL r3.2 Table 8-59 Memory Module
220 # Event Record for bit definitions for bit definiions.
221 #
222 -# @health-status: Overall health summary bitmap. See CXL r3.0 Table
223 -# 8-100 Get Health Info Output Payload, Health Status for bit
222 +# @health-status: Overall health summary bitmap. See CXL r3.2 Table
223 +# 8-148 Get Health Info Output Payload, Health Status for bit
224 # definitions.
225 #
226 -# @media-status: Overall media health summary. See CXL r3.0 Table
227 -# 8-100 Get Health Info Output Payload, Media Status for bit
226 +# @media-status: Overall media health summary. See CXL r3.2 Table
227 +# 8-148 Get Health Info Output Payload, Media Status for bit
228 # definitions.
229 #
230 -# @additional-status: See CXL r3.0 Table 8-100 Get Health Info Output
230 +# @additional-status: See CXL r3.2 Table 8-148 Get Health Info Output
231 # Payload, Additional Status for subfield definitions.
232 #
233 # @life-used: Percentage (0-100) of factory expected life span.
@@ -243,6 +243,14 @@
243 # @corrected-persistent-error-count: Total number of correctable
244 # errors in persistent memory
245 #
246 +# @component-id: Device specific component identifier for the event.
247 +# May describe a field replaceable sub-component of the device.
248 +#
249 +# @is-comp-id-pldm: This flag specifies whether the device-specific
250 +# component identifier format follows PLDM.
251 +#
252 +# @sub-type: Device event sub-type.
253 +#
254 # Since: 8.1
255 ##
256 { 'struct': 'CXLMemModuleEvent',
@@ -252,14 +260,16 @@
260 'life-used': 'uint8', 'temperature' : 'int16',
261 'dirty-shutdown-count': 'uint32',
262 'corrected-volatile-error-count': 'uint32',
255 - 'corrected-persistent-error-count': 'uint32'
263 + 'corrected-persistent-error-count': 'uint32',
264 + '*component-id': 'str', '*is-comp-id-pldm':'bool',
265 + 'sub-type':'uint8'
266 }}
267
268 ##
269 # @cxl-inject-memory-module-event:
270 #
261 -# Inject an event record for a Memory Module Event (CXL r3.0
262 -# 8.2.9.2.1.3). This event includes a copy of the Device Health info
271 +# Inject an event record for a Memory Module Event (CXL r3.2
272 +# 8.2.10.2.1.3). This event includes a copy of the Device Health info
273 # at the time of the event.
274 #
275 # Since: 8.1