Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp225373ybx; Thu, 31 Oct 2019 19:12:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqwsa0JYIDrQwhHpnemqX4dWYxsRe3mp1jxoWgLXDiHBArkTIzVQblRVAUzj4QRDGFB2X9NM X-Received: by 2002:aa7:ca0c:: with SMTP id y12mr9846685eds.224.1572574333876; Thu, 31 Oct 2019 19:12:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572574333; cv=none; d=google.com; s=arc-20160816; b=DfABO7aNsemywpHjpn3vZ/hwBnHBBPmtde8qmU+wgi1ZAvUl0bZ/SXOibDKXLblZai jO85yZd2SBdRrZHv4zKI2fz6/zXmS3Q/lMPGAhBM/j038JeesKOd4B0s3rtogALQsiKF VnB6OaRR76zC7vkUYxuJIefVe4vpdCt+X27R0MbPOXLhQ+RFsXX0CCtCEfG2UJ65ffpb Y2dLfF+eMXBSBoUJ+/BYDQ8xdxL4+BLdkQiUKxkyMgLJe52mMt6pdUvM6VG34LBqH9Xe 8QoSTo8167ZqNzXousentChSRlDIeYGRVZvbGpPhrBwASVRblSsUI8+eQqw8Rm4NnPVh HF8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature:dkim-signature; bh=NF5bzTzRHk2R3eOjv65X4liWA7Kvq8v8u/ICxd7VLP8=; b=a0kzQvw6O/KyC5tsBuBV6NtjphjuMef1bJbky6Rto9+DyYsIeMEaVz8Rr/YqerL6hp kN3Dy67vDXBsSQl92PSSwgmVQHi2L8CfdAEJy6sfV+Jy8u/3ST8DVG/+vD1TMw21ht48 vm4g6HxmiAemyuthAGnY1mQoEQmmoFleR3eUcBQD1BgF5vQkW3hBRZOkjPRRVpH3fV9P jlDQzYXzFCak7p6xgYrvoiw+SMYQy8WQMHza8/ZphqZQP7MUulXDWzHHedQWGL2zztNP rZ88JHKNt8LBi3Xt5Nmu8Eh82maNOydgH58j4LcLrPs19mzatUhpNw17SYHyFyTU9rmi 9rTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=gLSX1PZf; dkim=pass header.i=@codeaurora.org header.s=default header.b=pB6wHCTM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gg25si402590ejb.5.2019.10.31.19.11.50; Thu, 31 Oct 2019 19:12:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=gLSX1PZf; dkim=pass header.i=@codeaurora.org header.s=default header.b=pB6wHCTM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729086AbfKABSJ (ORCPT + 99 others); Thu, 31 Oct 2019 21:18:09 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:33092 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726772AbfKABSJ (ORCPT ); Thu, 31 Oct 2019 21:18:09 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id B62CB60B10; Fri, 1 Nov 2019 01:18:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1572571087; bh=y9zMopn20pWyqd0dZAi6MdBEcZVwhsf/FKrrzC2v+nc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=gLSX1PZfWinw39KqYpe7dn5LELvTP3vyfXmd0MSUFFiLT8hftYycjs5QEXIeYP50g jI5r6azQ+z12+2WdunRNOpUDxdBNxAM4j+U6CCr6StU1BZxsooGv13ZGgPHRffL12E NX6HTWFzSdTPpC3LnqdIPuFv7xeU9nXY3lPAvsTI= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 3C1F760913; Fri, 1 Nov 2019 01:18:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1572571086; bh=y9zMopn20pWyqd0dZAi6MdBEcZVwhsf/FKrrzC2v+nc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=pB6wHCTMNwQeSdopYeN0dThzcYnAz2cCO2YnbCR9/j4HD06nQ5ZqAm0IusbOBIcOB xh9U69ZoofNSa8G39UYEBpYLp2OVrXC5CTCLbbyCWdmN+xhA6m5nM+z4uu+kNd+8cJ EkHRQxnY7nASLD6oiKXoI2GgogTXZ/LtWa8L6y68= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 01 Nov 2019 09:18:06 +0800 From: cang@codeaurora.org To: Mark Salyzyn Cc: asutoshd@codeaurora.org, nguyenb@codeaurora.org, rnayak@codeaurora.org, linux-scsi@vger.kernel.org, kernel-team@android.com, saravanak@google.com, salyzyn@google.com, Alim Akhtar , Avri Altman , Pedro Sousa , "James E.J. Bottomley" , "Martin K. Petersen" , Stanley Chu , Bean Huo , Tomas Winkler , Subhash Jadavani , Arnd Bergmann , Bjorn Andersson , open list Subject: Re: [PATCH v1 1/2] scsi: ufs: Introduce a vops for resetting host controller In-Reply-To: <61b83149-e89b-bb4c-d747-a4c596c8eede@android.com> References: <1571804009-29787-1-git-send-email-cang@codeaurora.org> <1571804009-29787-2-git-send-email-cang@codeaurora.org> <61b83149-e89b-bb4c-d747-a4c596c8eede@android.com> Message-ID: <8b7e86d09cde1ea45c1ad979d88dc022@codeaurora.org> X-Sender: cang@codeaurora.org User-Agent: Roundcube Webmail/1.2.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019-10-31 22:44, Mark Salyzyn wrote: > On 10/22/19 9:13 PM, Can Guo wrote: >> Some UFS host controllers need their specific implementations of >> resetting >> to get them into a good state. Provide a new vops to allow the >> platform >> driver to implement this own reset operation. >> >> Signed-off-by: Can Guo >> --- >> drivers/scsi/ufs/ufshcd.c | 16 ++++++++++++++++ >> drivers/scsi/ufs/ufshcd.h | 10 ++++++++++ >> 2 files changed, 26 insertions(+) >> >> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c >> index c28c144..161e3c4 100644 >> --- a/drivers/scsi/ufs/ufshcd.c >> +++ b/drivers/scsi/ufs/ufshcd.c >> @@ -3859,6 +3859,14 @@ static int ufshcd_link_recovery(struct ufs_hba >> *hba) >> ufshcd_set_eh_in_progress(hba); >> spin_unlock_irqrestore(hba->host->host_lock, flags); >> + ret = ufshcd_vops_full_reset(hba); >> + if (ret) >> + dev_warn(hba->dev, "%s: full reset returned %d\n", >> + __func__, ret); >> + >> + /* Reset the attached device */ >> + ufshcd_vops_device_reset(hba); >> + >> ret = ufshcd_host_reset_and_restore(hba); >> spin_lock_irqsave(hba->host->host_lock, flags); > > In all your cases, especially after this adjustment, > ufshcd_vops_full_reset is called blindly (+error checking message) > before ufshcd_vops_device_reset. What about dropping the .full_reset > (should really have been called .hw_reset or .host_reset) addition to > the vops, just adding ufshcd_vops_device_reset call here before > ufshcd_host_reset_and_restore, and in the driver folding the > ufshcd_vops_full_reset code into the .device_reset handler? > > Would that be workable? It would be simpler if so. > > I can see a desire for the heads up > (ufshcd_vops_full_reset+)ufshcd_vops_device_reset calls before > ufshcd_host_reset_and_restore because that function will spin 10 > seconds waiting for a response from a standardized register, that > itself could be hardware locked up requiring product specific reset > procedures. But if that is the case, then what about all the other > calls to ufshcd_host_reset_and_restore in this file that are not > provided the heads up? My guess is that the host device only > demonstrated issues in the ufshcd_link_recovery handling path? Are you > sure this is the only path that tickles the controller into a hardware > lockup state? > > Sincerely -- Mark Salyzyn Hi Mark Salyzyn, Folding the "full_reset" vops inito "device_reset" vops is one choice for now. Shall do that. Your guess is correct. the head up is needed in ufshcd_link_recovery() path because link is already in bad state when we are here, expeically after hibern8 exit fails. So we need a full reset to PHY and host controller here before host_reset_and_restore. But other calls to host_reset_and_restore are under good conditions. Regards, Can Guo.