From patchwork Fri Jun 16 01:08:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jehoon Park X-Patchwork-Id: 13281912 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 E1834EB64D9 for ; Fri, 16 Jun 2023 01:06:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232101AbjFPBGL (ORCPT ); Thu, 15 Jun 2023 21:06:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229581AbjFPBGK (ORCPT ); Thu, 15 Jun 2023 21:06:10 -0400 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2D601FE2 for ; Thu, 15 Jun 2023 18:06:08 -0700 (PDT) Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20230616010606epoutp047e8f2ff069f4ae282937b035c2d8d66a~o-jWG33ts1701317013epoutp04C for ; Fri, 16 Jun 2023 01:06:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20230616010606epoutp047e8f2ff069f4ae282937b035c2d8d66a~o-jWG33ts1701317013epoutp04C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1686877566; bh=1RD42/3HhrAJUGHbUqWPQ03lONA6GWvvAqGel7VQqnU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p00WxwO3WyfuPNMeTkB8s9Psoc7vXKGSesH2HN3QdkMTVHGPM4HzgSnLI5tV+GXii eT1dboY3e28UCyy91o0Z+hUPjmBFdZK21QcWDwPYKG3/kz3knVUOJqw0vXsOKAuaDt v3PFmaOoqaGMe0ookMeGdl05Fh48iwIPbB5Elpgs= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20230616010605epcas2p3432f0d5566b4aaa4905726c6627b53cb~o-jVilu6o0389903899epcas2p3C; Fri, 16 Jun 2023 01:06:05 +0000 (GMT) Received: from epsmges2p1.samsung.com (unknown [182.195.36.92]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4Qj1F916tbz4x9Q2; Fri, 16 Jun 2023 01:06:05 +0000 (GMT) Received: from epcas2p2.samsung.com ( [182.195.41.54]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 0B.0F.11450.D75BB846; Fri, 16 Jun 2023 10:06:05 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas2p3.samsung.com (KnoxPortal) with ESMTPA id 20230616010604epcas2p3399f53ee96eb819678fc79eff2ae6ab6~o-jUxv13d0162901629epcas2p3a; Fri, 16 Jun 2023 01:06:04 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230616010604epsmtrp137a1a9b7a1ead3c0a645224f0704f870~o-jUxDeBH2991329913epsmtrp1E; Fri, 16 Jun 2023 01:06:04 +0000 (GMT) X-AuditID: b6c32a45-1dbff70000022cba-3b-648bb57d18ea Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 5F.23.27706.C75BB846; Fri, 16 Jun 2023 10:06:04 +0900 (KST) Received: from jehoon-Precision-7920-Tower.dsn.sec.samsung.com (unknown [10.229.83.133]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20230616010604epsmtip10213b934bf775696447b25fca056bc7f~o-jUmClsJ2136821368epsmtip1Z; Fri, 16 Jun 2023 01:06:04 +0000 (GMT) From: Jehoon PARK To: linux-cxl@vger.kernel.org Cc: nvdimm@lists.linux.dev, Alison Schofield , Vishal Verma , Ira Weiny , Ben Widawsky , Dan Williams , Dave Jiang , Jehoon Park Subject: [ndctl PATCH 1/2] cxl: Update a revision by CXL 3.0 specification Date: Fri, 16 Jun 2023 10:08:40 +0900 Message-Id: <20230616010841.3632-2-jehoon.park@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230616010841.3632-1-jehoon.park@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrKKsWRmVeSWpSXmKPExsWy7bCmmW7t1u4Ugytn2SzuPr7AZtE8eTGj xfSpFxgtTtxsZLPY//Q5i8WB1w3sFudnnWKxWPnjD6vFrQnHmBw4PRbvecnksWlVJ5vHi80z GT36tqxi9Pi8SS6ANSrbJiM1MSW1SCE1Lzk/JTMv3VbJOzjeOd7UzMBQ19DSwlxJIS8xN9VW ycUnQNctMwfoICWFssScUqBQQGJxsZK+nU1RfmlJqkJGfnGJrVJqQUpOgXmBXnFibnFpXrpe XmqJlaGBgZEpUGFCdsbSCz/ZCi5zVsw/XNvA2MzRxcjJISFgInG8dS9rFyMXh5DADkaJNW83 sEA4nxgldu+ezg7hfGOUaF/ZCpThAGvpf1sDEd/LKNG5YhtUey+TxJ3NN1hA5rIJaEu0971l BLFFBGQlmtc9YAIpYhbYwCSxYuExZpCEsICXxKunL9lBbBYBVYnnTd/BmnkFrCVuLp/MCHGg vMTqDQfA6jkFbCSm7XgLNkhC4Bq7xNWfi9kgilwkHq3vYYGwhSVeHd/CDmFLSbzsb4Oy8yV+ nrzFCmEXSHz68gGq3lji3c3nrCCvMQtoSqzfpQ/xpbLEkVtgFcwCfBIdh/+yQ4R5JTrahCAa VSW6jn+AulJa4vCVo8wQtofE7B+b2CBh0s8osfX5HJYJjHKzEBYsYGRcxSiWWlCcm55abFRg CI+w5PzcTYzg9KbluoNx8tsPeocYmTgYDzFKcDArifAuO9GVIsSbklhZlVqU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6rFnFRv5DvgHM4YslPZKMuQ99M7Jq4F9wJuNb/n9Bo1t2M9sUeSO+5q2vmrl01/y362te fbk3+2qr1CL97MpNn0q0eTf8ONo5wXPmr58ydU3d93qedE05yx1o7xAVNOdnmkTWk98Tux/a Ldoz3z58pVJRb8JdsxKvtAu1q9qcene+33fhQ3/Y+yzHm+Ucy/Rnh/xleuzGttvSo/bkh4Vm acyS3NOPZNyfZWHH4J3zTE9+/68tcaGpk6J7U+63/r4g4KXN0lT5e76YQxnfjv8udTYFd/Zy /NiW+/TXJbasmZXxDH46e9hLxIpuFeaWK7EUZyQaajEXFScCAOMs5J6zAgAA X-CMS-MailID: 20230616010604epcas2p3399f53ee96eb819678fc79eff2ae6ab6 X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230616010604epcas2p3399f53ee96eb819678fc79eff2ae6ab6 References: <20230616010841.3632-1-jehoon.park@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org From: Jehoon Park Update the value of device temperature field when it is not implemented. (CXL 3.0 8.2.9.8.3.1) Signed-off-by: Jehoon Park --- cxl/json.c | 2 +- cxl/lib/private.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cxl/json.c b/cxl/json.c index 9a4b5c7..3661eb9 100644 --- a/cxl/json.c +++ b/cxl/json.c @@ -155,7 +155,7 @@ static struct json_object *util_cxl_memdev_health_to_json( } field = cxl_cmd_health_info_get_temperature(cmd); - if (field != 0xffff) { + if (field != 0x7fff) { jobj = json_object_new_int(field); if (jobj) json_object_object_add(jhealth, "temperature", jobj); diff --git a/cxl/lib/private.h b/cxl/lib/private.h index d49b560..e92592d 100644 --- a/cxl/lib/private.h +++ b/cxl/lib/private.h @@ -324,7 +324,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 Fri Jun 16 01:08:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jehoon Park X-Patchwork-Id: 13281914 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 71326EB64D9 for ; Fri, 16 Jun 2023 01:06:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232788AbjFPBGU (ORCPT ); Thu, 15 Jun 2023 21:06:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230099AbjFPBGT (ORCPT ); Thu, 15 Jun 2023 21:06:19 -0400 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D872296E for ; Thu, 15 Jun 2023 18:06:18 -0700 (PDT) Received: from epcas2p2.samsung.com (unknown [182.195.41.54]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20230616010614epoutp0232d958e9d600230179d7cc0ac324c184~o-jd4HztN2884028840epoutp02i for ; Fri, 16 Jun 2023 01:06:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20230616010614epoutp0232d958e9d600230179d7cc0ac324c184~o-jd4HztN2884028840epoutp02i DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1686877574; bh=vA9DFA9kELh2hhQR8GlB+evZh96ipZlMIxxWmmxZZ8Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LAKWifA3/Nw6Gq8o9MKL5E9lLIiYZhZBodLKMhZTCbD7vjknEPj7oYMTUUs/+/Epu cr0oI+gYCi+xJvhaQeq+8+Av+RTY+cKLzgsTPP/H7xp9AiuPxtwDyftI/OUDr9w4yv uHtzKFnEHuHNAtyYNyIPJQ+kFdUQMO4x4+vbnmAQ= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20230616010614epcas2p3fc3062a13d2516da02d3bdd2057feeb7~o-jdX_U-h0162901629epcas2p34; Fri, 16 Jun 2023 01:06:14 +0000 (GMT) Received: from epsmges2p1.samsung.com (unknown [182.195.36.91]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4Qj1FK3THFz4x9Pw; Fri, 16 Jun 2023 01:06:13 +0000 (GMT) Received: from epcas2p1.samsung.com ( [182.195.41.53]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id A0.4F.11450.585BB846; Fri, 16 Jun 2023 10:06:13 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas2p4.samsung.com (KnoxPortal) with ESMTPA id 20230616010613epcas2p4970d8588a29154fa355e14f44943a80b~o-jchl8_41248912489epcas2p4A; Fri, 16 Jun 2023 01:06:13 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20230616010613epsmtrp20a0b05e074b3b5f12846d04a6cd28142~o-jcfo7GX2823928239epsmtrp2Y; Fri, 16 Jun 2023 01:06:13 +0000 (GMT) X-AuditID: b6c32a45-1dbff70000022cba-7c-648bb5859e7f Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 45.2A.28392.485BB846; Fri, 16 Jun 2023 10:06:13 +0900 (KST) Received: from jehoon-Precision-7920-Tower.dsn.sec.samsung.com (unknown [10.229.83.133]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20230616010612epsmtip1a7eca9e25b89c5fdda7b35ac1ff49f64~o-jcTTNJI1453014530epsmtip1a; Fri, 16 Jun 2023 01:06:12 +0000 (GMT) From: Jehoon PARK To: linux-cxl@vger.kernel.org Cc: nvdimm@lists.linux.dev, Alison Schofield , Vishal Verma , Ira Weiny , Ben Widawsky , Dan Williams , Dave Jiang , Jehoon Park Subject: [ndctl PATCH 2/2] libcxl: Fix accessors for temperature field to support negative value Date: Fri, 16 Jun 2023 10:08:41 +0900 Message-Id: <20230616010841.3632-3-jehoon.park@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230616010841.3632-1-jehoon.park@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrGKsWRmVeSWpSXmKPExsWy7bCmqW7r1u4Ug8bzUhZ3H19gs2ievJjR YvrUC4wWJ242slnsf/qcxeLA6wZ2i/OzTrFYrPzxh9Xi1oRjTA6cHov3vGTy2LSqk83jxeaZ jB59W1YxenzeJBfAGpVtk5GamJJapJCal5yfkpmXbqvkHRzvHG9qZmCoa2hpYa6kkJeYm2qr 5OIToOuWmQN0kJJCWWJOKVAoILG4WEnfzqYov7QkVSEjv7jEVim1ICWnwLxArzgxt7g0L10v L7XEytDAwMgUqDAhO6NrzVu2gm/SFQfnf2NrYFwq3sXIySEhYCKxs/8rSxcjF4eQwA5Gid0P T7FBOJ8YJZZuvgmV+cwosWzPUjaYlql7LzFBJHYxShz4uheqpZdJYs3lZ4wgVWwC2hLtfW/B bBEBWYnmdQ/AOpgFNjBJrFh4jLmLkYNDWCBJ4ukWG5AaFgFViXXvzzGB2LwC1hIdK68yQWyT l1i94QAziM0pYCMxbcdbsDkSApfYJaZfussMUeQiMXXVLRYIW1ji1fEt7BC2lMTnd3uhzs6X +HnyFiuEXSDx6csHqHpjiXc3n7OC3MMsoCmxfpc+iCk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i2tHYx7Vn3QO8TIxMF4iFGCg1lJhHfZia4UId6UxMqq1KL8+KLSnNTiQ4zSHCxK4rwX uk7GCwmkJ5akZqemFqQWwWSZODilGpikP/GcXhhdvtHhhLs7T4m88bWS2P0cEd9m5T0/13Cm 7t4RjSutCbXWVzO7Z/Eo6LXUyO879NSo92qHpPnt7HQutTlPkkVv8gWI6jj2fNge1b26Id9w J2toSOfMU9xluwQUZtifzp0yrdr0Z47edKv4lvNlS9uz7vBdn2h6Kv1Aq1Ny66JFQf8vlzU2 vQ2cdXev3AGvY7F7RE4929hQ5hMwT+jwN/WLHAsjeq9ZLjSptzjcpVF7L2a9wMOaqPTHSl1L vJRrxXbPKXy4b+nOulNCfR53TfbpvbnQ9n7O0itXjitGGoU7fy3p+MbHZGW1y0rCwsLi6T29 8rpFu+0ijPdPnxbv7zlDs9ytplfqmxJLcUaioRZzUXEiALmEdDO1AgAA X-CMS-MailID: 20230616010613epcas2p4970d8588a29154fa355e14f44943a80b X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230616010613epcas2p4970d8588a29154fa355e14f44943a80b References: <20230616010841.3632-1-jehoon.park@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org From: Jehoon Park Add a new macro function to retrieve a signed value such as a temperature. Replace indistinguishable error numbers with debug message. Signed-off-by: Jehoon Park --- cxl/lib/libcxl.c | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/cxl/lib/libcxl.c b/cxl/lib/libcxl.c index 769cd8a..fca7faa 100644 --- a/cxl/lib/libcxl.c +++ b/cxl/lib/libcxl.c @@ -3452,11 +3452,21 @@ 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) \ + return 0xffff; \ + 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); } @@ -3464,7 +3474,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); } @@ -3472,7 +3482,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); } @@ -3480,7 +3490,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); } @@ -3695,28 +3705,34 @@ static int health_info_get_life_used_raw(struct cxl_cmd *cmd) CXL_EXPORT int cxl_cmd_health_info_get_life_used(struct cxl_cmd *cmd) { int rc = health_info_get_life_used_raw(cmd); + struct cxl_ctx *ctx = cxl_memdev_get_ctx(cmd->memdev); if (rc < 0) - return rc; + dbg(ctx, "%s: Invalid command status\n", + cxl_memdev_get_devname(cmd->memdev)); if (rc == CXL_CMD_HEALTH_INFO_LIFE_USED_NOT_IMPL) - return -EOPNOTSUPP; + dbg(ctx, "%s: Life Used not implemented\n", + cxl_memdev_get_devname(cmd->memdev)); return rc; } 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); } CXL_EXPORT int cxl_cmd_health_info_get_temperature(struct cxl_cmd *cmd) { int rc = health_info_get_temperature_raw(cmd); + struct cxl_ctx *ctx = cxl_memdev_get_ctx(cmd->memdev); - if (rc < 0) - return rc; + if (rc == 0xffff) + dbg(ctx, "%s: Invalid command status\n", + cxl_memdev_get_devname(cmd->memdev)); if (rc == CXL_CMD_HEALTH_INFO_TEMPERATURE_NOT_IMPL) - return -EOPNOTSUPP; + dbg(ctx, "%s: Device Temperature not implemented\n", + cxl_memdev_get_devname(cmd->memdev)); return rc; }