From patchwork Mon Jul 17 06:29:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jehoon Park X-Patchwork-Id: 13315239 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 D58BAEB64DC for ; Mon, 17 Jul 2023 06:34:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229469AbjGQGeM (ORCPT ); Mon, 17 Jul 2023 02:34:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229450AbjGQGeL (ORCPT ); Mon, 17 Jul 2023 02:34:11 -0400 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBC88D9 for ; Sun, 16 Jul 2023 23:34:09 -0700 (PDT) Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20230717062626epoutp015e5349b399ebe72a2c979a8bf3dec56e~yk65CaWm12493924939epoutp01i for ; Mon, 17 Jul 2023 06:26:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20230717062626epoutp015e5349b399ebe72a2c979a8bf3dec56e~yk65CaWm12493924939epoutp01i DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1689575186; bh=J5pfay+vlkQzijjCfhEB6lCY4J+B6tZrRk6bAir7ttg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fI8pMMEDdfzjtvdBd59TerDaCkBYOIVc97nlrmrbXekcpdzkzk+cCOCppbsb10/kO iqZjgcFa9Vs2oauDcvOIm4ZcBnPZ3MFG2pXbY3FEUKWenpYXgHWem9cahgshwn9a7G a5qxY9Tq7hmGePIyeLLEI0DeuXbSi813721aBzIQ= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20230717062626epcas2p3b5b4d2e28f4219513a38aa33cf858e08~yk64fhWZy0784607846epcas2p3c; Mon, 17 Jul 2023 06:26:26 +0000 (GMT) Received: from epsmges2p2.samsung.com (unknown [182.195.36.100]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4R4BtT54T0z4x9Pv; Mon, 17 Jul 2023 06:26:25 +0000 (GMT) Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p2.samsung.com (Symantec Messaging Gateway) with SMTP id 16.8E.40133.11FD4B46; Mon, 17 Jul 2023 15:26:25 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas2p2.samsung.com (KnoxPortal) with ESMTPA id 20230717062624epcas2p2c5a14cb450b04ccc0ccd2292312d9636~yk63N8kX13261632616epcas2p2z; Mon, 17 Jul 2023 06:26:24 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20230717062624epsmtrp20af06d8ef2adeb0a1cc010ce2dd367e5~yk63M4Zok0871408714epsmtrp2N; Mon, 17 Jul 2023 06:26:24 +0000 (GMT) X-AuditID: b6c32a46-4edb870000009cc5-97-64b4df11f83e Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 75.9F.34491.01FD4B46; Mon, 17 Jul 2023 15:26:24 +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 20230717062624epsmtip259361e9fe7e20a78254512b004bd0a84~yk62_uWHm1559215592epsmtip2i; Mon, 17 Jul 2023 06:26:24 +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 RESEND 1/2] cxl: Update a revision by CXL 3.0 specification Date: Mon, 17 Jul 2023 15:29:07 +0900 Message-Id: <20230717062908.8292-2-jehoon.park@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230717062908.8292-1-jehoon.park@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrBKsWRmVeSWpSXmKPExsWy7bCmha7g/S0pBs+WKVrcfXyBzWL61AuM FiduNrJZrL65htFi/9PnLBYHXjewW6xaeI3NYvHRGcwWR/dwWJyfdYrFYuWPP6wWtyYcY3Lg 8Wg58pbVY/Gel0weLzbPZPTo27KK0WPq7HqPz5vkAtiism0yUhNTUosUUvOS81My89JtlbyD 453jTc0MDHUNLS3MlRTyEnNTbZVcfAJ03TJzgE5UUihLzCkFCgUkFhcr6dvZFOWXlqQqZOQX l9gqpRak5BSYF+gVJ+YWl+al6+WlllgZGhgYmQIVJmRnXL48kbFgCWfF9kv9jA2Mt9m7GDk5 JARMJHpWLWPrYuTiEBLYwShx/edidgjnE6PEp+unmSCcb4wS2+aegWvZt/I3I0RiL6PEmTOL mCGcXiaJzm0dTCBVbALaEve3b2ADsUUEZCWa1z0AG8UssJlZYtnOc2AJYYFgiflP28HGsgio Styf/hKsmVfAWuJ/5yYmiHXyEqs3HGAGsTkFbCRmTP/KCBH/yi6xbZ8BhO0i8f3gaTYIW1ji 1fEtUKdKSXx+txcqni/x8+QtVgi7QOLTlw8sELaxxLubz4HiHEDHaUqs36UPYkoIKEscuQVW wSzAJ9Fx+C87RJhXoqNNCKJRVaLr+AeoY6QlDl85ygxhe0h0rV3MCgmSfkaJpU8+M01glJuF sGABI+MqRrHUguLc9NRiowIjeIwl5+duYgQnQS23HYx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2kwuk9sv9PazG sexsfutJh5+dijsspnSHRi0LmyPasesK57NZqQ3uHBwX+GoT/t//OJHBRufCgiWsjKuW/tp8 h8c6hXXhvvX/XzPU8s5TOBKzYJPI8rrXMT0bmy8c+3hu3o2+qmcnTHfKXjmTYXXD8P43X/mI YosDO3Ywvlr8o7/5x7K7q/kfvC173fU+3FJ726kWpRals/5XOTuWln1I8T8wwd8uIbvML2eD 2TOdvXWKjPGLrm3WWSda9ZtrYlFfVeLaTx4e/PellzwyWyOUNmWn+HKOiotuvK+zZ+xbqh7z 7mV8Y2TRIomY5/ybZ/+Ws92/9ZXdReYjSnKLFlQIOTBH67K4lO48ET3JpUmJpTgj0VCLuag4 EQCbSymNxwIAAA== X-CMS-MailID: 20230717062624epcas2p2c5a14cb450b04ccc0ccd2292312d9636 X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230717062624epcas2p2c5a14cb450b04ccc0ccd2292312d9636 References: <20230717062908.8292-1-jehoon.park@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org 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 Mon Jul 17 06:29:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jehoon Park X-Patchwork-Id: 13315242 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 DFC1EEB64DC for ; Mon, 17 Jul 2023 06:36:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229471AbjGQGgt (ORCPT ); Mon, 17 Jul 2023 02:36:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229587AbjGQGgs (ORCPT ); Mon, 17 Jul 2023 02:36:48 -0400 Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B797510C8 for ; Sun, 16 Jul 2023 23:36:31 -0700 (PDT) Received: from epcas2p2.samsung.com (unknown [182.195.41.54]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20230717062634epoutp04764f90ef769a3fe10e1640bbb5bcddd1~yk7Al8Z090399503995epoutp04c for ; Mon, 17 Jul 2023 06:26:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20230717062634epoutp04764f90ef769a3fe10e1640bbb5bcddd1~yk7Al8Z090399503995epoutp04c DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1689575195; bh=FOuFAPtD9D4ZvNiRTsQvEk28ooi0o+1F6WOqazOptTA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X3VANfnFWWZUQtI/wRKv2mS582m7qWD6LRpb7aFTXhRxqaSEyV91v7VRNxPvBeQPz t7C5NgebG6izIKzY3yNVdI6H9tj5hs0Qp4HKYNoCIbjdHsxkj8CBVqo46XekMfYwwq QbSZJffGYdnyvHHaXexro87HTShYWTMxX1S9mnJ8= Received: from epsnrtp4.localdomain (unknown [182.195.42.165]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20230717062634epcas2p31fd2ad017fb5f54d42205e3ce6af3f58~yk7AHE46Q0111201112epcas2p3i; Mon, 17 Jul 2023 06:26:34 +0000 (GMT) Received: from epsmges2p1.samsung.com (unknown [182.195.36.98]) by epsnrtp4.localdomain (Postfix) with ESMTP id 4R4Btd6X2kz4x9Q7; Mon, 17 Jul 2023 06:26:33 +0000 (GMT) Received: from epcas2p4.samsung.com ( [182.195.41.56]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id 0E.A7.49913.91FD4B46; Mon, 17 Jul 2023 15:26:33 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas2p4.samsung.com (KnoxPortal) with ESMTPA id 20230717062633epcas2p44517748291e35d023f19cf00b4f85788~yk6__UDPM1632216322epcas2p4G; Mon, 17 Jul 2023 06:26:33 +0000 (GMT) Received: from epsmgmc1p1new.samsung.com (unknown [182.195.42.40]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20230717062633epsmtrp2a17248c0f7681fc22f5e4ec697379735~yk6_9ce0d0871408714epsmtrp2p; Mon, 17 Jul 2023 06:26:33 +0000 (GMT) X-AuditID: b6c32a45-5cfff7000000c2f9-c0-64b4df19297d Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgmc1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id E2.41.14748.91FD4B46; Mon, 17 Jul 2023 15:26:33 +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 20230717062632epsmtip23b96c6a6a6df2e863e268c747d90bc46~yk6_uTAmT1582615826epsmtip2P; Mon, 17 Jul 2023 06:26:32 +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 RESEND 2/2] libcxl: Fix accessors for temperature field to support negative value Date: Mon, 17 Jul 2023 15:29:08 +0900 Message-Id: <20230717062908.8292-3-jehoon.park@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230717062908.8292-1-jehoon.park@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrOKsWRmVeSWpSXmKPExsWy7bCmha7k/S0pBhPeGljcfXyBzWL61AuM FiduNrJZrL65htFi/9PnLBYHXjewW6xaeI3NYvHRGcwWR/dwWJyfdYrFYuWPP6wWtyYcY3Lg 8Wg58pbVY/Gel0weLzbPZPTo27KK0WPq7HqPz5vkAtiism0yUhNTUosUUvOS81My89JtlbyD 453jTc0MDHUNLS3MlRTyEnNTbZVcfAJ03TJzgE5UUihLzCkFCgUkFhcr6dvZFOWXlqQqZOQX l9gqpRak5BSYF+gVJ+YWl+al6+WlllgZGhgYmQIVJmRnrD16jrnguHTF5X0/mRoY/4p1MXJw SAiYSPRO4u5i5OIQEtjBKHH58h82COcTo8TGbZ/ZIZxvjBK/vj5i6WLkBOv4sOYSE0RiL6PE 33kdYAkhgV4miScrTUBsNgFtifvbN7CB2CICshLN6x6ANTALbGaWWLbzHFhCWCBTonnBKnYQ m0VAVaJt5lomEJtXwFpi6b17bBDb5CVWbzjADGJzCthIzJj+lRFkkITA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PPs4IkhAXSJd49mwrWwCKgKtE2 cy0TiM0rYC2x9N49NogN8hKrNxxgBrE5BWwkZkz/ClYvBFTz4MVv5gmMfAsYGVYxSqYWFOem 5yYbFhjmpZbrFSfmFpfmpesl5+duYgQHrJbGDsZ78//pHWJk4mA8xCjBwawkwvt91aYUId6U xMqq1KL8+KLSnNTiQ4zSHCxK4ryGM2anCAmkJ5akZqemFqQWwWSZODilGpjs5sYteDnzcmt4 fM4Ot4yrB99Ldj95Z5PPMuO5Osv09DvnM3Zv2X97v9ytQnfLAqbDd+t9vtd/t/y6LHBbF9Mv yasLDs2apNLRyJNxaUKJR7k3o6/MTDn+WpU7H3+IGpm23xJ8tdt388edR1Oc76eqzTjvneWT dV9TbeeVyDCLmBytR1rO0s9C67pm2i+XNC58ZLTOJrvx5NWz66O6nrDe+non94NuYHPkg05l 8+r/zS+8tsiLzxV6p/M3K/SNW52E81kzOwaZR6r6YbslvB4u3qX0gfcwc9DpidE6DKUzt9xw 0TvnvcBqpv8Fjfxr1U4/2WY9PnvDfkvGvNbdOztPxhxieDDt5Gc5z6uvNqxVYinOSDTUYi4q TgQA1KI5xMcCAAA= X-CMS-MailID: 20230717062633epcas2p44517748291e35d023f19cf00b4f85788 X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230717062633epcas2p44517748291e35d023f19cf00b4f85788 References: <20230717062908.8292-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. 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; }