From patchwork Tue Oct 22 19:30:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 13846088 Received: from 009.lax.mailroute.net (009.lax.mailroute.net [199.89.1.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B9D541CB508 for ; Tue, 22 Oct 2024 19:32:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=199.89.1.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729625530; cv=none; b=QL6MQdtOK4RCypFc2+OChf5wXz2FK0N+I2LLN6GPjKUZOPDfrwhmZxK/W7Q85Ev1pYbF3u3mBj+i1oFN0L6HRyBYnmYSkZPsm1bOxlHwWAXG9K+kRPw8RVCMxErAtEnXKnDUJG++lmPAjJtZCN6T5depG89095gvMiVJKivK/Q0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729625530; c=relaxed/simple; bh=crnUGiEWcx5uU38Fy62Oq3WY+EcZCObSxilBVC6WdY0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rjra73diECxeeNe8vOTiF6RxCom2tvxQu2AKlD4l4nZW3BdKrUArgpbLr5CjTt4jSFGd7YrKTv5gK4TmIFxIhJxXWzKk8Jx7MdmP0V4u+HcUjzeRnIT9N/9+6vauA2R+bvbBXHXgPi+Oo36NQhR4A5o5TICW4my4VplYeP9dHdM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org; spf=pass smtp.mailfrom=acm.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b=bdt3w7XP; arc=none smtp.client-ip=199.89.1.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=acm.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b="bdt3w7XP" Received: from localhost (localhost [127.0.0.1]) by 009.lax.mailroute.net (Postfix) with ESMTP id 4XY2PN0zR7zlgMVW; Tue, 22 Oct 2024 19:32:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=acm.org; h= content-transfer-encoding:mime-version:references:in-reply-to :x-mailer:message-id:date:date:subject:subject:from:from :received:received; s=mr01; t=1729625522; x=1732217523; bh=UPUSe dRFjdNT8ZAkw0yfEAemxlV/+z4DQYjD3T9LrTM=; b=bdt3w7XPpnI7P/Gl0l+VX eWlifwHZRIuWfNpc2SBDNDVuWIP3KdqALAqyrXzGS996hP85JGidQQ0kSHhwS/H5 Z9LzLcRFpc7fwTttLBZbMLeJQJXFpkD6aO/fLPpGRzppVIPmIaKd5bGdIbWf3bDG xie7ieOz0Sq+OSCEPSIq3KGdU6i5X9tIGcCaAS0XqkMdzhQIO8Jh4vZaTXxrxKkW 4SBEJAa8cBGmL74OIQlzKykT3ZBJbQ1uT25hVoryH3ESxmHYppwRKV7FIcLDN/7Y ToXTq0aeqapWwhicaLN8zjs3nOh5M+MJuSgIiqphjgo0/WkeVRqThhpp9hEaJ2GY A== X-Virus-Scanned: by MailRoute Received: from 009.lax.mailroute.net ([127.0.0.1]) by localhost (009.lax [127.0.0.1]) (mroute_mailscanner, port 10029) with LMTP id yugf9VIyL1Cl; Tue, 22 Oct 2024 19:32:02 +0000 (UTC) Received: from bvanassche.mtv.corp.google.com (unknown [104.135.204.82]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bvanassche@acm.org) by 009.lax.mailroute.net (Postfix) with ESMTPSA id 4XY2P828CxzlgTWP; Tue, 22 Oct 2024 19:31:55 +0000 (UTC) From: Bart Van Assche To: "Martin K . Petersen" Cc: linux-scsi@vger.kernel.org, Bart Van Assche , Peter Wang , "James E.J. Bottomley" , Matthias Brugger , AngeloGioacchino Del Regno , Manivannan Sadhasivam , Minwoo Im , Chanwoo Lee , Rohit Ner , Avri Altman , Eric Biggers , Maramaina Naresh Subject: [PATCH v2 1/6] scsi: ufs: core: Move the ufshcd_mcq_enable_esi() definition Date: Tue, 22 Oct 2024 12:30:57 -0700 Message-ID: <20241022193130.2733293-2-bvanassche@acm.org> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog In-Reply-To: <20241022193130.2733293-1-bvanassche@acm.org> References: <20241022193130.2733293-1-bvanassche@acm.org> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Move the ufshcd_mcq_enable_esi() definition such that it occurs immediately before the ufshcd_mcq_config_esi() definition. Reviewed-by: Peter Wang Signed-off-by: Bart Van Assche --- drivers/ufs/core/ufs-mcq.c | 14 +++++++------- include/ufs/ufshcd.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/ufs/core/ufs-mcq.c b/drivers/ufs/core/ufs-mcq.c index 5891cdacd0b3..57ced1729b73 100644 --- a/drivers/ufs/core/ufs-mcq.c +++ b/drivers/ufs/core/ufs-mcq.c @@ -417,13 +417,6 @@ void ufshcd_mcq_make_queues_operational(struct ufs_hba *hba) } EXPORT_SYMBOL_GPL(ufshcd_mcq_make_queues_operational); -void ufshcd_mcq_enable_esi(struct ufs_hba *hba) -{ - ufshcd_writel(hba, ufshcd_readl(hba, REG_UFS_MEM_CFG) | 0x2, - REG_UFS_MEM_CFG); -} -EXPORT_SYMBOL_GPL(ufshcd_mcq_enable_esi); - void ufshcd_mcq_enable(struct ufs_hba *hba) { ufshcd_rmwl(hba, MCQ_MODE_SELECT, MCQ_MODE_SELECT, REG_UFS_MEM_CFG); @@ -437,6 +430,13 @@ void ufshcd_mcq_disable(struct ufs_hba *hba) hba->mcq_enabled = false; } +void ufshcd_mcq_enable_esi(struct ufs_hba *hba) +{ + ufshcd_writel(hba, ufshcd_readl(hba, REG_UFS_MEM_CFG) | 0x2, + REG_UFS_MEM_CFG); +} +EXPORT_SYMBOL_GPL(ufshcd_mcq_enable_esi); + void ufshcd_mcq_config_esi(struct ufs_hba *hba, struct msi_msg *msg) { ufshcd_writel(hba, msg->address_lo, REG_UFS_ESILBA); diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h index a95282b9f743..a0b325a32aca 100644 --- a/include/ufs/ufshcd.h +++ b/include/ufs/ufshcd.h @@ -1321,8 +1321,8 @@ void ufshcd_mcq_write_cqis(struct ufs_hba *hba, u32 val, int i); unsigned long ufshcd_mcq_poll_cqe_lock(struct ufs_hba *hba, struct ufs_hw_queue *hwq); void ufshcd_mcq_make_queues_operational(struct ufs_hba *hba); -void ufshcd_mcq_enable_esi(struct ufs_hba *hba); void ufshcd_mcq_enable(struct ufs_hba *hba); +void ufshcd_mcq_enable_esi(struct ufs_hba *hba); void ufshcd_mcq_config_esi(struct ufs_hba *hba, struct msi_msg *msg); int ufshcd_opp_config_clks(struct device *dev, struct opp_table *opp_table, From patchwork Tue Oct 22 19:30:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 13846089 Received: from 009.lax.mailroute.net (009.lax.mailroute.net [199.89.1.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 92F0A1CB323 for ; Tue, 22 Oct 2024 19:32:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=199.89.1.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729625540; cv=none; b=k1whSL+BfaD7TqGxZc1J9er1VNj4ox9G297c3TWFd0fF+z4U6aEVhUtXPGx00az0z9JsBnyMtTAPbO2sb3usmqJ2Wejx5zJBCcqI8cAPJFRvqgBBDdId2MWKsy3svtq0D7mhGqhUzuohj/N+B2DYnFt+21UPaxRIf//Pd+DfCPk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729625540; c=relaxed/simple; bh=ZPbIqWWWXTkkQYELtxX/pBMFHBJh7yqutjaecej7C6w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=F2tjIrhBIzZ+hrqgdP+g7OBXm0BdfmM87vcwSjJVYP7csBSuB6qusEwat4Z60YUovNKKoHvP3p9tgNM7kuEJP9GpqvCdYsdQQLwbRabU8H7Ht6qPVi0D6pu+ZNhhPON3NF1Jx5SfZ7nbG82lj5dGDEndb2E7CD4FzovK/YCrHV0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org; spf=pass smtp.mailfrom=acm.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b=sszOBfix; arc=none smtp.client-ip=199.89.1.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=acm.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b="sszOBfix" Received: from localhost (localhost [127.0.0.1]) by 009.lax.mailroute.net (Postfix) with ESMTP id 4XY2PZ0T6rzlgMVW; Tue, 22 Oct 2024 19:32:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=acm.org; h= content-transfer-encoding:mime-version:references:in-reply-to :x-mailer:message-id:date:date:subject:subject:from:from :received:received; s=mr01; t=1729625532; x=1732217533; bh=u7OHb TnvNdlnErpRP4CybM/6blOEBfx1D1KPOncBioA=; b=sszOBfixZ+XaeNxkbMxdF HITHeLeHDfWDpOo15CBRv4kHyjkT+gx1Tnz0yM4a1MqXi0pUBChum8wOh+EJtahN 84sLCrwlz7GfRjFJQPCTNtHIS8VpXO7osztjiBrWZAnq2jPrVyQ7WdqHdoFLcODr jMl8JNAvRZ2E+Qrb4+WPNWcKJHtzPCRICEswiQvHerfuHT/AFaEXcfP/+WnyNbzD mVnXNol8xKj6H8wgkrmSdGNfsoCKbzoTkquXdEXp1jPYqtxb+g/5Wz/4VSMgIc9e E6Apx/Cwgk/ZEya6wDNRhfYkeeCtO92rFTerxwh5XxLPfjKJ15e2h1hEVgan6ueB g== X-Virus-Scanned: by MailRoute Received: from 009.lax.mailroute.net ([127.0.0.1]) by localhost (009.lax [127.0.0.1]) (mroute_mailscanner, port 10029) with LMTP id zqS_Yy08N-Vs; Tue, 22 Oct 2024 19:32:12 +0000 (UTC) Received: from bvanassche.mtv.corp.google.com (unknown [104.135.204.82]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bvanassche@acm.org) by 009.lax.mailroute.net (Postfix) with ESMTPSA id 4XY2PL4QF7zlgTWQ; Tue, 22 Oct 2024 19:32:06 +0000 (UTC) From: Bart Van Assche To: "Martin K . Petersen" Cc: linux-scsi@vger.kernel.org, Bart Van Assche , Avri Altman , Peter Wang , "James E.J. Bottomley" , Matthias Brugger , AngeloGioacchino Del Regno , Manivannan Sadhasivam , Andrew Halaney , Bean Huo , Maramaina Naresh Subject: [PATCH v2 2/6] scsi: ufs: core: Remove goto statements from ufshcd_try_to_abort_task() Date: Tue, 22 Oct 2024 12:30:58 -0700 Message-ID: <20241022193130.2733293-3-bvanassche@acm.org> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog In-Reply-To: <20241022193130.2733293-1-bvanassche@acm.org> References: <20241022193130.2733293-1-bvanassche@acm.org> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The only statement that follows the 'out:' label in ufshcd_try_to_abort_task() is a return-statement. Simplify this function by changing 'goto out' statements into return statements. Reviewed-by: Avri Altman Reviewed-by: Peter Wang Signed-off-by: Bart Van Assche --- drivers/ufs/core/ufshcd.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 9e6d008f4ea4..57ce1910fda0 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -7486,7 +7486,7 @@ static void ufshcd_set_req_abort_skip(struct ufs_hba *hba, unsigned long bitmap) int ufshcd_try_to_abort_task(struct ufs_hba *hba, int tag) { struct ufshcd_lrb *lrbp = &hba->lrb[tag]; - int err = 0; + int err; int poll_cnt; u8 resp = 0xF; u32 reg; @@ -7516,7 +7516,7 @@ int ufshcd_try_to_abort_task(struct ufs_hba *hba, int tag) /* command completed already */ dev_err(hba->dev, "%s: cmd at tag=%d is cleared.\n", __func__, tag); - goto out; + return 0; } /* Single Doorbell Mode */ @@ -7529,21 +7529,17 @@ int ufshcd_try_to_abort_task(struct ufs_hba *hba, int tag) /* command completed already */ dev_err(hba->dev, "%s: cmd at tag %d successfully cleared from DB.\n", __func__, tag); - goto out; + return 0; } else { dev_err(hba->dev, "%s: no response from device. tag = %d, err %d\n", __func__, tag, err); - if (!err) - err = resp; /* service response error */ - goto out; + return err ? : resp; } } - if (!poll_cnt) { - err = -EBUSY; - goto out; - } + if (!poll_cnt) + return -EBUSY; err = ufshcd_issue_tm_cmd(hba, lrbp->lun, lrbp->task_tag, UFS_ABORT_TASK, &resp); @@ -7553,7 +7549,7 @@ int ufshcd_try_to_abort_task(struct ufs_hba *hba, int tag) dev_err(hba->dev, "%s: issued. tag = %d, err %d\n", __func__, tag, err); } - goto out; + return err; } err = ufshcd_clear_cmd(hba, tag); @@ -7561,7 +7557,6 @@ int ufshcd_try_to_abort_task(struct ufs_hba *hba, int tag) dev_err(hba->dev, "%s: Failed clearing cmd at tag %d, err %d\n", __func__, tag, err); -out: return err; } From patchwork Tue Oct 22 19:30:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 13846090 Received: from 009.lax.mailroute.net (009.lax.mailroute.net [199.89.1.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0A3E414E2C0 for ; Tue, 22 Oct 2024 19:32:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=199.89.1.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729625549; cv=none; b=SlYIab+5rXZaNg6Wr6ePPBzNCYx6LgrwiTblSTOB8O6AWY7sWPBqAlBEsKc9hL+5+cyZD8qI0BdH98XylM+n+kDG3DL3kWNfANTWAmNfcLD60/Lo6WJZXB9f2cHJ3kkBgaGTGfYODfDNUfpvreG64ae905fdzQ/cXCAp3StchwE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729625549; c=relaxed/simple; bh=lLTwkuh7N9doUUCx86jYTBjOPmNXhUQP3v3fF0opHlk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hdJrwJGGW6S8r27W4k6ml9yxwpnCkAIIFgwXHEYUU++T4DDT3izwq4XHznppsYuR8gOanEeudBhTMSUkjOUSGweX1PFTaQc76qhESD+ye0JFm/auUwxNbRyzCdtrrjcOaFQLi5zTXK1KMa7MJgU89Uirg11hF99zwzbErle8sR8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org; spf=pass smtp.mailfrom=acm.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b=N5OH9EIQ; arc=none smtp.client-ip=199.89.1.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=acm.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b="N5OH9EIQ" Received: from localhost (localhost [127.0.0.1]) by 009.lax.mailroute.net (Postfix) with ESMTP id 4XY2Pl58r4zlgTWQ; Tue, 22 Oct 2024 19:32:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=acm.org; h= content-transfer-encoding:mime-version:references:in-reply-to :x-mailer:message-id:date:date:subject:subject:from:from :received:received; s=mr01; t=1729625542; x=1732217543; bh=uJCuw gswvqXnoAl5hmqAkiv+YbhAKq6vLarB/lFbeSI=; b=N5OH9EIQ6HT6/21ZhEUr0 qaZHLRH6bC23ssYA+ePr+y+mvOu6iLvP8BD1wk/cmxityRbAEn9ji8CvRvrUDHof +/5+mqEcJZqbzi158n8NgRpUQPth9oqF0yciF9e0f8zTlei4NCDlqp9pvXnItlJo E4na5pl4KdpC58cDrBPlaQi3QxTT63R2Cll7bZFQMDEgsQ5Vl7ftG9oFjzApA/FY sSUg/KGAGXU9D9ebqW962B/uXfoqD5AdiYkK2nyjaIxEPIqAaF3Bp98nZwHOMZy2 LC71To+YdX25WDqhVzNEi89Lxyo+1XHppE5HSs9QWnIbOL9ZFMwz4OJfWkdva4FI g== X-Virus-Scanned: by MailRoute Received: from 009.lax.mailroute.net ([127.0.0.1]) by localhost (009.lax [127.0.0.1]) (mroute_mailscanner, port 10029) with LMTP id RBWpiSKbOrWB; Tue, 22 Oct 2024 19:32:22 +0000 (UTC) Received: from bvanassche.mtv.corp.google.com (unknown [104.135.204.82]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bvanassche@acm.org) by 009.lax.mailroute.net (Postfix) with ESMTPSA id 4XY2PY4wppzlgTWP; Tue, 22 Oct 2024 19:32:15 +0000 (UTC) From: Bart Van Assche To: "Martin K . Petersen" Cc: linux-scsi@vger.kernel.org, Bart Van Assche , "James E.J. Bottomley" , Peter Wang , Manivannan Sadhasivam , Avri Altman , Andrew Halaney , Bean Huo , Maramaina Naresh Subject: [PATCH v2 3/6] scsi: ufs: core: Simplify ufshcd_try_to_abort_task() Date: Tue, 22 Oct 2024 12:30:59 -0700 Message-ID: <20241022193130.2733293-4-bvanassche@acm.org> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog In-Reply-To: <20241022193130.2733293-1-bvanassche@acm.org> References: <20241022193130.2733293-1-bvanassche@acm.org> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The MCQ code is also valid for legacy mode. Hence, remove the legacy mode code and retain the MCQ code. Since it is not an error if a command completes while ufshcd_try_to_abort_task() is in progress, use dev_info() instead of dev_err() to report this. Signed-off-by: Bart Van Assche --- drivers/ufs/core/ufshcd.c | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 57ce1910fda0..76884df580c3 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -7489,7 +7489,6 @@ int ufshcd_try_to_abort_task(struct ufs_hba *hba, int tag) int err; int poll_cnt; u8 resp = 0xF; - u32 reg; for (poll_cnt = 100; poll_cnt; poll_cnt--) { err = ufshcd_issue_tm_cmd(hba, lrbp->lun, lrbp->task_tag, @@ -7504,32 +7503,17 @@ int ufshcd_try_to_abort_task(struct ufs_hba *hba, int tag) * cmd not pending in the device, check if it is * in transition. */ - dev_err(hba->dev, "%s: cmd at tag %d not pending in the device.\n", + dev_info( + hba->dev, + "%s: cmd with tag %d not pending in the device.\n", __func__, tag); - if (hba->mcq_enabled) { - /* MCQ mode */ - if (ufshcd_cmd_inflight(lrbp->cmd)) { - /* sleep for max. 200us same delay as in SDB mode */ - usleep_range(100, 200); - continue; - } - /* command completed already */ - dev_err(hba->dev, "%s: cmd at tag=%d is cleared.\n", - __func__, tag); + if (!ufshcd_cmd_inflight(lrbp->cmd)) { + dev_info(hba->dev, + "%s: cmd with tag=%d completed.\n", + __func__, tag); return 0; } - - /* Single Doorbell Mode */ - reg = ufshcd_readl(hba, REG_UTP_TRANSFER_REQ_DOOR_BELL); - if (reg & (1 << tag)) { - /* sleep for max. 200us to stabilize */ - usleep_range(100, 200); - continue; - } - /* command completed already */ - dev_err(hba->dev, "%s: cmd at tag %d successfully cleared from DB.\n", - __func__, tag); - return 0; + usleep_range(100, 200); } else { dev_err(hba->dev, "%s: no response from device. tag = %d, err %d\n", From patchwork Tue Oct 22 19:31:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 13846091 Received: from 009.lax.mailroute.net (009.lax.mailroute.net [199.89.1.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C66321CB313 for ; Tue, 22 Oct 2024 19:32:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=199.89.1.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729625559; cv=none; b=jSbFuC6Gz+fNn8EWBqoydn0jy+CK+PvI95naEI9GPu0pVlsDbaMUkxt7NSAqhTZykEgCAbR4RjS5ase6+YimSj8scgjk1tyPoLlw3c0b73xmUHeM/XxIjtZndwxAEn9SKhZizyDkDDqbihVQES6tCBKCnEY65qcWt+JWccp5Ttg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729625559; c=relaxed/simple; bh=0vIe6xWSb1uN2BA5mvu1z7guMNkF+Ujgi+3cuq/Udt0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=T8DzWuLrCH/XZgRlSaNN7vqbhCHfjxonWrvd+d4WbEtB2xBZ3UQmOZ0Cna8Snri28qc8I6zCyGRSA3omNxuZEfbwYuY3XoOwX1D8pbguCEQJ8Nb/hTd7xEbgrpH6vPr4Njlh6FOfAu1W7JoZetyJ1TsS/stZuL5cVP5bMuTHJSk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org; spf=pass smtp.mailfrom=acm.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b=aT8+pknA; arc=none smtp.client-ip=199.89.1.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=acm.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b="aT8+pknA" Received: from localhost (localhost [127.0.0.1]) by 009.lax.mailroute.net (Postfix) with ESMTP id 4XY2Px1y67zlgTWQ; Tue, 22 Oct 2024 19:32:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=acm.org; h= content-transfer-encoding:mime-version:references:in-reply-to :x-mailer:message-id:date:date:subject:subject:from:from :received:received; s=mr01; t=1729625553; x=1732217554; bh=nB3QP eIa5Mj1kg9/4TSYwcyOx44JbRot9yLHLuC0ONI=; b=aT8+pknAmHQ3oroh0dQ7S JSxKy2zZ0HBpdMvDiHTusVrPpRLPcwilvt6N3Rm/CjsQU70opkn4nbS2xQQFWW/G ul++Kab9dJU0OTbdWvEEje/QewTRmfiF3ajO/6wn9ym4qHH4IdNRA3A7RkqUX7d3 CdYdg8EzDB7aNR9vzuPiQ2oCeRBLsjN70Xwf28vhj0ewbNtQ+XAzFTvSQu6LI8ce 88jxHXywR2mCisw+uFPNIDmZK8akXCWOGWiqzh9lb2d0KnUkNnvALYpyHBqbGHtn 3RSyYRZBFs/K+cldDrWheziAumXE48enslbjbEGGpnDa9Y2sa3ba7xJGy3gvJcIl w== X-Virus-Scanned: by MailRoute Received: from 009.lax.mailroute.net ([127.0.0.1]) by localhost (009.lax [127.0.0.1]) (mroute_mailscanner, port 10029) with LMTP id 2DGf9deozXm6; Tue, 22 Oct 2024 19:32:33 +0000 (UTC) Received: from bvanassche.mtv.corp.google.com (unknown [104.135.204.82]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bvanassche@acm.org) by 009.lax.mailroute.net (Postfix) with ESMTPSA id 4XY2Pm1LZ0zlgTWP; Tue, 22 Oct 2024 19:32:26 +0000 (UTC) From: Bart Van Assche To: "Martin K . Petersen" Cc: linux-scsi@vger.kernel.org, Bart Van Assche , Peter Wang , Avri Altman , "James E.J. Bottomley" , Matthias Brugger , AngeloGioacchino Del Regno , Manivannan Sadhasivam , Andrew Halaney , Bean Huo , Maramaina Naresh Subject: [PATCH v2 4/6] scsi: ufs: core: Simplify ufshcd_exception_event_handler() Date: Tue, 22 Oct 2024 12:31:00 -0700 Message-ID: <20241022193130.2733293-5-bvanassche@acm.org> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog In-Reply-To: <20241022193130.2733293-1-bvanassche@acm.org> References: <20241022193130.2733293-1-bvanassche@acm.org> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The ufshcd_scsi_block_requests() and ufshcd_scsi_unblock_requests() calls were introduced in ufshcd_exception_event_handler() to prevent that querying the exception event information would time out. Commit 10fe5888a40e ("scsi: ufs: increase the scsi query response timeout") increased the timeout for querying exception information from 30 ms to 1.5 s and thereby eliminated the risk that a timeout would happen. Hence, the calls to block and unblock SCSI requests are superfluous. Remove these calls. Reviewed-by: Peter Wang Tested-by: Avri Altman Signed-off-by: Bart Van Assche --- drivers/ufs/core/ufshcd.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 76884df580c3..2fde1b0a6086 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -6195,12 +6195,11 @@ static void ufshcd_exception_event_handler(struct work_struct *work) u32 status = 0; hba = container_of(work, struct ufs_hba, eeh_work); - ufshcd_scsi_block_requests(hba); err = ufshcd_get_ee_status(hba, &status); if (err) { dev_err(hba->dev, "%s: failed to get exception status %d\n", __func__, err); - goto out; + return; } trace_ufshcd_exception_event(dev_name(hba->dev), status); @@ -6212,8 +6211,6 @@ static void ufshcd_exception_event_handler(struct work_struct *work) ufshcd_temp_exception_event_handler(hba, status); ufs_debugfs_exception_event(hba, status); -out: - ufshcd_scsi_unblock_requests(hba); } /* Complete requests that have door-bell cleared */ From patchwork Tue Oct 22 19:31:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 13846093 Received: from 009.lax.mailroute.net (009.lax.mailroute.net [199.89.1.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 29BE917C98 for ; Tue, 22 Oct 2024 19:32:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=199.89.1.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729625575; cv=none; b=oxeigcm+gP8tp9nLyUV46wFMmgLM9guPh6om/kIp6EOu4e4kMSdRga03vxSxLOxP/dkzywH9ZEMBSE57Os9OjzYKqLcKXGRTm8MaZvmmJRDcollYz38ky0gBGQVSU9g5GVx6X0yMApDb8K/9/CcOzouo8iWogmifklJJ03IQTrs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729625575; c=relaxed/simple; bh=xMYIHmk+T+4ng2pmz1M32HNxLDLj5L71Lfbohd48erM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ECHbksYKpZt658tbh/7vKyLuP1xi09SO8b0ILggfb2KJ7zIlOr82KJR7/xT2dd8UDJUaJ3gtk1oTfMqIgQjFVRSOd4e4JsLVTGRRQYyU/ANMDSsHXdO/9bPRhHZajtcgvC+y5WLtvj8KPBQ7RRLwe7J3PL2X+ohimJqc0vXYh2g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org; spf=pass smtp.mailfrom=acm.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b=HhgiAcra; arc=none smtp.client-ip=199.89.1.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=acm.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b="HhgiAcra" Received: from localhost (localhost [127.0.0.1]) by 009.lax.mailroute.net (Postfix) with ESMTP id 4XY2QF4GNkzlgMVW; Tue, 22 Oct 2024 19:32:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=acm.org; h= content-transfer-encoding:mime-version:references:in-reply-to :x-mailer:message-id:date:date:subject:subject:from:from :received:received; s=mr01; t=1729625565; x=1732217566; bh=uZGjA JdKsfUKQn25GH7Spbxci4VJY+9XHaEdlkVlTZE=; b=HhgiAcraro8PeLgmhMhKU As9RV8UWe183M4YcoMWdKRkctKwY4Ss1u/5mqnrPh6LtdveA9NPcqqIqAo5aIHPo 1CJ2s/IrU/cr7fg4evDYwpGz80O6fCLE6H+uHRw/D0wVdASeA6Fu4r5zgceXu3UO lteeGtdzpZAOglSBD08O48Jnj5NSMcTuJzGwW/SS7ViFIlZDRt3BVdNPj5+lKHRL ZdCoWscQ7HVtwGb8nM7TxbXgq/IhqXoi6uUCdjH3kmBovTbh/M2jDLGh6Wnb1L6B Q/Zt72Tp6cgkOmD1KOF5F3OhCcXmq5fprASCkS+kl5bt7a+iM/jRwVgPbgEfZrZZ g== X-Virus-Scanned: by MailRoute Received: from 009.lax.mailroute.net ([127.0.0.1]) by localhost (009.lax [127.0.0.1]) (mroute_mailscanner, port 10029) with LMTP id 6X4XaEQSoKH4; Tue, 22 Oct 2024 19:32:45 +0000 (UTC) Received: from bvanassche.mtv.corp.google.com (unknown [104.135.204.82]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bvanassche@acm.org) by 009.lax.mailroute.net (Postfix) with ESMTPSA id 4XY2Q04tl5zlgTWP; Tue, 22 Oct 2024 19:32:40 +0000 (UTC) From: Bart Van Assche To: "Martin K . Petersen" Cc: linux-scsi@vger.kernel.org, Bart Van Assche , Avri Altman , "James E.J. Bottomley" , Peter Wang , Manivannan Sadhasivam , Andrew Halaney , Bean Huo , Maramaina Naresh , Eric Biggers , Minwoo Im Subject: [PATCH v2 5/6] scsi: ufs: core: Simplify ufshcd_err_handling_prepare() Date: Tue, 22 Oct 2024 12:31:01 -0700 Message-ID: <20241022193130.2733293-6-bvanassche@acm.org> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog In-Reply-To: <20241022193130.2733293-1-bvanassche@acm.org> References: <20241022193130.2733293-1-bvanassche@acm.org> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Use blk_mq_quiesce_tagset() instead of ufshcd_scsi_block_requests() and blk_mq_wait_quiesce_done(). Since this patch removes the last callers of ufshcd_scsi_block_requests() and ufshcd_scsi_unblock_requests(), remove these functions. Reviewed-by: Avri Altman Signed-off-by: Bart Van Assche --- drivers/ufs/core/ufshcd.c | 19 +++---------------- include/ufs/ufshcd.h | 2 -- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 2fde1b0a6086..e0dba0e3d5b5 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -349,18 +349,6 @@ static void ufshcd_configure_wb(struct ufs_hba *hba) ufshcd_wb_toggle_buf_flush(hba, true); } -static void ufshcd_scsi_unblock_requests(struct ufs_hba *hba) -{ - if (atomic_dec_and_test(&hba->scsi_block_reqs_cnt)) - scsi_unblock_requests(hba->host); -} - -static void ufshcd_scsi_block_requests(struct ufs_hba *hba) -{ - if (atomic_inc_return(&hba->scsi_block_reqs_cnt) == 1) - scsi_block_requests(hba->host); -} - static void ufshcd_add_cmd_upiu_trace(struct ufs_hba *hba, unsigned int tag, enum ufs_trace_str_t str_t) { @@ -6376,15 +6364,14 @@ static void ufshcd_err_handling_prepare(struct ufs_hba *hba) ufshcd_suspend_clkscaling(hba); ufshcd_clk_scaling_allow(hba, false); } - ufshcd_scsi_block_requests(hba); /* Wait for ongoing ufshcd_queuecommand() calls to finish. */ - blk_mq_wait_quiesce_done(&hba->host->tag_set); + blk_mq_quiesce_tagset(&hba->host->tag_set); cancel_work_sync(&hba->eeh_work); } static void ufshcd_err_handling_unprepare(struct ufs_hba *hba) { - ufshcd_scsi_unblock_requests(hba); + blk_mq_unquiesce_tagset(&hba->host->tag_set); ufshcd_release(hba); if (ufshcd_is_clkscaling_supported(hba)) ufshcd_clk_scaling_suspend(hba, false); @@ -10557,7 +10544,7 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) /* Hold auto suspend until async scan completes */ pm_runtime_get_sync(dev); - atomic_set(&hba->scsi_block_reqs_cnt, 0); + /* * We are assuming that device wasn't put in sleep/power-down * state exclusively during the boot stage before kernel. diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h index a0b325a32aca..36bd91ff3593 100644 --- a/include/ufs/ufshcd.h +++ b/include/ufs/ufshcd.h @@ -928,7 +928,6 @@ enum ufshcd_mcq_opr { * @wb_mutex: used to serialize devfreq and sysfs write booster toggling * @clk_scaling_lock: used to serialize device commands and clock scaling * @desc_size: descriptor sizes reported by device - * @scsi_block_reqs_cnt: reference counting for scsi block requests * @bsg_dev: struct device associated with the BSG queue * @bsg_queue: BSG queue associated with the UFS controller * @rpm_dev_flush_recheck_work: used to suspend from RPM (runtime power @@ -1089,7 +1088,6 @@ struct ufs_hba { struct mutex wb_mutex; struct rw_semaphore clk_scaling_lock; - atomic_t scsi_block_reqs_cnt; struct device bsg_dev; struct request_queue *bsg_queue; From patchwork Tue Oct 22 19:31:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 13846094 Received: from 009.lax.mailroute.net (009.lax.mailroute.net [199.89.1.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3B5A217C98 for ; Tue, 22 Oct 2024 19:32:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=199.89.1.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729625580; cv=none; b=BT0e/cv9SWsQxbbyrIlt1qJBnFL65+RHDQFoW/zcgRxhRh/txJGk7TWDocSvZkpp1RE/jFlam8qpmbK+pw4cMVc1P9491VEH8ValX9O/6ylmd+iVasmxnRvHRb9ahQTePlSSBMxJcZp3oHtVS3hFU61cOtlnrcq9qiexUD2x1kY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729625580; c=relaxed/simple; bh=iFhDpadDTq1M/fi5LZpwWwjxPq0/WLAFbYD+GnYMDmE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fC5CWAgGoD887AZ1OzgvIqkJf55DxUr/QHVjb1wDTozeg74k2hfg0f1/7oqneEmWxG1n6h6KZ21sSp0xa+fZQUQldzxo0rFnTbhOnkIJ+60PH01al2BNst2rQAnj9TJAxbzAz8KFW6pAhXuZyF2vZMuW4UAH/xOykLep7B5S7rQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org; spf=pass smtp.mailfrom=acm.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b=ggtXw2p8; arc=none smtp.client-ip=199.89.1.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=acm.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b="ggtXw2p8" Received: from localhost (localhost [127.0.0.1]) by 009.lax.mailroute.net (Postfix) with ESMTP id 4XY2QL6vqwzlgTWP; Tue, 22 Oct 2024 19:32:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=acm.org; h= content-transfer-encoding:mime-version:references:in-reply-to :x-mailer:message-id:date:date:subject:subject:from:from :received:received; s=mr01; t=1729625574; x=1732217575; bh=w2uiL xtKaJLX55oab5tZy0PTkoSS/6+EcUjV+abbHrY=; b=ggtXw2p8OZ+QOhgLiXgYe X16w1vY5eTDp95MXJK9lT9Q27iRYl9FfH4jWncbm0G1bcUj1W4OSH+KjmhBlHGWs a8+Mful54bW5E9kt2Pk16Cq5q8bOxb/qKEyNV4KEpW0VEf4hzlglluQhqJwwV2Xi AxuqfjNlNJwPXxGNzswCoNA2YsQHGXkRsF0rC18hWDmy5DV/hpuhvlAE4RqetM6A KPo+wjRxZlQgj56Lz5UMZCrsqusgK0oq6mati+FmZVKHzwJn+uCf/ifPrCsXgsHT pY4aJzq2+7hDITNNoJKkVa9QSIoUWobP+AwzQZHQ6uNN6cpMHyvUb7cN1dN5Pm6W w== X-Virus-Scanned: by MailRoute Received: from 009.lax.mailroute.net ([127.0.0.1]) by localhost (009.lax [127.0.0.1]) (mroute_mailscanner, port 10029) with LMTP id VPl9yyWj-_Dz; Tue, 22 Oct 2024 19:32:54 +0000 (UTC) Received: from bvanassche.mtv.corp.google.com (unknown [104.135.204.82]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bvanassche@acm.org) by 009.lax.mailroute.net (Postfix) with ESMTPSA id 4XY2QB1wqZzlgTWQ; Tue, 22 Oct 2024 19:32:49 +0000 (UTC) From: Bart Van Assche To: "Martin K . Petersen" Cc: linux-scsi@vger.kernel.org, Bart Van Assche , "Bao D. Nguyen" , "James E.J. Bottomley" , Peter Wang , Minwoo Im , Manivannan Sadhasivam , Chanwoo Lee , Rohit Ner , Stanley Jhu , Can Guo Subject: [PATCH v2 6/6] scsi: ufs: core: Improve ufshcd_mcq_sq_cleanup() Date: Tue, 22 Oct 2024 12:31:02 -0700 Message-ID: <20241022193130.2733293-7-bvanassche@acm.org> X-Mailer: git-send-email 2.47.0.105.g07ac214952-goog In-Reply-To: <20241022193130.2733293-1-bvanassche@acm.org> References: <20241022193130.2733293-1-bvanassche@acm.org> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From the UFSHCI specification: "CleanUp Command Return Code (RTC): host controller sets this return code to provide more details of the cleanup process. It is valid only when CUS is 1." Hence, do not read RTC if the CUS bitfield is zero. Cc: Bao D. Nguyen Fixes: 8d7290348992 ("scsi: ufs: mcq: Add supporting functions for MCQ abort") Signed-off-by: Bart Van Assche --- drivers/ufs/core/ufs-mcq.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/ufs/core/ufs-mcq.c b/drivers/ufs/core/ufs-mcq.c index 57ced1729b73..988400500560 100644 --- a/drivers/ufs/core/ufs-mcq.c +++ b/drivers/ufs/core/ufs-mcq.c @@ -572,14 +572,18 @@ int ufshcd_mcq_sq_cleanup(struct ufs_hba *hba, int task_tag) /* SQRTCy.ICU = 1 */ writel(SQ_ICU, opr_sqd_base + REG_SQRTC); - /* Poll SQRTSy.CUS = 1. Return result from SQRTSy.RTC */ + /* Wait until SQRTSy.CUS = 1. Report SQRTSy.RTC. */ reg = opr_sqd_base + REG_SQRTS; err = read_poll_timeout(readl, val, val & SQ_CUS, 20, MCQ_POLL_US, false, reg); if (err) - dev_err(hba->dev, "%s: failed. hwq=%d, tag=%d err=%ld\n", - __func__, id, task_tag, - FIELD_GET(SQ_ICU_ERR_CODE_MASK, readl(reg))); + dev_err(hba->dev, "%s: failed. hwq=%d, tag=%d err=%d\n", + __func__, id, task_tag, err); + else + dev_info(hba->dev, + "%s, hwq %d: cleanup return code (RTC) %ld\n", + __func__, id, + FIELD_GET(SQ_ICU_ERR_CODE_MASK, readl(reg))); if (ufshcd_mcq_sq_start(hba, hwq)) err = -ETIMEDOUT;