From patchwork Wed Dec 2 09:41:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 335968 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp778033ejs; Wed, 2 Dec 2020 01:45:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJzIshBGUN5jemYpPrV2YrSSSZRnnLiHvC54guMtN3MRQQla7DYaadG1d37E7wAcGo7TYSr0 X-Received: by 2002:aa7:dcd2:: with SMTP id w18mr1800695edu.281.1606902305691; Wed, 02 Dec 2020 01:45:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606902305; cv=none; d=google.com; s=arc-20160816; b=KVxqscFh4nghugA7QJ0RAywYaB6Kg5wdEiQDLdSrbsV/PQWzExZgdFP6Gm8WYYB8SU ukFl5hTlRmgjuzufDXy8LsaMou9UGyulBji1erXPI26CFLD1x+Vg+pTGXfkLQDgasu4M KOu+wDZ32Gx68vvJFHay/qhpRoNJtDNT1BwHS4PR42EL1f42Hbzvsuu7aaVHtICGCSWE SHn0//scXjbk9b9tOailqi4GkQ2k1Jv66kL558i1eqFjdCDXXQzTYWjFaSlpneCLt3uH 1WeAU4VooXElkUdeCp5dyBDgHE0QeV192PRN8N0KrYt1tOcCzSH9bBG7G8e75zcCYoD+ TwPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=piBK26WWTtM+MfbHLM9kzA+YwSLGGZPEJLMRCXt48HI=; b=KKrnYvsPUWRx8TwnyMmPw0vaqtkykihOR/w0oNGrChR7qfIlKRWyc7H7+kGIMgfRac BuZUSeEZtcYICrF/UzDU261xaJ21iIvkBEuHRVmwOEnxMrzlPWFEZGRlLRins4lfc98v 8iFfu/4jOJ3joxk4GYbTdv/wKL2A9yKbAEWhdQ1Av7Bjd1QfAd9zp2I/kYW690dqJgfm F5hzwAAdEOoSl5FAFwt0Aec87sPnCF61R/NsvZIb4X78uEoWmgVlu2Mk4DvVF3hTS1Tl c2EbRI/FWDKCPYfNgu6imTlGtTFdMzDprDCDnxjoUbrkciP0pL6IIYnQKAK/KM/7W2i3 jRww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Aweua2qv; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id do13si531726ejc.286.2020.12.02.01.45.05; Wed, 02 Dec 2020 01:45:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Aweua2qv; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388378AbgLBJpE (ORCPT + 15 others); Wed, 2 Dec 2020 04:45:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388580AbgLBJog (ORCPT ); Wed, 2 Dec 2020 04:44:36 -0500 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 CBE04C08E9AA for ; Wed, 2 Dec 2020 01:43:33 -0800 (PST) Received: by mail-pg1-x544.google.com with SMTP id f17so754345pge.6 for ; Wed, 02 Dec 2020 01:43:33 -0800 (PST) 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 :mime-version:content-transfer-encoding; bh=piBK26WWTtM+MfbHLM9kzA+YwSLGGZPEJLMRCXt48HI=; b=Aweua2qvLI3vaGm2ogi1Ow8Aw954ahXaedQDSNlLz8Fb/qcv4oqHM+xvCR7KWxXr3U XcYy9hxRjZs4iDKq9GRsoOxWGsRmvFvKSwhyP+PNWEkoLknXp56P16MiqmC5v6WckZ51 TT+ueBy7NXTQRciXCLeXtgKd6vPS0Xi+jAGoMi9oAXK+0BVz3/qHqsn+gElkG7AMKx4N 7ze7DY2fWTmeE6+ESkJj2W7Ab+FF2I/GV4MjnR2FKqbsf0ZL5ZNhsskf7LYF6MBtG3Yv COFwNwYvcGdUfn/xk59XsOTL1PucwjUABO8vAg/xI9nFkm/GB52Xuf+P+9xdN2L2otG5 yEBg== 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:mime-version:content-transfer-encoding; bh=piBK26WWTtM+MfbHLM9kzA+YwSLGGZPEJLMRCXt48HI=; b=e/2guUXcyWv/r63QKc+U+MJrOoLftpq8okyWFqf7eAmLD1abtb0qvt4mYkg6Ae85t+ 3rohMZavYCNb/YJveAe5E1FYTNl0QC+AZocjLC87zP/2HEXkFVf+CwO7QVj5fvS8it57 8Nok3LeJ7Ls2vX7xEWvJXy8EbOag9JLe8bJ2locswS388BPujZJuJm4EaUsUwIpvuHvi ytzBCc9l1gHn6NBsWptW69uB7A1xE2L1rYCSvhaWyJoUaeEk7GzoBwbAUv1G8p7c9sHg 6D6YyjK0v72vI8408aclvn4DdTUeAbz6P+IWoqahW0VVL1E9+f85rNrxPp6AAgo+PNFY TlWA== X-Gm-Message-State: AOAM531NtthJayt7ylf/10Lp+/BbDVGV3o//dQsPtOPey0OlOya7QMEp jcNv/pKJ0kx58A8FkBF1zYtO X-Received: by 2002:a63:5941:: with SMTP id j1mr1918512pgm.59.1606902213344; Wed, 02 Dec 2020 01:43:33 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id bg8sm1393990pjb.52.2020.12.02.01.43.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2020 01:43:32 -0800 (PST) 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@linaro.org, Manivannan Sadhasivam Subject: [PATCH 17/29] bus: mhi: core: Prevent sending multiple RDDM entry callbacks Date: Wed, 2 Dec 2020 15:11:47 +0530 Message-Id: <20201202094159.107075-18-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201202094159.107075-1-manivannan.sadhasivam@linaro.org> References: <20201202094159.107075-1-manivannan.sadhasivam@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Bhaumik Bhatt If an mhi_power_down() is initiated after the device has entered RDDM and a status callback was provided for it, it is possible that another BHI interrupt fires while waiting for the MHI RESET to be cleared. If that happens, MHI host would have moved a "disabled" execution environment and the check to allow sending an RDDM status callback will pass when it is should not. Add a check to see if MHI is in an active state before proceeding. Signed-off-by: Bhaumik Bhatt Reviewed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/main.c | 4 ++++ 1 file changed, 4 insertions(+) -- 2.25.1 diff --git a/drivers/bus/mhi/core/main.c b/drivers/bus/mhi/core/main.c index 91f8b8d05a62..4eb93d8bea1d 100644 --- a/drivers/bus/mhi/core/main.c +++ b/drivers/bus/mhi/core/main.c @@ -401,6 +401,10 @@ irqreturn_t mhi_intvec_threaded_handler(int irq_number, void *priv) /* If device supports RDDM don't bother processing SYS error */ if (mhi_cntrl->rddm_image) { + /* host may be performing a device power down already */ + if (!mhi_is_active(mhi_cntrl)) + goto exit_intvec; + if (mhi_cntrl->ee == MHI_EE_RDDM && mhi_cntrl->ee != ee) { mhi_cntrl->status_cb(mhi_cntrl, MHI_CB_EE_RDDM); wake_up_all(&mhi_cntrl->state_event);