@samitouri / QOSamiQemu / commits / 94976b8631

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

CXL spec rev3.2 section 8.2.10.2.1.2 Table 8-58, DRAM event record has updated with following new fields. 1. Component Identifier 2. Sub-channel of the memory event location 3. Advanced Programmable Corrected Memory Error Threshold Event Flags 4. Corrected Volatile Memory Error Count at Event 5. Memory Event Sub-Type Add updates for the above spec changes in the CXL DRAM event reporting and QMP command to inject DRAM event. In order to ensure consistency update all specification references for this command to CXL r3.2. 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-5-Jonathan.Cameron@huawei.com>

Shiju Jose committed Feb 5, 2026 at 11:23 UTC 94976b8631a11297b52826f51a638242b2767f9f
4 files changed +83 -10
hw/mem/cxl_type3.c
+43 -1
@@ -1783,6 +1783,13 @@ void qmp_cxl_inject_general_media_event(const char *path, CxlEventLog log,
1783 #define CXL_DRAM_VALID_ROW BIT(5)
1784 #define CXL_DRAM_VALID_COLUMN BIT(6)
1785 #define CXL_DRAM_VALID_CORRECTION_MASK BIT(7)
1786 +#define CXL_DRAM_VALID_COMPONENT BIT(8)
1787 +#define CXL_DRAM_VALID_COMPONENT_ID_FORMAT BIT(9)
1788 +#define CXL_DRAM_VALID_SUB_CHANNEL BIT(10)
1789 +
1790 +#define CXL_DRAM_EV_DESC_UCE BIT(0)
1791 +#define CXL_DRAM_EV_DESC_THRESHOLD_EVENT BIT(1)
1792 +#define CXL_DRAM_EV_DESC_POISON_LIST_OVERFLOW_EVENT BIT(2)
1793
1794 void qmp_cxl_inject_dram_event(const char *path, CxlEventLog log,
1795 uint32_t flags,
@@ -1802,6 +1809,12 @@ void qmp_cxl_inject_dram_event(const char *path, CxlEventLog log,
1809 bool has_column, uint16_t column,
1810 bool has_correction_mask,
1811 uint64List *correction_mask,
1812 + const char *component_id,
1813 + bool has_comp_id_pldm, bool is_comp_id_pldm,
1814 + bool has_sub_channel, uint8_t sub_channel,
1815 + bool has_cme_ev_flags, uint8_t cme_ev_flags,
1816 + bool has_cvme_count, uint32_t cvme_count,
1817 + uint8_t sub_type,
1818 Error **errp)
1819 {
1820 Object *obj = object_resolve_path(path, NULL);
@@ -1838,7 +1851,6 @@ void qmp_cxl_inject_dram_event(const char *path, CxlEventLog log,
1851 has_maint_op_subclass, maint_op_subclass,
1852 has_ld_id, ld_id, has_head_id, head_id);
1853 stq_le_p(&dram.phys_addr, dpa);
1841 - dram.descriptor = descriptor;
1854 dram.type = type;
1855 dram.transaction_type = transaction_type;
1856
@@ -1888,6 +1900,36 @@ void qmp_cxl_inject_dram_event(const char *path, CxlEventLog log,
1900 valid_flags |= CXL_DRAM_VALID_CORRECTION_MASK;
1901 }
1902
1903 + if (component_id) {
1904 + strncpy((char *)dram.component_id, component_id,
1905 + sizeof(dram.component_id) - 1);
1906 + valid_flags |= CXL_DRAM_VALID_COMPONENT;
1907 + if (has_comp_id_pldm && is_comp_id_pldm) {
1908 + valid_flags |= CXL_DRAM_VALID_COMPONENT_ID_FORMAT;
1909 + }
1910 + }
1911 +
1912 + if (has_sub_channel) {
1913 + dram.sub_channel = sub_channel;
1914 + valid_flags |= CXL_DRAM_VALID_SUB_CHANNEL;
1915 + }
1916 +
1917 + if (has_cme_ev_flags) {
1918 + dram.cme_ev_flags = cme_ev_flags;
1919 + } else {
1920 + dram.cme_ev_flags = 0;
1921 + }
1922 +
1923 + if (has_cvme_count) {
1924 + descriptor |= CXL_DRAM_EV_DESC_THRESHOLD_EVENT;
1925 + st24_le_p(dram.cvme_count, cvme_count);
1926 + } else {
1927 + st24_le_p(dram.cvme_count, 0);
1928 + }
1929 + dram.descriptor = descriptor;
1930 +
1931 + dram.sub_type = sub_type;
1932 +
1933 stw_le_p(&dram.validity_flags, valid_flags);
1934
1935 if (cxl_event_insert(cxlds, enc_log, (CXLEventRecordRaw *)&dram)) {
hw/mem/cxl_type3_stubs.c
+7
@@ -53,6 +53,13 @@ void qmp_cxl_inject_dram_event(const char *path, CxlEventLog log,
53 bool has_column, uint16_t column,
54 bool has_correction_mask,
55 uint64List *correction_mask,
56 + const char *component_id,
57 + bool has_comp_id_pldm,
58 + bool is_comp_id_pldm,
59 + bool has_sub_channel, uint8_t sub_channel,
60 + bool has_cme_ev_flags, uint8_t cme_ev_flags,
61 + bool has_cvme_count, uint32_t cvme_count,
62 + uint8_t sub_type,
63 Error **errp) {}
64
65 void qmp_cxl_inject_memory_module_event(const char *path, CxlEventLog log,
include/hw/cxl/cxl_events.h
+7 -2
@@ -138,7 +138,7 @@ typedef struct CXLEventGenMedia {
138
139 /*
140 * DRAM Event Record
141 - * CXL r3.1 Section 8.2.9.2.1.2: Table 8-46
141 + * CXL r3.2 Section 8.2.10.2.1.2: Table 8-58
142 * All fields little endian.
143 */
144 typedef struct CXLEventDram {
@@ -156,7 +156,12 @@ typedef struct CXLEventDram {
156 uint8_t row[3];
157 uint16_t column;
158 uint64_t correction_mask[4];
159 - uint8_t reserved[0x17];
159 + uint8_t component_id[CXL_EVENT_GEN_MED_COMP_ID_SIZE];
160 + uint8_t sub_channel;
161 + uint8_t cme_ev_flags;
162 + uint8_t cvme_count[3];
163 + uint8_t sub_type;
164 + uint8_t reserved;
165 } QEMU_PACKED CXLEventDram;
166
167 /*
qapi/cxl.json
+26 -7
@@ -131,21 +131,21 @@
131 ##
132 # @CXLDRAMEvent:
133 #
134 -# Event record for a DRAM Event (CXL r3.0 8.2.9.2.1.2).
134 +# Event record for a DRAM Event (CXL r3.2 8.2.10.2.1.2).
135 #
136 # @dpa: Device Physical Address (relative to @path device). Note
137 -# lower bits include some flags. See CXL r3.0 Table 8-44 DRAM
137 +# lower bits include some flags. See CXL r3.2 Table 8-58 DRAM
138 # Event Record, Physical Address.
139 #
140 # @descriptor: Memory Event Descriptor with additional memory event
141 -# information. See CXL r3.0 Table 8-44 DRAM Event Record, Memory
141 +# information. See CXL r3.2 Table 8-58 DRAM Event Record, Memory
142 # Event Descriptor for bit definitions.
143 #
144 -# @type: Type of memory event that occurred. See CXL r3.0 Table 8-44
144 +# @type: Type of memory event that occurred. See CXL r3.2 Table 8-58
145 # DRAM Event Record, Memory Event Type for possible values.
146 #
147 # @transaction-type: Type of first transaction that caused the event
148 -# to occur. See CXL r3.0 Table 8-44 DRAM Event Record,
148 +# to occur. See CXL r3.2 Table 8-58 DRAM Event Record,
149 # Transaction Type for possible values.
150 #
151 # @channel: The channel of the memory event location. A channel is an
@@ -169,6 +169,21 @@
169 # @correction-mask: Bits within each nibble. Used in order of bits
170 # set in the nibble-mask. Up to 4 nibbles may be covered.
171 #
172 +# @component-id: Device specific component identifier for the event.
173 +# May describe a field replaceable sub-component of the device.
174 +#
175 +# @is-comp-id-pldm: This flag specifies whether the device-specific
176 +# component identifier format follows PLDM.
177 +#
178 +# @sub-channel: The sub-channel of the memory event location.
179 +#
180 +# @cme-ev-flags: Advanced programmable corrected memory error
181 +# threshold event flags.
182 +#
183 +# @cvme-count: Corrected volatile memory error count at event.
184 +#
185 +# @sub-type: Memory event sub-type.
186 +#
187 # Since: 8.1
188 ##
189 { 'struct': 'CXLDRAMEvent',
@@ -177,13 +192,17 @@
192 'type': 'uint8', 'transaction-type': 'uint8',
193 '*channel': 'uint8', '*rank': 'uint8', '*nibble-mask': 'uint32',
194 '*bank-group': 'uint8', '*bank': 'uint8', '*row': 'uint32',
180 - '*column': 'uint16', '*correction-mask': [ 'uint64' ]
195 + '*column': 'uint16', '*correction-mask': [ 'uint64' ],
196 + '*component-id': 'str', '*is-comp-id-pldm':'bool',
197 + '*sub-channel':'uint8',
198 + '*cme-ev-flags':'uint8', '*cvme-count':'uint32',
199 + 'sub-type':'uint8'
200 }}
201
202 ##
203 # @cxl-inject-dram-event:
204 #
186 -# Inject an event record for a DRAM Event (CXL r3.0 8.2.9.2.1.2).
205 +# Inject an event record for a DRAM Event (CXL r3.2 8.2.10.2.1.2).
206 # This event type is reported via one of the event logs
207 # specified via the log parameter.
208 #