From patchwork Thu Nov 26 05:38:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanley Chu X-Patchwork-Id: 11932705 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 118CDC63777 for ; Thu, 26 Nov 2020 05:41:02 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 807D5206F4 for ; Thu, 26 Nov 2020 05:41:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="UBPgs64P"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="r8qEpu/R" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 807D5206F4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=M0EHRCgy0huxnBGG7o+fV9X0Q2yqIrb2YNCwx5UUrzE=; b=UBPgs64PQGU+blbXCDxK5KQ+X 4o2UgBq+8qg/3tFgOaDKGHF7NtRNwE82ar2G/1qn/88jiRN7z704Qq7dhHgmd8z+1D6rYsSCohVSQ jUzcm/15wCcT6DiXmTfxnoIgkm9lUmHzBc5xr7TCGkb+0PDdIZkjY5Wc3GvMOMOZRxQToJ0NNHwBt b4mCNnTfoG47LQbozlcQktVsciDJCWrDhSAEZ/RLFOdtw0F4Uo0k+Weoj4GLVooeOnoyGcA6KZw5N CNgxPfrANVK7XAyKKITFhR8dOCWmui4Y6IY+Z4Xwy1ePIG/FSCcPfPtbV8qvNZqTUyqcm0RP4frd0 3NrSRGk6A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kiA07-0005d1-SI; Thu, 26 Nov 2020 05:39:27 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ki9zf-0005X8-Mn; Thu, 26 Nov 2020 05:39:00 +0000 X-UUID: a48b7367bea64687bd86b7bf8fc23237-20201125 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=lUm3VEX1XpTDt9hbOEsQJpksYU2cZrrRZCzo6bMfzuA=; b=r8qEpu/RkQPazN8B6EitGT+zELMTBDBvtUhGjDaehf5lcsfdNCfQdln0BiGtNvpHWYJjbfcqDz+2ehs1/riLcBgfwJmI1MREbPTLw18NKzwdh8BU/u61vrHMAAIbjS6KIRe+DccuPoAPvMW+IvO4zJig2Kow7Hbfw0QDqCi/W5Y=; X-UUID: a48b7367bea64687bd86b7bf8fc23237-20201125 Received: from mtkcas67.mediatek.inc [(172.29.193.45)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1054702810; Wed, 25 Nov 2020 21:38:29 -0800 Received: from MTKMBS02N2.mediatek.inc (172.21.101.101) by MTKMBS62N2.mediatek.inc (172.29.193.42) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 25 Nov 2020 21:38:55 -0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs02n2.mediatek.inc (172.21.101.101) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 26 Nov 2020 13:38:40 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 26 Nov 2020 13:38:41 +0800 From: Stanley Chu To: , , , , Subject: [PATCH v1 3/3] scsi: ufs: Introduce notify_event variant function Date: Thu, 26 Nov 2020 13:38:39 +0800 Message-ID: <20201126053839.25889-4-stanley.chu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20201126053839.25889-1-stanley.chu@mediatek.com> References: <20201126053839.25889-1-stanley.chu@mediatek.com> MIME-Version: 1.0 X-TM-SNTS-SMTP: EBE7BAEF129B0F5E336E31696B4C21E27A89E4F63B38E3C9CB52C786E6C3C5152000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201126_003859_944557_7100E1B2 X-CRM114-Status: GOOD ( 12.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stanley Chu , alice.chao@mediatek.com, bvanassche@acm.org, huadian.liu@mediatek.com, andy.teng@mediatek.com, cc.chou@mediatek.com, chun-hung.wu@mediatek.com, kuohong.wang@mediatek.com, linux-kernel@vger.kernel.org, jiajie.hao@mediatek.com, cang@codeaurora.org, linux-mediatek@lists.infradead.org, peter.wang@mediatek.com, matthias.bgg@gmail.com, beanhuo@micron.com, chaotian.jing@mediatek.com, linux-arm-kernel@lists.infradead.org, asutoshd@codeaurora.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Introduce notify_event variant function to allow vendor to get notified of important events and connect to any proprietary debugging facilities. Signed-off-by: Stanley Chu --- drivers/scsi/ufs/ufshcd.c | 2 ++ drivers/scsi/ufs/ufshcd.h | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 7194bed1f10b..63fe37e1c908 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -4484,6 +4484,8 @@ void ufshcd_update_evt_hist(struct ufs_hba *hba, u32 id, u32 val) e->val[e->pos] = val; e->tstamp[e->pos] = ktime_get(); e->pos = (e->pos + 1) % UFS_EVENT_HIST_LENGTH; + + ufshcd_vops_notify_event(hba, id, &val); } EXPORT_SYMBOL_GPL(ufshcd_update_evt_hist); diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index 82c2fc5597bb..a81ca36c1715 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -317,6 +317,7 @@ struct ufs_pwr_mode_info { * @phy_initialization: used to initialize phys * @device_reset: called to issue a reset pulse on the UFS device * @program_key: program or evict an inline encryption key + * @notify_event: called to notify important events */ struct ufs_hba_variant_ops { const char *name; @@ -352,6 +353,8 @@ struct ufs_hba_variant_ops { void *data); int (*program_key)(struct ufs_hba *hba, const union ufs_crypto_cfg_entry *cfg, int slot); + void (*notify_event)(struct ufs_hba *hba, + enum ufs_event_type evt, void *data); }; /* clock gating state */ @@ -1097,6 +1100,14 @@ static inline int ufshcd_vops_clk_scale_notify(struct ufs_hba *hba, return 0; } +static inline void ufshcd_vops_notify_event(struct ufs_hba *hba, + enum ufs_event_type evt, + void *data) +{ + if (hba->vops && hba->vops->notify_event) + hba->vops->notify_event(hba, evt, data); +} + static inline int ufshcd_vops_setup_clocks(struct ufs_hba *hba, bool on, enum ufs_notify_change_status status) {