From: Adrian Hunter <adrian.hunter@intel.com>
To: Kiwoong Kim <kwmad.kim@samsung.com>,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
alim.akhtar@samsung.com, avri.altman@wdc.com, bvanassche@acm.org,
jejb@linux.ibm.com, martin.petersen@oracle.com,
beanhuo@micron.com, sc.suh@samsung.com, hy50.seo@samsung.com,
sh425.lee@samsung.com, kwangwon.min@samsung.com,
junwoo80.lee@samsung.com, wkon.kim@samsung.com
Subject: Re: [RESEND PATCH v3 2/2] ufs: poll HCS.UCRDY before issuing a UIC command
Date: Mon, 14 Aug 2023 14:26:27 +0300 [thread overview]
Message-ID: <f1e154c4-bbb3-18a2-cb7a-41adae292b48@intel.com> (raw)
In-Reply-To: <9c7ccbfb8fe05c29ab3e31d9cd14e6b91065b8b0.1690939662.git.kwmad.kim@samsung.com>
On 2/08/23 04:28, Kiwoong Kim wrote:
> With auto hibern8 enabled, UIC could be working
> for a while to process a hibern8 operation and HCI
> reports UIC not ready for a short term through HCS.UCRDY.
> And UFS driver can't recognize the operation.
> UFSHCI spec specifies UCRDY like this:
> whether the host controller is ready to process UIC COMMAND
>
> The 'ready' could be seen as many different meanings. If the meaning
> includes not processing any request from HCI, processing a hibern8
> operation can be 'not ready'. In this situation, the driver needs to
> wait until the operations is completed.
>
> Signed-off-by: Kiwoong Kim <kwmad.kim@samsung.com>
> ---
> drivers/ufs/core/ufshcd.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index a89d39a..10ccc85 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -22,6 +22,7 @@
> #include <linux/module.h>
> #include <linux/regulator/consumer.h>
> #include <linux/sched/clock.h>
> +#include <linux/iopoll.h>
> #include <scsi/scsi_cmnd.h>
> #include <scsi/scsi_dbg.h>
> #include <scsi/scsi_driver.h>
> @@ -2365,7 +2366,11 @@ static inline int ufshcd_hba_capabilities(struct ufs_hba *hba)
> */
> static inline bool ufshcd_ready_for_uic_cmd(struct ufs_hba *hba)
> {
> - return ufshcd_readl(hba, REG_CONTROLLER_STATUS) & UIC_COMMAND_READY;
> + u32 val;
> + int ret = read_poll_timeout(ufshcd_readl, val, val & UIC_COMMAND_READY,
> + 500, UIC_CMD_TIMEOUT * 1000, false, hba,
> + REG_CONTROLLER_STATUS);
> + return ret == 0 ? true : false;
Could use a comment in the code.
And perhaps the following is neater:
u32 val;
return !read_poll_timeout(ufshcd_readl, val, val & UIC_COMMAND_READY,
500, UIC_CMD_TIMEOUT * 1000, false, hba,
REG_CONTROLLER_STATUS);
> }
>
> /**
next prev parent reply other threads:[~2023-08-14 11:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20230802013848epcas2p3a896970d5bdc8e3f3e422c84c282a151@epcas2p3.samsung.com>
2023-08-02 1:28 ` [RESEND PATCH v3 0/2] change UIC command handling Kiwoong Kim
[not found] ` <CGME20230802013850epcas2p4a813b26e15c261d180ee3b46651e1534@epcas2p4.samsung.com>
2023-08-02 1:28 ` [RESEND PATCH v3 1/2] ufs: make __ufshcd_send_uic_cmd not wrapped by host_lock Kiwoong Kim
[not found] ` <CGME20230802013852epcas2p2334d33036d7d1a0bdbefaf5bb844928e@epcas2p2.samsung.com>
2023-08-02 1:28 ` [RESEND PATCH v3 2/2] ufs: poll HCS.UCRDY before issuing a UIC command Kiwoong Kim
2023-08-14 11:26 ` Adrian Hunter [this message]
2023-08-17 15:02 ` Bart Van Assche
2023-08-17 16:16 ` Adrian Hunter
2023-09-04 1:30 [RESEND PATCH v3 0/2] change UIC command handling Kiwoong Kim
[not found] ` <CGME20230904014150epcas2p251f19c2220ec8938559bc2873e8e265a@epcas2p2.samsung.com>
2023-09-04 1:30 ` [RESEND PATCH v3 2/2] ufs: poll HCS.UCRDY before issuing a UIC command Kiwoong Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f1e154c4-bbb3-18a2-cb7a-41adae292b48@intel.com \
--to=adrian.hunter@intel.com \
--cc=alim.akhtar@samsung.com \
--cc=avri.altman@wdc.com \
--cc=beanhuo@micron.com \
--cc=bvanassche@acm.org \
--cc=hy50.seo@samsung.com \
--cc=jejb@linux.ibm.com \
--cc=junwoo80.lee@samsung.com \
--cc=kwangwon.min@samsung.com \
--cc=kwmad.kim@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=sc.suh@samsung.com \
--cc=sh425.lee@samsung.com \
--cc=wkon.kim@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.