From patchwork Wed Dec 2 09:41:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 335945 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp777744ejs; Wed, 2 Dec 2020 01:44:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJxwDDtGvWpYEI/IdmfyQhPHpxVUN81za4mBOUclrpbmbbSAyAvvI4Dj4Xuz33tHtC74zWy1 X-Received: by 2002:a05:6402:312c:: with SMTP id dd12mr1743191edb.327.1606902278706; Wed, 02 Dec 2020 01:44:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606902278; cv=none; d=google.com; s=arc-20160816; b=I4RJRG3ntrb3KW/uRGhOpv63dRSPy73tFHewUz6jc76ZrKa+H7gccsys7r9h5gesZm p31sL6UHThoAU4sqHcUMo/xAAQzFxm37N5K8vKTZRIYvnMxuq0l1f+lfqaLUfQ9Ocz62 N1QN+7FiW0JBxsnrTpfpRriwSN3R7H4jc8SOMdDgGBIKtLp2Pi1KCj5XdsNSq3Wl4jpR VTVyC71VNCdkb+h/z3u3WXOrkMlS4jkHvNHQmyTjOksQzTmXkzGmq6W9ZfxlcMcVnqaF n2aBZGNSlluQ3AzBVdJzgvQf+43F3WFCoOkgcFuI+33OIHs7zkQa5EdjNS3DI0JyZs0+ +ylg== 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=60LQKWLOhut2/A3y4ySNOdu+taK30sHX8o3GbcmO8rM=; b=Hil8JarkoPQ5CHPUzA5J5JNbutPb4IcYu4BlAgab7jyQxt0+hcxCRrjWcAKY0oxZsd 4gsn93AnCB2yxXJ00YUp8RVm630HGd82zJucNvg9Yg3KxZ1yb5DuFKMWxqVCkb/MrtXp pvQzkDsabMuZ3x7WYdStmLxLqQTUUFtMu8zqX9AWr3Esp7F2zLzL1toaA0nRQgdLykDu Ex+7U5D3JwtZF5uv23isNmNz8x1sBeIkyYuGQFO7VUeHTp0C3/XfkSAXTU1oOzHj4+Fx WeEyP8KttmlZSsl2/05Xm+jvE9BCgyfkj2pwpjRqp22PJmwMBOZ3rc8cRSIaSNDTHoSw MZXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=d9R1vRwk; 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.44.38; Wed, 02 Dec 2020 01:44:38 -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=d9R1vRwk; 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 S2388033AbgLBJnK (ORCPT + 15 others); Wed, 2 Dec 2020 04:43:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729283AbgLBJnJ (ORCPT ); Wed, 2 Dec 2020 04:43:09 -0500 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 D8F6FC0613D6 for ; Wed, 2 Dec 2020 01:42:28 -0800 (PST) Received: by mail-pg1-x541.google.com with SMTP id g18so769744pgk.1 for ; Wed, 02 Dec 2020 01:42:28 -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=60LQKWLOhut2/A3y4ySNOdu+taK30sHX8o3GbcmO8rM=; b=d9R1vRwkudlYLEpv5gmZMu5opJHSxkSPC39ThAH5KCM4klo1r3DRhxPOQEODs1A900 sAMqEeTrzknWexSqltRRYgGHOMEQaBKQ2FLr7cucYFO7XFlk7/8S3/3bbVkEGQoDuDPN OYHsvwQK0TvGJcs1hwf6Ya98LSj/srHTddHhz6GbAgM2geB5bhUn1giACjlJfJwP2kA5 MWQCqecreDFmKVfNRSqOHfmG/NghbIQNSOdg+fm0sGu3Pye2XyE8eydnVjNaCrFQv2zZ xAJ7YUSQrdWI+n+oVRa+ppxHj5DRt3Yd9+Vej5JcWCWCb+k1hjdUUsP7YjByibVR9F5p wTYA== 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=60LQKWLOhut2/A3y4ySNOdu+taK30sHX8o3GbcmO8rM=; b=fukOVh4+/hqY/XJUDfzfgNp34LUgWkXNvGQtFOVC0C9QdmxdPLdAPUXKUBLWFs2Son 9Q+z+LOvYX4aRP1k7KI4TWAQ1fB8XClfrgkER5pdPvm4f00tK3xpwISyBOniwI1OplAR mO6hjnTP6uS3BV01bvG/42a27joPGBJxvjiqnOj0Yucx5eZoXY5KBN43ST+hxSsIyAJ9 wV4ZBXdxdEip/puZe32NFZqnSSW+Y4emPsciauFBJBrRt3p9vUE51Np9UFXsRXRGoGDc 80+ePaq37cEOwgtKGNityT4E29HofjYmJCtoVVJLqoNbLdFbTWceRr/aA8ug0Chl3CTp Preg== X-Gm-Message-State: AOAM530SHmGxZTLIopLgE+uk5sGZ9xm/OwA8IbXWA8gYx5Ul/wcaqzSE u5c73tXRCD0PoAfm93Dcwvm5 X-Received: by 2002:a63:d357:: with SMTP id u23mr1885676pgi.106.1606902148405; Wed, 02 Dec 2020 01:42:28 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id bg8sm1393990pjb.52.2020.12.02.01.42.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2020 01:42:27 -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, Kalle Valo , Manivannan Sadhasivam Subject: [PATCH 01/29] bus: mhi: Remove auto-start option Date: Wed, 2 Dec 2020 15:11:31 +0530 Message-Id: <20201202094159.107075-2-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: Loic Poulain There is really no point having an auto-start for channels. This is confusing for the device drivers, some have to enable the channels, others don't have... and waste resources (e.g. pre allocated buffers) that may never be used. This is really up to the MHI device(channel) driver to manage the state of its channels. While at it, let's also remove the auto-start option from ath11k mhi controller. Signed-off-by: Loic Poulain Acked-by: Kalle Valo Reviewed-by: Manivannan Sadhasivam [mani: clubbed ath11k change] Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/init.c | 9 --------- drivers/bus/mhi/core/internal.h | 1 - drivers/net/wireless/ath/ath11k/mhi.c | 4 ---- include/linux/mhi.h | 2 -- 4 files changed, 16 deletions(-) -- 2.25.1 diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c index 0ffdebde8265..381fdea2eb9f 100644 --- a/drivers/bus/mhi/core/init.c +++ b/drivers/bus/mhi/core/init.c @@ -758,7 +758,6 @@ static int parse_ch_cfg(struct mhi_controller *mhi_cntrl, mhi_chan->offload_ch = ch_cfg->offload_channel; mhi_chan->db_cfg.reset_req = ch_cfg->doorbell_mode_switch; mhi_chan->pre_alloc = ch_cfg->auto_queue; - mhi_chan->auto_start = ch_cfg->auto_start; /* * If MHI host allocates buffers, then the channel direction @@ -1160,11 +1159,6 @@ static int mhi_driver_probe(struct device *dev) goto exit_probe; ul_chan->xfer_cb = mhi_drv->ul_xfer_cb; - if (ul_chan->auto_start) { - ret = mhi_prepare_channel(mhi_cntrl, ul_chan); - if (ret) - goto exit_probe; - } } ret = -EINVAL; @@ -1198,9 +1192,6 @@ static int mhi_driver_probe(struct device *dev) if (ret) goto exit_probe; - if (dl_chan && dl_chan->auto_start) - mhi_prepare_channel(mhi_cntrl, dl_chan); - mhi_device_put(mhi_dev); return ret; diff --git a/drivers/bus/mhi/core/internal.h b/drivers/bus/mhi/core/internal.h index 7989269ddd96..33c23203c531 100644 --- a/drivers/bus/mhi/core/internal.h +++ b/drivers/bus/mhi/core/internal.h @@ -563,7 +563,6 @@ struct mhi_chan { bool configured; bool offload_ch; bool pre_alloc; - bool auto_start; bool wake_capable; }; diff --git a/drivers/net/wireless/ath/ath11k/mhi.c b/drivers/net/wireless/ath/ath11k/mhi.c index aded9a719d51..47a1ce1bee4f 100644 --- a/drivers/net/wireless/ath/ath11k/mhi.c +++ b/drivers/net/wireless/ath/ath11k/mhi.c @@ -24,7 +24,6 @@ static struct mhi_channel_config ath11k_mhi_channels[] = { .offload_channel = false, .doorbell_mode_switch = false, .auto_queue = false, - .auto_start = false, }, { .num = 1, @@ -39,7 +38,6 @@ static struct mhi_channel_config ath11k_mhi_channels[] = { .offload_channel = false, .doorbell_mode_switch = false, .auto_queue = false, - .auto_start = false, }, { .num = 20, @@ -54,7 +52,6 @@ static struct mhi_channel_config ath11k_mhi_channels[] = { .offload_channel = false, .doorbell_mode_switch = false, .auto_queue = false, - .auto_start = true, }, { .num = 21, @@ -69,7 +66,6 @@ static struct mhi_channel_config ath11k_mhi_channels[] = { .offload_channel = false, .doorbell_mode_switch = false, .auto_queue = true, - .auto_start = true, }, }; diff --git a/include/linux/mhi.h b/include/linux/mhi.h index d4841e5a5f45..6522a4adc794 100644 --- a/include/linux/mhi.h +++ b/include/linux/mhi.h @@ -214,7 +214,6 @@ enum mhi_db_brst_mode { * @offload_channel: The client manages the channel completely * @doorbell_mode_switch: Channel switches to doorbell mode on M0 transition * @auto_queue: Framework will automatically queue buffers for DL traffic - * @auto_start: Automatically start (open) this channel * @wake-capable: Channel capable of waking up the system */ struct mhi_channel_config { @@ -232,7 +231,6 @@ struct mhi_channel_config { bool offload_channel; bool doorbell_mode_switch; bool auto_queue; - bool auto_start; bool wake_capable; }; From patchwork Wed Dec 2 09:41:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 335946 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp777761ejs; Wed, 2 Dec 2020 01:44:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJz7WT7FmNXNfw5+wDcc4eaoyZWRvSrBc8FSsRJ3/dNVrXjgZJczlUnw4wBSkzJrI2+gepsu X-Received: by 2002:a05:6402:19b4:: with SMTP id o20mr1751520edz.103.1606902280379; Wed, 02 Dec 2020 01:44:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606902280; cv=none; d=google.com; s=arc-20160816; b=P+JnRJSnf4jpTPhNRmafhWid4r/FdSkjwPrXFStVZmJ8B7ASUXE9txxZd/4HRABfdI onYqs+YqkvMDqTd67IFtRrRg5lM1Vk80vwCV0ygmoX6DFZp7UkT9POPQDLPbFo/lHlt9 ZCJLvk2VMDzaWofjaW4/I0TgxzT9QcblfG16QSk159p/G9STuMG423W0lZt7YXhDsaJ3 Nsb1bAHqeMbBy8MmYCzKQ456SHw2ViQ41NuyNx6D0u6Fylmlw8UNRo0b1uCgYrQ6an4Z 9xU/yBP6psGgsswAwBZjVu315Msl+hxL2NpuXgCa6opn+Tcd0xEFu27mw26UGm/vBGxU 50Zg== 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=hhWOGsCeI+HSWEvhDneQIbO6o/toOvKW/eQPadkWVL8=; b=pBngvjwU96VYh+CjQSx7DA9ySynsKQ0iLOhmc1NWM6w5qS+9ELoXAzP1wDbDutM2vB UpphNpcmbOffTXxZa1ZXy2Lu9TZCkAN7yzGYkVnhlMwrta0XXHnJwh505yH68ft2jMBD 7sbvcJAVfYnklGZUz/kRoMDZ5tmm3sodPYGOlhpuEYcQIeLg7jOMhQACgVkQ+Cqh0eng BsRE5CFvkXIlwCPeXZiPdgcrR44m+cNa7izX4JJpfRASIE5NmzkQMo2nBVp53xvUDzjs JOKm+Bg42l7GrPCwkGuZ1nOFgr86kXiPK85hPiSB++AmdAMo7WIHhJeK7moGlAUhsZmg ueKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sMHsqd84; 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.44.40; Wed, 02 Dec 2020 01:44:40 -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=sMHsqd84; 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 S1729283AbgLBJnq (ORCPT + 15 others); Wed, 2 Dec 2020 04:43:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727219AbgLBJnp (ORCPT ); Wed, 2 Dec 2020 04:43:45 -0500 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A2BCC061A04 for ; Wed, 2 Dec 2020 01:42:33 -0800 (PST) Received: by mail-pl1-x643.google.com with SMTP id r2so830118pls.3 for ; Wed, 02 Dec 2020 01:42: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=hhWOGsCeI+HSWEvhDneQIbO6o/toOvKW/eQPadkWVL8=; b=sMHsqd84F90wtO1XKZOardsS6wf+SqJDnu9gf1RtjRGgzhOwjJwULiEWzy4BPtflbi j3kVTr2S5hnz6pOehmu8D6AL7WSyO49VlPjM9cuyvRLa1pidTb+5SSTXQMK4TPRvGlEW +ch9g6ht++BIyDNS3xJC531s+FYDpDrmofUUZl928V1PH6pAwCijER+QPMaybT3vPbi1 Wcfkh1QNgPKFl7wAPYzjYom/F9St2PhRZ+OfZ39AeJ7jv5O9Gsr1WUWrsPFsFwp3BKyq f6prqZbWqh6Y9iGd0PgMI+0Vi75aHzHsXGcEupAHlhtjsxXQLrnaMp2Ld/JGNaWzsAqt W0RA== 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=hhWOGsCeI+HSWEvhDneQIbO6o/toOvKW/eQPadkWVL8=; b=iywS7bJHLYAf6RWLIGPhFdD7z1t8Tunzb6xbzos9jDTp8F6sn8oPZ31Fm2XogHeOjQ rCAwKVG4WF/QeAhmLkB1sQen2oIpGPPhUCffDo5j/ERdtpdI6kD/atZvcubg4LZSZoOC H6Bjmgst7T1lWRoZmeBhFZjxK0X18KIsulDmo/SzTZBk4ns+E9nkwbqCFIQoRaJMJWPC cdgcKt/kJuxFEV5IqK+klFG2R0Gwyw62+ltVMNwcGYPzwAP7FaUoQwUxykPY/I8NexqW Y0XJuW9g0Sdjuuq0B1kh8JKRM4ld7zbGhneKXs3Ej4b8U41CvXYh9oF/pDsorTPmeLCA DQ3Q== X-Gm-Message-State: AOAM5323fQsXdOHZDEPrjhwrG1nAnw5I/Sqzz6kOoTE9gu5oV5iiujXN Y2UEQ6wurRqA3OyJrDKhm7m/ X-Received: by 2002:a17:902:aa02:b029:da:a2fc:413e with SMTP id be2-20020a170902aa02b02900daa2fc413emr1786374plb.5.1606902152819; Wed, 02 Dec 2020 01:42:32 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id bg8sm1393990pjb.52.2020.12.02.01.42.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2020 01:42:31 -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 , "David S . Miller" Subject: [PATCH 02/29] net: qrtr: Start MHI channels during init Date: Wed, 2 Dec 2020 15:11:32 +0530 Message-Id: <20201202094159.107075-3-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: Loic Poulain Start MHI device channels so that transfers can be performed. The MHI stack does not auto-start channels anymore. Signed-off-by: Loic Poulain Reviewed-by: Manivannan Sadhasivam Acked-by: David S. Miller Signed-off-by: Manivannan Sadhasivam --- net/qrtr/mhi.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.25.1 diff --git a/net/qrtr/mhi.c b/net/qrtr/mhi.c index ff0c41467fc1..7100f0bac4c6 100644 --- a/net/qrtr/mhi.c +++ b/net/qrtr/mhi.c @@ -76,6 +76,11 @@ static int qcom_mhi_qrtr_probe(struct mhi_device *mhi_dev, struct qrtr_mhi_dev *qdev; int rc; + /* start channels */ + rc = mhi_prepare_for_transfer(mhi_dev); + if (rc) + return rc; + qdev = devm_kzalloc(&mhi_dev->dev, sizeof(*qdev), GFP_KERNEL); if (!qdev) return -ENOMEM; From patchwork Wed Dec 2 09:41:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 335947 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp777768ejs; Wed, 2 Dec 2020 01:44:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJz5FDTpEc3pVG10WukrqKxn7O4tYhZI/00C7Eu/xutkIjncb9ZRrhDYzRs2Ij3CpJ130nT4 X-Received: by 2002:a17:906:7f13:: with SMTP id d19mr1566277ejr.54.1606902280889; Wed, 02 Dec 2020 01:44:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606902280; cv=none; d=google.com; s=arc-20160816; b=y8l/zMk8KkMHuHJ2zMQRA5dxYd6bxY5MCq7wcx7vQHSLzHLYTQ3JBGocuPrrVIJit5 CjN7FfS0cZwxzsFzi8MnRh//MTMEVLzkghvPvOpSvxuWif8k6x08vQ3ZbROcBccgxQQT 0aBreUQWXdJQEMylSUsC0NnK0PTxg+tunGbvAIz2WVqf3TaluhUXpv3YLRKMXTbbG4/2 a4zvkXGZmYxMRYDUkHMLLR7/H0LT3sLhl2uSSIQ/y/l6KmllVNQcKr0dowLbRoHYcS04 jZ7i4ohMySXJ4kRyJWe5sR2yfI1lCDtVPEF/MwDuKBhfhQx0aPxOTdK6Mlk3/fiMZJD+ F16w== 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=RE5w69On3Eny/j1GWLpJs16JP4zJIqHV3HKQLkmEnls=; b=waPQ9klxPY9IabhPy4G0fuB68QlbdC9Y40pRf78OBFW2hDspR/TNhZ2wH3nLKw64U9 sCzBo7PfHHW0Co1odP9x5a/48ZdXGsUWQ568y5bL9TrU1CxPoLrFoC76wk/e1RyD6S4m hJKq2JkaPRPQgFmw2EEEKys7AmP5cYg+Vl00s/Z/RAdd+cyNgxF/VOy5nZ70Y37LIz7F F5Wh8xSszl41QzOmKXSeTVJysGNLTbU0nEClGF/eqpxo/a3q9E7nDD15Tlu3qTTKnVkP U/8Ug20BEjaWs7pFpcvIIYHgd9AN30DQHa1bdAUFuZedR3IqxCqOKi9yVLfOc3L/LYsv MmEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JPPSNoTR; 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.44.40; Wed, 02 Dec 2020 01:44:40 -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=JPPSNoTR; 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 S1727219AbgLBJnq (ORCPT + 15 others); Wed, 2 Dec 2020 04:43:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728493AbgLBJnp (ORCPT ); Wed, 2 Dec 2020 04:43:45 -0500 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 26E47C061A48 for ; Wed, 2 Dec 2020 01:42:37 -0800 (PST) Received: by mail-pj1-x1044.google.com with SMTP id r9so694006pjl.5 for ; Wed, 02 Dec 2020 01:42:37 -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=RE5w69On3Eny/j1GWLpJs16JP4zJIqHV3HKQLkmEnls=; b=JPPSNoTRmp/EUqlKK0tgYpFwxrc2r5uK3JCoBu+cCeT+rtSa4GsKf2KYLttB8xNAb/ NyZAXoaACHSI9gFMtlnxN+8C52a7YDQapSGExgEosRAAioaQmRgHdwua2u48UiyFUu9c H994PptDsvu2E79UUWTOUWrNxd+e8BJHcTS5uIsXBc0lGsJ5FevHk1FaKI2ik5mwGcPn agEz6TbsxGJ6jm2JUFYqi0vubpE8zqkLAvzZfxuYWQpwwMNxmJEmACFwMtIAF/F3t5uA qqh7bQ3elan9mzomtma6EgtOzWMugcXyS5HwdMN6dJf2nTMM6+3ur3Qsa5YZpkmDzbaO 0J3A== 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=RE5w69On3Eny/j1GWLpJs16JP4zJIqHV3HKQLkmEnls=; b=ZyXRiiihsuMvwJqlUMvZuZngIt8R1f3S7LGpodPH4o9RpJE3lmyu6jqfXCBqwvuhOC SSneYkPAhchjrJylLt1wGSrqGH7lk59mFY8wq+9qcpNajD2CdWtT/Z5mTjLfu7eesZUR pkDrixPRMiCgS9+Mb9K0KKwCEWnl3EFvOhakc0qwYs65MLo8CbK/H9uuEs2MMciBbDKn X0MfHzU0IkscSlGU38ZMPwHhNQpLgCMgCjmuZGeV3QNP0UVy9AsCm17ZDX1vQlMNe5fr yuc0raDYIvGShrZMyM5TSEOeLl3WnL6X9MSNvOcNaImcx5pi2NLYTQKRPurf3gnuyPvj 3f/w== X-Gm-Message-State: AOAM532mz8OI+QzSYJ4rO9q5t5LIEmSkHi5H/0V3Hu60e3b4AHSall3M 4w26IsiVQ1EI6F52XLkQ1xT4 X-Received: by 2002:a17:902:7606:b029:da:246c:5bd8 with SMTP id k6-20020a1709027606b02900da246c5bd8mr1935031pll.27.1606902156684; Wed, 02 Dec 2020 01:42:36 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id bg8sm1393990pjb.52.2020.12.02.01.42.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2020 01:42:35 -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 03/29] bus: mhi: core: fix potential operator-precedence with BHI macros Date: Wed, 2 Dec 2020 15:11:33 +0530 Message-Id: <20201202094159.107075-4-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: Jeffrey Hugo The BHI_MSMHWID and BHI_OEMPKHASH macros take a value 'n' which is a BHI register index. If 'n' is an expression rather than a simple value, there can be an operator precedence issue which can result in the incorrect calculation of the register offset. Adding parentheses around the macro parameter can prevent such issues. Signed-off-by: Jeffrey Hugo Reviewed-by: Manivannan Sadhasivam Reviewed-by: Hemant Kumar Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/internal.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.25.1 diff --git a/drivers/bus/mhi/core/internal.h b/drivers/bus/mhi/core/internal.h index 7989269ddd96..78e4e84d6743 100644 --- a/drivers/bus/mhi/core/internal.h +++ b/drivers/bus/mhi/core/internal.h @@ -153,8 +153,8 @@ extern struct bus_type mhi_bus_type; #define BHI_SERIALNU (0x40) #define BHI_SBLANTIROLLVER (0x44) #define BHI_NUMSEG (0x48) -#define BHI_MSMHWID(n) (0x4C + (0x4 * n)) -#define BHI_OEMPKHASH(n) (0x64 + (0x4 * n)) +#define BHI_MSMHWID(n) (0x4C + (0x4 * (n))) +#define BHI_OEMPKHASH(n) (0x64 + (0x4 * (n))) #define BHI_RSVD5 (0xC4) #define BHI_STATUS_MASK (0xC0000000) #define BHI_STATUS_SHIFT (30) From patchwork Wed Dec 2 09:41:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 335948 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp777780ejs; Wed, 2 Dec 2020 01:44:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJzdLsQn7gS/2+c50HVZkicZHTknlscgSaxqyteTvB0l2qZPkx+jhYv6sW0ieEqn9zPnIX4Y X-Received: by 2002:a17:906:c312:: with SMTP id s18mr1508762ejz.185.1606902281480; Wed, 02 Dec 2020 01:44:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606902281; cv=none; d=google.com; s=arc-20160816; b=bWI7NrzznJYnmlnKwUCOwe+9pCoMRY1PyaAnB2ij9rmng5fjdF7O1l7RxMEHUSg0I/ ZfdCIqza6x5twHMANPOT3jauCE6WuwsDGDGZ3/zKAn6rEAX18afuaInfyBjMgfN9FW7v VX9uYdhrgkJuH5oCKy2yKqhBY/IAQ4vJZVTcNVwl7RRUZuJku/3k5YkDH2zsCSw4ptaa uzarVPFcQ5NZM0ejOett3x+p/ogrjgNI4Drpmg8IXFG1C347wkqro9t5sjbvt7ByfJFN ql9zJaW/ltVeLrpobngCOIGC+mlK0v3JSf2uEVFG5yQ/6+zvCblq7wmQa2I/mv9wlvXK a9Sw== 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=twBSQqdBeb4aH77F3Gv3t1i2uThCRPqZP5lsuqmm61Q=; b=WTUcwO6Pu98nWgyQTbzHUv37tiXC8iN/OSHT1giEHsh7JRiYbQlVGDSLcHeU9in6AB dxYa4oEc1jBnpdsGEp0pKyTcjdC8qCuBIrQA0qu4CsvNNpnvYvyUtfSRSHpM7mRQtJ6V l6yHVpCLY56CaqV15OF7i3Cg4ZMA5IBGkZSrpLzX4R5XQ9XBphW8XFzDoP0ZT/RmjH+Q gl7HSoMujB2dJdjX6kZP1PP9GHA0ct55rtlTK1hrGD+P1DVfe77uAwzxVmZ5IavqwpeX PFmv2K305+D8D/z+/YqAkCF9I6OrU7r8SjWOK41aGFSJzHauYEUzp9k72YKZGAeqsaoB c77A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="bOkp/+1W"; 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.44.41; Wed, 02 Dec 2020 01:44:41 -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="bOkp/+1W"; 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 S1728493AbgLBJnr (ORCPT + 15 others); Wed, 2 Dec 2020 04:43:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729255AbgLBJnp (ORCPT ); Wed, 2 Dec 2020 04:43:45 -0500 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 491B7C061A49 for ; Wed, 2 Dec 2020 01:42:41 -0800 (PST) Received: by mail-pl1-x644.google.com with SMTP id bj5so827112plb.4 for ; Wed, 02 Dec 2020 01:42:41 -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=twBSQqdBeb4aH77F3Gv3t1i2uThCRPqZP5lsuqmm61Q=; b=bOkp/+1WmakXprMGBpqqv9DL6gkptze602ykS8GYE+WfhAFAaKl4u3hQe4UZyjIXOE arw3npdDW2K3hIKFvhpxrCdHZ1XbkMWuo13JJp9ejLtr/ZzAep0MJlr77VxuWJE3MmQ3 UP1VkGFXRhjwdidtRWd3+flLCj38ANSnWA1NvLvbQLoq3GFGmbXz8evM0SoRYFc/F8cM ehSNpWTwL7y5J79eMoF1sOchMElDR5uDEdY34rEi4t4BsxJfgJ/A7901kca3dAUJ0DSe MLNfkPYUsoqNqATFMY4zoyQjbdb/olRGgJ0OzRT0IXAES+hWJTAhBArgh05eN5yvesJX vlbg== 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=twBSQqdBeb4aH77F3Gv3t1i2uThCRPqZP5lsuqmm61Q=; b=F6JNo6gGWWx6IXNEVxv7oc8Di1NgtDvw3JBVyFAs6+sSDIpq72KAN+DNGuZfU5EUZE 9SX3G5q55SEjK0a6+Wn4OE7SC86EHsK+rPzDEcglGfUYvtSYz1fcNDmajpUAAeX+XWPS eUJbjAE/7XuBF1HfLOZMV7sZsS9YHPZbxJXWzXbEPD1jKSj0uiHuTF4/oYQfsqQftxD0 2eI/JZllv7QICiR+9OrUnnubI4yaWgl4Z4CFPT51npyiDHUeab1PxYTtyCalxpXOm3US Jq2n9D2M8A/pIpA8OviGFJsJlqaqQJSgTKDXtwNNqKzgYCANT8hGN2HN+xpe72xx8h0w lsjw== X-Gm-Message-State: AOAM530ci0jLF2Qb9liaBZ8RDMOTNW5c15xsJBol93kYApK5tbwYyEfb 0/d5xNRrn6dPiMyXYNfhhJIB X-Received: by 2002:a17:90a:19d5:: with SMTP id 21mr1571662pjj.187.1606902160705; Wed, 02 Dec 2020 01:42:40 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id bg8sm1393990pjb.52.2020.12.02.01.42.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2020 01:42:39 -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 04/29] bus: mhi: Add MHI PCI support for WWAN modems Date: Wed, 2 Dec 2020 15:11:34 +0530 Message-Id: <20201202094159.107075-5-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: Loic Poulain This is a generic MHI-over-PCI controller driver for MHI only devices such as QCOM modems. For now it supports registering of Qualcomm SDX55 based PCIe modules. The MHI channels have been extracted from mhi downstream driver. This driver is for MHI-only devices which have all functionalities exposed through MHI channels and accessed by the corresponding MHI device drivers (no out-of-band communication). Signed-off-by: Loic Poulain Reviewed-by: Bhaumik Bhatt Reviewed-by: Hemant Kumar Reviewed-by: Manivannan Sadhasivam [mani: fixed up the Makefile rule] Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/Kconfig | 9 + drivers/bus/mhi/Makefile | 4 + drivers/bus/mhi/pci_generic.c | 345 ++++++++++++++++++++++++++++++++++ 3 files changed, 358 insertions(+) create mode 100644 drivers/bus/mhi/pci_generic.c -- 2.25.1 diff --git a/drivers/bus/mhi/Kconfig b/drivers/bus/mhi/Kconfig index e841c1097fb4..da5cd0c9fc62 100644 --- a/drivers/bus/mhi/Kconfig +++ b/drivers/bus/mhi/Kconfig @@ -20,3 +20,12 @@ config MHI_BUS_DEBUG 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. + +config MHI_BUS_PCI_GENERIC + tristate "MHI PCI controller driver" + depends on MHI_BUS + depends on PCI + help + This driver provides MHI PCI controller driver for devices such as + Qualcomm SDX55 based PCIe modems. + diff --git a/drivers/bus/mhi/Makefile b/drivers/bus/mhi/Makefile index 19e6443b72df..0a2d778d6fb4 100644 --- a/drivers/bus/mhi/Makefile +++ b/drivers/bus/mhi/Makefile @@ -1,2 +1,6 @@ # core layer obj-y += core/ + +obj-$(CONFIG_MHI_BUS_PCI_GENERIC) += mhi_pci_generic.o +mhi_pci_generic-y += pci_generic.o + diff --git a/drivers/bus/mhi/pci_generic.c b/drivers/bus/mhi/pci_generic.c new file mode 100644 index 000000000000..e3df838c3c80 --- /dev/null +++ b/drivers/bus/mhi/pci_generic.c @@ -0,0 +1,345 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * MHI PCI driver - MHI over PCI controller driver + * + * This module is a generic driver for registering MHI-over-PCI devices, + * such as PCIe QCOM modems. + * + * Copyright (C) 2020 Linaro Ltd + */ + +#include +#include +#include +#include + +#define MHI_PCI_DEFAULT_BAR_NUM 0 + +/** + * struct mhi_pci_dev_info - MHI PCI device specific information + * @config: MHI controller configuration + * @name: name of the PCI module + * @fw: firmware path (if any) + * @edl: emergency download mode firmware path (if any) + * @bar_num: PCI base address register to use for MHI MMIO register space + * @dma_data_width: DMA transfer word size (32 or 64 bits) + */ +struct mhi_pci_dev_info { + const struct mhi_controller_config *config; + const char *name; + const char *fw; + const char *edl; + unsigned int bar_num; + unsigned int dma_data_width; +}; + +#define MHI_CHANNEL_CONFIG_UL(ch_num, ch_name, el_count, ev_ring) \ + { \ + .num = ch_num, \ + .name = ch_name, \ + .num_elements = el_count, \ + .event_ring = ev_ring, \ + .dir = DMA_TO_DEVICE, \ + .ee_mask = BIT(MHI_EE_AMSS), \ + .pollcfg = 0, \ + .doorbell = MHI_DB_BRST_DISABLE, \ + .lpm_notify = false, \ + .offload_channel = false, \ + .doorbell_mode_switch = false, \ + } \ + +#define MHI_CHANNEL_CONFIG_DL(ch_num, ch_name, el_count, ev_ring) \ + { \ + .num = ch_num, \ + .name = ch_name, \ + .num_elements = el_count, \ + .event_ring = ev_ring, \ + .dir = DMA_FROM_DEVICE, \ + .ee_mask = BIT(MHI_EE_AMSS), \ + .pollcfg = 0, \ + .doorbell = MHI_DB_BRST_DISABLE, \ + .lpm_notify = false, \ + .offload_channel = false, \ + .doorbell_mode_switch = false, \ + } + +#define MHI_EVENT_CONFIG_CTRL(ev_ring) \ + { \ + .num_elements = 64, \ + .irq_moderation_ms = 0, \ + .irq = (ev_ring) + 1, \ + .priority = 1, \ + .mode = MHI_DB_BRST_DISABLE, \ + .data_type = MHI_ER_CTRL, \ + .hardware_event = false, \ + .client_managed = false, \ + .offload_channel = false, \ + } + +#define MHI_EVENT_CONFIG_DATA(ev_ring) \ + { \ + .num_elements = 128, \ + .irq_moderation_ms = 5, \ + .irq = (ev_ring) + 1, \ + .priority = 1, \ + .mode = MHI_DB_BRST_DISABLE, \ + .data_type = MHI_ER_DATA, \ + .hardware_event = false, \ + .client_managed = false, \ + .offload_channel = false, \ + } + +#define MHI_EVENT_CONFIG_HW_DATA(ev_ring, ch_num) \ + { \ + .num_elements = 128, \ + .irq_moderation_ms = 5, \ + .irq = (ev_ring) + 1, \ + .priority = 1, \ + .mode = MHI_DB_BRST_DISABLE, \ + .data_type = MHI_ER_DATA, \ + .hardware_event = true, \ + .client_managed = false, \ + .offload_channel = false, \ + .channel = ch_num, \ + } + +static const struct mhi_channel_config modem_qcom_v1_mhi_channels[] = { + MHI_CHANNEL_CONFIG_UL(12, "MBIM", 4, 0), + MHI_CHANNEL_CONFIG_DL(13, "MBIM", 4, 0), + MHI_CHANNEL_CONFIG_UL(14, "QMI", 4, 0), + MHI_CHANNEL_CONFIG_DL(15, "QMI", 4, 0), + MHI_CHANNEL_CONFIG_UL(20, "IPCR", 8, 0), + MHI_CHANNEL_CONFIG_DL(21, "IPCR", 8, 0), + MHI_CHANNEL_CONFIG_UL(100, "IP_HW0", 128, 1), + MHI_CHANNEL_CONFIG_DL(101, "IP_HW0", 128, 2), +}; + +static const struct mhi_event_config modem_qcom_v1_mhi_events[] = { + /* first ring is control+data ring */ + MHI_EVENT_CONFIG_CTRL(0), + /* Hardware channels request dedicated hardware event rings */ + MHI_EVENT_CONFIG_HW_DATA(1, 100), + MHI_EVENT_CONFIG_HW_DATA(2, 101) +}; + +static const struct mhi_controller_config modem_qcom_v1_mhiv_config = { + .max_channels = 128, + .timeout_ms = 5000, + .num_channels = ARRAY_SIZE(modem_qcom_v1_mhi_channels), + .ch_cfg = modem_qcom_v1_mhi_channels, + .num_events = ARRAY_SIZE(modem_qcom_v1_mhi_events), + .event_cfg = modem_qcom_v1_mhi_events, +}; + +static const struct mhi_pci_dev_info mhi_qcom_sdx55_info = { + .name = "qcom-sdx55m", + .fw = "qcom/sdx55m/sbl1.mbn", + .edl = "qcom/sdx55m/edl.mbn", + .config = &modem_qcom_v1_mhiv_config, + .bar_num = MHI_PCI_DEFAULT_BAR_NUM, + .dma_data_width = 32 +}; + +static const struct pci_device_id mhi_pci_id_table[] = { + { PCI_DEVICE(PCI_VENDOR_ID_QCOM, 0x0306), + .driver_data = (kernel_ulong_t) &mhi_qcom_sdx55_info }, + { } +}; +MODULE_DEVICE_TABLE(pci, mhi_pci_id_table); + +static int mhi_pci_read_reg(struct mhi_controller *mhi_cntrl, + void __iomem *addr, u32 *out) +{ + *out = readl(addr); + return 0; +} + +static void mhi_pci_write_reg(struct mhi_controller *mhi_cntrl, + void __iomem *addr, u32 val) +{ + writel(val, addr); +} + +static void mhi_pci_status_cb(struct mhi_controller *mhi_cntrl, + enum mhi_callback cb) +{ + /* Nothing to do for now */ +} + +static int mhi_pci_claim(struct mhi_controller *mhi_cntrl, + unsigned int bar_num, u64 dma_mask) +{ + struct pci_dev *pdev = to_pci_dev(mhi_cntrl->cntrl_dev); + int err; + + err = pci_assign_resource(pdev, bar_num); + if (err) + return err; + + err = pcim_enable_device(pdev); + if (err) { + dev_err(&pdev->dev, "failed to enable pci device: %d\n", err); + return err; + } + + err = pcim_iomap_regions(pdev, 1 << bar_num, pci_name(pdev)); + if (err) { + dev_err(&pdev->dev, "failed to map pci region: %d\n", err); + return err; + } + mhi_cntrl->regs = pcim_iomap_table(pdev)[bar_num]; + + err = pci_set_dma_mask(pdev, dma_mask); + if (err) { + dev_err(&pdev->dev, "Cannot set proper DMA mask\n"); + return err; + } + + err = pci_set_consistent_dma_mask(pdev, dma_mask); + if (err) { + dev_err(&pdev->dev, "set consistent dma mask failed\n"); + return err; + } + + pci_set_master(pdev); + + return 0; +} + +static int mhi_pci_get_irqs(struct mhi_controller *mhi_cntrl, + const struct mhi_controller_config *mhi_cntrl_config) +{ + struct pci_dev *pdev = to_pci_dev(mhi_cntrl->cntrl_dev); + int nr_vectors, i; + int *irq; + + /* + * Alloc one MSI vector for BHI + one vector per event ring, ideally... + * No explicit pci_free_irq_vectors required, done by pcim_release. + */ + mhi_cntrl->nr_irqs = 1 + mhi_cntrl_config->num_events; + + nr_vectors = pci_alloc_irq_vectors(pdev, 1, mhi_cntrl->nr_irqs, PCI_IRQ_MSI); + if (nr_vectors < 0) { + dev_err(&pdev->dev, "Error allocating MSI vectors %d\n", + nr_vectors); + return nr_vectors; + } + + if (nr_vectors < mhi_cntrl->nr_irqs) { + dev_warn(&pdev->dev, "Not enough MSI vectors (%d/%d), use shared MSI\n", + nr_vectors, mhi_cntrl_config->num_events); + } + + irq = devm_kcalloc(&pdev->dev, mhi_cntrl->nr_irqs, sizeof(int), GFP_KERNEL); + if (!irq) + return -ENOMEM; + + for (i = 0; i < mhi_cntrl->nr_irqs; i++) { + int vector = i >= nr_vectors ? (nr_vectors - 1) : i; + + irq[i] = pci_irq_vector(pdev, vector); + } + + mhi_cntrl->irq = irq; + + return 0; +} + +static int mhi_pci_runtime_get(struct mhi_controller *mhi_cntrl) +{ + /* no PM for now */ + return 0; +} + +static void mhi_pci_runtime_put(struct mhi_controller *mhi_cntrl) +{ + /* no PM for now */ +} + +static int mhi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) +{ + const struct mhi_pci_dev_info *info = (struct mhi_pci_dev_info *) id->driver_data; + const struct mhi_controller_config *mhi_cntrl_config; + struct mhi_controller *mhi_cntrl; + int err; + + dev_dbg(&pdev->dev, "MHI PCI device found: %s\n", info->name); + + mhi_cntrl = mhi_alloc_controller(); + if (!mhi_cntrl) + return -ENOMEM; + + mhi_cntrl_config = info->config; + mhi_cntrl->cntrl_dev = &pdev->dev; + mhi_cntrl->iova_start = 0; + mhi_cntrl->iova_stop = DMA_BIT_MASK(info->dma_data_width); + mhi_cntrl->fw_image = info->fw; + mhi_cntrl->edl_image = info->edl; + + mhi_cntrl->read_reg = mhi_pci_read_reg; + mhi_cntrl->write_reg = mhi_pci_write_reg; + mhi_cntrl->status_cb = mhi_pci_status_cb; + mhi_cntrl->runtime_get = mhi_pci_runtime_get; + mhi_cntrl->runtime_put = mhi_pci_runtime_put; + + err = mhi_pci_claim(mhi_cntrl, info->bar_num, DMA_BIT_MASK(info->dma_data_width)); + if (err) + goto err_release; + + err = mhi_pci_get_irqs(mhi_cntrl, mhi_cntrl_config); + if (err) + goto err_release; + + pci_set_drvdata(pdev, mhi_cntrl); + + err = mhi_register_controller(mhi_cntrl, mhi_cntrl_config); + if (err) + goto err_release; + + /* MHI bus does not power up the controller by default */ + err = mhi_prepare_for_power_up(mhi_cntrl); + if (err) { + dev_err(&pdev->dev, "failed to prepare MHI controller\n"); + goto err_unregister; + } + + err = mhi_sync_power_up(mhi_cntrl); + if (err) { + dev_err(&pdev->dev, "failed to power up MHI controller\n"); + goto err_unprepare; + } + + return 0; + +err_unprepare: + mhi_unprepare_after_power_down(mhi_cntrl); +err_unregister: + mhi_unregister_controller(mhi_cntrl); +err_release: + mhi_free_controller(mhi_cntrl); + + return err; +} + +static void mhi_pci_remove(struct pci_dev *pdev) +{ + struct mhi_controller *mhi_cntrl = pci_get_drvdata(pdev); + + mhi_power_down(mhi_cntrl, true); + mhi_unprepare_after_power_down(mhi_cntrl); + mhi_unregister_controller(mhi_cntrl); + mhi_free_controller(mhi_cntrl); +} + +static struct pci_driver mhi_pci_driver = { + .name = "mhi-pci-generic", + .id_table = mhi_pci_id_table, + .probe = mhi_pci_probe, + .remove = mhi_pci_remove +}; +module_pci_driver(mhi_pci_driver); + +MODULE_AUTHOR("Loic Poulain "); +MODULE_DESCRIPTION("Modem Host Interface (MHI) PCI controller driver"); +MODULE_LICENSE("GPL"); From patchwork Wed Dec 2 09:41:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 335951 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp777822ejs; Wed, 2 Dec 2020 01:44:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJzmm/nsJ+Dz6Jqoyp1HdVh3L152lqqF3gSy8BUrd8qBmmN8+XMWt9lRp6gPKEjdDlU1DNtC X-Received: by 2002:a17:906:cd06:: with SMTP id oz6mr1485424ejb.25.1606902285924; Wed, 02 Dec 2020 01:44:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606902285; cv=none; d=google.com; s=arc-20160816; b=KeJu9boYhi4gqof3aX84HnTxhS+pCL78i2WpmHZY2qgImc9A1d9nB/OptkOq5YuKCU iucAE19nkEIvR37lwmWz5WPwVwRejOyMQnAUUSPCiAEAfRXnRaDboe5P5MLDV54fJBdp RIE+w8JXnjgr5ZBSq9rkgHBlhKZo7oUbwmCTceP6g2bGaJidTpHZ8i4rAgHWsIhbljZR NX1ixxb1j8axpufogYyoL4QwD8NRvBvkMK6frDCrK2yWvDN6omtIYUXsxo15v6bAMJaq tXVHFuuICPDALxPTFmeBNbOChU0huZXRfFSsWCXvgSYoRa0SZaVTz3Q8p1aCpkXy4cil 5lHQ== 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=0LsQFaATp5kPNt9O4pgdJHaJ3akqe6fvWiwrf87Kxp4=; b=XGlzVFHADx6N3ecT4sLu0Zl+tOV7bJkRwg1Esjf/9G97T7r6DK5qUXSw8+H4iq6tMk gw83RZ/nGoHdGLu9dek8tItpAXtS5D8a/KxDMq8Q7g9QDBNOitO4G40H27Bmdup/EUEa j734nODE1H8VtR9dtsHKVeS4XP27tHqBywWLN5oSQ3DAZs1MmyptO1ngmjcEPIYghsEJ tzq+ndrDQh7OXJ924I3SwQQcFvVmnFaRsy0reqzoWl0oHt7q8GphJhPjLnQFcZtKT1cW hb8obCvKmV76FXHKN9VsIMjvkR4Ad1JBpo2OaXWaLIyN9PRrc4fOTNsiVHDGFXr/trsY DmRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hKj+OAqh; 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.44.45; Wed, 02 Dec 2020 01:44:45 -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=hKj+OAqh; 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 S2388274AbgLBJn4 (ORCPT + 15 others); Wed, 2 Dec 2020 04:43:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388293AbgLBJnz (ORCPT ); Wed, 2 Dec 2020 04:43:55 -0500 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 433D0C061A4C for ; Wed, 2 Dec 2020 01:42:46 -0800 (PST) Received: by mail-pf1-x441.google.com with SMTP id 131so879814pfb.9 for ; Wed, 02 Dec 2020 01:42:46 -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=0LsQFaATp5kPNt9O4pgdJHaJ3akqe6fvWiwrf87Kxp4=; b=hKj+OAqhvuORH/zH/KUnQJ4X0Kfz7CN0EAUjbcR305J9Bd9GDJ6xEaDjXWCXrmgIJl Auqfpwa+o5bQLdGxbWsjL3Uxgc+01hl2lOr9dyQ5a2ON2BoPbHs8RNhqh7Hx5zOdioM3 s24OnkxpU6gTjh+vtL3EkvT6qvO7vhRCox9av/byOUhe8p8PpJCIcTeL56eBy25bjXtw EAmPU4z/SEz4C/HdhEmmAQVu1P16mOU4RV7K2PutZSXjBl3xNff77OTizeHjvQNfMpvC nvVQxiHWMdncUjWYnwOCdzcQDGq+A1L2hs/llM0WgHrv4wo0zT9VR99MzPX9Yx76cGWv 4bPA== 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=0LsQFaATp5kPNt9O4pgdJHaJ3akqe6fvWiwrf87Kxp4=; b=gDTadmRT3cmp5aRXMZhvwFruYMIHfwATf2Ci6NXuQaIZcb7k/oj7jXpPOKMj1Lcxxt vzFQ8mOqkSF1JQ9CZY9Y0bG9HzwSmI8YHlYp+qV5KSeZwU9O/dJeo5e/gN+Yz0qNYyCH WRlEZR0rBBoMtxVbtEDKOd/L56vhQtHo+pVRJ7jnjSVdJLRB50aEbCiwijU+ekrhQiT1 NGOIiWOLcSnNne8yVwrfOGU0GMM1UVoUkDvhQ9VX+RMCFNgT8EGwMFs413V5Ms6r4atO 10ASVf0Dc9MakOdSyFjNuRBvayN4269z8Cokplmr6yL8yEJuhXTEoKRn6nmC/bSJoTVy s3/g== X-Gm-Message-State: AOAM530GjDjm/BulwAy2kaGhJ+6A8je5YxIcahulQmhxhbuXZg8uU8Nd XRDQpEu5YrB65avCzw57prKr X-Received: by 2002:a63:211:: with SMTP id 17mr1942020pgc.56.1606902165559; Wed, 02 Dec 2020 01:42:45 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id bg8sm1393990pjb.52.2020.12.02.01.42.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2020 01:42:44 -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, Carl Yin , Manivannan Sadhasivam Subject: [PATCH 05/29] bus: mhi: core: Fix null pointer access when parsing MHI configuration Date: Wed, 2 Dec 2020 15:11:35 +0530 Message-Id: <20201202094159.107075-6-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: Carl Yin Functions parse_ev_cfg() and parse_ch_cfg() access mhi_cntrl->mhi_dev before it is set in function mhi_register_controller(), use cntrl_dev instead of mhi_dev. Fixes: 0cbf260820fa ("bus: mhi: core: Add support for registering MHI controllers") Signed-off-by: Carl Yin Reviewed-by: Bhaumik Bhatt Reviewed-by: Hemant Kumar Reviewed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.25.1 diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c index 0a09f8215057..8cefa359fccd 100644 --- a/drivers/bus/mhi/core/init.c +++ b/drivers/bus/mhi/core/init.c @@ -610,7 +610,7 @@ static int parse_ev_cfg(struct mhi_controller *mhi_cntrl, { struct mhi_event *mhi_event; const struct mhi_event_config *event_cfg; - struct device *dev = &mhi_cntrl->mhi_dev->dev; + struct device *dev = mhi_cntrl->cntrl_dev; int i, num; num = config->num_events; @@ -692,7 +692,7 @@ static int parse_ch_cfg(struct mhi_controller *mhi_cntrl, const struct mhi_controller_config *config) { const struct mhi_channel_config *ch_cfg; - struct device *dev = &mhi_cntrl->mhi_dev->dev; + struct device *dev = mhi_cntrl->cntrl_dev; int i; u32 chan; From patchwork Wed Dec 2 09:41:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 335949 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp777797ejs; Wed, 2 Dec 2020 01:44:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJz4IKqr+tf6rB2MA/gdLRpbhikVKfqzZs1fPI3B8ZRq317NtAPkysoDpzRSO7hpoC++IdWT X-Received: by 2002:a17:906:339a:: with SMTP id v26mr1470426eja.107.1606902283915; Wed, 02 Dec 2020 01:44:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606902283; cv=none; d=google.com; s=arc-20160816; b=MKPfAevBDjz6gFbsT4Hxzyshh7WZjt567+vAgj8LcrAbGIEggewuUssGOpfDXNC4u/ CFlBFw2AFijD3t66JB1I9iqfnVhetzcN0jB6HiwWTjPOrc/VaZxUH5fc1gt2JO7BmZcS KbDng1RbdgzrmdhjdzWmww5BLkMl9COnfSstbOEYFy+f0Tow9AAjezJ+vttYWJNFvRHk X5K7D8hBGgAYs8hjVQnGKUioP96jNWPO7dhb/sZvcR8/z+9vnbMg9uvWdz730zKTFLud MHkuhomPRke2vL2RwbNTowStNsIb405g6ZpLKRtqlhfW8IETW0fxiHkTkFBw3c1PNJRZ t5Bg== 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=a9WxRr8jkB2wGuvMfwAD98bfQ14aXLmD+0/WKbQaXe4=; b=QWyVCX7DU4yGQBO6V2+6+LL9Xj17ses2yUi3geytJFYchGKyuC8wQQ3us0uCm5mPrU pP+TBRrlFdc1OZjlzQc5jtTlRUyO54Lg8lj5N3Mf3TlikgJUwRdOg10dojupCXxa/LxO EewvYNjg8LCOx9NeW2pU/iE69p9I84jW7NxAzxN5PZcrVrod9vw1hABobSxRkOqor4us ndQcPgKRS2wwEc9AkkS/weRhUqEeYlNrNk37GTwuYlnzXB8X6N/Qxxo5wdcFRS9/jTpC n5vxH+gHaD9tB0s9eAdtUZY7YAzqanOPGmoLpyDTXF73lMDI+ts7azvcTEIdPVfW+MMb gRjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hRW1WU3n; 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.44.43; Wed, 02 Dec 2020 01:44:43 -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=hRW1WU3n; 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 S2388288AbgLBJny (ORCPT + 15 others); Wed, 2 Dec 2020 04:43:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388272AbgLBJny (ORCPT ); Wed, 2 Dec 2020 04:43:54 -0500 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D210C061A4E for ; Wed, 2 Dec 2020 01:42:50 -0800 (PST) Received: by mail-pl1-x643.google.com with SMTP id v3so800532plz.13 for ; Wed, 02 Dec 2020 01:42:50 -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=a9WxRr8jkB2wGuvMfwAD98bfQ14aXLmD+0/WKbQaXe4=; b=hRW1WU3nt5lfKPnDD/qK8hPtS2iJyA/FB0lhozVDGDkgRCGxIkJv9GiE7lKWLm38aV BhPml0+XlrBr5rIf9JxjIyWMRWcPgp/1R+Z1ch1N1TWOYGYkmf6yujUpNVcv+sg3divi o2nViVc+PBkwR9QrtdUs+ZZI7BSdTnTlYt/DIa57Jo+10O3xqQDu5BQ6x0XDB2a0ie9f jnEuhiTBGn7y6YCcwmFGlyTZRmQHuLK2jKPg9lZH6yci3MlHvMx/EHXG5L0Ide5+rsVj pm862D6OBl56yDQuz38dqzGtfuOW7MdF/KuF0ovzYAssZzvNdLqea7eMtGGabQZ2NUQE 4tMg== 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=a9WxRr8jkB2wGuvMfwAD98bfQ14aXLmD+0/WKbQaXe4=; b=H7YdEAPQBXZ4UlCITswYuS4ZVgmv8Q7XIxeXnV1ZDl2IkjpohrTCqV4Dhgw6vOWaG7 +nhDWkZ1FGzpFY+jUPMa+EonZqlF78HhqiqPNRADV/DfE2tABNtEkYIMDQspJX6wBFM5 5Kjd/zY86q0176fNMKeLRAQtstnoLR1J+LsWYTK8AQpYmI8R8M6l79mjOpKvoVEceu6w 3CWnZBqIgGO1/56pT7SpReb2zy4NV7uancWupNghQbv7rhBZx3QyLLLMyNdBH91jk1To B6tfKWl+phrrbxnBWaybzacf5tHI43+EmxxQSN/5U0WuuVyNVkHKBhOqJlbnqGIIRPEU zawg== X-Gm-Message-State: AOAM533nzKxs6MeGSkwkmHWL8MuDjXQfzHRBbRkYPMiuyxQNjjHoniBr UDBdcGTwse04ocDL04LSular X-Received: by 2002:a17:90a:8d86:: with SMTP id d6mr1647793pjo.120.1606902170185; Wed, 02 Dec 2020 01:42:50 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id bg8sm1393990pjb.52.2020.12.02.01.42.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2020 01:42:49 -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 06/29] bus: mhi: Fix channel close issue on driver remove Date: Wed, 2 Dec 2020 15:11:36 +0530 Message-Id: <20201202094159.107075-7-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: Loic Poulain Some MHI device drivers need to stop the channels in their driver remove callback (e.g. module unloading), but the unprepare function is aborted because MHI core moved the channels to suspended state prior calling driver remove callback. This prevents the driver to send a proper MHI RESET CHAN command to the device. Device is then unaware of the stopped state of these channels. This causes issue when driver tries to start the channels again (e.g. module is reloaded), since device considers channels as already started (inconsistent state). Fix this by allowing channel reset when channel is suspended. Signed-off-by: Loic Poulain Reviewed-by: Manivannan Sadhasivam Reviewed-by: Bhaumik Bhatt Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.25.1 diff --git a/drivers/bus/mhi/core/main.c b/drivers/bus/mhi/core/main.c index 2cff5ddff225..cea5eab83f48 100644 --- a/drivers/bus/mhi/core/main.c +++ b/drivers/bus/mhi/core/main.c @@ -1224,7 +1224,8 @@ static void __mhi_unprepare_channel(struct mhi_controller *mhi_cntrl, /* no more processing events for this channel */ mutex_lock(&mhi_chan->mutex); write_lock_irq(&mhi_chan->lock); - if (mhi_chan->ch_state != MHI_CH_STATE_ENABLED) { + if (mhi_chan->ch_state != MHI_CH_STATE_ENABLED && + mhi_chan->ch_state != MHI_CH_STATE_SUSPENDED) { write_unlock_irq(&mhi_chan->lock); mutex_unlock(&mhi_chan->mutex); return; From patchwork Wed Dec 2 09:41:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 335950 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp777806ejs; Wed, 2 Dec 2020 01:44:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJzlW1A6Nb4O5r/DBiEpDf8bwYxANjhlqgXCpD+Bv+1y74CPdhN65tO4JTZOcXGJdnnKDqXz X-Received: by 2002:aa7:d54a:: with SMTP id u10mr1755322edr.168.1606902284416; Wed, 02 Dec 2020 01:44:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606902284; cv=none; d=google.com; s=arc-20160816; b=GBRZ0ZJ5KHME0sZEb1VVA56pwX7lu6LIUAoU6pi7fbRmNlVoqkundBj31oeY3sZNMB QBBGjF+2HJWD4VvzgxgWmFetpgrU3ZNiinrqxYehTfoVJEjuTAvYzCywHBn51BIoZeZq qys6gSFoU2cwmweguLp7pKO42mOUvOz0XuH7md87Pu74gtQvBcbtcHcm/OwTUHTQfo+n ky/iOmkePO7s9Qx4zlp8J1Zp4J1YISoZQqNF/EF3lLV14UZy67L8L9Rd4dYN3o2eNAvT PiMrStFi0Gh7KhzTUuMWBkarvSo0ZtpUPbITmOwebzO1+FSSosXJGdJ7jeDrl/xrh4Uz alRg== 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=DLEpetMqROUc2OOQ0fVepK2+3FOFzdcD46Lm023xCZ4=; b=YEhEZpQUrsKyZX6xso3hN3L3AjdGxZaPgzw5iUvrZ0+AVR9Vw2u/LuAviXEGvHiX9N FDioLOYYyBuCjHDqFSHFPy49utHnsa+zXkWCCXb3hchJblkJnyhzcxS8fpyKLA+vOmhs V++IMIqNpbpF6L89xlA72zLiNUJrh+7skGsTQ5OkJuGt/naB/sWNdjaffC3Bwbtenupc gCmlD/H3UJ0xNBeMbPSpXx7ohaXWsOIydstW42frJ+8b6xL9NSy7t+b7jVJFW5Ubn1lO C6JDewRP5f59mk+so+oWxyl7pSQNVIEIaRT9ZlXWEyZHWiPwPPUR7EW8F8+4JBU/sq9L 3AEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sU60JdKX; 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.44.44; Wed, 02 Dec 2020 01:44:44 -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=sU60JdKX; 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 S2388300AbgLBJn4 (ORCPT + 15 others); Wed, 2 Dec 2020 04:43:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388274AbgLBJny (ORCPT ); Wed, 2 Dec 2020 04:43:54 -0500 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 D342FC061A4F for ; Wed, 2 Dec 2020 01:42:54 -0800 (PST) Received: by mail-pf1-x443.google.com with SMTP id b10so893959pfo.4 for ; Wed, 02 Dec 2020 01:42:54 -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=DLEpetMqROUc2OOQ0fVepK2+3FOFzdcD46Lm023xCZ4=; b=sU60JdKX1bMF/Sz7d8IzSVSDvOXsbOvwUI2moEbOr32zMImmIXisPR4ivQlpmM7GBD 8vU1N9taSa/VTd1x+vqPqF5yJ6oGdyP3GjJR8VNb5fncOJw3lqXP0LEsSN3Q4oYTen08 dUbgpk7gZuqw9j6ZLhcVGRUT2vwJIkRgR01Qcx4yhPc6xiIT/+hPfNfTYPchU9r4Y2E+ UP/6nNpdVg8yEy5zSUEwbuxuLZ5gTrxBE9pWgOaSiP+fXxcGewfU0N+dPTAOw06E2kf/ YKLPbK1jgLsfu9DbvxhXgf+J73zF3NMf/BGAk8IDgjaSwn72crV72GvqnVYcYkOnBNT0 584Q== 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=DLEpetMqROUc2OOQ0fVepK2+3FOFzdcD46Lm023xCZ4=; b=t8t3IyoMst77RD8suQgAAdMQKaV/ETyYc9W1drLaxMC/v5kCBbvUNj6Zn80DM7QAzx Yu5q6XKBEHSyezbZV3fg07XGIMoprjQ5stNh8drLeGMxDf/J9/ejSKtT/3Mmk4isCb57 DIupO7hcgl5nWOVR86PbabT1+KptqwR7rxhG36xxs0xoxIHMxO6HXnYoMG9WDib/wtQs ugthpl8hIWuWOqJYa3aE8AvKV48sqh/kcXFIbvSTwO+a6yCGc31uNzkO+fQKhwMwcnmg fmOfMH6IFyxxhaNVdJ+tPgg24XTxeXNr9P2grO5Ab7E/EB703mHALlgTEECMnkI2AxKw k2HA== X-Gm-Message-State: AOAM530ZTMmlYDjga3lIXU2ilXEFdNqlzCkx9Xh98wuMN0aq8BRv/OKf GV00KyILbPe8iCjoAo7mOnxq X-Received: by 2002:a63:c54e:: with SMTP id g14mr1900811pgd.398.1606902174395; Wed, 02 Dec 2020 01:42:54 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id bg8sm1393990pjb.52.2020.12.02.01.42.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2020 01:42:53 -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, kernel test robot , Manivannan Sadhasivam Subject: [PATCH 07/29] bus: mhi: core: Remove unnecessary counter from mhi_firmware_copy() Date: Wed, 2 Dec 2020 15:11:37 +0530 Message-Id: <20201202094159.107075-8-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 There is an extra 'i' counter in the mhi_firmware_copy() function which is unused. Remove it to clean-up code and reduce stack space as well as improve efficiency of the function. Fixes: cd457afb1667 ("bus: mhi: core: Add support for downloading firmware over BHIe") Reported-by: kernel test robot Signed-off-by: Bhaumik Bhatt Reviewed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/boot.c | 2 -- 1 file changed, 2 deletions(-) -- 2.25.1 diff --git a/drivers/bus/mhi/core/boot.c b/drivers/bus/mhi/core/boot.c index 24422f5c3d80..6b6fd9668c3b 100644 --- a/drivers/bus/mhi/core/boot.c +++ b/drivers/bus/mhi/core/boot.c @@ -365,7 +365,6 @@ static void mhi_firmware_copy(struct mhi_controller *mhi_cntrl, size_t remainder = firmware->size; size_t to_cpy; const u8 *buf = firmware->data; - int i = 0; struct mhi_buf *mhi_buf = img_info->mhi_buf; struct bhi_vec_entry *bhi_vec = img_info->bhi_vec; @@ -377,7 +376,6 @@ static void mhi_firmware_copy(struct mhi_controller *mhi_cntrl, buf += to_cpy; remainder -= to_cpy; - i++; bhi_vec++; mhi_buf++; } From patchwork Wed Dec 2 09:41:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 335957 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp777921ejs; Wed, 2 Dec 2020 01:44:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJwcCmKZXCy5AUQ+Hn8NcxxJEJgTy49syVvn9L1nnwGM7cZSdn8+uGF0c9DR2WjWU7NThs/w X-Received: by 2002:a17:906:1752:: with SMTP id d18mr1489825eje.529.1606902295632; Wed, 02 Dec 2020 01:44:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606902295; cv=none; d=google.com; s=arc-20160816; b=b0BJLi6ae1LWsZjZjyjJKeZknKxnwYVSVr3IQYnxRxMcB0Iz90SCW+ZZdzHGKmucvE 2V/pzJyRODNm9mS7MCyeYkOnYNLDwffori+ZXSrBt45tbHCSAYo4Hv0k8ome5SSai9i7 DxM3tFMQhE3E83sl5u0IYdyVKr0rIH1q27wJBzwe7lWWTUXIGYnR0Qb+2FFOGN3SCNVM PF2CHchCgJ+1RDRPXJGuKWxW0aOKJQ+wRYW1ZkfJXBAiRnFm7H4ebCjYJYp+VViJgCwv QdK7mWGeyGCktld4XuIE0OW2IhQSlOXm99af/2wgOcjQhupoD/bNuBVieL+oOFeVtKx9 /WWQ== 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=UISj8CWAL6pda/2do9TebmYyKaX57n+8YUGGANaX7W0=; b=tFjEJ8hSFlohhns3wts59AUv1mpaDTBudf33uLpSaAzR4afiSW1OhZqHlThT12uDtz TXzeqKaC17xkOMbwlgcCzpq0OG8/LjhxLYKIpE+R/iV+BALZGKuKbgg2ON1oENsMv9O2 tw1Y/+XqaBKcm7OHPmC1eemyStzVi6/sHJw/UabkeiQfTvY+HzawDIO4ZVM1nnmrrzdp m1CUR/FmaSqTQ1uaShCI4ZlN9XxSUDyl9LRgVq008t5AZx5XN4ZgfhnRn8KXuiVT/NRD yqiH6kCdXEcuOuu3zFE4GB2JYyT4AggKc7+zz3MHy7adVU4q3pLYyQpbPZUF4MoCKGzj 7fQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sLCmBPiQ; 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.44.55; Wed, 02 Dec 2020 01:44:55 -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=sLCmBPiQ; 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 S2388555AbgLBJod (ORCPT + 15 others); Wed, 2 Dec 2020 04:44:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388545AbgLBJob (ORCPT ); Wed, 2 Dec 2020 04:44:31 -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 9D727C061A52 for ; Wed, 2 Dec 2020 01:42:58 -0800 (PST) Received: by mail-pg1-x544.google.com with SMTP id e23so734447pgk.12 for ; Wed, 02 Dec 2020 01:42:58 -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=UISj8CWAL6pda/2do9TebmYyKaX57n+8YUGGANaX7W0=; b=sLCmBPiQlkMjcP5oGrJgKQzzo8uyPkgPRAqX4hAAQO50S5gr48ua4GeeKT99lfpxz1 GRCqFji/lR6xCQHHsURqW7hgPIRRnxdPONmT1rxwPPItHo2XYZNjGVy8kD3WEsMSQUFf xRA1og6GGg/tQBehyfIvZa5AT2wc0nVfQKSnxUDBX0zQlJgXOkPkhUG/Idcjrrexy42C JrNmBCcMnrTps1p3idxwuCCWF7blMxRsuAdXqqzs+iZHCgJ6ixU1NwEUzY64aUCzBOet qx/eH+u2OSr5H5dp0Cgs5CarR6uNe6q0j1msCeNEzzf/dJ9ZlhuF7qAChQo2+3PWeot0 g+SA== 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=UISj8CWAL6pda/2do9TebmYyKaX57n+8YUGGANaX7W0=; b=T21gOGuTMaCGPNnRT4YlbPsYuO2NnujwzQeZ8eVL4RxEar+yUfrYQB9RvVQK6QkFeC Xn4NZ2C0GWllnC4yu+Ey9p7I5zfjMiLEw/IwA1SPxdj9QVhEX+HOoXXrg0k4B08KGU85 pyVShsUBtxNvL1+wZeH53kGYlVZ3rEPLTlcqP72ff6peYLBcuYzZDDe8OCl7aon/X3RN tWso1VV39BP7MFxLIy5CGSRyXiHcvCz0Fmdc+SDskLQqjxLd07ym7GaIkMFKYvyJESKw nITB323+6gzSp6KvBZMQEISjANAW27SUdE+xteG0UQqPO1Nad+/fuiAfWPGyNQFHgGKs 1KAg== X-Gm-Message-State: AOAM532LimdqIjXFpYUoHqQpYVW4KtXxFCDalaaK0ZX2zmNA83B+APDp r3htynFeWEp9NrFOC4s1FW40 X-Received: by 2002:a63:5802:: with SMTP id m2mr1904626pgb.58.1606902178104; Wed, 02 Dec 2020 01:42:58 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id bg8sm1393990pjb.52.2020.12.02.01.42.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2020 01:42:57 -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 08/29] bus: mhi: core: Add missing EXPORT_SYMBOL for mhi_get_mhi_state() Date: Wed, 2 Dec 2020 15:11:38 +0530 Message-Id: <20201202094159.107075-9-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 Add missing EXPORT_SYMBOL_GPL() declaration for mhi_get_mhi_state() API. Signed-off-by: Bhaumik Bhatt Reviewed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/main.c | 1 + 1 file changed, 1 insertion(+) -- 2.25.1 diff --git a/drivers/bus/mhi/core/main.c b/drivers/bus/mhi/core/main.c index cea5eab83f48..6ecaacaa8b54 100644 --- a/drivers/bus/mhi/core/main.c +++ b/drivers/bus/mhi/core/main.c @@ -132,6 +132,7 @@ enum mhi_state mhi_get_mhi_state(struct mhi_controller *mhi_cntrl) MHISTATUS_MHISTATE_SHIFT, &state); return ret ? MHI_STATE_MAX : state; } +EXPORT_SYMBOL_GPL(mhi_get_mhi_state); int mhi_map_single_no_bb(struct mhi_controller *mhi_cntrl, struct mhi_buf_info *buf_info) From patchwork Wed Dec 2 09:41:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 335971 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp778939ejs; Wed, 2 Dec 2020 01:46:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJx8U6lYODm0M0AvxhDXvcA+rzp1gxCoqq7KCr4zBl0fJUxiT+Z+WXBTZlXSZ9usOIHlSRpT X-Received: by 2002:a50:8e0e:: with SMTP id 14mr1697394edw.171.1606902403780; Wed, 02 Dec 2020 01:46:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606902403; cv=none; d=google.com; s=arc-20160816; b=L34dqCBYA9YnILyca485HudaRiaqinoYZB4UvlDShmMVru/QvYDUn2F82xjDyiCRX5 K6TB1rlC97Tqm/gDuqtYYzpe1Vd+Ktbm9U4WR3mFzh4gscQIIYp8jnCuLMMNd251Dt3O 0Z26YdSZiCGVP9S2i0pTBy6FOWTPVActmpcasoWMLcX1b+FbVkKcdVc2iQHfmmCYZVyR EZdNHQucIprpwWLw0SMZJh+qjJiifcTSaZNBw55UuCJ6pbloFrL+twznEPvitcMi4wVG 57vZ0xWHLqjgXCrVo5IsgjK9ygpQlFfw/VdmYTRdjG8mnrtHXLht1MDLKjqGbJSP4QQY Ze9Q== 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=KwdaP394uCZh/YGWGEmp+8FEBT4NPzYLWZ37cgF2aZU=; b=gQ/jby/NfV1KRG5F24IVVddrAzSDVy5ZLfciFN3cnFfYtmmIxM8w5zaVIGkpLcyNO4 itkeEaywWz8v4LRc8EGZM/ipceMrgW3sELXVl57ybnGLAaQqhZ6E3FkFUbbYjN5NKTph 0RPPP+c5D/O7kCQHDt6irgtxdXH+2q1BAmM3rJEhtLLdtsblRhsVAIpeHj3ryoJ5ugQE BJi1I/ipNlvL1tnGRmL/1GmgrUSdhHlbUAib+5Wcw5R5Y4Zosz8b+LW2ONtaMpQfDXPa o17lS8+VyO5F+UIptgQqvQzZ/6Sd35QyzvA1/uzWXcc2WwQepeux0buLrcxy+OPnAVga F8aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cq6dXcRT; 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 d27si564967ejt.291.2020.12.02.01.46.43; Wed, 02 Dec 2020 01:46:43 -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=cq6dXcRT; 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 S2388533AbgLBJpG (ORCPT + 15 others); Wed, 2 Dec 2020 04:45:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388532AbgLBJo0 (ORCPT ); Wed, 2 Dec 2020 04:44:26 -0500 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 D27C1C061A54 for ; Wed, 2 Dec 2020 01:43:02 -0800 (PST) Received: by mail-pj1-x1044.google.com with SMTP id b12so683372pjl.0 for ; Wed, 02 Dec 2020 01:43:02 -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=KwdaP394uCZh/YGWGEmp+8FEBT4NPzYLWZ37cgF2aZU=; b=cq6dXcRTLlO5i4JVNBzbod0fguBXG1bAzZM+E6zRc9Pq8SiAV1zbUWtGpdI11JdOhn H7B3YFPe96zOW6zCttdZrr37Ij79fuEXV5JmC2oMipMSobJ697O28ds1MttSI57rehAU ztKxdnyd9B8PgJV1EZy4zXwH9xeN2ipaD5hJidb41drCt3nZ0kir0Qgbmjou3AEL7WFA quDD3y0IrXltGpoqqzV+zZi1V+ehMbdRXWVTHqpd3Du+/q65juqmDS5eXzbFfL3riTaU toclbfOqgB+939EAiXWyl3X3K9Is2uJEtscKn9iEGkYAPucvdITYkyIYO0GGRygSardf KDUg== 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=KwdaP394uCZh/YGWGEmp+8FEBT4NPzYLWZ37cgF2aZU=; b=VAlF+BpgoyY7fQOW2HD8Ep++PmfAfSBEYBM/kcacQPLwfzCgidFrEqb2QX0iYEs/BP K9Ux6ymkW2fkcXFLeVzaoXCVn43PgCiukXMayRtGuiol12tLPBRqOHV6K7LKHOKcG9vy votVk2yTWiWMqYNmLKEXLCWrjzLnICuoyVsZbLEsQ5hoF1Qjf7CV9I4U6fqb1KOGvvX6 xDV93oWokNUxlIOLZ5Bj3vcU+WE5F/cglCkn1T+SQRNtRC2rvHisDbDFoaSlSLbRC8X5 z3x8Dvx+RaCasQhc9Fal0Fgthi2AgffD/RwxyS/AkZzpH1sjDGd7Kl9Vxkjj5mAKHMPG 1MXg== X-Gm-Message-State: AOAM532sgCvOuJfBbqUrclYhEIwtET/aXHzY97e3rOY+rXz00HzQnsI4 HCdOqFq1V4jh58GcfiNLQ1Mn X-Received: by 2002:a17:90a:db48:: with SMTP id u8mr1619594pjx.81.1606902182388; Wed, 02 Dec 2020 01:43:02 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id bg8sm1393990pjb.52.2020.12.02.01.42.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2020 01:43:01 -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 09/29] bus: mhi: core: Expose mhi_get_exec_env() API for controllers Date: Wed, 2 Dec 2020 15:11:39 +0530 Message-Id: <20201202094159.107075-10-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 The mhi_get_exec_env() APIs can be used by the controller drivers to query the execution environment of the MHI device. Expose it so it can be used in some scenarios to determine behavior of controllers. Signed-off-by: Bhaumik Bhatt Reviewed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/internal.h | 1 - drivers/bus/mhi/core/main.c | 1 + include/linux/mhi.h | 6 ++++++ 3 files changed, 7 insertions(+), 1 deletion(-) -- 2.25.1 diff --git a/drivers/bus/mhi/core/internal.h b/drivers/bus/mhi/core/internal.h index 78e4e84d6743..d8af8a702493 100644 --- a/drivers/bus/mhi/core/internal.h +++ b/drivers/bus/mhi/core/internal.h @@ -609,7 +609,6 @@ enum mhi_pm_state __must_check mhi_tryset_pm_state( struct mhi_controller *mhi_cntrl, enum mhi_pm_state state); const char *to_mhi_pm_state_str(enum mhi_pm_state state); -enum mhi_ee_type mhi_get_exec_env(struct mhi_controller *mhi_cntrl); int mhi_queue_state_transition(struct mhi_controller *mhi_cntrl, enum dev_st_transition state); void mhi_pm_st_worker(struct work_struct *work); diff --git a/drivers/bus/mhi/core/main.c b/drivers/bus/mhi/core/main.c index 6ecaacaa8b54..f953e2a6d58a 100644 --- a/drivers/bus/mhi/core/main.c +++ b/drivers/bus/mhi/core/main.c @@ -123,6 +123,7 @@ enum mhi_ee_type mhi_get_exec_env(struct mhi_controller *mhi_cntrl) return (ret) ? MHI_EE_MAX : exec; } +EXPORT_SYMBOL_GPL(mhi_get_exec_env); enum mhi_state mhi_get_mhi_state(struct mhi_controller *mhi_cntrl) { diff --git a/include/linux/mhi.h b/include/linux/mhi.h index d4841e5a5f45..9225d5551d69 100644 --- a/include/linux/mhi.h +++ b/include/linux/mhi.h @@ -658,6 +658,12 @@ int mhi_download_rddm_img(struct mhi_controller *mhi_cntrl, bool in_panic); */ int mhi_force_rddm_mode(struct mhi_controller *mhi_cntrl); +/** + * mhi_get_exec_env - Get BHI execution environment of the device + * @mhi_cntrl: MHI controller + */ +enum mhi_ee_type mhi_get_exec_env(struct mhi_controller *mhi_cntrl); + /** * mhi_get_mhi_state - Get MHI state of the device * @mhi_cntrl: MHI controller From patchwork Wed Dec 2 09:41:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 335972 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp778945ejs; Wed, 2 Dec 2020 01:46:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJyHjzfTiC0NJfffSXiye5QlvmXG6Z5wAf/f3Chh63LnCJ1tvMJKdXa0UzHH0F0kDd51eW8Z X-Received: by 2002:aa7:c313:: with SMTP id l19mr1770806edq.293.1606902404250; Wed, 02 Dec 2020 01:46:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606902404; cv=none; d=google.com; s=arc-20160816; b=dcNwGDSmB+YRjlmlZMPG+YyNCRPPEodz5Iyh045werT59EwUvcADGZBNnhy9tOFpB1 +AUiBREWPMZ6Wj5aHNhvYCZoh+XSlw6hQEXawNloKyabTm+rZ0oVM/eZftyIjDCh9HAF ulOHTB2Lpx8pOTQWx/8dJY0kZW+OdGJ2KML1HPuu5+rPrnLRgGTIq5txktdW8SvzT7h6 DhmP/2mxnXMyR2ZhhGFjpN4woNUxtZ9cjoUBriup1YhsTDkKK+g4CZAN6fFnFThajsZ7 OaCCde/R9rB5hncP03nGo2mXkpiu0la8n6WyQiBZ7GMJZds8Y2o1er/bmF8Q7CTfH6P0 d/Xg== 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=W29naHKk3BnHfLKgn8xbt6r59+NsCibowdGwfY8zXY4=; b=FLVXEZYih1qoigbPYiDtJvAJCCGbK6ar3d1wHoZVVUAolx494G9Qmr/kt2CmiRq3iz gCBTE1BaT4URharkVSn2KDigDxnt58NMFogiX6Tba9QRh9yrbuIUP0ybWOyZGa4Ea87V WPmtO9v1fvdf+jKvn8fBlP59YvEkV5drhkdCvE6mr2FqLkY8GAkKZRwbi9w9pSdGTm4N QaR6eeg2REmhsQ+y2onPWmDbYdAqJbsjICvCfZb2K8tYaG5hRuFEEqYPJK3sJCOotyz6 Go3Q3ANO9XUiqAr7u92S66BHhnWKeicyS1GQjgfofex2vbUZmh/CNN/efvktopdDozGG UuVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VLqhulcA; 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 d27si564967ejt.291.2020.12.02.01.46.44; Wed, 02 Dec 2020 01:46:44 -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=VLqhulcA; 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 S2388556AbgLBJpG (ORCPT + 15 others); Wed, 2 Dec 2020 04:45:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388533AbgLBJo1 (ORCPT ); Wed, 2 Dec 2020 04:44:27 -0500 Received: from mail-pj1-x1043.google.com (mail-pj1-x1043.google.com [IPv6:2607:f8b0:4864:20::1043]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DC89C0613CF for ; Wed, 2 Dec 2020 01:43:06 -0800 (PST) Received: by mail-pj1-x1043.google.com with SMTP id m5so668726pjv.5 for ; Wed, 02 Dec 2020 01:43:06 -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=W29naHKk3BnHfLKgn8xbt6r59+NsCibowdGwfY8zXY4=; b=VLqhulcAQBHXat9sqgUwdDOtS+HV51UPeMPm/BZRSGenqBYga7lEARnnQu9A3FYLDq JZbzoHx5BM8ANyOmS5oAO13bUy7Ro2xdyFg4bnbPqZIwD8jT93X53V3NapQGYsElnOAN 5xUuLM8rELu8XfovoIpH2LmrhRJNibhMVpnvAb3UPWE5refMH8mWqkJZR4BQzRTMp9P+ E5/w8+OsG/WG4sZFy9coyNG0c2LC+KJMauLHdCtfWuKxj9fSrYwqW5+z5ovu8tiw8yZa pyN9zeAA+AwaE/Bmj6JwQcigeV3TwkYkCPAEhRGZZ9JfCodb3xeqIAN9JMRa7AuhLE+w jxdQ== 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=W29naHKk3BnHfLKgn8xbt6r59+NsCibowdGwfY8zXY4=; b=p6ZdmuIyWFamxT1xXR8ds1VEf05u+TR5LwTHVcuubbUCTjvoG0DUIbZ7ZfCvwI2fmo S87EE0R9QKZ3R6vGXHQbqKX/juHWVqC22n+yZtvskYkEu9/fFk7bwtYwaDIhGEaOKUPU kfeZZtLqu3vBqj3IhJ8veuCcIgTONY9TU987frNx5B/Ve3r6mfzplpLAnK9eGj5XLoLD ps3ueiaerVNsaNm0qyqbSBIeCj4YzLQARxP1I7c0M9NDjWrrUgMxd0KuCZ7/XhFvMwS0 Di4nNVZ7zergz512Nj2J+ZW9T7rsqeF8Kw2f4SlAnQxAwWnaI4VY5GG1y4IqrFNgNQXz zABw== X-Gm-Message-State: AOAM530xRKe+Up1W+XiMb75/nvMtnjMZxJRfyEVLylFHDeHuRnFwGhVf xgMa3IpxCtHL3Z0tdyBiUrR2 X-Received: by 2002:a17:90a:b782:: with SMTP id m2mr1529404pjr.185.1606902186186; Wed, 02 Dec 2020 01:43:06 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id bg8sm1393990pjb.52.2020.12.02.01.43.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2020 01:43:05 -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 10/29] bus: mhi: core: Remove unused mhi_fw_load_worker() declaration Date: Wed, 2 Dec 2020 15:11:40 +0530 Message-Id: <20201202094159.107075-11-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 The mhi_fw_load_worker() function no longer exists. Remove its declaration as part of code 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(-) -- 2.25.1 diff --git a/drivers/bus/mhi/core/internal.h b/drivers/bus/mhi/core/internal.h index d8af8a702493..2df8de5432f9 100644 --- a/drivers/bus/mhi/core/internal.h +++ b/drivers/bus/mhi/core/internal.h @@ -613,7 +613,6 @@ int mhi_queue_state_transition(struct mhi_controller *mhi_cntrl, enum dev_st_transition state); 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); int mhi_pm_m0_transition(struct mhi_controller *mhi_cntrl); void mhi_pm_m1_transition(struct mhi_controller *mhi_cntrl); From patchwork Wed Dec 2 09:41:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 335958 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp777913ejs; Wed, 2 Dec 2020 01:44:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJxN+JeJ0dwHzgBWjHmZ6NE9UBjcfZxpoXjwcOgHDIbZLtTOxduRWBMUJvqruL0TRKXNz3Lw X-Received: by 2002:a17:906:c312:: with SMTP id s18mr1509412ejz.185.1606902295180; Wed, 02 Dec 2020 01:44:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606902295; cv=none; d=google.com; s=arc-20160816; b=O84FpNrORzFhZZJ1JVd4y0iF83RNrDuTWdq614T70gPo1upUZGtaW6UJceGOk2lbwI aU5V8oAoUG6NS44U0Bmj3d93fuS4ltdAI/G1YkqvQsF7xJpgmot2RAsS5pTURN2Ob6af VT7mAeakyCfUHlusPEN+7uQZYKhahs4OmA0BHlnssQEbI6+GWFg9sIn3NQp+wFYzCQhT ikMh3GNrK9t61Zb65XO4DXGbBSFjPtw6hw0hnxp8+KZ5JRbMSCxL6Wl5hpWzz3AqnBPV BJhWDGjBm9mzbokV92dPkFnkb0oTWFslgJJFVcdPGXgYu20oUehPOvVK+jIrddpWqIA0 q7zg== 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=VefEV681jSKxcJU1jLAzMKiv4DpHh1pRZytDsbLE6rI=; b=DcKFHgM0LYrisoGpTgaQIoeiaN8z+LuBTj7oe3+bj1rClwn3uYIeeu5CRCkullHdll EKy+S1OZQQnSWz2PoasnivajNstxKz5YLzGpfc1TPDr5n8hJcswl5xVxelgjbstTCaOX TJrCtgtn3Ordt+YfFX8AY5G7FR3fe+/rbgpkBFWaRMA0dopq7A03OtL0IQNDpuXWrpv7 ZeUNvODORapttWQRpPZ5uy2NPjybF2gJbH4NmGE6HqMJKUHlfRsAG30rroKbLJwdUSnT YWXBJck8v6g885XLiUfdTPJQCaC76bPE+D/nfK18dmMZowRHTBgSSLAlRvgNuHm3ZFb9 kqdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EKp9MPdv; 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.44.54; Wed, 02 Dec 2020 01:44:55 -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=EKp9MPdv; 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 S2388527AbgLBJob (ORCPT + 15 others); Wed, 2 Dec 2020 04:44:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388545AbgLBJoa (ORCPT ); Wed, 2 Dec 2020 04:44:30 -0500 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 7829FC0613D6 for ; Wed, 2 Dec 2020 01:43:10 -0800 (PST) Received: by mail-pf1-x443.google.com with SMTP id q10so905275pfn.0 for ; Wed, 02 Dec 2020 01:43:10 -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=VefEV681jSKxcJU1jLAzMKiv4DpHh1pRZytDsbLE6rI=; b=EKp9MPdvCHsGtHxa+NUUvBYTlS664LJUQRa3H/N3KWIxDe/2XFurkuOlBJgQ0jx/6+ AJrT1h3oNYdoUViXsbU8jXcUByIqK0+TgHrJynwb0EifTjvedBD5PgtMAl4x+5F9A0Ys sYGhcxpMAKIIKkoBzfsqUrjxIG5fU+Qsq2kyEvmeeBWtQbHYSUcy3DlF8w+x1a2dj1r6 ZfAc9mNt8qaVUhYc60rjUHjmSspesmIp59ULrFA3/3C/2beMNSAgDyJvxrUUKxtrZD23 7ZvK8Be5+CFC3MNR6zy21fE2TeINU/RXH9tfjY3bXVpBzXHWknyJKutPWeJ0obXJ7PGu 9QNQ== 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=VefEV681jSKxcJU1jLAzMKiv4DpHh1pRZytDsbLE6rI=; b=tpdkNguT6SIpeSLm0N0WByESUEoet/nI5+OkEdln6NxlWg0lgwVzYxcY9FlK6C5F7+ i5VBurHS4RqOMMP45Jv6j4RXLl1MO2ojVuNLgP15nMvVx7WSf/sE4ptdR0JeH6zgr7ha ZfNbCBOfZ0nFcHhk6q0AHk9+sGfv/aK9Cf7eGJmlDEb2BG1YgnPSpSp4vhXSnOyWOAjZ v3QzQCuLC9InRx76jfgnNAzl04wTC3B1lFFA/JxyRhezHIVSNcMipBNvbAbVANmKcyRu 002rCVjOIWf3H6L40wfkJrvg3rJTZYRieKJUUxsCKMr2mPXYkR/4DxAMGWIVR2Yz1OUt HwnA== X-Gm-Message-State: AOAM533/KLLcUWlUq/8LvaWkIijpoZbez2VltOSmA4tlmLARDkxIO9OR H6yy1uozkCiu63YgZCvojTju X-Received: by 2002:a62:ed11:0:b029:19a:e1cd:ca96 with SMTP id u17-20020a62ed110000b029019ae1cdca96mr2092823pfh.38.1606902189977; Wed, 02 Dec 2020 01:43:09 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id bg8sm1393990pjb.52.2020.12.02.01.43.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2020 01:43:09 -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 11/29] bus: mhi: core: Rename RDDM download function to use proper words Date: Wed, 2 Dec 2020 15:11:41 +0530 Message-Id: <20201202094159.107075-12-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 mhi_download_rddm_img() uses a shorter version of the word image. Expand it and rename the function to mhi_download_rddm_image(). Signed-off-by: Bhaumik Bhatt Reviewed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/boot.c | 4 ++-- include/linux/mhi.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) -- 2.25.1 diff --git a/drivers/bus/mhi/core/boot.c b/drivers/bus/mhi/core/boot.c index 6b6fd9668c3b..16244cc8fbe7 100644 --- a/drivers/bus/mhi/core/boot.c +++ b/drivers/bus/mhi/core/boot.c @@ -147,7 +147,7 @@ static int __mhi_download_rddm_in_panic(struct mhi_controller *mhi_cntrl) } /* Download RDDM image from device */ -int mhi_download_rddm_img(struct mhi_controller *mhi_cntrl, bool in_panic) +int mhi_download_rddm_image(struct mhi_controller *mhi_cntrl, bool in_panic) { void __iomem *base = mhi_cntrl->bhie; struct device *dev = &mhi_cntrl->mhi_dev->dev; @@ -169,7 +169,7 @@ int mhi_download_rddm_img(struct mhi_controller *mhi_cntrl, bool in_panic) return (rx_status == BHIE_RXVECSTATUS_STATUS_XFER_COMPL) ? 0 : -EIO; } -EXPORT_SYMBOL_GPL(mhi_download_rddm_img); +EXPORT_SYMBOL_GPL(mhi_download_rddm_image); static int mhi_fw_load_amss(struct mhi_controller *mhi_cntrl, const struct mhi_buf *mhi_buf) diff --git a/include/linux/mhi.h b/include/linux/mhi.h index 9225d5551d69..52b3c60bf9bb 100644 --- a/include/linux/mhi.h +++ b/include/linux/mhi.h @@ -645,12 +645,12 @@ int mhi_pm_suspend(struct mhi_controller *mhi_cntrl); int mhi_pm_resume(struct mhi_controller *mhi_cntrl); /** - * mhi_download_rddm_img - Download ramdump image from device for - * debugging purpose. + * mhi_download_rddm_image - Download ramdump image from device for + * debugging purpose. * @mhi_cntrl: MHI controller * @in_panic: Download rddm image during kernel panic */ -int mhi_download_rddm_img(struct mhi_controller *mhi_cntrl, bool in_panic); +int mhi_download_rddm_image(struct mhi_controller *mhi_cntrl, bool in_panic); /** * mhi_force_rddm_mode - Force device into rddm mode From patchwork Wed Dec 2 09:41:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 335959 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp777927ejs; Wed, 2 Dec 2020 01:44:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJz+gK7oVgTmmIHbYd760+zQ02qsmwFfCIB2ONQFomJJGfg1B76Ii2n1vJQp2VEb8KbNYtaX X-Received: by 2002:aa7:c558:: with SMTP id s24mr1768365edr.257.1606902296229; Wed, 02 Dec 2020 01:44:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606902296; cv=none; d=google.com; s=arc-20160816; b=e5YYubiS6oTputfuCf37LO8FeKyXWcPJMr/5S8a+PxdqILZPz2Dol3d1MTP4W/NNKY BWYn8Lq26MqvTltmw08OtkGrp4uKojChJRrlUpcmvNNQNRhzxq9w1Oqh3PlMYWoK3o3e yax9L+DHycRmO8NIlWYLC3uYhQpexScv34uGxrWIeZhL6tOr+a9mRXdeKDFLCYsi7itn 8SUN/1cXQUkbPfhJWzQidQrW7v2J82UGzHsaiyUiHaDawe+0ZuOdz/TKQYWKyLnosUW7 HnR3BQ4nUigqCF1KSilZoXsts3eJ8+di5b22+7YOHxhcfMruMChXBCyyGOaGu9XNqYfc xQAQ== 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=As+64t4In9qgfO6oiaQfB+CQCXZv+hCjtZ0HhYLGPu4=; b=RV1pGQv3fT9fIzpo1wUc2ovIhq57xFPhL365VaTdV5tX7fSKgvM8JQzGrn+f0eseTQ /WeKD6s3CXOfaMlKBfO8RLuxc9vh9Nbjw3eHvlSlG0UhfISaY338vJj53/MoA5ALLvqU XmHwJECFqORXNsnOBuHbObMQOzDEtqMfWHm6yoxzYqyBhylfmfEu05LHdAFygwvj83OT FUo+2jLXFIEGVvGjHcRNt6aXqcDMW2RCOxXDQg9SxDaQMzK2I8IdeyEHBP44nhBGa8hr AzLD3HN7cWIS+0iJ3Rd6EF0cNT/uyzqocoqlTe3MxCWxqucTbQ1daTPIVjynHBD2gRRk ofbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nHfys83G; 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.44.55; Wed, 02 Dec 2020 01:44:56 -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=nHfys83G; 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 S2388531AbgLBJod (ORCPT + 15 others); Wed, 2 Dec 2020 04:44:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388552AbgLBJod (ORCPT ); Wed, 2 Dec 2020 04:44:33 -0500 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B91EC0617A7 for ; Wed, 2 Dec 2020 01:43:14 -0800 (PST) Received: by mail-pg1-x543.google.com with SMTP id t37so751680pga.7 for ; Wed, 02 Dec 2020 01:43:14 -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=As+64t4In9qgfO6oiaQfB+CQCXZv+hCjtZ0HhYLGPu4=; b=nHfys83GpKTfu7SddXUVTvpPDZ29CmUwRuWoieNCtEPlo5MQbR/JT/Ja3uw4zBYu6u WmI5zSwtECGNAJy1QMmYmfO7MSpTwd5GRHCfWfjPg7+7RCdS4VtfIezZjoFvzsvtqLuO CyYgqnqJ+71LDwrgEOJy+4nrmSoR4aKE5Ali/yLsgPKgpHP8XzsIx3zC58JamYaQZZnD Z45Aa1fHE+q/gXnkjli415odxozqBY1XZxpdblLpYUcyFKuTptwPOJRor0w34GrniwDZ uHq1GoA5ODIRduQGSb+GvESMHGjtp6VKlLen9pDYJMGNE1v8sAlcQaXddVkRVuimZCOZ GcGw== 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=As+64t4In9qgfO6oiaQfB+CQCXZv+hCjtZ0HhYLGPu4=; b=rJM4J/9m8ekmVeeW6amLcBYMcbtEPm//kwb6tm2/aNJlU2YDrY3kTYBPlr/xw0df4R 92FCibk8kDZFon0JVmWT6kK2ExzCYUPXZcgHpb/R142JVttoR38CVtLBCxqBVC+DDLQy 6z5DdibZ+cUz/WYrGRUkLRXv1KOEIEixsH9uWiWiTGjXG8NcDxHDHfJkd4aza5KqJN9n xoWHqCtPQKN7YRsciGUzjalT5P5IMQmQ4zhObvANh+L5mWEpp/amFn4b/QfmaCDORw5B K65Usb7uFahgZJ0mIILC4SI1a4yO0fCMZE4ZsOLRk4ntzRrPzSpRafVkiBctOVOWN/93 ekcg== X-Gm-Message-State: AOAM533VpRl8WPAZtwebR6KYhe9Xld6XS9wwL09/eBC911gQSnAlhWzV 23O+V1yBGU7VwiE6KBb1nmim65e+CrYp X-Received: by 2002:a62:8705:0:b029:198:22e5:adcd with SMTP id i5-20020a6287050000b029019822e5adcdmr1769218pfe.74.1606902194040; Wed, 02 Dec 2020 01:43:14 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id bg8sm1393990pjb.52.2020.12.02.01.43.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2020 01:43:13 -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 12/29] bus: mhi: core: Skip RDDM download for unknown execution environment Date: Wed, 2 Dec 2020 15:11:42 +0530 Message-Id: <20201202094159.107075-13-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 MHI is unable to determine the execution environment during the panic path, host must skip the RDDM download. This can happen if the BHI offset read or the BHI_EXECENV register read fails indicating that the underlying transport is unresponsive. Hence, there is no need to trigger an RDDM using SYSERR or request an SOC reset. Suggested-by: Hemant Kumar Signed-off-by: Bhaumik Bhatt Reviewed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/boot.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) -- 2.25.1 diff --git a/drivers/bus/mhi/core/boot.c b/drivers/bus/mhi/core/boot.c index 16244cc8fbe7..6f0cfb9922b4 100644 --- a/drivers/bus/mhi/core/boot.c +++ b/drivers/bus/mhi/core/boot.c @@ -92,6 +92,9 @@ static int __mhi_download_rddm_in_panic(struct mhi_controller *mhi_cntrl) * image download completion. */ ee = mhi_get_exec_env(mhi_cntrl); + if (ee == MHI_EE_MAX) + goto error_exit_rddm; + if (ee != MHI_EE_RDDM) { dev_dbg(dev, "Trigger device into RDDM mode using SYS ERR\n"); mhi_set_mhi_state(mhi_cntrl, MHI_STATE_SYS_ERR); @@ -139,10 +142,12 @@ static int __mhi_download_rddm_in_panic(struct mhi_controller *mhi_cntrl) ee = mhi_get_exec_env(mhi_cntrl); ret = mhi_read_reg(mhi_cntrl, base, BHIE_RXVECSTATUS_OFFS, &rx_status); - dev_err(dev, "Did not complete RDDM transfer\n"); - dev_err(dev, "Current EE: %s\n", TO_MHI_EXEC_STR(ee)); dev_err(dev, "RXVEC_STATUS: 0x%x\n", rx_status); +error_exit_rddm: + dev_err(dev, "RDDM transfer failed. Current EE: %s\n", + TO_MHI_EXEC_STR(ee)); + return -EIO; } From patchwork Wed Dec 2 09:41:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 335973 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp778953ejs; Wed, 2 Dec 2020 01:46:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJw+RDIQvFQcwlm08GTgiOcYZCpbNeNrkNmv1cyeDLqiKkxw89QOvv4XTZM8ovKlONfYZ5HF X-Received: by 2002:a05:6402:3d9:: with SMTP id t25mr1694969edw.338.1606902404674; Wed, 02 Dec 2020 01:46:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606902404; cv=none; d=google.com; s=arc-20160816; b=d2a0qKDD0ghClxzSFeZ3DfZMml0g6GnBT5Rro+uj8AsiX5Or+RbonRGljmV5RmfUI5 +4+UlaXdo1oBif6m6AnUD4coQ/FeFz5nO+wcl4yLjBRApuBXFCy/cTaVEl1JN6bLs3op Les6XznnlkfrAuHL+KXmagxmHM/O4rkMc55DeWbXeU8wQRIaNurgG7/5e/2NBcbiOSHo vBnk/RaYm9R14v3UajC8MqhoK+FYfJ6/RacbJK8JciDi2hzTWmuz5KPwQSq78Fh+eH9E NP150+mw4btoAIRaS8Vangp/pmdWbpkiOw37be0frB0c7gQ2h1oSXFuVS9qRPbVNd0J8 kvZA== 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=qCehJ5/nwTgtth9aagxkj9DlJP9D+xsxv+nF6q0eHjo=; b=gxC+aMD//dPhMLhSD0FhnI6w0WjMBaQMqQZ4gUquKa338uY1ZaaShV1cJ4Dc0EgCl1 CfmpYqwTdH7VoIb8DMyJXXJdsZQfl2XmPeeQoHjP0oIu7RXunk/CRWaPBW1rNLLMxfqM YV3Cw5ngH0fgELOExEeSYl5CVm3bpuRn8aE2/wCwSAq9lyeq0PChEii6ic2aUyJpcoqF MSMGkYkG3BxSWmu92koSv72H2YCk0dk1y/1wQGdDOPSNQ1X7FlYQNIrLatk/tziLaUrd Yxdh9MmQMOih1W9tquZyrbjA8gRJgEUVfHkkHIB5SGmitpgAdGDIQZ6J/GfTa/z8UYZi C0Eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=G7zlsEwL; 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 d27si564967ejt.291.2020.12.02.01.46.44; Wed, 02 Dec 2020 01:46:44 -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=G7zlsEwL; 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 S2388475AbgLBJoK (ORCPT + 15 others); Wed, 2 Dec 2020 04:44:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388474AbgLBJoJ (ORCPT ); Wed, 2 Dec 2020 04:44:09 -0500 Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 476CDC08E85E for ; Wed, 2 Dec 2020 01:43:18 -0800 (PST) Received: by mail-pl1-x642.google.com with SMTP id r2so831069pls.3 for ; Wed, 02 Dec 2020 01:43:18 -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=qCehJ5/nwTgtth9aagxkj9DlJP9D+xsxv+nF6q0eHjo=; b=G7zlsEwLrIeqPDlswh4th2Xiqv2KsB6xMy7RqU+lFTvmaa7N9o5j6lH1G+S4nRiKDd K2BvhKrkzV0tlNj55QGRdyZ5khhU0uVBGV//AiJix5s3SWUTREikvE8pXCJgzDPVXKXX k3mQq6llGXsD0pOW+MPtcohMLV/JE+HTIx67DYQjbPQm6PAFvrZl9bJPj/V03VL4EVG4 s5erTQJjKqdKyFqzXjmfbGx9hpmIeriBDYmrvNKmBF8jbx8MQA7h/byN1MwuJw+CmQDM nBZWvfVLenek6nDdmBD3Gt0xkSB44LMjrx0lEJld2l2aAPCXR9easvqAmJSh05tQ0FP/ lsbw== 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=qCehJ5/nwTgtth9aagxkj9DlJP9D+xsxv+nF6q0eHjo=; b=aw4zZkr6ZP2JrOSfcca/jcX34HHO32dXIaVodAjnrNd5Vd7PJ3lxmOJzdKs55kbanO pS9lgwapLmKyDNlSuoiqsgL5VdeW5OOvKcLwQCmzOdLx2tBcF+7GMK0pYTohIROgqtgh rqmV43IREUlHoBhummVKwGalRPnDaOZfJcGKHUXYSGZihAjha6n6Jwiea6g/gnxwPMjc SFwf+9jtkEZRJilz1jyIstW+mkw3N1/t0+Dn8EUmwWaMl25OIvaHcjyJxSk5imj4OVTl Zx1m63fHiTFR6BRdgfwWg565jgjCk+D4gZ5/9ugJFlSP86w+YIxov21u2m5TDlsjrfOX S+qg== X-Gm-Message-State: AOAM5336wCaN4KE9f/yZiW4zsVRhyfcEGonQlT+ou9BB8IlxRhPw8h73 4oDXPdCUu+hlmt2weGoJn6G9dqxu6Wp0 X-Received: by 2002:a17:902:6acc:b029:d8:c6ee:6d6c with SMTP id i12-20020a1709026accb02900d8c6ee6d6cmr1866601plt.7.1606902197790; Wed, 02 Dec 2020 01:43:17 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id bg8sm1393990pjb.52.2020.12.02.01.43.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2020 01:43:17 -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 13/29] bus: mhi: core: Use appropriate names for firmware load functions Date: Wed, 2 Dec 2020 15:11:43 +0530 Message-Id: <20201202094159.107075-14-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 mhi_fw_load_sbl() function is currently used to transfer SBL or EDL images over BHI (Boot Host Interface). Same goes with mhi_fw_load_amss() which uses BHIe. However, the contents of these functions do not indicate support for a specific set of images. Since these can be used for any image download over BHI or BHIe, rename them based on the protocol used. Signed-off-by: Bhaumik Bhatt Reviewed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/boot.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) -- 2.25.1 diff --git a/drivers/bus/mhi/core/boot.c b/drivers/bus/mhi/core/boot.c index 6f0cfb9922b4..2d7752cd9ccc 100644 --- a/drivers/bus/mhi/core/boot.c +++ b/drivers/bus/mhi/core/boot.c @@ -176,7 +176,7 @@ int mhi_download_rddm_image(struct mhi_controller *mhi_cntrl, bool in_panic) } EXPORT_SYMBOL_GPL(mhi_download_rddm_image); -static int mhi_fw_load_amss(struct mhi_controller *mhi_cntrl, +static int mhi_fw_load_bhie(struct mhi_controller *mhi_cntrl, const struct mhi_buf *mhi_buf) { void __iomem *base = mhi_cntrl->bhie; @@ -192,7 +192,7 @@ static int mhi_fw_load_amss(struct mhi_controller *mhi_cntrl, } sequence_id = MHI_RANDOM_U32_NONZERO(BHIE_TXVECSTATUS_SEQNUM_BMSK); - dev_dbg(dev, "Starting AMSS download via BHIe. Sequence ID:%u\n", + dev_dbg(dev, "Starting image download via BHIe. Sequence ID: %u\n", sequence_id); mhi_write_reg(mhi_cntrl, base, BHIE_TXVECADDR_HIGH_OFFS, upper_32_bits(mhi_buf->dma_addr)); @@ -223,7 +223,7 @@ static int mhi_fw_load_amss(struct mhi_controller *mhi_cntrl, return (!ret) ? -ETIMEDOUT : 0; } -static int mhi_fw_load_sbl(struct mhi_controller *mhi_cntrl, +static int mhi_fw_load_bhi(struct mhi_controller *mhi_cntrl, dma_addr_t dma_addr, size_t size) { @@ -250,7 +250,7 @@ static int mhi_fw_load_sbl(struct mhi_controller *mhi_cntrl, } session_id = MHI_RANDOM_U32_NONZERO(BHI_TXDB_SEQNUM_BMSK); - dev_dbg(dev, "Starting SBL download via BHI. Session ID:%u\n", + dev_dbg(dev, "Starting image download via BHI. Session ID: %u\n", session_id); mhi_write_reg(mhi_cntrl, base, BHI_STATUS, 0); mhi_write_reg(mhi_cntrl, base, BHI_IMGADDR_HIGH, @@ -449,9 +449,9 @@ void mhi_fw_load_handler(struct mhi_controller *mhi_cntrl) return; } - /* Download SBL image */ + /* Download image using BHI */ memcpy(buf, firmware->data, size); - ret = mhi_fw_load_sbl(mhi_cntrl, dma_addr, size); + ret = mhi_fw_load_bhi(mhi_cntrl, dma_addr, size); mhi_free_coherent(mhi_cntrl, size, buf, dma_addr); if (!mhi_cntrl->fbc_download || ret || mhi_cntrl->ee == MHI_EE_EDL) @@ -459,7 +459,7 @@ void mhi_fw_load_handler(struct mhi_controller *mhi_cntrl) /* Error or in EDL mode, we're done */ if (ret) { - dev_err(dev, "MHI did not load SBL, ret:%d\n", ret); + dev_err(dev, "MHI did not load image over BHI, ret: %d\n", ret); return; } @@ -509,11 +509,12 @@ void mhi_fw_load_handler(struct mhi_controller *mhi_cntrl) /* Start full firmware image download */ image_info = mhi_cntrl->fbc_image; - ret = mhi_fw_load_amss(mhi_cntrl, + ret = mhi_fw_load_bhie(mhi_cntrl, /* Vector table is the last entry */ &image_info->mhi_buf[image_info->entries - 1]); if (ret) - dev_err(dev, "MHI did not load AMSS, ret:%d\n", ret); + dev_err(dev, "MHI did not load image over BHIe, ret: %d\n", + ret); release_firmware(firmware); From patchwork Wed Dec 2 09:41:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 335952 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp777866ejs; Wed, 2 Dec 2020 01:44:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJwKfE6ENcsEw0fDVXsoH4x5uYe37+hNPTjCKnFIvSgvrIbMnCQiYiroLRa5tg4yLTcvtdF+ X-Received: by 2002:a17:906:1752:: with SMTP id d18mr1489598eje.529.1606902290568; Wed, 02 Dec 2020 01:44:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606902290; cv=none; d=google.com; s=arc-20160816; b=VSJK9LtW1DKXN8aVsV/5PC4Xmht1xoMLNiexskGcXgbFlB9D3lVRsN1hl9/Z4Mkbmp oxkAOgiBTycxKpNmswroEuWL11vWUQ662hpxm09Z76Vv83ixLPnihFs4f4ZnzRZWSSm/ ydEPi6eKSiitzDmS9qcY2LnpQRJ+ZpkhuxTg3cjWorDUKh4Svl5uVmR9Drqnr5BMzmXi /oXYRgE1t0f1UuSfJ1Kze27FJw1dEBEalIxe9I7E862Xs336d2rm9421LJSxEZB9cSYn +v1nobb+xHcE4GR55pvqP3A6zGHUa0dEPS6NOy6sVtSbGHxNrHe+/dZFKp0MPwSa2gS1 42Sw== 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=aCVtwoMEwnU/q7ikh6vCgAOZIiE0p1Na8j+wCbAr6Fw=; b=HmRGpauB5ndKey3UrezlHZPlKU5dSlaCo8ZO78GEsriNRBSzVdP0DK09RPKgERUv0F b559kRJABmz4EcmnDAJkMNKUu0s5T++nypJ7Gd9jW6C2OXm92/2IZR3fDKY2XAfOzim1 HRerx23wBlk22H/EVZZscLDthhPtMjrMLUFzXw7jyXoVpIKw4BCFU29Jv+P9gbuJNoWj FkUNwmceeGgiD21NMm18eqU3swYqt4roMlPpLGM3GWpHixWx2+Ssy4zwR0CDk9vbaQN8 8+S+8TgioUyTGAf4bY62eIOvV5cxcqdMj+6y3pWNUTL7TzPPL2gUTJJctkNmasx3GCCB Fe2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LsgQwzr8; 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.44.50; Wed, 02 Dec 2020 01:44:50 -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=LsgQwzr8; 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 S1727345AbgLBJoS (ORCPT + 15 others); Wed, 2 Dec 2020 04:44:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388504AbgLBJoR (ORCPT ); Wed, 2 Dec 2020 04:44:17 -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 4EE5DC08E860 for ; Wed, 2 Dec 2020 01:43:22 -0800 (PST) Received: by mail-pg1-x544.google.com with SMTP id t3so741620pgi.11 for ; Wed, 02 Dec 2020 01:43:22 -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=aCVtwoMEwnU/q7ikh6vCgAOZIiE0p1Na8j+wCbAr6Fw=; b=LsgQwzr8NayEzWH8Zpz2N6+tUkMRQ5zH74sppdFiihHLKEdgw/x26915JpwBZZ5W7w BXpC22qtd0YICfJZgopjxUG7b3SXLJFMOnbZlz+jxS8cpZ/gOmPXFeumavBBocG2Gxha UJOaArO8V7qZ3fLT31JfY7pxjoGgpEi2n33qnBDDKc2kbAkj7QXOz9kE9vnrS3aB5vI+ xskFx/7nNWWb0kfibXURJ7yssXvLIRUDXQ08lWTmwkoxA88qC6cmsAOUaOZbSQ43NToE iPQY5jkGC/h3dDqtkBp8t1oSvKKoixdJA9EzFUmAXld5vsNyz/40Gvr0VxMPSI32dc6Z U+1g== 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=aCVtwoMEwnU/q7ikh6vCgAOZIiE0p1Na8j+wCbAr6Fw=; b=s6AMl8ZrAJUKpwMgoVW1EcjhZpWvA4ij2HEJl899u38QbfoCdQuBu3HrR22XbMpM9A i66cQoOHU7EyW74E1qPcQxJZjeuw4ltlpJFqs5vs5h+pLYZzj08urNn1go5gi8rx/uSr rSUX52zhrlVNsVKkbqmoRPXl6cytaX8lUiKMjV9Ua8qFEeleLQ9LnqflBxwhsh1rql5l WFAg2uxKodyJf3mCiI75coOO6/YsvQyhsVg8P7jIb8KMRAqEDUH0qqsDYPky3f1BtJ3I 3z+d/C0Un9XbI6z1LV0AS6ZbxBvaonC3qPsJPrSIP9vQXXqjWfMHgZMfiuJ2VPHY0qC3 NL+w== X-Gm-Message-State: AOAM5325NhucEUMSC2m992YF9q8/fUeI9tDVRvshCB/ZC5RN9nx9XTt3 CFT/73LD6zgwMw6KypCgKW4B X-Received: by 2002:a63:fa0e:: with SMTP id y14mr1899263pgh.225.1606902201790; Wed, 02 Dec 2020 01:43:21 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id bg8sm1393990pjb.52.2020.12.02.01.43.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2020 01:43:21 -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 14/29] bus: mhi: core: Move to using high priority workqueue Date: Wed, 2 Dec 2020 15:11:44 +0530 Message-Id: <20201202094159.107075-15-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 MHI work is currently scheduled on the global/system workqueue and can encounter delays on a stressed system. To avoid those unforeseen delays which can hamper bootup or shutdown times, use a dedicated high priority workqueue instead of the global/system workqueue. Signed-off-by: Bhaumik Bhatt Reviewed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/init.c | 9 +++++++++ drivers/bus/mhi/core/pm.c | 2 +- include/linux/mhi.h | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-) -- 2.25.1 diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c index 8cefa359fccd..877e40c86801 100644 --- a/drivers/bus/mhi/core/init.c +++ b/drivers/bus/mhi/core/init.c @@ -880,6 +880,13 @@ int mhi_register_controller(struct mhi_controller *mhi_cntrl, INIT_WORK(&mhi_cntrl->st_worker, mhi_pm_st_worker); init_waitqueue_head(&mhi_cntrl->state_event); + mhi_cntrl->hiprio_wq = alloc_ordered_workqueue + ("mhi_hiprio_wq", WQ_MEM_RECLAIM | WQ_HIGHPRI); + if (!mhi_cntrl->hiprio_wq) { + dev_err(mhi_cntrl->cntrl_dev, "Failed to allocate workqueue\n"); + goto error_alloc_cmd; + } + mhi_cmd = mhi_cntrl->mhi_cmd; for (i = 0; i < NR_OF_CMD_RINGS; i++, mhi_cmd++) spin_lock_init(&mhi_cmd->lock); @@ -969,6 +976,7 @@ int mhi_register_controller(struct mhi_controller *mhi_cntrl, error_alloc_cmd: vfree(mhi_cntrl->mhi_chan); kfree(mhi_cntrl->mhi_event); + destroy_workqueue(mhi_cntrl->hiprio_wq); return ret; } @@ -982,6 +990,7 @@ void mhi_unregister_controller(struct mhi_controller *mhi_cntrl) mhi_destroy_debugfs(mhi_cntrl); + destroy_workqueue(mhi_cntrl->hiprio_wq); kfree(mhi_cntrl->mhi_cmd); kfree(mhi_cntrl->mhi_event); diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c index 3de7b1639ec6..805b6fa748f0 100644 --- a/drivers/bus/mhi/core/pm.c +++ b/drivers/bus/mhi/core/pm.c @@ -597,7 +597,7 @@ int mhi_queue_state_transition(struct mhi_controller *mhi_cntrl, list_add_tail(&item->node, &mhi_cntrl->transition_list); spin_unlock_irqrestore(&mhi_cntrl->transition_lock, flags); - schedule_work(&mhi_cntrl->st_worker); + queue_work(mhi_cntrl->hiprio_wq, &mhi_cntrl->st_worker); return 0; } diff --git a/include/linux/mhi.h b/include/linux/mhi.h index 52b3c60bf9bb..1ed5f2aa224b 100644 --- a/include/linux/mhi.h +++ b/include/linux/mhi.h @@ -337,6 +337,7 @@ struct mhi_controller_config { * @wlock: Lock for protecting device wakeup * @mhi_link_info: Device bandwidth info * @st_worker: State transition worker + * @hiprio_wq: High priority workqueue for MHI work such as state transitions * @state_event: State change event * @status_cb: CB function to notify power states of the device (required) * @wake_get: CB function to assert device wake (optional) @@ -419,6 +420,7 @@ struct mhi_controller { spinlock_t wlock; struct mhi_link_info mhi_link_info; struct work_struct st_worker; + struct workqueue_struct *hiprio_wq; wait_queue_head_t state_event; void (*status_cb)(struct mhi_controller *mhi_cntrl, From patchwork Wed Dec 2 09:41:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 335967 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp778025ejs; Wed, 2 Dec 2020 01:45:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJyrOij8F+ymnNXBRvowT5TdvAyvpB82TtItJf7DrlCOvGMFzY/ljCYYdcGoZU4YqLOiYYxc X-Received: by 2002:a17:906:3b5b:: with SMTP id h27mr1461039ejf.450.1606902304643; Wed, 02 Dec 2020 01:45:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606902304; cv=none; d=google.com; s=arc-20160816; b=tZOwYjcVfzuRYjR5M+fKy2e3HIKcGjSVjrF4F2bgDD0zQ2UpdTrEmrifb6Uu9MXAx6 UljR4STekb9WQRJfWtEhD2ntYtvyjPUGiXVt63RGl/p2R3JfbDLYtrx6+3eifRM8T/0a 4zE2d+Q1xlwCHyFefspMGr8N87v/aa2tvgKYUTxm8YI82aietJ84FSwh6FCd9a6SWW19 K3N71aemuix6a9br90k1IaAFZYIxV6eX1CaunJJCXwRqSFExQB8zFeVvUxRKQ9zGS57b ZQUrg1OBKexlu6U971RH4CCNq1MArZ9PrfWA3FyXUC+anuMn9mGP/vrVe+Kyeo5r2fZ+ 2c4A== 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=qlptgLAgYYEEBECAOSdw0l78qtjRaQyT/9MkpEBmWJU=; b=Jc80abgMFmWkdLnQRsVZbRlQpxfd3vG0C8P2Jdgxe+Xcraq1ERrxpoLxkVreGv7aeO uji0TjpJVuhAVugW5PfKgP2z/lDKBwJKUWjDMOlwgtCG3s83PsgoUlwwtsZ7dXDn8cvj k5TbqUT32u5FB3Z/mQhRGlnptW5NBUHOkbLELl5lUGYIk4xj6JLLFg/FSmuaNIYic/7P uV0yZe04cD9/tRgqGHe6JeH4eXi+TS3FXxeaAbT5+08PKfgRSPIlaoWIm+daypkK1qBf AD2jzI2XFzj++V3i9w9Qc6e+GAMr9ZsmGp/8/TkKMxLTXerT3gMGpohXE0ml/Ve4xYuy AMeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WxxRtYpd; 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.04; Wed, 02 Dec 2020 01:45:04 -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=WxxRtYpd; 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 S2388381AbgLBJpA (ORCPT + 15 others); Wed, 2 Dec 2020 04:45:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388600AbgLBJom (ORCPT ); Wed, 2 Dec 2020 04:44:42 -0500 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 75C43C08E861 for ; Wed, 2 Dec 2020 01:43:26 -0800 (PST) Received: by mail-pg1-x542.google.com with SMTP id f17so754154pge.6 for ; Wed, 02 Dec 2020 01:43:26 -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=qlptgLAgYYEEBECAOSdw0l78qtjRaQyT/9MkpEBmWJU=; b=WxxRtYpdbnDZtPw8aTHbrkPc+jst9eXu8a/qPDLPBiWTxotTgJ8Ubm0oQ2o+y2RvFX RoKL2hzhmGcLywD4OEw1EPmRTjht7k1YQs3pUInAPwQ5gQlJ+LVpjgjZnkU5yXArFpMJ l5LL0RisqLXXnqITYhjmYDey6k5UxZfW5oq5cx9q+SX35hAUQYlV+03dh7owyGCPiKWg kPAWTDiWwnIM43ltUznEhK0yvwKHRRDIY6wL/Ioq3BSMF6wkmUJmdNOo4aL/Y5nlrB0a 5WBnDSEZ10wvhFbFTm1otfhZjJ2qRQ+6IHzqb7UKsalWCj74IY6jtn91JM355Oxyiohp XbfA== 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=qlptgLAgYYEEBECAOSdw0l78qtjRaQyT/9MkpEBmWJU=; b=oQyZM6jfXLnRqwsK6tRR/HQHxdzjY2kx9UEbuGM6XtVUBJ2b/rGZrE5oieHIgywFZC txxBDqumGyHtGJCV8A38ljI20n/tlKXWXHC91JqOmK+BNbDDPov5bqFm1HseXN8Zk9BV EIJ6LGvPry/7eIv97Ao40UTUxTz+PcqVOhpsWDa3tCS5mh3bHdSTVGmuBcYjPENacEGD DiUl82iBsqHpMYAU/JKL7Ao8+6QNXqYn+FPFQQ0z2UE8X0xVuSg5cI9B+K2U98t3anwj ggFppNg4qRnY4ACbUjX2abZJgIQ9TK38gN4a15qHHb+urg2I1x79BH/b89x7D+R2X2M8 7x5A== X-Gm-Message-State: AOAM531S8nM7omJQFhfuVtF0KsK2drW6Jh0+JD82kmsQkjWzUCmBgcAt T9kWPzKc7bU4SyLEzQE5qmerfoLOCXqk X-Received: by 2002:a63:e:: with SMTP id 14mr1879403pga.426.1606902206012; Wed, 02 Dec 2020 01:43:26 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id bg8sm1393990pjb.52.2020.12.02.01.43.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2020 01:43:25 -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 15/29] bus: mhi: core: Skip device wake in error or shutdown states Date: Wed, 2 Dec 2020 15:11:45 +0530 Message-Id: <20201202094159.107075-16-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 MHI client drivers can request a device wake even if the device may be in an error state or undergoing a shutdown. To prevent unnecessary device wake processing, check for the device state and bail out early so that the clients are made aware of the device state sooner. Signed-off-by: Bhaumik Bhatt Reviewed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/pm.c | 4 ++++ 1 file changed, 4 insertions(+) -- 2.25.1 diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c index 805b6fa748f0..029919647002 100644 --- a/drivers/bus/mhi/core/pm.c +++ b/drivers/bus/mhi/core/pm.c @@ -827,6 +827,10 @@ int __mhi_device_get_sync(struct mhi_controller *mhi_cntrl) /* Wake up the device */ read_lock_bh(&mhi_cntrl->pm_lock); + if (MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state)) { + read_unlock_bh(&mhi_cntrl->pm_lock); + return -EIO; + } mhi_cntrl->wake_get(mhi_cntrl, true); if (MHI_PM_IN_SUSPEND_STATE(mhi_cntrl->pm_state)) mhi_trigger_resume(mhi_cntrl); From patchwork Wed Dec 2 09:41:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 335964 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp778007ejs; Wed, 2 Dec 2020 01:45:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJz/unSL921oUdltvo4PHTVAHCqR+XdDyB6j0UaceHGnzQIoGmYX6sfWEqou0GaYU1rhrpy4 X-Received: by 2002:a17:907:6e6:: with SMTP id yh6mr1510362ejb.512.1606902303785; Wed, 02 Dec 2020 01:45:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606902303; cv=none; d=google.com; s=arc-20160816; b=NUxAPnM06fwGjkGLFeVUp7zfLBe9JS0H1w7t7B83IWbX3xMc0m7UMqQBiXhVAsYeBq Lnjmtx3aIvfjWFp5ShEKvUSracK5QOD4/yrMPd4azVkGhmKKnvclbHvPF7qB7bhWdY5k IDCxfDOXkpPdUPFqK8ENTtKudWIlGqwhEYbAvbu5e3qZ/sk+9N7p8aBw+w+A3r9fg7qM 830umJol6iONRAIow/7SuCGQ70jd8LEb29WCyDS2H6UE1LPv3pulERSRUOq+WvfpTLRh BLvKjBk9kI41jYwd0rd3JxFt4tI006ghlc3mmk37y6tJ+MLDtpcye2UQF/fXemFvmTCF RQaA== 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=rrPaCWKtGUJVYezpsd+8q+kGL2gwIXJvLaxfTN6qvNo=; b=cUGdLuxWoaLjW8sZ6nTt+OBHuiIjFv1+ehr7dkjGqWH6UxVOjnpCayLzhIfhbznRpg e3Gk62hD4jZa+DjOH0XEzZA3U1/2JCm+xaQvAXqn5Xe+1eH3t+UeuPgEHhg1V5/HTFfJ 424lB4fh3B206kCnpQufjCmARkOalsyYSnRuS0MD8M9vvT4iv1BOYxb679hUGrEoSGn/ t+K3610rKWRUnrWlsu3dXSp5GFfZ03Oj80Nky4nhnP0/0gjNDMfEHksM+B2gJJGCtbkd NAu2ITq7Wz47e6NoBWHUkFR8fHl2dLJUl+jKbNCiv6AmJ5l76Q8MCGB2J/ob1UZPBwXr OKSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=usxNVmK6; 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.03; Wed, 02 Dec 2020 01:45:03 -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=usxNVmK6; 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 S2388568AbgLBJoh (ORCPT + 15 others); Wed, 2 Dec 2020 04:44:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388579AbgLBJog (ORCPT ); Wed, 2 Dec 2020 04:44:36 -0500 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04FDAC08E863 for ; Wed, 2 Dec 2020 01:43:30 -0800 (PST) Received: by mail-pl1-x644.google.com with SMTP id 4so826016plk.5 for ; Wed, 02 Dec 2020 01:43:30 -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=rrPaCWKtGUJVYezpsd+8q+kGL2gwIXJvLaxfTN6qvNo=; b=usxNVmK6NkD1z1QZur0mj6TGTOwqQpBGST9yfR3GOnc2JqiHYPLppiT0RLJ0RiQEPu RQyCKHBHp+CrIeskswVJCyVC1iGLKeM5Qng19quXatToSLQIBc0N0uWR1gcifaU+uUkD Ums/C9YSk6VSwotdOCxY/51tX8HLo0yJQyavi46kvGzboaoWKU+TSC6uu6bQFfpewbkX 99ciFfdN1SjG898eLl2NXlKFHL45cow9SKpRF7hOSP3YdLkmv4f8g4XxVPJiVE+j2mo9 4dIi3lVyq/72uXZ8v/SG9kxy3tRe2s6CLiyurTg1LckX7fl29vPvjEFgtOhTo3mvcfkj wVAQ== 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=rrPaCWKtGUJVYezpsd+8q+kGL2gwIXJvLaxfTN6qvNo=; b=QbAAJE6Y4naHAFZXflXawtV7vX3xQ/u5WAmurUMo4FycscYMd4vpmuPkjn3TBlrtVm Djq3TZeRc6Hv6OP41lOE21HFgnlF9/0DwPacCBYgUqpjXa9K0wpYJm0UE3A41FKOWuCN 5KlO644ZFyeZgvzZDcJLRPQX9UL3nFgyTv7kEhUjrv5PhlyhdHS1aAwPGieYlasa0wq+ yK+qX8ZwIOfFWNq4GE3pd6f1H1ptdA4XT34Zr0u+fqhMRgyBRCIuw/miPoKaNhXJNU/7 8jdOX/Haa+K3tEME3qKSJLXJJmFdKTve8jAeXDOclrv76GoNJkKtY9SWK0VFQlJXtbkh auQQ== X-Gm-Message-State: AOAM531rRYAVHhv0IvKdGsIVKiaFK27y62fRdAo2PPAFOLTBE/ZZkX/E K9bq9LP+bjhXwa4ukNmgGUiMj7FVLt5D X-Received: by 2002:a17:902:7488:b029:da:6be9:3aac with SMTP id h8-20020a1709027488b02900da6be93aacmr1756772pll.59.1606902209554; Wed, 02 Dec 2020 01:43:29 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id bg8sm1393990pjb.52.2020.12.02.01.43.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2020 01:43:28 -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 16/29] bus: mhi: core: Move to SYS_ERROR regardless of RDDM capability Date: Wed, 2 Dec 2020 15:11:46 +0530 Message-Id: <20201202094159.107075-17-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 In some cases, the entry of device to RDDM execution environment can occur after a significant amount of time has elapsed and a SYS_ERROR state change event has already arrived. This can result in scenarios where MHI controller and client drivers are unaware of the error state of the device. Remove the check for rddm_image when processing the SYS_ERROR state change as it is present in mhi_pm_sys_err_handler() already and prevent further activity until the expected RDDM execution environment change occurs or the controller driver decides further action. Signed-off-by: Bhaumik Bhatt Reviewed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/main.c | 5 ----- 1 file changed, 5 deletions(-) -- 2.25.1 diff --git a/drivers/bus/mhi/core/main.c b/drivers/bus/mhi/core/main.c index f953e2a6d58a..91f8b8d05a62 100644 --- a/drivers/bus/mhi/core/main.c +++ b/drivers/bus/mhi/core/main.c @@ -737,11 +737,6 @@ int mhi_process_ctrl_ev_ring(struct mhi_controller *mhi_cntrl, { enum mhi_pm_state new_state; - /* skip SYS_ERROR handling if RDDM supported */ - if (mhi_cntrl->ee == MHI_EE_RDDM || - mhi_cntrl->rddm_image) - break; - dev_dbg(dev, "System error detected\n"); write_lock_irq(&mhi_cntrl->pm_lock); new_state = mhi_tryset_pm_state(mhi_cntrl, 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); From patchwork Wed Dec 2 09:41:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 335954 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp777884ejs; Wed, 2 Dec 2020 01:44:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJzBGPboikZ1JMy6i030THocMUBaS032MvMTpjJNa0xnLegqLWDWqgs5SZoasVgVSo1Ai1uA X-Received: by 2002:a17:907:216b:: with SMTP id rl11mr1497547ejb.61.1606902292112; Wed, 02 Dec 2020 01:44:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606902292; cv=none; d=google.com; s=arc-20160816; b=va+yHRE81t3rucFEhFmjS4uUZppT6/t4MffeumQ+Pg93XNE14o9NxlM8m+QDKizcNA slRNnf2zuqDlAmCGWn/9R3I4nG+usdXjqNjuVjvihkYuz1ki1R2RzacJyxrwSYc7ZcNj GnyDwRNldt8d+VOB49jxPO6oFeIFyKA+7HgomOvADBSLy4a1/ToMODauPN6Qr6v7O5Rq bE0DLZhIK0P7G2vsWP1rzZUN1m8V5xvSGVOpVZWesKt5Om617bZ6Wso5twWr3w2phXIo hEyWMmEG0Q/+8ZGQ6fiG/+DE2j46yNQ6RSyozedcGosrk7oMLrl7c6EvfwemaniYprcZ +KXw== 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=w1qiZN/4S+9EMfWyy+8/u8wFtLnh3UkIHeGY4tC9U34=; b=u/Xlx5Y9ndt0Z8V8d4qye8DOnLCRqStGi03z1qDMRSyR/9NYqa9vXyLI7huwwzV/72 KfzLfcJDRpCbAFO2wVK7QRGWETDG+YwWuV+wAl69ZD4DRiuo6WL93dCEI4x38RBYBuGM eCtGoK048Ubd1dMbRARgBSDqxc072xV4kDXdOCYvRYzPC4C239c0ovICBIyy+aM74tY0 SQNsAvts2aDx2MBoKlKX9RUsiSPMQh2ccl2jF2j5EZYdzR3zO83hS+evFKjsoqMgweoY xT0nGJ8lmK5R9ddiT/b9kcQgolzmfjWRn2ZMGNst3P9mHMshQ4c7Bj9HQfw5JRwd1SOu ykJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zjf7dqj9; 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.44.51; Wed, 02 Dec 2020 01:44:52 -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=zjf7dqj9; 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 S2388509AbgLBJoT (ORCPT + 15 others); Wed, 2 Dec 2020 04:44:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388508AbgLBJoR (ORCPT ); Wed, 2 Dec 2020 04:44:17 -0500 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F690C094241 for ; Wed, 2 Dec 2020 01:43:38 -0800 (PST) Received: by mail-pl1-x644.google.com with SMTP id p6so820190plr.7 for ; Wed, 02 Dec 2020 01:43:38 -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=w1qiZN/4S+9EMfWyy+8/u8wFtLnh3UkIHeGY4tC9U34=; b=zjf7dqj9hi2/BvOyAMs9XQ39ZYbjNabsET/QZakL/4MpzRgj4wOZg0CsnlY2V1y+8+ m6JdzUQ8cnT4nm6CRs0q/PvTx/hIouMTTtNNuteE6fa8q5chTEVplfFDwA9ki2gZTYjG wO0pcULhGhzHM+bpqqM5p7zg3xzJFjkux5IhRcTrQaPTbn8salQyrWvtQR6jBhfvxo21 i7gkC9F5QnjH6PhHTzXB0EmpoSJ33brqRVYwD2bvpmnASLxnBBVVM/FkvWAgOQu9NTWP 44YvYTMHjG9N/KKWru3yuxxv952M/FHimSsCkpC96vyjvPxZTAbQhoFRy7ZSDsS/63Bb wmaw== 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=w1qiZN/4S+9EMfWyy+8/u8wFtLnh3UkIHeGY4tC9U34=; b=XuJB0ATy7oTk3CSGk5xXZIbaeB1kHvAtYrh1UwKESWSQXIDNY+N4K9lCsMHHUK5Rxl svfqzeX8uQEPMj4UQetQWCL4UFD9yZ/3nX4pz7liJZrrMv+x9DCUbgZMQJ+MXMTeDa10 dCGT37y/R21CHijcT6aF12OQAC7ziFywrj26Us8bx3qXfR0j+sUYce3VU10ngcr5ziQ7 VWeXdBPHz9moso1cQqdo2pxsnw17RDjMBtHtZjE9lRL6WA2qBBP5iEdhRZANVWV8+fkF Bb7HwrvasUJX0/i5HFGBq70MI2RwKwZrOe6HJ1fRUDj0fTjTxtxM1wD0GJzQxtjIeyuF Ukfg== X-Gm-Message-State: AOAM531m35EScisrr+5itTQ+tt8gvtwJfKc1T27NWZanarCutysaAj7N GpeWr2+EdveutWLdxMtNMjGQ X-Received: by 2002:a17:902:b783:b029:da:6567:f244 with SMTP id e3-20020a170902b783b02900da6567f244mr1811669pls.45.1606902217527; Wed, 02 Dec 2020 01:43:37 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id bg8sm1393990pjb.52.2020.12.02.01.43.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2020 01:43:36 -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 18/29] bus: mhi: core: Move to an error state on any firmware load failure Date: Wed, 2 Dec 2020 15:11:48 +0530 Message-Id: <20201202094159.107075-19-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 Move MHI to a firmware download error state for a failure to find the firmware files or to load SBL or EBL image using BHI/BHIe. This helps detect an error state sooner and shortens the wait for a synchronous power up timeout. Signed-off-by: Bhaumik Bhatt Reviewed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/boot.c | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) -- 2.25.1 diff --git a/drivers/bus/mhi/core/boot.c b/drivers/bus/mhi/core/boot.c index 2d7752cd9ccc..7b57bb9a3080 100644 --- a/drivers/bus/mhi/core/boot.c +++ b/drivers/bus/mhi/core/boot.c @@ -428,13 +428,13 @@ void mhi_fw_load_handler(struct mhi_controller *mhi_cntrl) !mhi_cntrl->seg_len))) { dev_err(dev, "No firmware image defined or !sbl_size || !seg_len\n"); - return; + goto error_fw_load; } ret = request_firmware(&firmware, fw_name, dev); if (ret) { dev_err(dev, "Error loading firmware: %d\n", ret); - return; + goto error_fw_load; } size = (mhi_cntrl->fbc_download) ? mhi_cntrl->sbl_size : firmware->size; @@ -446,7 +446,7 @@ void mhi_fw_load_handler(struct mhi_controller *mhi_cntrl) buf = mhi_alloc_coherent(mhi_cntrl, size, &dma_addr, GFP_KERNEL); if (!buf) { release_firmware(firmware); - return; + goto error_fw_load; } /* Download image using BHI */ @@ -454,17 +454,17 @@ void mhi_fw_load_handler(struct mhi_controller *mhi_cntrl) ret = mhi_fw_load_bhi(mhi_cntrl, dma_addr, size); mhi_free_coherent(mhi_cntrl, size, buf, dma_addr); - if (!mhi_cntrl->fbc_download || ret || mhi_cntrl->ee == MHI_EE_EDL) - release_firmware(firmware); - /* Error or in EDL mode, we're done */ if (ret) { dev_err(dev, "MHI did not load image over BHI, ret: %d\n", ret); - return; + release_firmware(firmware); + goto error_fw_load; } - if (mhi_cntrl->ee == MHI_EE_EDL) + if (mhi_cntrl->ee == MHI_EE_EDL) { + release_firmware(firmware); return; + } write_lock_irq(&mhi_cntrl->pm_lock); mhi_cntrl->dev_state = MHI_STATE_RESET; @@ -477,13 +477,17 @@ void mhi_fw_load_handler(struct mhi_controller *mhi_cntrl) if (mhi_cntrl->fbc_download) { ret = mhi_alloc_bhie_table(mhi_cntrl, &mhi_cntrl->fbc_image, firmware->size); - if (ret) - goto error_alloc_fw_table; + if (ret) { + release_firmware(firmware); + goto error_fw_load; + } /* Load the firmware into BHIE vec table */ mhi_firmware_copy(mhi_cntrl, firmware, mhi_cntrl->fbc_image); } + release_firmware(firmware); + fw_load_ee_pthru: /* Transitioning into MHI RESET->READY state */ ret = mhi_ready_state_transition(mhi_cntrl); @@ -512,11 +516,11 @@ void mhi_fw_load_handler(struct mhi_controller *mhi_cntrl) ret = mhi_fw_load_bhie(mhi_cntrl, /* Vector table is the last entry */ &image_info->mhi_buf[image_info->entries - 1]); - if (ret) + if (ret) { dev_err(dev, "MHI did not load image over BHIe, ret: %d\n", ret); - - release_firmware(firmware); + goto error_fw_load; + } return; @@ -524,6 +528,7 @@ void mhi_fw_load_handler(struct mhi_controller *mhi_cntrl) mhi_free_bhie_table(mhi_cntrl, mhi_cntrl->fbc_image); mhi_cntrl->fbc_image = NULL; -error_alloc_fw_table: - release_firmware(firmware); +error_fw_load: + mhi_cntrl->pm_state = MHI_PM_FW_DL_ERR; + wake_up_all(&mhi_cntrl->state_event); } From patchwork Wed Dec 2 09:41:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 335953 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp777891ejs; Wed, 2 Dec 2020 01:44:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJwyGjkc9oidK2EfKi8cDFurzHC1nA4SLd693FVJTyICm8MCrKGKh7lEaQw4RUWB7WYTYmVR X-Received: by 2002:a17:906:c312:: with SMTP id s18mr1509302ejz.185.1606902292623; Wed, 02 Dec 2020 01:44:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606902292; cv=none; d=google.com; s=arc-20160816; b=MgiHC4ElKOtMKuRbl4NKEHcoxD9Wzq4ZQdJFzloAawOTyq6oL2Daw9iQeuvi3DabkV BOuMQlDJfAXHwdyts/VDfTZKQNvGQdhyVci46szJOfeHePtjs8Pufgrb/w6Lb+MuYzte LbQQhwfELIVibmc6VSYJUGWpYT/qd8N4zramVTD2DhPfYvl6lxiKso9W6O0c8gGC3w57 hFuVmSAp0BHvoGFvTPrK10ai6JJvzR71TDmzBZtFGcgKyq3pdN5jPvF5XrT1l97OU+y5 7wogDEhzeDso3MfddBrTrjiRYbGS6zDdxYk2w9wF6VIpujPlIj0m5waEbP17AAd5PR2A rYTA== 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=nTb4bDaGBERzc1DVzOJ+hYUZw8vd3IFev46E0aJe5pM=; b=Kslx4yeFxKZuyJ3tT6HaLlrg9Pe/yflV5iwPTbifsthI3zvoxInK90wv5rfMm5Cn/e pjEiLoOeGhQYrNpQ2auS13Ofe2jPSVfPGyHzQIwg1ziMY9qtAvEzVC/5T3BJ/7PitqZL DxEP0oLCpqqQyu+/i8bcchKrbI7k2xj/bhLmlR6UU6mAqQQubK86KjpzNRzMIyaB0+KH K8oA+R2Uc9JmC6sKAnnPWhqR4lmdJ6k0o0EDXFQe7NQ1p+L0TMkm8yhGy6nlVnk7VOCu FHOFC5Wsviw863/YWpcs8Xx0BRrclRYQ14AyTh+P4nvD5zJyfbLDI1TcgDVmR0pswXN5 uzYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=k7weTbPz; 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.44.52; Wed, 02 Dec 2020 01:44:52 -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=k7weTbPz; 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 S1729031AbgLBJoZ (ORCPT + 15 others); Wed, 2 Dec 2020 04:44:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388374AbgLBJoY (ORCPT ); Wed, 2 Dec 2020 04:44:24 -0500 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 E6141C094243 for ; Wed, 2 Dec 2020 01:43:41 -0800 (PST) Received: by mail-pj1-x1041.google.com with SMTP id h7so418790pjk.1 for ; Wed, 02 Dec 2020 01:43:41 -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=nTb4bDaGBERzc1DVzOJ+hYUZw8vd3IFev46E0aJe5pM=; b=k7weTbPzd4qGAVsY0L3rLmh9fBgRionLY7FttqxE6LGukCO2max1ZCFgN9WSbe+lZG JGoOF1iLesIb/xK6tMaVEoTJBYjUfqUctyBTLDYLxxJU9vdgGbgK46NrGKvXtgm+/XJ5 n3xU45AhitmECN9KrB16z3uy3Rzn5byBI3UTZu/4BNihJiwfEKqv0mSQwcDzB1+CNm5m kYOO5Ty7F7jhmnhTRbZgWz58Eok8ejEekHBBPvMUBUFx3vT/2nyu49YPRbdlF3sopMuu lpZlGdXlWkJ6yyg9xpFnQtkvMOJ8D/9ecOdUP9Wfrc7b1PtiMrOGf3fTFQZ6qhWk+BTC TbSw== 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=nTb4bDaGBERzc1DVzOJ+hYUZw8vd3IFev46E0aJe5pM=; b=abtjXIb8rqR/5xC0QoBagaj7+2dbMakp0UuAbOJ2gXzMBksDzabRcupd4oy9Z5KOuT 1E4VgXYSKGTnFxfpHc7FGiqgjNSfDKAbnXVFFEZx+SLaPiD/ZwD1hEdYxepgyImtNmmo B7xtGuDNUE4vj1T1Tm+gGnhXuVGT3cageCTeCJQ6dhPDbLboR8e+Hn1g2xL6HLocw5Q+ rbho0SU69FvTcCtPttZEnGkpwCUF5frFWhd8QIPXAgO8Hy0lkYNfFqZmI89kf7ea6dfR /B2OOXccdA8SLUpY8XTQb0q+Zg/m0oGP0kEKnww/N22vJyPoWcEwJ2GEkOkZsoFCsKb2 Y0Sg== X-Gm-Message-State: AOAM533/PqyDEAeffAK2tTiVttSx0yB7IMSFjyumq8Qsn/YWlzuezluW FnWzh1B5WFTJJMtBPePmMGD3Oa0ZIF1A X-Received: by 2002:a17:902:469:b029:da:17d0:e755 with SMTP id 96-20020a1709020469b02900da17d0e755mr1943968ple.53.1606902221432; Wed, 02 Dec 2020 01:43:41 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id bg8sm1393990pjb.52.2020.12.02.01.43.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2020 01:43:40 -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 19/29] bus: mhi: core: Use appropriate label in firmware load handler API Date: Wed, 2 Dec 2020 15:11:49 +0530 Message-Id: <20201202094159.107075-20-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 Correct the "error_read" label to say "error_ready_state" as that is the appropriate usage of the label. Signed-off-by: Bhaumik Bhatt Reviewed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/boot.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.25.1 diff --git a/drivers/bus/mhi/core/boot.c b/drivers/bus/mhi/core/boot.c index 7b57bb9a3080..c2546bf229fb 100644 --- a/drivers/bus/mhi/core/boot.c +++ b/drivers/bus/mhi/core/boot.c @@ -497,7 +497,7 @@ void mhi_fw_load_handler(struct mhi_controller *mhi_cntrl) if (ret) { dev_err(dev, "MHI did not enter READY state\n"); - goto error_read; + goto error_ready_state; } /* Wait for the SBL event */ @@ -508,7 +508,7 @@ void mhi_fw_load_handler(struct mhi_controller *mhi_cntrl) if (!ret || MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state)) { dev_err(dev, "MHI did not enter SBL\n"); - goto error_read; + goto error_ready_state; } /* Start full firmware image download */ @@ -524,7 +524,7 @@ void mhi_fw_load_handler(struct mhi_controller *mhi_cntrl) return; -error_read: +error_ready_state: mhi_free_bhie_table(mhi_cntrl, mhi_cntrl->fbc_image); mhi_cntrl->fbc_image = NULL; From patchwork Wed Dec 2 09:41:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 335955 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp777893ejs; Wed, 2 Dec 2020 01:44:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJzboJjqZBf0vwR2ZrgcYa3ZQ8RjATjvas2DdVU6mIlk9fGRoJfEtm6GLtMa1yRlLD3B8Sud X-Received: by 2002:a50:d8c8:: with SMTP id y8mr1747081edj.82.1606902293334; Wed, 02 Dec 2020 01:44:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606902293; cv=none; d=google.com; s=arc-20160816; b=sNbfZRVXgetkycF5/b8hYH7Hkg2wnyJVxgGCkd+/r7+4e/Bwm8jMVN69b8Vc8dLTu4 isVimMkq0k9ba/o87xkV/LqnPuUfIe3xEXvSVVjp8dz9v9eTYh7hKJ64oSp7j7IE5+6I QOxxUZUck7xu2+uvaLiQPDcjWnH9tauP4m2XUahK5syNT/paP+9LYRW9Wy2uQVIsaY93 A3vJN0aOlNfR2YCPHN4ZbdTUNvC1ijNpcZpCtI1OGyMLR5AWkbP2+Q/hKj/JeT6+Rfl9 1NcEeD3rYD9tfkKwxpgeBRsaBD52+1+xVy3UCOkAu07BVt8So6J7aXM9ooXr15nNNH08 rB4A== 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=aCsmJ1k49Ua8PjKSNyR1qR4vjZ+Bg7VpSSpGmvdAxP4=; b=D4fkoqsHInHVCLyxGbfWyS25u7mGXmkqHODxaieRPe8Xv+gWsGYmEH5svn4fep9j/L hJnIhbuY1yO4pPQE1Cc3OOTlsAdbXETaBNJ99M3sRJA4ZhSLeM5mj9LDHCDIePhEm+dW A/kaYjH1OeFHS7CgzCl3cFUdyjIC3RWQnTd1ID2n906XLf+h8Re9yZMYdRKIVfMXudPg SYAGldCRE0cYHwhiaE3PI+XjjNDqjWaqNZfYHLP0x5j5WImxvSP7uHmT7JZb4+81H4MR d05LUA4adWw+R8/MATxrBfMLATlhg6Hci820FtiLff+MPWtLib6CR+G+D8/DW82+wdRG ThzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iURQzayB; 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.44.52; Wed, 02 Dec 2020 01:44:53 -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=iURQzayB; 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 S2388374AbgLBJo0 (ORCPT + 15 others); Wed, 2 Dec 2020 04:44:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728701AbgLBJoZ (ORCPT ); Wed, 2 Dec 2020 04:44:25 -0500 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 C5F0AC09424A for ; Wed, 2 Dec 2020 01:43:45 -0800 (PST) Received: by mail-pj1-x1044.google.com with SMTP id v1so704127pjr.2 for ; Wed, 02 Dec 2020 01:43:45 -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=aCsmJ1k49Ua8PjKSNyR1qR4vjZ+Bg7VpSSpGmvdAxP4=; b=iURQzayB6DZcAa6cIYUASPN9FTCA/rrz22OrT9v/7F9lTCleMF4QmpQWCJKUdxeYb6 VZVXrz/e0pPSGKvrnswS0l3+fv9vvB/kLMUK4IekhjY9lNBv3o5dHs76bIXg4bZ6S348 l5Dq0b2z4bRJ6UigcPOdRLyow/h4T9Q4nLJOfaFNYiGp6gmYAKN9ukGjhQYimcsJE4WM TGU5Gmda75k6nJgeQ9PBfFweTYEBGbnWMls4tQ5Vvy5+ybAZ/lUB/Sw5Ioj7hmfKxbhX TPYpWhKWBlmn7MOZ0KwIPSDVummw0SjctlVWN73UojBkgVsCNdmUJxFV3wvS8bAPowx+ zp0w== 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=aCsmJ1k49Ua8PjKSNyR1qR4vjZ+Bg7VpSSpGmvdAxP4=; b=T0MyeIM2W4swkoajy1r0PQKTwv2ZiONMkDvA8bmbh8iRIvuMLJZcPkq4tcg7GCciyD bUYe/NOpf/71slpFrsNUdpU7MrUMaJAHkBh8Zur+4lbJshLGCDig/2cI13NWmVNfUx5P M+JliYWleaCjrSSn1B/7oMAsufbr4IAkaxUMLjAfCk8eG7wm+Pc7Pm4ojCEqwiWrGMw9 eVzI7AWgwJTt/rvdDQFyLEmBp6VuGRS6fyYE4hJK2PD/OvTQlff4Dw4n6RYO70E2KWDR lTHnDPRi1qDWLRvsldelzumMIxEvDzIiSTQTl5CiF/Ilph+MnvbANSLr+sXev4JKnGGI +NOg== X-Gm-Message-State: AOAM531Z7ppzhaeCdcSf50JezrRdFZ0JHjWrCKSFZBoB5xYPWIPbWwvw pdVDkRu7dBy3tmeNU7TQ5o7v X-Received: by 2002:a17:90a:7d0c:: with SMTP id g12mr1588052pjl.77.1606902225327; Wed, 02 Dec 2020 01:43:45 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id bg8sm1393990pjb.52.2020.12.02.01.43.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2020 01:43:44 -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 20/29] bus: mhi: core: Move to an error state on mission mode failure Date: Wed, 2 Dec 2020 15:11:50 +0530 Message-Id: <20201202094159.107075-21-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 the host receives a mission mode event and by the time it can get to processing it, the register accesses fail implying a connectivity error, MHI should move to an error state. This helps avoid longer wait times from a synchronous power up perspective and accurately reflects the MHI execution environment and power management states. Signed-off-by: Bhaumik Bhatt Reviewed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/pm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) -- 2.25.1 diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c index 029919647002..06adea2580d2 100644 --- a/drivers/bus/mhi/core/pm.c +++ b/drivers/bus/mhi/core/pm.c @@ -383,10 +383,14 @@ static int mhi_pm_mission_mode_transition(struct mhi_controller *mhi_cntrl) write_lock_irq(&mhi_cntrl->pm_lock); if (MHI_REG_ACCESS_VALID(mhi_cntrl->pm_state)) mhi_cntrl->ee = mhi_get_exec_env(mhi_cntrl); - write_unlock_irq(&mhi_cntrl->pm_lock); - if (!MHI_IN_MISSION_MODE(mhi_cntrl->ee)) + if (!MHI_IN_MISSION_MODE(mhi_cntrl->ee)) { + mhi_cntrl->pm_state = MHI_PM_LD_ERR_FATAL_DETECT; + write_unlock_irq(&mhi_cntrl->pm_lock); + wake_up_all(&mhi_cntrl->state_event); return -EIO; + } + write_unlock_irq(&mhi_cntrl->pm_lock); wake_up_all(&mhi_cntrl->state_event); From patchwork Wed Dec 2 09:41:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 335956 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp777903ejs; Wed, 2 Dec 2020 01:44:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJyjYV7MrbS+oUxwnuKzi1AwvCGPvxcU0bbDZCcfa3W2k4/qqmHg/J6ZGrlknAZZb4eL53d5 X-Received: by 2002:a17:906:52da:: with SMTP id w26mr1489801ejn.347.1606902294291; Wed, 02 Dec 2020 01:44:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606902294; cv=none; d=google.com; s=arc-20160816; b=Ol+VT/67oQDqw4JTIsk8X96x9nF4Q+CoKPMSKqD0Xv2j8QCCrebyaS3Nx9TQIIujc2 dDFinprNhV4Gylgg/Cu8+2j1UZngIILUsxCBrYYgGXbFPWSLtrAMs9nWWVUnaLVkmEEY wvzOMf1hmebgp+SiZQI2YKmUNPOiocTJWQGP1hI0q1MmQUUA0i9TnVJnPGFGnwJPe7zC Cccpz7xWOE7U1LHIl+sWLIKGSAYIOpncOCx9lEE25vwZeAxkAV0cGsCrth/RyeE+neiV YFY2wLcDwBETWEWkLzeMkYLxG6JlA7GWYC/fURfxRwGGcqWZbP8KhDnNdgNrMzPwFRrG gv6g== 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=UJzmIzhninA4VTeT0eWcsBnXmToO3ytXqgYb0lUnRM4=; b=RjaAiBa1y/TV2Kq0+y36RnXoaqBHe00G43V66Kwl5oXhqyPFY46I3QXzsaka6qh+kb cqu9KlkkCMuSfFQV5NBSGTDAxTXPEePP3DI+TmaTzWkf4K5WSLQbqWA6/EqP5X+f0dnQ xtuS3uQWN1GG44dbHKulp+sKpS+hmdQgvSdOxhJS/K8Hv3MEiUiODQcWffddvNDHN1ce V2ZFKi/lXjceqPHJZQVJjjCkk2XKkST6+bLn6/SLrde4HjaoiQjjda8E4mP23vt4/UCP VuTK4ipaMCcxKV59W3Ijhdvky0d+r40afKrt8ex7u1+WdEB51UoWaWvSnvQ+imrI8x84 wcbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TBqpLwrc; 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.44.54; Wed, 02 Dec 2020 01:44:54 -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=TBqpLwrc; 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 S2388543AbgLBJo3 (ORCPT + 15 others); Wed, 2 Dec 2020 04:44:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388537AbgLBJo1 (ORCPT ); Wed, 2 Dec 2020 04:44:27 -0500 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 BC8FFC061A48 for ; Wed, 2 Dec 2020 01:43:49 -0800 (PST) Received: by mail-pg1-x541.google.com with SMTP id o5so744975pgm.10 for ; Wed, 02 Dec 2020 01:43:49 -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=UJzmIzhninA4VTeT0eWcsBnXmToO3ytXqgYb0lUnRM4=; b=TBqpLwrcJRgnSxjt1FUXwny6S57FDRh0MuxFiVRxDZZ3XWs+RvuzKSQnrNJEPoqoIU Zss8u7OOsaHx3H/qNM1rpPWT2k9J+6OnOytmhSzbatmv9xySy8nWhZSAhWw6GmVWGT7Z ZmxSHKd7KsHj+Lge04kNQo4LHKk9FzWp0CXQWQyWuwCGXNpVHzua3viEQbZpcnO+Sgb9 Zt6aj6yA0PYEx5CmX2Eu8olVpdEDx1kyEi1ANanf5QnMso8p6dXPIcql+//zansga8RA 76RHUuyM3j3t8rSPwb+djCb8++Ae3zoql3P1GrIfl0ExN4rY+kd+cHcJMTjDGmHdRBHj sLuw== 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=UJzmIzhninA4VTeT0eWcsBnXmToO3ytXqgYb0lUnRM4=; b=W5zeSqXDrpRif7H6q0pBZvKpQJ7HyOqfuKl1+XUF8c3lhWbexoz0xqj/1t9nnKKfR2 OzKMmPQb8yBQbJ6yrGlHTS5zrJuumzK0h8K1DGf1/LGDcLJk1vNDjHAxwd3vLij153g+ mgxQdrKm2Mvh6ZZlREieF9A9f2Lag+DOz3OLrpMSOqqYNuEn1dE2MEyCa1HwMkok7nqw KFPDvUPxfBdJhhhyR6QcZ27xLZuZMtgKk+CSPe6fq0rxXqrwuZ3VZV7f2cIJFTcl7vPS 3llPeo+tFyeQoDD8tbO/TzCw6yrLV3QzNsQ8XhcWuPlZDolcV+/M7hdEsQ48UeppRF3s RMLQ== X-Gm-Message-State: AOAM532XbLFOc3ErQqP3Ai4xAx1nlEbV5/yedp/DEIep91bpZrL4yM3X Y4Iwg2dFIiDYy+ha5x9d2p7V X-Received: by 2002:a05:6a00:892:b029:19c:7b0e:19ea with SMTP id q18-20020a056a000892b029019c7b0e19eamr1814314pfj.5.1606902229225; Wed, 02 Dec 2020 01:43:49 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id bg8sm1393990pjb.52.2020.12.02.01.43.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2020 01:43:48 -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 21/29] bus: mhi: core: Check for IRQ availability during registration Date: Wed, 2 Dec 2020 15:11:51 +0530 Message-Id: <20201202094159.107075-22-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 Current design allows a controller to register with MHI successfully without the need to have any IRQs available for use. If no IRQs are available, power up requests to MHI can fail after a successful registration with MHI. Improve the design by checking for the number of IRQs available sooner within the mhi_regsiter_controller() API as it is required to be specified by the controller. Signed-off-by: Bhaumik Bhatt Reviewed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/init.c | 2 +- drivers/bus/mhi/core/pm.c | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) -- 2.25.1 diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c index 877e40c86801..2534f1c9c153 100644 --- a/drivers/bus/mhi/core/init.c +++ b/drivers/bus/mhi/core/init.c @@ -858,7 +858,7 @@ int mhi_register_controller(struct mhi_controller *mhi_cntrl, if (!mhi_cntrl->runtime_get || !mhi_cntrl->runtime_put || !mhi_cntrl->status_cb || !mhi_cntrl->read_reg || - !mhi_cntrl->write_reg) + !mhi_cntrl->write_reg || !mhi_cntrl->nr_irqs) return -EINVAL; ret = parse_config(mhi_cntrl, config); diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c index 06adea2580d2..1d04e401b67f 100644 --- a/drivers/bus/mhi/core/pm.c +++ b/drivers/bus/mhi/core/pm.c @@ -926,9 +926,6 @@ int mhi_async_power_up(struct mhi_controller *mhi_cntrl) dev_info(dev, "Requested to power ON\n"); - if (mhi_cntrl->nr_irqs < 1) - return -EINVAL; - /* Supply default wake routines if not provided by controller driver */ if (!mhi_cntrl->wake_get || !mhi_cntrl->wake_put || !mhi_cntrl->wake_toggle) { From patchwork Wed Dec 2 09:41:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 335969 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp778917ejs; Wed, 2 Dec 2020 01:46:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJwl7SttF0fLov6CJq9w8KgF7uOUBErVunSkQP4pgWawbxljvb2rtuREyPYIdQtjj6j9yIlK X-Received: by 2002:a50:fc11:: with SMTP id i17mr1793752edr.112.1606902402134; Wed, 02 Dec 2020 01:46:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606902402; cv=none; d=google.com; s=arc-20160816; b=mxWwsqjTajVFXjw+WeA0qu8G+J89iEwmuSvcL5Q5FtzzpQazrjkjSfRvhEvqFFSoEx KBpyrNKQI6WiwtVWCdJvdG8VAOLShvgLT+/BXmcc0hDUGcEP2h8aV8nrjIYRePGKzowL Hd+FoAPzxeuUrKC9nua4IiSCY0SGIQR8+RS9YMpNWer9EWVEtuVMxxACDMuG4EXqKjeW eXHMVdmBshIBlCZdrhqi/iNIsTGAfci8/aV1vGdvzFxazTZXHs2K1TvnAH3aA/kcI61J 62g82R1OOaxnIt0RgjSBdVhKRN7Vfz+I33L50ICCvocRydYzKMdsni2SOZqUHdZIu6Uk 3pvA== 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=DxMcwlRnYOKwFiXUfJbjrsm9AnRKM8HjvrrBztUq5gc=; b=mOT4TvohwPSNacFMmeijKg9StSPNjmHbaKG4dmYVLyqIvXJ03kQi2/1mUmSymbzyXQ IfkiE//TUMoPaFo9pxCmtYyorP2MGjjpaiWMQ1ktaTSkcnMLvypvK7UckbWHmWcqdcLU UvETKIUokLANTTSz0o61r0d8yKuj0r1xy1ASDUTnvBC9JqyFOfWzl1s1HN2NQZ39VmEm 5TQMly1h898Hpi6DHbR9VnZG1AvZmEUM/oQtja7C4CKoBTcxOnI/GAsazO7xsyyksQgU YN54fWSg0dK/YqLu1T0v4OLYloio9mmQ2N/MY5xod0S9tNJ6eHLovSdsgiXx8RsdKBiG O/rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QHcSwPcw; 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 d27si564967ejt.291.2020.12.02.01.46.41; Wed, 02 Dec 2020 01:46:42 -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=QHcSwPcw; 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 S2388557AbgLBJod (ORCPT + 15 others); Wed, 2 Dec 2020 04:44:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388323AbgLBJoc (ORCPT ); Wed, 2 Dec 2020 04:44:32 -0500 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 CAF4AC061A47 for ; Wed, 2 Dec 2020 01:43:53 -0800 (PST) Received: by mail-pg1-x541.google.com with SMTP id w4so733900pgg.13 for ; Wed, 02 Dec 2020 01:43:53 -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=DxMcwlRnYOKwFiXUfJbjrsm9AnRKM8HjvrrBztUq5gc=; b=QHcSwPcwGVNBEE5mvHIAqYAg6N20F+Jv7lqpw2qmnk8AQLttJtVTuTjE5aBvpXvoAu 7xqe9gdR0C77nbXxM8ejB40Ax1GAHQw3QgoqKTgziJxwjcM+U/u1j8/4sXgHtdKDeYeI LFVp4TGkJ9NqlYqZwT8vBr4BH09J1SUbGW5mYU8HvyToh0H4IJ8pfSxTThbsBW2l9T/R qk9PsXEUiEuZS888+AlzkGVXVErcw6jKYy/k7agzcusaKPxt2a1OdsLh3zncu6TeRCZm Vt/7JAGnvW8V8o3FkIcpqwtcEh8jHluguanOlAx4vPNxrZwq0CI7VGjxYdLhBEdH+IO7 LDhg== 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=DxMcwlRnYOKwFiXUfJbjrsm9AnRKM8HjvrrBztUq5gc=; b=kLtvRqfp41MaiSrhmJQhrvxE5l0jYvxushwN2ohQ8f9EjOut4NKdDWgKM3FZuIn02L 1gfCaLuXjduQMWs14rpL0sYfSHJyRvkhSuQxPg0a7580GU+1tG5pfAidBNFatxDIbM7H jwk0x6wXnFvD3oshmV4wD1MDfDvq/yQZs/Gza+qSbAb0pG6UjWBmRThJUBAiqOL+DfcK tfgZHjf1rKZMckgBaxrTdB3JJgq5tVdfCFWHM/Ew/S3XLf3gpatvWIxRK4X0m4NAgJTP je145g1ngxFeYXOFistfJr0uLifkR9HmgKGD0bzuT/UfNs86/G8zHJdoK9nr5NRf7Jgd YOwA== X-Gm-Message-State: AOAM530d0DCS9JIFrM1ssOWXOlF1JUuxIoB36DmVPSNuLhtAODdO3Csa HzBBDt0wC3xeFKe8W7QGpD+M X-Received: by 2002:a63:5802:: with SMTP id m2mr1907530pgb.58.1606902233325; Wed, 02 Dec 2020 01:43:53 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id bg8sm1393990pjb.52.2020.12.02.01.43.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2020 01:43:52 -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 22/29] bus: mhi: core: Separate system error and power down handling Date: Wed, 2 Dec 2020 15:11:52 +0530 Message-Id: <20201202094159.107075-23-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 Currently, there exist a set of if...else statements in the mhi_pm_disable_transition() function which make handling system error and disable transitions differently complex. To make that cleaner and facilitate differences in behavior, separate these two transitions for MHI host. Signed-off-by: Bhaumik Bhatt Reviewed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/pm.c | 159 ++++++++++++++++++++++++++++++++------ 1 file changed, 137 insertions(+), 22 deletions(-) -- 2.25.1 diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c index 1d04e401b67f..347ae7dd6cf8 100644 --- a/drivers/bus/mhi/core/pm.c +++ b/drivers/bus/mhi/core/pm.c @@ -444,7 +444,7 @@ static int mhi_pm_mission_mode_transition(struct mhi_controller *mhi_cntrl) return ret; } -/* Handle SYS_ERR and Shutdown transitions */ +/* Handle shutdown transitions */ static void mhi_pm_disable_transition(struct mhi_controller *mhi_cntrl, enum mhi_pm_state transition_state) { @@ -460,10 +460,6 @@ static void mhi_pm_disable_transition(struct mhi_controller *mhi_cntrl, to_mhi_pm_state_str(mhi_cntrl->pm_state), to_mhi_pm_state_str(transition_state)); - /* We must notify MHI control driver so it can clean up first */ - if (transition_state == MHI_PM_SYS_ERR_PROCESS) - mhi_cntrl->status_cb(mhi_cntrl, MHI_CB_SYS_ERROR); - mutex_lock(&mhi_cntrl->pm_mutex); write_lock_irq(&mhi_cntrl->pm_lock); prev_state = mhi_cntrl->pm_state; @@ -502,11 +498,8 @@ static void mhi_pm_disable_transition(struct mhi_controller *mhi_cntrl, MHICTRL_RESET_SHIFT, &in_reset) || !in_reset, timeout); - if ((!ret || in_reset) && cur_state == MHI_PM_SYS_ERR_PROCESS) { + if (!ret || in_reset) dev_err(dev, "Device failed to exit MHI Reset state\n"); - mutex_unlock(&mhi_cntrl->pm_mutex); - return; - } /* * Device will clear BHI_INTVEC as a part of RESET processing, @@ -566,19 +559,142 @@ static void mhi_pm_disable_transition(struct mhi_controller *mhi_cntrl, er_ctxt->wp = er_ctxt->rbase; } - if (cur_state == MHI_PM_SYS_ERR_PROCESS) { - mhi_ready_state_transition(mhi_cntrl); - } else { - /* Move to disable state */ - write_lock_irq(&mhi_cntrl->pm_lock); - cur_state = mhi_tryset_pm_state(mhi_cntrl, MHI_PM_DISABLE); - write_unlock_irq(&mhi_cntrl->pm_lock); - if (unlikely(cur_state != MHI_PM_DISABLE)) - dev_err(dev, "Error moving from PM state: %s to: %s\n", - to_mhi_pm_state_str(cur_state), - to_mhi_pm_state_str(MHI_PM_DISABLE)); + /* Move to disable state */ + write_lock_irq(&mhi_cntrl->pm_lock); + cur_state = mhi_tryset_pm_state(mhi_cntrl, MHI_PM_DISABLE); + write_unlock_irq(&mhi_cntrl->pm_lock); + if (unlikely(cur_state != MHI_PM_DISABLE)) + dev_err(dev, "Error moving from PM state: %s to: %s\n", + to_mhi_pm_state_str(cur_state), + to_mhi_pm_state_str(MHI_PM_DISABLE)); + + dev_dbg(dev, "Exiting with PM state: %s, MHI state: %s\n", + to_mhi_pm_state_str(mhi_cntrl->pm_state), + TO_MHI_STATE_STR(mhi_cntrl->dev_state)); + + mutex_unlock(&mhi_cntrl->pm_mutex); +} + +/* Handle system error transitions */ +static void mhi_pm_sys_error_transition(struct mhi_controller *mhi_cntrl) +{ + enum mhi_pm_state cur_state, prev_state; + struct mhi_event *mhi_event; + struct mhi_cmd_ctxt *cmd_ctxt; + struct mhi_cmd *mhi_cmd; + struct mhi_event_ctxt *er_ctxt; + struct device *dev = &mhi_cntrl->mhi_dev->dev; + int ret, i; + + dev_dbg(dev, "Transitioning from PM state: %s to: %s\n", + to_mhi_pm_state_str(mhi_cntrl->pm_state), + to_mhi_pm_state_str(MHI_PM_SYS_ERR_PROCESS)); + + /* We must notify MHI control driver so it can clean up first */ + mhi_cntrl->status_cb(mhi_cntrl, MHI_CB_SYS_ERROR); + + mutex_lock(&mhi_cntrl->pm_mutex); + write_lock_irq(&mhi_cntrl->pm_lock); + prev_state = mhi_cntrl->pm_state; + cur_state = mhi_tryset_pm_state(mhi_cntrl, MHI_PM_SYS_ERR_PROCESS); + write_unlock_irq(&mhi_cntrl->pm_lock); + + if (cur_state != MHI_PM_SYS_ERR_PROCESS) { + dev_err(dev, "Failed to transition from PM state: %s to: %s\n", + to_mhi_pm_state_str(cur_state), + to_mhi_pm_state_str(MHI_PM_SYS_ERR_PROCESS)); + goto exit_sys_error_transition; + } + + mhi_cntrl->ee = MHI_EE_DISABLE_TRANSITION; + mhi_cntrl->dev_state = MHI_STATE_RESET; + + /* Wake up threads waiting for state transition */ + wake_up_all(&mhi_cntrl->state_event); + + /* Trigger MHI RESET so that the device will not access host memory */ + if (MHI_REG_ACCESS_VALID(prev_state)) { + u32 in_reset = -1; + unsigned long timeout = msecs_to_jiffies(mhi_cntrl->timeout_ms); + + dev_dbg(dev, "Triggering MHI Reset in device\n"); + mhi_set_mhi_state(mhi_cntrl, MHI_STATE_RESET); + + /* Wait for the reset bit to be cleared by the device */ + ret = wait_event_timeout(mhi_cntrl->state_event, + mhi_read_reg_field(mhi_cntrl, + mhi_cntrl->regs, + MHICTRL, + MHICTRL_RESET_MASK, + MHICTRL_RESET_SHIFT, + &in_reset) || + !in_reset, timeout); + if (!ret || in_reset) { + dev_err(dev, "Device failed to exit MHI Reset state\n"); + goto exit_sys_error_transition; + } + + /* + * Device will clear BHI_INTVEC as a part of RESET processing, + * hence re-program it + */ + mhi_write_reg(mhi_cntrl, mhi_cntrl->bhi, BHI_INTVEC, 0); + } + + dev_dbg(dev, + "Waiting for all pending event ring processing to complete\n"); + mhi_event = mhi_cntrl->mhi_event; + for (i = 0; i < mhi_cntrl->total_ev_rings; i++, mhi_event++) { + if (mhi_event->offload_ev) + continue; + tasklet_kill(&mhi_event->task); } + /* Release lock and wait for all pending threads to complete */ + mutex_unlock(&mhi_cntrl->pm_mutex); + dev_dbg(dev, "Waiting for all pending threads to complete\n"); + wake_up_all(&mhi_cntrl->state_event); + + dev_dbg(dev, "Reset all active channels and remove MHI devices\n"); + device_for_each_child(mhi_cntrl->cntrl_dev, NULL, mhi_destroy_device); + + mutex_lock(&mhi_cntrl->pm_mutex); + + WARN_ON(atomic_read(&mhi_cntrl->dev_wake)); + WARN_ON(atomic_read(&mhi_cntrl->pending_pkts)); + + /* Reset the ev rings and cmd rings */ + dev_dbg(dev, "Resetting EV CTXT and CMD CTXT\n"); + mhi_cmd = mhi_cntrl->mhi_cmd; + cmd_ctxt = mhi_cntrl->mhi_ctxt->cmd_ctxt; + for (i = 0; i < NR_OF_CMD_RINGS; i++, mhi_cmd++, cmd_ctxt++) { + struct mhi_ring *ring = &mhi_cmd->ring; + + ring->rp = ring->base; + ring->wp = ring->base; + cmd_ctxt->rp = cmd_ctxt->rbase; + cmd_ctxt->wp = cmd_ctxt->rbase; + } + + mhi_event = mhi_cntrl->mhi_event; + er_ctxt = mhi_cntrl->mhi_ctxt->er_ctxt; + for (i = 0; i < mhi_cntrl->total_ev_rings; i++, er_ctxt++, + mhi_event++) { + struct mhi_ring *ring = &mhi_event->ring; + + /* Skip offload events */ + if (mhi_event->offload_ev) + continue; + + ring->rp = ring->base; + ring->wp = ring->base; + er_ctxt->rp = er_ctxt->rbase; + er_ctxt->wp = er_ctxt->rbase; + } + + mhi_ready_state_transition(mhi_cntrl); + +exit_sys_error_transition: dev_dbg(dev, "Exiting with PM state: %s, MHI state: %s\n", to_mhi_pm_state_str(mhi_cntrl->pm_state), TO_MHI_STATE_STR(mhi_cntrl->dev_state)); @@ -666,8 +782,7 @@ void mhi_pm_st_worker(struct work_struct *work) mhi_ready_state_transition(mhi_cntrl); break; case DEV_ST_TRANSITION_SYS_ERR: - mhi_pm_disable_transition - (mhi_cntrl, MHI_PM_SYS_ERR_PROCESS); + mhi_pm_sys_error_transition(mhi_cntrl); break; case DEV_ST_TRANSITION_DISABLE: mhi_pm_disable_transition From patchwork Wed Dec 2 09:41:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 335970 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp778925ejs; Wed, 2 Dec 2020 01:46:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJwmYaWBBU64VwFe49fHm/jbD8pQzkfCX5DrpR782Lbw/cs4VYrdcz9Rln44+48sG5Vvqj1E X-Received: by 2002:a05:6402:1d18:: with SMTP id dg24mr1701366edb.221.1606902402555; Wed, 02 Dec 2020 01:46:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606902402; cv=none; d=google.com; s=arc-20160816; b=V5q+0tHOy8G70EkRRmFApMDwdGnoFfhg2lxwbE95LtQEm3Cw45eGOTvzbEuN0iH0pY BqWh1Z03XcPmJPkhS0A51vpOKv4Av3PcP2B/WA3tE3wj7CL21W2B9uSHlFtnaZSKDqNC 9tmp0090G0VINCcNelP5QTnjw1R1ckNy50Da6RAaZ7fl1j1Z9dUZhDVUD9GcPxzGZ4ud qT7GC6ySJN60qg8wihLvqh17XGI+m/IKZ3hUqhb51Zitn8pGUl3jFc6vWflrBwGoaqk9 rks+JaE2CcJWBE7+jv5i/8fy3vxvIw/1X0skJiFryNVWPoiADw2+nUdbjANaYMoK9Drg 3Qog== 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=UqJtPPbam5F4e6lWYSMgvhm5ifJn4YWUg9vIO4IndOc=; b=0viCCOPZNrvjmg6/q/33KRAPbvlgSvRNxYmUcF2isStm6bvohK2aRUnl/qttMRR4fk ewYlsDfEVue1X+w8oRiAO2eM3/Xdt2Cx82CIprrkxuVTSZdx+zdQ5cakA0wmBHOHNCDQ tNh3UXr9yUimNYdOzzWbDGJ0HoKKaDCEcM4Wa7EnLgZriqikj7tmqZLTgBbsE6QZcMNi 2xh9xD4ErmiNhbT6wJRPnrWKUh7EWGRRMYwMVhndnSNbJlikwbDFfF2adBxhtRT+TAh2 UHPOCsXRCklAGSSmFtuNVcxPJ/MAi2pB9/WyChtvkcR/kzNgU6hLuIBa4kV6h01m0qlz j4zQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Yu3nOBg/"; 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 d27si564967ejt.291.2020.12.02.01.46.42; Wed, 02 Dec 2020 01:46:42 -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="Yu3nOBg/"; 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 S2388349AbgLBJpG (ORCPT + 15 others); Wed, 2 Dec 2020 04:45:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388556AbgLBJod (ORCPT ); Wed, 2 Dec 2020 04:44:33 -0500 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 DDA06C061A4B for ; Wed, 2 Dec 2020 01:43:57 -0800 (PST) Received: by mail-pg1-x542.google.com with SMTP id n7so302145pgg.2 for ; Wed, 02 Dec 2020 01:43:57 -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=UqJtPPbam5F4e6lWYSMgvhm5ifJn4YWUg9vIO4IndOc=; b=Yu3nOBg/WmUy21MfNUE/dGvV8kG5uWRcbNvXGAxcCcCu0pgrx1eJ9ovJn2xuSn0NVF r6n5dJkVVTCxTu/VJrQ4wxFCuQjLAxoMDzSDlLgDuG8UJsG4t+NRdU65qNh49ZQlvBop IJpVIiZnGranLAnFleZNWCIhEkwcgUfIM3KcNlwPIB+jbSlaa0NVFB0+3/QL5Yff/8Fj ARKeiSFLGxO4LdXldbbGa1kP48gvVW0gdR8mB5ykaVzMIIPwJZWYIuEen8zDA1qr3rji k/lfQdn0MBHMjEhGQv0eLwtWSXaaJo95HnL9tzeGsmqhXUrRMEvGlKlcqJFn8NXtCcgz 89lg== 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=UqJtPPbam5F4e6lWYSMgvhm5ifJn4YWUg9vIO4IndOc=; b=m5mPIJOHJjjzvkbj1ajE+ZuJJlng2SLSd5UYMnoPwlhb7DcylI/U1yNUXzfEIU6zK1 Ju8kNpqeVj+DZgVFlcyPXMsNBVl6dLrBI5hTlXuZfDfcbpvzeek/2dexPkGECkdHj88u Shv9i8GvmwJDv7eitcaFMUrUvgfZPgCzerPyt22rczTFatmG/EDNUW/tzB38t+K/MP6H 6SRdUf0IGMX9b02+pFYQjxUoTfxhKRxA5KBhyQq1skoSMiAgEKAPOcTpS5jkU6OtslP8 kZmdi87iyjywcfwrwpGAMM8zjneZTxPppWybYWkkVIrv/SeyHx38oV1AG/poNS0mKiTd FSXA== X-Gm-Message-State: AOAM532CDLOra6reCA5ty0tXxCL0i/iH6FJ+dEGWszR8KNDwwGPvE2Ha KUs61oYb584wR1n3HecWEtmE X-Received: by 2002:a63:368e:: with SMTP id d136mr1885181pga.239.1606902237328; Wed, 02 Dec 2020 01:43:57 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id bg8sm1393990pjb.52.2020.12.02.01.43.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2020 01:43:56 -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 23/29] bus: mhi: core: Mark and maintain device states early on after power down Date: Wed, 2 Dec 2020 15:11:53 +0530 Message-Id: <20201202094159.107075-24-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 mhi_power_down() does not ensure that the PM state is moved to an inaccessible state soon enough as the system can encounter scheduling delays till mhi_pm_disable_transition() gets called. Additionally, if an MHI controller decides that the device is now inaccessible and issues a power down, the register inaccessible state is not maintained by moving from MHI_PM_LD_ERR_FATAL_DETECT to MHI_PM_SHUTDOWN_PROCESS. This can result in bus errors if a client driver attempted to read registers when powering down. Close these gaps and avoid any race conditions to prevent such activity. Signed-off-by: Bhaumik Bhatt Reviewed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/pm.c | 77 +++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 44 deletions(-) -- 2.25.1 diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c index 347ae7dd6cf8..ffbf6f539510 100644 --- a/drivers/bus/mhi/core/pm.c +++ b/drivers/bus/mhi/core/pm.c @@ -37,9 +37,10 @@ * M0 -> FW_DL_ERR * M0 -> M3_ENTER -> M3 -> M3_EXIT --> M0 * L1: SYS_ERR_DETECT -> SYS_ERR_PROCESS --> POR - * L2: SHUTDOWN_PROCESS -> DISABLE + * L2: SHUTDOWN_PROCESS -> LD_ERR_FATAL_DETECT + * SHUTDOWN_PROCESS -> DISABLE * L3: LD_ERR_FATAL_DETECT <--> LD_ERR_FATAL_DETECT - * LD_ERR_FATAL_DETECT -> SHUTDOWN_PROCESS + * LD_ERR_FATAL_DETECT -> DISABLE */ static struct mhi_pm_transitions const dev_state_transitions[] = { /* L0 States */ @@ -72,7 +73,7 @@ static struct mhi_pm_transitions const dev_state_transitions[] = { { MHI_PM_M3, MHI_PM_M3_EXIT | MHI_PM_SYS_ERR_DETECT | - MHI_PM_SHUTDOWN_PROCESS | MHI_PM_LD_ERR_FATAL_DETECT + MHI_PM_LD_ERR_FATAL_DETECT }, { MHI_PM_M3_EXIT, @@ -103,7 +104,7 @@ static struct mhi_pm_transitions const dev_state_transitions[] = { /* L3 States */ { MHI_PM_LD_ERR_FATAL_DETECT, - MHI_PM_LD_ERR_FATAL_DETECT | MHI_PM_SHUTDOWN_PROCESS + MHI_PM_LD_ERR_FATAL_DETECT | MHI_PM_DISABLE }, }; @@ -445,10 +446,9 @@ static int mhi_pm_mission_mode_transition(struct mhi_controller *mhi_cntrl) } /* Handle shutdown transitions */ -static void mhi_pm_disable_transition(struct mhi_controller *mhi_cntrl, - enum mhi_pm_state transition_state) +static void mhi_pm_disable_transition(struct mhi_controller *mhi_cntrl) { - enum mhi_pm_state cur_state, prev_state; + enum mhi_pm_state cur_state; struct mhi_event *mhi_event; struct mhi_cmd_ctxt *cmd_ctxt; struct mhi_cmd *mhi_cmd; @@ -456,33 +456,13 @@ static void mhi_pm_disable_transition(struct mhi_controller *mhi_cntrl, struct device *dev = &mhi_cntrl->mhi_dev->dev; int ret, i; - dev_dbg(dev, "Transitioning from PM state: %s to: %s\n", - to_mhi_pm_state_str(mhi_cntrl->pm_state), - to_mhi_pm_state_str(transition_state)); + dev_dbg(dev, "Processing disable transition with PM state: %s\n", + to_mhi_pm_state_str(mhi_cntrl->pm_state)); mutex_lock(&mhi_cntrl->pm_mutex); - write_lock_irq(&mhi_cntrl->pm_lock); - prev_state = mhi_cntrl->pm_state; - cur_state = mhi_tryset_pm_state(mhi_cntrl, transition_state); - if (cur_state == transition_state) { - mhi_cntrl->ee = MHI_EE_DISABLE_TRANSITION; - mhi_cntrl->dev_state = MHI_STATE_RESET; - } - write_unlock_irq(&mhi_cntrl->pm_lock); - - /* Wake up threads waiting for state transition */ - wake_up_all(&mhi_cntrl->state_event); - - if (cur_state != transition_state) { - dev_err(dev, "Failed to transition to state: %s from: %s\n", - to_mhi_pm_state_str(transition_state), - to_mhi_pm_state_str(cur_state)); - mutex_unlock(&mhi_cntrl->pm_mutex); - return; - } /* Trigger MHI RESET so that the device will not access host memory */ - if (MHI_REG_ACCESS_VALID(prev_state)) { + if (!MHI_PM_IN_FATAL_STATE(mhi_cntrl->pm_state)) { u32 in_reset = -1; unsigned long timeout = msecs_to_jiffies(mhi_cntrl->timeout_ms); @@ -785,8 +765,7 @@ void mhi_pm_st_worker(struct work_struct *work) mhi_pm_sys_error_transition(mhi_cntrl); break; case DEV_ST_TRANSITION_DISABLE: - mhi_pm_disable_transition - (mhi_cntrl, MHI_PM_SHUTDOWN_PROCESS); + mhi_pm_disable_transition(mhi_cntrl); break; default: break; @@ -1153,23 +1132,33 @@ EXPORT_SYMBOL_GPL(mhi_async_power_up); void mhi_power_down(struct mhi_controller *mhi_cntrl, bool graceful) { - enum mhi_pm_state cur_state; + enum mhi_pm_state cur_state, transition_state; struct device *dev = &mhi_cntrl->mhi_dev->dev; /* If it's not a graceful shutdown, force MHI to linkdown state */ - if (!graceful) { - mutex_lock(&mhi_cntrl->pm_mutex); - write_lock_irq(&mhi_cntrl->pm_lock); - cur_state = mhi_tryset_pm_state(mhi_cntrl, - MHI_PM_LD_ERR_FATAL_DETECT); - write_unlock_irq(&mhi_cntrl->pm_lock); - mutex_unlock(&mhi_cntrl->pm_mutex); - if (cur_state != MHI_PM_LD_ERR_FATAL_DETECT) - dev_dbg(dev, "Failed to move to state: %s from: %s\n", - to_mhi_pm_state_str(MHI_PM_LD_ERR_FATAL_DETECT), - to_mhi_pm_state_str(mhi_cntrl->pm_state)); + transition_state = (graceful) ? MHI_PM_SHUTDOWN_PROCESS : + MHI_PM_LD_ERR_FATAL_DETECT; + + mutex_lock(&mhi_cntrl->pm_mutex); + write_lock_irq(&mhi_cntrl->pm_lock); + cur_state = mhi_tryset_pm_state(mhi_cntrl, transition_state); + if (cur_state != transition_state) { + dev_err(dev, "Failed to move to state: %s from: %s\n", + to_mhi_pm_state_str(transition_state), + to_mhi_pm_state_str(mhi_cntrl->pm_state)); + /* Force link down or error fatal detected state */ + mhi_cntrl->pm_state = MHI_PM_LD_ERR_FATAL_DETECT; } + /* mark device inactive to avoid any further host processing */ + mhi_cntrl->ee = MHI_EE_DISABLE_TRANSITION; + mhi_cntrl->dev_state = MHI_STATE_RESET; + + wake_up_all(&mhi_cntrl->state_event); + + write_unlock_irq(&mhi_cntrl->pm_lock); + mutex_unlock(&mhi_cntrl->pm_mutex); + mhi_queue_state_transition(mhi_cntrl, DEV_ST_TRANSITION_DISABLE); /* Wait for shutdown to complete */ From patchwork Wed Dec 2 09:41:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 335963 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp777988ejs; Wed, 2 Dec 2020 01:45:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJw/xp1VPFdN9loB1zq4F/5rM5Ici3T3fMGRDXldbgljDNFWLr679ZI6zUxkE3SEfKdRC+Js X-Received: by 2002:a17:906:f6c4:: with SMTP id jo4mr1466746ejb.145.1606902301895; Wed, 02 Dec 2020 01:45:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606902301; cv=none; d=google.com; s=arc-20160816; b=miDkDfmKezVpKNR1j2Ap74ceJ0nr1TdAoWOvi2KEZFE6/aclZ99O6HVOWezIKoMdHg NK8+xpwxHutkgcJeF09ZIk3EBVDyryEkN5oqKyMgRjHlU52XZTa3I7TxMGBg85k+kKVo fqjjsJ64BPheL0aWaOvRj7tpWHsXWxbV5xk0fjMN/487vQm4rp6/j6+8641F2xzM/RU7 oUJc/nwTuaqs9S4bL9xcuKkJfs8YzCNHx+3P2mqErvsmaZ8qh6i7wC4H7pLhRgYDgG54 0wbtVnEvM144WH2TeRWfanq9pdZ60Vxd/ekS9zlCNXecbzU1kozLgKkHXTUTCFb+7IOu P7Rw== 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=U6tuxJXwhPncIR+38W/QdB/JkWjIPeIUW2URyo+M7Yc=; b=nkBOCpKDwfHgcjsto7yID4Brc1CbGfrhXqyjpjFpXcx44E08oh7u5hDwWMcNIerUa1 CNW+z4mXb1Wov2IdJV22WaGtjk2D56Pj7jwKukVbsiF7A0pbiQFX/TJzY+SNQy5I6cAU vewLlGikepYX2dtwuhQydelo+EGJ57PSsoSq0AyhRE2EZA/mOlVilFUMkyJNK5bDTHK9 IwdfRyBUZyHm035729R/sDfY2PGz8H9GdpHdkCsnsoVKN+nwP29pEEPx87KC/PBtUfNR EO/oMi9j3qo36AgcLpHaRxx+jMpWVqxy+witoaqVOffb1LIgC/pQDC9+98WQRFynLk55 OBXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xbXswLJ7; 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.01; Wed, 02 Dec 2020 01:45:01 -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=xbXswLJ7; 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 S2388432AbgLBJox (ORCPT + 15 others); Wed, 2 Dec 2020 04:44:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388619AbgLBJoq (ORCPT ); Wed, 2 Dec 2020 04:44:46 -0500 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 AE2CAC061A4C for ; Wed, 2 Dec 2020 01:44:01 -0800 (PST) Received: by mail-pg1-x542.google.com with SMTP id o5so745273pgm.10 for ; Wed, 02 Dec 2020 01:44:01 -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=U6tuxJXwhPncIR+38W/QdB/JkWjIPeIUW2URyo+M7Yc=; b=xbXswLJ7+f0M/CEswANqTGQd6R/+AlDh+HPlu6bJdxK1gDa8YCcwq5q9zqIwTWiH+r Nd0ZQG23ERxLUL7QAx/G2IkcA29X5dkz2nneEJASBL5N1YnA1IROh5OikEOiZutWoeDb apL/d4XAKFbvO4fVmSI4nYq8JOb5/ltLJ0e2AqVPaFH8xceocAcp/p0LmkX8xkwgNXLD bBmNxqd7JusVyyTz8jezOf9wVD2gRMDbt5viugOXQqrslUNfBfSJoeiIl+ZbCWWAxpXc OZ7b37wFDRty/xZC1lnUxN9sH1mKCoWh9zDQVkFgWkkW9l3eiZQzAr921ESUbrnxKUFC pkxQ== 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=U6tuxJXwhPncIR+38W/QdB/JkWjIPeIUW2URyo+M7Yc=; b=GreZRw0A2CaQe2chDlcud2NzRIpt0+UxMTo0rfmIKKNU6HaPz6MfuUR5OjAIi+Y4uK 4mvWajs4wri1S+wqn/UUHf+LrklYi5XoSc6zcQv62LjeozEHbvUSnxkq4GRu6xiPU6NF BznapOA7dmZwrxt+eiM7+msPzRAgj6SDOkftff8iyFf4tJEEMHa9nE/+vrDrGsJazw15 uRnOqNHiZRwo8BeH94HCCeBeDy2JjIcKA9z4mNOIwNKD1AFPnqxKR/gup3O119ifapwz StCV90RdHLTJvYydcBgEXW/yEWEDj4r77aPH5tN+C8Eiamj9nQQfObcuuhPuw7UQmpS8 UTKg== X-Gm-Message-State: AOAM530WtpTSTsdZAVpI4uGM1Q5XBqtxigbI+nqNTYRrV0E8hFIGXmD3 M5jU+6gn3LupPip5Nh5YLjMI X-Received: by 2002:a63:fa0e:: with SMTP id y14mr1901280pgh.225.1606902241222; Wed, 02 Dec 2020 01:44:01 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id bg8sm1393990pjb.52.2020.12.02.01.43.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2020 01:44:00 -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 24/29] bus: mhi: core: Remove MHI event ring IRQ handlers when powering down Date: Wed, 2 Dec 2020 15:11:54 +0530 Message-Id: <20201202094159.107075-25-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 While powering down, the device may or may not acknowledge an MHI RESET issued by host for a graceful shutdown scenario and end up sending an incoming data packet after tasklets have been killed. If a rogue device sends this interrupt for a data transfer event ring update, it can result in a tasklet getting scheduled while a clean up is ongoing or has completed and cause access to freed memory leading to a NULL pointer exception. Remove the interrupt handlers for MHI event rings early on to avoid this scenario. Signed-off-by: Bhaumik Bhatt Reviewed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/pm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.25.1 diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c index ffbf6f539510..a671f585ce35 100644 --- a/drivers/bus/mhi/core/pm.c +++ b/drivers/bus/mhi/core/pm.c @@ -494,6 +494,7 @@ static void mhi_pm_disable_transition(struct mhi_controller *mhi_cntrl) for (i = 0; i < mhi_cntrl->total_ev_rings; i++, mhi_event++) { if (mhi_event->offload_ev) continue; + free_irq(mhi_cntrl->irq[mhi_event->irq], mhi_event); tasklet_kill(&mhi_event->task); } @@ -1164,7 +1165,7 @@ void mhi_power_down(struct mhi_controller *mhi_cntrl, bool graceful) /* Wait for shutdown to complete */ flush_work(&mhi_cntrl->st_worker); - mhi_deinit_free_irq(mhi_cntrl); + free_irq(mhi_cntrl->irq[0], mhi_cntrl); if (!mhi_cntrl->pre_init) { /* Free all allocated resources */ From patchwork Wed Dec 2 09:41:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 335960 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp777951ejs; Wed, 2 Dec 2020 01:44:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJzZCrZgFQdwE7c/8XlKFJ8ye0M4g710wRXK4HCBs7YYFFT/iK3YxAyUAyWJmnmYt7g+G6La X-Received: by 2002:aa7:d459:: with SMTP id q25mr1699631edr.279.1606902298818; Wed, 02 Dec 2020 01:44:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606902298; cv=none; d=google.com; s=arc-20160816; b=jzbCbJ1EeGxRe+czINxoUoENokAtMbrQ/gC1/oRnmhi3iLS5QszaEfkb305KpVv7um qTunF+31WT0X/BEoLj4qap6xas8EsycLuyRuadGKNlMya1wkF/9e5rmLvcU/7EmNmrAo jIdeNIv87x5O7QKnQePpgaMuYj8WYgZBuSGfI2sKHNGCylMhGatYngrWgylLA6RoEOIz CiLFi8veofL3e9dLncmiuz7tVfysSRX0D8sNJ5RtZQJY0xNWCTMX7WbZa7xY5pq9g03Y VATBjDoV9Z3OiuptiXCpcDcEiMnY1/7xFbZ1iPpW9dSvEaBP6VRYWPIr2+vLYbCSGpxJ 0JVA== 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=EVdtvlNlMaH6XJZVDa7SACl1Wek+TOSf5O60QTYY0oc=; b=e7yyppIVqX9JRyzMJkWfsyX/+oEoaokHNyKRN2sRbzRM2L+enedyPAEbEdjnuYzvl1 cZnZV+WcJQEryzJgNw+ZTscvV5u5kBrwr1O3UIXLWRQOiGbXp4YJ+xZCZXesXLXs9TJS obPoVRNHnb5eKDsm8K+xqNcWd+VGER1cXb5Z2m/+B6TK5VnqlpKYRCizu8iKBWh+YqtW OT4BAKRj4is7VpRGl/C/SUevEzwqSkGRUa9irmhVGdJi5zcnUxobdvtghfIRebc2LsOY kIDbQstD12EdCXLmhGdIt4TpGdsOV9XKph/XaJM7rJkEDDjoFzzurwSn92zugezzQko/ JySQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oNLCZIZ0; 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.44.58; Wed, 02 Dec 2020 01:44:58 -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=oNLCZIZ0; 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 S2388606AbgLBJon (ORCPT + 15 others); Wed, 2 Dec 2020 04:44:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388541AbgLBJom (ORCPT ); Wed, 2 Dec 2020 04:44:42 -0500 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 A7FF7C061A4E for ; Wed, 2 Dec 2020 01:44:06 -0800 (PST) Received: by mail-pg1-x542.google.com with SMTP id o4so774396pgj.0 for ; Wed, 02 Dec 2020 01:44:06 -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=EVdtvlNlMaH6XJZVDa7SACl1Wek+TOSf5O60QTYY0oc=; b=oNLCZIZ0/aPHgaorzTRveyCpmaxIgzkOy/EMMm968Nh3E6zHjukXnPEgdU/smgfwEx 0GglQkJ6Z62lmgh6lfclTB4UZazJBcDdd4Lq8IvUCgrB6gxVEuKJDpqDOIK4AIsbJj69 Pok3FEmvpfEZ9z0i+sU34IcyqHTxfFuzPb/kFQfFFiKNXp9j7mF16flViAm3HexD5g86 Ef1BFNrG2ieqKgkTa6TVSCbokXW9sjsIS0/h97pDlH3VPcAnhTRdp+Vtw6UrDRx84m/4 FodcVAuBJNXA5qdOOoy1toC3d91iGGladljqxPf9DXdzG9b8kAL88v7YeNX+2KIwcrdB RLwg== 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=EVdtvlNlMaH6XJZVDa7SACl1Wek+TOSf5O60QTYY0oc=; b=jXIN4wVbsLY5t2BD1QKaQo7ijVevAEwOYknqJrncMkFohHOOTah0T5RAOqxRCyPbWM gqx7pNjmW9m90WemH0U0qLK6t8qA0bVef1lt0qGK/nZ6Xuk+Q7i0/RRDoKWZPvlEOyI/ uUIg2Zr2JmR1zUFJ+uycJDAtu743++WxMmyRUQwKytSgRIMiRWKIC6rFPwccTnO42Gm7 EA7FGOA/QMcmoQveV4fr3/BFqK9TlxZ1laGfQaf14niKlgM7+1QXkinb2t09hGnr5f39 ezCfaoiAIX72eIvu8b+HKvIUVOtBCbSQK7MZB+74+kjMjDSs3kHdOvvt11wwvVTa72ZN pBkw== X-Gm-Message-State: AOAM5303zIfpT3lnXeJ4ph7qIEdpHfyX8PNHg8OFlKAbuxLDaYibq0Sv APk9z/V4jC4Cva2XyKU9nQZA X-Received: by 2002:a63:d357:: with SMTP id u23mr1890661pgi.106.1606902246250; Wed, 02 Dec 2020 01:44:06 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id bg8sm1393990pjb.52.2020.12.02.01.44.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2020 01:44:05 -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, Jakub Kicinski , Manivannan Sadhasivam Subject: [PATCH 25/29] net: qrtr: Unprepare MHI channels during remove Date: Wed, 2 Dec 2020 15:11:55 +0530 Message-Id: <20201202094159.107075-26-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 Reset MHI device channels when driver remove is called due to module unload or any crash scenario. This will make sure that MHI channels no longer remain enabled for transfers since the MHI stack does not take care of this anymore after the auto-start channels feature was removed. Signed-off-by: Bhaumik Bhatt Acked-by: Jakub Kicinski Reviewed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam --- net/qrtr/mhi.c | 1 + 1 file changed, 1 insertion(+) -- 2.25.1 diff --git a/net/qrtr/mhi.c b/net/qrtr/mhi.c index 7100f0bac4c6..2bf2b1943e61 100644 --- a/net/qrtr/mhi.c +++ b/net/qrtr/mhi.c @@ -104,6 +104,7 @@ static void qcom_mhi_qrtr_remove(struct mhi_device *mhi_dev) struct qrtr_mhi_dev *qdev = dev_get_drvdata(&mhi_dev->dev); qrtr_endpoint_unregister(&qdev->ep); + mhi_unprepare_from_transfer(mhi_dev); dev_set_drvdata(&mhi_dev->dev, NULL); } From patchwork Wed Dec 2 09:41:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 335966 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp778017ejs; Wed, 2 Dec 2020 01:45:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJxZec6IIT/3eEBTrRNFtTCrpdpEopPP7OscNjHAmOdkrUzZXk31XB9zayC9/nYpS63cqPTD X-Received: by 2002:a50:bb64:: with SMTP id y91mr1808117ede.367.1606902304204; Wed, 02 Dec 2020 01:45:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606902304; cv=none; d=google.com; s=arc-20160816; b=pGlQ4o8rFg1AjLNBOJrwZXbfbVtzo00LSOk4SLAikGezg4l6d5Paigjn3Y7M4yZviI j7UZDcR2Pz9YZ30UGKFodGrRijyCn2Zf9Xo09+DMjr+nhhmZSNGwPlwJWIlLQ77IRIu+ XgetulqJwOKTDJS+4qyHVpUyxnT/WXa+BuvgF8eMQUXE1W1vRDNro1KIw6PJUXfwgZla UIwNzBCAFnJosk/TJ0fzYrHMgtEpqdMJR2vhxrB1arVvcY1LmX+y8uUMd6VC0X+S42ia YzXwNuSqzRs62WExSZyw7buVl03RP3+TyNFIxPhNIQYUDZEDpw9NFkrUmZkNUrm78YBX Ci1g== 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=D7gHV9XT2NDWWAcMQEmr5435W+1ty8KPE5zJq5MQ2Ns=; b=WnhKlpkoar1ufxofjfpp1WeRL6Iix3xtd2sZrJ/fyg8ch7yHoMo6SO0aRg6KercMmA QVKi57TA2vwLESlh8Q01R+orfIU6pszW41ngEuPbRiRu9VJJUVirJd1lO0Ig7d+9Wuhy 32wvBsA/cSpJVAxzHehTxSzYIDZ/ClZ12rhTNeHVfIWf9jQ2aVh+gPwUFFIixU+Vgyge VdtlIklpro5EcVhNDGz5i3XnRIyepfwaQV3ZBi6zFfz3E9T+LpHx/tzzXXIq8IaWWZBd APOrTfNZA1PV55/SXYYvGgDqCVif0VhtdVhh6iMpE897ytMIgb9QIDmi2s9Jt9VAGMMh luug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pqwnNnV0; 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.04; Wed, 02 Dec 2020 01:45:04 -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=pqwnNnV0; 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 S2388583AbgLBJo7 (ORCPT + 15 others); Wed, 2 Dec 2020 04:44:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388602AbgLBJom (ORCPT ); Wed, 2 Dec 2020 04:44:42 -0500 Received: from mail-pj1-x1043.google.com (mail-pj1-x1043.google.com [IPv6:2607:f8b0:4864:20::1043]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE308C061A4F for ; Wed, 2 Dec 2020 01:44:10 -0800 (PST) Received: by mail-pj1-x1043.google.com with SMTP id iq13so702651pjb.3 for ; Wed, 02 Dec 2020 01:44:10 -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=D7gHV9XT2NDWWAcMQEmr5435W+1ty8KPE5zJq5MQ2Ns=; b=pqwnNnV0h3+5O5CnqaViisplV0agqqErehuxFHMdojbDFXpO5xIILjGF8Gtj72eXie EeL3LZpwJEZCFKC56dOt8GJZqkzq14dQnRq3F2nJ7dOLjQTWCtrpuzhO3yx01Ai8bIej l6l/rsTfM2A0H9ycDZYgK3JaeavvD6uwceAJ8F+1QLqfVbaL7Z1PB8WamZUYf0CyjdGa sNjDmEW3bdkERhmLvIvPHiyEAboPdQpVdcKLF76Yc6sKeV4JrRWXgEHbj2s/xtBMlUZt tHbUFftlEcewBbIdeCZXiVLcDh++4+G0KfQfKXfzebv8Q5+EqR1w/k+T6ShtxqkFtF0m Un2w== 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=D7gHV9XT2NDWWAcMQEmr5435W+1ty8KPE5zJq5MQ2Ns=; b=IZkRo0EyWi+z7UPBCKowDbIXmZmRy9OnrvJJMyVUqaXbq3DzCKy1seCh1ZAiks3s3i JN5pA4u/B0ARwIBYMTqc2tJuSm6LlQuHCtpUhHxEdMc1M+yaxL5UfDO/p0i35OmK2nCK qD9bYH30C2d2knsIFJEFi46Fqd7daYYfRvCixRPxokTJ/9taLeAdFQMKVeV6J33UxG68 LfysBcXOx407/YNNLGX7vAnJksBZG4KYNV/r5oPr4yZAHN1vNVcfYHU9/orxYWw5bN3H xC1+DryIaDQO09rvIqLcx4eAS75F80n2tlnGToYoIY8FLH9QQ/bX5fiKkXZnJvv0Ev4x QlRw== X-Gm-Message-State: AOAM531NrCm6EdXHDt1BVEZFpqXnUXHB29L4FSXEJf8o3UeUv5+Mjybw /YErWwcKFQX3/svZixbdDvkCz1vy4RID X-Received: by 2002:a17:902:8bcb:b029:d9:d765:d7f3 with SMTP id r11-20020a1709028bcbb02900d9d765d7f3mr1926816plo.69.1606902250339; Wed, 02 Dec 2020 01:44:10 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id bg8sm1393990pjb.52.2020.12.02.01.44.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2020 01:44:09 -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 26/29] bus: mhi: core: Indexed MHI controller name Date: Wed, 2 Dec 2020 15:11:56 +0530 Message-Id: <20201202094159.107075-27-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: Loic Poulain Today the MHI controller name is simply cloned from the underlying bus device (its parent), that gives the following device structure for e.g. a MHI/PCI controller: devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:02:00.0 devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:02:00.0/0000:02:00.0_IPCR ... That's quite misleading/confusing and can cause device registering issues because of duplicate dev name (e.g. if a PCI device register two different MHI instances). This patch changes MHI core to create indexed mhi controller names (mhi0, mhi1...) in the same way as other busses (i2c0, usb0...). The previous example becomes: devices/pci0000:00/0000:00:01.2/0000:02:00.0/mhi0 devices/pci0000:00/0000:00:01.2/0000:02:00.0/mhi0/mhi0_IPCR ... v2: move index field at the end of mhi_controller struct (before bool) to avoid breaking well packed alignment. Signed-off-by: Loic Poulain Reviewed-by: Jeffrey Hugo Reviewed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/init.c | 18 ++++++++++++++++-- drivers/bus/mhi/core/main.c | 2 +- include/linux/mhi.h | 2 ++ 3 files changed, 19 insertions(+), 3 deletions(-) -- 2.25.1 diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c index 655d539c6808..1d6f7b6c1fcd 100644 --- a/drivers/bus/mhi/core/init.c +++ b/drivers/bus/mhi/core/init.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -18,6 +19,8 @@ #include #include "internal.h" +static DEFINE_IDA(mhi_controller_ida); + const char * const mhi_ee_str[MHI_EE_MAX] = { [MHI_EE_PBL] = "PBL", [MHI_EE_SBL] = "SBL", @@ -940,6 +943,12 @@ int mhi_register_controller(struct mhi_controller *mhi_cntrl, mhi_cntrl->minor_version = (soc_info & SOC_HW_VERSION_MINOR_VER_BMSK) >> SOC_HW_VERSION_MINOR_VER_SHFT; + mhi_cntrl->index = ida_alloc(&mhi_controller_ida, GFP_KERNEL); + if (mhi_cntrl->index < 0) { + ret = mhi_cntrl->index; + goto error_ida_alloc; + } + /* Register controller with MHI bus */ mhi_dev = mhi_alloc_device(mhi_cntrl); if (IS_ERR(mhi_dev)) { @@ -950,8 +959,8 @@ 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); + dev_set_name(&mhi_dev->dev, "mhi%d", mhi_cntrl->index); + mhi_dev->name = dev_name(&mhi_dev->dev); /* Init wakeup source */ device_init_wakeup(&mhi_dev->dev, true); @@ -970,6 +979,9 @@ int mhi_register_controller(struct mhi_controller *mhi_cntrl, put_device(&mhi_dev->dev); error_alloc_dev: + ida_free(&mhi_controller_ida, mhi_cntrl->index); + +error_ida_alloc: kfree(mhi_cntrl->mhi_cmd); error_alloc_cmd: @@ -1004,6 +1016,8 @@ void mhi_unregister_controller(struct mhi_controller *mhi_cntrl) device_del(&mhi_dev->dev); put_device(&mhi_dev->dev); + + ida_free(&mhi_controller_ida, mhi_cntrl->index); } EXPORT_SYMBOL_GPL(mhi_unregister_controller); diff --git a/drivers/bus/mhi/core/main.c b/drivers/bus/mhi/core/main.c index 4eb93d8bea1d..702c31b6aefa 100644 --- a/drivers/bus/mhi/core/main.c +++ b/drivers/bus/mhi/core/main.c @@ -331,7 +331,7 @@ void mhi_create_devices(struct mhi_controller *mhi_cntrl) /* Channel name is same for both UL and DL */ mhi_dev->name = mhi_chan->name; dev_set_name(&mhi_dev->dev, "%s_%s", - dev_name(mhi_cntrl->cntrl_dev), + dev_name(&mhi_cntrl->mhi_dev->dev), mhi_dev->name); /* Init wakeup source if available */ diff --git a/include/linux/mhi.h b/include/linux/mhi.h index d31efcf02ae7..aa9757e71f1f 100644 --- a/include/linux/mhi.h +++ b/include/linux/mhi.h @@ -348,6 +348,7 @@ struct mhi_controller_config { * @read_reg: Read a MHI register via the physical link (required) * @write_reg: Write a MHI register via the physical link (required) * @buffer_len: Bounce buffer length + * @index: Index of the MHI controller instance * @bounce_buf: Use of bounce buffer * @fbc_download: MHI host needs to do complete image transfer (optional) * @pre_init: MHI host needs to do pre-initialization before power up @@ -438,6 +439,7 @@ struct mhi_controller { u32 val); size_t buffer_len; + int index; bool bounce_buf; bool fbc_download; bool pre_init; From patchwork Wed Dec 2 09:41:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 335965 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp778001ejs; Wed, 2 Dec 2020 01:45:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJwVGagRwOhJNJikB8fXce6GYHPCLN42WCcB7A1LUf49zgGG+787ike4etCCO5OXpS4zTK4R X-Received: by 2002:a17:906:4348:: with SMTP id z8mr1513325ejm.119.1606902303321; Wed, 02 Dec 2020 01:45:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606902303; cv=none; d=google.com; s=arc-20160816; b=WHEZSHRfo29nq8HdC2SW9mJZmswzIYEsNFbQFvOpZA2Yw8oTqjK+4+fYzZkDO2TTx/ 9AjKdlHZXPT7tlqZOog4zZDvNgbqDMFbxLYrN/+71zuZqFmtlkw51xTDN93EbalhU8V5 4UXSHUQISeewOfe6sjyDOgGuXGtJrP2sA4fGqbPD1P2ooXq3zORjXnz6arczTPjOuh0f Y/ntIBPJS9jYCq1oVrl3U0flWwngoNPjQ2Rm/8rGEOxei3O5ezNZrbwGHnyvO/QRKNg4 op3rW7m9YztCJ8ezgMTBpsO+1CRQJKBFtg6IKFVy9h6mQTLQl778MuYxUoV/5KS7Njqf FL7g== 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=bFDUiEsizbJwRk40uj2Hkrxtol83gwE9Deu7VwozJVw=; b=bA74hiQnbLZ1jQiBdhpAK8OGSG7QvnO9K8BFwAWWPkkFj8vrZXznGabIEpFKINaAXJ +iPJEWEpqby8waR5eXtTPE08VcUO03DhIAoQHgeFyjQm7N1TJ6/83J0xIjLpO8KtgObE 3tr+QOuRudXZYjMomIazGM2COGSaXIwJNQdFEDntatFiHFNeBGEy0JTi9QbWBDrz7B2a xtBu7zpO3hY/GUJiWZcTerlmlHRGsnDT/WWfNH3tZ8K3hJjoJCIyxCtd8OL8oMrdBpjb ozDnB0rWrhdUX/A25JbJS5k627G0s/ihLrqIhSX/hIDFqx4Vx/0Ympx6D8plf1Sx3Zjk Zq3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TKAWWG7A; 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.03; Wed, 02 Dec 2020 01:45:03 -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=TKAWWG7A; 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 S2388637AbgLBJo4 (ORCPT + 15 others); Wed, 2 Dec 2020 04:44:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388604AbgLBJon (ORCPT ); Wed, 2 Dec 2020 04:44:43 -0500 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EED4C061A51 for ; Wed, 2 Dec 2020 01:44:15 -0800 (PST) Received: by mail-pl1-x643.google.com with SMTP id p6so820976plr.7 for ; Wed, 02 Dec 2020 01:44:15 -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=bFDUiEsizbJwRk40uj2Hkrxtol83gwE9Deu7VwozJVw=; b=TKAWWG7AhUD30Z6KbqUPdzYUjh8jLepc3fai+vHXiYkmzTx3LWs0F+fd22l06ffc1e IPGYlVv2kS/wW/HwLp4LjUcBcBFEwwVUJjmJCmMDiGBWctL/7k1eQTYmri0OrC6KeVov cgt5P+oSBUntOm6QrYR8jEkkii2aroh4YtmoHseazXzVhAhlsM0DGbpk8eVy4G78Q7ot uDRuwj8Nfqz17UDIDKvtEUQH9/M0nyLnflJICx5suj3YYj4T0bpzlebWreWvAS8jzurJ DVioaV3eFMGl9paIjPzZCBbB/qGxQ/8CJ/nDwMZ3xfwzsJ/Xcy6hYvvGxPCGI6RLLvnq 0BFg== 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=bFDUiEsizbJwRk40uj2Hkrxtol83gwE9Deu7VwozJVw=; b=hOZePMxv3JJWNOHeveY8PzsEqgapsCxv1bnLJMY+OdYpDbE1p1Ues/MQ64AD50kLhK QlFzz9apGLzetANqx8hubjkHadcWzcTqgtJqGfPuh77jX9/s35MDLnfFeHf3MqEdflfu /f2TQ1VKK5HnmdLP/FEcAO1L8fAQfbX49ngozwlBSTIuO/tAwLrznOrn+eri9NQmmjat +BqsRVL0JdNKsx4J5MbihKQBA2gYgEZdWcxGEtrXjvRhIiFrNafLFqQUWAdkKv+i4wVw GPI/u/DINv5lbTjvNFO1iFKMdvJDrQrDCCcOiq43P8kA9+y/dCss4Qz7kJJVbt1J8ks6 hUow== X-Gm-Message-State: AOAM532ypIc2WLDoKGbufhjnFM5Q9DjaXr+72DVhATSyLSOB2IAHQM/E y8bPhlrEj4dS28wxT4C/PFik X-Received: by 2002:a17:90b:90f:: with SMTP id bo15mr1590769pjb.148.1606902254777; Wed, 02 Dec 2020 01:44:14 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id bg8sm1393990pjb.52.2020.12.02.01.44.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2020 01:44:13 -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, Bjorn Andersson , Manivannan Sadhasivam Subject: [PATCH 27/29] bus: mhi: core: Fix device hierarchy Date: Wed, 2 Dec 2020 15:11:57 +0530 Message-Id: <20201202094159.107075-28-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: Loic Poulain This patch fixes the hierarchical structure of MHI devices. Indeed, MHI client devices are directly 'enumerated' from the mhi controller and therefore must be direct descendants/children of their mhi controller device, in accordance with the Linux Device Model. Today both MHI clients and controller devices are at the same level, this patch ensures that MHI controller is parent of its client devices. The hierarchy is especially important for power management (safe suspend/resume order). It is also useful for userspace to determine relationship between MHI client devices and controllers. Signed-off-by: Loic Poulain Reviewed-by: Bjorn Andersson Reviewed-by: Manivannan Sadhasivam Reviewed-by: Hemant Kumar Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/debugfs.c | 4 +++- drivers/bus/mhi/core/init.c | 10 +++++++++- drivers/bus/mhi/core/pm.c | 4 ++-- 3 files changed, 14 insertions(+), 4 deletions(-) -- 2.25.1 diff --git a/drivers/bus/mhi/core/debugfs.c b/drivers/bus/mhi/core/debugfs.c index 3a48801e01f4..7d43138ce66d 100644 --- a/drivers/bus/mhi/core/debugfs.c +++ b/drivers/bus/mhi/core/debugfs.c @@ -159,7 +159,9 @@ static int mhi_debugfs_devices_show(struct seq_file *m, void *d) return -ENODEV; } - device_for_each_child(mhi_cntrl->cntrl_dev, m, mhi_device_info_show); + /* Show controller and client(s) info */ + mhi_device_info_show(&mhi_cntrl->mhi_dev->dev, m); + device_for_each_child(&mhi_cntrl->mhi_dev->dev, m, mhi_device_info_show); return 0; } diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c index 1d6f7b6c1fcd..96cde9c0034c 100644 --- a/drivers/bus/mhi/core/init.c +++ b/drivers/bus/mhi/core/init.c @@ -1144,7 +1144,15 @@ struct mhi_device *mhi_alloc_device(struct mhi_controller *mhi_cntrl) device_initialize(dev); dev->bus = &mhi_bus_type; dev->release = mhi_release_device; - dev->parent = mhi_cntrl->cntrl_dev; + + if (mhi_cntrl->mhi_dev) { + /* for MHI client devices, parent is the MHI controller device */ + dev->parent = &mhi_cntrl->mhi_dev->dev; + } else { + /* for MHI controller device, parent is the bus device (e.g. pci device) */ + dev->parent = mhi_cntrl->cntrl_dev; + } + mhi_dev->mhi_cntrl = mhi_cntrl; mhi_dev->dev_wake = 0; diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c index a671f585ce35..681960c72d2a 100644 --- a/drivers/bus/mhi/core/pm.c +++ b/drivers/bus/mhi/core/pm.c @@ -504,7 +504,7 @@ static void mhi_pm_disable_transition(struct mhi_controller *mhi_cntrl) wake_up_all(&mhi_cntrl->state_event); dev_dbg(dev, "Reset all active channels and remove MHI devices\n"); - device_for_each_child(mhi_cntrl->cntrl_dev, NULL, mhi_destroy_device); + device_for_each_child(&mhi_cntrl->mhi_dev->dev, NULL, mhi_destroy_device); mutex_lock(&mhi_cntrl->pm_mutex); @@ -637,7 +637,7 @@ static void mhi_pm_sys_error_transition(struct mhi_controller *mhi_cntrl) wake_up_all(&mhi_cntrl->state_event); dev_dbg(dev, "Reset all active channels and remove MHI devices\n"); - device_for_each_child(mhi_cntrl->cntrl_dev, NULL, mhi_destroy_device); + device_for_each_child(&mhi_cntrl->mhi_dev->dev, NULL, mhi_destroy_device); mutex_lock(&mhi_cntrl->pm_mutex); From patchwork Wed Dec 2 09:41:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 335961 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp777963ejs; Wed, 2 Dec 2020 01:45:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJw7MXnRB6Oi5GloZW5jsCLdhVDgpzOAwINVvy/XRLPaNaQiKnqKgnifijiqb5h/36Lcsm/n X-Received: by 2002:a17:906:cd06:: with SMTP id oz6mr1486113ejb.25.1606902299778; Wed, 02 Dec 2020 01:44:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606902299; cv=none; d=google.com; s=arc-20160816; b=G5b/depQqRrQeqtu1sWlFgmE0sl7OoIHj2CMSXPNwKOT27lLNTiSwMCrcBsi86aL5G 9Y9TGyWMVDNuFRm99tJ1xzmV9wEeSsuCTBDBW1z06W79dUElsajDexqdzNMQFzlDRnjR pLAu9nOyXhAxuJhPYSjdUOEI7t5gzk5BOoyfW/poJcbgEStOZux8aa4eK9vGEpIZE0gd Uf+bYwZEBK5NXO3jsiPGbngd8OuyyRO8T/6st8/QBY/+spcg2pAUmUrihWDak/w0Sp5l w8xTYA1I7gIhc+xs05O3nS3YkN7GTOfO0s1UKqPRhBrPAK2avisDiJZGYNA0K/5ZpSTC 513w== 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=mlX6/dUBp4V7NccOfxayBKu6ql0r7Sno2otMyRjZDtk=; b=PMKHM7Uvu11pOYChrcwD2jEwJbVF/U6ih7vJe6Bqr9Ck6JTPEhFRGCjgitmNM7vB+0 mXpLOGln8dQ8lSJtFGbbpCLEzWfr6yVBOjpGyCI3YqLN4mAjsBbdyoMDqakGrcAouHJz 5WJyAOeJAdv4pmOgxrACfv31pugQ7VkTPUaJYzhz7f93kPkYIIrGHBjQWt1YUxwqmVSh t0twU+1FwAHfJ17IhsSpNbCAdsx7cP+DBWF8QLVvXHixKkJVfvToPExnJh+RNg7fSe6j 6uDwWWLDk9/cWtp0RtqM7knroHkQhlVLbcY8NRcSJ2s0qJgp+U385c3rknOYeNkIG869 /8LA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fxoWoJ6X; 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.44.59; Wed, 02 Dec 2020 01:44:59 -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=fxoWoJ6X; 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 S2388344AbgLBJos (ORCPT + 15 others); Wed, 2 Dec 2020 04:44:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388599AbgLBJos (ORCPT ); Wed, 2 Dec 2020 04:44:48 -0500 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 A6D3CC061A56 for ; Wed, 2 Dec 2020 01:44:19 -0800 (PST) Received: by mail-pj1-x1044.google.com with SMTP id r20so707848pjp.1 for ; Wed, 02 Dec 2020 01:44:19 -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=mlX6/dUBp4V7NccOfxayBKu6ql0r7Sno2otMyRjZDtk=; b=fxoWoJ6XnyCFTBwICbKaSS3cycg5+uuhPrznurEyFI86CB+6r+lRiKhkX1gpxwbCP1 OcRzqoFF7bpCs+vuAHL3NtTnOste9oD4Nk5ZB4IJtrTo1HmHKJxEvLv93tm32YG/IAgR k2LHFDDAgAtY9rd7P0xFvZKKT+QyAHbBpWrKNK5AAT2qPKAUb1gRxAHiqJTbLARIWDgU GYzPQfNH0HqTyfD2qLDg3qjD4Tx+o+h16VH5jeHsnIYWM9zl2A47zHZ3PbA7mUWFe3uZ v8I5NVJ81DXy6dGlbEDRiTeqICiHue3z/jZw+wfFaFMGMOLnx1XCkKm2R+ME8vkV4T/N /KYA== 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=mlX6/dUBp4V7NccOfxayBKu6ql0r7Sno2otMyRjZDtk=; b=nHnTuhV5TjnfUEMqHqkGZ3erH47a3Ff/oQD1XjAQu5KbU88a3colZpdgiHd/DFzuFv WOVGb8YnRuBSDbdVhfFSfHvQRmpbaiQhxvvTovGXIfkC41W/5RTl0xYadGv6Sjxa9MgP i1Mvg7RrFIAc7voToC3m3qDkDYScrKCiIErmKS9+hjukJ0kQ8PVub7dgtoT4n79xNgEf RgQZREHpcd13xITGNUr8WUY+n7rF8Z6z1WsEVYjNtsmKRxRvNJLOBZm7elltn2uYzc0R 4KymyOWVSg8o95HUHbFuDCJoXdnZdQWKO5iPiPnwaUy26WYYdtUePe2/yVRDKmTJvnkP rHaA== X-Gm-Message-State: AOAM530IkiKWgbZOwzN6zdqEwe6oZLuarb8ngy+Ao2kMJWncGqRYv5QQ NAMes21LB6OvObg4UYTzPslP X-Received: by 2002:a17:90a:9e5:: with SMTP id 92mr1645248pjo.176.1606902259173; Wed, 02 Dec 2020 01:44:19 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id bg8sm1393990pjb.52.2020.12.02.01.44.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2020 01:44:18 -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, Dan Carpenter , Manivannan Sadhasivam Subject: [PATCH 28/29] bus: mhi: core: Fix error handling in mhi_register_controller() Date: Wed, 2 Dec 2020 15:11:58 +0530 Message-Id: <20201202094159.107075-29-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: Dan Carpenter There are a few problems with the error handling in this function. They mostly center around the alloc_ordered_workqueue() allocation. 1) If that allocation fails or if the kcalloc() prior to it fails then it leads to a NULL dereference when we call destroy_workqueue(mhi_cntrl->hiprio_wq). 2) The error code is not set. 3) The "mhi_cntrl->mhi_cmd" allocation is not freed. The error handling was slightly confusing and I re-ordered it to be in the exact mirror/reverse order of how things were allocated. I changed the label names to say what the goto does instead of describing where the goto comes from. Fixes: 8f7039787687 ("bus: mhi: core: Move to using high priority workqueue") Signed-off-by: Dan Carpenter Reviewed-by: Loic Poulain Reviewed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/init.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) -- 2.25.1 diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c index 96cde9c0034c..f0697f433c2f 100644 --- a/drivers/bus/mhi/core/init.c +++ b/drivers/bus/mhi/core/init.c @@ -871,7 +871,7 @@ int mhi_register_controller(struct mhi_controller *mhi_cntrl, sizeof(*mhi_cntrl->mhi_cmd), GFP_KERNEL); if (!mhi_cntrl->mhi_cmd) { ret = -ENOMEM; - goto error_alloc_cmd; + goto err_free_event; } INIT_LIST_HEAD(&mhi_cntrl->transition_list); @@ -886,7 +886,8 @@ int mhi_register_controller(struct mhi_controller *mhi_cntrl, ("mhi_hiprio_wq", WQ_MEM_RECLAIM | WQ_HIGHPRI); if (!mhi_cntrl->hiprio_wq) { dev_err(mhi_cntrl->cntrl_dev, "Failed to allocate workqueue\n"); - goto error_alloc_cmd; + ret = -ENOMEM; + goto err_free_cmd; } mhi_cmd = mhi_cntrl->mhi_cmd; @@ -932,7 +933,7 @@ int mhi_register_controller(struct mhi_controller *mhi_cntrl, ret = mhi_read_reg(mhi_cntrl, mhi_cntrl->regs, SOC_HW_VERSION_OFFS, &soc_info); if (ret) - goto error_alloc_dev; + goto err_destroy_wq; mhi_cntrl->family_number = (soc_info & SOC_HW_VERSION_FAM_NUM_BMSK) >> SOC_HW_VERSION_FAM_NUM_SHFT; @@ -946,7 +947,7 @@ int mhi_register_controller(struct mhi_controller *mhi_cntrl, mhi_cntrl->index = ida_alloc(&mhi_controller_ida, GFP_KERNEL); if (mhi_cntrl->index < 0) { ret = mhi_cntrl->index; - goto error_ida_alloc; + goto err_destroy_wq; } /* Register controller with MHI bus */ @@ -954,7 +955,7 @@ int mhi_register_controller(struct mhi_controller *mhi_cntrl, if (IS_ERR(mhi_dev)) { dev_err(mhi_cntrl->cntrl_dev, "Failed to allocate MHI device\n"); ret = PTR_ERR(mhi_dev); - goto error_alloc_dev; + goto err_ida_free; } mhi_dev->dev_type = MHI_DEVICE_CONTROLLER; @@ -967,7 +968,7 @@ int mhi_register_controller(struct mhi_controller *mhi_cntrl, ret = device_add(&mhi_dev->dev); if (ret) - goto error_add_dev; + goto err_release_dev; mhi_cntrl->mhi_dev = mhi_dev; @@ -975,19 +976,17 @@ int mhi_register_controller(struct mhi_controller *mhi_cntrl, return 0; -error_add_dev: +err_release_dev: put_device(&mhi_dev->dev); - -error_alloc_dev: +err_ida_free: ida_free(&mhi_controller_ida, mhi_cntrl->index); - -error_ida_alloc: +err_destroy_wq: + destroy_workqueue(mhi_cntrl->hiprio_wq); +err_free_cmd: kfree(mhi_cntrl->mhi_cmd); - -error_alloc_cmd: - vfree(mhi_cntrl->mhi_chan); +err_free_event: kfree(mhi_cntrl->mhi_event); - destroy_workqueue(mhi_cntrl->hiprio_wq); + vfree(mhi_cntrl->mhi_chan); return ret; } From patchwork Wed Dec 2 09:41:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 335962 Delivered-To: patch@linaro.org Received: by 2002:a17:906:4755:0:0:0:0 with SMTP id j21csp777982ejs; Wed, 2 Dec 2020 01:45:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJwLEYWXrbKK4DJJ5V65tlEmA4q+ZkR//XFKXWAvVDECWcAHv2UQgba+lkIiV6/fZgSZKW7Z X-Received: by 2002:a17:906:e15:: with SMTP id l21mr1457071eji.509.1606902301442; Wed, 02 Dec 2020 01:45:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606902301; cv=none; d=google.com; s=arc-20160816; b=EeVphD9sKHfLS9Q/G2Y5rO9kIadRYBO7kK0pp2g91MHxDDESsv08ST6b7zZlNhrGD5 jkZjBhyWacwt57CvQ8RnyELWSevELHe5OAzGYRAqS/RgLERXZT9a+AvxHpKChpOfsNSi FeVryKHRnAWIfcLrbcvleEDFjwvjMEMeAhMQEjaxYuM0yy5gh8U+6qP9YbKvPcF0d+2q IcdcYTc/r5kSAt23Fu7X7stnUt5rZK5GYSjhDRwqL/1TpB/ICUJ0bmjdx7QYf8JznbZb KGggk6XdNJ6U0jw9wfx/2Q7DKVz/AsGE8ntWEFs5H2Lb9jFJq74Negszx/pcr5Xz3nmy rROA== 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=hesBFBojopE7IXyDHX9xv1pvWQunAb7Jbvi4ET2s6mg=; b=CMC07jnDw9cllsm20+yvf+MqypSspkakJ4tKdYuEL8Cn5TPA+PG/LZPEzUc6I3VPCW 3BiDvtAH1Jcq4WWOA9cfxt9bCN1vt2cjDPlZYcY5TBYPmRHSJwRyFV6nkGfIk9Y6i9Fh 5KMbP4VNE+7qW2veOAMe1pXZE9E6tkKCGNbCo6DwVI4tP2ujSpCPSdDtQ2YHFYLARz5t tet6DKKQF8Ecim8MAe/gw8RxURJiDIB6AXUoq71VaDxHmckAw3slzjvxhC0WBJyYJQIZ GMd3u4epebCVB6bP2NZcl/cA6EqfHQFA0SSjEgHwE0psftbgXtMury4LIAbtgjeirS1n 5K0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=O+4jPsZt; 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.01; Wed, 02 Dec 2020 01:45:01 -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=O+4jPsZt; 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 S2388599AbgLBJot (ORCPT + 15 others); Wed, 2 Dec 2020 04:44:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388627AbgLBJos (ORCPT ); Wed, 2 Dec 2020 04:44:48 -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 106F1C08E860 for ; Wed, 2 Dec 2020 01:44:24 -0800 (PST) Received: by mail-pg1-x544.google.com with SMTP id n7so302826pgg.2 for ; Wed, 02 Dec 2020 01:44:24 -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=hesBFBojopE7IXyDHX9xv1pvWQunAb7Jbvi4ET2s6mg=; b=O+4jPsZtWP+eaoXAjBDW/UBLL8u4+f70p9fgqatvstbeOqHnHsZc5BFM6mXMyR0yqF ymxh4DMJnFvOhl+zDYcqj2vA3wkHCl8BlTetoAM5H640i5MAwmaIfnXm8WaFxbvS5S+w 1YsaCurhV5RhLd0kWQl3V88TtA7Ir0r4NFRVGstbm/svqaI5jJQX/GU7O8mI4GswzhxF X23Yra3I+fJ/Dvw3L4h/JZgfJlIDP/fk/VFrg+yRdHSxYBr4V6QrNosF2J/+KnfEkfL/ Y57uHl/ynIk7g5CjYsPZ0C+o47SRrdhl5nYodHY6In+5Cszu7YdTOjqn2ebfqfDfc+Do FW5w== 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=hesBFBojopE7IXyDHX9xv1pvWQunAb7Jbvi4ET2s6mg=; b=O9nI6vC35y5VkOKxghGIJe54hQU6I52JkH9BHJGSUgR085t9OG9FVliohoQUzaOq7T AomdJ0Ta9282PmA7VCU3j7kkK3W/GVV+uQUMHGKD1VyZ/LZ0ponb+L2IfemcbwuPODrd pLJsskMHKCo8V8W1fftknjHoYgIkadkjZ9iTPTXn5DylyKr5+ppzTN3B0mNReETOS/3p tHbg72S5fmirWQU3TqNCbQdm74OnamwO31YL8y5jdBc0eB2v75BeCRXVt+26mW/aBhOx SKPKVaBV3zSvy+kTwU/gdv4+OXURqt/MyAw8ytMdhErKP99uWoqeDUnMFnPbFCOb+8/D zSNg== X-Gm-Message-State: AOAM533mZ4qDuu+z65a/Mj2p6wED1dN6YYZB0z9UwwDNxSzwGikorijS OYqW9NL35IfjzmO2IcZ36OAu X-Received: by 2002:a63:4b05:: with SMTP id y5mr1895628pga.342.1606902263544; Wed, 02 Dec 2020 01:44:23 -0800 (PST) Received: from localhost.localdomain ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id bg8sm1393990pjb.52.2020.12.02.01.44.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2020 01:44:22 -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, kernel test robot , Nathan Chancellor , Manivannan Sadhasivam Subject: [PATCH 29/29] mhi: pci_generic: Fix implicit conversion warning Date: Wed, 2 Dec 2020 15:11:59 +0530 Message-Id: <20201202094159.107075-30-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: Loic Poulain Fix the following warning with explicit cast: warning: implicit conversion from 'unsigned long long' to 'dma_addr_t' (aka 'unsigned int') mhi_cntrl->iova_stop = DMA_BIT_MASK(info->dma_data_width); Fixes: 855a70c12021 ("bus: mhi: Add MHI PCI support for WWAN modems") Signed-off-by: Loic Poulain Reported-by: kernel test robot Reviewed-by: Nathan Chancellor Reviewed-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/pci_generic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.25.1 diff --git a/drivers/bus/mhi/pci_generic.c b/drivers/bus/mhi/pci_generic.c index e3df838c3c80..f5bee76ea061 100644 --- a/drivers/bus/mhi/pci_generic.c +++ b/drivers/bus/mhi/pci_generic.c @@ -273,7 +273,7 @@ static int mhi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) mhi_cntrl_config = info->config; mhi_cntrl->cntrl_dev = &pdev->dev; mhi_cntrl->iova_start = 0; - mhi_cntrl->iova_stop = DMA_BIT_MASK(info->dma_data_width); + mhi_cntrl->iova_stop = (dma_addr_t)DMA_BIT_MASK(info->dma_data_width); mhi_cntrl->fw_image = info->fw; mhi_cntrl->edl_image = info->edl;