From patchwork Fri Nov 11 03:12:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alison Schofield X-Patchwork-Id: 18399 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp511567wru; Thu, 10 Nov 2022 19:14:17 -0800 (PST) X-Google-Smtp-Source: AA0mqf7V1Tm3dALEzoA4TR5t40L3fSB3TslAVeOkXhEvyTPsBWmuBoESJgMT4wzfpizixU68agCk X-Received: by 2002:a05:6a00:1f0a:b0:56b:a149:1d89 with SMTP id be10-20020a056a001f0a00b0056ba1491d89mr499334pfb.83.1668136457676; Thu, 10 Nov 2022 19:14:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668136457; cv=none; d=google.com; s=arc-20160816; b=ZDjZdKsDpbkujxg5dPkk3KdTXGtg9Vygrf1B8ljynCQo+4wvAsjTqVVH+J+zGp3OPT NpUpvm4H49P5YyAnzW2dS7iHYZ4ND4RlJG4FCoZ+N8ihLZVtO7gP8TwtV8rsjl7eXP5G 7pGYf7UyzCWcmgV8EUOi+XIbcvrapDO3GYIZc71AGcTAWQrQAQDRvQHW3bw/tF+CoHfz zcuNENzk7TY3O11invaIBcMO+effVh9prDN2VyWHENCpcewPh9Un7cIL7GFq30lJmyon B1faSz64QGOX9Z5ZFmRr2DyqokD1E6KiN+MltCK9vkvoWe9+U3fnw/9aiVcjtKUMqpE5 dcpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=SjzHlKfhbC1sArP1J9IPDeTbhAlBFVF1JHlvhXPOW84=; b=YgFDoqGva+PR73eGT7H/+saaPpYF0phQRSx3fntS65ASarDBCUjaa1kyNIgYXv8hqf xw04RTIluA/xC1tGD3FkVsXB/imFPyh1ZJ2Ga1arIQs83CI0LDxxEOJ2AZzA55A2M8NZ YsKCU4WjI98uOwHLpoMj0rDxBrCZ8P/uPdRW35YAPgM5V3uIxWtPXz1ifQJJsYP8KJQ6 f1X/h6d07GWUYG3oo0WSDyl9TTJv9GhjH+Gjwqe9HY1nIm8JhGs05OLENCBFbL0Ep4rI /q18aIWCLdIm5e0yixOmC5cR2WAuV5InidyuD2Fj/38ZYZDZk8wvMRF0y9+StpfhNKkS 5bpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=gwwPesXr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h14-20020a170902f54e00b00178b5e035fcsi1341421plf.496.2022.11.10.19.14.04; Thu, 10 Nov 2022 19:14:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=gwwPesXr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232483AbiKKDM5 (ORCPT + 99 others); Thu, 10 Nov 2022 22:12:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232094AbiKKDMw (ORCPT ); Thu, 10 Nov 2022 22:12:52 -0500 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6ECAF2EF42; Thu, 10 Nov 2022 19:12:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668136371; x=1699672371; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dpT2xSej3sVQoszQCqz3VXjYp4+bosvOJvtGCWIi7qY=; b=gwwPesXrClALuyZh3u3Q6dmPf/XscyQRKq4YVA7rHLZuXs4MTczA2BNg ILKmKjUWWwynFVsSW8EB85mr8xWUR2yhIp8XJ0EhuNEMWUk24S9JL2EAw I4hR77D8b/YTCj+lrhxLq5k4vLYfVZBN9/+8NKoAHc+TmlCzPZmvkGJo6 3qZlH/xYeQWw8/PTc3BdixtlBDCLiWpc6XQ5sX1CPGkXBBfIgTFk/ZPYb u+7oxqh2EEz7TbxXh/lhv6PFnN3WYkLiU8/vbETdPvXht+Kwykbm+XUYl 07TYw3owEUwp1T9nAv/1Y0zA77mAY8vxTLyOt+F9kwZiwmlGs6GD02hyr g==; X-IronPort-AV: E=McAfee;i="6500,9779,10527"; a="310224398" X-IronPort-AV: E=Sophos;i="5.96,155,1665471600"; d="scan'208";a="310224398" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Nov 2022 19:12:51 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10527"; a="812296052" X-IronPort-AV: E=Sophos;i="5.96,155,1665471600"; d="scan'208";a="812296052" Received: from aschofie-mobl2.amr.corp.intel.com (HELO localhost) ([10.209.161.45]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Nov 2022 19:12:50 -0800 From: alison.schofield@intel.com To: Dan Williams , Ira Weiny , Vishal Verma , Dave Jiang , Ben Widawsky , Steven Rostedt , Ingo Molnar Cc: Alison Schofield , linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 1/6] trace, cxl: Introduce a TRACE_EVENT for CXL poison records Date: Thu, 10 Nov 2022 19:12:39 -0800 Message-Id: <5746274c905f57f117987c8268c9f6dc9bd33337.1668115235.git.alison.schofield@intel.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749167854227803546?= X-GMAIL-MSGID: =?utf-8?q?1749167854227803546?= From: Alison Schofield CXL devices may support the retrieval of a device poison list. Introduce a trace event that the CXL subsystem can use to log the poison error records. Signed-off-by: Alison Schofield Reviewed-by: Jonathan Cameron --- drivers/cxl/cxlmem.h | 14 +++++++ include/trace/events/cxl.h | 80 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 include/trace/events/cxl.h diff --git a/drivers/cxl/cxlmem.h b/drivers/cxl/cxlmem.h index 88e3a8e54b6a..669868cc1553 100644 --- a/drivers/cxl/cxlmem.h +++ b/drivers/cxl/cxlmem.h @@ -347,6 +347,20 @@ struct cxl_mbox_set_partition_info { #define CXL_SET_PARTITION_IMMEDIATE_FLAG BIT(0) +/* Get Poison List CXL 3.0 Spec 8.2.9.8.4.1 */ + +/* Get Poison List: Payload out flags */ +#define CXL_POISON_FLAG_MORE BIT(0) +#define CXL_POISON_FLAG_OVERFLOW BIT(1) +#define CXL_POISON_FLAG_SCANNING BIT(2) + +/* Get Poison List: Poison Source */ +#define CXL_POISON_SOURCE_UNKNOWN 0 +#define CXL_POISON_SOURCE_EXTERNAL 1 +#define CXL_POISON_SOURCE_INTERNAL 2 +#define CXL_POISON_SOURCE_INJECTED 3 +#define CXL_POISON_SOURCE_VENDOR 7 + /** * struct cxl_mem_command - Driver representation of a memory device command * @info: Command information as it exists for the UAPI diff --git a/include/trace/events/cxl.h b/include/trace/events/cxl.h new file mode 100644 index 000000000000..03428125573f --- /dev/null +++ b/include/trace/events/cxl.h @@ -0,0 +1,80 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM cxl + +#if !defined(_CXL_TRACE_H) || defined(TRACE_HEADER_MULTI_READ) +#define _CXL_TRACE_H + +#include +#include + +#define __show_poison_source(source) \ + __print_symbolic(source, \ + { CXL_POISON_SOURCE_UNKNOWN, "Unknown" }, \ + { CXL_POISON_SOURCE_EXTERNAL, "External" }, \ + { CXL_POISON_SOURCE_INTERNAL, "Internal" }, \ + { CXL_POISON_SOURCE_INJECTED, "Injected" }, \ + { CXL_POISON_SOURCE_VENDOR, "Vendor" }) + +#define show_poison_source(source) \ + (((source > CXL_POISON_SOURCE_INJECTED) && \ + (source != CXL_POISON_SOURCE_VENDOR)) ? "Reserved" \ + : __show_poison_source(source)) + +#define show_poison_flags(flags) \ + __print_flags(flags, "|", \ + { CXL_POISON_FLAG_MORE, "More" }, \ + { CXL_POISON_FLAG_OVERFLOW, "Overflow" }, \ + { CXL_POISON_FLAG_SCANNING, "Scanning" }) + +TRACE_EVENT(cxl_poison, + + TP_PROTO(const char *memdev, const char *pcidev, const char *region, + const uuid_t *uuid, u64 dpa, u32 length, u8 source, + u8 flags, u64 overflow_t), + + TP_ARGS(memdev, pcidev, region, uuid, dpa, length, source, + flags, overflow_t), + + TP_STRUCT__entry( + __string(memdev, memdev) + __string(pcidev, pcidev) + __string(region, region ? region : "") + __array(char, uuid, 16) + __field(u64, dpa) + __field(u32, length) + __field(u8, source) + __field(u8, flags) + __field(u64, overflow_t) + ), + + TP_fast_assign( + __assign_str(memdev, memdev); + __assign_str(pcidev, pcidev); + __assign_str(region, region ? region : ""); + if (uuid) + memcpy(__entry->uuid, uuid, 16); + __entry->dpa = dpa; + __entry->length = length; + __entry->source = source; + __entry->flags = flags; + __entry->overflow_t = overflow_t; + ), + + TP_printk("memdev=%s pcidev=%s region=%s region_uuid=%pU dpa=0x%llx length=0x%x source=%s flags=%s overflow_time=%llu", + __get_str(memdev), + __get_str(pcidev), + __get_str(region), + __entry->uuid, + __entry->dpa, + __entry->length, + show_poison_source(__entry->source), + show_poison_flags(__entry->flags), + __entry->overflow_t) +); +#endif /* _CXL_TRACE_H */ + +/* This part must be outside protection */ +#undef TRACE_INCLUDE_FILE +#define TRACE_INCLUDE_FILE cxl +#include From patchwork Fri Nov 11 03:12:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alison Schofield X-Patchwork-Id: 18398 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp511423wru; Thu, 10 Nov 2022 19:13:52 -0800 (PST) X-Google-Smtp-Source: AMsMyM4HmkJdEITClBhz6Zsi2KaDgfdj9kZfducz06fPkYx5POFuIDdg5sfn6vwjMDiOw9hOu90k X-Received: by 2002:a65:4908:0:b0:450:3ae9:2590 with SMTP id p8-20020a654908000000b004503ae92590mr4429126pgs.410.1668136432205; Thu, 10 Nov 2022 19:13:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668136432; cv=none; d=google.com; s=arc-20160816; b=hTp2xkL1E80ZTeCH2yQ3/mSOZZPLKTRSJbganZ+EBWvYX57uPM+dYGN1R/fHVc4odi DGeqJBsl4BQguT4qlUZuDnBXamSz9JGI/HL4li7t4w/Azk5QKftIaXw6Z+kAXU6NOiD6 SWOJCArAd9zJcjuQwJ86QTtBJ8CzLC78G02XnqwCBbEQ0DjghnUrnH1GqZ8mRtPPESvq r+bwlI9cJ4wMJLnQyBfv3in07DDCidTRmj5vwF9NIMUCwQW5jk7I50EL06hq4HyA5LfR zAZUfJK7YydIuRf5P1EDFAts2YNSg6RlzR4J1D98iFaKUxJ912CAISba7cMbYhwl4jg+ XuVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Vgfvt0wbPskFvYGNVzv4pyi2qo/Im+Vsqtw0cLgiHXY=; b=aTxHSNzqQYhtJb9gE74EOQWfBfHOQ7NmxsBaxRZ4UKVsZQ0Ke228OCwYmeXKX1ei6q eMSM/EO+rC976zDAJcQxXdddXRLB0x+fVgN0csBW+lh/OeOv+pmyII1tUnKjPLryphgN ztFwNkNR837HcsYE/K09efp9HJNaqIGhlHSxX/7QbKFZwWnA3UZuBZeSai6luVVZktJU S6SL40lOaHYgvnh7MPmBoy1Z8BweGbuo0szJmEyQDeIXrvx4zDdsfTrTcQdMjOOLnzvM sPbVTazBaoDBC19OW0KxkeE3CvCeuzCkCg8hfpVPF4SyKISZbC9rScJE6NIeXfldt8Yl V3dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=E91T1odn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e20-20020a635014000000b0046aeabd6548si1120373pgb.104.2022.11.10.19.13.38; Thu, 10 Nov 2022 19:13:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=E91T1odn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232577AbiKKDNB (ORCPT + 99 others); Thu, 10 Nov 2022 22:13:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232335AbiKKDMy (ORCPT ); Thu, 10 Nov 2022 22:12:54 -0500 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C4382EF42; Thu, 10 Nov 2022 19:12:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668136373; x=1699672373; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bOUKwtAc44fVEJb7Wp1v8fcxde+NjnUeKTqw0XJ/NhE=; b=E91T1odnuhzb0VGz10mPVFEfi6kcE77X76saFnr5fpy2oR3J+4MN7a5x hHdQksXlJo17bmFsKeYHY7vOken8PWFtRZRclVPr6vUEwMkf+KMfY3G4s kohV/7H860ijPP0shU2+IhKALSTTxSPJOJxHrKBnwQSeq+tXT4zIJghdv 6b8QlHF4dOt/JsYWKPuXlAxtlQsoKBiNmfujB40erptfg+VXaLTB4kcn1 HpHnDpsQS5Vx47OTNew7574gvdXcbAfSh5aoihWv+oVSQg6RK7DnLXPf+ QagJgpRjcbL2HRPvGeChsg1puKdLx8HWb0HEvFSTEX5mn4cesqBaFyIQt w==; X-IronPort-AV: E=McAfee;i="6500,9779,10527"; a="310224404" X-IronPort-AV: E=Sophos;i="5.96,155,1665471600"; d="scan'208";a="310224404" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Nov 2022 19:12:52 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10527"; a="812296069" X-IronPort-AV: E=Sophos;i="5.96,155,1665471600"; d="scan'208";a="812296069" Received: from aschofie-mobl2.amr.corp.intel.com (HELO localhost) ([10.209.161.45]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Nov 2022 19:12:51 -0800 From: alison.schofield@intel.com To: Dan Williams , Ira Weiny , Vishal Verma , Dave Jiang , Ben Widawsky , Steven Rostedt , Ingo Molnar Cc: Alison Schofield , linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 2/6] cxl/mbox: Add GET_POISON_LIST mailbox command Date: Thu, 10 Nov 2022 19:12:40 -0800 Message-Id: <46c7c7339224744fce424b196da3e5566effec17.1668115235.git.alison.schofield@intel.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749167827738955035?= X-GMAIL-MSGID: =?utf-8?q?1749167827738955035?= From: Alison Schofield CXL devices maintain a list of locations that are poisoned or result in poison if the addresses are accessed by the host. Per the spec (CXL 3.0 8.2.9.8.4.1), the device returns this Poison list as a set of Media Error Records that include the source of the error, the starting device physical address and length. The length is the number of adjacent DPAs in the record and is in units of 64 bytes. Retrieve the list and log each Media Error Record as a trace event of type 'cxl_poison'. When the poison list is requested by region, include the region name and uuid in the trace event. Signed-off-by: Alison Schofield --- drivers/cxl/core/mbox.c | 81 +++++++++++++++++++++++++++++++++++++++++ drivers/cxl/cxlmem.h | 37 +++++++++++++++++++ 2 files changed, 118 insertions(+) diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c index 0c90f13870a4..88f034e97812 100644 --- a/drivers/cxl/core/mbox.c +++ b/drivers/cxl/core/mbox.c @@ -9,6 +9,9 @@ #include "core.h" +#define CREATE_TRACE_POINTS +#include + static bool cxl_raw_allow_all; /** @@ -752,6 +755,7 @@ int cxl_dev_state_identify(struct cxl_dev_state *cxlds) { /* See CXL 2.0 Table 175 Identify Memory Device Output Payload */ struct cxl_mbox_identify id; + __le32 val = 0; int rc; rc = cxl_mbox_send_cmd(cxlds, CXL_MBOX_OP_IDENTIFY, NULL, 0, &id, @@ -771,6 +775,9 @@ int cxl_dev_state_identify(struct cxl_dev_state *cxlds) cxlds->lsa_size = le32_to_cpu(id.lsa_size); memcpy(cxlds->firmware_version, id.fw_revision, sizeof(id.fw_revision)); + memcpy(&val, id.poison_list_max_mer, 3); + cxlds->poison_max = min_t(u32, le32_to_cpu(val), CXL_POISON_LIST_MAX); + return 0; } EXPORT_SYMBOL_NS_GPL(cxl_dev_state_identify, CXL); @@ -835,6 +842,79 @@ int cxl_mem_create_range_info(struct cxl_dev_state *cxlds) } EXPORT_SYMBOL_NS_GPL(cxl_mem_create_range_info, CXL); +static void cxl_trace_poison(struct cxl_mbox_poison_payload_out *po, + struct cxl_region *cxlr, + const char *memdev_name, + const char *pcidev_name) +{ + const char *region_name = cxlr ? dev_name(&cxlr->dev) : NULL; + struct cxl_region_params *p = cxlr ? &cxlr->params : NULL; + uuid_t *uuid = p ? &p->uuid : NULL; + u64 addr, dpa, overflow_t = 0; + u8 source; + u32 len; + + if (po->flags & CXL_POISON_FLAG_OVERFLOW) + overflow_t = le64_to_cpu(po->overflow_timestamp); + + for (int i = 0; i < le16_to_cpu(po->count); i++) { + len = le32_to_cpu(po->record[i].length) * CXL_POISON_LEN_MULT; + addr = le64_to_cpu(po->record[i].address); + source = addr & CXL_POISON_SOURCE_MASK; + dpa = addr & CXL_POISON_START_MASK; + + trace_cxl_poison(memdev_name, pcidev_name, region_name, uuid, + dpa, len, source, po->flags, overflow_t); + } +} + +int cxl_mem_get_poison(struct cxl_memdev *cxlmd, u64 offset, u64 len, + struct cxl_region *cxlr) +{ + struct cxl_dev_state *cxlds = cxlmd->cxlds; + const char *memdev_name = dev_name(&cxlmd->dev); + const char *pcidev_name = dev_name(cxlds->dev); + struct cxl_mbox_poison_payload_out *po; + struct cxl_mbox_poison_payload_in pi; + int nr_records = 0; + int rc; + + po = kvmalloc(cxlds->payload_size, GFP_KERNEL); + if (!po) + return -ENOMEM; + + pi.offset = cpu_to_le64(offset); + pi.length = cpu_to_le64(len); + + rc = mutex_lock_interruptible(&cxlds->poison_list_mutex); + if (rc) + goto out; + + do { + rc = cxl_mbox_send_cmd(cxlds, CXL_MBOX_OP_GET_POISON, &pi, + sizeof(pi), po, cxlds->payload_size); + if (rc) + break; + + if (trace_cxl_poison_enabled()) + cxl_trace_poison(po, cxlr, memdev_name, pcidev_name); + + /* Protect against an uncleared _FLAG_MORE */ + nr_records = nr_records + le16_to_cpu(po->count); + if (nr_records >= cxlds->poison_max) { + dev_dbg(&cxlmd->dev, "Max Error Records reached: %d\n", + nr_records); + break; + } + } while (po->flags & CXL_POISON_FLAG_MORE); + + mutex_unlock(&cxlds->poison_list_mutex); +out: + kvfree(po); + return rc; +} +EXPORT_SYMBOL_NS_GPL(cxl_mem_get_poison, CXL); + struct cxl_dev_state *cxl_dev_state_create(struct device *dev) { struct cxl_dev_state *cxlds; @@ -846,6 +926,7 @@ struct cxl_dev_state *cxl_dev_state_create(struct device *dev) } mutex_init(&cxlds->mbox_mutex); + mutex_init(&cxlds->poison_list_mutex); cxlds->dev = dev; return cxlds; diff --git a/drivers/cxl/cxlmem.h b/drivers/cxl/cxlmem.h index 669868cc1553..49d891347e39 100644 --- a/drivers/cxl/cxlmem.h +++ b/drivers/cxl/cxlmem.h @@ -192,6 +192,8 @@ struct cxl_endpoint_dvsec_info { * (CXL 2.0 8.2.8.4.3 Mailbox Capabilities Register) * @lsa_size: Size of Label Storage Area * (CXL 2.0 8.2.9.5.1.1 Identify Memory Device) + * @poison_max: maximum media error records held in device cache + * @poison_list_mutex: Mutex to synchronize poison list retrieval * @mbox_mutex: Mutex to synchronize mailbox access. * @firmware_version: Firmware version for the memory device. * @enabled_cmds: Hardware commands found enabled in CEL. @@ -224,6 +226,8 @@ struct cxl_dev_state { size_t payload_size; size_t lsa_size; + u32 poison_max; + struct mutex poison_list_mutex; /* Protect reads of poison list */ struct mutex mbox_mutex; /* Protects device mailbox and firmware */ char firmware_version[0x10]; DECLARE_BITMAP(enabled_cmds, CXL_MEM_COMMAND_ID_MAX); @@ -349,6 +353,37 @@ struct cxl_mbox_set_partition_info { /* Get Poison List CXL 3.0 Spec 8.2.9.8.4.1 */ +struct cxl_mbox_poison_payload_in { + __le64 offset; + __le64 length; +} __packed; + +struct cxl_mbox_poison_payload_out { + u8 flags; + u8 rsvd1; + __le64 overflow_timestamp; + __le16 count; + u8 rsvd2[0x14]; + struct cxl_poison_record { + __le64 address; + __le32 length; + __le32 rsvd; + } __packed record[]; +} __packed; + +/* + * Get Poison List address field encodes the starting + * address of poison, and the source of the poison. + */ +#define CXL_POISON_START_MASK GENMASK_ULL(63, 6) +#define CXL_POISON_SOURCE_MASK GENMASK(2, 0) + +/* Get Poison List record length is in units of 64 bytes */ +#define CXL_POISON_LEN_MULT 64 + +/* Kernel defined maximum for a list of poison errors */ +#define CXL_POISON_LIST_MAX 1024 + /* Get Poison List: Payload out flags */ #define CXL_POISON_FLAG_MORE BIT(0) #define CXL_POISON_FLAG_OVERFLOW BIT(1) @@ -395,6 +430,8 @@ int cxl_mem_create_range_info(struct cxl_dev_state *cxlds); struct cxl_dev_state *cxl_dev_state_create(struct device *dev); void set_exclusive_cxl_commands(struct cxl_dev_state *cxlds, unsigned long *cmds); void clear_exclusive_cxl_commands(struct cxl_dev_state *cxlds, unsigned long *cmds); +int cxl_mem_get_poison(struct cxl_memdev *cxlmd, u64 offset, u64 len, + struct cxl_region *cxlr); #ifdef CONFIG_CXL_SUSPEND void cxl_mem_active_inc(void); void cxl_mem_active_dec(void); From patchwork Fri Nov 11 03:12:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alison Schofield X-Patchwork-Id: 18401 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp511942wru; Thu, 10 Nov 2022 19:15:31 -0800 (PST) X-Google-Smtp-Source: AMsMyM4d7qwHH3QQpa22LdjgAEnQqO46OkT5Ov+m5xIGgZfZfdp12lrk7wojEYTanWHSD6frezEh X-Received: by 2002:a17:90a:3ee1:b0:20a:da52:9616 with SMTP id k88-20020a17090a3ee100b0020ada529616mr3221854pjc.171.1668136531444; Thu, 10 Nov 2022 19:15:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668136531; cv=none; d=google.com; s=arc-20160816; b=PBQoc5e7rUAc8HCU4rBOiQGaCKGyw+8i7UnwKbt96evVjtkVuoP21qoquXMwEaOphs AtPk2qjvHJXD0MVsG3X2o+D55r1aWvsCZQNiAdioxTedAnEtJH0baroF6bXgkytTyX2d N40YI+Rv4FLqNvRryYz2qxNb8Gy7m/7fVE50FcdM7tPAvQ1hiTCpmkafvVwOTJXESv3h kvh9RQD537snqWLBqFbTncqb80//95hyxAqMP4b6sB4OMXq/+0K2GI31aKlT1u/JqxBj qGnkZdDaMgVn3jsSHlalI/jO6FrfywcvLeyrOeBwXuZe+HPeriqd60VEYVLmV+QAwN8h zkyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lfCiAk4Luy1TI7jKiuwYcNpypYpa7zZugRjqjxXT540=; b=yvT50UNZn2lSqMrLU2n9sf+SMdUp7c/k6IQUcEgE4HCnCWoqR6e8h8Hx5csS2LomRg +wKVKJxS8ac+9x25v6sJ2T0okLXgkhF5JcBsnnMoyU0JRZ2Y27s46yromPMHaIajSdlV KdbuMC1vBVfQic3qLItzf61YWtcjWgF44GRGZ7/sCWgG05bvX3TTZoS9jW8yTozwi6dK qfGnHIG4v4RjVWRiuNK9OvcPhVlOqldzITR1DPgWU/2LuiQSq8pcJ8KR/S0iXrfB7o5s vM0K6XUZHskWNqaYrB4Z12T+mhFk6z6anBvY7baFbkz0ExevQYhTHwUat323YVpM/Z6F emYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=CXohdT7B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k131-20020a633d89000000b0046ed15b5318si1110515pga.98.2022.11.10.19.15.16; Thu, 10 Nov 2022 19:15:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=CXohdT7B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229675AbiKKDNG (ORCPT + 99 others); Thu, 10 Nov 2022 22:13:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232476AbiKKDMz (ORCPT ); Thu, 10 Nov 2022 22:12:55 -0500 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDED05B5AC; Thu, 10 Nov 2022 19:12:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668136374; x=1699672374; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VsDB9dzd0mEr75cQiAY7peAbT1Qp+7elj42fOh/7AAo=; b=CXohdT7Bp1D0gxxie1HJ5GTlDiS1KHIObiEM6VNDOq6BbB+o2LwpYQn3 r4oxhfv+ZihSdO7BnjpIll94sTegw4VD1Of/TudnjgkjxsnBjzvEwkZZu seHoX1oVbHDnZX3CEQrOrSIs0/NkHEtMia5wf9J5imuzOcJH93li2gqf6 3hToYwXOyn0uPoezSNCMHAABVMhjOmpVJ104/45+78XLxuD0QmjVgkaxf Fmc4rVy16POO3iWefrexaply2w9Nv9TZ3U7rDMajHSBuJaqtvEUXIgU/B wLR8W1QZ/3G4Xy7K9GE3iyv4ZMF/QR81FsIFrPCob/4pwLqJD2LQXN32e Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10527"; a="310224411" X-IronPort-AV: E=Sophos;i="5.96,155,1665471600"; d="scan'208";a="310224411" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Nov 2022 19:12:54 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10527"; a="812296085" X-IronPort-AV: E=Sophos;i="5.96,155,1665471600"; d="scan'208";a="812296085" Received: from aschofie-mobl2.amr.corp.intel.com (HELO localhost) ([10.209.161.45]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Nov 2022 19:12:53 -0800 From: alison.schofield@intel.com To: Dan Williams , Ira Weiny , Vishal Verma , Dave Jiang , Ben Widawsky , Steven Rostedt , Ingo Molnar Cc: Alison Schofield , linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 3/6] cxl/memdev: Add trigger_poison_list sysfs attribute Date: Thu, 10 Nov 2022 19:12:41 -0800 Message-Id: <5055dd47526d900f85f43bb0d85f4ccd4c9502b6.1668115235.git.alison.schofield@intel.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749167931384222659?= X-GMAIL-MSGID: =?utf-8?q?1749167931384222659?= From: Alison Schofield When a boolean 'true' is written to this attribute the memdev driver retrieves the poison list from the device. The list includes addresses that are poisoned, or would result in poison if accessed, and the source of the poison. This attribute is only visible for devices supporting the capability. The retrieved errors are logged as kernel trace events with the label 'cxl_poison'. Signed-off-by: Alison Schofield --- Documentation/ABI/testing/sysfs-bus-cxl | 14 +++++++++ drivers/cxl/core/memdev.c | 41 +++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-bus-cxl b/Documentation/ABI/testing/sysfs-bus-cxl index 8494ef27e8d2..1c5f4a853ba2 100644 --- a/Documentation/ABI/testing/sysfs-bus-cxl +++ b/Documentation/ABI/testing/sysfs-bus-cxl @@ -388,3 +388,17 @@ Description: 1), and checks that the hardware accepts the commit request. Reading this value indicates whether the region is committed or not. + + +What: /sys/bus/cxl/devices/memX/trigger_poison_list +Date: November, 2022 +KernelVersion: v6.2 +Contact: linux-cxl@vger.kernel.org +Description: + (WO) When a boolean 'true' is written to this attribute the + memdev driver retrieves the poison list from the device. The + list includes addresses that are poisoned or would result in + poison if accessed, and the source of the poison. This + attribute is only visible for devices supporting the + capability. The retrieved errors are logged as kernel + trace events with the label 'cxl_poison'. diff --git a/drivers/cxl/core/memdev.c b/drivers/cxl/core/memdev.c index 20ce488a7754..06d265db5127 100644 --- a/drivers/cxl/core/memdev.c +++ b/drivers/cxl/core/memdev.c @@ -106,12 +106,45 @@ static ssize_t numa_node_show(struct device *dev, struct device_attribute *attr, } static DEVICE_ATTR_RO(numa_node); +static ssize_t trigger_poison_list_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t len) +{ + struct cxl_memdev *cxlmd = to_cxl_memdev(dev); + struct cxl_dev_state *cxlds = cxlmd->cxlds; + u64 offset, length; + bool tmp; + int rc; + + if (kstrtobool(buf, &tmp)) + return -EINVAL; + + /* Per CXL Spec, separate the pmem and ram poison list reads */ + if (resource_size(&cxlds->pmem_res)) { + offset = cxlds->pmem_res.start; + length = resource_size(&cxlds->pmem_res); + rc = cxl_mem_get_poison(cxlmd, offset, length, NULL); + if (rc) + return rc; + } + if (resource_size(&cxlds->ram_res)) { + offset = cxlds->ram_res.start; + length = resource_size(&cxlds->ram_res); + rc = cxl_mem_get_poison(cxlmd, offset, length, NULL); + if (rc) + return rc; + } + return len; +} +static DEVICE_ATTR_WO(trigger_poison_list); + static struct attribute *cxl_memdev_attributes[] = { &dev_attr_serial.attr, &dev_attr_firmware_version.attr, &dev_attr_payload_max.attr, &dev_attr_label_storage_size.attr, &dev_attr_numa_node.attr, + &dev_attr_trigger_poison_list.attr, NULL, }; @@ -130,6 +163,14 @@ static umode_t cxl_memdev_visible(struct kobject *kobj, struct attribute *a, { if (!IS_ENABLED(CONFIG_NUMA) && a == &dev_attr_numa_node.attr) return 0; + + if (a == &dev_attr_trigger_poison_list.attr) { + struct device *dev = kobj_to_dev(kobj); + + if (!test_bit(CXL_MEM_COMMAND_ID_GET_POISON, + to_cxl_memdev(dev)->cxlds->enabled_cmds)) + return 0; + } return a->mode; } From patchwork Fri Nov 11 03:12:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alison Schofield X-Patchwork-Id: 18400 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp511689wru; Thu, 10 Nov 2022 19:14:41 -0800 (PST) X-Google-Smtp-Source: AMsMyM5lMd2I6ExD8F9hEIreH+Fo2nmSdSdRB7oM94VUER/z9H0EjZV1irnmDBZWRlRL/JJVNtB8 X-Received: by 2002:a63:3207:0:b0:46a:f665:ed96 with SMTP id y7-20020a633207000000b0046af665ed96mr4377435pgy.486.1668136481124; Thu, 10 Nov 2022 19:14:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668136481; cv=none; d=google.com; s=arc-20160816; b=ZM7lgCLi/EHxWa9LqffsGKhVZ22ismhIHCE1AqHrBC51hMjJOJmzSw++gXGcx6F+zm 1C8VU5VtQa9sTNI4G392Ad2F5PKnCIYM1KMIT7t6HIdOrJiYY4mNufngsEJ8/kSmNmlD UCDiA2+DkjrdAEOPGLrqLNjAjy3Iq7vBuaD1cJQqGUz+f5EuOyGb9CYcZxP/fWjpkRMs oZ2wYweC/kpUf/m0uI6RJN7WutYHjXENbNBaXhz+DOwXQkWCpWjBZAjwiK++7HUntD/7 Et4GFocWqcoCXdwwBlUh657acIapuaNgzi4bpdX8/7YOmbkiElCbNyTX/F3cNZrLnipR Lscw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xbI/wns7PPcAXKtQjuY222W4LvwSRAXV0pVrWb6M3xw=; b=Bem9C2qbPfmbk+X+ueOzeeT418Ekmiw1tAUPKFXFLQF3MkSiBZ971abmCwEXgoNNT6 AYyxDlv+Zug0fDvR+6cSIClWtPDqFKqOd+aH6BgoxlPvv6d8oOHe9CjervTWqJznKBEB KK/DN6VqStsOEAc2kZc39R1D629Iq0rOl0vDg2YbGsg71keftyzDXSWQNvj9IM4GRccd y6GL5ZfRWWENRJEHYMrU2BC2Wba7AVvfbEuOub02IJGObMEG2zweL1C4DI3E9R8ScORB H5IpQBD9hJMfPRzgVoUEScO2jlJGJIHfwIvmIepLVTMSIrq2rG6zbSKJvbMXdYAAx4kq /bAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Pdq3mywf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jc22-20020a17090325d600b001789a178e33si1035319plb.428.2022.11.10.19.14.27; Thu, 10 Nov 2022 19:14:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Pdq3mywf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232650AbiKKDNJ (ORCPT + 99 others); Thu, 10 Nov 2022 22:13:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231483AbiKKDM5 (ORCPT ); Thu, 10 Nov 2022 22:12:57 -0500 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA3A72EF42; Thu, 10 Nov 2022 19:12:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668136376; x=1699672376; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=D2Rd/Pgneu6uQpvUYP+09V/ctmxkFwMNJvxyOCowpy0=; b=Pdq3mywfMNQPVHBqLsIsLvShiWWCTPHHmYmRrhMuaw8bFtLm7+LlPE8O S5V7sGrhuVHCsr3AvAkAqA0YUsJghmyoBqzuTo4/FlQturgwgVDl8kZZg sWZht16t+KbRAovtv3OD8AvAvyNZ8SGXKAezmaGYTgvqmddW2eJqiPrt3 iVljrVXt9JjKc4JQVGqsv0DupTxzZXrwObmMOVpOq9fPm/Uvh6p0w23Z6 MldhNMZqo9L9GLOeOymuHklwkp1UhRPO0AZJyPBmVal4WR67Dep1R4Qm6 LlLXQwoAvD9kwZVyo10n68BUtzHk6dCla/se8dg9uxaoufNbcHLdtmnlP w==; X-IronPort-AV: E=McAfee;i="6500,9779,10527"; a="310224414" X-IronPort-AV: E=Sophos;i="5.96,155,1665471600"; d="scan'208";a="310224414" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Nov 2022 19:12:56 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10527"; a="812296090" X-IronPort-AV: E=Sophos;i="5.96,155,1665471600"; d="scan'208";a="812296090" Received: from aschofie-mobl2.amr.corp.intel.com (HELO localhost) ([10.209.161.45]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Nov 2022 19:12:55 -0800 From: alison.schofield@intel.com To: Dan Williams , Ira Weiny , Vishal Verma , Dave Jiang , Ben Widawsky , Steven Rostedt , Ingo Molnar Cc: Alison Schofield , linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 4/6] cxl/region: Add trigger_poison_list sysfs attribute Date: Thu, 10 Nov 2022 19:12:42 -0800 Message-Id: X-Mailer: git-send-email 2.37.3 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749167878946138608?= X-GMAIL-MSGID: =?utf-8?q?1749167878946138608?= From: Alison Schofield When a boolean 'true' is written to this attribute the region driver retrieves the poison list for the capacity each device contributes to this region. The list includes addresses that are poisoned, or would result in poison if accessed, and the source of the poison. The retrieved errors are logged as kernel trace events with the label 'cxl_poison'. Devices not supporting the poison list capability are ignored. Signed-off-by: Alison Schofield Reviewed-by: Jonathan Cameron --- Documentation/ABI/testing/sysfs-bus-cxl | 14 +++++++++++ drivers/cxl/core/region.c | 33 +++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-bus-cxl b/Documentation/ABI/testing/sysfs-bus-cxl index 1c5f4a853ba2..54fad3bdcb2b 100644 --- a/Documentation/ABI/testing/sysfs-bus-cxl +++ b/Documentation/ABI/testing/sysfs-bus-cxl @@ -402,3 +402,17 @@ Description: attribute is only visible for devices supporting the capability. The retrieved errors are logged as kernel trace events with the label 'cxl_poison'. + + +What: /sys/bus/cxl/devices/regionZ/trigger_poison_list +Date: November, 2022 +KernelVersion: v6.2 +Contact: linux-cxl@vger.kernel.org +Description: + (WO) When a boolean 'true' is written to this attribute the + region driver retrieves the poison list for the capacity + each device contributes to this region. The list includes + addresses that are poisoned, or would result in poison if + accessed, and the source of the poison. The retrieved + errors are logged as kernel trace events with the label + 'cxl_poison'. diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c index f9ae5ad284ff..68821238491e 100644 --- a/drivers/cxl/core/region.c +++ b/drivers/cxl/core/region.c @@ -72,6 +72,38 @@ static int is_dup(struct device *match, void *data) return 0; } +static ssize_t trigger_poison_list_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t len) +{ + struct cxl_region *cxlr = to_cxl_region(dev); + struct cxl_region_params *p = &cxlr->params; + struct cxl_endpoint_decoder *cxled; + struct cxl_memdev *cxlmd; + u64 offset, length; + int rc, i; + bool tmp; + + if (kstrtobool(buf, &tmp)) + return -EINVAL; + + for (i = 0; i < p->nr_targets; i++) { + cxled = p->targets[i]; + cxlmd = cxled_to_memdev(cxled); + if (!test_bit(CXL_MEM_COMMAND_ID_GET_POISON, + cxlmd->cxlds->enabled_cmds)) + continue; + + offset = cxl_dpa_resource_start(cxled); + length = cxl_dpa_size(cxled); + rc = cxl_mem_get_poison(cxlmd, offset, length, cxlr); + if (rc) + return rc; + } + return len; +} +static DEVICE_ATTR_WO(trigger_poison_list); + static ssize_t uuid_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t len) { @@ -570,6 +602,7 @@ static struct attribute *cxl_region_attrs[] = { &dev_attr_interleave_granularity.attr, &dev_attr_resource.attr, &dev_attr_size.attr, + &dev_attr_trigger_poison_list.attr, NULL, }; From patchwork Fri Nov 11 03:12:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alison Schofield X-Patchwork-Id: 18402 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp512007wru; Thu, 10 Nov 2022 19:15:44 -0800 (PST) X-Google-Smtp-Source: AMsMyM7/TnG3Y4hl3I7wqDcQF2wiPVDGfsot3fBEjIjDVEDm892f4KA7/iew0/l9nyi87lUA6Kir X-Received: by 2002:a17:90a:c591:b0:213:f05:e37e with SMTP id l17-20020a17090ac59100b002130f05e37emr3306466pjt.167.1668136544104; Thu, 10 Nov 2022 19:15:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668136544; cv=none; d=google.com; s=arc-20160816; b=KXfI/uuoZFE+nBt0kLK8mRYUTp4EVgdY6prTXE/sAwvzHQDTi9R7UymC90121rqJNt ijHEG/Y2p31gCPw9CehgS7gd3HzfMj4qd5l2rxZYFCSCWi6MM5mG54ieDKilcRUUFQu5 wYUjLU3CNePRExuOK8TYLmq9gjWYBtwavJvyzCsisL9Adr1s1QG0eLNGY2OEaDyOJuXi WDO9/Px0TW1ihgi8K5/QQekQphP4ovhJMwUgidOhEFr9Zb9qkUWOOFQlbAwPT0knp2Wn nfBXIhydtMUkTEZf3CW5RqHhF3yHoJ9DeobwxqHF70T4h+4SVAf/Brf79qlteQRJkVg3 N0kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=cCzlwIWRk6g+BMbAwVw84uxxQOIKFMvJBxvKd/BNCWs=; b=O6eedgT7wUGJ7WxUCFhG9jMB2grsqcTJrMCEf9uTwSF6a8ykM4oldi6w2xShXhEnv6 ghvUyI1IfyaTwwiG9u6KSn66070Ng0plwhgwGa0JW0Xn+z6HdTjrdetqL0Ax6GBZdC3M yQpO+A0v9QLnZARrOLT0RLfwIR9NevMJGNvqHHVEjnkBDu7mo0B5sHFMgr8plO5wkGX5 Rfb1VfyeUB6m1bs03oG3o2tEkM5vJ613liKDwqM1NKTQcXt5sugq6IlZjVB5M1pRYnQ0 Gjgf2gD86j/ImqfDNFzOlwIfTdEyQ1nhR09gYcqXTl5dH0Mq/e1avXtNvpk2wDQ+w8/s V5PQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="MApE+J/R"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c189-20020a6335c6000000b004704bae726asi1147358pga.47.2022.11.10.19.15.30; Thu, 10 Nov 2022 19:15:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="MApE+J/R"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232829AbiKKDNM (ORCPT + 99 others); Thu, 10 Nov 2022 22:13:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232507AbiKKDM7 (ORCPT ); Thu, 10 Nov 2022 22:12:59 -0500 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8468A5CD12; Thu, 10 Nov 2022 19:12:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668136378; x=1699672378; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=JdyavRtcyKYFKOnnExa3qY1SoXZOphSrTHOAQ8KDAJw=; b=MApE+J/RoaEae/iGA01GOeL8nmN+cv22SONSdf4UWytH0xCw1oR8AdAD 96S7Ey6bFaPh6G3Wh9PtpNeD1yejXRHUeYzIfViXO9e2VekSMn7/mstaq ChB7+RNMV2DUBCoo8uY0pr29MhkThHUp1SZ95osPtBnm26GHqxmRyKuiP Xn+zA2fuAtiEe2QL+TZWvnAVBS1EFXwcv3uk6VOjOJv11fHVfAlZFbLKX ZApGaRcJBtBvQoW81DUl/6sA27AxFNGdscP1GHKlUc4kQYh5L5MbUn2mp Eqv/9osZyRXGauBRlpmCYKt1fd+EB3rbMxr3HElNXdM6InzTv+4jQNsGC w==; X-IronPort-AV: E=McAfee;i="6500,9779,10527"; a="310224418" X-IronPort-AV: E=Sophos;i="5.96,155,1665471600"; d="scan'208";a="310224418" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Nov 2022 19:12:58 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10527"; a="812296101" X-IronPort-AV: E=Sophos;i="5.96,155,1665471600"; d="scan'208";a="812296101" Received: from aschofie-mobl2.amr.corp.intel.com (HELO localhost) ([10.209.161.45]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Nov 2022 19:12:57 -0800 From: alison.schofield@intel.com To: Dan Williams , Ira Weiny , Vishal Verma , Dave Jiang , Ben Widawsky , Steven Rostedt , Ingo Molnar Cc: Alison Schofield , linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 5/6] tools/testing/cxl: Mock the max err records field of Identify cmd Date: Thu, 10 Nov 2022 19:12:43 -0800 Message-Id: <14b883bd220ff388cc3a287cf104d83d53a2f520.1668115235.git.alison.schofield@intel.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749167944926601790?= X-GMAIL-MSGID: =?utf-8?q?1749167944926601790?= From: Alison Schofield The CXL mbox command Identify reports the maximum media error records that a device will report. Mock it here for testing the GET POISON LIST mbox command. Signed-off-by: Alison Schofield --- tools/testing/cxl/test/mem.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/testing/cxl/test/mem.c b/tools/testing/cxl/test/mem.c index aa2df3a15051..f0704d090073 100644 --- a/tools/testing/cxl/test/mem.c +++ b/tools/testing/cxl/test/mem.c @@ -111,6 +111,10 @@ static int mock_id(struct cxl_dev_state *cxlds, struct cxl_mbox_cmd *cmd) cpu_to_le64(DEV_SIZE / CXL_CAPACITY_MULTIPLIER), }; + __le32 val = cpu_to_le32(SZ_64); + + memcpy(id.poison_list_max_mer, &val, 3); + if (cmd->size_out < sizeof(id)) return -EINVAL; From patchwork Fri Nov 11 03:12:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alison Schofield X-Patchwork-Id: 18403 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp512072wru; Thu, 10 Nov 2022 19:15:56 -0800 (PST) X-Google-Smtp-Source: AA0mqf4+EG+bZJcBKavMDuCs5UFxC3H+7eBX0fJJiq2MvJlbcbhlEbI0eAATvIREmN9KxfckqyEI X-Received: by 2002:a17:902:e5c9:b0:188:602b:8259 with SMTP id u9-20020a170902e5c900b00188602b8259mr509116plf.139.1668136556099; Thu, 10 Nov 2022 19:15:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668136556; cv=none; d=google.com; s=arc-20160816; b=mrDJ+y2wX4eDI6coJe56DWzLV0Z7IGfpPthA+rU24rQ9ukauNMOwtQ1cC4z6JeGr/g MOPPmgzNYgyy7Q/DUYBpXP7aiNRHvSMGmLJ5uukhyUNdPQrCF+9Rz68jnbMO1UxhsPrt r9l32iIKcjkw4sTYuS0fnygXhRpApg5JT5GURpOrCzZBJfGnVE9svs9cgrbW+krmJrzn 3lAJLb6XpLV6xSvCF6ll6lYFa42nhpQxWixrZNH7PPE0EbRWp/jGRhbsVvLx6PSPgM4y Qh/F60O7V0petpyqnl1d2XXLanUw5etBwaiHz6jpULyiiVXqgHbsVld3cfkweh1JOaTi iJhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=VljfeLsa4uxFVwdlDyMrvC9ocC0NGWhhxBaPHmC0jps=; b=TZ77OL5N3m2KNYSDr+IOzLZUIRT4z3GVXeJJ+2hgsnMppf/IIWSSyuv+ph3x/KH8oV 4uDt437mzvwRjfec67IKoDD+fi5B6/SmfVgKsZdb2SWCGTL/1VEDqViiBIedsVCPVdkY iJEHKYvwe5jJ6gqwFq0effOyV8vctwDHB9/XUbm/bngjCZfx4TBcnJLTW94HEGuv+ymM hdbxwW7jGe27YxL66u42COZWaZRVpk1JOOepiJrX04J1RyA4uw9hiy4up2SfBk1VgaXO mJIoK8067rdRLdJfeLJIJ+8fRnYU87ikjiDolnpF5FcPvEBxixLTW/ARVULjWlz4B6OB qywg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=IUdDeEcW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hk16-20020a17090b225000b00213db2b6587si7202054pjb.169.2022.11.10.19.15.43; Thu, 10 Nov 2022 19:15:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=IUdDeEcW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232855AbiKKDNP (ORCPT + 99 others); Thu, 10 Nov 2022 22:13:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232667AbiKKDND (ORCPT ); Thu, 10 Nov 2022 22:13:03 -0500 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FC2F5CD29; Thu, 10 Nov 2022 19:13:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668136380; x=1699672380; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Y00FqPXd0tXMVfbMPOYOFfjRtaD0786m2Qc/OlOfGUE=; b=IUdDeEcWfeS9KM33cf7hVpD8Az0gL3y3vfxU+Fdsb/MJyFviz3FLIoc4 cWZKLYlVg8Y0FM88FSzBw9vZAVE1vsPIGhFu5Lr8Ce0mc4VA/dARTEOjX WYefm52/CWHIPPhsaAsDFZ9l7kwJRJMOXfGXMe39WhE2bMzeajtRigpWQ dQBhP8LU2lxYyhh6e0CCegh+SAXh/mP+c4cJZDZqpErXu6m39qnd+j44k FHg5ubgQA7PTMhD0ADaP+pb8upN0lgv3SsyTK9iqyTV5UZcZyj4rSOnoc ycT1a7EUUmvJ5Uy/MHebiwf4Wj78WVpPIW/W7rGrpBna/tEIa26F9MlzU g==; X-IronPort-AV: E=McAfee;i="6500,9779,10527"; a="310224419" X-IronPort-AV: E=Sophos;i="5.96,155,1665471600"; d="scan'208";a="310224419" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Nov 2022 19:13:00 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10527"; a="812296108" X-IronPort-AV: E=Sophos;i="5.96,155,1665471600"; d="scan'208";a="812296108" Received: from aschofie-mobl2.amr.corp.intel.com (HELO localhost) ([10.209.161.45]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Nov 2022 19:12:59 -0800 From: alison.schofield@intel.com To: Dan Williams , Ira Weiny , Vishal Verma , Dave Jiang , Ben Widawsky , Steven Rostedt , Ingo Molnar Cc: Alison Schofield , linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 6/6] tools/testing/cxl: Mock the Get Poison List mbox command Date: Thu, 10 Nov 2022 19:12:44 -0800 Message-Id: <7accc4b25613bd04ded1c48fa317dcf08803575f.1668115235.git.alison.schofield@intel.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749167957770910944?= X-GMAIL-MSGID: =?utf-8?q?1749167957770910944?= From: Alison Schofield Return fake poison error records when the get poison list mbox command is issued. This supports testing the kernel tracing and cxl list capabilities for media errors. Signed-off-by: Alison Schofield Reviewed-by: Jonathan Cameron --- tools/testing/cxl/test/mem.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tools/testing/cxl/test/mem.c b/tools/testing/cxl/test/mem.c index f0704d090073..f729e055605d 100644 --- a/tools/testing/cxl/test/mem.c +++ b/tools/testing/cxl/test/mem.c @@ -38,6 +38,10 @@ static struct cxl_cel_entry mock_cel[] = { .opcode = cpu_to_le16(CXL_MBOX_OP_GET_HEALTH_INFO), .effect = cpu_to_le16(0), }, + { + .opcode = cpu_to_le16(CXL_MBOX_OP_GET_POISON), + .effect = cpu_to_le16(0), + }, }; /* See CXL 2.0 Table 181 Get Health Info Output Payload */ @@ -207,6 +211,30 @@ static int mock_health_info(struct cxl_dev_state *cxlds, return 0; } +static int mock_get_poison(struct cxl_dev_state *cxlds, struct cxl_mbox_cmd *cmd) +{ + struct { + struct cxl_mbox_poison_payload_out poison_out; + struct cxl_poison_record record; + } mock_poison_list = { + .poison_out = { + .count = cpu_to_le16(1), + }, + .record = { + /* .address encodes DPA and poison source bits */ + .address = cpu_to_le64(CXL_POISON_SOURCE_INTERNAL), + .length = cpu_to_le32(1), + }, + }; + + if (cmd->size_out < sizeof(mock_poison_list)) + return -EINVAL; + + memcpy(cmd->payload_out, &mock_poison_list, sizeof(mock_poison_list)); + cmd->size_out = sizeof(mock_poison_list); + return 0; +} + static int cxl_mock_mbox_send(struct cxl_dev_state *cxlds, struct cxl_mbox_cmd *cmd) { struct device *dev = cxlds->dev; @@ -234,6 +262,9 @@ static int cxl_mock_mbox_send(struct cxl_dev_state *cxlds, struct cxl_mbox_cmd * case CXL_MBOX_OP_GET_HEALTH_INFO: rc = mock_health_info(cxlds, cmd); break; + case CXL_MBOX_OP_GET_POISON: + rc = mock_get_poison(cxlds, cmd); + break; default: break; }