From patchwork Wed Oct 16 21:11:12 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: 836572 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 C5E695478E for ; Wed, 16 Oct 2024 21:12:19 +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=1729113141; cv=none; b=L3bLc98t78Df5FOEFLGjEaN1eOAkbgIBoX7oqJscsFoNaUAHleb+Ua2lo8tsHWFU0moIS5EntMknhQ761e69YHA9RYQ8kt60vzhYZS4FC6rV4v2SXEGU6INRp6D5SdZj5Ns2AGqRlAMFblzxnYVB/m2xWeysA8/5i9neMPhCth4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729113141; c=relaxed/simple; bh=nJiCNFEr2nvYXouCa9qPiMnCv1XWLEmW3ZArSD8YwX0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Al+qBgZPSE8f+KEnV/yz7iXxfFbkp33uKew41zpZe6bDSZaA2+4qr5vgDa0Z3EdqBM0KLH7Nqk9VKWzSPPKelfIkww8+0NuC9y5V8wc4B2lzsfP/wU6zeaHuLIi+zd3EhjsO4nZOCz3r1dN5ROXjZwrcFohp+MOXVN8jEfzxxkA= 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=n1g/dyCg; 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="n1g/dyCg" Received: from localhost (localhost [127.0.0.1]) by 009.lax.mailroute.net (Postfix) with ESMTP id 4XTNvl1qMMzlgMVt; Wed, 16 Oct 2024 21:12:19 +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=1729113134; x=1731705135; bh=bjieb x6JIRUFVTLwcC94SgZT6Wzx5o/Qw/I4S74mwmU=; b=n1g/dyCg/ccxlg6vVXCDT zLJ/X6hAYAEHsdAKKLyC5LDjFbnZXGBXTUwERIWngwIUcDVIUVSLr8/vSpgpwgwq 6jva4iid3S4CiXG0ymvoVeBCSH32U5QiR0xSEAs6tRvCncnKL4ELCKvL5hLzoBTq gN0yjAnVozDYk+5oZO2kz3B8m9QtoGxhcwZMps7Hrd8zqpSr0FBX6gi4XJ2yaW/A V8jWx4aY1OkoFRYJiVaDNuS0kYxB4jSyDNx40rcC9TjlfatZ393bewW7NX+ceO5y C6nZYXYVYqK+IqBdlW0B7pUcOwnDX6OLZk50B7EP3PEcO7zD5W44Z2fS3Z2kHYV8 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 vOBNMffYo0yD; Wed, 16 Oct 2024 21:12:14 +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 4XTNvb1vRvzlgTWP; Wed, 16 Oct 2024 21:12:11 +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 , Minwoo Im , Chanwoo Lee , Rohit Ner , Alim Akhtar , Eric Biggers , Avri Altman , Maramaina Naresh Subject: [PATCH 1/7] scsi: ufs: core: Move the ufshcd_mcq_enable_esi() definition Date: Wed, 16 Oct 2024 14:11:12 -0700 Message-ID: <20241016211154.2425403-2-bvanassche@acm.org> X-Mailer: git-send-email 2.47.0.rc1.288.g06298d1525-goog In-Reply-To: <20241016211154.2425403-1-bvanassche@acm.org> References: <20241016211154.2425403-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. 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 Wed Oct 16 21:11:13 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: 836080 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 4566F5478E for ; Wed, 16 Oct 2024 21:12:25 +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=1729113146; cv=none; b=Y5hOZIFZ7zcpcWC0NoToLFpnD+++U2SV/FMZwH4Z/DeCisobsWR3V0LwE1g8+J/YcQ1H3nE8c4Y/qsbqEPSFXdkcUcWVcxIRN9qDBW0cXMS1Ls/jQWuRQqFGMVLqJvsFeDIqr0H0gsiB7BC39uttHEro9xAe8E/96URl41UGahI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729113146; c=relaxed/simple; bh=Xn+tuGz2iZ3UwjQBmBHrEKPeiEv0Ywldl1LysgdhgWI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pl/aZF3bUGLaT+HxsJ//O6XzsFCg/1mK8NtZKRHBPSyqODomWWirMqm9F0PkEVUCWvn8mEgqh0ENeoebg8LtkkBZLU2QKXHssIDF1ob9bUg2ePu2pyhcHQzef+rGGkrUEaMssQROdMOYSVmtJ2SCHhIibwg969zGjutlvUsnM8g= 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=DGT6u0WN; 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="DGT6u0WN" Received: from localhost (localhost [127.0.0.1]) by 009.lax.mailroute.net (Postfix) with ESMTP id 4XTNvs0C1wzlgTWP; Wed, 16 Oct 2024 21:12:25 +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=1729113141; x=1731705142; bh=dhpm9 EmWWkpfxSCUFvc7iAu3vYdrTITzUUPean/3+es=; b=DGT6u0WN9QLNpwbFrJTQa bkqIRpL1bqFYNm2q8qASIRM+Jms4yeZ+lOvwar8sB70YjfpCZ1EuqXE0bsIFAZ38 WVKLF8xhiwHFnlJ3bjfCOLxhsXg/XZg6Un8Ll1BpzikjeocfDySq4wKp7Xv1X+IW de+/cxrrA5ziy505PzQ7HomlIcH2xLRHT9/M6otWXzPgnUNKorlqwmHNVWQlTRxj bQjDKZGmbyuRJb536YXEcU1svgIOmHsSFs53+L3zgtXDL5rwsRqRDlSWTQ1elJDv WM6CTL2qTfamA+NMx7dOLfs4gOOZPZDzzn58hzFDl9QT1PaB7wjV33Ca4rJPh3MJ 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 s2S-XaIcUsOo; Wed, 16 Oct 2024 21:12:21 +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 4XTNvk4Q8zzlgMVr; Wed, 16 Oct 2024 21:12:18 +0000 (UTC) From: Bart Van Assche To: "Martin K . Petersen" Cc: linux-scsi@vger.kernel.org, Bart Van Assche , "James E.J. Bottomley" , Manivannan Sadhasivam , Peter Wang , Avri Altman , Andrew Halaney , Bean Huo , Maramaina Naresh Subject: [PATCH 2/7] scsi: ufs: core: Remove goto statements from ufshcd_try_to_abort_task() Date: Wed, 16 Oct 2024 14:11:13 -0700 Message-ID: <20241016211154.2425403-3-bvanassche@acm.org> X-Mailer: git-send-email 2.47.0.rc1.288.g06298d1525-goog In-Reply-To: <20241016211154.2425403-1-bvanassche@acm.org> References: <20241016211154.2425403-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. Signed-off-by: Bart Van Assche Reviewed-by: Avri Altman --- 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 Wed Oct 16 21:11:14 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: 836571 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 126135478E for ; Wed, 16 Oct 2024 21:12:31 +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=1729113153; cv=none; b=jNoxILzN79C9mlhVcwqmTKq3dDl+RsZnWjLzKpgnIju8w7+H3m+PiHmxYpmMZFf6MN3YIMEJNr8DH43vCWo/CRHCDhjW0pR36nZhcJNQDNBZSLSqjGmCudHrm1DfXxwF1PFj4nSrmBG0pLOdYvlh9yf/1F3fpTl+4snocvnbLgk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729113153; c=relaxed/simple; bh=lLTwkuh7N9doUUCx86jYTBjOPmNXhUQP3v3fF0opHlk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UaXsiY46eHhQnxGIm8OnWKdYnV2U4vJWnU3FMj8OiqnXoqmYT4MS2QvYhX5iInYI+JseDmOqXSEw8efWqHWugqMVO9sFrX+fje6gkcIhfWMJFB/tk5mljfTJ9Co95ZUGhjn2dvxrk9uO7KswxNfpirLQK6yUZyFn3g36NIos5bw= 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=Zyq8B5wU; 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="Zyq8B5wU" Received: from localhost (localhost [127.0.0.1]) by 009.lax.mailroute.net (Postfix) with ESMTP id 4XTNvz4TqXzlgTWP; Wed, 16 Oct 2024 21:12:31 +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=1729113147; x=1731705148; bh=uJCuw gswvqXnoAl5hmqAkiv+YbhAKq6vLarB/lFbeSI=; b=Zyq8B5wUgFOHmkCnzIjh0 LRmWZmBHKvduTWfHOlQ4vMscXOBfGNtrvRIx7jrizkxG0+mC8XBkWp2X28EKJl8P c8n3LhtiiSRLlebFBQkx8yn1zUw33WGCVAprV5YbvZ/HB6lBorqmxs4bFjnynLvo auWSdeltohhMxLGX47Jyoj+ZfO3czczm6MNnxkhj9hmD2DC6tiIxi25n/nShWJJB m+9TxB+3Oel3HKLmjLyBqxx1Sc1FWVeNwe5q+vEcFkkZC2gzHCfvC1CAqR4vyKVO g48kY1F1JNhd3I+pQ+Df20aTrtFPmiJKFIet1XXIUA7JSvho8I69IscTn0jEjq9N 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 6IWzXs2iXM9y; Wed, 16 Oct 2024 21:12:27 +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 4XTNvs2LtpzlgMVr; Wed, 16 Oct 2024 21:12:25 +0000 (UTC) From: Bart Van Assche To: "Martin K . Petersen" Cc: linux-scsi@vger.kernel.org, Bart Van Assche , "James E.J. Bottomley" , Manivannan Sadhasivam , Peter Wang , Avri Altman , Andrew Halaney , Bean Huo , Maramaina Naresh Subject: [PATCH 3/7] scsi: ufs: core: Simplify ufshcd_try_to_abort_task() Date: Wed, 16 Oct 2024 14:11:14 -0700 Message-ID: <20241016211154.2425403-4-bvanassche@acm.org> X-Mailer: git-send-email 2.47.0.rc1.288.g06298d1525-goog In-Reply-To: <20241016211154.2425403-1-bvanassche@acm.org> References: <20241016211154.2425403-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 Wed Oct 16 21:11:15 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: 836079 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 55A581CBA16 for ; Wed, 16 Oct 2024 21:12:39 +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=1729113160; cv=none; b=ru5TV3opmXBnU1Xiq5FJ1Zyi8dz1lAjhbhf7zdNmabeDRrRcjz1XE6+sVjjHyWcOkG2B/ArX8kXDERByV4QHitBr/00l5lPI8PrXZWp/FWNirfvo5CWbHZ9XbfQWlj6F9lsItKKzyhVX2r/TXZx97xWYwqyPwnBiBsov2QqyelI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729113160; c=relaxed/simple; bh=cW6XNMBTBAgxOtzK7ioYdChwOMIEooir0VfeYR/t2OY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lpci6TgIpti+TcM6swKCv9x2znPqoqPPlSAYDZh0ZBVSQQ9PYQdmWJTxp2iq9tIQRFN3IFJc9Ai6NW7et2OIZMbGrfaxyEDsNAZszAFND9jICJebq6r/vaU7/smRmZEdxJLayfFxtQeDUGdv+IIudMZNrdVrFaGO7KlLyw+OOcQ= 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=xZGPtu8Z; 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="xZGPtu8Z" Received: from localhost (localhost [127.0.0.1]) by 009.lax.mailroute.net (Postfix) with ESMTP id 4XTNw65f7NzlgTWP; Wed, 16 Oct 2024 21:12:38 +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=1729113154; x=1731705155; bh=WOHiv 8CEU+KJI+dGQQYZcdgaaJBmMdv0xMhdmT/xVYU=; b=xZGPtu8ZR0xSABT7POXr3 CpQtefUhLmG/xkl2sOwOrtA8q8aNIvDNJ3RVPBCfnuEzMFwj+Chk3k5OInX4We3U Gn+MCVLpUtotVZe5+/ZSc1rCK2AUFsFUWBkvjyxcIux2VxpiALjrETx8mm3tnWg2 g1z3PNsP6cbDPJDiYdIiuT6qd2A0T3QdyT6mV9XAPLQpjFF+qdAbhNyzNJ8I0exb WZAtyksAGgfEPuZbdLO8mD7gi+aCirmiZhaalGcQOcJlaJRGZj/N7IDeQ9lO62O/ 219YnzqdXjSC0d4CN8yCEEwI/d6esvshfEi91N3mph27FTRU8z+wlvbcrajouLwi 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 gQuCACCqWAhN; Wed, 16 Oct 2024 21:12:34 +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 4XTNvz5N8CzlgMVr; Wed, 16 Oct 2024 21:12:31 +0000 (UTC) From: Bart Van Assche To: "Martin K . Petersen" Cc: linux-scsi@vger.kernel.org, Bart Van Assche , "James E.J. Bottomley" , Manivannan Sadhasivam , Peter Wang , Avri Altman , Andrew Halaney , Bean Huo , Maramaina Naresh , Maya Erez , Asutosh Das , Can Guo Subject: [PATCH 4/7] scsi: ufs: core: Fix ufshcd_exception_event_handler() Date: Wed, 16 Oct 2024 14:11:15 -0700 Message-ID: <20241016211154.2425403-5-bvanassche@acm.org> X-Mailer: git-send-email 2.47.0.rc1.288.g06298d1525-goog In-Reply-To: <20241016211154.2425403-1-bvanassche@acm.org> References: <20241016211154.2425403-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() / blk_mq_unquiesce_tagset() instead of scsi_block_requests() / scsi_unblock_requests() because the former wait for ongoing SCSI command dispatching to finish while the latter do not. Fixes: 2e3611e9546c ("scsi: ufs: fix exception event handling") Signed-off-by: Bart Van Assche --- drivers/ufs/core/ufshcd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 76884df580c3..ff1b0af74041 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -6195,7 +6195,7 @@ 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); + blk_mq_quiesce_tagset(&hba->host->tag_set); err = ufshcd_get_ee_status(hba, &status); if (err) { dev_err(hba->dev, "%s: failed to get exception status %d\n", @@ -6213,7 +6213,7 @@ static void ufshcd_exception_event_handler(struct work_struct *work) ufs_debugfs_exception_event(hba, status); out: - ufshcd_scsi_unblock_requests(hba); + blk_mq_unquiesce_tagset(&hba->host->tag_set); } /* Complete requests that have door-bell cleared */ From patchwork Wed Oct 16 21:11:16 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: 836570 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 539A21D2F4A for ; Wed, 16 Oct 2024 21:12:51 +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=1729113172; cv=none; b=tAkH3sjcKPLIfxVrlPW7A+ixUqTiqS90nb75SkaAaIFf4QYXMjFwzCqxvRk52xfAPdnsY6ioI3k16IMZFa05rpYGjdn0d6vrhS7hAfa8KBqPDj0wERPWo1mUzZ/aIeemMTjjTT697G24jSF1mrNveb1zIAljVIS2mjjfIYvhYxU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729113172; c=relaxed/simple; bh=tJYnRyLs+vOe5ziZOOPwG7tJnXx04wDUxjO/0vkGijE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tW/EXCJwag3X7a2To+NZohxSY+ekzFNWmVD8RzLUa1jgyT3b1PB2VjWVruP+ewAYpl+Er0Oyrw/Betp0Zkp8H3kFyl22+YoefH3tsZcbpIp757zp1DFJ+7feu1Y01pj9QD3yXDWwzWs2X6aL+naDDssQpRpzgwmHl280yHoexsU= 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=sf80NVQf; 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="sf80NVQf" Received: from localhost (localhost [127.0.0.1]) by 009.lax.mailroute.net (Postfix) with ESMTP id 4XTNwL5v4PzlgMVt; Wed, 16 Oct 2024 21:12:50 +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=1729113164; x=1731705165; bh=SLRf9 FpgOFoV8I+ITsfNgy8cGdrL1Z7Tli9KFFH4nO4=; b=sf80NVQfpXQKZXf2j4p+9 KNnvY2XbjbOwOuoYSqk3Cl7RJrcDxGBn1Wi3g4MEreOWGGl/G9Lqrt4luQ3MNd73 VMiFSVgZ6Gnko2mcX1wkDh+3ay/jULEkLDZsc65jEU5SsEiobhtO89Vc50FxJK+l LKmczLT+ZU/35OBM0AkqYqiu6zxSFzVQU6rvMu+fFNaH0BqAwlHC8YFCBIA4cf2O MRrLTslpq94No6hvXW5GFReq1v6h4gIkD/qPycaF0oBnfm9MKsH0Uow59vxdl3a9 oaVNHg2bTVhyPysTFhB+EGB3/EVyUpuQ47d/Qp7lvynrnt+MgirB5QVqZKuwC8Ef 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 WZ09dTFVRmUk; Wed, 16 Oct 2024 21:12:44 +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 4XTNw968PVzlgTWP; Wed, 16 Oct 2024 21:12:41 +0000 (UTC) From: Bart Van Assche To: "Martin K . Petersen" Cc: linux-scsi@vger.kernel.org, Bart Van Assche , "James E.J. Bottomley" , Manivannan Sadhasivam , Peter Wang , Avri Altman , Andrew Halaney , Bean Huo , Maramaina Naresh , Alim Akhtar , Eric Biggers , Minwoo Im Subject: [PATCH 5/7] scsi: ufs: core: Simplify ufshcd_err_handling_prepare() Date: Wed, 16 Oct 2024 14:11:16 -0700 Message-ID: <20241016211154.2425403-6-bvanassche@acm.org> X-Mailer: git-send-email 2.47.0.rc1.288.g06298d1525-goog In-Reply-To: <20241016211154.2425403-1-bvanassche@acm.org> References: <20241016211154.2425403-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(). 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 ff1b0af74041..75e00e5b3f79 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) { @@ -6379,15 +6367,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); @@ -10560,7 +10547,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 Wed Oct 16 21:11:18 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: 836569 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 3026E1D2F42 for ; Wed, 16 Oct 2024 21:13:09 +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=1729113190; cv=none; b=cpFICl0QA2BcY5C73+6iDY9czJeGXtWb33PCJeTEzKDtauzo0grnFTbwmeNusVuJBmhtZf3Ays+7JnrY8bjxG9Re0AJveUacdpzNvs9gL5vIppXBkZ0DDVfuJ9UCGy1J2Jt517j2mjMXtF5aZcGsh2Ogbs9JJ2Eff7LolnZ126M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729113190; c=relaxed/simple; bh=UCL7HwpmMrkOWCYTpoYSw3v+dXq2S/1324SQeV4xfUg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Pn8qMm4TWdSep5uXcyFRCaWRp4CpVMFRLYW4YKoCzu628+NUQl9AJqWhwmtOa+vyPEYNG1fou7wx82YbfohjZPZ4W18hP67sF7DZ8F7o4xJ8Dxw2fSwld6Y2UWjF6agdT1uHbctTD5VOVSSA4laE8cmGm3PYy/+YYrq2gF++9xU= 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=CtlA4nsK; 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="CtlA4nsK" Received: from localhost (localhost [127.0.0.1]) by 009.lax.mailroute.net (Postfix) with ESMTP id 4XTNwh6n9hzlgMVr; Wed, 16 Oct 2024 21:13: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=1729113182; x=1731705183; bh=nBOJM e0B8AN1VXAmXtfYXEEKaQTpcbxJMNXSKJd0Kx8=; b=CtlA4nsKHJ3K/M0k2TCAe N827HRSaeqQgEFs299Y9fHHJhvLQDaG7GTLmt1RbK1h+RxGmJj/OaNr5vAIl8Wv/ TTvASgenC0t+70rzcyyrg4q5GyHIWWi5hv+WR/v6hnCYywj66guCRodobrv9GJk9 1Tjln+AhLJ02squZC1fJruV3UDqCyPSdwflJIGCBwHs0C9s5U/hp/rmKGx2xyXam vgaSlmxrzKQITeHHEfM7azIQ5ktTIpD+SBUDTVKm+lJZK7mEWMwlD2H8aJZbilcn HAVVlPWUSBT67RolXC+0CEutNRLwcPlIbYBXkawBGZvxr0gEDJjUphjnj47ewA6w 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 z6LGICovOHu4; Wed, 16 Oct 2024 21:13: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 4XTNwW0htWzlgTWP; Wed, 16 Oct 2024 21:12:58 +0000 (UTC) From: Bart Van Assche To: "Martin K . Petersen" Cc: linux-scsi@vger.kernel.org, Bart Van Assche , "James E.J. Bottomley" , Yoshihiro Shimoda , Manivannan Sadhasivam , Peter Wang , Avri Altman , Andrew Halaney , Bean Huo , Maramaina Naresh , Eric Biggers , Minwoo Im Subject: [PATCH 7/7] scsi: ufs: core: Make DMA mask configuration more flexible Date: Wed, 16 Oct 2024 14:11:18 -0700 Message-ID: <20241016211154.2425403-8-bvanassche@acm.org> X-Mailer: git-send-email 2.47.0.rc1.288.g06298d1525-goog In-Reply-To: <20241016211154.2425403-1-bvanassche@acm.org> References: <20241016211154.2425403-1-bvanassche@acm.org> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Replace UFSHCD_QUIRK_BROKEN_64BIT_ADDRESS with ufs_hba_variant_ops::set_dma_mask. Update the Renesas driver accordingly. This patch prepares for adding 36-bit DMA support. No functionality has been changed. Signed-off-by: Bart Van Assche --- drivers/ufs/core/ufshcd.c | 4 ++-- drivers/ufs/host/ufs-renesas.c | 9 +++++++-- include/ufs/ufshcd.h | 9 +++------ 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 75e00e5b3f79..c1d4a9c8480f 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -2389,8 +2389,6 @@ static inline int ufshcd_hba_capabilities(struct ufs_hba *hba) int err; hba->capabilities = ufshcd_readl(hba, REG_CONTROLLER_CAPABILITIES); - if (hba->quirks & UFSHCD_QUIRK_BROKEN_64BIT_ADDRESS) - hba->capabilities &= ~MASK_64_ADDRESSING_SUPPORT; /* nutrs and nutmrs are 0 based values */ hba->nutrs = (hba->capabilities & MASK_TRANSFER_REQUESTS_SLOTS_SDB) + 1; @@ -10280,6 +10278,8 @@ EXPORT_SYMBOL_GPL(ufshcd_dealloc_host); */ static int ufshcd_set_dma_mask(struct ufs_hba *hba) { + if (hba->vops && hba->vops->set_dma_mask) + return hba->vops->set_dma_mask(hba); if (hba->capabilities & MASK_64_ADDRESSING_SUPPORT) { if (!dma_set_mask_and_coherent(hba->dev, DMA_BIT_MASK(64))) return 0; diff --git a/drivers/ufs/host/ufs-renesas.c b/drivers/ufs/host/ufs-renesas.c index 8711e5cbc968..8b0aebf127b6 100644 --- a/drivers/ufs/host/ufs-renesas.c +++ b/drivers/ufs/host/ufs-renesas.c @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -364,14 +365,18 @@ static int ufs_renesas_init(struct ufs_hba *hba) return -ENOMEM; ufshcd_set_variant(hba, priv); - hba->quirks |= UFSHCD_QUIRK_BROKEN_64BIT_ADDRESS | UFSHCD_QUIRK_HIBERN_FASTAUTO; - return 0; } +static int ufs_renesas_set_dma_mask(struct ufs_hba *hba) +{ + return dma_set_mask_and_coherent(hba->dev, DMA_BIT_MASK(32)); +} + static const struct ufs_hba_variant_ops ufs_renesas_vops = { .name = "renesas", .init = ufs_renesas_init, + .set_dma_mask = ufs_renesas_set_dma_mask, .setup_clocks = ufs_renesas_setup_clocks, .hce_enable_notify = ufs_renesas_hce_enable_notify, .dbg_register_dump = ufs_renesas_dbg_register_dump, diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h index 36bd91ff3593..9ea2a7411bb5 100644 --- a/include/ufs/ufshcd.h +++ b/include/ufs/ufshcd.h @@ -299,6 +299,8 @@ struct ufs_pwr_mode_info { * @max_num_rtt: maximum RTT supported by the host * @init: called when the driver is initialized * @exit: called to cleanup everything done in init + * @set_dma_mask: For setting another DMA mask than indicated by the 64AS + * capability bit. * @get_ufs_hci_version: called to get UFS HCI version * @clk_scale_notify: notifies that clks are scaled up/down * @setup_clocks: called before touching any of the controller registers @@ -341,6 +343,7 @@ struct ufs_hba_variant_ops { int (*init)(struct ufs_hba *); void (*exit)(struct ufs_hba *); u32 (*get_ufs_hci_version)(struct ufs_hba *); + int (*set_dma_mask)(struct ufs_hba *); int (*clk_scale_notify)(struct ufs_hba *, bool, enum ufs_notify_change_status); int (*setup_clocks)(struct ufs_hba *, bool, @@ -623,12 +626,6 @@ enum ufshcd_quirks { */ UFSHCD_QUIRK_SKIP_PH_CONFIGURATION = 1 << 16, - /* - * This quirk needs to be enabled if the host controller has - * 64-bit addressing supported capability but it doesn't work. - */ - UFSHCD_QUIRK_BROKEN_64BIT_ADDRESS = 1 << 17, - /* * This quirk needs to be enabled if the host controller has * auto-hibernate capability but it's FASTAUTO only.