From patchwork Sun Feb 2 10:46:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avi Shchislowski X-Patchwork-Id: 11361559 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0E6DC14D5 for ; Sun, 2 Feb 2020 10:47:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D726C206D3 for ; Sun, 2 Feb 2020 10:47:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="oSYLAxkx" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726837AbgBBKrJ (ORCPT ); Sun, 2 Feb 2020 05:47:09 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:8763 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725942AbgBBKrJ (ORCPT ); Sun, 2 Feb 2020 05:47:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1580640428; x=1612176428; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=mL+pSGCYlrKyit46RFmfv6r8QXFWeRdsOxWCMEsG/0g=; b=oSYLAxkx1IYiQrssWpY3o7ToDcIszWHhtN73lzPlx3xmkfbsg+lfwESg UWjcgUhFtGoyhLnieFnxnEew3ooMPAM6HbAzy5CDdVZx/F2mmBI1AqNNM NVh61jJEmNDqguiWn3Dp2y3Hxmn6uWqQ2vdiCdytTCRn+uZwFrt3K0+Bg 1KUbSu1Kqemig3MoUKt1mD6wMID/2/l2UOXihM/4YXK0rt9Mn+w9gs+R2 raBa1WzGkxH/zDx/gwycR7uhpDH0H/cyQ8MiKuGP/0J81O7JxZA2E9hAQ qMQjsPuaV15NsK/qRl6d0R3lzEdXb73NjninZVopi2xPKrdZdKoX0SBkn g==; IronPort-SDR: 0tyEpLmbqoKodY9sO5Bxhi7r4QwX+XPGfxlzCw1WB7pdJfsh8V8pgGY8gjtp6AThQwdt4NtWLv SoWQSRZhe4WzUbT62ZEuRJjT03pAnbTKc3tNdhME+Qc8KsrnQWT+tLUuCUCmZlkQq6gBbmLM33 Z3z4CkxTM7jjViHoUkVwUHND4Zq2akFRHjC4niL95tE9ZYgHDqlEpJsiCWRVDZGAJ4K2gPBeAK kacgmEVY5oA+WC4v9+RxjY3KGOsb+BbHaLAtB/s6RRN+0tip2k5CITHCR/tDiJ0h/ZsF2ySdfo Mlg= X-IronPort-AV: E=Sophos;i="5.70,393,1574092800"; d="scan'208";a="128925962" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 02 Feb 2020 18:47:08 +0800 IronPort-SDR: SD1M1BcQlD9D4GWArxY3bkcgB32875xumPSH/1WIbjLGoR+nCd8p9ogGstjDhjHUshAntOn1OR KiuYCZhGTwwO9fnsP7khYh7YGT8fTSms512YVpR4ccSVEnsPCJdBy1vlZ7th2etGGNOSB5H+F9 aO0QEdexWlmnI01stoXS1XLAJmlaS2NQT5YSxCRzDtMf/miF8GDVihlML/N3zNGnUWeoQA0CRP HM2kCfSylhOQFvbKbYDxgyimVIVY8h+NVzwJtfPiNZjEiyTKrmaOCUX6KJm1QyJHZmWGVjaEvX P/bKPtVstnRdTlh2sjohmV51 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2020 02:40:14 -0800 IronPort-SDR: qjXU+kNMVjD/uB5E8K/KveGzemG/Os9Q9m8XCC3dX7yM7lkjKj5XCjcYeMI60AdIVICq1HwNpj J6GqcIJHxuRk2/QhhJKo/ylNlgxmZTAxAIB25bLpIgYGlei7C8rv48wXn3GEEegyXpvh5CPjoV iHZZoS/m3MUr5NhDGqessYmov06YlnLyccHXjWqw95ipNvZwK0OKCq9W9ksmc6U0GgZ/RODp8e OyJX7VT9r7zX1e+DlrvuoLTfcg1dRoYAheQWR9ngHYsjHLUSEVVYyqqaS1XgN81u50i66SqcCi J9Y= WDCIronportException: Internal Received: from kfae419068.sdcorp.global.sandisk.com ([10.0.231.195]) by uls-op-cesaip01.wdc.com with ESMTP; 02 Feb 2020 02:47:06 -0800 From: Avi Shchislowski To: Alim Akhtar , Avri Altman , "James E.J. Bottomley" , "Martin K. Petersen" , linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org Cc: Avi Shchislowski , Uri Yanai Subject: [PATCH 1/5] scsi: ufs: Add ufs thermal support Date: Sun, 2 Feb 2020 12:46:55 +0200 Message-Id: <1580640419-6703-2-git-send-email-avi.shchislowski@wdc.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1580640419-6703-1-git-send-email-avi.shchislowski@wdc.com> References: <1580640419-6703-1-git-send-email-avi.shchislowski@wdc.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Support the new temperature notification attributes introduced in UFSv3.0. Add exception event mask, and ufs features attributes. Signed-off-by: Uri Yanai Signed-off-by: Avi Shchislowski --- drivers/scsi/ufs/Kconfig | 11 ++++ drivers/scsi/ufs/Makefile | 1 + drivers/scsi/ufs/ufs-thermal.c | 123 +++++++++++++++++++++++++++++++++++++++++ drivers/scsi/ufs/ufs-thermal.h | 19 +++++++ drivers/scsi/ufs/ufs.h | 11 ++++ drivers/scsi/ufs/ufshcd.c | 3 + drivers/scsi/ufs/ufshcd.h | 10 ++++ 7 files changed, 178 insertions(+) create mode 100644 drivers/scsi/ufs/ufs-thermal.c create mode 100644 drivers/scsi/ufs/ufs-thermal.h diff --git a/drivers/scsi/ufs/Kconfig b/drivers/scsi/ufs/Kconfig index d14c224..bed56ee 100644 --- a/drivers/scsi/ufs/Kconfig +++ b/drivers/scsi/ufs/Kconfig @@ -160,3 +160,14 @@ config SCSI_UFS_BSG Select this if you need a bsg device node for your UFS controller. If unsure, say N. + +config THERMAL_UFS + bool "Thermal UFS" + depends on THERMAL && SCSI_UFSHCD + help + A UFS3.0 feature that allows using the ufs device as a temperature + sensor. it provide notification to the host when the UFS device + case temperature approaches its pre-defined boundaries. + + Select Y to enable this feature, otherwise say N. + If unsure, say N. \ No newline at end of file diff --git a/drivers/scsi/ufs/Makefile b/drivers/scsi/ufs/Makefile index 94c6c5d..fd35941 100644 --- a/drivers/scsi/ufs/Makefile +++ b/drivers/scsi/ufs/Makefile @@ -12,3 +12,4 @@ obj-$(CONFIG_SCSI_UFSHCD_PLATFORM) += ufshcd-pltfrm.o obj-$(CONFIG_SCSI_UFS_HISI) += ufs-hisi.o obj-$(CONFIG_SCSI_UFS_MEDIATEK) += ufs-mediatek.o obj-$(CONFIG_SCSI_UFS_TI_J721E) += ti-j721e-ufs.o +obj-$(CONFIG_THERMAL_UFS) += ufs-thermal.o diff --git a/drivers/scsi/ufs/ufs-thermal.c b/drivers/scsi/ufs/ufs-thermal.c new file mode 100644 index 0000000..469c1ed --- /dev/null +++ b/drivers/scsi/ufs/ufs-thermal.c @@ -0,0 +1,123 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * thermal ufs + * + * Copyright (C) 2020 Western Digital Corporation + */ +#include +#include "ufs-thermal.h" + +enum { + UFS_THERM_MAX_TEMP, + UFS_THERM_HIGH_TEMP, + UFS_THERM_LOW_TEMP, + UFS_THERM_MIN_TEMP, + + /* keep last */ + UFS_THERM_MAX_TRIPS +}; + +/** + *struct ufs_thermal - thermal zone related data + * @tzone: thermal zone device data + */ +static struct ufs_thermal { + struct thermal_zone_device *zone; +} thermal; + +static struct thermal_zone_device_ops ufs_thermal_ops = { + .get_temp = NULL, + .get_trip_temp = NULL, + .get_trip_type = NULL, +}; + +static int ufs_thermal_enable_ee(struct ufs_hba *hba) +{ + /* later */ + return -EINVAL; +} + +static void ufs_thermal_zone_unregister(struct ufs_hba *hba) +{ + if (thermal.zone) { + dev_dbg(hba->dev, "Thermal zone device unregister\n"); + thermal_zone_device_unregister(thermal.zone); + thermal.zone = NULL; + } +} + +static int ufs_thermal_register(struct ufs_hba *hba) +{ + int err = 0; + char name[THERMAL_NAME_LENGTH] = {}; + + snprintf(name, THERMAL_NAME_LENGTH, "ufs_storage_%d", + hba->host->host_no); + + thermal.zone = thermal_zone_device_register(name, UFS_THERM_MAX_TRIPS, + 0, hba, &ufs_thermal_ops, NULL, 0, 0); + if (IS_ERR(thermal.zone)) { + err = PTR_ERR(thermal.zone); + dev_err(hba->dev, "Failed to register to thermal zone, err %d\n", + err); + thermal.zone = NULL; + goto out; + } + + /* thermal support is enabled only after successful + * enablement of thermal exception + */ + if (ufs_thermal_enable_ee(hba)) { + dev_info(hba->dev, "Failed to enable thermal exception\n"); + ufs_thermal_zone_unregister(hba); + err = -EINVAL; + } + +out: + return err; +} + +int ufs_thermal_probe(struct ufs_hba *hba) +{ + u8 ufs_features; + u8 *desc_buf = NULL; + int err = -EINVAL; + + if (!ufshcd_thermal_management_enabled(hba)) + goto out; + + desc_buf = kzalloc(hba->desc_size.dev_desc, GFP_KERNEL); + if (!desc_buf) { + err = -ENOMEM; + goto out; + } + + if (ufshcd_read_desc_param(hba, QUERY_DESC_IDN_DEVICE, 0, 0, desc_buf, + hba->desc_size.dev_desc)) + goto out; + + + ufs_features = desc_buf[DEVICE_DESC_PARAM_UFS_FEAT] & + (UFS_FEATURE_HTEMP | UFS_FEATURE_LTEMP); + if (!ufs_features) + goto out; + + err = ufs_thermal_register(hba); + if (err) + goto out; + + hba->thermal_features = ufs_features; + +out: + kfree(desc_buf); + return err; +} + +void ufs_thermal_remove(struct ufs_hba *hba) +{ + if (!ufshcd_thermal_management_enabled(hba)) + return; + + ufs_thermal_zone_unregister(hba); + hba->thermal_features = 0; +} diff --git a/drivers/scsi/ufs/ufs-thermal.h b/drivers/scsi/ufs/ufs-thermal.h new file mode 100644 index 0000000..7c0fcbe --- /dev/null +++ b/drivers/scsi/ufs/ufs-thermal.h @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2018 Western Digital Corporation + */ +#ifndef UFS_THERMAL_H +#define UFS_THERMAL_H + +#include "ufshcd.h" +#include "ufs.h" + +#ifdef CONFIG_THERMAL_UFS +void ufs_thermal_remove(struct ufs_hba *hba); +int ufs_thermal_probe(struct ufs_hba *hba); +#else +static inline void ufs_thermal_remove(struct ufs_hba *hba) {} +static inline int ufs_thermal_probe(struct ufs_hba *hba) {return 0; } +#endif /* CONFIG_THERMAL_UFS */ + +#endif /* UFS_THERMAL_H */ diff --git a/drivers/scsi/ufs/ufs.h b/drivers/scsi/ufs/ufs.h index dde2eb0..eb729cc 100644 --- a/drivers/scsi/ufs/ufs.h +++ b/drivers/scsi/ufs/ufs.h @@ -332,6 +332,17 @@ enum { UFSHCD_AMP = 3, }; +/* UFS Features - to decode bUFSFeaturesSupport */ +enum { + UFS_FEATURE_FFU = BIT(0), + UFS_FEATURE_PSA = BIT(1), + UFS_FEATURE_LIFE = BIT(2), + UFS_FEATURE_REFRESH = BIT(3), + UFS_FEATURE_HTEMP = BIT(4), + UFS_FEATURE_LTEMP = BIT(5), + UFS_FEATURE_ETEMP = BIT(6), +}; + #define POWER_DESC_MAX_SIZE 0x62 #define POWER_DESC_MAX_ACTV_ICC_LVLS 16 diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index abd0e6b..099d2de 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -47,6 +47,7 @@ #include "unipro.h" #include "ufs-sysfs.h" #include "ufs_bsg.h" +#include "ufs-thermal.h" #define CREATE_TRACE_POINTS #include @@ -7111,6 +7112,7 @@ static int ufshcd_probe_hba(struct ufs_hba *hba, bool async) /* Enable Auto-Hibernate if configured */ ufshcd_auto_hibern8_enable(hba); + ufs_thermal_probe(hba); out: @@ -8278,6 +8280,7 @@ int ufshcd_shutdown(struct ufs_hba *hba) */ void ufshcd_remove(struct ufs_hba *hba) { + ufs_thermal_remove(hba); ufs_bsg_remove(hba); ufs_sysfs_remove_nodes(hba->dev); blk_cleanup_queue(hba->tmf_queue); diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index 2ae6c7c..28c0063 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -730,6 +730,11 @@ struct ufs_hba { struct device bsg_dev; struct request_queue *bsg_queue; + +#define UFSHCD_CAP_THERMAL_MANAGEMENT (1 << 7) + + u8 thermal_features; + }; /* Returns true if clocks can be gated. Otherwise false */ @@ -754,6 +759,11 @@ static inline bool ufshcd_is_rpm_autosuspend_allowed(struct ufs_hba *hba) return hba->caps & UFSHCD_CAP_RPM_AUTOSUSPEND; } +static inline bool ufshcd_thermal_management_enabled(struct ufs_hba *hba) +{ + return hba->caps & UFSHCD_CAP_THERMAL_MANAGEMENT; +} + static inline bool ufshcd_is_intr_aggr_allowed(struct ufs_hba *hba) { /* DWC UFS Core has the Interrupt aggregation feature but is not detectable*/ From patchwork Sun Feb 2 10:46:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avi Shchislowski X-Patchwork-Id: 11361561 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 38FE617E0 for ; Sun, 2 Feb 2020 10:47:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 17A55206D3 for ; Sun, 2 Feb 2020 10:47:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="NEYYS0yS" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726905AbgBBKrN (ORCPT ); Sun, 2 Feb 2020 05:47:13 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:8763 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725942AbgBBKrM (ORCPT ); Sun, 2 Feb 2020 05:47:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1580640432; x=1612176432; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=J2CwgzRWIYLSpvNnhogUm4kTDIqaX6TbFTnNTEDWAng=; b=NEYYS0yStIFG5a8v3DypvNeG6ePOORRf6VN8X9BVSUSnESZd+SDvFXaH Aur+kvSWyxBUyQCJdq20y8Bv8B5EnPy+DZYzJ4ItfEb0cH0oNjVdD2oPO sNio0VaroaEaU2vt1Ru0m4n+lcC67/DGr61LkD2FHprOAwRx4nvh8PAUx EKY/mIm40z/cnq0x+buQM77eAS8lI2GnHozPqFFZ83dcsVvA8EYDvAieI 4ZHcIyHJeeI0ZoCJro2pKEdXBDROUvsqxCt3nVohxlMacS96Qv/scdvHA seOTNlzMUBvtQaNFno/c/AQyWuUpOaQ6GMvt8mWDyCXiei8o4k44QI3KF Q==; IronPort-SDR: 9N3CId4iBGeAfTN6iwOyIjBZiX41yMjDoShj0fJ+6RJ6kohTKT48IJYrjnE/JXVyIXOiO3tiHI xWfzJAtnE4ioa68pmgA2rCwbVoorWSM7aT2hSOuXxvYJMlSDyg3O9oGeWvkEIupRM5R9Jg6YNy O/qlL/D7Fncw+djM+FImWuR6mYu4Z13Q+zSONQCjeRR8yfrEE/nVCUSMp3oU2oI3yYFTY3Uads Q5cs0VGKIWyK4qOz8YnqrGekzwNYuyO09xx8fWCZlEuK/j6nNsxH87MSijMWtmv0nK00ad9cRe o5k= X-IronPort-AV: E=Sophos;i="5.70,393,1574092800"; d="scan'208";a="128925966" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 02 Feb 2020 18:47:12 +0800 IronPort-SDR: 5ERP2Q8gQ8NTzx1jJiz0l8330Zm6/PFHwxslNwbI39/dKqQM8D4Co0yOoe5JrpBpjCwWfmGdZ6 r/bfvohnk8WMR897xWnlIYK7721WQnlA622gKmNdBS800Kt20IR8bfcF1ocm9RCLX/CVUEIHAr x8SO1wZI7tR3RF1ukuzaR2DKOZvPxEftRfveRI710pUvofb7fXgQGugftX1qeP4uENS0fGuKGT lRT+RE0OvYWWjgffPv7ilFpRENgf/EH6C4HK4I8CFHfils7XUHE7cEiHagmal3mv5gu5C3SOW+ F/w9jwKdwNFannv9+jffV6lh Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2020 02:40:18 -0800 IronPort-SDR: v9StwYbNRIXVJgoMCNjN/p540DuYQ6dEPr2ehSkEdcAj6ExJ1+ZQA/W3ZrYMbpRS3MuBPASYn1 zNIzwF5erou1zbSxrTDkaup0vZcHI7ATdFoTlYezsZ6GYdisKOznsWGOClUikzHS99yqGVDqye wiF+3jP/EJYzh7ej4bCBZMLpSMhQShpVMpP/1hkaSrNV8lC3I90FClpBOMYoZ4WHXEQvAlBLft iUMCPsnj/voD/RS+APLR+HM7FZaq0Oj0Y6ZmeCAzN26i+TOvpC9JP67CxHAX1fk4qr7g/9rtay ZjQ= WDCIronportException: Internal Received: from kfae419068.sdcorp.global.sandisk.com ([10.0.231.195]) by uls-op-cesaip01.wdc.com with ESMTP; 02 Feb 2020 02:47:09 -0800 From: Avi Shchislowski To: Alim Akhtar , Avri Altman , "James E.J. Bottomley" , "Martin K. Petersen" , linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org Cc: Avi Shchislowski , Uri Yanai Subject: [PATCH 2/5] scsi: ufs: export ufshcd_enable_ee Date: Sun, 2 Feb 2020 12:46:56 +0200 Message-Id: <1580640419-6703-3-git-send-email-avi.shchislowski@wdc.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1580640419-6703-1-git-send-email-avi.shchislowski@wdc.com> References: <1580640419-6703-1-git-send-email-avi.shchislowski@wdc.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org export ufshcd_enable_ee so that other modules can use it. this will come handy in the next patch where we will need it to enable thermal support Signed-off-by: Uri Yanai Signed-off-by: Avi Shchislowski --- drivers/scsi/ufs/ufshcd.c | 2 +- drivers/scsi/ufs/ufshcd.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 099d2de..f25b93c 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -4923,7 +4923,7 @@ static int ufshcd_disable_ee(struct ufs_hba *hba, u16 mask) * * Returns zero on success, non-zero error value on failure. */ -static int ufshcd_enable_ee(struct ufs_hba *hba, u16 mask) +int ufshcd_enable_ee(struct ufs_hba *hba, u16 mask) { int err = 0; u32 val; diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index 28c0063..6d2a5fd 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -960,6 +960,8 @@ int ufshcd_exec_raw_upiu_cmd(struct ufs_hba *hba, u8 *desc_buff, int *buff_len, enum query_opcode desc_op); +int ufshcd_enable_ee(struct ufs_hba *hba, u16 mask); + /* Wrapper functions for safely calling variant operations */ static inline const char *ufshcd_get_var_name(struct ufs_hba *hba) { From patchwork Sun Feb 2 10:46:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Avi Shchislowski X-Patchwork-Id: 11361567 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 58BCB139A for ; Sun, 2 Feb 2020 10:47:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2BDC9206D3 for ; Sun, 2 Feb 2020 10:47:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="XJ2Vb5XH" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726946AbgBBKrQ (ORCPT ); Sun, 2 Feb 2020 05:47:16 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:8763 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725942AbgBBKrQ (ORCPT ); Sun, 2 Feb 2020 05:47:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1580640435; x=1612176435; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CWCt1N9QQeshEUbUnNbIJ3gtz8DB25rDcqW1k3WBi7c=; b=XJ2Vb5XHl/b29NMSKOFZr9w3fWppoYTT3Sc7WziE5l50jhOp7Ard8xnl Z7fHRv5smMEccPDI0Y4ySe4AcrkcSk5CLvy7hTgdKBsroqWX4mrEtbP2k 00XRuhNC5TtvTnz2dvy+rEG4l15t0m/3hHbKBXwa5eZGrsJozEJyoTYuJ B6dgb3Fi7mDZRGYNXCfYPSVvWio+sU9gn/zEKUwCoDCe2v7oUG4OWUWwd sjcJxa3qRoWVHeHOKIj3yii3t6LqMGZ2seF84JHP59Bmb3hZU+ep0SxoJ HQs9kTs24VkrUqs97uUZ/bEzskpTomxkMVSSDskJGb7PuybfDjMgjNn1Y w==; IronPort-SDR: uvX53ibYan5trArNtfhGmze/6PLMFcMOr0wPMDlzgQUZwDWtUU9dKQOQrT7aCOEyP8o9wpO2sn lSHhFEMEQ5oI2RVfNsmvu8ugZwNzOlsgOxWFPCYfOnrx34JBWXxo00rvrcHYu7VXXxCLtQx/i5 AqSN4c3c8LdINKvOW7eJ/hDo1RkHLrdrnQgrH1gyqMcczT+nUKXugAYq6S0QrESkZEoXPzX+EU y5PgP9zoDHgXW5OmDKGSKUDK13m00titHytz7jfN36Wb7Soy6uUMTjR1lCHLZDS+FAC9c301ta R+s= X-IronPort-AV: E=Sophos;i="5.70,393,1574092800"; d="scan'208";a="128925969" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 02 Feb 2020 18:47:15 +0800 IronPort-SDR: 2nzMcbeYQ1DjQ9UN65XlMuDIlFnmOUe6t8LiAl0lzciWM4RkNWs85eu+E6VcSxi3bWvPkswbAd E8B3/Bb05wFSiZOZI+QpGxUiofgVKukXDqSytCTYatWIqNaBDBAQ9NOA/kTfWScpPcMBbN52Qj qtsFsByANpKQw6TWCBTsPKlanqjqJZUcvYbeR8lrODd/SXavxsyNRbwcPXoJ/i23tNcSPM9I/T q2kPyejODBzcXn5IkfG/kKUJQXd7CQwBJJNo4FestmXnkXyyrElgkcvMFSf55OCmDcpCYC3HFT /K9q76kEiWEisDrtWsM3MruI Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2020 02:40:22 -0800 IronPort-SDR: 0rUBRk1wBMNSKKbvh0PAQeWk2frOQTQU6L8yLA83ufNdLaZBgzR2e0CJ67sAMGumWzKjVfNUr2 XHqsRsf4dZCjvONiu/K2aKpMS8o/OQl6F1MQSUp3QHAf8at/5uYoSLfJ9Q/p8DX3wu5HZBbi7n Mw5e4lUe7pn90/L+diBa+fHvH1kY9BHPZjIFVsOtvBAoAlBzV2s2BLViG9nr02SF0YX1yNJVwQ I1S2Eh62q2N2yqC0cFyc0myytGX8J/7h20JGOfa7Z8PXbCtKu72DwvM4COX3Uuzjlp9SceqXnE jdc= WDCIronportException: Internal Received: from kfae419068.sdcorp.global.sandisk.com ([10.0.231.195]) by uls-op-cesaip01.wdc.com with ESMTP; 02 Feb 2020 02:47:13 -0800 From: Avi Shchislowski To: Alim Akhtar , Avri Altman , "James E.J. Bottomley" , "Martin K. Petersen" , linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org Cc: Avi Shchislowski , Uri Yanai Subject: [PATCH 3/5] scsi: ufs: enable thermal exception event Date: Sun, 2 Feb 2020 12:46:57 +0200 Message-Id: <1580640419-6703-4-git-send-email-avi.shchislowski@wdc.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1580640419-6703-1-git-send-email-avi.shchislowski@wdc.com> References: <1580640419-6703-1-git-send-email-avi.shchislowski@wdc.com> MIME-Version: 1.0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The host might need to be aware of the device's temperature, when it's too high or too low. Should such event occur, the device is expected to notify it to the host by using the exception event mechanism. E.g. when TOO_HIGH_TEMP in wExceptionEventStatus is raised, it is recommended to perform thermal throttling or other cooling activities for lowering the device Tcase temperature. Similarly, when TOO_LOW_TEMP is raised, it is recommended to take an applicable actions to increase the device’s Tcase temperature. Signed-off-by: Uri Yanai Signed-off-by: Avi Shchislowski --- drivers/scsi/ufs/ufs-thermal.c | 28 ++++++++++++++++++++++++---- drivers/scsi/ufs/ufs-thermal.h | 6 ++++++ drivers/scsi/ufs/ufs.h | 6 +++++- drivers/scsi/ufs/ufshcd.c | 4 ++++ 4 files changed, 39 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/ufs/ufs-thermal.c b/drivers/scsi/ufs/ufs-thermal.c index 469c1ed..dfa5d68 100644 --- a/drivers/scsi/ufs/ufs-thermal.c +++ b/drivers/scsi/ufs/ufs-thermal.c @@ -19,11 +19,32 @@ enum { /** *struct ufs_thermal - thermal zone related data - * @tzone: thermal zone device data + * @trip: trip array */ static struct ufs_thermal { struct thermal_zone_device *zone; -} thermal; + int trip[UFS_THERM_MAX_TRIPS]; +} thermal = { + .trip = { + [UFS_THERM_MAX_TEMP] = 170 * 1000, + [UFS_THERM_MIN_TEMP] = -79 * 1000 + } +}; + +void ufs_thermal_exception_event_handler(struct ufs_hba *hba, + u32 exception_status) +{ + if (WARN_ON_ONCE(!hba->thermal_features)) + return; + + if (exception_status & MASK_EE_TOO_HIGH_TEMP) { + thermal_notify_framework(thermal.zone, UFS_THERM_HIGH_TEMP); + dev_info(hba->dev, "High temperature raised\n"); + } else if (exception_status & MASK_EE_TOO_LOW_TEMP) { + thermal_notify_framework(thermal.zone, UFS_THERM_LOW_TEMP); + dev_info(hba->dev, "Low temperature raised\n"); + } +} static struct thermal_zone_device_ops ufs_thermal_ops = { .get_temp = NULL, @@ -33,8 +54,7 @@ enum { static int ufs_thermal_enable_ee(struct ufs_hba *hba) { - /* later */ - return -EINVAL; + return ufshcd_enable_ee(hba, MASK_EE_URGENT_TEMP); } static void ufs_thermal_zone_unregister(struct ufs_hba *hba) diff --git a/drivers/scsi/ufs/ufs-thermal.h b/drivers/scsi/ufs/ufs-thermal.h index 7c0fcbe..285049e 100644 --- a/drivers/scsi/ufs/ufs-thermal.h +++ b/drivers/scsi/ufs/ufs-thermal.h @@ -11,9 +11,15 @@ #ifdef CONFIG_THERMAL_UFS void ufs_thermal_remove(struct ufs_hba *hba); int ufs_thermal_probe(struct ufs_hba *hba); +void ufs_thermal_exception_event_handler(struct ufs_hba *hba, + u32 exception_status); #else static inline void ufs_thermal_remove(struct ufs_hba *hba) {} static inline int ufs_thermal_probe(struct ufs_hba *hba) {return 0; } +void ufs_thermal_exception_event_handler(struct ufs_hba *hba, + u32 exception_status) +{ +} #endif /* CONFIG_THERMAL_UFS */ #endif /* UFS_THERMAL_H */ diff --git a/drivers/scsi/ufs/ufs.h b/drivers/scsi/ufs/ufs.h index eb729cc..8fc0b0c 100644 --- a/drivers/scsi/ufs/ufs.h +++ b/drivers/scsi/ufs/ufs.h @@ -363,7 +363,9 @@ enum power_desc_param_offset { /* Exception event mask values */ enum { MASK_EE_STATUS = 0xFFFF, - MASK_EE_URGENT_BKOPS = (1 << 2), + MASK_EE_URGENT_BKOPS = BIT(2), + MASK_EE_TOO_HIGH_TEMP = BIT(3), + MASK_EE_TOO_LOW_TEMP = BIT(4), }; /* Background operation status */ @@ -375,6 +377,8 @@ enum bkops_status { BKOPS_STATUS_MAX = BKOPS_STATUS_CRITICAL, }; +#define MASK_EE_URGENT_TEMP (MASK_EE_TOO_HIGH_TEMP | MASK_EE_TOO_LOW_TEMP) + /* UTP QUERY Transaction Specific Fields OpCode */ enum query_opcode { UPIU_QUERY_OPCODE_NOP = 0x0, diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index f25b93c..45fb52d 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -42,6 +42,7 @@ #include #include #include +#include #include "ufshcd.h" #include "ufs_quirks.h" #include "unipro.h" @@ -5183,6 +5184,9 @@ static void ufshcd_exception_event_handler(struct work_struct *work) if (status & MASK_EE_URGENT_BKOPS) ufshcd_bkops_exception_event_handler(hba); + if (status & MASK_EE_URGENT_TEMP) + ufs_thermal_exception_event_handler(hba, status); + out: ufshcd_scsi_unblock_requests(hba); pm_runtime_put_sync(hba->dev); From patchwork Sun Feb 2 10:46:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avi Shchislowski X-Patchwork-Id: 11361563 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9F19F138D for ; Sun, 2 Feb 2020 10:47:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 73D52206D3 for ; Sun, 2 Feb 2020 10:47:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="emd6LCyu" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726995AbgBBKrW (ORCPT ); Sun, 2 Feb 2020 05:47:22 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:8763 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725942AbgBBKrT (ORCPT ); Sun, 2 Feb 2020 05:47:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1580640439; x=1612176439; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=rAReo7Ghhyllt4vhzaYwGGfwgZx7+2h3+bZQ0IC2fB4=; b=emd6LCyuKKzFzfJbrC1Rmy6JzPBnQLYJ4lhVfuppTDL8ifEUv6jR7Q38 /oVnMtS3DWlml46RxoXROId/x/xmULHCItlIU59/QYE6B0EDDMZZFOIHI ZHTFRFI7JqLbxhhXia95c/kUA5VtYOjpu4jUkhgA+52DeKma76S1cr7oU pPfYMg4Bcy8oEBFj0ooeeLRs2Hw4n6Lesh+MwhbTYmnpo5R7ZONeQDUy6 1551yXXsVF+NKH0Hk8VM2nDvw/o1CF5ulFPoGNFl+46fgDjcPzJen4SHG OYbpVnrPfw64IIrUfPA7jae2iR7rm/R5IJmHojARBgH4FOrCmgYwKvx42 w==; IronPort-SDR: vCgjVBXvrQ6ToTLyjPrGg/dAQyQs4yZkrspw634yhZivPZvs8X8bS087j4anEHX5YVIdJWmGSW c8QdEUOJc5OGuwjKGLol2MSPIrmNyhWW82U/21+SD2oZMd2zrcWCXVpGDSlUBC8PNAAZpfqIvf V+kVVjbR4lskIZnPgc8HitzI1IT0HsnxZ4pknjQsj4b72nFaZv4vXj2BTS7+vVjI5rvpkPoKIo 6Zl+jcpYNy0wp/1yn/cyfRdt00+vmFFHwz5/gNYcHLxFEjv27+aKuhHWQATbvP/C/ASg4AqH+6 KF8= X-IronPort-AV: E=Sophos;i="5.70,393,1574092800"; d="scan'208";a="128925973" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 02 Feb 2020 18:47:19 +0800 IronPort-SDR: 9CqXTRR0ZleFwOWUNuNeTvCvFRjXKr0FPLyJbkzLGbcvEo/F04wJO0gDBDv0Syc6mzOohnapnS z1RNsKZrj9YScg6gdA0hEyekGzRN7ic7belqPJrkqlO88R+wIjVGPiD05UqC/tru/3ceR3RM9J P2bldDGDz8ve5trThsTP5MR0mYJjjEHX6+4pSuNN3Y+Wp7X09C/XreCQDyzHt+qBaz1P2r9Af1 q5TjdB8xWF9shlHUtj6e+VaHjpEU/9p9bg1c+QKgD/EsRkAkJnxc460FVZ7Af11WhC15NTaomV uZn5aY7I2UxsnIZwFZo38yCn Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2020 02:40:25 -0800 IronPort-SDR: XI6t96dGbXOX1k+jk4xPRZt4RrXd86gFSq7r7R51IXvsEigcIJpNnUfJKqQ6ZipJQjmljyzPwl suD6M32ZwW/0ctXp3NCLvhJSvF1MCN3xhNcriiNpXk6WM8bZSlgSapk1AtZjquWYcwmgjQMl8M 7tqWffg/2rbAI9fonjp2SGxc9YLIOWFYVZ/EgXCQRb4KdioXGGzR7rghD9FXiiIDrSCqRkusJo v/OwoLSgNNpp6MIpMwdL9Hw3EM3RngaO33rCdgjcNQoMZMdtpETRz2qeqyZwtIQCWHBUbUTEMl uFk= WDCIronportException: Internal Received: from kfae419068.sdcorp.global.sandisk.com ([10.0.231.195]) by uls-op-cesaip01.wdc.com with ESMTP; 02 Feb 2020 02:47:16 -0800 From: Avi Shchislowski To: Alim Akhtar , Avri Altman , "James E.J. Bottomley" , "Martin K. Petersen" , linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org Cc: Avi Shchislowski , Uri Yanai Subject: [PATCH 4/5] scsi: ufs-thermal: implement thermal file ops Date: Sun, 2 Feb 2020 12:46:58 +0200 Message-Id: <1580640419-6703-5-git-send-email-avi.shchislowski@wdc.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1580640419-6703-1-git-send-email-avi.shchislowski@wdc.com> References: <1580640419-6703-1-git-send-email-avi.shchislowski@wdc.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The thermal interface adds a new thermal zone device sensor under /sys/class/thermal/ folder. Signed-off-by: Uri Yanai Signed-off-by: Avi Shchislowski --- drivers/scsi/ufs/ufs-thermal.c | 122 ++++++++++++++++++++++++++++++++++++++--- drivers/scsi/ufs/ufs.h | 3 + 2 files changed, 117 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/ufs/ufs-thermal.c b/drivers/scsi/ufs/ufs-thermal.c index dfa5d68..23e4ac1 100644 --- a/drivers/scsi/ufs/ufs-thermal.c +++ b/drivers/scsi/ufs/ufs-thermal.c @@ -31,6 +31,99 @@ enum { } }; +#define attr2milicelcius(attr) (((0xFF & attr) - 80) * 1000) + +static int ufs_thermal_get_temp(struct thermal_zone_device *device, + int *temperature) +{ + struct ufs_hba *hba = (struct ufs_hba *)device->devdata; + u32 temp; + int err; + + err = ufshcd_query_attr(hba, + UPIU_QUERY_OPCODE_READ_ATTR, + QUERY_ATTR_IDN_ROUGH_TEMP, + 0, 0, &temp); + if (err) + return -EINVAL; + + *temperature = attr2milicelcius(temp); + return 0; +} + +static int ufs_thermal_get_trip_temp( + struct thermal_zone_device *device, + int trip, int *temp) +{ + + if (trip < 0 || trip >= UFS_THERM_MAX_TRIPS) + return -EINVAL; + + *temp = thermal.trip[trip]; + + return 0; +} + +static int ufs_thermal_get_trip_type( + struct thermal_zone_device *device, + int trip, enum thermal_trip_type *type) +{ + if (trip < 0 || trip >= UFS_THERM_MAX_TRIPS) + return -EINVAL; + + *type = THERMAL_TRIP_PASSIVE; + + return 0; +} + +static int ufs_thermal_get_boundary(struct ufs_hba *hba, + int trip, int *boundary) +{ + enum attr_idn idn; + int err = 0; + u32 val; + + idn = trip == UFS_THERM_HIGH_TEMP ? + QUERY_ATTR_IDN_TOO_HIGH_TEMP : + QUERY_ATTR_IDN_TOO_LOW_TEMP; + + err = ufshcd_query_attr(hba, + UPIU_QUERY_OPCODE_READ_ATTR, + idn, 0, 0, &val); + if (err) { + dev_err(hba->dev, + "Failed to get device too %s temperature boundary\n", + trip == UFS_THERM_HIGH_TEMP ? "high" : "low"); + goto out; + } + + if (val < 1 || val > 250) { + dev_err(hba->dev, "out of device temperature boundary\n"); + err = -EINVAL; + goto out; + } + + *boundary = attr2milicelcius(val); + +out: + return err; +} + +static int ufs_thermal_set_trip(struct ufs_hba *hba, int trip) +{ + int temp; + int err = 0; + + err = ufs_thermal_get_boundary(hba, trip, &temp); + if (err) + return err; + + thermal.trip[trip] = temp; + + return err; + +} + void ufs_thermal_exception_event_handler(struct ufs_hba *hba, u32 exception_status) { @@ -46,17 +139,12 @@ void ufs_thermal_exception_event_handler(struct ufs_hba *hba, } } -static struct thermal_zone_device_ops ufs_thermal_ops = { - .get_temp = NULL, - .get_trip_temp = NULL, - .get_trip_type = NULL, -}; - static int ufs_thermal_enable_ee(struct ufs_hba *hba) { return ufshcd_enable_ee(hba, MASK_EE_URGENT_TEMP); } + static void ufs_thermal_zone_unregister(struct ufs_hba *hba) { if (thermal.zone) { @@ -66,7 +154,13 @@ static void ufs_thermal_zone_unregister(struct ufs_hba *hba) } } -static int ufs_thermal_register(struct ufs_hba *hba) +static struct thermal_zone_device_ops ufs_thermal_ops = { + .get_temp = ufs_thermal_get_temp, + .get_trip_temp = ufs_thermal_get_trip_temp, + .get_trip_type = ufs_thermal_get_trip_type, +}; + +static int ufs_thermal_register(struct ufs_hba *hba, u8 ufs_features) { int err = 0; char name[THERMAL_NAME_LENGTH] = {}; @@ -74,6 +168,18 @@ static int ufs_thermal_register(struct ufs_hba *hba) snprintf(name, THERMAL_NAME_LENGTH, "ufs_storage_%d", hba->host->host_no); + if (ufs_features & UFS_FEATURE_HTEMP) { + err = ufs_thermal_set_trip(hba, UFS_THERM_HIGH_TEMP); + if (err) + goto out; + } + + if (ufs_features & UFS_FEATURE_LTEMP) { + err = ufs_thermal_set_trip(hba, UFS_THERM_LOW_TEMP); + if (err) + goto out; + } + thermal.zone = thermal_zone_device_register(name, UFS_THERM_MAX_TRIPS, 0, hba, &ufs_thermal_ops, NULL, 0, 0); if (IS_ERR(thermal.zone)) { @@ -122,7 +228,7 @@ int ufs_thermal_probe(struct ufs_hba *hba) if (!ufs_features) goto out; - err = ufs_thermal_register(hba); + err = ufs_thermal_register(hba, ufs_features); if (err) goto out; diff --git a/drivers/scsi/ufs/ufs.h b/drivers/scsi/ufs/ufs.h index 8fc0b0c..9f8224b 100644 --- a/drivers/scsi/ufs/ufs.h +++ b/drivers/scsi/ufs/ufs.h @@ -167,6 +167,9 @@ enum attr_idn { QUERY_ATTR_IDN_FFU_STATUS = 0x14, QUERY_ATTR_IDN_PSA_STATE = 0x15, QUERY_ATTR_IDN_PSA_DATA_SIZE = 0x16, + QUERY_ATTR_IDN_ROUGH_TEMP = 0x18, + QUERY_ATTR_IDN_TOO_HIGH_TEMP = 0x19, + QUERY_ATTR_IDN_TOO_LOW_TEMP = 0x1A, }; /* Descriptor idn for Query requests */ From patchwork Sun Feb 2 10:46:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avi Shchislowski X-Patchwork-Id: 11361565 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 257FC138D for ; Sun, 2 Feb 2020 10:47:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 02B65206D3 for ; Sun, 2 Feb 2020 10:47:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="BvDdVHUM" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727063AbgBBKrZ (ORCPT ); Sun, 2 Feb 2020 05:47:25 -0500 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:8763 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727034AbgBBKrX (ORCPT ); Sun, 2 Feb 2020 05:47:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1580640443; x=1612176443; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=L4nAHFKokWMKbsmdb2ayPfvOB5mMFhDgRN9aEfo+7Pk=; b=BvDdVHUMrTolEoYuxCjFwtBuAIt/kqNjt0mcIQ1NTet3epRQ0xli1lcV 0LWxqshpn91ycBuWu2/ayl+/zJCFRjT3MFP7p+NSs+n5FcqkIPaVUOO+C hK3xDpTJyKhp/5lnkTwruzjvrD7PKaNpnkWTlDK1p2Fgq94wtH1YZMqxs TwFroUwTceI5q3/FT510Q6IttaqmImICGFBOwcOFNGfKBmP7B2UYNRwD4 ykHJKuULz1+B26WzQC4ywkbt2tjj6Mjcj/+V83OTntYbx4BPBcIH9PNOr gIwZdq+3y+jedvOLhC4YSysrTx+dr/MguSpvr5/rskhsytZeXVMVpkFKQ w==; IronPort-SDR: qDSOw3JcaXxn21mJEceTM+MjOfYbvY7bLZUXvuBN/SH5qW7XZzS0OBxZVNh28N2iFZpWjc5sgb C6l3ngAxwyDUltg8z0KqdhlsNsNkBp8ZYVP9q9zOqNMg+lKcHHS7HcOO1oFlyA/yyY+uuzjtqt uV0OitUImLIk4UiXrX4JFHUcmT4m8+H+qxJjZR9UBnAtg3AGEC5A5bL/NYBJwzhrJU/dej+Ff5 hUy3dUkJ0vv9mTmzt+3w1hz3L0IfIS+lokGl0yK1G0Zr/9AzrYV7ufExOMfdaOeDf5Ctwf3S2i 58o= X-IronPort-AV: E=Sophos;i="5.70,393,1574092800"; d="scan'208";a="128925975" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 02 Feb 2020 18:47:23 +0800 IronPort-SDR: TlAOPE+RWUw3Uh8SbQhreOBfF8GKvc3K8Di7cMB6tZVeLQClNPzVhV2KNoHup71vOfB5C56H0y +npCWMKHXi37THqu+gIzHWlOzSAz725WB5jduv2oZP4V673yPk4evRtas3RrhtJ4hxbfsMeEZj FpqkjUUAkn+PVvCNu5lxENmSJn794ZyInycam0ft7pZS6yboUuEvdFnN6foudmDF5o94JvmwKw nWxqffyb1fumgJWUk9hmY8peBczfraTbIOkBpTGDRkHPKOpVJwfSKs23KDYpPwA32XHXLOAiZm 6RGPVDsfmCrxljYAbdwfs1uY Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2020 02:40:29 -0800 IronPort-SDR: Hc51kDLCNGUTtubZS79q+bfxzteXY0gCd4WUdkyFsyegZbNfIKWWcoYpb7ehaZCxM4jeAonfet 3Ra6faP15GbG6QYH5dHb8g575pUGmZ/bDY9vPU9rLVXCwsbF+vTqynjxVVPbshNt/x3SzA1Lvo qmJ53tdFOjPW4FZKbkZHBudMbGIIMCO7izXStMLkC4IzHDP1Nd+Xy6wyYAhBAOIo38uqrAuAnF QDU69SlSaAbmwcOVlviW8XELM1H+oOc2KJJ8JsubdV081KvzsBUIuP4xyETzEvHOCtQCMpfJzI P+s= WDCIronportException: Internal Received: from kfae419068.sdcorp.global.sandisk.com ([10.0.231.195]) by uls-op-cesaip01.wdc.com with ESMTP; 02 Feb 2020 02:47:20 -0800 From: Avi Shchislowski To: Alim Akhtar , Avri Altman , "James E.J. Bottomley" , "Martin K. Petersen" , linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org Cc: Avi Shchislowski , Uri Yanai , Avi Shchislowski Subject: [PATCH 5/5] scsi: ufs: temperature atrributes add to ufs_sysfs Date: Sun, 2 Feb 2020 12:46:59 +0200 Message-Id: <1580640419-6703-6-git-send-email-avi.shchislowski@wdc.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1580640419-6703-1-git-send-email-avi.shchislowski@wdc.com> References: <1580640419-6703-1-git-send-email-avi.shchislowski@wdc.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Avi Shchislowski Signed-off-by: Uri Yanai Signed-off-by: Avi Shchislowski --- drivers/scsi/ufs/ufs-sysfs.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/scsi/ufs/ufs-sysfs.c b/drivers/scsi/ufs/ufs-sysfs.c index dbdf8b0..180f4db 100644 --- a/drivers/scsi/ufs/ufs-sysfs.c +++ b/drivers/scsi/ufs/ufs-sysfs.c @@ -667,6 +667,9 @@ static DEVICE_ATTR_RO(_name) UFS_ATTRIBUTE(ffu_status, _FFU_STATUS); UFS_ATTRIBUTE(psa_state, _PSA_STATE); UFS_ATTRIBUTE(psa_data_size, _PSA_DATA_SIZE); +UFS_ATTRIBUTE(rough_temp, _ROUGH_TEMP); +UFS_ATTRIBUTE(too_high_temp, _TOO_HIGH_TEMP); +UFS_ATTRIBUTE(too_low_temp, _TOO_LOW_TEMP); static struct attribute *ufs_sysfs_attributes[] = { &dev_attr_boot_lun_enabled.attr, @@ -685,6 +688,9 @@ static DEVICE_ATTR_RO(_name) &dev_attr_ffu_status.attr, &dev_attr_psa_state.attr, &dev_attr_psa_data_size.attr, + &dev_attr_rough_temp.attr, + &dev_attr_too_high_temp.attr, + &dev_attr_too_low_temp.attr, NULL, };