Received: by 2002:a05:7412:b795:b0:e2:908c:2ebd with SMTP id iv21csp96824rdb; Wed, 1 Nov 2023 18:54:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IECrKPlJFBnVsSZrxCrU0wypyiUQzu8CdG8UTsBJEGqO5BsQOBhhnahrRtiHOHM2is2uYsF X-Received: by 2002:a05:6870:214d:b0:1e9:8699:d20c with SMTP id g13-20020a056870214d00b001e98699d20cmr18656494oae.53.1698890069569; Wed, 01 Nov 2023 18:54:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698890069; cv=none; d=google.com; s=arc-20160816; b=hTDoyESyDhCGCK85OXQKBVNRdvE0OT6spRi7JoFkP0ej6/6M30lLZVPpeySKZOLOdQ FDUd05iaup6b0SQB9TurKYmoIpTGl2dlSwnOr70Pu14fSBXS+cwWz52E7MjBJ7qHSdj3 NDD7kV8iIrXfd9d/wVI5Ym37XDx/A49zC9lAQ7tutk7ai6LiqJAnOKDeB69axrsQEhUx qjj/Nmj8imPOsqgrhtbVFkJFWD9vmo7KnMt+MaUTqizhwM2s5sLf+5NA3JE46HDNOm3p sUZT7WjKd66u2a4F5p6lD644qdt0whRL5SCejytuZ7RL+/y8w9cwctpEEHNEyz+HRHFc kBnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=9ANE3tFi/dfKW4H8ZBjSQq5eHTSVmT6YEmJD1/CxvdE=; fh=mij0pTr5/A8fOY3zXYRBzbX4pFGsx/wKFKZBqXBVIMM=; b=uxPsVYK8X0ktSXxcqW9B62DElvisSHaQt4AhJoHwlFul8Qab9ezlIlc90q35fx68Rv Y2kLNtDwl4nbtxrCoHv7sSlFzogpRObLimIUoTXwlk7YaQ8RK/eAexhjaq8tnebJv5uf rxIb907DDEUpYcUgQlTZB+AZ/29+r8CkBvX11AZw5zM44c/YoqBBD29Y4zxaRkLje/TN pNRdsLRVQhm2bP/3PKKuTJKkwzGQA7hj7Q3bezHMvjbNRsEmctYATizEeJSDfec6X8q4 fCNdDLDJEaIxJFkVQHK+hIgAbfY7qs3vTPblRhvrs4rXa//W6H1OElTYECSw0Mchg7HB tnvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=gvNSJxYK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id q207-20020a632ad8000000b005b9377ee20csi1062972pgq.701.2023.11.01.18.54.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 18:54:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=gvNSJxYK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id E711B80C6EBC; Wed, 1 Nov 2023 18:54:21 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348216AbjKBBx4 (ORCPT + 99 others); Wed, 1 Nov 2023 21:53:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232963AbjKBBxz (ORCPT ); Wed, 1 Nov 2023 21:53:55 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2856311B; Wed, 1 Nov 2023 18:53:49 -0700 (PDT) Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3A21D2qD025153; Thu, 2 Nov 2023 01:50:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=qcppdkim1; bh=9ANE3tFi/dfKW4H8ZBjSQq5eHTSVmT6YEmJD1/CxvdE=; b=gvNSJxYKEcAe/srU9+b7hIoZhInsG1KdwASHfz6TCInTjW+eyiRRbv+TLrEdZLfrbU8V k91vEDuMIFWK50lHpau9e3z3KZdewNTjfbPFIWa2nNtSfzDOnDbzL6BzJtKeajeIw/z3 IZy7h/4g+YYCrMX/uitBz5drssbGcIoDqZB68IfSXv+Ms3mmLay9cXYEEUzLsPYclATN 8qrJHx2n5wqTOcr0x+0ICxtyJCWajRbls/JdEn+y1H6T4u/iF1UDj72++uW6Rin2xVt0 vezB8Bpf4RVu8GTeF/xLkOLc7bWGZEn0f4IsZae8nK3Z5lk2v3Af3IxUlVA4WXRZq7g3 +g== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3u3kactaer-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 02 Nov 2023 01:50:00 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3A21nwJj023142 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 2 Nov 2023 01:49:58 GMT Received: from [10.253.74.76] (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.39; Wed, 1 Nov 2023 18:49:55 -0700 Message-ID: <862aab51-5a71-d8f8-17d8-cb5bff8115a4@quicinc.com> Date: Thu, 2 Nov 2023 09:49:53 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH v3] scsi: ufs: ufs-sysfs: Expose UFS power info Content-Language: en-US To: Manivannan Sadhasivam CC: , , , , , , , , Alim Akhtar , "James E.J. Bottomley" , Lu Hongfei , open list References: <1698811243-5024-1-git-send-email-quic_cang@quicinc.com> <20231101051204.GC2897@thinkpad> From: Can Guo In-Reply-To: <20231101051204.GC2897@thinkpad> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: MyNRLrTNpEU1sbr5zpW-dJ8Ax5Dg3n4E X-Proofpoint-GUID: MyNRLrTNpEU1sbr5zpW-dJ8Ax5Dg3n4E X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-01_23,2023-11-01_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 suspectscore=0 priorityscore=1501 lowpriorityscore=0 malwarescore=0 bulkscore=0 clxscore=1015 phishscore=0 spamscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2310240000 definitions=main-2311020013 X-Spam-Status: No, score=-4.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 01 Nov 2023 18:54:22 -0700 (PDT) Hi Mani, On 11/1/2023 1:12 PM, Manivannan Sadhasivam wrote: > On Tue, Oct 31, 2023 at 09:00:34PM -0700, Can Guo wrote: >> Having UFS power info available in sysfs makes it easier to tell the state >> of the link during runtime considering we have a bunch of power saving >> features and various combinations for backward compatibility. >> >> Signed-off-by: Can Guo > Just a nitpick below. With that addressed, > > Reviewed-by: Manivannan Sadhasivam > >> --- >> >> v2 -> v3: >> 1. For mode/gear/rate/dev_pm/link_status, print texts instead of numbers >> 2. Removed number<->text explanations for mode/rate/gear/dev_pm/link_status in Documentation/ABI/testing/sysfs-driver-ufs >> >> v1 -> v2: >> 1. Incorporated comments from Bart, Nitin and Mani. >> 2. Added explanations for lane/mode/rate/gear/dev_pm/link_status in Documentation/ABI/testing/sysfs-driver-ufs >> >> --- >> Documentation/ABI/testing/sysfs-driver-ufs | 49 ++++++++++++ >> drivers/ufs/core/ufs-sysfs.c | 120 +++++++++++++++++++++++++++++ >> include/ufs/unipro.h | 4 +- >> 3 files changed, 171 insertions(+), 2 deletions(-) >> >> diff --git a/Documentation/ABI/testing/sysfs-driver-ufs b/Documentation/ABI/testing/sysfs-driver-ufs >> index 0c7efaf..b73067b 100644 >> --- a/Documentation/ABI/testing/sysfs-driver-ufs >> +++ b/Documentation/ABI/testing/sysfs-driver-ufs >> @@ -1223,6 +1223,55 @@ Description: This file shows the total latency (in micro seconds) of write >> >> The file is read only. >> >> +What: /sys/bus/platform/drivers/ufshcd/*/power_info/lane >> +What: /sys/bus/platform/devices/*.ufs/power_info/lane >> +Date: September 2023 >> +Contact: Can Guo >> +Description: This file shows how many lanes are enabled on the UFS link, >> + i.e., an output 2 means UFS link is operating with 2 lanes. >> + >> + The file is read only. >> + >> +What: /sys/bus/platform/drivers/ufshcd/*/power_info/mode >> +What: /sys/bus/platform/devices/*.ufs/power_info/mode >> +Date: September 2023 >> +Contact: Can Guo >> +Description: This file shows the PA power mode of UFS. >> + >> + The file is read only. >> + >> +What: /sys/bus/platform/drivers/ufshcd/*/power_info/rate >> +What: /sys/bus/platform/devices/*.ufs/power_info/rate >> +Date: September 2023 >> +Contact: Can Guo >> +Description: This file shows the speed rate of UFS link. >> + >> + The file is read only. >> + >> +What: /sys/bus/platform/drivers/ufshcd/*/power_info/gear >> +What: /sys/bus/platform/devices/*.ufs/power_info/gear >> +Date: September 2023 >> +Contact: Can Guo >> +Description: This file shows the gear of UFS link. >> + >> + The file is read only. >> + >> +What: /sys/bus/platform/drivers/ufshcd/*/power_info/dev_pm >> +What: /sys/bus/platform/devices/*.ufs/power_info/dev_pm >> +Date: September 2023 >> +Contact: Can Guo >> +Description: This file shows the UFS device power mode. >> + >> + The file is read only. >> + >> +What: /sys/bus/platform/drivers/ufshcd/*/power_info/link_state >> +What: /sys/bus/platform/devices/*.ufs/power_info/link_state >> +Date: September 2023 >> +Contact: Can Guo >> +Description: This file shows the state of UFS link. >> + >> + The file is read only. >> + >> What: /sys/bus/platform/drivers/ufshcd/*/device_descriptor/wb_presv_us_en >> What: /sys/bus/platform/devices/*.ufs/device_descriptor/wb_presv_us_en >> Date: June 2020 >> diff --git a/drivers/ufs/core/ufs-sysfs.c b/drivers/ufs/core/ufs-sysfs.c >> index c959064..b8b5dd1 100644 >> --- a/drivers/ufs/core/ufs-sysfs.c >> +++ b/drivers/ufs/core/ufs-sysfs.c >> @@ -7,9 +7,56 @@ >> #include >> >> #include >> +#include >> #include "ufs-sysfs.h" >> #include "ufshcd-priv.h" >> >> +static const char *ufshcd_ufs_pa_pwr_mode_to_string(enum ufs_pa_pwr_mode mode) > I don't think it is necessary to have the ufshcd_ prefix. Done Thanks, Can Guo.