From patchwork Tue Sep 29 17:52:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 11806451 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E8E266CB for ; Tue, 29 Sep 2020 17:52:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C3C5920848 for ; Tue, 29 Sep 2020 17:52:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="PJe+P1fq" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727917AbgI2Rwi (ORCPT ); Tue, 29 Sep 2020 13:52:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725320AbgI2Rwf (ORCPT ); Tue, 29 Sep 2020 13:52:35 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC97AC061755 for ; Tue, 29 Sep 2020 10:52:35 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id n14so5307603pff.6 for ; Tue, 29 Sep 2020 10:52:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=N1lX7l+McFM6cV+ssdxZ5AClsLBq3ozRzVIZ+mY0GZo=; b=PJe+P1fqL1ZX9/RlJKjKd2gP/un7dEK/H0G2AIfohepaT5OC/OAw/1DBId4RkhFPrZ gy3a0WXPg9lm5BQV3tUJBgan812XE2gvUhrogAbcnVqb36E3o/6e1+uMxc3kElu7lbn5 WSpLUGqCj+D4ceWb69emB7b6NSM0is//mKXzYsgjctT6TCWuoU6gDGQdWhNqVpvuDobc 14WdHCzDv8LwopdKK+L5l9JFcI7W+TYdWZTHqHxGS7NV+kaJXrIDT48yCFBLN8yAHzR1 sKZ50yWrVRLwFAK1xKKler66w3iMbznDlkBmu/uGkQ/W5cfRDmA9LNfQTJJN7Kjxvena L30Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=N1lX7l+McFM6cV+ssdxZ5AClsLBq3ozRzVIZ+mY0GZo=; b=ZAFod3wlABkgWIXhmqMuEDzyjIdgrCdjYhZOWOC17gHWT/sy3Fh/uBE8IhAqcgSvqc njxUZPRohhPl10ETY67JjyvF9UmozlVCSZyzAKA/lXiBV6+/zEx9dH5vxiEO9R8rjVan WCoUl8727sT28+bLG2B+zVTw+dzVQIvviYULDqxbquDt9wzFRxFszEwlOArBzi7rZA3O vlgATeP68gBa2/opplf5lqNvcaSJtpKrx6SObiNgC/YVT8DGC21iEn2A76dADVvgMM64 i9hehvluEmyaWSeZnVWJDIfOUeh//xPUM4Ysa/cxcpAn045uSGhurg2bs7ewuDUj4Czy QFqg== X-Gm-Message-State: AOAM53293Dy9qllcjke6uuuY2l/vuGg1fBx0JeGzc+t90s+RVzLtRhs+ mR1LoRbyOfHA4SgkEs5Uus6k9S1i0NUCkAg= X-Google-Smtp-Source: ABdhPJwHl2araGfZcOBIkbzUbUTP/rCz4s3UW/kOg4aDl966UReZYrfICnLxtDiqWExm710mgtV7UQ== X-Received: by 2002:a17:902:d90e:b029:d2:8cba:8f02 with SMTP id c14-20020a170902d90eb02900d28cba8f02mr5643010plz.38.1601401955331; Tue, 29 Sep 2020 10:52:35 -0700 (PDT) Received: from Mani-XPS-13-9360.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id r188sm6271046pfc.67.2020.09.29.10.52.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Sep 2020 10:52:34 -0700 (PDT) From: Manivannan Sadhasivam To: gregkh@linuxfoundation.org Cc: hemantk@codeaurora.org, bbhatt@codeaurora.org, linux-arm-msm@vger.kernel.org, jhugo@codeaurora.org, linux-kernel@vger.kernel.org, Randy Dunlap , Manivannan Sadhasivam Subject: [PATCH v3 01/19] bus: mhi: fix doubled words and struct image_info kernel-doc Date: Tue, 29 Sep 2020 23:22:00 +0530 Message-Id: <20200929175218.8178-2-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200929175218.8178-1-manivannan.sadhasivam@linaro.org> References: <20200929175218.8178-1-manivannan.sadhasivam@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Randy Dunlap Drop doubled word "table" in kernel-doc. Fix syntax for the kernel-doc notation for struct image_info. Note that the bhi_vec field is private and not part of the kernel-doc. Drop doubled word "device" in a comment. Signed-off-by: Randy Dunlap Cc: Manivannan Sadhasivam Cc: Hemant Kumar Cc: linux-arm-msm@vger.kernel.org Reviewed-by: Manivannan Sadhasivam [mani: Added bus: prefix to the commit subject] Signed-off-by: Manivannan Sadhasivam --- include/linux/mhi.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/include/linux/mhi.h b/include/linux/mhi.h index c4a940d98912..0779bc689b3e 100644 --- a/include/linux/mhi.h +++ b/include/linux/mhi.h @@ -85,13 +85,15 @@ enum mhi_ch_type { }; /** - * struct image_info - Firmware and RDDM table table - * @mhi_buf - Buffer for firmware and RDDM table - * @entries - # of entries in table + * struct image_info - Firmware and RDDM table + * @mhi_buf: Buffer for firmware and RDDM table + * @entries: # of entries in table */ struct image_info { struct mhi_buf *mhi_buf; + /* private: from internal.h */ struct bhi_vec_entry *bhi_vec; + /* public: */ u32 entries; }; @@ -593,7 +595,7 @@ int mhi_async_power_up(struct mhi_controller *mhi_cntrl); /** * mhi_sync_power_up - Start MHI power up sequence and wait till the device - * device enters valid EE state + * enters valid EE state * @mhi_cntrl: MHI controller */ int mhi_sync_power_up(struct mhi_controller *mhi_cntrl); From patchwork Tue Sep 29 17:52:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 11806453 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7586C6CB for ; Tue, 29 Sep 2020 17:52:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5570D20848 for ; Tue, 29 Sep 2020 17:52:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="CcAtM72O" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728006AbgI2Rwn (ORCPT ); Tue, 29 Sep 2020 13:52:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727836AbgI2Rwk (ORCPT ); Tue, 29 Sep 2020 13:52:40 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0D4CC061755 for ; Tue, 29 Sep 2020 10:52:39 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id b124so5281506pfg.13 for ; Tue, 29 Sep 2020 10:52:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=bmv3vMkNMLZAUojDUc5hK8E8LQxr3ViBRDic1DDVfzI=; b=CcAtM72OxPK+o7dqPeHsUK9HxRfxj3JUGhIgI5F1VOy+BcyAkIwKkoDG1jZWqrK1G0 x08iK3XgDIL2R8Y65CmwnXDktN+ZHDlRNEYYwcy8huYwVpzQnhS/aoIMjEFXehSrEWhf GEm7oPb2vKtjUH58mgTUr8KPLAvFhTxGwIfGzpC6H+n962TMGexu97/pjvF8YpDKPSZb cj9BVqRKoVO54x2edIHT0NGEJHFSpL0SMw3z0UR7oBYzimrIEuALkRCaBd1BHG0PSYqE ysaw117ird8+vi75KRQxGr4Dn/hE2RQqV3GIGcx6S6zqYHyZps0/WewLZj6s1vpB5a5z V87A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=bmv3vMkNMLZAUojDUc5hK8E8LQxr3ViBRDic1DDVfzI=; b=tDmzTYQ+eODKIjrIRmpbf0lRZk6qqhnrISq6PHVrEmd1hmG+SzkSzpFcyVz07lGiH3 suv42IasMmjXw6JBcHYc7rFa7ymbm3YU4JxnbtlG/Oa+dMugu9xIyikkNfJAHq1AXLD+ sPYUNW/nBgDVTVCrQZt+AeZSDRo5RzMAJfrETYNPXN0gU7Ub9UqxOvQ+wGsLNMHl8pSl OIWcaiDkR/YcxrOSxaRSlvFtEVvXfXkreZTALAwCRnaZtGzGHzg9RPUbJqrHhjxGjl+o HYkKHcWBmZZSLpaNbnVOfy6HEHjVfCp4TP/0LBwMlDDtlpKX5P8lxjKlqQjZ2H2TugH0 Wl5w== X-Gm-Message-State: AOAM532Md1bB+eYIZRVE+pVI0psmYQk9GWElW1YOQo7QxFibrfFn4Rtu vYPrORdKx/SXFbRl5GbllKNSib6ev6BZ1bE= X-Google-Smtp-Source: ABdhPJzL4g5H6yv/k3A+TZkQEkeTCfWweO5Yw8Dj0uw679bCHOjzMVEy8Xk9y5nOBq741rWsP4OT6A== X-Received: by 2002:a63:f342:: with SMTP id t2mr4227953pgj.313.1601401959385; Tue, 29 Sep 2020 10:52:39 -0700 (PDT) Received: from Mani-XPS-13-9360.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id r188sm6271046pfc.67.2020.09.29.10.52.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Sep 2020 10:52:38 -0700 (PDT) From: Manivannan Sadhasivam To: gregkh@linuxfoundation.org Cc: hemantk@codeaurora.org, bbhatt@codeaurora.org, linux-arm-msm@vger.kernel.org, jhugo@codeaurora.org, linux-kernel@vger.kernel.org, Manivannan Sadhasivam Subject: [PATCH v3 02/19] bus: mhi: core: Remove double occurrence for mhi_ctrl_ev_task() declaration Date: Tue, 29 Sep 2020 23:22:01 +0530 Message-Id: <20200929175218.8178-3-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200929175218.8178-1-manivannan.sadhasivam@linaro.org> References: <20200929175218.8178-1-manivannan.sadhasivam@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Bhaumik Bhatt mhi_ctrl_ev_task() in the internal header file occurred twice. Remove one of the occurrences for clean-up. Signed-off-by: Bhaumik Bhatt Reviewed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/internal.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/bus/mhi/core/internal.h b/drivers/bus/mhi/core/internal.h index b1f640b75a94..bcfa7b6558ef 100644 --- a/drivers/bus/mhi/core/internal.h +++ b/drivers/bus/mhi/core/internal.h @@ -592,7 +592,6 @@ void mhi_pm_st_worker(struct work_struct *work); void mhi_pm_sys_err_handler(struct mhi_controller *mhi_cntrl); void mhi_fw_load_worker(struct work_struct *work); int mhi_ready_state_transition(struct mhi_controller *mhi_cntrl); -void mhi_ctrl_ev_task(unsigned long data); int mhi_pm_m0_transition(struct mhi_controller *mhi_cntrl); void mhi_pm_m1_transition(struct mhi_controller *mhi_cntrl); int mhi_pm_m3_transition(struct mhi_controller *mhi_cntrl); From patchwork Tue Sep 29 17:52:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 11806455 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 31F936CA for ; Tue, 29 Sep 2020 17:52:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1095A208B8 for ; Tue, 29 Sep 2020 17:52:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="aRQslGHM" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728041AbgI2Rwp (ORCPT ); Tue, 29 Sep 2020 13:52:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727894AbgI2Rwo (ORCPT ); Tue, 29 Sep 2020 13:52:44 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0BCAC0613D0 for ; Tue, 29 Sep 2020 10:52:43 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id x123so5304207pfc.7 for ; Tue, 29 Sep 2020 10:52:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=GocdqLYTODm0NoMZyaUYMh/e3m0B19dnr1p1DXm0VJA=; b=aRQslGHMAeFni2VsdJTxi6d/DZka///48BBsRpkLIkDMdrfdJm50w1bgWkIvfVisbe KpM1PzpNzKTI66g6xYn8t0nyzL7P9SGXXn9v5mCs+FiKRIa7a3gz8hZN/G+/uqVxpsUh qjd6XMohve35b6uN/AhLaH5FjEApkLqm0c51uFjyBoZkzOW9+zbk6DGR4432SEVkFneN zQ+b0WJuIaFZK+ZeK3U9Xc4dql+9IIEd/PmPAvgpiG6HreWNqTMlXmgRVdyvu4lTyDPt Ikp5wXCI9pBw2Tue8N1SLD6hkfSbSwUO22Yd+ujXuik8DrNWdqYpEdI09RRtv6JvgI6G pEmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=GocdqLYTODm0NoMZyaUYMh/e3m0B19dnr1p1DXm0VJA=; b=AiYE3Koe0W3/SLKGmqPKFrtf6BPcGUZtrbtSUudrUxsrUylMLSEaFirXdMJwx1xTXY faEQzQ6R4Mm+Z3eE4lG1k5UFVY/Qao7qLh4261AALIwx3OohsYJA+Uhs2161HvIfzPeu TpKJIb+GiLyx0qojqJBpxecJYrUOuqPH0o/czUu/jpiPDKOUzKjOx2FuIN1+5PpLUIjY aYP8oiwXHVO/HwLwtFimW3VZoO9v5K6qARX2sNh8+0HK6tFwIvD7HDoch6ZsMVp9sD3G yR1M8JTAl+/1FgqR9nspSi8iHSHgCDlNKrU+htYyKluAvqcDtYG5OkGqLPISwNQTRS5b CsiQ== X-Gm-Message-State: AOAM531gS+8PH75uPmFMbJ+Xd4RWrTZw7cb6RmKn9iJ1qEZQDcxJ1eSP Bz1KFo8E5xbZycAxNnKPaKAu X-Google-Smtp-Source: ABdhPJz8qZHVFBt7Yr2IMsD1khhXNppN/ZKG0zMuuYPY73GPMaNnSXYMkkIIzgwYv7frL44wM9Ymyg== X-Received: by 2002:a63:e441:: with SMTP id i1mr4263442pgk.221.1601401963210; Tue, 29 Sep 2020 10:52:43 -0700 (PDT) Received: from Mani-XPS-13-9360.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id r188sm6271046pfc.67.2020.09.29.10.52.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Sep 2020 10:52:42 -0700 (PDT) From: Manivannan Sadhasivam To: gregkh@linuxfoundation.org Cc: hemantk@codeaurora.org, bbhatt@codeaurora.org, linux-arm-msm@vger.kernel.org, jhugo@codeaurora.org, linux-kernel@vger.kernel.org, Manivannan Sadhasivam Subject: [PATCH v3 03/19] bus: mhi: core: Abort suspends due to outgoing pending packets Date: Tue, 29 Sep 2020 23:22:02 +0530 Message-Id: <20200929175218.8178-4-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200929175218.8178-1-manivannan.sadhasivam@linaro.org> References: <20200929175218.8178-1-manivannan.sadhasivam@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Bhaumik Bhatt Add the missing check to abort suspends if a client driver has pending outgoing packets to send to the device. This allows better utilization of the MHI bus wherein clients on the host are not left waiting for longer suspend or resume cycles to finish for data transfers. Signed-off-by: Bhaumik Bhatt Reviewed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/pm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c index 796098078083..661d704c8093 100644 --- a/drivers/bus/mhi/core/pm.c +++ b/drivers/bus/mhi/core/pm.c @@ -686,7 +686,8 @@ int mhi_pm_suspend(struct mhi_controller *mhi_cntrl) return -EIO; /* Return busy if there are any pending resources */ - if (atomic_read(&mhi_cntrl->dev_wake)) + if (atomic_read(&mhi_cntrl->dev_wake) || + atomic_read(&mhi_cntrl->pending_pkts)) return -EBUSY; /* Take MHI out of M2 state */ @@ -712,7 +713,8 @@ int mhi_pm_suspend(struct mhi_controller *mhi_cntrl) write_lock_irq(&mhi_cntrl->pm_lock); - if (atomic_read(&mhi_cntrl->dev_wake)) { + if (atomic_read(&mhi_cntrl->dev_wake) || + atomic_read(&mhi_cntrl->pending_pkts)) { write_unlock_irq(&mhi_cntrl->pm_lock); return -EBUSY; } From patchwork Tue Sep 29 17:52:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 11806457 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E466C6CB for ; Tue, 29 Sep 2020 17:52:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BC1C5207F7 for ; Tue, 29 Sep 2020 17:52:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="w1vrD/H1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727836AbgI2Rws (ORCPT ); Tue, 29 Sep 2020 13:52:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727886AbgI2Rws (ORCPT ); Tue, 29 Sep 2020 13:52:48 -0400 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90C30C0613D0 for ; Tue, 29 Sep 2020 10:52:47 -0700 (PDT) Received: by mail-pg1-x544.google.com with SMTP id e18so4477999pgd.4 for ; Tue, 29 Sep 2020 10:52:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=U2zjAyHMv+vNvI44PVm7WKt9xsmBm2Pl8T9zrZbzqsE=; b=w1vrD/H1wbpauynNoziIwFqp5GrIGE0eZK8nxqMdSlQAetxTouD4KLJKSF0s9C1Vpo C5SjVFmpfyrnj6fw/w0bXQBYN6oz5CAEP/8IZuNvOBv6up832IKo4VT55xhedd58BaWw JMVPQN4mLxaPxmgx1bMOpYRdyJymmy4E+i+De2oPinhVuvp3Cg+Wspjkaf89oHI4m7m/ XV0i+zSgyPGLwiE2Coz1vnHnPR/AHEMJFUsKd0wwTMdp4jYjk2ivqtNf8m7IKQapMBPC jH0moGrh9gabCEfRaxhts2NDmdoaCb8Xy96O9wx1jQlFzuZiF9fDBgPncv/BgcYfxnYm y5yA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=U2zjAyHMv+vNvI44PVm7WKt9xsmBm2Pl8T9zrZbzqsE=; b=X8mssvMP3xlaMxdbyiJA2+kXxxGipQ35+j1BQ6psnB1jYKATGZCYI0V0ObxRKqHEIe VXrqRKAzxpSjjU0n4VQtDFRqDd0sacAUuqR+5rNxBUmQDUvbjSL3q9WSKulr/Ch98rXH FT7T+t4fQZ32AxGT5/zOUu5OE9gp9yLRcK5ZOL4rnp3m6SA6zfsRkZRMkg435/gCbAYR /K7Jfp63HkMWM9cs40J1SM/a2gMKp6RxeDsuyhQjVsZh1gPTWulovaueByDTYb/eEsav 0JH4USueGit5KU7Ytdmct+Vel3eHKun0k8pUDZ7GoCYHtVO48k+z9LWgDQEBNwNFZtyQ 4P2Q== X-Gm-Message-State: AOAM532IwDNpfZ+M67hW80JH2sdTwZ2IfcbCPTZoRAyb1DnH7iwy7FX1 oDlFXfbuImGlvPZIT8cins70 X-Google-Smtp-Source: ABdhPJze3VumCnlT6Qxf8nRHGmsp+oehb5IXiZt6+CM/Pj4KPXr8uWYDNfuG+4sFMQmB+9sw+ffoKA== X-Received: by 2002:a17:902:14f:b029:d2:562d:e84 with SMTP id 73-20020a170902014fb02900d2562d0e84mr5567378plb.64.1601401967041; Tue, 29 Sep 2020 10:52:47 -0700 (PDT) Received: from Mani-XPS-13-9360.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id r188sm6271046pfc.67.2020.09.29.10.52.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Sep 2020 10:52:46 -0700 (PDT) From: Manivannan Sadhasivam To: gregkh@linuxfoundation.org Cc: hemantk@codeaurora.org, bbhatt@codeaurora.org, linux-arm-msm@vger.kernel.org, jhugo@codeaurora.org, linux-kernel@vger.kernel.org, Manivannan Sadhasivam Subject: [PATCH v3 04/19] bus: mhi: core: Use helper API to trigger a non-blocking host resume Date: Tue, 29 Sep 2020 23:22:03 +0530 Message-Id: <20200929175218.8178-5-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200929175218.8178-1-manivannan.sadhasivam@linaro.org> References: <20200929175218.8178-1-manivannan.sadhasivam@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Bhaumik Bhatt Autonomous low power mode support requires the MHI host to resume from multiple places and post a wakeup source to exit system suspend. This needs to be done in a non-blocking manner. Introduce a helper API to trigger the host resume for data transfers and other non-blocking use cases while supporting implementation of autonomous low power modes. Signed-off-by: Bhaumik Bhatt Reviewed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/internal.h | 7 +++++++ drivers/bus/mhi/core/main.c | 21 +++++++-------------- drivers/bus/mhi/core/pm.c | 13 ++++--------- 3 files changed, 18 insertions(+), 23 deletions(-) diff --git a/drivers/bus/mhi/core/internal.h b/drivers/bus/mhi/core/internal.h index bcfa7b6558ef..1bbd6e99d38d 100644 --- a/drivers/bus/mhi/core/internal.h +++ b/drivers/bus/mhi/core/internal.h @@ -599,6 +599,13 @@ int __mhi_device_get_sync(struct mhi_controller *mhi_cntrl); int mhi_send_cmd(struct mhi_controller *mhi_cntrl, struct mhi_chan *mhi_chan, enum mhi_cmd_type cmd); +static inline void mhi_trigger_resume(struct mhi_controller *mhi_cntrl) +{ + pm_wakeup_event(&mhi_cntrl->mhi_dev->dev, 0); + mhi_cntrl->runtime_get(mhi_cntrl); + mhi_cntrl->runtime_put(mhi_cntrl); +} + /* Register access methods */ void mhi_db_brstmode(struct mhi_controller *mhi_cntrl, struct db_cfg *db_cfg, void __iomem *db_addr, dma_addr_t db_val); diff --git a/drivers/bus/mhi/core/main.c b/drivers/bus/mhi/core/main.c index 1f622ce6be8b..79be18ec2ebf 100644 --- a/drivers/bus/mhi/core/main.c +++ b/drivers/bus/mhi/core/main.c @@ -909,8 +909,7 @@ void mhi_ctrl_ev_task(unsigned long data) * process it since we are probably in a suspended state, * so trigger a resume. */ - mhi_cntrl->runtime_get(mhi_cntrl); - mhi_cntrl->runtime_put(mhi_cntrl); + mhi_trigger_resume(mhi_cntrl); return; } @@ -971,10 +970,8 @@ int mhi_queue_skb(struct mhi_device *mhi_dev, enum dma_data_direction dir, } /* we're in M3 or transitioning to M3 */ - if (MHI_PM_IN_SUSPEND_STATE(mhi_cntrl->pm_state)) { - mhi_cntrl->runtime_get(mhi_cntrl); - mhi_cntrl->runtime_put(mhi_cntrl); - } + if (MHI_PM_IN_SUSPEND_STATE(mhi_cntrl->pm_state)) + mhi_trigger_resume(mhi_cntrl); /* Toggle wake to exit out of M2 */ mhi_cntrl->wake_toggle(mhi_cntrl); @@ -1032,10 +1029,8 @@ int mhi_queue_dma(struct mhi_device *mhi_dev, enum dma_data_direction dir, } /* we're in M3 or transitioning to M3 */ - if (MHI_PM_IN_SUSPEND_STATE(mhi_cntrl->pm_state)) { - mhi_cntrl->runtime_get(mhi_cntrl); - mhi_cntrl->runtime_put(mhi_cntrl); - } + if (MHI_PM_IN_SUSPEND_STATE(mhi_cntrl->pm_state)) + mhi_trigger_resume(mhi_cntrl); /* Toggle wake to exit out of M2 */ mhi_cntrl->wake_toggle(mhi_cntrl); @@ -1147,10 +1142,8 @@ int mhi_queue_buf(struct mhi_device *mhi_dev, enum dma_data_direction dir, read_lock_irqsave(&mhi_cntrl->pm_lock, flags); /* we're in M3 or transitioning to M3 */ - if (MHI_PM_IN_SUSPEND_STATE(mhi_cntrl->pm_state)) { - mhi_cntrl->runtime_get(mhi_cntrl); - mhi_cntrl->runtime_put(mhi_cntrl); - } + if (MHI_PM_IN_SUSPEND_STATE(mhi_cntrl->pm_state)) + mhi_trigger_resume(mhi_cntrl); /* Toggle wake to exit out of M2 */ mhi_cntrl->wake_toggle(mhi_cntrl); diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c index 661d704c8093..b227d415e937 100644 --- a/drivers/bus/mhi/core/pm.c +++ b/drivers/bus/mhi/core/pm.c @@ -824,11 +824,8 @@ int __mhi_device_get_sync(struct mhi_controller *mhi_cntrl) /* Wake up the device */ read_lock_bh(&mhi_cntrl->pm_lock); mhi_cntrl->wake_get(mhi_cntrl, true); - if (MHI_PM_IN_SUSPEND_STATE(mhi_cntrl->pm_state)) { - pm_wakeup_event(&mhi_cntrl->mhi_dev->dev, 0); - mhi_cntrl->runtime_get(mhi_cntrl); - mhi_cntrl->runtime_put(mhi_cntrl); - } + if (MHI_PM_IN_SUSPEND_STATE(mhi_cntrl->pm_state)) + mhi_trigger_resume(mhi_cntrl); read_unlock_bh(&mhi_cntrl->pm_lock); ret = wait_event_timeout(mhi_cntrl->state_event, @@ -1139,10 +1136,8 @@ void mhi_device_put(struct mhi_device *mhi_dev) mhi_dev->dev_wake--; read_lock_bh(&mhi_cntrl->pm_lock); - if (MHI_PM_IN_SUSPEND_STATE(mhi_cntrl->pm_state)) { - mhi_cntrl->runtime_get(mhi_cntrl); - mhi_cntrl->runtime_put(mhi_cntrl); - } + if (MHI_PM_IN_SUSPEND_STATE(mhi_cntrl->pm_state)) + mhi_trigger_resume(mhi_cntrl); mhi_cntrl->wake_put(mhi_cntrl, false); read_unlock_bh(&mhi_cntrl->pm_lock); From patchwork Tue Sep 29 17:52:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 11806459 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 71B696CB for ; Tue, 29 Sep 2020 17:52:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4EE97208B8 for ; Tue, 29 Sep 2020 17:52:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="qMR468WZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727936AbgI2Rwz (ORCPT ); Tue, 29 Sep 2020 13:52:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728020AbgI2Rwv (ORCPT ); Tue, 29 Sep 2020 13:52:51 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 975C2C061755 for ; Tue, 29 Sep 2020 10:52:51 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id d9so5328432pfd.3 for ; Tue, 29 Sep 2020 10:52:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=mLM1ooiBRvHKnVHboD9nW5AfyUuBhafQkkCUD3MREGQ=; b=qMR468WZbOAjo7zHG2aH9sUuHVlzp0rlzLxGllyORpGs5bHkWQreaKMAwYujLq3+mw fZCTBqaOPxVc7JNUjkq6874llC/dlFjQyiv+jg+VFknFOBzTb+I/Dkl3m3kpoaegDjrW 0H0dUAZXrY2yiI00td19qs2mAs4+zlqRLOFVJV6E7w9FMZb6aep8rYPSN7wdzrYmoqP8 8ByiNKL1hQbWpmdQyGfIwkpGCST2Y4CL73x3/9OVg1ZEiDqJbHhi62cppFhX8k4np8H0 WsDlMcDjPPIo7heKG29BQVeazNalbguR8GUZjbUZOrSUMUpdYdCPIPvp5o5BD2EJ8F5z Nvvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=mLM1ooiBRvHKnVHboD9nW5AfyUuBhafQkkCUD3MREGQ=; b=eM7q/9Lx4JEwUzIem/1gNyc0lvY1Z6VGDKuV3HHC6JwQK8KYtetOOWLKbwLBGdkIBb fo31Oag+52UfSHh6CPrUK25gLhpszGTuWg22BkdzTtqt7gRMR5pMQJfJ+zZEfDUmzTqh 5PQVqPnfYpl5dm5XrEfp2/wyIl0Z1NBRQlfsf+4pgCkFeqlnzgfciRLv8uZTYCkwI+nS WGtPPska/Z1ah8FKMjIIxT8J82m9qSY3tKVfOYGE8g7EnryXkG5daGC+xbZR0Lxbn6rl /1Xc70uhRjVWFbdt5RCQw8PsEm6qyqeb+dKtLmm2xu0HEEEmnFEMDTXjjR0O8eBu3R4s QUKA== X-Gm-Message-State: AOAM530JM2pl0kqKv6C1TWqC6I6CDBL2fR89n622hYlIBdF0Po/vdB8S +QusXHbVbKQNzU3EKhMag1my X-Google-Smtp-Source: ABdhPJxCqpIxlMVjTvyMq79uKt7Qm0iPci+xymbV4P64uZJnQN5NYNzfW4rnWAADl5m8YDK2I95SRw== X-Received: by 2002:a63:4c4e:: with SMTP id m14mr3876393pgl.199.1601401971037; Tue, 29 Sep 2020 10:52:51 -0700 (PDT) Received: from Mani-XPS-13-9360.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id r188sm6271046pfc.67.2020.09.29.10.52.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Sep 2020 10:52:50 -0700 (PDT) From: Manivannan Sadhasivam To: gregkh@linuxfoundation.org Cc: hemantk@codeaurora.org, bbhatt@codeaurora.org, linux-arm-msm@vger.kernel.org, jhugo@codeaurora.org, linux-kernel@vger.kernel.org, Manivannan Sadhasivam Subject: [PATCH v3 05/19] bus: mhi: core: Trigger host resume if suspended during mhi_device_get() Date: Tue, 29 Sep 2020 23:22:04 +0530 Message-Id: <20200929175218.8178-6-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200929175218.8178-1-manivannan.sadhasivam@linaro.org> References: <20200929175218.8178-1-manivannan.sadhasivam@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Bhaumik Bhatt It is possible that the host may be suspending or suspended and may not allow an outgoing device wake assert immediately if a client has requested for it. Ensure that the host wakes up and allows for it so the client does not have to wait for an external trigger or an outgoing packet to be queued for the host resume to occur. Signed-off-by: Bhaumik Bhatt Reviewed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/pm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c index b227d415e937..27bb471c8f4e 100644 --- a/drivers/bus/mhi/core/pm.c +++ b/drivers/bus/mhi/core/pm.c @@ -1112,6 +1112,9 @@ void mhi_device_get(struct mhi_device *mhi_dev) mhi_dev->dev_wake++; read_lock_bh(&mhi_cntrl->pm_lock); + if (MHI_PM_IN_SUSPEND_STATE(mhi_cntrl->pm_state)) + mhi_trigger_resume(mhi_cntrl); + mhi_cntrl->wake_get(mhi_cntrl, true); read_unlock_bh(&mhi_cntrl->pm_lock); } From patchwork Tue Sep 29 17:52:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 11806465 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 90CCE6CB for ; Tue, 29 Sep 2020 17:53:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6926720936 for ; Tue, 29 Sep 2020 17:53:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="FRnczYI+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728180AbgI2RxH (ORCPT ); Tue, 29 Sep 2020 13:53:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728056AbgI2Rwz (ORCPT ); Tue, 29 Sep 2020 13:52:55 -0400 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2E41C061755 for ; Tue, 29 Sep 2020 10:52:55 -0700 (PDT) Received: by mail-pg1-x544.google.com with SMTP id t14so4448332pgl.10 for ; Tue, 29 Sep 2020 10:52:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Sxs+p0qJGwlXlYqr5DnhuqsFJ9uI4G3h2LLCfE221Y0=; b=FRnczYI+v1u4dF861GnaIOp7rwgHlWVR54rKOOmduQRHcCn3R9o1CGzz6CzA7vTVAx +n0kG7P2oIRLzc7CveQVunt6YFEXfvggLu99xyxEPv0TVORLTjGm7TC2stGi4DWp5HPK PlEurju2WE5NhammvldF/Lf4DgPtxVXomb1i1W6tXyStIXSCGEnBb0Bf/8F7/ebdFPpH 0qFcSlWnP5XPpLzYycAIwDsCFycikhr0xerBMxjs1FzYC3mJqCf2fOe0paDndJFRu0EC 9e924nDYpiBYwgaD8c7Hz+jCLgBBodCtfWvHUBBaboMiV8z29WRrWA2hA7k1QhBVcg34 DwWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Sxs+p0qJGwlXlYqr5DnhuqsFJ9uI4G3h2LLCfE221Y0=; b=fgFADGF86yhP8kOjtEjhCUUkBTAOmKOCqloB+auNy9GBu6dlIwLlZbnzmSnGFmpCB9 c+9+BLSRFle3e/4vMKTS35uZOdLgu4ZLKZITUbpSYNxeS3VD3tQMjS2htjq6OEqBm/LQ lK7Ygta21i6sPWxbljP51sL1MfF7+58CghqOTxvYbiDv4eb5Eq6vHvUHkWBJzJPL8KaC msui37Hddu5OJFyuhs6F4RU9BR+dF/kCqtjS07r2/e2nNiWQcDqMADXgsKOPNFfT5P7+ EveC+fh2Kg5fxfP87vzJpohII9LW9CR3dMiy2FeEj/0PY+6Gxi+7G9W1IYkuJ9YR3uAH KdgQ== X-Gm-Message-State: AOAM531wARROQx3fZX1ztR7Fu0s4ytcTVVmhwKsmOliv98T3imNKoU8z PXQpPXZuAhd0jd9m1aZVImCC X-Google-Smtp-Source: ABdhPJz7HbkWz/+MiuN5TUw2klFfMVw6d+fVFvpDeQy34/on+mPPovOK6c7kBXNRCy+BhyVVNhD+WA== X-Received: by 2002:a63:5821:: with SMTP id m33mr4064260pgb.16.1601401975150; Tue, 29 Sep 2020 10:52:55 -0700 (PDT) Received: from Mani-XPS-13-9360.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id r188sm6271046pfc.67.2020.09.29.10.52.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Sep 2020 10:52:54 -0700 (PDT) From: Manivannan Sadhasivam To: gregkh@linuxfoundation.org Cc: hemantk@codeaurora.org, bbhatt@codeaurora.org, linux-arm-msm@vger.kernel.org, jhugo@codeaurora.org, linux-kernel@vger.kernel.org, Manivannan Sadhasivam Subject: [PATCH v3 06/19] bus: mhi: core: Use generic name field for an MHI device Date: Tue, 29 Sep 2020 23:22:05 +0530 Message-Id: <20200929175218.8178-7-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200929175218.8178-1-manivannan.sadhasivam@linaro.org> References: <20200929175218.8178-1-manivannan.sadhasivam@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Bhaumik Bhatt An MHI device is not necessarily associated with only channels as we can have one associated with the controller itself. Hence, the chan_name field within the mhi_device structure should instead be replaced with a generic name to accurately reflect any type of MHI device. Signed-off-by: Bhaumik Bhatt Reviewed-by: Jeffrey Hugo Reviewed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/init.c | 5 +++-- drivers/bus/mhi/core/main.c | 6 +++--- include/linux/mhi.h | 8 ++++---- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c index e43a190a7a36..e2011ec46b92 100644 --- a/drivers/bus/mhi/core/init.c +++ b/drivers/bus/mhi/core/init.c @@ -904,6 +904,7 @@ int mhi_register_controller(struct mhi_controller *mhi_cntrl, mhi_dev->dev_type = MHI_DEVICE_CONTROLLER; mhi_dev->mhi_cntrl = mhi_cntrl; dev_set_name(&mhi_dev->dev, "%s", dev_name(mhi_cntrl->cntrl_dev)); + mhi_dev->name = dev_name(mhi_cntrl->cntrl_dev); /* Init wakeup source */ device_init_wakeup(&mhi_dev->dev, true); @@ -1249,7 +1250,7 @@ static int mhi_uevent(struct device *dev, struct kobj_uevent_env *env) struct mhi_device *mhi_dev = to_mhi_device(dev); return add_uevent_var(env, "MODALIAS=" MHI_DEVICE_MODALIAS_FMT, - mhi_dev->chan_name); + mhi_dev->name); } static int mhi_match(struct device *dev, struct device_driver *drv) @@ -1266,7 +1267,7 @@ static int mhi_match(struct device *dev, struct device_driver *drv) return 0; for (id = mhi_drv->id_table; id->chan[0]; id++) - if (!strcmp(mhi_dev->chan_name, id->chan)) { + if (!strcmp(mhi_dev->name, id->chan)) { mhi_dev->id = id; return 1; } diff --git a/drivers/bus/mhi/core/main.c b/drivers/bus/mhi/core/main.c index 79be18ec2ebf..2cff5ddff225 100644 --- a/drivers/bus/mhi/core/main.c +++ b/drivers/bus/mhi/core/main.c @@ -249,7 +249,7 @@ int mhi_destroy_device(struct device *dev, void *data) put_device(&mhi_dev->dl_chan->mhi_dev->dev); dev_dbg(&mhi_cntrl->mhi_dev->dev, "destroy device for chan:%s\n", - mhi_dev->chan_name); + mhi_dev->name); /* Notify the client and remove the device from MHI bus */ device_del(dev); @@ -327,10 +327,10 @@ void mhi_create_devices(struct mhi_controller *mhi_cntrl) } /* Channel name is same for both UL and DL */ - mhi_dev->chan_name = mhi_chan->name; + mhi_dev->name = mhi_chan->name; dev_set_name(&mhi_dev->dev, "%s_%s", dev_name(mhi_cntrl->cntrl_dev), - mhi_dev->chan_name); + mhi_dev->name); /* Init wakeup source if available */ if (mhi_dev->dl_chan && mhi_dev->dl_chan->wake_capable) diff --git a/include/linux/mhi.h b/include/linux/mhi.h index 0779bc689b3e..bb337d163dda 100644 --- a/include/linux/mhi.h +++ b/include/linux/mhi.h @@ -438,10 +438,10 @@ struct mhi_controller { }; /** - * struct mhi_device - Structure representing a MHI device which binds - * to channels + * struct mhi_device - Structure representing an MHI device which binds + * to channels or is associated with controllers * @id: Pointer to MHI device ID struct - * @chan_name: Name of the channel to which the device binds + * @name: Name of the associated MHI device * @mhi_cntrl: Controller the device belongs to * @ul_chan: UL channel for the device * @dl_chan: DL channel for the device @@ -453,7 +453,7 @@ struct mhi_controller { */ struct mhi_device { const struct mhi_device_id *id; - const char *chan_name; + const char *name; struct mhi_controller *mhi_cntrl; struct mhi_chan *ul_chan; struct mhi_chan *dl_chan; From patchwork Tue Sep 29 17:52:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 11806461 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CFCEC6CA for ; Tue, 29 Sep 2020 17:53:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AD2B6207F7 for ; Tue, 29 Sep 2020 17:53:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Caelkjsy" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727861AbgI2RxA (ORCPT ); Tue, 29 Sep 2020 13:53:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728061AbgI2Rw7 (ORCPT ); Tue, 29 Sep 2020 13:52:59 -0400 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2ECEC0613D0 for ; Tue, 29 Sep 2020 10:52:59 -0700 (PDT) Received: by mail-pf1-x442.google.com with SMTP id k13so5334140pfg.1 for ; Tue, 29 Sep 2020 10:52:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=SCbfk5KhIaeQlvR4Cwr7GsH4vv2lp3s8XkSFmUeV6ps=; b=CaelkjsyVnDqqLeG6nKa/oRVZl1X7PiGHuL9W0916QfNpvOs9PX+lbaoySwpk2SF/q Kkn6ok1NHNu7HryrR8N8CViiIjsYMCerfQwwV2uMXvJquYX0zQQ1sBJBoGlAeyS8h0vL qeROnRLFxVUhpQIowZmlrY8VpGA/Kvl97IHJ6TypHW7ssolgVeZoIJjI16Ty5GcZIl61 LqbhpyvAZ6hcPYg1bDWflAJXdfoXp78ndiwNCVOocUmLtR7z/O0+yXUTeHOOnGfKIZdN 3dnD5Nsc2f6t/BGOwZUVdy99YTxapLB23sy9ReHfBMRFDXqsJ3RDP9q65A12uh1oNRCe Xu4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=SCbfk5KhIaeQlvR4Cwr7GsH4vv2lp3s8XkSFmUeV6ps=; b=JiXDAfYp8UGzcA3b1/VVvQvogy+fGpgHPFYpE66IRjyrV7yhGyjzbIIEiT1mdq5G1Q oveiqE5ilJhQms0tyL2s6Vfya+du4OD5ZQAn0zUvKWWsveABskvX3tUTs529a4S8vhN2 Y4Gfz1tkGALkTbwroxMbAk0QyFMg9iqchDURhtB0C95bv7CXl/b8TJ5HM3VhvQqAzAwV K23hgCx16penSZ/f1oLMJUk4hVNap2Z+2VyxtBT2zJb80R2TkUvwOTto4G8pldPAXPYK Ll54+yftO3YRpVTkuXxGxCvTREL6WtnVt1FsQFenIIYs8shojAmX0yAhbM1SVoGY663E jg5w== X-Gm-Message-State: AOAM532idElp9LDru4HDyX8jwUXC4rbH8wwzv0ZVo7PvmtN5JH2TrYgu 5Bnt9JvH6A4zDPWDar6Zf24Y X-Google-Smtp-Source: ABdhPJxOE2mlXSIh8bsmRUfCw/62BNg7cTPqhUCKLO7Sx7sTNRLHC3jBIFtywrf7iWYIhuxjaDlckQ== X-Received: by 2002:aa7:8dc9:0:b029:150:e9ad:952 with SMTP id j9-20020aa78dc90000b0290150e9ad0952mr4943478pfr.61.1601401979194; Tue, 29 Sep 2020 10:52:59 -0700 (PDT) Received: from Mani-XPS-13-9360.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id r188sm6271046pfc.67.2020.09.29.10.52.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Sep 2020 10:52:58 -0700 (PDT) From: Manivannan Sadhasivam To: gregkh@linuxfoundation.org Cc: hemantk@codeaurora.org, bbhatt@codeaurora.org, linux-arm-msm@vger.kernel.org, jhugo@codeaurora.org, linux-kernel@vger.kernel.org, Manivannan Sadhasivam Subject: [PATCH v3 07/19] bus: mhi: core: Introduce helper function to check device state Date: Tue, 29 Sep 2020 23:22:06 +0530 Message-Id: <20200929175218.8178-8-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200929175218.8178-1-manivannan.sadhasivam@linaro.org> References: <20200929175218.8178-1-manivannan.sadhasivam@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Bhaumik Bhatt Introduce a helper function to determine whether the device is in a powered ON state and resides in one of the active MHI states. This will allow for some use cases where access can be pre-determined. Signed-off-by: Bhaumik Bhatt Reviewed-by: Jeffrey Hugo Reviewed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/internal.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/bus/mhi/core/internal.h b/drivers/bus/mhi/core/internal.h index 1bbd6e99d38d..5a81a428c4aa 100644 --- a/drivers/bus/mhi/core/internal.h +++ b/drivers/bus/mhi/core/internal.h @@ -598,6 +598,11 @@ int mhi_pm_m3_transition(struct mhi_controller *mhi_cntrl); int __mhi_device_get_sync(struct mhi_controller *mhi_cntrl); int mhi_send_cmd(struct mhi_controller *mhi_cntrl, struct mhi_chan *mhi_chan, enum mhi_cmd_type cmd); +static inline bool mhi_is_active(struct mhi_controller *mhi_cntrl) +{ + return (mhi_cntrl->dev_state >= MHI_STATE_M0 && + mhi_cntrl->dev_state <= MHI_STATE_M3_FAST); +} static inline void mhi_trigger_resume(struct mhi_controller *mhi_cntrl) { From patchwork Tue Sep 29 17:52:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 11806467 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ED1226CA for ; Tue, 29 Sep 2020 17:53:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CB14C208B8 for ; Tue, 29 Sep 2020 17:53:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="kb8Dglyz" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728058AbgI2RxH (ORCPT ); Tue, 29 Sep 2020 13:53:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728166AbgI2RxD (ORCPT ); Tue, 29 Sep 2020 13:53:03 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8981C061755 for ; Tue, 29 Sep 2020 10:53:03 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id 7so4449448pgm.11 for ; Tue, 29 Sep 2020 10:53:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=JMSzjnZoFPF6UWbIK88WIGtNwMDAVVwPEVBN0nLk6ZA=; b=kb8Dglyz0c90un0H+tM53KPlqGyODKsr85qGzPy0tOBCsO8WT/URuluK/40CNWMQ8z M811HQjc0VhEjs2RedC6CJPBEBKvIdFUAA3lPj8j/W6+rMsrmMBbh9lzYNVsVF82nMu3 VgUnzeXbCUq00P3ko3E1mqK+4NK48woHMC50q6gilbQNTTo+RgjABOiNRy1jRbgFiOsr 04BrIJSBEeGpt5P2/VdrIBDhAUzJ2ghgbnLiHJ2SIWm2uD8WSD/rsSb0FibnCOCCtnhF QoHFsQFIuibBiujGR904OjIjwQAn7ZPh4RcHy1vFI0BowOlGpsT/xrKwopLTFvJNNqIG CV7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=JMSzjnZoFPF6UWbIK88WIGtNwMDAVVwPEVBN0nLk6ZA=; b=NEykJ+lfd4+n+bG5TViNlJJw++GnQNc8r0EDvpjIgkA74q/vUIkGrf+/fGy4SWsotf qHrdWLR+WGN9+YKuAuleiw/7lEeparRndzj5vjnYEfMW7kT9p4MsSSJWjd8gT84HkkQ/ RFJrKQC/oepJRt5t6+3YCBif15Yy/6MjghO5Nx735tBqMt9tsYAHy06LTG1YaFI1zeCz 7rpWbKGZjWV43Gz4A4y9nhWYu/1Q4RRS1tn6+8ZCaUyWTDjYku80d7WMOP7k8ZB9Qs9W Dcnopn6Abv1qvvlB97Rxf6OhG1NRHYKi6KEqubsAbe+LJP0TSaIOXRAb2LIC0bZUz7gk PrCA== X-Gm-Message-State: AOAM533C7k82rJUneObNkbjWXyFdoQcp8DeoO0beRt0YeYojfH3yUqN3 HcI3yMde5XCy/ilw5lKs93fC X-Google-Smtp-Source: ABdhPJxSRajMbPNGYzU/2wn1LjkBbTcz4igHUir2ZhrlxBVIAv/5MHMFg84W1Mafwmg+XacUnt9XyA== X-Received: by 2002:a17:902:b587:b029:d2:80bd:2f0c with SMTP id a7-20020a170902b587b02900d280bd2f0cmr5763232pls.60.1601401983175; Tue, 29 Sep 2020 10:53:03 -0700 (PDT) Received: from Mani-XPS-13-9360.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id r188sm6271046pfc.67.2020.09.29.10.52.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Sep 2020 10:53:02 -0700 (PDT) From: Manivannan Sadhasivam To: gregkh@linuxfoundation.org Cc: hemantk@codeaurora.org, bbhatt@codeaurora.org, linux-arm-msm@vger.kernel.org, jhugo@codeaurora.org, linux-kernel@vger.kernel.org, Manivannan Sadhasivam Subject: [PATCH v3 08/19] bus: mhi: core: Introduce counters to track MHI device state transitions Date: Tue, 29 Sep 2020 23:22:07 +0530 Message-Id: <20200929175218.8178-9-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200929175218.8178-1-manivannan.sadhasivam@linaro.org> References: <20200929175218.8178-1-manivannan.sadhasivam@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Bhaumik Bhatt Use counters to track MHI device state transitions such as those to M0, M2, or M3 states. This can help in better debug, allowing the user to see the number of transitions to a certain MHI state when queried using debugfs entries or via other mechanisms. Signed-off-by: Bhaumik Bhatt Reviewed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/pm.c | 4 ++++ include/linux/mhi.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c index 27bb471c8f4e..ce4d969818b4 100644 --- a/drivers/bus/mhi/core/pm.c +++ b/drivers/bus/mhi/core/pm.c @@ -256,6 +256,7 @@ int mhi_pm_m0_transition(struct mhi_controller *mhi_cntrl) dev_err(dev, "Unable to transition to M0 state\n"); return -EIO; } + mhi_cntrl->M0++; /* Wake up the device */ read_lock_bh(&mhi_cntrl->pm_lock); @@ -326,6 +327,8 @@ void mhi_pm_m1_transition(struct mhi_controller *mhi_cntrl) mhi_cntrl->dev_state = MHI_STATE_M2; write_unlock_irq(&mhi_cntrl->pm_lock); + + mhi_cntrl->M2++; wake_up_all(&mhi_cntrl->state_event); /* If there are any pending resources, exit M2 immediately */ @@ -362,6 +365,7 @@ int mhi_pm_m3_transition(struct mhi_controller *mhi_cntrl) return -EIO; } + mhi_cntrl->M3++; wake_up_all(&mhi_cntrl->state_event); return 0; diff --git a/include/linux/mhi.h b/include/linux/mhi.h index bb337d163dda..c56b4447a4e9 100644 --- a/include/linux/mhi.h +++ b/include/linux/mhi.h @@ -328,6 +328,7 @@ struct mhi_controller_config { * @dev_state: MHI device state * @dev_wake: Device wakeup count * @pending_pkts: Pending packets for the controller + * @M0, M2, M3: Counters to track number of device MHI state changes * @transition_list: List of MHI state transitions * @transition_lock: Lock for protecting MHI state transition list * @wlock: Lock for protecting device wakeup @@ -407,6 +408,7 @@ struct mhi_controller { enum mhi_state dev_state; atomic_t dev_wake; atomic_t pending_pkts; + u32 M0, M2, M3; struct list_head transition_list; spinlock_t transition_lock; spinlock_t wlock; From patchwork Tue Sep 29 17:52:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 11806463 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DE1736CB for ; Tue, 29 Sep 2020 17:53:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B91C22145D for ; Tue, 29 Sep 2020 17:53:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="VuuIe3Wt" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728206AbgI2RxI (ORCPT ); Tue, 29 Sep 2020 13:53:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728172AbgI2RxH (ORCPT ); Tue, 29 Sep 2020 13:53:07 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FA53C0613D0 for ; Tue, 29 Sep 2020 10:53:07 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id k8so5330252pfk.2 for ; Tue, 29 Sep 2020 10:53:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Y1HDeSf7eMJfSl6ZK/D9lqct6zJN8sO0bd/DmJuThzk=; b=VuuIe3Wtfr2EIlZlKLTeY2sJ2IfdF+t63kwOnjXC3MIwLv7u0IoUgfhPVIcolwW7mF HnonW/0dVJGEOIl9dPosA7jLQu2VwzJIQZsE7NFdZzEieSnIWzKzwjFTzKxNG034sxhm jaJRNnTpdeS225Bw0ef+EEEnayuYX0gsYS1F/ytIQexYk5GRDiWkXHh9JVTKfHYzoZe4 GwHjPX5JO2SbyFJoRZ4ekOCoAYw+/C9g8PdmprqeNnxFlXO9mSRUH9yd9ayL8CDzUpDB NEFpG3vqWD5ItmmHTxRi+WbjEOfuFp/2rVEIWo5+MGk+hMqfQJSIHAuH9Aux4eVG5/WN NAqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Y1HDeSf7eMJfSl6ZK/D9lqct6zJN8sO0bd/DmJuThzk=; b=k701FviHla8ZMA9cPdVeHF1fRw5w3qWz5EWDYJTm8gzcLGk47TD+T04vRxuY0QOJt/ nsh3+v/6PH4yry4KvhV+uCcab3mfytmUDX3u/IXd0V4XceXGjpnkMcpWbdwKx0+m6GQn fzEPrkHA58/jvc1O1yUhKihI5Vz7I4puc0Ki7rBr4c4cTGjLDsr1QFO5hUYR9EtGy+EA HBP3MLDNS/trYGxJTE2WKtyH93xeigifYeo7IAV8k2vEcATv+q46ZGGl2jm0RU01ujaA 05zy+Ni0SnKfjozk0ewH5WY1Q2n03/VHu4GN0RTiNlUq0LDCpkLDx2YZEY2I6xk4FIDe jFuQ== X-Gm-Message-State: AOAM532Vosq1uhJuWoG5cZfQotb3KeTnXpA7JLrInYOif+ODxiPNF51+ qL8fJRWF4sE9EyLbzX3yexcx X-Google-Smtp-Source: ABdhPJyxZwS4UjRxdX7l1ElQMUC769Y1++Fz7aDKgJTkBJJ+52cCdZDDUfF4B4/3/EZZBbgEmNtKbg== X-Received: by 2002:a17:902:be0c:b029:d2:8ceb:f39c with SMTP id r12-20020a170902be0cb02900d28cebf39cmr5645119pls.71.1601401986990; Tue, 29 Sep 2020 10:53:06 -0700 (PDT) Received: from Mani-XPS-13-9360.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id r188sm6271046pfc.67.2020.09.29.10.53.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Sep 2020 10:53:06 -0700 (PDT) From: Manivannan Sadhasivam To: gregkh@linuxfoundation.org Cc: hemantk@codeaurora.org, bbhatt@codeaurora.org, linux-arm-msm@vger.kernel.org, jhugo@codeaurora.org, linux-kernel@vger.kernel.org, Manivannan Sadhasivam Subject: [PATCH v3 09/19] bus: mhi: core: Read and save device hardware information from BHI Date: Tue, 29 Sep 2020 23:22:08 +0530 Message-Id: <20200929175218.8178-10-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200929175218.8178-1-manivannan.sadhasivam@linaro.org> References: <20200929175218.8178-1-manivannan.sadhasivam@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Bhaumik Bhatt Device hardware specific information such as serial number and the OEM PK hash can be read using BHI and saved on host to identify the endpoint. Signed-off-by: Bhaumik Bhatt Reviewed-by: Jeffrey Hugo Reviewed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/boot.c | 17 ++++++++++++++++- include/linux/mhi.h | 6 ++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/bus/mhi/core/boot.c b/drivers/bus/mhi/core/boot.c index 0b38014d040e..24422f5c3d80 100644 --- a/drivers/bus/mhi/core/boot.c +++ b/drivers/bus/mhi/core/boot.c @@ -392,13 +392,28 @@ void mhi_fw_load_handler(struct mhi_controller *mhi_cntrl) void *buf; dma_addr_t dma_addr; size_t size; - int ret; + int i, ret; if (MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state)) { dev_err(dev, "Device MHI is not in valid state\n"); return; } + /* save hardware info from BHI */ + ret = mhi_read_reg(mhi_cntrl, mhi_cntrl->bhi, BHI_SERIALNU, + &mhi_cntrl->serial_number); + if (ret) + dev_err(dev, "Could not capture serial number via BHI\n"); + + for (i = 0; i < ARRAY_SIZE(mhi_cntrl->oem_pk_hash); i++) { + ret = mhi_read_reg(mhi_cntrl, mhi_cntrl->bhi, BHI_OEMPKHASH(i), + &mhi_cntrl->oem_pk_hash[i]); + if (ret) { + dev_err(dev, "Could not capture OEM PK HASH via BHI\n"); + break; + } + } + /* If device is in pass through, do reset to ready state transition */ if (mhi_cntrl->ee == MHI_EE_PTHRU) goto fw_load_ee_pthru; diff --git a/include/linux/mhi.h b/include/linux/mhi.h index c56b4447a4e9..0c97f4bc5fae 100644 --- a/include/linux/mhi.h +++ b/include/linux/mhi.h @@ -16,6 +16,8 @@ #include #include +#define MHI_MAX_OEM_PK_HASH_SEGMENTS 16 + struct mhi_chan; struct mhi_event; struct mhi_ctxt; @@ -316,6 +318,8 @@ struct mhi_controller_config { * @device_number: MHI controller device number * @major_version: MHI controller major revision number * @minor_version: MHI controller minor revision number + * @serial_number: MHI controller serial number obtained from BHI + * @oem_pk_hash: MHI controller OEM PK Hash obtained from BHI * @mhi_event: MHI event ring configurations table * @mhi_cmd: MHI command ring configurations table * @mhi_ctxt: MHI device context, shared memory between host and device @@ -394,6 +398,8 @@ struct mhi_controller { u32 device_number; u32 major_version; u32 minor_version; + u32 serial_number; + u32 oem_pk_hash[MHI_MAX_OEM_PK_HASH_SEGMENTS]; struct mhi_event *mhi_event; struct mhi_cmd *mhi_cmd; From patchwork Tue Sep 29 17:52:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 11806471 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 616386CA for ; Tue, 29 Sep 2020 17:53:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3751220936 for ; Tue, 29 Sep 2020 17:53:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="w+L+sbwy" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728157AbgI2RxP (ORCPT ); Tue, 29 Sep 2020 13:53:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727740AbgI2RxM (ORCPT ); Tue, 29 Sep 2020 13:53:12 -0400 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01692C0613D1 for ; Tue, 29 Sep 2020 10:53:12 -0700 (PDT) Received: by mail-pg1-x544.google.com with SMTP id s31so4459604pga.7 for ; Tue, 29 Sep 2020 10:53:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=s8QQquLL4oGKh6uhiaB6MoxZtKFnQbbrDA+3b3PoVuU=; b=w+L+sbwyRqd/kUR4yOGRGKdcsW/vsqagEE4b5dBd+YZKGnvdQsXZIBd9wcC/ybuR9j T7xFQt1xsUbYCz6dxITSbJakrbbfwg2yt9unakKKSuoKQMy1GZVgxjwaBMavfEw3i4Tr NAVXHpX/AC9aIGapsZW9STs+y+0B+nydyTceAKIzdjNjN7rbitqaaa39jv/LriDADxOV B6aytMZypc8wlDkBQNAk6DFmC8bh/tqG9Cbtmz7IwF6+7wR5dM0hkUuSIhqCM/f84Mle nvTVPOwkFfK6KEEGSt5gWB25g3UPqYFyYV7Z6pNumelyFgweCgn5uFCVthcy5Jom+UIG eESg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=s8QQquLL4oGKh6uhiaB6MoxZtKFnQbbrDA+3b3PoVuU=; b=YeNwyRDYgEnUNwISducyzoIuwTod+2gHc4353yk+7YT/KtaT3Ct2NOr9sAOvHMQiX5 oplJQ14GBV+8SMMrRhGY5CHaiQqQq2UcT+9v6xP83elSzXH60IHz7XBV8vh+QK1S/++H 8SQfyXnFMRuKUFOfWN6S+2ll6uywDIeEbizf32hgDGM04ngDOduMopgkVFC6hBT5dGZD Obw7K2ftkr1Dt0flHWESdeUsc+CwJMQlea/xVCIsBH5H+I479mHwF2r1xovJL7e93qqi 2Wq98AzBL9NMyXu90WSlUXjnxBvJejhvZXHCkreJ+SlydLPr9TR1EIjawUv5uuT6B56z pA1g== X-Gm-Message-State: AOAM530D4JTThlDk1LUp/nr/puFCkFfZczZKC86R4L/WlMuB7PCVkiHp pw4varxzyJXlE+42fl1f6ezy X-Google-Smtp-Source: ABdhPJzXApVxJD/OdfawaQJ6lvpnhJEEL/Vu27J/Mxk/eyfZZxlBsNg5eOebe+WoBS9z3WuVZsiAUA== X-Received: by 2002:a65:4642:: with SMTP id k2mr3992637pgr.41.1601401991461; Tue, 29 Sep 2020 10:53:11 -0700 (PDT) Received: from Mani-XPS-13-9360.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id r188sm6271046pfc.67.2020.09.29.10.53.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Sep 2020 10:53:10 -0700 (PDT) From: Manivannan Sadhasivam To: gregkh@linuxfoundation.org Cc: hemantk@codeaurora.org, bbhatt@codeaurora.org, linux-arm-msm@vger.kernel.org, jhugo@codeaurora.org, linux-kernel@vger.kernel.org, Manivannan Sadhasivam Subject: [PATCH v3 10/19] bus: mhi: core: Introduce APIs to allocate and free the MHI controller Date: Tue, 29 Sep 2020 23:22:09 +0530 Message-Id: <20200929175218.8178-11-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200929175218.8178-1-manivannan.sadhasivam@linaro.org> References: <20200929175218.8178-1-manivannan.sadhasivam@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Bhaumik Bhatt Client devices should use the APIs provided to allocate and free the MHI controller structure. This will help ensure that the structure is zero-initialized and there are no false positives with respect to reading any values such as the serial number or the OEM PK hash. Suggested-by: Manivannan Sadhasivam Signed-off-by: Bhaumik Bhatt Reviewed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/init.c | 16 ++++++++++++++++ include/linux/mhi.h | 12 ++++++++++++ 2 files changed, 28 insertions(+) diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c index e2011ec46b92..f69a2f3d039d 100644 --- a/drivers/bus/mhi/core/init.c +++ b/drivers/bus/mhi/core/init.c @@ -954,6 +954,22 @@ void mhi_unregister_controller(struct mhi_controller *mhi_cntrl) } EXPORT_SYMBOL_GPL(mhi_unregister_controller); +struct mhi_controller *mhi_alloc_controller(void) +{ + struct mhi_controller *mhi_cntrl; + + mhi_cntrl = kzalloc(sizeof(*mhi_cntrl), GFP_KERNEL); + + return mhi_cntrl; +} +EXPORT_SYMBOL_GPL(mhi_alloc_controller); + +void mhi_free_controller(struct mhi_controller *mhi_cntrl) +{ + kfree(mhi_cntrl); +} +EXPORT_SYMBOL_GPL(mhi_free_controller); + int mhi_prepare_for_power_up(struct mhi_controller *mhi_cntrl) { struct device *dev = &mhi_cntrl->mhi_dev->dev; diff --git a/include/linux/mhi.h b/include/linux/mhi.h index 0c97f4bc5fae..6b987e8cc438 100644 --- a/include/linux/mhi.h +++ b/include/linux/mhi.h @@ -527,6 +527,18 @@ struct mhi_driver { #define to_mhi_driver(drv) container_of(drv, struct mhi_driver, driver) #define to_mhi_device(dev) container_of(dev, struct mhi_device, dev) +/** + * mhi_alloc_controller - Allocate the MHI Controller structure + * Allocate the mhi_controller structure using zero initialized memory + */ +struct mhi_controller *mhi_alloc_controller(void); + +/** + * mhi_free_controller - Free the MHI Controller structure + * Free the mhi_controller structure which was previously allocated + */ +void mhi_free_controller(struct mhi_controller *mhi_cntrl); + /** * mhi_register_controller - Register MHI controller * @mhi_cntrl: MHI controller to register From patchwork Tue Sep 29 17:52:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 11806469 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8DDB26CA for ; Tue, 29 Sep 2020 17:53:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6333D208B8 for ; Tue, 29 Sep 2020 17:53:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="EcOfnwcI" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728192AbgI2RxQ (ORCPT ); Tue, 29 Sep 2020 13:53:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728519AbgI2RxP (ORCPT ); Tue, 29 Sep 2020 13:53:15 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC539C061755 for ; Tue, 29 Sep 2020 10:53:15 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id z19so5302801pfn.8 for ; Tue, 29 Sep 2020 10:53:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=jNx5jfKYWZGFzKUONheqZrKSOvFz+O7hWeUKgyZ6/3A=; b=EcOfnwcIhZmkg8YtKqupJtE6kqkv1F1JlgYrWpsbRQhuV48lQOWqLZuawvW8eN8vmE nYduKuwcGC5oi+NX8M2N7XYBQgmP3aa5s2Jhuxkr2pcr6zIwZ8q8tZ4/bi+tNCjkMBMl DUTCVnnRmCMU0uFr5M9qud6HasU3LGq1uDXF9oXMCjxCyuMmSyvYLbwv9sRhYLOHPTwz CdRHiD+XHE8pIDaSlaCR03i7M/I6xeforlG7UVvOq/k/n8lsubiUoO8ESKpzqA/q6+ws 3QKJ8swzHL6L27YMEJi7gws9x+nyk9i/WyoRFEEx9aaXvLfByHGgXzEk7ZE2j6Cmb265 0IAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=jNx5jfKYWZGFzKUONheqZrKSOvFz+O7hWeUKgyZ6/3A=; b=DgQVmkIx03ggCAotOAGOCiRZf6tk5m/nTE94gsaqNF6m9R/VrPvon8mGGMSQT200Pt RhVprGScUKoMhEebGVjy/yptivIewzXUeKDZiqVJyRLtdgGf4xMejpJm1vjCE8yN/WlF 8anxEs4E3c9K2BDvkbxROAvrE1GZ2qnW8iPGn3aRCc6ytr0jXNJriyxlPFxEnDf3cnS/ BFhtV+YcBmIfraRxTBafyTj1gllJ0CkC4rBCPtvLWetTbq2ny3UhifySM+VMngk1pa1Q 0+8Hj6C6UIV4UeNhsngpWJIClYlDCLw4Zl+B335bagm2BUPuSMOFV6QkT/uBXo5+M9iE OPeg== X-Gm-Message-State: AOAM530N/pkTpRuj8GklMI8aoWqTq1VCkBmA1zSl7hm6zD3nAIiOW0U3 O8MZ8VDghjD0ZftQgfS3rvaY X-Google-Smtp-Source: ABdhPJzpvHisS1PdUoNs7JTrdToLTpc1i8Nmo9aXjx7gsfueAtDo2tvU/rP+p0YFXCbo8E6SbBBT/g== X-Received: by 2002:a65:5647:: with SMTP id m7mr4171265pgs.327.1601401995324; Tue, 29 Sep 2020 10:53:15 -0700 (PDT) Received: from Mani-XPS-13-9360.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id r188sm6271046pfc.67.2020.09.29.10.53.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Sep 2020 10:53:14 -0700 (PDT) From: Manivannan Sadhasivam To: gregkh@linuxfoundation.org Cc: hemantk@codeaurora.org, bbhatt@codeaurora.org, linux-arm-msm@vger.kernel.org, jhugo@codeaurora.org, linux-kernel@vger.kernel.org, Manivannan Sadhasivam Subject: [PATCH v3 11/19] bus: mhi: core: Add const qualifier to MHI config information Date: Tue, 29 Sep 2020 23:22:10 +0530 Message-Id: <20200929175218.8178-12-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200929175218.8178-1-manivannan.sadhasivam@linaro.org> References: <20200929175218.8178-1-manivannan.sadhasivam@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Hemant Kumar MHI channel, event and controller config data needs to be treated read only information. Add const qualifier to make sure config information passed by MHI controller is not modified by MHI core driver. Suggested-by: Kalle Valo Signed-off-by: Hemant Kumar Reviewed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/init.c | 12 ++++++------ include/linux/mhi.h | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c index f69a2f3d039d..d23293876be8 100644 --- a/drivers/bus/mhi/core/init.c +++ b/drivers/bus/mhi/core/init.c @@ -562,10 +562,10 @@ int mhi_init_chan_ctxt(struct mhi_controller *mhi_cntrl, } static int parse_ev_cfg(struct mhi_controller *mhi_cntrl, - struct mhi_controller_config *config) + const struct mhi_controller_config *config) { struct mhi_event *mhi_event; - struct mhi_event_config *event_cfg; + const struct mhi_event_config *event_cfg; struct device *dev = &mhi_cntrl->mhi_dev->dev; int i, num; @@ -648,9 +648,9 @@ static int parse_ev_cfg(struct mhi_controller *mhi_cntrl, } static int parse_ch_cfg(struct mhi_controller *mhi_cntrl, - struct mhi_controller_config *config) + const struct mhi_controller_config *config) { - struct mhi_channel_config *ch_cfg; + const struct mhi_channel_config *ch_cfg; struct device *dev = &mhi_cntrl->mhi_dev->dev; int i; u32 chan; @@ -766,7 +766,7 @@ static int parse_ch_cfg(struct mhi_controller *mhi_cntrl, } static int parse_config(struct mhi_controller *mhi_cntrl, - struct mhi_controller_config *config) + const struct mhi_controller_config *config) { int ret; @@ -803,7 +803,7 @@ static int parse_config(struct mhi_controller *mhi_cntrl, } int mhi_register_controller(struct mhi_controller *mhi_cntrl, - struct mhi_controller_config *config) + const struct mhi_controller_config *config) { struct mhi_event *mhi_event; struct mhi_chan *mhi_chan; diff --git a/include/linux/mhi.h b/include/linux/mhi.h index 6b987e8cc438..b2c0214bfbd6 100644 --- a/include/linux/mhi.h +++ b/include/linux/mhi.h @@ -280,9 +280,9 @@ struct mhi_controller_config { u32 timeout_ms; u32 buf_len; u32 num_channels; - struct mhi_channel_config *ch_cfg; + const struct mhi_channel_config *ch_cfg; u32 num_events; - struct mhi_event_config *event_cfg; + const struct mhi_event_config *event_cfg; bool use_bounce_buf; bool m2_no_db; }; @@ -545,7 +545,7 @@ void mhi_free_controller(struct mhi_controller *mhi_cntrl); * @config: Configuration to use for the controller */ int mhi_register_controller(struct mhi_controller *mhi_cntrl, - struct mhi_controller_config *config); + const struct mhi_controller_config *config); /** * mhi_unregister_controller - Unregister MHI controller From patchwork Tue Sep 29 17:52:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 11806473 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E5B966CB for ; Tue, 29 Sep 2020 17:53:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C4E7020848 for ; Tue, 29 Sep 2020 17:53:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="CY3xSlhp" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728257AbgI2Rx1 (ORCPT ); Tue, 29 Sep 2020 13:53:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728237AbgI2RxU (ORCPT ); Tue, 29 Sep 2020 13:53:20 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 599B6C061755 for ; Tue, 29 Sep 2020 10:53:20 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id o20so5299752pfp.11 for ; Tue, 29 Sep 2020 10:53:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3OCoOb+JFwXi2wMv6xbpF4vbDUAK9pGDZl8s+55Ok38=; b=CY3xSlhp90EMIar8OSFcqeG1hs/T3B8VyrW6GQrLY2a2FJzU9ejCTR10wI/nXoDQO1 v6n3qonu8tqI06JQJCqnk12E22Nus3CeGXYnNqHfupyOVU8Qcm43XLw+NyQXiKg+IOmb 4fzaqvPU2SeU3TNRQitpJsS+HVS6v/TfsSNUr6uerSjyLXa6VnkRTT+pclXO4fDYnObn qde8OCfA6zomxvsBaZoOrWJajK3AuQR5KpGdXvPt5PPGmpCjT4Ue09vW0lAi9gKR572m Oqbtoy7zB+LCZCbjEOAplCC2I16ugJr/kvDasFKKx8rWl19ldCDBOUE/f8i0za2apSRJ LAag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3OCoOb+JFwXi2wMv6xbpF4vbDUAK9pGDZl8s+55Ok38=; b=pM1f3X9sBTtEeEDFOpSbvvs/iNPLZ1mGA//Tq17Cr3bvaq6YlAx051AD1MGQvvcUUV qkCP/E8DGoAJyNlrmzphjefHi3pHryf2nYACrpf4j79WOQ526ws7fkL58Rf6n8HVwjAJ 2sakz78Yrzot3Sz3janajt0CkmWw/POcGmjVys1UhvD1Kz2LkVpJLS7RuQM//MYd0jdc BA15UGYyyXxTfQwvlPydVjgM+K5akRfUDDyhNfOXXG5DFa0hIrE4nMJcdf8clwFvQOee 2yw+2y55J/RlJJRZLLlwJF5p1FlzJsnXEc+L+LXTvhsgLWV13aLAMTGl0bGubHBMTH12 p5JA== X-Gm-Message-State: AOAM533uLN0YlxUkXkKdYkl6cwKPkHYdjNUAbAzQFHhXJWTu2CPVWTgH lAoUHFlBD8nrctC+sVXJzUGR X-Google-Smtp-Source: ABdhPJwvFlIjoVNA6mxVHO5t5M60EU/7EzXH9zO09Xgs400hPCTD3JMm6+dvmhS8Wu0dEH3/OCGxjQ== X-Received: by 2002:a17:902:7290:b029:d2:ac30:1690 with SMTP id d16-20020a1709027290b02900d2ac301690mr3180256pll.62.1601401999852; Tue, 29 Sep 2020 10:53:19 -0700 (PDT) Received: from Mani-XPS-13-9360.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id r188sm6271046pfc.67.2020.09.29.10.53.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Sep 2020 10:53:19 -0700 (PDT) From: Manivannan Sadhasivam To: gregkh@linuxfoundation.org Cc: hemantk@codeaurora.org, bbhatt@codeaurora.org, linux-arm-msm@vger.kernel.org, jhugo@codeaurora.org, linux-kernel@vger.kernel.org, Clark Williams , Sebastian Andrzej Siewior , Manivannan Sadhasivam Subject: [PATCH v3 12/19] bus: mhi: Remove include of rwlock_types.h Date: Tue, 29 Sep 2020 23:22:11 +0530 Message-Id: <20200929175218.8178-13-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200929175218.8178-1-manivannan.sadhasivam@linaro.org> References: <20200929175218.8178-1-manivannan.sadhasivam@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Clark Williams rwlock.h should not be included directly. Instead linux/splinlock.h should be included. Including it directly will break the RT build. Also there is no point in including _types.h headers directly. There is no benefit in including the type without the accessor. Fixes: 0cbf260820fa7 ("bus: mhi: core: Add support for registering MHI controllers") Signed-off-by: Clark Williams Signed-off-by: Sebastian Andrzej Siewior Reviewed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam --- include/linux/mhi.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/linux/mhi.h b/include/linux/mhi.h index b2c0214bfbd6..008b8f6fa9ff 100644 --- a/include/linux/mhi.h +++ b/include/linux/mhi.h @@ -9,10 +9,9 @@ #include #include #include -#include #include #include -#include +#include #include #include From patchwork Tue Sep 29 17:52:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 11806479 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DC6066CB for ; Tue, 29 Sep 2020 17:53:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B63192145D for ; Tue, 29 Sep 2020 17:53:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="mRQxkYoB" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728237AbgI2Rx2 (ORCPT ); Tue, 29 Sep 2020 13:53:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727657AbgI2RxY (ORCPT ); Tue, 29 Sep 2020 13:53:24 -0400 Received: from mail-pj1-x1041.google.com (mail-pj1-x1041.google.com [IPv6:2607:f8b0:4864:20::1041]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88EB3C0613D2 for ; Tue, 29 Sep 2020 10:53:24 -0700 (PDT) Received: by mail-pj1-x1041.google.com with SMTP id kk9so3062231pjb.2 for ; Tue, 29 Sep 2020 10:53:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+YUGt6aV7OP8RvUr5xgq7JykMZCPIUZje2/XDNY6QSI=; b=mRQxkYoBixvJF1Le8FkMC7LqWivfP6TeMbb2iQTv4mM0ZgzljpKRJDTRddL64xWz6c mtlxflF7/QMYBmW8VSR3s1sZ2NL3yXglpQWXn/4VYn2NCM7Z45ayYC2foijdM7sX+M0w afD1EWXxxd6GDzYcJ111JY5uPu2irdqYzNtt6PFINaN2JIB7YmuDllLUlrp0zwnS35Ql Uh1/qwlrBIym8lxKpZOZj+5hNpiCVOsMztxm3SjkZBVqKnNT5DX1jHbEEYRUiVMDQ9A6 dRubqe8zhJcn4ZmAWl8xQmbvpFa4ZHjo6IQl0dLlb+lvgay+00GeZ0AHXYGJ+tDT6bSb gfpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+YUGt6aV7OP8RvUr5xgq7JykMZCPIUZje2/XDNY6QSI=; b=Qeed92OJ8o7VUs8sVvPgBPgFW+LNyaNA3QQBthFDUvSKbpbrRggbRPuM33sHei2Ljw KGQUEyrhdG/0SPw/zxLdffw/HkCUbpwNukTT9hg8m8FGlCfwfp7pNJ7FelsbaR4ceQAM PHCi6RfYzxr4+8+1/5F/85iWNROZPTJFyQpgf2pkA1knLW/EgnCFQXk/+WS3ynfZKWHe REPY7rO98UXCZK0uGw1x+VbYNChWfT+0FHHc0L3n40L0yCtaceKLO+2Vb8Y24bXxy0p9 Un1JVrJKmiRQVJm7GPY4niTBT+WeI8erKtczG7L1cXTn5nnPVYnCnzINMvHxQOQ+kGkb +dsw== X-Gm-Message-State: AOAM533gufv6tIBW/HuGTOVVNJH+EApGuPas9RY+nixvziyY9cuB3sdO O58+uE44FQykIRepXGCxpQHl X-Google-Smtp-Source: ABdhPJxJ9UPNW1HcIz7wS8wh7ox8xeVaye082jOi3ooDXcMMyUFdRZPHpcUGy4j1gALBpIytLrQdbA== X-Received: by 2002:a17:90a:aa90:: with SMTP id l16mr1921077pjq.0.1601402004018; Tue, 29 Sep 2020 10:53:24 -0700 (PDT) Received: from Mani-XPS-13-9360.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id r188sm6271046pfc.67.2020.09.29.10.53.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Sep 2020 10:53:23 -0700 (PDT) From: Manivannan Sadhasivam To: gregkh@linuxfoundation.org Cc: hemantk@codeaurora.org, bbhatt@codeaurora.org, linux-arm-msm@vger.kernel.org, jhugo@codeaurora.org, linux-kernel@vger.kernel.org, Manivannan Sadhasivam Subject: [PATCH v3 13/19] bus: mhi: Fix entries based on Kconfig coding style Date: Tue, 29 Sep 2020 23:22:12 +0530 Message-Id: <20200929175218.8178-14-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200929175218.8178-1-manivannan.sadhasivam@linaro.org> References: <20200929175218.8178-1-manivannan.sadhasivam@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Bhaumik Bhatt Kconfig coding style mandates use of tabs for the configuration definition and an additional two spaces for the help text. Make the required changes to the MHI Kconfig adhering to those guidelines. Signed-off-by: Bhaumik Bhatt Reviewed-by: Manivannan Sadhasivam Acked-by: Randy Dunlap Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/Kconfig | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/bus/mhi/Kconfig b/drivers/bus/mhi/Kconfig index a8bd9bd7db7c..6677cccd61f3 100644 --- a/drivers/bus/mhi/Kconfig +++ b/drivers/bus/mhi/Kconfig @@ -6,9 +6,9 @@ # config MHI_BUS - tristate "Modem Host Interface (MHI) bus" - help - Bus driver for MHI protocol. Modem Host Interface (MHI) is a - communication protocol used by the host processors to control - and communicate with modem devices over a high speed peripheral - bus or shared memory. + tristate "Modem Host Interface (MHI) bus" + help + Bus driver for MHI protocol. Modem Host Interface (MHI) is a + communication protocol used by the host processors to control + and communicate with modem devices over a high speed peripheral + bus or shared memory. From patchwork Tue Sep 29 17:52:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 11806475 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 88D136CB for ; Tue, 29 Sep 2020 17:53:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5380A208B8 for ; Tue, 29 Sep 2020 17:53:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ssk+wxRZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728289AbgI2Rx3 (ORCPT ); Tue, 29 Sep 2020 13:53:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728277AbgI2Rx3 (ORCPT ); Tue, 29 Sep 2020 13:53:29 -0400 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6BE4C0613D0 for ; Tue, 29 Sep 2020 10:53:28 -0700 (PDT) Received: by mail-pg1-x542.google.com with SMTP id 7so4450293pgm.11 for ; Tue, 29 Sep 2020 10:53:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=mMw/Ksp0P1U2sI/VwrzNDLr3GW08so3zHnsJ9YYxsqo=; b=ssk+wxRZVnQuQM8n2Ur1vZKXTHKh5s+Bz5nKSfA/rAFAll5Mo5vZ5ZtNnRZAhvoyoK x8B75e1RhIxhj+KVUjKxlh7dR2S+qaZTPW4tVAV/Qle1Pw38lSMYNsdAY74S1OmbSOTp 9z6pIgHq4vG5QzqD77UKwjbS6N5WRmD+2HJ7otAbr6uFU1DUD0uAun6g2xFf+Sk3ubeP htup98+1kJvGyzZhaZXcujWBFN/91KgEqmPFUQVdi7gn6TkLjrytSg0sDzPIbWdfouje N1J/U1BSlVhHF0VI57sVZEy/UMzX2nQpbg9lDtZG++Q0nYKj2pUpwa89a+P4z5af9gu2 KUYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=mMw/Ksp0P1U2sI/VwrzNDLr3GW08so3zHnsJ9YYxsqo=; b=kaqVmaUcCRNSO1MRZ0lHCuAa00APFUvGeEhBIqVtlw4VluvBTX1XcogXuF6Gt5CALG WlPCmlK3grdxDnC0Ph8UPbQr/p6rUNHYgnvfToQNcyJUP1ARfWOPx8lc6thCQowVeCp+ 8egUcYORJ5Kt2+KyZc3XpDbtweAJt1DXSATMkty+qERsR455nnu2wtcEgZ2Sq4zkZ/li Z4IF4fVt8vgprZW+s/l3TrruaKkQ3VDWbXFJKFYMGlhsskjukJFp8q55bboTXUMK+L4A rD7Oh0pEV+yrvQqtSchoHAZsskaGZ0QvPUQbTq2xrGBlsPhz6aNme/z597bTMFZluGJf e3kQ== X-Gm-Message-State: AOAM531tuCbDBMJqlDNhtJRNJdJBM07MSJDWigWoj5cROTo+qeKO2V6a YOSSy3yly2v5gV5/FpP8fpgE X-Google-Smtp-Source: ABdhPJxya+Ot8zrBH9bZRPAncbD/qiSrsosEN4R5ql9aIAgtgVyt90xKi5zdpHhsBtnXluIaw4zDCw== X-Received: by 2002:a17:902:be09:b029:d2:83ee:dc2b with SMTP id r9-20020a170902be09b02900d283eedc2bmr5912782pls.20.1601402008289; Tue, 29 Sep 2020 10:53:28 -0700 (PDT) Received: from Mani-XPS-13-9360.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id r188sm6271046pfc.67.2020.09.29.10.53.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Sep 2020 10:53:27 -0700 (PDT) From: Manivannan Sadhasivam To: gregkh@linuxfoundation.org Cc: hemantk@codeaurora.org, bbhatt@codeaurora.org, linux-arm-msm@vger.kernel.org, jhugo@codeaurora.org, linux-kernel@vger.kernel.org, Manivannan Sadhasivam Subject: [PATCH v3 14/19] bus: mhi: core: Introduce debugfs entries for MHI Date: Tue, 29 Sep 2020 23:22:13 +0530 Message-Id: <20200929175218.8178-15-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200929175218.8178-1-manivannan.sadhasivam@linaro.org> References: <20200929175218.8178-1-manivannan.sadhasivam@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Bhaumik Bhatt Introduce debugfs entries to show state, register, channel, device, and event rings information. Allow the host to dump registers, issue device wake, and change the MHI timeout to help in debug. Signed-off-by: Bhaumik Bhatt Reviewed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/Kconfig | 8 + drivers/bus/mhi/core/Makefile | 1 + drivers/bus/mhi/core/debugfs.c | 410 ++++++++++++++++++++++++++++++++ drivers/bus/mhi/core/init.c | 7 + drivers/bus/mhi/core/internal.h | 24 ++ include/linux/mhi.h | 2 + 6 files changed, 452 insertions(+) create mode 100644 drivers/bus/mhi/core/debugfs.c diff --git a/drivers/bus/mhi/Kconfig b/drivers/bus/mhi/Kconfig index 6677cccd61f3..e841c1097fb4 100644 --- a/drivers/bus/mhi/Kconfig +++ b/drivers/bus/mhi/Kconfig @@ -12,3 +12,11 @@ config MHI_BUS communication protocol used by the host processors to control and communicate with modem devices over a high speed peripheral bus or shared memory. + +config MHI_BUS_DEBUG + bool "Debugfs support for the MHI bus" + depends on MHI_BUS && DEBUG_FS + help + Enable debugfs support for use with the MHI transport. Allows + reading and/or modifying some values within the MHI controller + for debug and test purposes. diff --git a/drivers/bus/mhi/core/Makefile b/drivers/bus/mhi/core/Makefile index 66e2700c9032..12c57ab3724c 100644 --- a/drivers/bus/mhi/core/Makefile +++ b/drivers/bus/mhi/core/Makefile @@ -1,3 +1,4 @@ obj-$(CONFIG_MHI_BUS) := mhi.o mhi-y := init.o main.o pm.o boot.o +mhi-$(CONFIG_MHI_BUS_DEBUG) += debugfs.o diff --git a/drivers/bus/mhi/core/debugfs.c b/drivers/bus/mhi/core/debugfs.c new file mode 100644 index 000000000000..f50d73054db4 --- /dev/null +++ b/drivers/bus/mhi/core/debugfs.c @@ -0,0 +1,410 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2020, The Linux Foundation. All rights reserved. + * + */ + +#include +#include +#include +#include +#include +#include +#include "internal.h" + +static int mhi_debugfs_states_show(struct seq_file *m, void *d) +{ + struct mhi_controller *mhi_cntrl = m->private; + + /* states */ + seq_printf(m, "PM state: %s Device: %s MHI state: %s EE: %s wake: %s\n", + to_mhi_pm_state_str(mhi_cntrl->pm_state), + mhi_is_active(mhi_cntrl) ? "Active" : "Inactive", + TO_MHI_STATE_STR(mhi_cntrl->dev_state), + TO_MHI_EXEC_STR(mhi_cntrl->ee), + mhi_cntrl->wake_set ? "true" : "false"); + + /* counters */ + seq_printf(m, "M0: %u M2: %u M3: %u", mhi_cntrl->M0, mhi_cntrl->M2, + mhi_cntrl->M3); + + seq_printf(m, " device wake: %u pending packets: %u\n", + atomic_read(&mhi_cntrl->dev_wake), + atomic_read(&mhi_cntrl->pending_pkts)); + + return 0; +} + +static int mhi_debugfs_events_show(struct seq_file *m, void *d) +{ + struct mhi_controller *mhi_cntrl = m->private; + struct mhi_event *mhi_event; + struct mhi_event_ctxt *er_ctxt; + int i; + + if (!mhi_is_active(mhi_cntrl)) { + seq_puts(m, "Device not ready\n"); + return -ENODEV; + } + + er_ctxt = mhi_cntrl->mhi_ctxt->er_ctxt; + mhi_event = mhi_cntrl->mhi_event; + for (i = 0; i < mhi_cntrl->total_ev_rings; + i++, er_ctxt++, mhi_event++) { + struct mhi_ring *ring = &mhi_event->ring; + + if (mhi_event->offload_ev) { + seq_printf(m, "Index: %d is an offload event ring\n", + i); + continue; + } + + seq_printf(m, "Index: %d intmod count: %lu time: %lu", + i, (er_ctxt->intmod & EV_CTX_INTMODC_MASK) >> + EV_CTX_INTMODC_SHIFT, + (er_ctxt->intmod & EV_CTX_INTMODT_MASK) >> + EV_CTX_INTMODT_SHIFT); + + seq_printf(m, " base: 0x%0llx len: 0x%llx", er_ctxt->rbase, + er_ctxt->rlen); + + seq_printf(m, " rp: 0x%llx wp: 0x%llx", er_ctxt->rp, + er_ctxt->wp); + + seq_printf(m, " local rp: 0x%pK db: 0x%pad\n", ring->rp, + &mhi_event->db_cfg.db_val); + } + + return 0; +} + +static int mhi_debugfs_channels_show(struct seq_file *m, void *d) +{ + struct mhi_controller *mhi_cntrl = m->private; + struct mhi_chan *mhi_chan; + struct mhi_chan_ctxt *chan_ctxt; + int i; + + if (!mhi_is_active(mhi_cntrl)) { + seq_puts(m, "Device not ready\n"); + return -ENODEV; + } + + mhi_chan = mhi_cntrl->mhi_chan; + chan_ctxt = mhi_cntrl->mhi_ctxt->chan_ctxt; + for (i = 0; i < mhi_cntrl->max_chan; i++, chan_ctxt++, mhi_chan++) { + struct mhi_ring *ring = &mhi_chan->tre_ring; + + if (mhi_chan->offload_ch) { + seq_printf(m, "%s(%u) is an offload channel\n", + mhi_chan->name, mhi_chan->chan); + continue; + } + + if (!mhi_chan->mhi_dev) + continue; + + seq_printf(m, + "%s(%u) state: 0x%lx brstmode: 0x%lx pollcfg: 0x%lx", + mhi_chan->name, mhi_chan->chan, (chan_ctxt->chcfg & + CHAN_CTX_CHSTATE_MASK) >> CHAN_CTX_CHSTATE_SHIFT, + (chan_ctxt->chcfg & CHAN_CTX_BRSTMODE_MASK) >> + CHAN_CTX_BRSTMODE_SHIFT, (chan_ctxt->chcfg & + CHAN_CTX_POLLCFG_MASK) >> CHAN_CTX_POLLCFG_SHIFT); + + seq_printf(m, " type: 0x%x event ring: %u", chan_ctxt->chtype, + chan_ctxt->erindex); + + seq_printf(m, " base: 0x%llx len: 0x%llx wp: 0x%llx", + chan_ctxt->rbase, chan_ctxt->rlen, chan_ctxt->wp); + + seq_printf(m, " local rp: 0x%pK local wp: 0x%pK db: 0x%pad\n", + ring->rp, ring->wp, + &mhi_chan->db_cfg.db_val); + } + + return 0; +} + +static int mhi_device_info_show(struct device *dev, void *data) +{ + struct mhi_device *mhi_dev; + + if (dev->bus != &mhi_bus_type) + return 0; + + mhi_dev = to_mhi_device(dev); + + seq_printf((struct seq_file *)data, "%s: type: %s dev_wake: %u", + mhi_dev->name, mhi_dev->dev_type ? "Controller" : "Transfer", + mhi_dev->dev_wake); + + /* for transfer device types only */ + if (mhi_dev->dev_type == MHI_DEVICE_XFER) + seq_printf((struct seq_file *)data, " channels: %u(UL)/%u(DL)", + mhi_dev->ul_chan_id, mhi_dev->dl_chan_id); + + seq_puts((struct seq_file *)data, "\n"); + + return 0; +} + +static int mhi_debugfs_devices_show(struct seq_file *m, void *d) +{ + struct mhi_controller *mhi_cntrl = m->private; + + if (!mhi_is_active(mhi_cntrl)) { + seq_puts(m, "Device not ready\n"); + return -ENODEV; + } + + device_for_each_child(mhi_cntrl->cntrl_dev, m, mhi_device_info_show); + + return 0; +} + +static int mhi_debugfs_regdump_show(struct seq_file *m, void *d) +{ + struct mhi_controller *mhi_cntrl = m->private; + enum mhi_state state; + enum mhi_ee_type ee; + int i, ret = -EIO; + u32 val; + void __iomem *mhi_base = mhi_cntrl->regs; + void __iomem *bhi_base = mhi_cntrl->bhi; + void __iomem *bhie_base = mhi_cntrl->bhie; + void __iomem *wake_db = mhi_cntrl->wake_db; + struct { + const char *name; + int offset; + void __iomem *base; + } regs[] = { + { "MHI_REGLEN", MHIREGLEN, mhi_base}, + { "MHI_VER", MHIVER, mhi_base}, + { "MHI_CFG", MHICFG, mhi_base}, + { "MHI_CTRL", MHICTRL, mhi_base}, + { "MHI_STATUS", MHISTATUS, mhi_base}, + { "MHI_WAKE_DB", 0, wake_db}, + { "BHI_EXECENV", BHI_EXECENV, bhi_base}, + { "BHI_STATUS", BHI_STATUS, bhi_base}, + { "BHI_ERRCODE", BHI_ERRCODE, bhi_base}, + { "BHI_ERRDBG1", BHI_ERRDBG1, bhi_base}, + { "BHI_ERRDBG2", BHI_ERRDBG2, bhi_base}, + { "BHI_ERRDBG3", BHI_ERRDBG3, bhi_base}, + { "BHIE_TXVEC_DB", BHIE_TXVECDB_OFFS, bhie_base}, + { "BHIE_TXVEC_STATUS", BHIE_TXVECSTATUS_OFFS, bhie_base}, + { "BHIE_RXVEC_DB", BHIE_RXVECDB_OFFS, bhie_base}, + { "BHIE_RXVEC_STATUS", BHIE_RXVECSTATUS_OFFS, bhie_base}, + { NULL }, + }; + + if (!MHI_REG_ACCESS_VALID(mhi_cntrl->pm_state)) + return ret; + + seq_printf(m, "Host PM state: %s Device state: %s EE: %s\n", + to_mhi_pm_state_str(mhi_cntrl->pm_state), + TO_MHI_STATE_STR(mhi_cntrl->dev_state), + TO_MHI_EXEC_STR(mhi_cntrl->ee)); + + state = mhi_get_mhi_state(mhi_cntrl); + ee = mhi_get_exec_env(mhi_cntrl); + seq_printf(m, "Device EE: %s state: %s\n", TO_MHI_EXEC_STR(ee), + TO_MHI_STATE_STR(state)); + + for (i = 0; regs[i].name; i++) { + if (!regs[i].base) + continue; + ret = mhi_read_reg(mhi_cntrl, regs[i].base, regs[i].offset, + &val); + if (ret) + continue; + + seq_printf(m, "%s: 0x%x\n", regs[i].name, val); + } + + return 0; +} + +static int mhi_debugfs_device_wake_show(struct seq_file *m, void *d) +{ + struct mhi_controller *mhi_cntrl = m->private; + struct mhi_device *mhi_dev = mhi_cntrl->mhi_dev; + + if (!mhi_is_active(mhi_cntrl)) { + seq_puts(m, "Device not ready\n"); + return -ENODEV; + } + + seq_printf(m, + "Wake count: %d\n%s\n", mhi_dev->dev_wake, + "Usage: echo get/put > device_wake to vote/unvote for M0"); + + return 0; +} + +static ssize_t mhi_debugfs_device_wake_write(struct file *file, + const char __user *ubuf, + size_t count, loff_t *ppos) +{ + struct seq_file *m = file->private_data; + struct mhi_controller *mhi_cntrl = m->private; + struct mhi_device *mhi_dev = mhi_cntrl->mhi_dev; + char buf[16]; + int ret = -EINVAL; + + if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count))) + return -EFAULT; + + if (!strncmp(buf, "get", 3)) { + ret = mhi_device_get_sync(mhi_dev); + } else if (!strncmp(buf, "put", 3)) { + mhi_device_put(mhi_dev); + ret = 0; + } + + return ret ? ret : count; +} + +static int mhi_debugfs_timeout_ms_show(struct seq_file *m, void *d) +{ + struct mhi_controller *mhi_cntrl = m->private; + + seq_printf(m, "%u ms\n", mhi_cntrl->timeout_ms); + + return 0; +} + +static ssize_t mhi_debugfs_timeout_ms_write(struct file *file, + const char __user *ubuf, + size_t count, loff_t *ppos) +{ + struct seq_file *m = file->private_data; + struct mhi_controller *mhi_cntrl = m->private; + u32 timeout_ms; + + if (kstrtou32_from_user(ubuf, count, 0, &timeout_ms)) + return -EINVAL; + + mhi_cntrl->timeout_ms = timeout_ms; + + return count; +} + +static int mhi_debugfs_states_open(struct inode *inode, struct file *fp) +{ + return single_open(fp, mhi_debugfs_states_show, inode->i_private); +} + +static int mhi_debugfs_events_open(struct inode *inode, struct file *fp) +{ + return single_open(fp, mhi_debugfs_events_show, inode->i_private); +} + +static int mhi_debugfs_channels_open(struct inode *inode, struct file *fp) +{ + return single_open(fp, mhi_debugfs_channels_show, inode->i_private); +} + +static int mhi_debugfs_devices_open(struct inode *inode, struct file *fp) +{ + return single_open(fp, mhi_debugfs_devices_show, inode->i_private); +} + +static int mhi_debugfs_regdump_open(struct inode *inode, struct file *fp) +{ + return single_open(fp, mhi_debugfs_regdump_show, inode->i_private); +} + +static int mhi_debugfs_device_wake_open(struct inode *inode, struct file *fp) +{ + return single_open(fp, mhi_debugfs_device_wake_show, inode->i_private); +} + +static int mhi_debugfs_timeout_ms_open(struct inode *inode, struct file *fp) +{ + return single_open(fp, mhi_debugfs_timeout_ms_show, inode->i_private); +} + +static const struct file_operations debugfs_states_fops = { + .open = mhi_debugfs_states_open, + .release = single_release, + .read = seq_read, +}; + +static const struct file_operations debugfs_events_fops = { + .open = mhi_debugfs_events_open, + .release = single_release, + .read = seq_read, +}; + +static const struct file_operations debugfs_channels_fops = { + .open = mhi_debugfs_channels_open, + .release = single_release, + .read = seq_read, +}; + +static const struct file_operations debugfs_devices_fops = { + .open = mhi_debugfs_devices_open, + .release = single_release, + .read = seq_read, +}; + +static const struct file_operations debugfs_regdump_fops = { + .open = mhi_debugfs_regdump_open, + .release = single_release, + .read = seq_read, +}; + +static const struct file_operations debugfs_device_wake_fops = { + .open = mhi_debugfs_device_wake_open, + .write = mhi_debugfs_device_wake_write, + .release = single_release, + .read = seq_read, +}; + +static const struct file_operations debugfs_timeout_ms_fops = { + .open = mhi_debugfs_timeout_ms_open, + .write = mhi_debugfs_timeout_ms_write, + .release = single_release, + .read = seq_read, +}; + +static struct dentry *mhi_debugfs_root; + +void mhi_create_debugfs(struct mhi_controller *mhi_cntrl) +{ + mhi_cntrl->debugfs_dentry = + debugfs_create_dir(dev_name(mhi_cntrl->cntrl_dev), + mhi_debugfs_root); + + debugfs_create_file("states", 0444, mhi_cntrl->debugfs_dentry, + mhi_cntrl, &debugfs_states_fops); + debugfs_create_file("events", 0444, mhi_cntrl->debugfs_dentry, + mhi_cntrl, &debugfs_events_fops); + debugfs_create_file("channels", 0444, mhi_cntrl->debugfs_dentry, + mhi_cntrl, &debugfs_channels_fops); + debugfs_create_file("devices", 0444, mhi_cntrl->debugfs_dentry, + mhi_cntrl, &debugfs_devices_fops); + debugfs_create_file("regdump", 0444, mhi_cntrl->debugfs_dentry, + mhi_cntrl, &debugfs_regdump_fops); + debugfs_create_file("device_wake", 0644, mhi_cntrl->debugfs_dentry, + mhi_cntrl, &debugfs_device_wake_fops); + debugfs_create_file("timeout_ms", 0644, mhi_cntrl->debugfs_dentry, + mhi_cntrl, &debugfs_timeout_ms_fops); +} + +void mhi_destroy_debugfs(struct mhi_controller *mhi_cntrl) +{ + debugfs_remove_recursive(mhi_cntrl->debugfs_dentry); + mhi_cntrl->debugfs_dentry = NULL; +} + +void mhi_debugfs_init(void) +{ + mhi_debugfs_root = debugfs_create_dir(mhi_bus_type.name, NULL); +} + +void mhi_debugfs_exit(void) +{ + debugfs_remove_recursive(mhi_debugfs_root); +} diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c index d23293876be8..61e5885a331a 100644 --- a/drivers/bus/mhi/core/init.c +++ b/drivers/bus/mhi/core/init.c @@ -4,6 +4,7 @@ * */ +#include #include #include #include @@ -915,6 +916,8 @@ int mhi_register_controller(struct mhi_controller *mhi_cntrl, mhi_cntrl->mhi_dev = mhi_dev; + mhi_create_debugfs(mhi_cntrl); + return 0; error_add_dev: @@ -937,6 +940,8 @@ void mhi_unregister_controller(struct mhi_controller *mhi_cntrl) struct mhi_chan *mhi_chan = mhi_cntrl->mhi_chan; unsigned int i; + mhi_destroy_debugfs(mhi_cntrl); + kfree(mhi_cntrl->mhi_cmd); kfree(mhi_cntrl->mhi_event); @@ -1300,11 +1305,13 @@ struct bus_type mhi_bus_type = { static int __init mhi_init(void) { + mhi_debugfs_init(); return bus_register(&mhi_bus_type); } static void __exit mhi_exit(void) { + mhi_debugfs_exit(); bus_unregister(&mhi_bus_type); } diff --git a/drivers/bus/mhi/core/internal.h b/drivers/bus/mhi/core/internal.h index 5a81a428c4aa..7989269ddd96 100644 --- a/drivers/bus/mhi/core/internal.h +++ b/drivers/bus/mhi/core/internal.h @@ -570,6 +570,30 @@ struct mhi_chan { /* Default MHI timeout */ #define MHI_TIMEOUT_MS (1000) +/* debugfs related functions */ +#ifdef CONFIG_MHI_BUS_DEBUG +void mhi_create_debugfs(struct mhi_controller *mhi_cntrl); +void mhi_destroy_debugfs(struct mhi_controller *mhi_cntrl); +void mhi_debugfs_init(void); +void mhi_debugfs_exit(void); +#else +static inline void mhi_create_debugfs(struct mhi_controller *mhi_cntrl) +{ +} + +static inline void mhi_destroy_debugfs(struct mhi_controller *mhi_cntrl) +{ +} + +static inline void mhi_debugfs_init(void) +{ +} + +static inline void mhi_debugfs_exit(void) +{ +} +#endif + struct mhi_device *mhi_alloc_device(struct mhi_controller *mhi_cntrl); int mhi_destroy_device(struct device *dev, void *data); diff --git a/include/linux/mhi.h b/include/linux/mhi.h index 008b8f6fa9ff..fb45a0ff9aa3 100644 --- a/include/linux/mhi.h +++ b/include/linux/mhi.h @@ -291,6 +291,7 @@ struct mhi_controller_config { * @cntrl_dev: Pointer to the struct device of physical bus acting as the MHI * controller (required) * @mhi_dev: MHI device instance for the controller + * @debugfs_dentry: MHI controller debugfs directory * @regs: Base address of MHI MMIO register space (required) * @bhi: Points to base of MHI BHI register space * @bhie: Points to base of MHI BHIe register space @@ -370,6 +371,7 @@ struct mhi_controller_config { struct mhi_controller { struct device *cntrl_dev; struct mhi_device *mhi_dev; + struct dentry *debugfs_dentry; void __iomem *regs; void __iomem *bhi; void __iomem *bhie; From patchwork Tue Sep 29 17:52:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 11806477 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 28A326CA for ; Tue, 29 Sep 2020 17:53:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 019BD208B8 for ; Tue, 29 Sep 2020 17:53:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="IHdVpJcx" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728606AbgI2Rxh (ORCPT ); Tue, 29 Sep 2020 13:53:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728576AbgI2Rxd (ORCPT ); Tue, 29 Sep 2020 13:53:33 -0400 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 018C9C0613D0 for ; Tue, 29 Sep 2020 10:53:33 -0700 (PDT) Received: by mail-pf1-x441.google.com with SMTP id d6so5304057pfn.9 for ; Tue, 29 Sep 2020 10:53:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=L3CU+DoqUHiRxVgJAceWJlznOoGillE+BlhtluWnPFM=; b=IHdVpJcxXiMp1MfK/ckQ0DW8ljvSsIpYWAOjHKaz26YBfQrgZBuOfbf1EWOXIWUtVI OEd+tyR8rqFKIOUts36EuDYIHlLVI2qpAXd5i9upvFSlonCdPo9NlZx6dv6McwsXZFEc nBNjVzEHU6RepQSHlpxvD0o80z/ZjCeVW27iHsW9v6swJ+Tt1rivGHoO0dpxd02FvyUZ Is8s+0lYwhkrnzKp373bxDeQ79KjKMTiL4WcqB1tbzBPwxtT6p+3avdyzj92cKm+V69m oa/98k+zTeIQI4MXo6nRe0G1szc9y/PtIq2JQTMARPE2ztv4+8IHFlR2qziUwVoO1u2R MDnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=L3CU+DoqUHiRxVgJAceWJlznOoGillE+BlhtluWnPFM=; b=scc2zC/jIvBzMoLFWmqDBE4iV2+bnU252RuEtjA4VVP1DSi0W7jfYuy/nBT56lmpbH 8f3ooVutRi3Lp+m1RN3KrQwOlbUUOZyfOZcxu40/j4QrZr+lGOdNWEZ2rnXtU5JyUJ67 UirpGexbSSnsUrUNWXrIVfgl33IT/x+5pFp/+oV4eBAEPGIfRKeCggzJU/c4jyXgN2do IiEBZLtwFY+bSnm5WDjMNd9nfcakkZSwMwiOSbqGRqKXOahlH0XL2Bif4ud0Sp7zyyYf DjS0MTqL+XCQyIJqSduqsgcL9uOssNWhvRYCvjOVfifswVJiDLhvWnclj7PDPxAL1wKb Og2w== X-Gm-Message-State: AOAM533p7GMcQYm2EzFuqrsmbYuKQxCImDRBy0BQSa1kM4S6iZvYEVJI LomiF668PcqWFwkOThuitw2P X-Google-Smtp-Source: ABdhPJyJcSx28lSC2XOPOG707RQ0nvJ2m8g3Eo+Wwxq7RbLfSZxltrjZ+DMx2EjQ8pdBr5a3Nqb2/A== X-Received: by 2002:a63:e441:: with SMTP id i1mr4265509pgk.221.1601402012424; Tue, 29 Sep 2020 10:53:32 -0700 (PDT) Received: from Mani-XPS-13-9360.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id r188sm6271046pfc.67.2020.09.29.10.53.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Sep 2020 10:53:31 -0700 (PDT) From: Manivannan Sadhasivam To: gregkh@linuxfoundation.org Cc: hemantk@codeaurora.org, bbhatt@codeaurora.org, linux-arm-msm@vger.kernel.org, jhugo@codeaurora.org, linux-kernel@vger.kernel.org, Manivannan Sadhasivam Subject: [PATCH v3 15/19] bus: mhi: core: Introduce sysfs entries for MHI Date: Tue, 29 Sep 2020 23:22:14 +0530 Message-Id: <20200929175218.8178-16-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200929175218.8178-1-manivannan.sadhasivam@linaro.org> References: <20200929175218.8178-1-manivannan.sadhasivam@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Bhaumik Bhatt Introduce sysfs entries to enable userspace clients the ability to read the serial number and the OEM PK Hash values obtained from BHI. OEMs need to read these device-specific hardware information values through userspace for factory testing purposes and cannot be exposed via degbufs as it may remain disabled for performance reasons. Also, update the documentation for ABI to include these entries. Signed-off-by: Bhaumik Bhatt Reviewed-by: Manivannan Sadhasivam [mani: used dev_groups to manage sysfs attributes] Signed-off-by: Manivannan Sadhasivam --- Documentation/ABI/stable/sysfs-bus-mhi | 21 +++++++++++++++ MAINTAINERS | 1 + drivers/bus/mhi/core/init.c | 37 ++++++++++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 Documentation/ABI/stable/sysfs-bus-mhi diff --git a/Documentation/ABI/stable/sysfs-bus-mhi b/Documentation/ABI/stable/sysfs-bus-mhi new file mode 100644 index 000000000000..ecfe7662f8d0 --- /dev/null +++ b/Documentation/ABI/stable/sysfs-bus-mhi @@ -0,0 +1,21 @@ +What: /sys/bus/mhi/devices/.../serialnumber +Date: Sept 2020 +KernelVersion: 5.10 +Contact: Bhaumik Bhatt +Description: The file holds the serial number of the client device obtained + using a BHI (Boot Host Interface) register read after at least + one attempt to power up the device has been done. If read + without having the device power on at least once, the file will + read all 0's. +Users: Any userspace application or clients interested in device info. + +What: /sys/bus/mhi/devices/.../oem_pk_hash +Date: Sept 2020 +KernelVersion: 5.10 +Contact: Bhaumik Bhatt +Description: The file holds the OEM PK Hash value of the endpoint device + obtained using a BHI (Boot Host Interface) register read after + at least one attempt to power up the device has been done. If + read without having the device power on at least once, the file + will read all 0's. +Users: Any userspace application or clients interested in device info. diff --git a/MAINTAINERS b/MAINTAINERS index deaafb617361..11e7be9b9163 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -11323,6 +11323,7 @@ M: Hemant Kumar L: linux-arm-msm@vger.kernel.org S: Maintained T: git git://git.kernel.org/pub/scm/linux/kernel/git/mani/mhi.git +F: Documentation/ABI/stable/sysfs-bus-mhi F: Documentation/mhi/ F: drivers/bus/mhi/ F: include/linux/mhi.h diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c index 61e5885a331a..a33665b7ee54 100644 --- a/drivers/bus/mhi/core/init.c +++ b/drivers/bus/mhi/core/init.c @@ -76,6 +76,42 @@ const char *to_mhi_pm_state_str(enum mhi_pm_state state) return mhi_pm_state_str[index]; } +static ssize_t serial_number_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct mhi_device *mhi_dev = to_mhi_device(dev); + struct mhi_controller *mhi_cntrl = mhi_dev->mhi_cntrl; + + return snprintf(buf, PAGE_SIZE, "Serial Number: %u\n", + mhi_cntrl->serial_number); +} +static DEVICE_ATTR_RO(serial_number); + +static ssize_t oem_pk_hash_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct mhi_device *mhi_dev = to_mhi_device(dev); + struct mhi_controller *mhi_cntrl = mhi_dev->mhi_cntrl; + int i, cnt = 0; + + for (i = 0; i < ARRAY_SIZE(mhi_cntrl->oem_pk_hash); i++) + cnt += snprintf(buf + cnt, PAGE_SIZE - cnt, + "OEMPKHASH[%d]: 0x%x\n", i, + mhi_cntrl->oem_pk_hash[i]); + + return cnt; +} +static DEVICE_ATTR_RO(oem_pk_hash); + +static struct attribute *mhi_dev_attrs[] = { + &dev_attr_serial_number.attr, + &dev_attr_oem_pk_hash.attr, + NULL, +}; +ATTRIBUTE_GROUPS(mhi_dev); + /* MHI protocol requires the transfer ring to be aligned with ring length */ static int mhi_alloc_aligned_ring(struct mhi_controller *mhi_cntrl, struct mhi_ring *ring, @@ -1301,6 +1337,7 @@ struct bus_type mhi_bus_type = { .dev_name = "mhi", .match = mhi_match, .uevent = mhi_uevent, + .dev_groups = mhi_dev_groups, }; static int __init mhi_init(void) From patchwork Tue Sep 29 17:52:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 11806481 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 651BB6CA for ; Tue, 29 Sep 2020 17:53:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3C8D7208B8 for ; Tue, 29 Sep 2020 17:53:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="VcUe4WF6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728345AbgI2Rxq (ORCPT ); Tue, 29 Sep 2020 13:53:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728272AbgI2Rxh (ORCPT ); Tue, 29 Sep 2020 13:53:37 -0400 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E1FEC061755 for ; Tue, 29 Sep 2020 10:53:37 -0700 (PDT) Received: by mail-pf1-x442.google.com with SMTP id d9so5330784pfd.3 for ; Tue, 29 Sep 2020 10:53:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=I4sYG/yonx2Z4e3j5HjpsSaE/IQcEPtF5lwUAPBhXso=; b=VcUe4WF6dH2FXchwOaRd0598LuuqD1JkgolkZQFDXa81xOts4Z1XwgDAtSQuXm8b+B 27dUXBF35E13arQCKfjBGqrKUgbK3z7oSoSZfUC/Z5GExKrg1MXkNUyaijFfaHXzdnqC L4mt9I/qfitl3NujaemogT5hIgYx2K9mmvWKzEpw0V/GMKsedYvUSdYWtSnNvf31ZxBw iL4qS7zHVrJnpkF4CxsRNEb2/ZB2XmHeqJpEl4aUnYq4DV26a7lGzWTGYvEoioKZTlgl +V+8ypQDw4Pl5lRVQZ+6/FzxW5zXeg6wq2bCZInDGNO26txhooYNzmSi43GRD2JmFvMx i3Ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=I4sYG/yonx2Z4e3j5HjpsSaE/IQcEPtF5lwUAPBhXso=; b=RCQn9vkYnFQJBQDmFxGsnYREbz6Y7+VPouxnZgW4gC73Q/7ObmpVjM4KJOzfH3avvE qDFGZtUYfrp7+v1F165V8Vuf+StAx9WnOHNREn3kLzMupzte2SNiJoJsWlmQhdSCvfBz iocpVqmwxRzrpDecmcx0hGewYb8widcBFDU9Vu2AP+fA1/NWVenZf4Bm+4kZUw17mmDG 108xhdsOQdv+RGUoB9A+ide+cDRV72rPcs/lzjZ6B+fFXXynTx8I7MxGS//6iFilslFx qxzgxFejMpFX9pxQ+kO/DHyXcDVxa7QUndUqkXnPZwbKD6saK5bI3cqzJGXH4aSomIkl 79oA== X-Gm-Message-State: AOAM531pXg7QbMilmqkss4fhG2f3ZhSwdy11d01Sb9tyqWn8UKMIEGnn +zmoD4UXRyaZgibHdUbnyQpj X-Google-Smtp-Source: ABdhPJwyv1MBf2jqrlH853GVV/DeEf2XXFzpFlnMa0Sr/YR4NjBPQBQ1mF2U67Trtcn8JqA1NTjbIg== X-Received: by 2002:aa7:9635:0:b029:142:2501:3980 with SMTP id r21-20020aa796350000b029014225013980mr5185745pfg.69.1601402016739; Tue, 29 Sep 2020 10:53:36 -0700 (PDT) Received: from Mani-XPS-13-9360.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id r188sm6271046pfc.67.2020.09.29.10.53.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Sep 2020 10:53:36 -0700 (PDT) From: Manivannan Sadhasivam To: gregkh@linuxfoundation.org Cc: hemantk@codeaurora.org, bbhatt@codeaurora.org, linux-arm-msm@vger.kernel.org, jhugo@codeaurora.org, linux-kernel@vger.kernel.org, Loic Poulain , Manivannan Sadhasivam Subject: [PATCH v3 16/19] bus: mhi: core: Allow shared IRQ for event rings Date: Tue, 29 Sep 2020 23:22:15 +0530 Message-Id: <20200929175218.8178-17-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200929175218.8178-1-manivannan.sadhasivam@linaro.org> References: <20200929175218.8178-1-manivannan.sadhasivam@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Loic Poulain There is no requirement for using a dedicated IRQ per event ring. Some systems does not support multiple MSI vectors (e.g. intel without CONFIG_IRQ_REMAP), In that case the MHI controller can configure all the event rings to use the same interrupt (as fallback). Allow this by removing the nr_irqs = ev_ring test and add extra check in the irq_setup function. Signed-off-by: Loic Poulain Reviewed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/init.c | 7 +++++++ drivers/bus/mhi/core/pm.c | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c index a33665b7ee54..103d51f35e28 100644 --- a/drivers/bus/mhi/core/init.c +++ b/drivers/bus/mhi/core/init.c @@ -162,6 +162,13 @@ int mhi_init_irq_setup(struct mhi_controller *mhi_cntrl) if (mhi_event->offload_ev) continue; + if (mhi_event->irq >= mhi_cntrl->nr_irqs) { + dev_err(dev, "irq %d not available for event ring\n", + mhi_event->irq); + ret = -EINVAL; + goto error_request; + } + ret = request_irq(mhi_cntrl->irq[mhi_event->irq], mhi_irq_handler, IRQF_SHARED | IRQF_NO_SUSPEND, diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c index ce4d969818b4..3de7b1639ec6 100644 --- a/drivers/bus/mhi/core/pm.c +++ b/drivers/bus/mhi/core/pm.c @@ -918,7 +918,7 @@ int mhi_async_power_up(struct mhi_controller *mhi_cntrl) dev_info(dev, "Requested to power ON\n"); - if (mhi_cntrl->nr_irqs < mhi_cntrl->total_ev_rings) + if (mhi_cntrl->nr_irqs < 1) return -EINVAL; /* Supply default wake routines if not provided by controller driver */ From patchwork Tue Sep 29 17:52:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 11806485 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EB86A174A for ; Tue, 29 Sep 2020 17:53:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C92472145D for ; Tue, 29 Sep 2020 17:53:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="HhWa9++E" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727863AbgI2Rxr (ORCPT ); Tue, 29 Sep 2020 13:53:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728379AbgI2Rxl (ORCPT ); Tue, 29 Sep 2020 13:53:41 -0400 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85F76C0613D2 for ; Tue, 29 Sep 2020 10:53:41 -0700 (PDT) Received: by mail-pf1-x441.google.com with SMTP id n14so5310992pff.6 for ; Tue, 29 Sep 2020 10:53:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=d5NHMOfzoZtUI9mNkF0dRKXjszoqYK7ekBI5K8v9id0=; b=HhWa9++EqlvSV1/AxY493KAUH2ktKFTjdgz6plENoEl5upE9fuV1zfwvRXB9C0mLaJ QmupooH+E+lkgbOIaAJOn8xeYgUvPWVHG6IWXmDCngyVBUtdDcBY7H7g0QrkP0f0c32q ucMwSb29Ewy6Vz8yn7GFHZrjbILJxJba/PtystV7CoWBAP8SqrxHNLA3Yu8ebfY42bRO qad+sZaKR/Jqh+aAZ6c1CV5EGKd0NtXPXBEq8QEbDO0xP501oilRb0iEqLZ4+paP1Od7 8wU3F8lvVt5NV7TgGn8ejQEB0NMeZvFuEfhi/hAu21zS5gx/rSRehdt/Qwy682y1yk3h h18w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=d5NHMOfzoZtUI9mNkF0dRKXjszoqYK7ekBI5K8v9id0=; b=PR3D4VARh7iksfq9+1w40JQ7xf11i76sPIZ/8bXCcAsEN8B5Ll75VesZIUsTaOuyj+ UJKZoiKldc5Xk1XLHRsae/+fZshNBtIXBISF0KUEswrbJUTfHtnajt2l34kcWHoELqL/ AMLweg9bgHdiYmiipBp7dXDkxD88v4Mx8i58MUT8W5JO8ZDHmItS63NWgewrDoPlS48L QlHUEzStCaYph/jRIv/38dR0897sv1nKUYXxAn+hcQG+dXRAybGBqBvkRkz0GqPVta14 Ly1fdfqPggMypen3fFruKpFTsBQhLXInAsORTdE4Gr3bmaycbhhtY29+VoLqWjQEWIhi lwfg== X-Gm-Message-State: AOAM531DXcvFzfjEAeum/SZWiQBK1F7K2yS7sPKwkKMjdYLSvRuSXvtd KqBlcqZlg9W8MSqbMJhiNugK X-Google-Smtp-Source: ABdhPJxBBwqWfMMoD+HnTfwjAWNt4UlJd3VoGL0BhhqEJ+dg+fNv2g4nWNaP5VKIpgMADXBlJR4EVw== X-Received: by 2002:aa7:9817:0:b029:13e:d13d:a139 with SMTP id e23-20020aa798170000b029013ed13da139mr5011278pfl.33.1601402020983; Tue, 29 Sep 2020 10:53:40 -0700 (PDT) Received: from Mani-XPS-13-9360.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id r188sm6271046pfc.67.2020.09.29.10.53.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Sep 2020 10:53:40 -0700 (PDT) From: Manivannan Sadhasivam To: gregkh@linuxfoundation.org Cc: hemantk@codeaurora.org, bbhatt@codeaurora.org, linux-arm-msm@vger.kernel.org, jhugo@codeaurora.org, linux-kernel@vger.kernel.org, Loic Poulain , Manivannan Sadhasivam Subject: [PATCH v3 17/19] bus: mhi: Remove unused nr_irqs_req variable Date: Tue, 29 Sep 2020 23:22:16 +0530 Message-Id: <20200929175218.8178-18-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200929175218.8178-1-manivannan.sadhasivam@linaro.org> References: <20200929175218.8178-1-manivannan.sadhasivam@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Loic Poulain nr_irqs_req is unused in MHI stack. Signed-off-by: Loic Poulain Reviewed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/init.c | 3 --- include/linux/mhi.h | 2 -- 2 files changed, 5 deletions(-) diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c index 103d51f35e28..0ffdebde8265 100644 --- a/drivers/bus/mhi/core/init.c +++ b/drivers/bus/mhi/core/init.c @@ -680,9 +680,6 @@ static int parse_ev_cfg(struct mhi_controller *mhi_cntrl, mhi_event++; } - /* We need IRQ for each event ring + additional one for BHI */ - mhi_cntrl->nr_irqs_req = mhi_cntrl->total_ev_rings + 1; - return 0; error_ev_cfg: diff --git a/include/linux/mhi.h b/include/linux/mhi.h index fb45a0ff9aa3..d4841e5a5f45 100644 --- a/include/linux/mhi.h +++ b/include/linux/mhi.h @@ -312,7 +312,6 @@ struct mhi_controller_config { * @total_ev_rings: Total # of event rings allocated * @hw_ev_rings: Number of hardware event rings * @sw_ev_rings: Number of software event rings - * @nr_irqs_req: Number of IRQs required to operate (optional) * @nr_irqs: Number of IRQ allocated by bus master (required) * @family_number: MHI controller family number * @device_number: MHI controller device number @@ -393,7 +392,6 @@ struct mhi_controller { u32 total_ev_rings; u32 hw_ev_rings; u32 sw_ev_rings; - u32 nr_irqs_req; u32 nr_irqs; u32 family_number; u32 device_number; From patchwork Tue Sep 29 17:52:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 11806483 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B1CD7112E for ; Tue, 29 Sep 2020 17:53:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8B79221734 for ; Tue, 29 Sep 2020 17:53:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="DjFYWvjC" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728353AbgI2Rxq (ORCPT ); Tue, 29 Sep 2020 13:53:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727863AbgI2Rxq (ORCPT ); Tue, 29 Sep 2020 13:53:46 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 714E4C0613D4 for ; Tue, 29 Sep 2020 10:53:45 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id q4so3062054pjh.5 for ; Tue, 29 Sep 2020 10:53:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=1xlErZ6+GH/dFW2F7UNH0x194BKPh+D1csCpYINewdA=; b=DjFYWvjCzk4vJuMNUoELofbluXc+tJlTIqeWiZqFuG0qJzcghYmUALWB/W36svkgeD 4m9SXbLYe+PaYYGLaFFzilIfBFnm07t8NrKVljtHm1nVa4kJrRJ6kyRJv63dmnmILr46 arQVrozZdTkjgB3gm9Kuj1IviJ/LWhxRJuLSUj9X6gv/BeQhWd76qY2Yr0KS3/0ci+ub Sq05T9J9ed3ZA966OOMBqPMNmXhWn2kJecBaJetVlxhFoNh1EP6ijafBSL51iOyQDhsF 6C95z28+5tg5H+X6hs2LD/GuUrieYh1ptqYpFg8cusW6KD1bmL9S3dINQ+h5m8A5Vqye SElg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=1xlErZ6+GH/dFW2F7UNH0x194BKPh+D1csCpYINewdA=; b=QXaV9O91GPHqlolKWgfN77mzdsWt3QGd/Wuf+yGmCy4Ob8pblcI8sCMhZy8TPmzpIW v1m0PCGEixpYzyPNe+Mn00AZnTM4+R+gVDkICUloYbcyKmS2dFyTUDXepvMXAdl+Io1n hbTizy6SVU+TcFVUqkKbveSMmDZogqI3mVD8bu/xfqjToEEGEntqyD3FbrWuwOtC5TcG 02wzUEENLoIc64yBupmJiLcCIdL/OgWZ2aOTYMeprgGnFdxwXTrN5tjOod494x0x/dEK TKXsz0SVz1vFKJTFLhK2hIxA3Re/pxkIbjezQK0nhLvlPpqsZbO4z/5hGrqW+tPMiRbr 2zIQ== X-Gm-Message-State: AOAM530CeNS8U8Hp5xqouyjvNJoaVx8to6wmsZGfPh5nHsM+BCeQvYNv qGGnHYb/QfSWena7YLpvQPf/ X-Google-Smtp-Source: ABdhPJwzl16pEcfLQjEvjYvCWYK6RsX8cE9zdfcNLujwvGydbR8HnZEUQHwZArxxAIP2SiEqUttKGw== X-Received: by 2002:a17:90a:1b62:: with SMTP id q89mr4995702pjq.74.1601402024910; Tue, 29 Sep 2020 10:53:44 -0700 (PDT) Received: from Mani-XPS-13-9360.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id r188sm6271046pfc.67.2020.09.29.10.53.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Sep 2020 10:53:44 -0700 (PDT) From: Manivannan Sadhasivam To: gregkh@linuxfoundation.org Cc: hemantk@codeaurora.org, bbhatt@codeaurora.org, linux-arm-msm@vger.kernel.org, jhugo@codeaurora.org, linux-kernel@vger.kernel.org, Manivannan Sadhasivam Subject: [PATCH v3 18/19] bus: mhi: core: Fix the building of MHI module Date: Tue, 29 Sep 2020 23:22:17 +0530 Message-Id: <20200929175218.8178-19-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200929175218.8178-1-manivannan.sadhasivam@linaro.org> References: <20200929175218.8178-1-manivannan.sadhasivam@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The Kbuild rule to build MHI should use the append operator. This fixes the below warning reported by Kbuild test bot. WARNING: modpost: missing MODULE_LICENSE() in drivers/bus/mhi/core/main.o WARNING: modpost: missing MODULE_LICENSE() in drivers/bus/mhi/core/pm.o WARNING: modpost: missing MODULE_LICENSE() in drivers/bus/mhi/core/boot.o Fixes: 0cbf260820fa ("bus: mhi: core: Add support for registering MHI controllers") Reported-by: kernel test robot Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/bus/mhi/core/Makefile b/drivers/bus/mhi/core/Makefile index 12c57ab3724c..c3feb4130aa3 100644 --- a/drivers/bus/mhi/core/Makefile +++ b/drivers/bus/mhi/core/Makefile @@ -1,4 +1,4 @@ -obj-$(CONFIG_MHI_BUS) := mhi.o +obj-$(CONFIG_MHI_BUS) += mhi.o mhi-y := init.o main.o pm.o boot.o mhi-$(CONFIG_MHI_BUS_DEBUG) += debugfs.o From patchwork Tue Sep 29 17:52:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 11806487 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 78D4C6CB for ; Tue, 29 Sep 2020 17:53:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 53320208B8 for ; Tue, 29 Sep 2020 17:53:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="DBlFCS79" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728113AbgI2Rxy (ORCPT ); Tue, 29 Sep 2020 13:53:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728662AbgI2Rxt (ORCPT ); Tue, 29 Sep 2020 13:53:49 -0400 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81A8CC0613D0 for ; Tue, 29 Sep 2020 10:53:49 -0700 (PDT) Received: by mail-pf1-x443.google.com with SMTP id q123so5332526pfb.0 for ; Tue, 29 Sep 2020 10:53:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=maouQTMrsxpLVka2tVtG0rlrDbgTOcw+DDAUcgByUy4=; b=DBlFCS792aAzgH+YUwYyG64zLj2k7P2a9/rWGSqHCFFdPuF5zjQJitPgucRktCcOif J6XBhlAKlusXgUvJMiMe5tT+Zr42S5N8wqv/9fL5Caxon8ra+EW8YTyrC/SSnz5OP5z4 0FlUaB2kBe7nziZMZKosh4/TLmwFwyUIwG90Q9QnrUBxHKaRCGt+ddjYVH5cJWD0bnSN 25rS9bIn91THpyIueoNDZHu5ZE7Myc+m1yVMPwjXv7RxqqNboopoE1F8rlbhAGVY2B0d eH8DFkXwo7LanUFcdBqvs0V+UkVS2WXCWC3wf2d4Mh4Pg8DZeIOu6kQP5m5yIqvFNFMd mCsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=maouQTMrsxpLVka2tVtG0rlrDbgTOcw+DDAUcgByUy4=; b=eFYVMGW/e7vNqIq7ka73LtcRrK9h04TzYxhWGkz87Mq3HJdsmDSQAgv3D5ZDzdAFsg w/V+IkyOkhezHyoS2xeppJxbFDPk+misjwMkSBGrScS7evCy+idEwBGWx2mRlU5ItQWC amPpUe5hwKuMNTfNGkygExwwrVhfVuf4oMQt9WyUtEL0h6H9urK1NBC8u1oGrkcT8s7S WTv9A9gEblsy+OA1SsC65hm0Ii7HHwD0BIxeRO0YNme7D0B0a4TAszhCKCqOdgTYu9aK qe0oZ9MbBysDSeR4D+4V/puC4SZ9Kn3iVWc3vfZOW6CVi2O+Z9G4XWCa77Sr4CcGW2eu 5fVA== X-Gm-Message-State: AOAM533RBJAzXK2Iz/5RXeKuuIW2O90DeqYXcC9AKrMSjSESvxYMtsHH Bv4d6DjFmtvOerjN+Tt5D4pc X-Google-Smtp-Source: ABdhPJwsPcrCsb5NI3bCKFLI703acgMqVlHrSNfzGVuqStm8g6hRHp/Fl6+Ulg+C/ABAgsA2FcdGFA== X-Received: by 2002:aa7:8051:0:b029:13e:d13d:a04e with SMTP id y17-20020aa780510000b029013ed13da04emr5027675pfm.20.1601402028950; Tue, 29 Sep 2020 10:53:48 -0700 (PDT) Received: from Mani-XPS-13-9360.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id r188sm6271046pfc.67.2020.09.29.10.53.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Sep 2020 10:53:48 -0700 (PDT) From: Manivannan Sadhasivam To: gregkh@linuxfoundation.org Cc: hemantk@codeaurora.org, bbhatt@codeaurora.org, linux-arm-msm@vger.kernel.org, jhugo@codeaurora.org, linux-kernel@vger.kernel.org, Loic Poulain , Manivannan Sadhasivam Subject: [PATCH v3 19/19] bus: mhi: debugfs: Print channel context read-pointer Date: Tue, 29 Sep 2020 23:22:18 +0530 Message-Id: <20200929175218.8178-20-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200929175218.8178-1-manivannan.sadhasivam@linaro.org> References: <20200929175218.8178-1-manivannan.sadhasivam@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Loic Poulain This value was missing in the channel debugfs output. Signed-off-by: Loic Poulain Reviewed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/debugfs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/bus/mhi/core/debugfs.c b/drivers/bus/mhi/core/debugfs.c index f50d73054db4..3a48801e01f4 100644 --- a/drivers/bus/mhi/core/debugfs.c +++ b/drivers/bus/mhi/core/debugfs.c @@ -115,8 +115,9 @@ static int mhi_debugfs_channels_show(struct seq_file *m, void *d) seq_printf(m, " type: 0x%x event ring: %u", chan_ctxt->chtype, chan_ctxt->erindex); - seq_printf(m, " base: 0x%llx len: 0x%llx wp: 0x%llx", - chan_ctxt->rbase, chan_ctxt->rlen, chan_ctxt->wp); + seq_printf(m, " base: 0x%llx len: 0x%llx rp: 0x%llx wp: 0x%llx", + chan_ctxt->rbase, chan_ctxt->rlen, chan_ctxt->rp, + chan_ctxt->wp); seq_printf(m, " local rp: 0x%pK local wp: 0x%pK db: 0x%pad\n", ring->rp, ring->wp,