From patchwork Mon Aug 7 06:35:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jehoon Park X-Patchwork-Id: 13343111 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A123C001DB for ; Mon, 7 Aug 2023 06:35:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230294AbjHGGfa (ORCPT ); Mon, 7 Aug 2023 02:35:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230202AbjHGGf3 (ORCPT ); Mon, 7 Aug 2023 02:35:29 -0400 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D958170B for ; Sun, 6 Aug 2023 23:35:28 -0700 (PDT) Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20230807063525epoutp02a83c12524f8d6aa0a575e23f5fa15eb4~5BlubUXa12859328593epoutp02m for ; Mon, 7 Aug 2023 06:35:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20230807063525epoutp02a83c12524f8d6aa0a575e23f5fa15eb4~5BlubUXa12859328593epoutp02m DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1691390125; bh=R8tzhSUTvRNXdClB/JlrKxNNA4AXoAcodJElwVcpW6o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AARV/7DRDWZYkVIr30aK6Xwof+22WnQbt+yuMLoSMmv33EQZlhktRgF43q8Dx+j0K u/MjRWN8CE2mwAbfUeMe6ABMWzZqEmIT4H8tuJxKxOW5PVIlyPDna9wVoHy5hSHUiz 1W7vgxQF1AcfbtkhH6jlybbZ/VXo5ynvVPCZziPE= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20230807063525epcas2p20ac8b66c9cdeeae743dcde3069cb8ab1~5Blt9yXT70052100521epcas2p2y; Mon, 7 Aug 2023 06:35:25 +0000 (GMT) Received: from epsmges2p2.samsung.com (unknown [182.195.36.99]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4RK6583Qn5z4x9Q2; Mon, 7 Aug 2023 06:35:24 +0000 (GMT) Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p2.samsung.com (Symantec Messaging Gateway) with SMTP id BC.2B.40133.CA090D46; Mon, 7 Aug 2023 15:35:24 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas2p4.samsung.com (KnoxPortal) with ESMTPA id 20230807063523epcas2p45f74891b764d920b2a9bd22ddf6b6998~5Bls7IWBA0402604026epcas2p4p; Mon, 7 Aug 2023 06:35:23 +0000 (GMT) Received: from epsmgms1p2new.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230807063523epsmtrp1e84ac40901595d0dfee31f6da776bf77~5Bls6UaYq2722927229epsmtrp1f; Mon, 7 Aug 2023 06:35:23 +0000 (GMT) X-AuditID: b6c32a46-4edb870000009cc5-7b-64d090acd1aa Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2new.samsung.com (Symantec Messaging Gateway) with SMTP id AF.B2.30535.BA090D46; Mon, 7 Aug 2023 15:35:23 +0900 (KST) Received: from jehoon-Precision-7920-Tower.dsn.sec.samsung.com (unknown [10.229.83.133]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230807063523epsmtip20a72cfca40ef6d4a7087939c06ebebd9~5BlsrJl8-1913319133epsmtip2C; Mon, 7 Aug 2023 06:35:23 +0000 (GMT) From: Jehoon Park To: linux-cxl@vger.kernel.org Cc: nvdimm@lists.linux.dev, Alison Schofield , Vishal Verma , Ira Weiny , Dan Williams , Dave Jiang , Davidlohr Bueso , Jonathan Cameron , Kyungsan Kim , Junhyeok Im , Jehoon Park Subject: [ndctl PATCH v2 1/3] libcxl: Update a revision by CXL 3.0 specification Date: Mon, 7 Aug 2023 15:35:47 +0900 Message-Id: <20230807063549.5942-2-jehoon.park@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230807063549.5942-1-jehoon.park@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrOKsWRmVeSWpSXmKPExsWy7bCmhe6aCRdSDKbfkrS4+/gCm8X0qRcY LU7cbGSzWH1zDaPF/qfPWSwOvG5gt1i18BqbxeKjM5gtju7hsDg/6xSLxcoff1gtbk04xuTA 49Fy5C2rx+I9L5k8XmyeyejRt2UVo8fU2fUenzfJBbBFZdtkpCampBYppOYl56dk5qXbKnkH xzvHm5oZGOoaWlqYKynkJeam2iq5+AToumXmAJ2opFCWmFMKFApILC5W0rezKcovLUlVyMgv LrFVSi1IySkwL9ArTswtLs1L18tLLbEyNDAwMgUqTMjO+Ht4EUvBD9aKvy0yDYwtrF2MnBwS AiYS7Ru3M4PYQgI7GCVan5R1MXIB2Z8YJTZc38sM4XxjlHh3ZTo7TMfxq38YIRJ7GSWuXu5k h3B6mSSObPrDBFLFJqAtcX/7BjYQW0RAVqJ53QMmkCJmgc3MEst2ngNLCAsESdzaehBsOYuA qsShezfAjuIVsJZo//qcBWKdvMTqDQfAajgFbCTWXXzHCjJIQuAru8SLq0uYIIpcJL7+WcsM YQtLvDq+BepWKYmX/W1Qdr7Ez5O3oL4ukPj05QPUAmOJdzefA8U5gK7TlFi/Sx/ElBBQljhy C6yCWYBPouPwX3aIMK9ER5sQRKOqRNfxD4wQtrTE4StHoQ7wkPi37xE0TPoZJToef2aawCg3 C2HBAkbGVYxiqQXFuempxUYFRvAIS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1NSC1CKYLBMHp1QDk0w3z+2+befXPC7e aa4/aePThdbv77X8OCGS9SN8j77Yk6fLrd7tYyvJuKH4tMEizKHh+6aa+3MmOrBWeKotMN/C JP17ta3tLkvGD/r+PPfX/H13MuPA080B/HO/vfyTu0R9H18K13zZN6vTeRNZAzeoSm/f+r9W KHbR6qU2v5Mjr/RPu6ETcEFFb79/gb2YTNi++i2cCz4knxCp0nq17Jz64jUr5beISrs87uPd f7SA+e3kZ9d2xuerHwpjVOa7Mnslw/KgJd881SqOsO7PVLBvil15LnVD5uWT+189vPPZd86O BtXr36Z2TTx05XDlmZzLh//dE3MrNSnO8bvFttqmked/quSXQMPjH9oZpzgrsRRnJBpqMRcV JwIAo4l45sUCAAA= X-CMS-MailID: 20230807063523epcas2p45f74891b764d920b2a9bd22ddf6b6998 X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230807063523epcas2p45f74891b764d920b2a9bd22ddf6b6998 References: <20230807063549.5942-1-jehoon.park@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org Update the predefined value for device temperature field when it is not implemented. (CXL 3.0.8.2.9.8.3.1) Signed-off-by: Jehoon Park Reviewed-by: Jonathan Cameron Reviewed-by: Davidlohr Bueso --- cxl/lib/private.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cxl/lib/private.h b/cxl/lib/private.h index a641727..a692fd5 100644 --- a/cxl/lib/private.h +++ b/cxl/lib/private.h @@ -360,7 +360,7 @@ struct cxl_cmd_set_partition { #define CXL_CMD_HEALTH_INFO_EXT_CORRECTED_PERSISTENT_WARNING (1) #define CXL_CMD_HEALTH_INFO_LIFE_USED_NOT_IMPL 0xff -#define CXL_CMD_HEALTH_INFO_TEMPERATURE_NOT_IMPL 0xffff +#define CXL_CMD_HEALTH_INFO_TEMPERATURE_NOT_IMPL 0x7fff static inline int check_kmod(struct kmod_ctx *kmod_ctx) { From patchwork Mon Aug 7 06:35:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jehoon Park X-Patchwork-Id: 13343112 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2DC58C001DB for ; Mon, 7 Aug 2023 06:35:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230434AbjHGGfr (ORCPT ); Mon, 7 Aug 2023 02:35:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230162AbjHGGfp (ORCPT ); Mon, 7 Aug 2023 02:35:45 -0400 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB69E171B for ; Sun, 6 Aug 2023 23:35:42 -0700 (PDT) Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20230807063540epoutp0312343bcf40ed20697e36bb611c914955~5Bl8sYzmU0968109681epoutp03b for ; Mon, 7 Aug 2023 06:35:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20230807063540epoutp0312343bcf40ed20697e36bb611c914955~5Bl8sYzmU0968109681epoutp03b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1691390140; bh=UdZyML6B24ScUvSgDKW8/+eMj4Rfa9MYaG249Qxddzo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mk5VdhhOt4CIgy8tUtIB/FsnIPid/id5Wsa81UZPZ1IL0eGPnWsYGHZndAdLxYqlc w6+zKrDH+inE41nsPjAfHJqxfBxYQp/50UX3K2u/V9GbERrxmRaoL70P396KgIT5ec mEhSY8revEcChjc4VaS4LU7vcFsjLALxy3AW1FPk= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20230807063540epcas2p3b86d2b1bcbfb8ffc62d2982b65b7d7ba~5Bl8HD7yV0737307373epcas2p30; Mon, 7 Aug 2023 06:35:40 +0000 (GMT) Received: from epsmges2p4.samsung.com (unknown [182.195.36.91]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4RK65R4S0sz4x9QB; Mon, 7 Aug 2023 06:35:39 +0000 (GMT) Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id FE.66.32393.BB090D46; Mon, 7 Aug 2023 15:35:39 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas2p4.samsung.com (KnoxPortal) with ESMTPA id 20230807063538epcas2p4965d5d117b8ef87ac4217bec53beff95~5Bl67FpCa0920509205epcas2p43; Mon, 7 Aug 2023 06:35:38 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230807063538epsmtrp15a4709b12f6903875d791f18d8e1ca6e~5Bl66AjFX2729227292epsmtrp1J; Mon, 7 Aug 2023 06:35:38 +0000 (GMT) X-AuditID: b6c32a48-adffa70000007e89-b1-64d090bb61b8 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id DD.1F.34491.AB090D46; Mon, 7 Aug 2023 15:35:38 +0900 (KST) Received: from jehoon-Precision-7920-Tower.dsn.sec.samsung.com (unknown [10.229.83.133]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230807063538epsmtip228fdd2b9d55344aa2776e77cf46889fd~5Bl6ua8ly1913019130epsmtip2g; Mon, 7 Aug 2023 06:35:38 +0000 (GMT) From: Jehoon Park To: linux-cxl@vger.kernel.org Cc: nvdimm@lists.linux.dev, Alison Schofield , Vishal Verma , Ira Weiny , Dan Williams , Dave Jiang , Davidlohr Bueso , Jonathan Cameron , Kyungsan Kim , Junhyeok Im , Jehoon Park Subject: [ndctl PATCH v2 2/3] libcxl: Fix accessors for temperature field to support negative value Date: Mon, 7 Aug 2023 15:35:48 +0900 Message-Id: <20230807063549.5942-3-jehoon.park@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230807063549.5942-1-jehoon.park@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrBKsWRmVeSWpSXmKPExsWy7bCmhe7uCRdSDLa9VbS4+/gCm8X0qRcY LU7cbGSzWH1zDaPF/qfPWSwOvG5gt1i18BqbxeKjM5gtju7hsDg/6xSLxcoff1gtbk04xuTA 49Fy5C2rx+I9L5k8XmyeyejRt2UVo8fU2fUenzfJBbBFZdtkpCampBYppOYl56dk5qXbKnkH xzvHm5oZGOoaWlqYKynkJeam2iq5+AToumXmAJ2opFCWmFMKFApILC5W0rezKcovLUlVyMgv LrFVSi1IySkwL9ArTswtLs1L18tLLbEyNDAwMgUqTMjOmPx6HlPBVsmKWeusGxg7RLsYOTkk BEwkVnWtYOxi5OIQEtjBKPHhz2U2COcTo8T2czeZIJxvjBIvfn5lg2n5fvMxK0RiL6PEjY/b 2SGcXiaJttObGEGq2AS0Je5v3wDWISIgK9G87gHYKGaBzcwSy3aeA0sIC6RK3L17gBnEZhFQ leh/MxUszitgLXH32QwWiHXyEqs3QNRwCthIrLv4Dmy1hMBXdolJj3czQRS5SFzt2gR1n7DE q+Nb2CFsKYmX/W1Qdr7Ez5O3WCHsAolPXz5ALTCWeHfzOVCcA+g6TYn1u/RBTAkBZYkjt8Aq mAX4JDoO/2WHCPNKdLQJQTSqSnQd/8AIYUtLHL5ylBnC9pBYcPs3NOT6GSW23N/JOIFRbhbC ggWMjKsYxVILinPTU4u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Ff8RW+KkEB6YklqdmpqQWoRTJaJg1OqgWl69O4Zuc7HuWtY jI8Xx/c1/690ORAmbG5amVys/XJCTkXJfCXJ3fclVzLFcSQdbdSfIGQ+06WxQa8zYc99AcEp N7fdYmnxn/hhkaLpzuM8t3fbzt82r7DylVi4xiZtv9kW60M6F8q9sDB3fLj51peqqzcKvzw9 UDXxnIrPvHVvdZ4W3xBXZeONdqqujv8Zk3Cra8qry/PYXv7UVN1pc+ktR5t324bfFhMPrLD4 I7WvyrT6yFqB3VLbL/TNK0m0fRK4XWHiW/db8X9fbz+bFlO5MG7iH+FJZyu3/TZLbWJTk33t 0xo9LSLtz88VmTuWH2u1TKrSEDhQxyvqfXi+yEOLvqiCpZt8Y/+zlB3f8V2JpTgj0VCLuag4 EQC+NW3bxQIAAA== X-CMS-MailID: 20230807063538epcas2p4965d5d117b8ef87ac4217bec53beff95 X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230807063538epcas2p4965d5d117b8ef87ac4217bec53beff95 References: <20230807063549.5942-1-jehoon.park@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org Add a new macro function to retrieve a signed value such as a temperature. Modify accessors for signed value to return INT_MAX when error occurs and set errno to corresponding errno codes. Signed-off-by: Jehoon Park --- cxl/lib/libcxl.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/cxl/lib/libcxl.c b/cxl/lib/libcxl.c index af4ca44..fc64de1 100644 --- a/cxl/lib/libcxl.c +++ b/cxl/lib/libcxl.c @@ -3661,11 +3661,23 @@ cxl_cmd_alert_config_get_life_used_prog_warn_threshold(struct cxl_cmd *cmd) life_used_prog_warn_threshold); } +#define cmd_get_field_s16(cmd, n, N, field) \ +do { \ + struct cxl_cmd_##n *c = \ + (struct cxl_cmd_##n *)cmd->send_cmd->out.payload; \ + int rc = cxl_cmd_validate_status(cmd, CXL_MEM_COMMAND_ID_##N); \ + if (rc) { \ + errno = -rc; \ + return INT_MAX; \ + } \ + return (int16_t)le16_to_cpu(c->field); \ +} while(0) + CXL_EXPORT int cxl_cmd_alert_config_get_dev_over_temperature_crit_alert_threshold( struct cxl_cmd *cmd) { - cmd_get_field_u16(cmd, get_alert_config, GET_ALERT_CONFIG, + cmd_get_field_s16(cmd, get_alert_config, GET_ALERT_CONFIG, dev_over_temperature_crit_alert_threshold); } @@ -3673,7 +3685,7 @@ CXL_EXPORT int cxl_cmd_alert_config_get_dev_under_temperature_crit_alert_threshold( struct cxl_cmd *cmd) { - cmd_get_field_u16(cmd, get_alert_config, GET_ALERT_CONFIG, + cmd_get_field_s16(cmd, get_alert_config, GET_ALERT_CONFIG, dev_under_temperature_crit_alert_threshold); } @@ -3681,7 +3693,7 @@ CXL_EXPORT int cxl_cmd_alert_config_get_dev_over_temperature_prog_warn_threshold( struct cxl_cmd *cmd) { - cmd_get_field_u16(cmd, get_alert_config, GET_ALERT_CONFIG, + cmd_get_field_s16(cmd, get_alert_config, GET_ALERT_CONFIG, dev_over_temperature_prog_warn_threshold); } @@ -3689,7 +3701,7 @@ CXL_EXPORT int cxl_cmd_alert_config_get_dev_under_temperature_prog_warn_threshold( struct cxl_cmd *cmd) { - cmd_get_field_u16(cmd, get_alert_config, GET_ALERT_CONFIG, + cmd_get_field_s16(cmd, get_alert_config, GET_ALERT_CONFIG, dev_under_temperature_prog_warn_threshold); } @@ -3905,8 +3917,6 @@ CXL_EXPORT int cxl_cmd_health_info_get_life_used(struct cxl_cmd *cmd) { int rc = health_info_get_life_used_raw(cmd); - if (rc < 0) - return rc; if (rc == CXL_CMD_HEALTH_INFO_LIFE_USED_NOT_IMPL) return -EOPNOTSUPP; return rc; @@ -3914,7 +3924,7 @@ CXL_EXPORT int cxl_cmd_health_info_get_life_used(struct cxl_cmd *cmd) static int health_info_get_temperature_raw(struct cxl_cmd *cmd) { - cmd_get_field_u16(cmd, get_health_info, GET_HEALTH_INFO, + cmd_get_field_s16(cmd, get_health_info, GET_HEALTH_INFO, temperature); } @@ -3922,10 +3932,10 @@ CXL_EXPORT int cxl_cmd_health_info_get_temperature(struct cxl_cmd *cmd) { int rc = health_info_get_temperature_raw(cmd); - if (rc < 0) - return rc; - if (rc == CXL_CMD_HEALTH_INFO_TEMPERATURE_NOT_IMPL) - return -EOPNOTSUPP; + if (rc == CXL_CMD_HEALTH_INFO_TEMPERATURE_NOT_IMPL) { + errno = EOPNOTSUPP; + return INT_MAX; + } return rc; } From patchwork Mon Aug 7 06:35:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jehoon Park X-Patchwork-Id: 13343113 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01A94C001DB for ; Mon, 7 Aug 2023 06:35:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230054AbjHGGfz (ORCPT ); Mon, 7 Aug 2023 02:35:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230476AbjHGGfx (ORCPT ); Mon, 7 Aug 2023 02:35:53 -0400 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67A31172C for ; Sun, 6 Aug 2023 23:35:51 -0700 (PDT) Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20230807063549epoutp03104d2f23da85a7a5cd7da11baac1e156~5BmFC_CyJ0969309693epoutp03b for ; Mon, 7 Aug 2023 06:35:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20230807063549epoutp03104d2f23da85a7a5cd7da11baac1e156~5BmFC_CyJ0969309693epoutp03b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1691390149; bh=Leo3A7Oaszp/5S8ja3I/nQK908gdWsvtnK3ZBXA6d14=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n9frTeBIO/WiyW4iLHc0zCdIYBJDOf86JLV2TPEFOlBJoKSDp4dS/Kr1WyKBQxtsT cs3gnp3WcoTD68ShjTIWgq9JfGjzV4u5PZzcS0dg4VF6m1GrBwWWFRQ+fyNmDgf9ZC 6IG6sjui69CEDz+YeVDyeV5WhYZlqsBPgGDvXsz4= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20230807063549epcas2p1b287f00db141e525463430f31424eb10~5BmEl1OHB0959509595epcas2p1H; Mon, 7 Aug 2023 06:35:49 +0000 (GMT) Received: from epsmgec2p1.samsung.com (unknown [182.195.36.102]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4RK65c5n3Gz4x9Px; Mon, 7 Aug 2023 06:35:48 +0000 (GMT) Received: from epcas2p1.samsung.com ( [182.195.41.53]) by epsmgec2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 49.53.49986.4C090D46; Mon, 7 Aug 2023 15:35:48 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas2p4.samsung.com (KnoxPortal) with ESMTPA id 20230807063547epcas2p4ccb33e410e77a94e088f283b8c2925db~5BmDTkOLd2298722987epcas2p4T; Mon, 7 Aug 2023 06:35:47 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20230807063547epsmtrp21083b8acda708987a7f7d44191720004~5BmDStPi72086220862epsmtrp2G; Mon, 7 Aug 2023 06:35:47 +0000 (GMT) X-AuditID: b6c32a43-5f9ff7000000c342-75-64d090c4a3fa Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id EF.1F.34491.3C090D46; Mon, 7 Aug 2023 15:35:47 +0900 (KST) Received: from jehoon-Precision-7920-Tower.dsn.sec.samsung.com (unknown [10.229.83.133]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230807063547epsmtip25ab034ba4198fd5b9a10c1356fd1bb94~5BmDBUzlQ2291222912epsmtip2S; Mon, 7 Aug 2023 06:35:47 +0000 (GMT) From: Jehoon Park To: linux-cxl@vger.kernel.org Cc: nvdimm@lists.linux.dev, Alison Schofield , Vishal Verma , Ira Weiny , Dan Williams , Dave Jiang , Davidlohr Bueso , Jonathan Cameron , Kyungsan Kim , Junhyeok Im , Jehoon Park Subject: [ndctl PATCH v2 3/3] cxl: Fix the checking value when listing device's health info Date: Mon, 7 Aug 2023 15:35:49 +0900 Message-Id: <20230807063549.5942-4-jehoon.park@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230807063549.5942-1-jehoon.park@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrKKsWRmVeSWpSXmKPExsWy7bCmqe6RCRdSDA7M0rG4+/gCm8X0qRcY LU7cbGSzWH1zDaPF/qfPWSwOvG5gt1i18BqbxeKjM5gtju7hsDg/6xSLxcoff1gtbk04xuTA 49Fy5C2rx+I9L5k8XmyeyejRt2UVo8fU2fUenzfJBbBFZdtkpCampBYppOYl56dk5qXbKnkH xzvHm5oZGOoaWlqYKynkJeam2iq5+AToumXmAJ2opFCWmFMKFApILC5W0rezKcovLUlVyMgv LrFVSi1IySkwL9ArTswtLs1L18tLLbEyNDAwMgUqTMjOeNWcUfCLs6Jt+UH2BsbZHF2MnBwS AiYS7csmsXYxcnEICexglNh55hQbhPOJUWLKu0ZGCOcbo8T152eYYVr6D51ngkjsZZSYOPcm VFUvk8TP/ndgVWwC2hL3t29gA7FFBGQlmt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YxcHEICuxkl5jZ2M0IkpCXuNV9hh7CFJe63HGGFKOpm kli/5x0zSIJNQFvi/vYNbCC2iICsRPO6B2CTmAX2Mkt0zDwP1MHBISwQLfH3qw2IySKgKtFy 1QWknFfAWmJV20JmiPnyEqs3HACzOQVsJNZdfAfWKQRUc/xe4gRGvgWMDKsYJVMLinPTc4sN CwzzUsv1ihNzi0vz0vWS83M3MYIDVUtzB+P2VR/0DjEycTAeYpTgYFYS4Z335HyKEG9KYmVV alF+fFFpTmrxIUZpDhYlcV7xF70pQgLpiSWp2ampBalFMFkmDk6pBqb0Tf9Z0zgXnDc1fC+3 /6p0j3vuwZX77T/43TrgtXX2tm2vo49UHZt1JO5mb2hE3exlKuznj0RMXiq9Ia5/7d/ov3Em j0555exR6jlrOO1zTm/G/9lr9l5epq/pNFvuumjS5YnRWd61rvmTrH1tViptnc+VZLnHSS/c LJh788U7p6rfZSukNealnP6ecmn//JJPEUp7m5Yre87IX/TnaW/Q308yAhN+vZ5xh79uSohm 2b6OtOt8d1NfV9xd+Khw0SmrGyHbu/45nmDd25LeOVPTX75rxlPH5Nilu9RvWksuNVjM8+pp YPodK669nrWrPrn9W79nnYTIwnR38Vvy6ode9vp47PJ+sWLa75cVGZxPlFiKMxINtZiLihMB SjpmfMMCAAA= X-CMS-MailID: 20230807063547epcas2p4ccb33e410e77a94e088f283b8c2925db X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230807063547epcas2p4ccb33e410e77a94e088f283b8c2925db References: <20230807063549.5942-1-jehoon.park@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org Fix the value for checking device's life used and temperature fields are implemented. Signed-off-by: Jehoon Park --- cxl/json.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cxl/json.c b/cxl/json.c index 7678d02..102bfaf 100644 --- a/cxl/json.c +++ b/cxl/json.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 // Copyright (C) 2015-2021 Intel Corporation. All rights reserved. +#include #include #include #include @@ -238,15 +239,15 @@ static struct json_object *util_cxl_memdev_health_to_json( json_object_object_add(jhealth, "ext_corrected_persistent", jobj); /* other fields */ - field = cxl_cmd_health_info_get_life_used(cmd); - if (field != 0xff) { - jobj = json_object_new_int(field); + rc = cxl_cmd_health_info_get_life_used(cmd); + if (rc != -EOPNOTSUPP) { + jobj = json_object_new_int(rc); if (jobj) json_object_object_add(jhealth, "life_used_percent", jobj); } field = cxl_cmd_health_info_get_temperature(cmd); - if (field != 0xffff) { + if (field != INT_MAX) { jobj = json_object_new_int(field); if (jobj) json_object_object_add(jhealth, "temperature", jobj);