Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3932113pxb; Tue, 2 Mar 2021 02:12:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJws4ATeN/J4KzDNKftp7/4fgn1d7hVPDa+pEdLsQaJjVQgmOCk5JQuKM8l1iO/7y+2D1LPp X-Received: by 2002:a17:906:95d1:: with SMTP id n17mr8149687ejy.394.1614679940317; Tue, 02 Mar 2021 02:12:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614679940; cv=none; d=google.com; s=arc-20160816; b=fjqPV0rqpX43GuclZgVfSv92uP2ju0qOQ9l8k/Wg9i+oMYfR9cx+z5efAAVtqyIje8 clR8qzBVCWS+9jYDTQ2g0poFh3VTunQ9m/XqJiaRZz+nEzHtKfJie6Evfxlypn7pYtQD Dj3ZrZZj27WwXKG6A7kk1npK9GR4SaGeSyBW3smnlkbiZNFDJhKJR8lgU2+x6J8n0/LI E/5Fl51TzFhnP1l35ZU7FH1ne68UNnG9fLV/nNbHJqGNZjyHMaZ+AP0FmiNQhvZnuZ3k LN+7+O4wcCBKC83Oj8PJ5LfscBLGQzeZYE5q4Y4i9P+r6bMVp/JMKHOEgAkAOq6jBOkN yZZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject:ironport-sdr:ironport-sdr; bh=UGrYir+9dff9HptVu5L+0Pj7jduLj+0nfO7FNsQ2vH4=; b=JueqKTEjn4VHVkDuFdiEX1rqszzdn82jRvtYlAwyjKvCIAE5hib84HCC+d3xftw7yO mDYom6dcN5z8D9bSIdFYm8rn5x9TmuzEEB2AZI/BxZIQhLBniJR7Cf3eD7hhhxhaiSS1 fasnhXDX3ul48KdFmAIxd3Xs/LG+dOSRK7lvfK2WnnLu5W1k8w3spfkzFa8cL8bLF5+r 7jPVsnBOsGEwynd93iXzALnLnJegZ/T7L63nlCM9UhiGuCh/fi+O/rSH6GG9s5XA300c KS+jva9VKg4wt8LjsymjbxM+I7ib/VkwrLJEIVBvxSSnyVYxmK3xY6f68GBLeLjvR6Xj 9Oiw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ku16si12500726ejc.484.2021.03.02.02.11.57; Tue, 02 Mar 2021 02:12:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379485AbhCBB3A (ORCPT + 99 others); Mon, 1 Mar 2021 20:29:00 -0500 Received: from mga17.intel.com ([192.55.52.151]:64757 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241003AbhCATQX (ORCPT ); Mon, 1 Mar 2021 14:16:23 -0500 IronPort-SDR: GsTuTHm/5rWl3aL4agKeKtchqZauU35HTE88xwdsskHBeJaD8FYmrAvBWElWr1EGcAmyZsGoKI 1rADKJnWZaiQ== X-IronPort-AV: E=McAfee;i="6000,8403,9910"; a="166449034" X-IronPort-AV: E=Sophos;i="5.81,215,1610438400"; d="scan'208";a="166449034" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Mar 2021 11:12:48 -0800 IronPort-SDR: IZHeAmha3J9FNGeaDMx1ISJgDn1JHd6fmIBKO6IXMHwxa3XdT+30OgfhOr/VVZJb8UIdH4/w7G turhYFrDusDQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,215,1610438400"; d="scan'208";a="585603646" Received: from ahunter-desktop.fi.intel.com (HELO [10.237.72.76]) ([10.237.72.76]) by orsmga005.jf.intel.com with ESMTP; 01 Mar 2021 11:12:42 -0800 Subject: Re: [PATCH v8 1/2] scsi: ufs: Enable power management for wlun To: Asutosh Das Cc: cang@codeaurora.org, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, linux-arm-msm@vger.kernel.org, Alim Akhtar , Avri Altman , "James E.J. Bottomley" , Pedro Sousa , Krzysztof Kozlowski , Stanley Chu , Andy Gross , Bjorn Andersson , Steven Rostedt , Ingo Molnar , Matthias Brugger , Kiwoong Kim , Bean Huo , Lee Jones , Dan Carpenter , Wei Yongjun , Jaegeuk Kim , Satya Tangirala , open list , "moderated list:ARM/SAMSUNG S3C, S5P AND EXYNOS ARM ARCHITECTURES" , "open list:ARM/SAMSUNG S3C, S5P AND EXYNOS ARM ARCHITECTURES" , "moderated list:UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER..." References: <20210301181014.GF12147@stor-presley.qualcomm.com> From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: <3b085cd7-529f-51b8-6a2f-6aa397e1acd3@intel.com> Date: Mon, 1 Mar 2021 21:12:55 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-Version: 1.0 In-Reply-To: <20210301181014.GF12147@stor-presley.qualcomm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/03/21 8:10 pm, Asutosh Das wrote: > On Mon, Mar 01 2021 at 05:23 -0800, Adrian Hunter wrote: >> On 26/02/21 1:37 am, Asutosh Das wrote: >>> @@ -8901,43 +9125,14 @@ static int ufshcd_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op) >>>              goto vendor_suspend; >>>      } >> >> The ufshcd_reset_and_restore() in ufshcd_resume() will also change the power >> mode of the UFS device to active.  Until the UFS device is also resumed and >> then suspended, it will not return to a low power mode. >> >> > Umm, sorry, I didn't understand this comment. > Say, the UFS device was reset in ufshcd_reset_and_restore() it'd be a hardware > reset and the UFS device would move to Powered On mode and then to Active power > mode, when it is ready to begin initialization. And from this state it should > move to all other legal states. > Before entering system suspend ufshcd_system_suspend(), the ufs device is > runtime resumed in ufshcd_suspend_prepare(). > > Please can you explain a bit more on this issue that you see? Say you runtime resume the host controller, and ufshcd_reset_and_restore() makes the UFS device active, but the UFS device is still runtime suspended. Example: Add a debugfs file to show the current power mode: diff --git a/drivers/scsi/ufs/ufs-debugfs.c b/drivers/scsi/ufs/ufs-debugfs.c index dee98dc72d29..700b88df0866 100644 --- a/drivers/scsi/ufs/ufs-debugfs.c +++ b/drivers/scsi/ufs/ufs-debugfs.c @@ -48,6 +48,7 @@ void ufs_debugfs_hba_init(struct ufs_hba *hba) { hba->debugfs_root = debugfs_create_dir(dev_name(hba->dev), ufs_debugfs_root); debugfs_create_file("stats", 0400, hba->debugfs_root, hba, &ufs_debugfs_stats_fops); + debugfs_create_u32("curr_dev_pwr_mode", 0400, hba->debugfs_root, (u32 *)&hba->curr_dev_pwr_mode); } void ufs_debugfs_hba_exit(struct ufs_hba *hba) # grep -H . /sys/bus/pci/drivers/ufshcd/0000\:00\:12.5/rpm* /sys/bus/pci/drivers/ufshcd/0000:00:12.5/rpm_lvl:6 /sys/bus/pci/drivers/ufshcd/0000:00:12.5/rpm_target_dev_state:DEEPSLEEP /sys/bus/pci/drivers/ufshcd/0000:00:12.5/rpm_target_link_state:OFF # cat /sys/kernel/debug/ufshcd/0000\:00\:12.5/curr_dev_pwr_mode 4 # echo on > /sys/devices/pci0000:00/0000:00:12.5/power/control # cat /sys/kernel/debug/ufshcd/0000\:00\:12.5/curr_dev_pwr_mode 1 # grep -H . /sys/bus/pci/drivers/ufshcd/0000\:00\:12.5/host*/target*/*/power/runtime_status /sys/bus/pci/drivers/ufshcd/0000:00:12.5/host1/target1:0:0/1:0:0:0/power/runtime_status:suspended /sys/bus/pci/drivers/ufshcd/0000:00:12.5/host1/target1:0:0/1:0:0:49456/power/runtime_status:suspended /sys/bus/pci/drivers/ufshcd/0000:00:12.5/host1/target1:0:0/1:0:0:49476/power/runtime_status:suspended /sys/bus/pci/drivers/ufshcd/0000:00:12.5/host1/target1:0:0/1:0:0:49488/power/runtime_status:suspended So UFS devices is runtime suspended and should in DeepSleep, but it is active.