From patchwork Sat Feb 4 00:57:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: subhashj@codeaurora.org X-Patchwork-Id: 9555399 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C44EE602B7 for ; Sat, 4 Feb 2017 00:57:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF32C27C0C for ; Sat, 4 Feb 2017 00:57:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A3F1328478; Sat, 4 Feb 2017 00:57:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5426427C0C for ; Sat, 4 Feb 2017 00:57:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753418AbdBDA5g (ORCPT ); Fri, 3 Feb 2017 19:57:36 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:44260 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753138AbdBDA5f (ORCPT ); Fri, 3 Feb 2017 19:57:35 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id BE2C760913; Sat, 4 Feb 2017 00:57:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1486169854; bh=mnF+yBFMWAQAJQEVl86J74rpgDosPDT4h9Yn+egGRrA=; h=From:To:Cc:Subject:Date:From; b=JL3FKTlnieieRqmPHb2jZyfpLR3obDIokjhU5n9XSDlkCMqzYzqaiWeqGhNYHqCyv VCG0+9bb7aBgrapyUs6roRXMS3QzcOEyAD6gSmrcSDRohuGZVT237gjlrj8QA7pQRS jBhFOByJcm429bwrQcw1lNPCbZuEHRJ/eClD/GZM= Received: from pacamara-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: subhashj@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id DECF36090C; Sat, 4 Feb 2017 00:57:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1486169854; bh=mnF+yBFMWAQAJQEVl86J74rpgDosPDT4h9Yn+egGRrA=; h=From:To:Cc:Subject:Date:From; b=JL3FKTlnieieRqmPHb2jZyfpLR3obDIokjhU5n9XSDlkCMqzYzqaiWeqGhNYHqCyv VCG0+9bb7aBgrapyUs6roRXMS3QzcOEyAD6gSmrcSDRohuGZVT237gjlrj8QA7pQRS jBhFOByJcm429bwrQcw1lNPCbZuEHRJ/eClD/GZM= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org DECF36090C Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=subhashj@codeaurora.org From: Subhash Jadavani To: vinholikatti@gmail.com, jejb@linux.vnet.ibm.com, martin.petersen@oracle.com Cc: linux-scsi@vger.kernel.org, Gilad Broner , Subhash Jadavani , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v1 4/8] scsi: ufs: add host state prints in failure cases Date: Fri, 3 Feb 2017 16:57:28 -0800 Message-Id: <1486169848-22814-1-git-send-email-subhashj@codeaurora.org> X-Mailer: git-send-email 1.9.1 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Gilad Broner Whenever some UFS failure occurs the driver prints the UFS registers in order to help with analysis of the failure. However this may not be sufficient in some cases, so having the host controller state as it is represented and managed in the driver will contribute to analysis efforts. Added prints of various fields in the hba struct which may be of interest. Signed-off-by: Gilad Broner Signed-off-by: Subhash Jadavani --- drivers/scsi/ufs/ufshcd.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index e75e50d..056e912 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -453,6 +453,28 @@ static void ufshcd_print_tmrs(struct ufs_hba *hba, unsigned long bitmap) } } +static void ufshcd_print_host_state(struct ufs_hba *hba) +{ + dev_err(hba->dev, "UFS Host state=%d\n", hba->ufshcd_state); + dev_err(hba->dev, "lrb in use=0x%lx, outstanding reqs=0x%lx tasks=0x%lx\n", + hba->lrb_in_use, hba->outstanding_tasks, hba->outstanding_reqs); + dev_err(hba->dev, "saved_err=0x%x, saved_uic_err=0x%x\n", + hba->saved_err, hba->saved_uic_err); + dev_err(hba->dev, "Device power mode=%d, UIC link state=%d\n", + hba->curr_dev_pwr_mode, hba->uic_link_state); + dev_err(hba->dev, "PM in progress=%d, sys. suspended=%d\n", + hba->pm_op_in_progress, hba->is_sys_suspended); + dev_err(hba->dev, "Auto BKOPS=%d, Host self-block=%d\n", + hba->auto_bkops_enabled, hba->host->host_self_blocked); + dev_err(hba->dev, "Clk gate=%d\n", hba->clk_gating.state); + dev_err(hba->dev, "error handling flags=0x%x, req. abort count=%d\n", + hba->eh_flags, hba->req_abort_count); + dev_err(hba->dev, "Host capabilities=0x%x, caps=0x%x\n", + hba->capabilities, hba->caps); + dev_err(hba->dev, "quirks=0x%x, dev. quirks=0x%x\n", hba->quirks, + hba->dev_quirks); +} + /** * ufshcd_print_pwr_info - print power params as saved in hba * power info @@ -4426,6 +4448,7 @@ static int ufshcd_task_req_compl(struct ufs_hba *hba, u32 index, u8 *resp) "OCS error from controller = %x for tag %d\n", ocs, lrbp->task_tag); ufshcd_print_host_regs(hba); + ufshcd_print_host_state(hba); break; } /* end of switch */ @@ -5477,6 +5500,7 @@ static int ufshcd_abort(struct scsi_cmnd *cmd) scsi_print_command(hba->lrb[tag].cmd); if (!hba->req_abort_count) { ufshcd_print_host_regs(hba); + ufshcd_print_host_state(hba); ufshcd_print_pwr_info(hba); ufshcd_print_trs(hba, 1 << tag, true); } else { @@ -7738,6 +7762,7 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) if (err) { dev_err(hba->dev, "Host controller enable failed\n"); ufshcd_print_host_regs(hba); + ufshcd_print_host_state(hba); goto out_remove_scsi_host; }