From nobody Sat Feb 7 04:47:06 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1770290701; cv=none; d=zohomail.com; s=zohoarc; b=Y9qsexdl1IxlV1o7/nnHdp/ln1PdAvRSUcLAhOg3Zd7rjsgHUkA+kmAfs0bn8suKtlxu94nRC6j9Zjev9QEMcWhpCVT10Fk2j1dBcUWyKXCxAmQ0hEZBV1UfPNaZNrrDErq3pyb1oSyOVyqBkAVcNgrmMyYKJYTzTKBYfa3TGsY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770290701; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=1Y23OTo5S1yV7uMQb5mwz8QZRNJ9HfyfS/W3Llg0cPk=; b=B888WmMQ1lRY68ffANVbXDS0KBTsYZuHmH/MtEYVlQcxRvhXTQUGV52gLY2QbBjGYL/xhj6qSOCvzQGD9MwbCB/Pn5Cwmq7iE5VYlfvP1SSVzJDfSvV6ed0ZdKce7UMfmqbB1wVR16T6Y69t/G2Tkkh5Ip4qo/ATgDnSmaHVezE= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770290701823211.1169985407015; Thu, 5 Feb 2026 03:25:01 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vnxTP-0001A6-3s; Thu, 05 Feb 2026 06:24:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vnxTG-000193-0X for qemu-devel@nongnu.org; Thu, 05 Feb 2026 06:24:30 -0500 Received: from frasgout.his.huawei.com ([185.176.79.56]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vnxTE-00054J-7p for qemu-devel@nongnu.org; Thu, 05 Feb 2026 06:24:25 -0500 Received: from mail.maildlp.com (unknown [172.18.224.107]) by frasgout.his.huawei.com (SkyGuard) with ESMTPS id 4f6FGD2sz2zJ46l4; Thu, 5 Feb 2026 19:23:32 +0800 (CST) Received: from dubpeml500005.china.huawei.com (unknown [7.214.145.207]) by mail.maildlp.com (Postfix) with ESMTPS id F1B1940570; Thu, 5 Feb 2026 19:24:22 +0800 (CST) Received: from SecurePC-101-06.huawei.com (10.122.19.247) by dubpeml500005.china.huawei.com (7.214.145.207) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 5 Feb 2026 11:24:22 +0000 To: Michael Tsirkin , , , Ravi Shankar , , Ravi Jonnalagadda CC: , Subject: [PATCH qemu v5 1/5] qapi: cxl: Refactor CXL event injection for common commands arguments Date: Thu, 5 Feb 2026 11:23:46 +0000 Message-ID: <20260205112350.60681-2-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260205112350.60681-1-Jonathan.Cameron@huawei.com> References: <20260205112350.60681-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.122.19.247] X-ClientProxiedBy: lhrpeml100009.china.huawei.com (7.191.174.83) To dubpeml500005.china.huawei.com (7.214.145.207) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=185.176.79.56; envelope-from=jonathan.cameron@huawei.com; helo=frasgout.his.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Jonathan Cameron From: Jonathan Cameron via qemu development Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1770290703666158500 Content-Type: text/plain; charset="utf-8" From: Shiju Jose Refactor CXL event injection to use struct for common command arguments. Suggested-by: Markus Armbruster Signed-off-by: Shiju Jose Acked-by: Markus Armbruster Reviewed-by: Ravi Jonnalagadda Signed-off-by: Jonathan Cameron --- qapi/cxl.json | 89 +++++++++++++++++++++++++++++++++------------------ 1 file changed, 58 insertions(+), 31 deletions(-) diff --git a/qapi/cxl.json b/qapi/cxl.json index eeddb58d1d3f..55a088586e53 100644 --- a/qapi/cxl.json +++ b/qapi/cxl.json @@ -31,11 +31,10 @@ } =20 ## -# @cxl-inject-general-media-event: +# @CXLCommonEventBase: # -# Inject an event record for a General Media Event (CXL r3.0 -# 8.2.9.2.1.1). This event type is reported via one of the event logs -# specified via the log parameter. +# Common event base for a CXL Event (CXL r3.0 8.2.9.2.1 +# Table 8-42 Common Event Record Format). # # @path: CXL type 3 device canonical QOM path # @@ -44,6 +43,16 @@ # @flags: Event Record Flags. See CXL r3.0 Table 8-42 Common Event # Record Format, Event Record Flags for subfield definitions. # +# Since: 8.1 +## +{ 'struct': 'CXLCommonEventBase', + 'data': { 'path': 'str', 'log': 'CxlEventLog', 'flags': 'uint8' } } + +## +# @CXLGeneralMediaEvent: +# +# Event record for a General Media Event (CXL r3.0 8.2.9.2.1.1). +# # @dpa: Device Physical Address (relative to @path device). Note # lower bits include some flags. See CXL r3.0 Table 8-43 General # Media Event Record, Physical Address. @@ -74,26 +83,29 @@ # # Since: 8.1 ## -{ 'command': 'cxl-inject-general-media-event', - 'data': { 'path': 'str', 'log': 'CxlEventLog', 'flags': 'uint8', - 'dpa': 'uint64', 'descriptor': 'uint8', +{ 'struct': 'CXLGeneralMediaEvent', + 'base': 'CXLCommonEventBase', + 'data': { 'dpa': 'uint64', 'descriptor': 'uint8', 'type': 'uint8', 'transaction-type': 'uint8', '*channel': 'uint8', '*rank': 'uint8', '*device': 'uint32', '*component-id': 'str' } } =20 ## -# @cxl-inject-dram-event: -# -# Inject an event record for a DRAM Event (CXL r3.0 8.2.9.2.1.2). -# This event type is reported via one of the event logs specified via -# the log parameter. +# @cxl-inject-general-media-event: # -# @path: CXL type 3 device canonical QOM path +# Inject an event record for a General Media Event (CXL r3.0 +# 8.2.9.2.1.1). This event type is reported via one of the event +# logs specified via the log parameter. # -# @log: Event log to add the event to +# Since: 8.1 +## +{ 'command': 'cxl-inject-general-media-event', + 'data': 'CXLGeneralMediaEvent' } + +## +# @CXLDRAMEvent: # -# @flags: Event Record Flags. See CXL r3.0 Table 8-42 Common Event -# Record Format, Event Record Flags for subfield definitions. +# Event record for a DRAM Event (CXL r3.0 8.2.9.2.1.2). # # @dpa: Device Physical Address (relative to @path device). Note # lower bits include some flags. See CXL r3.0 Table 8-44 DRAM @@ -133,9 +145,9 @@ # # Since: 8.1 ## -{ 'command': 'cxl-inject-dram-event', - 'data': { 'path': 'str', 'log': 'CxlEventLog', 'flags': 'uint8', - 'dpa': 'uint64', 'descriptor': 'uint8', +{ 'struct': 'CXLDRAMEvent', + 'base': 'CXLCommonEventBase', + 'data': { 'dpa': 'uint64', 'descriptor': 'uint8', 'type': 'uint8', 'transaction-type': 'uint8', '*channel': 'uint8', '*rank': 'uint8', '*nibble-mask': 'uint32= ', '*bank-group': 'uint8', '*bank': 'uint8', '*row': 'uint32', @@ -143,18 +155,21 @@ }} =20 ## -# @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 info -# at the time of the event. +# @cxl-inject-dram-event: # -# @path: CXL type 3 device canonical QOM path +# Inject an event record for a DRAM Event (CXL r3.0 8.2.9.2.1.2). +# This event type is reported via one of the event logs +# specified via the log parameter. # -# @log: Event Log to add the event to +# Since: 8.1 +## +{ 'command': 'cxl-inject-dram-event', + 'data': 'CXLDRAMEvent' } + +## +# @CXLMemModuleEvent: # -# @flags: Event Record Flags. See CXL r3.0 Table 8-42 Common Event -# Record Format, Event Record Flags for subfield definitions. +# Event record for a Memory Module Event (CXL r3.0 8.2.9.2.1.3). # # @type: Device Event Type. See CXL r3.0 Table 8-45 Memory Module # Event Record for bit definitions for bit definiions. @@ -185,9 +200,9 @@ # # Since: 8.1 ## -{ 'command': 'cxl-inject-memory-module-event', - 'data': { 'path': 'str', 'log': 'CxlEventLog', 'flags' : 'uint8', - 'type': 'uint8', 'health-status': 'uint8', +{ 'struct': 'CXLMemModuleEvent', + 'base': 'CXLCommonEventBase', + 'data': { 'type': 'uint8', 'health-status': 'uint8', 'media-status': 'uint8', 'additional-status': 'uint8', 'life-used': 'uint8', 'temperature' : 'int16', 'dirty-shutdown-count': 'uint32', @@ -195,6 +210,18 @@ 'corrected-persistent-error-count': 'uint32' }} =20 +## +# @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 info +# at the time of the event. +# +# Since: 8.1 +## +{ 'command': 'cxl-inject-memory-module-event', + 'data': 'CXLMemModuleEvent' } + ## # @cxl-inject-poison: # --=20 2.51.0 From nobody Sat Feb 7 04:47:06 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1770290713; cv=none; d=zohomail.com; s=zohoarc; b=eXOziklKjTGtf3w1IuHAgmN+mSxZqL/2EkXJ5sG8E1Hu3F4990J1bBN1hHwBLcLa7ojFthVM2wVsHq1wHRI3ItpM7h+3yIGQLMvBvV8hBIPGAsyr59y1dq6s/BI9ldXC2ffaoRayREaRU9aZKHbVfLa3VlfuDmAxyVKSFEB9DoY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770290713; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=WOz5jfJsCW5EnJXsg6gwTy0tqMlFaSRcmXwZExjMXcY=; b=k0paLGvL/aqG0vYLlSG4WdOzvYV4ChM15QBhKDTizz/u90OaljOQ1tOxQZpHNWDpORHMmWCmjlF0+5hvPukYLeblFYumBH5pCIKp1zJV3TZbLbkfBXfIW5TNFSHz9TfFlh1oDf/LE089pij3lxl0RSxPVi/XYcYBIzWX/dBMiRU= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770290713554419.76340203483653; Thu, 5 Feb 2026 03:25:13 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vnxTr-0001hu-JH; Thu, 05 Feb 2026 06:25:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vnxTp-0001gw-AN for qemu-devel@nongnu.org; Thu, 05 Feb 2026 06:25:01 -0500 Received: from frasgout.his.huawei.com ([185.176.79.56]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vnxTn-000598-3r for qemu-devel@nongnu.org; Thu, 05 Feb 2026 06:25:01 -0500 Received: from mail.maildlp.com (unknown [172.18.224.83]) by frasgout.his.huawei.com (SkyGuard) with ESMTPS id 4f6FGq2kx6zJ46gx; Thu, 5 Feb 2026 19:24:03 +0800 (CST) Received: from dubpeml500005.china.huawei.com (unknown [7.214.145.207]) by mail.maildlp.com (Postfix) with ESMTPS id E6A5440086; Thu, 5 Feb 2026 19:24:53 +0800 (CST) Received: from SecurePC-101-06.huawei.com (10.122.19.247) by dubpeml500005.china.huawei.com (7.214.145.207) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 5 Feb 2026 11:24:53 +0000 To: Michael Tsirkin , , , Ravi Shankar , , Ravi Jonnalagadda CC: , Subject: [PATCH qemu v5 2/5] hw/cxl/events: Update for rev3.2 common event record format Date: Thu, 5 Feb 2026 11:23:47 +0000 Message-ID: <20260205112350.60681-3-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260205112350.60681-1-Jonathan.Cameron@huawei.com> References: <20260205112350.60681-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.122.19.247] X-ClientProxiedBy: lhrpeml100009.china.huawei.com (7.191.174.83) To dubpeml500005.china.huawei.com (7.214.145.207) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=185.176.79.56; envelope-from=jonathan.cameron@huawei.com; helo=frasgout.his.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Jonathan Cameron From: Jonathan Cameron via qemu development Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1770290715208154100 Content-Type: text/plain; charset="utf-8" From: Shiju Jose CXL spec 3.2 section 8.2.9.2.1 Table 8-55, Common Event Record format has updated with optional Maintenance Operation Subclass, LD ID and ID of the device head information. Add updates for the above optional parameters in the related CXL events reporting and in the QMP commands to inject CXL events. Update all related specification references to CXL r3.2 to ensure one consistent source. Signed-off-by: Shiju Jose Acked-by: Markus Armbruster Reviewed-by: Ravi Jonnalagadda Signed-off-by: Jonathan Cameron --- qapi/cxl.json | 21 ++++++++--- include/hw/cxl/cxl_device.h | 7 +++- include/hw/cxl/cxl_events.h | 15 ++++++-- hw/cxl/cxl-events.c | 3 +- hw/cxl/cxl-mailbox-utils.c | 3 +- hw/mem/cxl_type3.c | 70 ++++++++++++++++++++++++++++++++----- hw/mem/cxl_type3_stubs.c | 24 +++++++++++-- 7 files changed, 122 insertions(+), 21 deletions(-) diff --git a/qapi/cxl.json b/qapi/cxl.json index 55a088586e53..82001c0591d8 100644 --- a/qapi/cxl.json +++ b/qapi/cxl.json @@ -33,20 +33,33 @@ ## # @CXLCommonEventBase: # -# Common event base for a CXL Event (CXL r3.0 8.2.9.2.1 -# Table 8-42 Common Event Record Format). +# Common event base for a CXL Event (CXL r3.2 8.2.10.2.1 +# Table 8-55 Common Event Record Format). # # @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 +# @flags: Event Record Flags. See CXL r3.2 Table 8-55 Common Event # Record Format, Event Record Flags for subfield definitions. # +# @maint-op-class: Maintenance operation class the device requests to +# initiate. +# +# @maint-op-subclass: Maintenance operation subclass the device +# requests to initiate. +# +# @ld-id: Logical Device (LD) ID of LD from where the event +# originated. +# +# @head-id: ID of the device head from where the event originated. +# # Since: 8.1 ## { 'struct': 'CXLCommonEventBase', - 'data': { 'path': 'str', 'log': 'CxlEventLog', 'flags': 'uint8' } } + 'data': { 'path': 'str', 'log': 'CxlEventLog', 'flags': 'uint32', + '*maint-op-class':'uint8', '*maint-op-subclass':'uint8', + '*ld-id':'uint16', '*head-id':'uint8' } } =20 ## # @CXLGeneralMediaEvent: diff --git a/include/hw/cxl/cxl_device.h b/include/hw/cxl/cxl_device.h index 165355baf9da..e461a824b692 100644 --- a/include/hw/cxl/cxl_device.h +++ b/include/hw/cxl/cxl_device.h @@ -723,7 +723,12 @@ bool ct3_test_region_block_backed(CXLType3Dev *ct3d, u= int64_t dpa, uint64_t len); void cxl_assign_event_header(CXLEventRecordHdr *hdr, const QemuUUID *uuid, uint32_t flags, - uint8_t length, uint64_t timestamp); + uint8_t length, uint64_t timestamp, + bool has_maint_op_class, uint8_t maint_op_cla= ss, + bool has_maint_op_subclass, + uint8_t maint_op_subclass, + bool has_ld_id, uint16_t ld_id, + bool has_head_id, uint8_t head_id); void cxl_create_dc_event_records_for_extents(CXLType3Dev *ct3d, CXLDCEventType type, CXLDCExtentRaw extents[], diff --git a/include/hw/cxl/cxl_events.h b/include/hw/cxl/cxl_events.h index 758b075a64b9..4d9cfdb621ea 100644 --- a/include/hw/cxl/cxl_events.h +++ b/include/hw/cxl/cxl_events.h @@ -29,9 +29,15 @@ typedef enum CXLEventLogType { =20 /* * Common Event Record Format - * CXL r3.1 section 8.2.9.2.1: Event Records; Table 8-43 + * CXL r3.2 section 8.2.10.2.1: Event Records; Table 8-55 */ -#define CXL_EVENT_REC_HDR_RES_LEN 0xf +#define CXL_EVENT_REC_FLAGS_PERMANENT_COND BIT(2) +#define CXL_EVENT_REC_FLAGS_MAINT_NEEDED BIT(3) +#define CXL_EVENT_REC_FLAGS_PERF_DEGRADED BIT(4) +#define CXL_EVENT_REC_FLAGS_HW_REPLACEMENT_NEEDED BIT(5) +#define CXL_EVENT_REC_FLAGS_MAINT_OP_SUBCLASS_VALID BIT(6) +#define CXL_EVENT_REC_FLAGS_LD_ID_VALID BIT(7) +#define CXL_EVENT_REC_FLAGS_HEAD_ID_VALID BIT(8) typedef struct CXLEventRecordHdr { QemuUUID id; uint8_t length; @@ -40,7 +46,10 @@ typedef struct CXLEventRecordHdr { uint16_t related_handle; uint64_t timestamp; uint8_t maint_op_class; - uint8_t reserved[CXL_EVENT_REC_HDR_RES_LEN]; + uint8_t maint_op_subclass; + uint16_t ld_id; + uint8_t head_id; + uint8_t reserved[0xb]; } QEMU_PACKED CXLEventRecordHdr; =20 #define CXL_EVENT_RECORD_DATA_LENGTH 0x50 diff --git a/hw/cxl/cxl-events.c b/hw/cxl/cxl-events.c index 7583dd9162f6..5356dfb5b300 100644 --- a/hw/cxl/cxl-events.c +++ b/hw/cxl/cxl-events.c @@ -271,7 +271,8 @@ void cxl_create_dc_event_records_for_extents(CXLType3De= v *ct3d, &dynamic_capacity_uuid, (1 << CXL_EVENT_TYPE_INFO), sizeof(event_rec), - cxl_device_get_timestamp(&ct3d->cxl_dstate)); + cxl_device_get_timestamp(&ct3d->cxl_dstate), + 0, 0, 0, 0, 0, 0, 0, 0); event_rec.type =3D type; event_rec.validity_flags =3D 1; event_rec.host_id =3D 0; diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c index 6cfdd98168f9..e9528da70cc4 100644 --- a/hw/cxl/cxl-mailbox-utils.c +++ b/hw/cxl/cxl-mailbox-utils.c @@ -3458,7 +3458,8 @@ static CXLRetCode cmd_fm_set_dc_region_config(const s= truct cxl_cmd *cmd, &dynamic_capacity_uuid, (1 << CXL_EVENT_TYPE_INFO), sizeof(dcEvent), - cxl_device_get_timestamp(&ct3d->cxl_dstate)); + cxl_device_get_timestamp(&ct3d->cxl_dstate), + 0, 0, 0, 0, 0, 0, 0, 0); dcEvent.type =3D DC_EVENT_REGION_CONFIG_UPDATED; dcEvent.validity_flags =3D 1; dcEvent.host_id =3D 0; diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c index 6eb20137a04f..371bd4dc6ab2 100644 --- a/hw/mem/cxl_type3.c +++ b/hw/mem/cxl_type3.c @@ -1592,12 +1592,39 @@ void qmp_cxl_inject_correctable_error(const char *p= ath, CxlCorErrorType type, =20 void cxl_assign_event_header(CXLEventRecordHdr *hdr, const QemuUUID *uuid, uint32_t flags, - uint8_t length, uint64_t timestamp) + uint8_t length, uint64_t timestamp, + bool has_maint_op_class, uint8_t maint_op_cla= ss, + bool has_maint_op_subclass, + uint8_t maint_op_subclass, + bool has_ld_id, uint16_t ld_id, + bool has_head_id, uint8_t head_id) { - st24_le_p(&hdr->flags, flags); hdr->length =3D length; memcpy(&hdr->id, uuid, sizeof(hdr->id)); stq_le_p(&hdr->timestamp, timestamp); + + if (has_maint_op_class) { + hdr->maint_op_class =3D maint_op_class; + } else { + hdr->maint_op_class =3D 0; + } + + if (has_maint_op_subclass) { + flags |=3D CXL_EVENT_REC_FLAGS_MAINT_OP_SUBCLASS_VALID; + hdr->maint_op_subclass =3D maint_op_subclass; + } + + if (has_ld_id) { + flags |=3D CXL_EVENT_REC_FLAGS_LD_ID_VALID; + stw_le_p(&hdr->ld_id, ld_id); + } + + if (has_head_id) { + flags |=3D CXL_EVENT_REC_FLAGS_HEAD_ID_VALID; + hdr->head_id =3D head_id; + } + + st24_le_p(&hdr->flags, flags); } =20 static const QemuUUID gen_media_uuid =3D { @@ -1637,7 +1664,13 @@ static int ct3d_qmp_cxl_event_log_enc(CxlEventLog lo= g) } /* Component ID is device specific. Define this as a string. */ void qmp_cxl_inject_general_media_event(const char *path, CxlEventLog log, - uint8_t flags, uint64_t dpa, + uint32_t flags, bool has_maint_op_= class, + uint8_t maint_op_class, + bool has_maint_op_subclass, + uint8_t maint_op_subclass, + bool has_ld_id, uint16_t ld_id, + bool has_head_id, uint8_t head_id, + uint64_t dpa, uint8_t descriptor, uint8_t type, uint8_t transaction_type, bool has_channel, uint8_t channel, @@ -1675,7 +1708,10 @@ void qmp_cxl_inject_general_media_event(const char *= path, CxlEventLog log, =20 memset(&gem, 0, sizeof(gem)); cxl_assign_event_header(hdr, &gen_media_uuid, flags, sizeof(gem), - cxl_device_get_timestamp(&ct3d->cxl_dstate)); + cxl_device_get_timestamp(&ct3d->cxl_dstate), + has_maint_op_class, maint_op_class, + has_maint_op_subclass, maint_op_subclass, + has_ld_id, ld_id, has_head_id, head_id); =20 stq_le_p(&gem.phys_addr, dpa); gem.descriptor =3D descriptor; @@ -1719,7 +1755,13 @@ void qmp_cxl_inject_general_media_event(const char *= path, CxlEventLog log, #define CXL_DRAM_VALID_COLUMN BIT(6) #define CXL_DRAM_VALID_CORRECTION_MASK BIT(7) =20 -void qmp_cxl_inject_dram_event(const char *path, CxlEventLog log, uint8_t = flags, +void qmp_cxl_inject_dram_event(const char *path, CxlEventLog log, + uint32_t flags, + bool has_maint_op_class, uint8_t maint_op_c= lass, + bool has_maint_op_subclass, + uint8_t maint_op_subclass, + bool has_ld_id, uint16_t ld_id, + bool has_head_id, uint8_t head_id, uint64_t dpa, uint8_t descriptor, uint8_t type, uint8_t transaction_type, bool has_channel, uint8_t channel, @@ -1762,7 +1804,10 @@ void qmp_cxl_inject_dram_event(const char *path, Cxl= EventLog log, uint8_t flags, =20 memset(&dram, 0, sizeof(dram)); cxl_assign_event_header(hdr, &dram_uuid, flags, sizeof(dram), - cxl_device_get_timestamp(&ct3d->cxl_dstate)); + cxl_device_get_timestamp(&ct3d->cxl_dstate), + has_maint_op_class, maint_op_class, + has_maint_op_subclass, maint_op_subclass, + has_ld_id, ld_id, has_head_id, head_id); stq_le_p(&dram.phys_addr, dpa); dram.descriptor =3D descriptor; dram.type =3D type; @@ -1822,7 +1867,13 @@ void qmp_cxl_inject_dram_event(const char *path, Cxl= EventLog log, uint8_t flags, } =20 void qmp_cxl_inject_memory_module_event(const char *path, CxlEventLog log, - uint8_t flags, uint8_t type, + uint32_t flags, bool has_maint_op_= class, + uint8_t maint_op_class, + bool has_maint_op_subclass, + uint8_t maint_op_subclass, + bool has_ld_id, uint16_t ld_id, + bool has_head_id, uint8_t head_id, + uint8_t type, uint8_t health_status, uint8_t media_status, uint8_t additional_status, @@ -1861,7 +1912,10 @@ void qmp_cxl_inject_memory_module_event(const char *= path, CxlEventLog log, =20 memset(&module, 0, sizeof(module)); cxl_assign_event_header(hdr, &memory_module_uuid, flags, sizeof(module= ), - cxl_device_get_timestamp(&ct3d->cxl_dstate)); + cxl_device_get_timestamp(&ct3d->cxl_dstate), + has_maint_op_class, maint_op_class, + has_maint_op_subclass, maint_op_subclass, + has_ld_id, ld_id, has_head_id, head_id); =20 module.type =3D type; module.health_status =3D health_status; diff --git a/hw/mem/cxl_type3_stubs.c b/hw/mem/cxl_type3_stubs.c index c1a5e4a7c193..91b1478114d9 100644 --- a/hw/mem/cxl_type3_stubs.c +++ b/hw/mem/cxl_type3_stubs.c @@ -14,7 +14,13 @@ #include "qapi/qapi-commands-cxl.h" =20 void qmp_cxl_inject_general_media_event(const char *path, CxlEventLog log, - uint8_t flags, uint64_t dpa, + uint32_t flags, bool has_maint_op_= class, + uint8_t maint_op_class, + bool has_maint_op_subclass, + uint8_t maint_op_subclass, + bool has_ld_id, uint16_t ld_id, + bool has_head_id, uint8_t head_id, + uint64_t dpa, uint8_t descriptor, uint8_t type, uint8_t transaction_type, bool has_channel, uint8_t channel, @@ -23,7 +29,13 @@ void qmp_cxl_inject_general_media_event(const char *path= , CxlEventLog log, const char *component_id, Error **errp) {} =20 -void qmp_cxl_inject_dram_event(const char *path, CxlEventLog log, uint8_t = flags, +void qmp_cxl_inject_dram_event(const char *path, CxlEventLog log, + uint32_t flags, + bool has_maint_op_class, uint8_t maint_op_c= lass, + bool has_maint_op_subclass, + uint8_t maint_op_subclass, + bool has_ld_id, uint16_t ld_id, + bool has_head_id, uint8_t head_id, uint64_t dpa, uint8_t descriptor, uint8_t type, uint8_t transaction_type, bool has_channel, uint8_t channel, @@ -38,7 +50,13 @@ void qmp_cxl_inject_dram_event(const char *path, CxlEven= tLog log, uint8_t flags, Error **errp) {} =20 void qmp_cxl_inject_memory_module_event(const char *path, CxlEventLog log, - uint8_t flags, uint8_t type, + uint32_t flags, bool has_maint_op_= class, + uint8_t maint_op_class, + bool has_maint_op_subclass, + uint8_t maint_op_subclass, + bool has_ld_id, uint16_t ld_id, + bool has_head_id, uint8_t head_id, + uint8_t type, uint8_t health_status, uint8_t media_status, uint8_t additional_status, --=20 2.51.0 From nobody Sat Feb 7 04:47:06 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1770290733; cv=none; d=zohomail.com; s=zohoarc; b=gsoXadRsTtapPpA8JxKjKgegq7ywWdYtxDvhM/rPdkknYcgQP+KFA55T7nEBDoxl3X3LwQMMvhEnTSo2oGPECutMoJ4syFQ0bvqjQB6NzPoN4E6qc8WPalxlgNdnZS0vviUyUzKsjzBWwTnEeWqJBuPfwk8cctZDgyEmAsyUxG8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770290733; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=fclbF4Fz8V8ZrZXribqZNI6b4nNSrn1OpHJhD0x/JS0=; b=UT2w+ytXKi+5jh/L1UR6iLH3RPTkB81+gkmn6/+tzyKrDPpEJpsp7xjRYGXiY1veaNt3fd9u+MnLYJ3Uiylap1opFtjTUHpZN0IeoZWlgwiIAjxlOh4sjy7RubEwLnjFrmlFCA3M0KvHyAhY7A+hBIHAn5I5D4FaSmZsGAQUalY= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770290733183747.9983459175318; Thu, 5 Feb 2026 03:25:33 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vnxUH-0002GQ-KX; Thu, 05 Feb 2026 06:25:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vnxUG-0002EV-NE for qemu-devel@nongnu.org; Thu, 05 Feb 2026 06:25:28 -0500 Received: from frasgout.his.huawei.com ([185.176.79.56]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vnxUE-0005WB-Ki for qemu-devel@nongnu.org; Thu, 05 Feb 2026 06:25:28 -0500 Received: from mail.maildlp.com (unknown [172.18.224.150]) by frasgout.his.huawei.com (SkyGuard) with ESMTPS id 4f6FHQ21ySzJ46Dq; Thu, 5 Feb 2026 19:24:34 +0800 (CST) Received: from dubpeml500005.china.huawei.com (unknown [7.214.145.207]) by mail.maildlp.com (Postfix) with ESMTPS id D352140539; Thu, 5 Feb 2026 19:25:24 +0800 (CST) Received: from SecurePC-101-06.huawei.com (10.122.19.247) by dubpeml500005.china.huawei.com (7.214.145.207) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 5 Feb 2026 11:25:24 +0000 To: Michael Tsirkin , , , Ravi Shankar , , Ravi Jonnalagadda CC: , Subject: [PATCH qemu v5 3/5] hw/cxl/events: Updates for rev3.2 general media event record Date: Thu, 5 Feb 2026 11:23:48 +0000 Message-ID: <20260205112350.60681-4-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260205112350.60681-1-Jonathan.Cameron@huawei.com> References: <20260205112350.60681-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.122.19.247] X-ClientProxiedBy: lhrpeml100009.china.huawei.com (7.191.174.83) To dubpeml500005.china.huawei.com (7.214.145.207) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=185.176.79.56; envelope-from=jonathan.cameron@huawei.com; helo=frasgout.his.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Jonathan Cameron From: Jonathan Cameron via qemu development Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1770290735563158500 Content-Type: text/plain; charset="utf-8" From: Shiju Jose CXL spec rev3.2 section 8.2.10.2.1.1 Table 8-57, general media event table has updated with following new fields. 1. Advanced Programmable Corrected Memory Error Threshold Event Flags 2. Corrected Memory Error Count at Event 3. Memory Event Sub-Type 4. Support for component ID in the PLDM format. Add updates for the above spec changes in the CXL general media event reporting and QMP command to inject general media event. In order to have one consistent source of references, update all to references for this command to CXL r3.2. Signed-off-by: Shiju Jose Acked-by: Markus Armbruster Signed-off-by: Jonathan Cameron --- v5: Move setting of gem.descriptor later so that updated value is stored correctly (Ravi) --- qapi/cxl.json | 29 +++++++++++++++++++++-------- include/hw/cxl/cxl_events.h | 7 +++++-- hw/mem/cxl_type3.c | 31 ++++++++++++++++++++++++++++++- hw/mem/cxl_type3_stubs.c | 6 ++++++ 4 files changed, 62 insertions(+), 11 deletions(-) diff --git a/qapi/cxl.json b/qapi/cxl.json index 82001c0591d8..4ff66fc6c16c 100644 --- a/qapi/cxl.json +++ b/qapi/cxl.json @@ -64,22 +64,22 @@ ## # @CXLGeneralMediaEvent: # -# Event record for a General Media Event (CXL r3.0 8.2.9.2.1.1). +# Event record for a General Media Event (CXL r3.2 8.2.10.2.1.1). # # @dpa: Device Physical Address (relative to @path device). Note -# lower bits include some flags. See CXL r3.0 Table 8-43 General +# lower bits include some flags. See CXL r3.2 Table 8-57 General # Media Event Record, Physical Address. # # @descriptor: Memory Event Descriptor with additional memory event -# information. See CXL r3.0 Table 8-43 General Media Event +# information. See CXL r3.2 Table 8-57 General Media Event # Record, Memory Event Descriptor for bit definitions. # -# @type: Type of memory event that occurred. See CXL r3.0 Table 8-43 +# @type: Type of memory event that occurred. See CXL r3.2 Table 8-57 # General Media Event Record, Memory Event Type for possible # values. # # @transaction-type: Type of first transaction that caused the event -# to occur. See CXL r3.0 Table 8-43 General Media Event Record, +# to occur. See CXL r3-2 Table 8-57 General Media Event Record, # Transaction Type for possible values. # # @channel: The channel of the memory event location. A channel is an @@ -94,6 +94,16 @@ # @component-id: Device specific component identifier for the event. # May describe a field replaceable sub-component of the device. # +# @is-comp-id-pldm: This flag specifies whether the device-specific +# component identifier format follows PLDM. +# +# @cme-ev-flags: Advanced programmable corrected memory error +# threshold event flags. +# +# @cme-count: Corrected memory error count at event. +# +# @sub-type: Memory event sub-type. +# # Since: 8.1 ## { 'struct': 'CXLGeneralMediaEvent', @@ -101,13 +111,16 @@ 'data': { 'dpa': 'uint64', 'descriptor': 'uint8', 'type': 'uint8', 'transaction-type': 'uint8', '*channel': 'uint8', '*rank': 'uint8', - '*device': 'uint32', '*component-id': 'str' } } + '*device': 'uint32', '*component-id': 'str', + '*is-comp-id-pldm':'bool', + '*cme-ev-flags':'uint8', '*cme-count':'uint32', + 'sub-type':'uint8' } } =20 ## # @cxl-inject-general-media-event: # -# Inject an event record for a General Media Event (CXL r3.0 -# 8.2.9.2.1.1). This event type is reported via one of the event +# Inject an event record for a General Media Event (CXL r3.2 +# 8.2.10.2.1.1). This event type is reported via one of the event # logs specified via the log parameter. # # Since: 8.1 diff --git a/include/hw/cxl/cxl_events.h b/include/hw/cxl/cxl_events.h index 4d9cfdb621ea..352f9891bd36 100644 --- a/include/hw/cxl/cxl_events.h +++ b/include/hw/cxl/cxl_events.h @@ -115,10 +115,10 @@ typedef struct CXLEventInterruptPolicy { =20 /* * General Media Event Record - * CXL r3.1 Section 8.2.9.2.1.1; Table 8-45 + * CXL r3.2 Section 8.2.10.2.1.1; Table 8-57 */ #define CXL_EVENT_GEN_MED_COMP_ID_SIZE 0x10 -#define CXL_EVENT_GEN_MED_RES_SIZE 0x2e +#define CXL_EVENT_GEN_MED_RES_SIZE 0x29 typedef struct CXLEventGenMedia { CXLEventRecordHdr hdr; uint64_t phys_addr; @@ -130,6 +130,9 @@ typedef struct CXLEventGenMedia { uint8_t rank; uint8_t device[3]; uint8_t component_id[CXL_EVENT_GEN_MED_COMP_ID_SIZE]; + uint8_t cme_ev_flags; + uint8_t cme_count[3]; + uint8_t sub_type; uint8_t reserved[CXL_EVENT_GEN_MED_RES_SIZE]; } QEMU_PACKED CXLEventGenMedia; =20 diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c index 371bd4dc6ab2..229be8870864 100644 --- a/hw/mem/cxl_type3.c +++ b/hw/mem/cxl_type3.c @@ -1646,6 +1646,11 @@ static const QemuUUID memory_module_uuid =3D { #define CXL_GMER_VALID_RANK BIT(1) #define CXL_GMER_VALID_DEVICE BIT(2) #define CXL_GMER_VALID_COMPONENT BIT(3) +#define CXL_GMER_VALID_COMPONENT_ID_FORMAT BIT(4) + +#define CXL_GMER_EV_DESC_UCE BIT(0) +#define CXL_GMER_EV_DESC_THRESHOLD_EVENT BIT(1) +#define CXL_GMER_EV_DESC_POISON_LIST_OVERFLOW_EVENT BIT(2) =20 static int ct3d_qmp_cxl_event_log_enc(CxlEventLog log) { @@ -1677,6 +1682,12 @@ void qmp_cxl_inject_general_media_event(const char *= path, CxlEventLog log, bool has_rank, uint8_t rank, bool has_device, uint32_t device, const char *component_id, + bool has_comp_id_pldm, + bool is_comp_id_pldm, + bool has_cme_ev_flags, + uint8_t cme_ev_flags, + bool has_cme_count, uint32_t cme_c= ount, + uint8_t sub_type, Error **errp) { Object *obj =3D object_resolve_path(path, NULL); @@ -1714,7 +1725,6 @@ void qmp_cxl_inject_general_media_event(const char *p= ath, CxlEventLog log, has_ld_id, ld_id, has_head_id, head_id); =20 stq_le_p(&gem.phys_addr, dpa); - gem.descriptor =3D descriptor; gem.type =3D type; gem.transaction_type =3D transaction_type; =20 @@ -1737,10 +1747,29 @@ void qmp_cxl_inject_general_media_event(const char = *path, CxlEventLog log, strncpy((char *)gem.component_id, component_id, sizeof(gem.component_id) - 1); valid_flags |=3D CXL_GMER_VALID_COMPONENT; + if (has_comp_id_pldm && is_comp_id_pldm) { + valid_flags |=3D CXL_GMER_VALID_COMPONENT_ID_FORMAT; + } } =20 stw_le_p(&gem.validity_flags, valid_flags); =20 + if (has_cme_ev_flags) { + gem.cme_ev_flags =3D cme_ev_flags; + } else { + gem.cme_ev_flags =3D 0; + } + + if (has_cme_count) { + descriptor |=3D CXL_GMER_EV_DESC_THRESHOLD_EVENT; + st24_le_p(gem.cme_count, cme_count); + } else { + st24_le_p(gem.cme_count, 0); + } + gem.descriptor =3D descriptor; + + gem.sub_type =3D sub_type; + if (cxl_event_insert(cxlds, enc_log, (CXLEventRecordRaw *)&gem)) { cxl_event_irq_assert(ct3d); } diff --git a/hw/mem/cxl_type3_stubs.c b/hw/mem/cxl_type3_stubs.c index 91b1478114d9..2047e9784694 100644 --- a/hw/mem/cxl_type3_stubs.c +++ b/hw/mem/cxl_type3_stubs.c @@ -27,6 +27,12 @@ void qmp_cxl_inject_general_media_event(const char *path= , CxlEventLog log, bool has_rank, uint8_t rank, bool has_device, uint32_t device, const char *component_id, + bool has_comp_id_pldm, + bool is_comp_id_pldm, + bool has_cme_ev_flags, + uint8_t cme_ev_flags, + bool has_cme_count, uint32_t cme_c= ount, + uint8_t sub_type, Error **errp) {} =20 void qmp_cxl_inject_dram_event(const char *path, CxlEventLog log, --=20 2.51.0 From nobody Sat Feb 7 04:47:06 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1770290768; cv=none; d=zohomail.com; s=zohoarc; b=He947A2xFP2s7S7FzQ9cpCK1ZhpzL12vuVbZ7tokQ7VmEWdgMicopiVBD0yfr6MuMjqe7yxf+erukW3ioJrMpAzIFQslpmfPig0TJoL6E5BzW8zvppkxmdOjrSJcwPuekx6QyMbQWdpfspqC0V+UMWYsi4oKfPAQ6J728zq4EA0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770290768; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=9ODyzHAM8+38NVecSgXRywbfE7ojxLFVGymi3JHOsnQ=; b=eNLLUTsyfeuUcKiDGmU/HiyG/dXBMugys0oihXhsr3IBfJiKSLVyjNZDziHMDB5RaA7xV+v8kbzn15MDvF9jn4GzyhbqqE6XoVm8cOtfz4hn55jsqny5hSVf/ExHweKY1WjcegIGRixMLOkmldBWaWl/A9qr0ch9a3qjvJWt5BE= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770290768749955.6790869398413; Thu, 5 Feb 2026 03:26:08 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vnxUn-0002f7-4F; Thu, 05 Feb 2026 06:26:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vnxUl-0002eu-9X for qemu-devel@nongnu.org; Thu, 05 Feb 2026 06:25:59 -0500 Received: from frasgout.his.huawei.com ([185.176.79.56]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vnxUj-0005aO-Aq for qemu-devel@nongnu.org; Thu, 05 Feb 2026 06:25:59 -0500 Received: from mail.maildlp.com (unknown [172.18.224.83]) by frasgout.his.huawei.com (SkyGuard) with ESMTPS id 4f6FJx3s2LzHnGd2; Thu, 5 Feb 2026 19:25:53 +0800 (CST) Received: from dubpeml500005.china.huawei.com (unknown [7.214.145.207]) by mail.maildlp.com (Postfix) with ESMTPS id D8D6240569; Thu, 5 Feb 2026 19:25:55 +0800 (CST) Received: from SecurePC-101-06.huawei.com (10.122.19.247) by dubpeml500005.china.huawei.com (7.214.145.207) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 5 Feb 2026 11:25:55 +0000 To: Michael Tsirkin , , , Ravi Shankar , , Ravi Jonnalagadda CC: , Subject: [PATCH qemu v5 4/5] hw/cxl/events: Updates for rev3.2 DRAM event record Date: Thu, 5 Feb 2026 11:23:49 +0000 Message-ID: <20260205112350.60681-5-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260205112350.60681-1-Jonathan.Cameron@huawei.com> References: <20260205112350.60681-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.122.19.247] X-ClientProxiedBy: lhrpeml100009.china.huawei.com (7.191.174.83) To dubpeml500005.china.huawei.com (7.214.145.207) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=185.176.79.56; envelope-from=jonathan.cameron@huawei.com; helo=frasgout.his.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Jonathan Cameron From: Jonathan Cameron via qemu development Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1770290769564158500 Content-Type: text/plain; charset="utf-8" From: Shiju Jose 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 Acked-by: Markus Armbruster Signed-off-by: Jonathan Cameron --- v5: Move setting of gem.descriptor later to ensure update is correctly stored (Ravi) --- qapi/cxl.json | 33 ++++++++++++++++++++++------ include/hw/cxl/cxl_events.h | 9 ++++++-- hw/mem/cxl_type3.c | 44 ++++++++++++++++++++++++++++++++++++- hw/mem/cxl_type3_stubs.c | 7 ++++++ 4 files changed, 83 insertions(+), 10 deletions(-) diff --git a/qapi/cxl.json b/qapi/cxl.json index 4ff66fc6c16c..1dc8b08ca301 100644 --- a/qapi/cxl.json +++ b/qapi/cxl.json @@ -131,21 +131,21 @@ ## # @CXLDRAMEvent: # -# Event record for a DRAM Event (CXL r3.0 8.2.9.2.1.2). +# Event record for a DRAM Event (CXL r3.2 8.2.10.2.1.2). # # @dpa: Device Physical Address (relative to @path device). Note -# lower bits include some flags. See CXL r3.0 Table 8-44 DRAM +# lower bits include some flags. See CXL r3.2 Table 8-58 DRAM # Event Record, Physical Address. # # @descriptor: Memory Event Descriptor with additional memory event -# information. See CXL r3.0 Table 8-44 DRAM Event Record, Memory +# information. See CXL r3.2 Table 8-58 DRAM Event Record, Memory # Event Descriptor for bit definitions. # -# @type: Type of memory event that occurred. See CXL r3.0 Table 8-44 +# @type: Type of memory event that occurred. See CXL r3.2 Table 8-58 # DRAM Event Record, Memory Event Type for possible values. # # @transaction-type: Type of first transaction that caused the event -# to occur. See CXL r3.0 Table 8-44 DRAM Event Record, +# to occur. See CXL r3.2 Table 8-58 DRAM Event Record, # Transaction Type for possible values. # # @channel: The channel of the memory event location. A channel is an @@ -169,6 +169,21 @@ # @correction-mask: Bits within each nibble. Used in order of bits # set in the nibble-mask. Up to 4 nibbles may be covered. # +# @component-id: Device specific component identifier for the event. +# May describe a field replaceable sub-component of the device. +# +# @is-comp-id-pldm: This flag specifies whether the device-specific +# component identifier format follows PLDM. +# +# @sub-channel: The sub-channel of the memory event location. +# +# @cme-ev-flags: Advanced programmable corrected memory error +# threshold event flags. +# +# @cvme-count: Corrected volatile memory error count at event. +# +# @sub-type: Memory event sub-type. +# # Since: 8.1 ## { 'struct': 'CXLDRAMEvent', @@ -177,13 +192,17 @@ 'type': 'uint8', 'transaction-type': 'uint8', '*channel': 'uint8', '*rank': 'uint8', '*nibble-mask': 'uint32= ', '*bank-group': 'uint8', '*bank': 'uint8', '*row': 'uint32', - '*column': 'uint16', '*correction-mask': [ 'uint64' ] + '*column': 'uint16', '*correction-mask': [ 'uint64' ], + '*component-id': 'str', '*is-comp-id-pldm':'bool', + '*sub-channel':'uint8', + '*cme-ev-flags':'uint8', '*cvme-count':'uint32', + 'sub-type':'uint8' }} =20 ## # @cxl-inject-dram-event: # -# Inject an event record for a DRAM Event (CXL r3.0 8.2.9.2.1.2). +# Inject an event record for a DRAM Event (CXL r3.2 8.2.10.2.1.2). # This event type is reported via one of the event logs # specified via the log parameter. # diff --git a/include/hw/cxl/cxl_events.h b/include/hw/cxl/cxl_events.h index 352f9891bd36..a3c5f2ec20e6 100644 --- a/include/hw/cxl/cxl_events.h +++ b/include/hw/cxl/cxl_events.h @@ -138,7 +138,7 @@ typedef struct CXLEventGenMedia { =20 /* * DRAM Event Record - * CXL r3.1 Section 8.2.9.2.1.2: Table 8-46 + * CXL r3.2 Section 8.2.10.2.1.2: Table 8-58 * All fields little endian. */ typedef struct CXLEventDram { @@ -156,7 +156,12 @@ typedef struct CXLEventDram { uint8_t row[3]; uint16_t column; uint64_t correction_mask[4]; - uint8_t reserved[0x17]; + uint8_t component_id[CXL_EVENT_GEN_MED_COMP_ID_SIZE]; + uint8_t sub_channel; + uint8_t cme_ev_flags; + uint8_t cvme_count[3]; + uint8_t sub_type; + uint8_t reserved; } QEMU_PACKED CXLEventDram; =20 /* diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c index 229be8870864..be99d20fafb4 100644 --- a/hw/mem/cxl_type3.c +++ b/hw/mem/cxl_type3.c @@ -1783,6 +1783,13 @@ void qmp_cxl_inject_general_media_event(const char *= path, CxlEventLog log, #define CXL_DRAM_VALID_ROW BIT(5) #define CXL_DRAM_VALID_COLUMN BIT(6) #define CXL_DRAM_VALID_CORRECTION_MASK BIT(7) +#define CXL_DRAM_VALID_COMPONENT BIT(8) +#define CXL_DRAM_VALID_COMPONENT_ID_FORMAT BIT(9) +#define CXL_DRAM_VALID_SUB_CHANNEL BIT(10) + +#define CXL_DRAM_EV_DESC_UCE BIT(0) +#define CXL_DRAM_EV_DESC_THRESHOLD_EVENT BIT(1) +#define CXL_DRAM_EV_DESC_POISON_LIST_OVERFLOW_EVENT BIT(2) =20 void qmp_cxl_inject_dram_event(const char *path, CxlEventLog log, uint32_t flags, @@ -1802,6 +1809,12 @@ void qmp_cxl_inject_dram_event(const char *path, Cxl= EventLog log, bool has_column, uint16_t column, bool has_correction_mask, uint64List *correction_mask, + const char *component_id, + bool has_comp_id_pldm, bool is_comp_id_pldm, + bool has_sub_channel, uint8_t sub_channel, + bool has_cme_ev_flags, uint8_t cme_ev_flags, + bool has_cvme_count, uint32_t cvme_count, + uint8_t sub_type, Error **errp) { Object *obj =3D object_resolve_path(path, NULL); @@ -1838,7 +1851,6 @@ void qmp_cxl_inject_dram_event(const char *path, CxlE= ventLog log, has_maint_op_subclass, maint_op_subclass, has_ld_id, ld_id, has_head_id, head_id); stq_le_p(&dram.phys_addr, dpa); - dram.descriptor =3D descriptor; dram.type =3D type; dram.transaction_type =3D transaction_type; =20 @@ -1888,6 +1900,36 @@ void qmp_cxl_inject_dram_event(const char *path, Cxl= EventLog log, valid_flags |=3D CXL_DRAM_VALID_CORRECTION_MASK; } =20 + if (component_id) { + strncpy((char *)dram.component_id, component_id, + sizeof(dram.component_id) - 1); + valid_flags |=3D CXL_DRAM_VALID_COMPONENT; + if (has_comp_id_pldm && is_comp_id_pldm) { + valid_flags |=3D CXL_DRAM_VALID_COMPONENT_ID_FORMAT; + } + } + + if (has_sub_channel) { + dram.sub_channel =3D sub_channel; + valid_flags |=3D CXL_DRAM_VALID_SUB_CHANNEL; + } + + if (has_cme_ev_flags) { + dram.cme_ev_flags =3D cme_ev_flags; + } else { + dram.cme_ev_flags =3D 0; + } + + if (has_cvme_count) { + descriptor |=3D CXL_DRAM_EV_DESC_THRESHOLD_EVENT; + st24_le_p(dram.cvme_count, cvme_count); + } else { + st24_le_p(dram.cvme_count, 0); + } + dram.descriptor =3D descriptor; + + dram.sub_type =3D sub_type; + stw_le_p(&dram.validity_flags, valid_flags); =20 if (cxl_event_insert(cxlds, enc_log, (CXLEventRecordRaw *)&dram)) { diff --git a/hw/mem/cxl_type3_stubs.c b/hw/mem/cxl_type3_stubs.c index 2047e9784694..231dda263fa4 100644 --- a/hw/mem/cxl_type3_stubs.c +++ b/hw/mem/cxl_type3_stubs.c @@ -53,6 +53,13 @@ void qmp_cxl_inject_dram_event(const char *path, CxlEven= tLog log, bool has_column, uint16_t column, bool has_correction_mask, uint64List *correction_mask, + const char *component_id, + bool has_comp_id_pldm, + bool is_comp_id_pldm, + bool has_sub_channel, uint8_t sub_channel, + bool has_cme_ev_flags, uint8_t cme_ev_flags, + bool has_cvme_count, uint32_t cvme_count, + uint8_t sub_type, Error **errp) {} =20 void qmp_cxl_inject_memory_module_event(const char *path, CxlEventLog log, --=20 2.51.0 From nobody Sat Feb 7 04:47:06 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1770290808; cv=none; d=zohomail.com; s=zohoarc; b=AJ7eYslxynPMBxbfqnmQxe5Cjk8W58b8KgXob5MDB1cP9iCvEy8qwxWyFEtJlwLnnvPnS8XZ0OjxZfnv2ipZ1YijppZP8T09goIYF2mu7mIb6L48ThACbNXOcY+FpZ70Q3lDf6XFpVIjJhIW3+Rjx+V3q9L91asN5/xKfenNidI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770290808; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=wqMEBTz4wMUoJa09WWbaHn1mO9Spl1sFxn2bCZXNch0=; b=L9K3oXSMwHfC1Jh7f5chSCDEBGg19Afo5WlXe+cpIekN+hwHDKBplkS1VfE8SRfcfNnbnTz2RmTG7WAL99yzh1ymglGgl65G8nRz+Ei2TOCvLDBuc1CC9RN2IXNMYbGBaAGAVf4pw+R+zwqwfqEvi0XX2UlrXxg6HwqIWN/MSBw= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1770290808091532.3934793104106; Thu, 5 Feb 2026 03:26:48 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vnxVH-0003Qo-6H; Thu, 05 Feb 2026 06:26:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vnxVF-0003Pj-Sn for qemu-devel@nongnu.org; Thu, 05 Feb 2026 06:26:29 -0500 Received: from frasgout.his.huawei.com ([185.176.79.56]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vnxVE-0005f0-0H for qemu-devel@nongnu.org; Thu, 05 Feb 2026 06:26:29 -0500 Received: from mail.maildlp.com (unknown [172.18.224.83]) by frasgout.his.huawei.com (SkyGuard) with ESMTPS id 4f6FKX3HNDzHnGhl; Thu, 5 Feb 2026 19:26:24 +0800 (CST) Received: from dubpeml500005.china.huawei.com (unknown [7.214.145.207]) by mail.maildlp.com (Postfix) with ESMTPS id C5E5140569; Thu, 5 Feb 2026 19:26:26 +0800 (CST) Received: from SecurePC-101-06.huawei.com (10.122.19.247) by dubpeml500005.china.huawei.com (7.214.145.207) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 5 Feb 2026 11:26:26 +0000 To: Michael Tsirkin , , , Ravi Shankar , , Ravi Jonnalagadda CC: , Subject: [PATCH qemu v5 5/5] hw/cxl/events: Updates for rev3.2 memory module event record Date: Thu, 5 Feb 2026 11:23:50 +0000 Message-ID: <20260205112350.60681-6-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260205112350.60681-1-Jonathan.Cameron@huawei.com> References: <20260205112350.60681-1-Jonathan.Cameron@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.122.19.247] X-ClientProxiedBy: lhrpeml100009.china.huawei.com (7.191.174.83) To dubpeml500005.china.huawei.com (7.214.145.207) Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=185.176.79.56; envelope-from=jonathan.cameron@huawei.com; helo=frasgout.his.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Jonathan Cameron From: Jonathan Cameron via qemu development Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1770290809776158501 Content-Type: text/plain; charset="utf-8" From: Shiju Jose 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 Acked-by: Markus Armbruster Signed-off-by: Jonathan Cameron --- v5: Fix table reference in commit message. 8-50 is completely unrelated to this change, should be 8-59 (Ravi) --- qapi/cxl.json | 30 ++++++++++++++++++++---------- include/hw/cxl/cxl_events.h | 7 +++++-- hw/mem/cxl_type3.c | 20 ++++++++++++++++++++ hw/mem/cxl_type3_stubs.c | 4 ++++ 4 files changed, 49 insertions(+), 12 deletions(-) diff --git a/qapi/cxl.json b/qapi/cxl.json index 1dc8b08ca301..81d6198ba030 100644 --- a/qapi/cxl.json +++ b/qapi/cxl.json @@ -214,20 +214,20 @@ ## # @CXLMemModuleEvent: # -# Event record for a Memory Module Event (CXL r3.0 8.2.9.2.1.3). +# Event record for a Memory Module Event (CXL r3.2 8.2.10.2.1.3). # -# @type: Device Event Type. See CXL r3.0 Table 8-45 Memory Module +# @type: Device Event Type. See CXL r3.2 Table 8-59 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 +# @health-status: Overall health summary bitmap. See CXL r3.2 Table +# 8-148 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 +# @media-status: Overall media health summary. See CXL r3.2 Table +# 8-148 Get Health Info Output Payload, Media Status for bit # definitions. # -# @additional-status: See CXL r3.0 Table 8-100 Get Health Info Output +# @additional-status: See CXL r3.2 Table 8-148 Get Health Info Output # Payload, Additional Status for subfield definitions. # # @life-used: Percentage (0-100) of factory expected life span. @@ -243,6 +243,14 @@ # @corrected-persistent-error-count: Total number of correctable # errors in persistent memory # +# @component-id: Device specific component identifier for the event. +# May describe a field replaceable sub-component of the device. +# +# @is-comp-id-pldm: This flag specifies whether the device-specific +# component identifier format follows PLDM. +# +# @sub-type: Device event sub-type. +# # Since: 8.1 ## { 'struct': 'CXLMemModuleEvent', @@ -252,14 +260,16 @@ 'life-used': 'uint8', 'temperature' : 'int16', 'dirty-shutdown-count': 'uint32', 'corrected-volatile-error-count': 'uint32', - 'corrected-persistent-error-count': 'uint32' + 'corrected-persistent-error-count': 'uint32', + '*component-id': 'str', '*is-comp-id-pldm':'bool', + 'sub-type':'uint8' }} =20 ## # @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 info +# Inject an event record for a Memory Module Event (CXL r3.2 +# 8.2.10.2.1.3). This event includes a copy of the Device Health info # at the time of the event. # # Since: 8.1 diff --git a/include/hw/cxl/cxl_events.h b/include/hw/cxl/cxl_events.h index a3c5f2ec20e6..4a7836ad7227 100644 --- a/include/hw/cxl/cxl_events.h +++ b/include/hw/cxl/cxl_events.h @@ -166,7 +166,7 @@ typedef struct CXLEventDram { =20 /* * Memory Module Event Record - * CXL r3.1 Section 8.2.9.2.1.3: Table 8-47 + * CXL r3.2 Section 8.2.10.2.1.3: Table 8-59 * All fields little endian. */ typedef struct CXLEventMemoryModule { @@ -180,7 +180,10 @@ typedef struct CXLEventMemoryModule { uint32_t dirty_shutdown_count; uint32_t corrected_volatile_error_count; uint32_t corrected_persistent_error_count; - uint8_t reserved[0x3d]; + uint16_t validity_flags; + uint8_t component_id[CXL_EVENT_GEN_MED_COMP_ID_SIZE]; + uint8_t sub_type; + uint8_t reserved[0x2a]; } QEMU_PACKED CXLEventMemoryModule; =20 /* diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c index be99d20fafb4..acb75f8f01e3 100644 --- a/hw/mem/cxl_type3.c +++ b/hw/mem/cxl_type3.c @@ -1937,6 +1937,9 @@ void qmp_cxl_inject_dram_event(const char *path, CxlE= ventLog log, } } =20 +#define CXL_MMER_VALID_COMPONENT BIT(0) +#define CXL_MMER_VALID_COMPONENT_ID_FORMAT BIT(1) + void qmp_cxl_inject_memory_module_event(const char *path, CxlEventLog log, uint32_t flags, bool has_maint_op_= class, uint8_t maint_op_class, @@ -1953,11 +1956,16 @@ void qmp_cxl_inject_memory_module_event(const char = *path, CxlEventLog log, uint32_t dirty_shutdown_count, uint32_t corrected_volatile_error_= count, uint32_t corrected_persist_error_c= ount, + const char *component_id, + bool has_comp_id_pldm, + bool is_comp_id_pldm, + uint8_t sub_type, Error **errp) { Object *obj =3D object_resolve_path(path, NULL); CXLEventMemoryModule module; CXLEventRecordHdr *hdr =3D &module.hdr; + uint16_t valid_flags =3D 0; CXLDeviceState *cxlds; CXLType3Dev *ct3d; uint8_t enc_log; @@ -2000,6 +2008,18 @@ void qmp_cxl_inject_memory_module_event(const char *= path, CxlEventLog log, stl_le_p(&module.corrected_persistent_error_count, corrected_persist_error_count); =20 + if (component_id) { + strncpy((char *)module.component_id, component_id, + sizeof(module.component_id) - 1); + valid_flags |=3D CXL_MMER_VALID_COMPONENT; + if (has_comp_id_pldm && is_comp_id_pldm) { + valid_flags |=3D CXL_MMER_VALID_COMPONENT_ID_FORMAT; + } + } + module.sub_type =3D sub_type; + + stw_le_p(&module.validity_flags, valid_flags); + if (cxl_event_insert(cxlds, enc_log, (CXLEventRecordRaw *)&module)) { cxl_event_irq_assert(ct3d); } diff --git a/hw/mem/cxl_type3_stubs.c b/hw/mem/cxl_type3_stubs.c index 231dda263fa4..98292a931c16 100644 --- a/hw/mem/cxl_type3_stubs.c +++ b/hw/mem/cxl_type3_stubs.c @@ -78,6 +78,10 @@ void qmp_cxl_inject_memory_module_event(const char *path= , CxlEventLog log, uint32_t dirty_shutdown_count, uint32_t corrected_volatile_error_= count, uint32_t corrected_persist_error_c= ount, + const char *component_id, + bool has_comp_id_pldm, + bool is_comp_id_pldm, + uint8_t sub_type, Error **errp) {} =20 void qmp_cxl_inject_poison(const char *path, uint64_t start, uint64_t leng= th, --=20 2.51.0