From patchwork Mon Aug 9 08:24:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 493837 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp2688678jap; Mon, 9 Aug 2021 01:24:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxD3ei6uyYB+7wm2iP8oXJTtrp84JksN3Gs5Muk/98PlXwF70iMQ31Eqmq+Cx4YaXCWbQzT X-Received: by 2002:a6b:4f16:: with SMTP id d22mr200434iob.40.1628497484768; Mon, 09 Aug 2021 01:24:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628497484; cv=none; d=google.com; s=arc-20160816; b=tqFjbpgOWHLOVNgAWFjEMFHgwVgE9dJqjErb/GBvxjEO//AjoEySfUKFqUEe1iWAPN cGqIaaSv8c5Cj25KhVU0BUBvezeimMMIAF5ClR2kqcMIbKzu6FJI9uprhF9Cjy5j6Lo8 DgkHuGCv8o4mRzGjddPVkTbtCzB7Q3VFKpgMKXNv5wqqLjlkn7lFqllSLUXZEVJFUbJd wJJ8bWRU0XVs91nWu+FH106HnF7vNeRQkBIv8kk5chj8cg5tbJWqrwC++cYM3GvBcgaZ m8noKFUrPYWstC5Xbn66bHRCBKywMzmnIgeLRFGndPTByMUSteGuDqJ63mHI+QtRHhq6 DehQ== 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=8M4d0Uxz/0+0kMFPkk4zFO2m4csYlGTmBy9HzP7nwc4=; b=Pcjr2o5wmA6UYd22/7Ra8kRVAQpnbJeGgcqKDfUyrvDdd9WGK1ZBsZ30IMOc9F+1L/ nJ6rLY0XkXEp2nThLx1++xUNO+UIlXnwCEDmMpcdyJpUeTdkxUaUOUyVkYkEkkSWO/j+ 5qGm6W7z8jqNLaG9bpTeUTfX1HftSa9OVm+rUA7EjZy4/DXCCsPOj6v/yr9mM4AM0oup Ki2n1bKUqd528WFsEnz0cW+0Fl6DDlbj4ziXhu5V6/OM2TxGWoDjeB4ffwrJO9zC/WL6 /pIHxxW8oEje++b/aUe6AyCut7Q+pQ8ZBMBwGOnxs8g19Hycp6rJpIacUVbfz0j6eQMI WIyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NwUHzMjo; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 e20si22414517iow.6.2021.08.09.01.24.44; Mon, 09 Aug 2021 01:24:44 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-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=NwUHzMjo; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 S233857AbhHIIZD (ORCPT + 12 others); Mon, 9 Aug 2021 04:25:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233942AbhHIIZC (ORCPT ); Mon, 9 Aug 2021 04:25:02 -0400 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F726C0613D3 for ; Mon, 9 Aug 2021 01:24:42 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id o11so3824705wms.0 for ; Mon, 09 Aug 2021 01:24:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8M4d0Uxz/0+0kMFPkk4zFO2m4csYlGTmBy9HzP7nwc4=; b=NwUHzMjoQ5R5F5nGSCfQy+CR6Mbh323wn9co/8+otLrt9OyssZ2/yCQQ3BjkrC5KeX 7Ok8+86VSe9mw15Q7adCt3V7xIB6wD3xm7Z7CdUCEAiZgYdHQKJYPiuASKhEzcb4GJyI EdpJkfIj7ATYUJSjCdbkArd3V9PZilgW6Fn9AMhwDqK8UBmernuxwus+HDPK3Y4LtBJU WpyDA6Q8egGhl+M5Vx6T9uKNvk/tclwvVdqyoWXOcaP/WG72g5FtalkT0N6YMAPsXC1Z e6mpJ45V2D1rdOmoVQb5Ayc48mgJQSgwPAy5YYXk+eYnhAaejfYC2/KxEcEfVMP1MmCb yGyQ== 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=8M4d0Uxz/0+0kMFPkk4zFO2m4csYlGTmBy9HzP7nwc4=; b=N/CA1WXOXn/a3c6kKKNvqwS1KiH+zXK8CccNKntfbg3jAs2xNCJk4krg937fjM3eYK AzZQ0D9UKdUXAay3BhyZh5dQlnfg4dmdgcVXGqkx30tjUekNrPRWNExGgGuwxqvU03jP rBp0/jPt4v9gsR32qMip51UzGiBUL6BbkgfBz2OZ0ry2jx+A8b0Hueqemz8eu7gqiJSu XIxAPfk2VGx5zstMZi7j48IDTSYPW5R95fRlueaJ+0KaBxhzilti4ZGu/dLP3+ZVLj2k XLb7DQ01uFuKBa2EKHYcveYxUCCzoCCl/3ynEettU+lH4V7vliorvHIOnYDL0TDL11Oz o0gA== X-Gm-Message-State: AOAM5335OajTeYFGsROr1GpkKaHnDfc3FXiBTwxOABuA/BMU8Kmiu5I8 RQdDjiBgMCboSD6yaNwyjG6nbZrPnLy5vg== X-Received: by 2002:a05:600c:2306:: with SMTP id 6mr15684677wmo.115.1628497480815; Mon, 09 Aug 2021 01:24:40 -0700 (PDT) Received: from srini-hackbox.lan (cpc86377-aztw32-2-0-cust226.18-1.cable.virginm.net. [92.233.226.227]) by smtp.gmail.com with ESMTPSA id t15sm18036371wrw.48.2021.08.09.01.24.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Aug 2021 01:24:40 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Srinivas Kandagatla , stable@vger.kernel.org Subject: [RESEND PATCH 1/4] slimbus: messaging: start transaction ids from 1 instead of zero Date: Mon, 9 Aug 2021 09:24:25 +0100 Message-Id: <20210809082428.11236-2-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20210809082428.11236-1-srinivas.kandagatla@linaro.org> References: <20210809082428.11236-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org As tid is unsigned its hard to figure out if the tid is valid or invalid. So Start the transaction ids from 1 instead of zero so that we could differentiate between a valid tid and invalid tids This is useful in cases where controller would add a tid for controller specific transfers. Fixes: d3062a210930 ("slimbus: messaging: add slim_alloc/free_txn_tid()") Cc: Signed-off-by: Srinivas Kandagatla --- drivers/slimbus/messaging.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.21.0 diff --git a/drivers/slimbus/messaging.c b/drivers/slimbus/messaging.c index f2b5d347d227..6097ddc43a35 100644 --- a/drivers/slimbus/messaging.c +++ b/drivers/slimbus/messaging.c @@ -66,7 +66,7 @@ int slim_alloc_txn_tid(struct slim_controller *ctrl, struct slim_msg_txn *txn) int ret = 0; spin_lock_irqsave(&ctrl->txn_lock, flags); - ret = idr_alloc_cyclic(&ctrl->tid_idr, txn, 0, + ret = idr_alloc_cyclic(&ctrl->tid_idr, txn, 1, SLIM_MAX_TIDS, GFP_ATOMIC); if (ret < 0) { spin_unlock_irqrestore(&ctrl->txn_lock, flags); From patchwork Mon Aug 9 08:24:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 493838 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp2688685jap; Mon, 9 Aug 2021 01:24:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjQGsmKUpAAO4qyYoah5hUp6VYc/scuZmZ/VP4Gg2NbGaF0zXEkVC1E5UrkXi4FwX9zlHc X-Received: by 2002:a02:8807:: with SMTP id r7mr16577631jai.35.1628497485178; Mon, 09 Aug 2021 01:24:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628497485; cv=none; d=google.com; s=arc-20160816; b=Xs2DDQXb2Y2dLYQ1lQn/vI5CfAi2VJXkJa6j3gufZ39RhYZ6SwjLU2BEnitaqLrt0z q++s43ex+DqH0/BdvmKlOnkxGGPN6FvcSMkvTwWsPAMNCZd/rkh+gioRgakOD9HIP6pa FqT3GLZPbpYBFIP3lNGBXCJC2/vTyZIEovkFICDvoySgIng7LOgFxKiSvBIbPKgD/YTt JAH0rIAi7/+xRRWnnoePe5ETagmfxBztWdbXeyuH8Wr4h3kDLqMsK4/GxJVEGBYWffnC WXFTHnjK4jSNkVzuGw4BZorlBQdm0Ps2EXPUkozwlxp/odLbWlxKB5YZhj1Zf4m1fGvM RIpg== 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=yiquJn/INQmy4EXg5mRduxYtbDZF0r2NCJii+WrbH0Y=; b=Xd2reoq5Cx8Z1w0Stuf6qMlMch+9dR+y2+GRlA8okXdPL0Rqq2fk9Pp0KvLIiqDkvV 3+FenNhX8E98mPMBxxCFcuTnbr3Azul109FS7fOYQU8RGRgdm5lZ70nLKZd0t4LSyevl sTd2v5Bo1ivAUoiU9yAkkmgwEGyVRARcKpHv4x6BpELBbYMq3PK6fZfgMyjeNSMJ7dqP oBxEJ5uUVoHvgZMXcP26g3YRJKjSo4VWHiXgD95AuDJM9QCJghBFlc4Lp6PAKc75svpJ gNEckGLPqmH8+oGmeULR+BNzZYzj/JbeoLt5AK+XZbPTCPXEz3Cfzk5m6mDBaBgV8i1G 90HA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cBC+pizn; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 e20si22414517iow.6.2021.08.09.01.24.45; Mon, 09 Aug 2021 01:24:45 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-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=cBC+pizn; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 S233952AbhHIIZD (ORCPT + 12 others); Mon, 9 Aug 2021 04:25:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233947AbhHIIZD (ORCPT ); Mon, 9 Aug 2021 04:25:03 -0400 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E078C0613D3 for ; Mon, 9 Aug 2021 01:24:43 -0700 (PDT) Received: by mail-wm1-x330.google.com with SMTP id q11-20020a7bce8b0000b02902e6880d0accso2053883wmj.0 for ; Mon, 09 Aug 2021 01:24:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yiquJn/INQmy4EXg5mRduxYtbDZF0r2NCJii+WrbH0Y=; b=cBC+piznjrG893DpUbCLAQausCChPmbITmrt3rP7kIziQb9lP52gK1mDqwHpTzWv7h RVrsQui3bODCdnS6ZJ4paATX8ASIpfcMnGRbr7/PaLveD/wLoo1pi3p8v9aJibtFr9iO Du+9O6zo38Z2o3pm5QOlb2F5SvrQZxXqU8ITYEfBT+dH7RGAmTLk4r0TWo7toZ4aV3sE w7jO3YkW+A7m3IAiK1x9E1V/rX6EUAvEPhwMfylQUrkkBSjW5i8ywr7nYe3wbeMK/qid pVYXc9jY2cumYmwO0dz1mHhAqe36bIr0HLmodqCZUnMK7Zt4jfBGj2Wv36E7Dby5SppN /cRQ== 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=yiquJn/INQmy4EXg5mRduxYtbDZF0r2NCJii+WrbH0Y=; b=c6oTvtHo/G00u17AnxjWnWSBSEkMnhuN+6Ygxlyv59i9GRy/ntnTffQf6173UYCbzU kNJc1uWBOUbsASkYUIPPAdFSL32LlOOVk6fFJUgnHYAE1OO2aBs9XDtto1Jl9I8zC/0p bxONO25LXuruuBKSgdXXdCGQMjIlQ5HN7KSZpBr9csD9iB7G1EIUjV6Y7WDbfmmFZrkL 7Xmn7S1ZkEZsZdv2B8Ai/pv0DXiaCYMSQpiVzW4IuYk1N+YFGfmagWCyDgrvDLuXqdlL BavhwI+RCqm2wXslFGHaRxb8A23uxoYw7LVfpC8gcZU3tLhT1DFmsROC+ypCXxuvlBxD VBGw== X-Gm-Message-State: AOAM533DfzaeAc8dlSpRTcu7pV434kO/zlQcu1UBhdMhIovk80zwWL2O xnc7kqyHCvsL0Uv3NK+T/efd7A== X-Received: by 2002:a05:600c:3b8f:: with SMTP id n15mr10274591wms.155.1628497481789; Mon, 09 Aug 2021 01:24:41 -0700 (PDT) Received: from srini-hackbox.lan (cpc86377-aztw32-2-0-cust226.18-1.cable.virginm.net. [92.233.226.227]) by smtp.gmail.com with ESMTPSA id t15sm18036371wrw.48.2021.08.09.01.24.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Aug 2021 01:24:41 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Srinivas Kandagatla , stable@vger.kernel.org Subject: [RESEND PATCH 2/4] slimbus: messaging: check for valid transaction id Date: Mon, 9 Aug 2021 09:24:26 +0100 Message-Id: <20210809082428.11236-3-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20210809082428.11236-1-srinivas.kandagatla@linaro.org> References: <20210809082428.11236-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org In some usecases transaction ids are dynamically allocated inside the controller driver after sending the messages which have generic acknowledge responses. So check for this before refcounting pm_runtime. Without this we would end up imbalancing runtime pm count by doing pm_runtime_put() in both slim_do_transfer() and slim_msg_response() for a single pm_runtime_get() in slim_do_transfer() Fixes: d3062a210930 ("slimbus: messaging: add slim_alloc/free_txn_tid()") Cc: Signed-off-by: Srinivas Kandagatla --- drivers/slimbus/messaging.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- 2.21.0 diff --git a/drivers/slimbus/messaging.c b/drivers/slimbus/messaging.c index 6097ddc43a35..e5ae26227bdb 100644 --- a/drivers/slimbus/messaging.c +++ b/drivers/slimbus/messaging.c @@ -131,7 +131,8 @@ int slim_do_transfer(struct slim_controller *ctrl, struct slim_msg_txn *txn) goto slim_xfer_err; } } - + /* Initialize tid to invalid value */ + txn->tid = 0; need_tid = slim_tid_txn(txn->mt, txn->mc); if (need_tid) { @@ -163,7 +164,7 @@ int slim_do_transfer(struct slim_controller *ctrl, struct slim_msg_txn *txn) txn->mt, txn->mc, txn->la, ret); slim_xfer_err: - if (!clk_pause_msg && (!need_tid || ret == -ETIMEDOUT)) { + if (!clk_pause_msg && (txn->tid == 0 || ret == -ETIMEDOUT)) { /* * remove runtime-pm vote if this was TX only, or * if there was error during this transaction From patchwork Mon Aug 9 08:24:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 493840 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp2688729jap; Mon, 9 Aug 2021 01:24:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4ImWdnEoHmzZVDL6+7lOnkgs+dYgDcGShtJ0B0yU+Xmpq2c9OtZOp6YYPxHTjQbzjS/HW X-Received: by 2002:a92:d088:: with SMTP id h8mr362726ilh.165.1628497488935; Mon, 09 Aug 2021 01:24:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628497488; cv=none; d=google.com; s=arc-20160816; b=PdjwxshZjiUF+L4VfSUHbLdE5l4L8T+X1v9qdDdr7utdj083JuDszL2+AhjE7UINP1 QsGyB2z8SkFF4pi/1RF2rxisd5MrU+4hl2Vm8JVsQu0+zVgMcZlo0eFG8qnG+IM5icrz NkAvCx5p6jyUeSdSgEy76s4s812Otd7Dlwgo9uJCyTQZwLP5IcJcSl0Z215qAbkX8KMt Mb+/lp4AGgjATUXfU39kVgK0XPRLi4CPtnXK3+JQLUpNz5yT28+T1wO1+4E0F8MpzmX+ 8z2BCEWz35icKfPWDIWho2NMY3Za9EEk7lOvOqYxa//+2r/RaoJVb/z42UwugnIA9Z6K X53g== 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=MMllCfmYFnjcwZk6yJ9SVZujM0OJeGztI30MGIz0Avw=; b=KorCSKLXzVCWI16AzLbmzxomu8Nv3u5hdGC4oYtL2ZGa8Y8Zirp04QYZLnkQRMaTcp tf+tXwVBjrDpl8FeKqBa3EmaMmTVQUW4gmW3D+r31heYGWod7DVOBriYxeAILF3n8SSN HtLGsmr/4QukUVEWl4BlNv5qrrVv6o0vUSqJL05vUpVjojH2kQbXF+tgf2KYg4GOUXS4 3nC18hctRdd6KmcxuvdRZKe5onzCgwM4FqNDSXvvDG2gBL0o+nHSUTG5RbkN8GzVuqu6 LA6zXU8/eo+WZb4w7kef4yrYpXhltD1NbzPfU78fNcCim0t7qLLv4BxZZKVptTgC0lOw z6uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hN2Aw1lF; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 o12si18238814ilu.155.2021.08.09.01.24.48; Mon, 09 Aug 2021 01:24:48 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-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=hN2Aw1lF; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 S233965AbhHIIZH (ORCPT + 12 others); Mon, 9 Aug 2021 04:25:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233961AbhHIIZE (ORCPT ); Mon, 9 Aug 2021 04:25:04 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07520C0613D3 for ; Mon, 9 Aug 2021 01:24:44 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id k4so9979499wms.3 for ; Mon, 09 Aug 2021 01:24:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MMllCfmYFnjcwZk6yJ9SVZujM0OJeGztI30MGIz0Avw=; b=hN2Aw1lF5hQbakvLyby19k7M45wABivNCeDHhtq1VuNjrwu0cjHqIf1XiVB07lWqgI BdmDpWx+vR46Zx46h/GvjbciWePm5uSPWTxvOzYzTK+4WOcEBm4DHFRcyXLuJRF2JXmJ ee8Mhr3YE2I8fF8SDBt8sd/oHh40NnxpJDhZh+gizS3RqiWJyofoL3VKI+bSFSf238Jf ihB4xp2do2OSoylH9VOKIMF27FfvoyTjAy77F6s7nUX4UiaLwfR0RFKfDxKQQaD6vKfe yfvxmctk3s4wpQKHci/Q9uEN/cQHtGXmj2o5WgbDNA5WH+7dm4EZLC4bnuRqvgnrGyEB JQZA== 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=MMllCfmYFnjcwZk6yJ9SVZujM0OJeGztI30MGIz0Avw=; b=fPywa3wDAUm+VFc/PeuCoUSpGeI5uZqLX6be/NWvPd3V8RsBTHe9TAI+rPQ9CNV+yw U3qM0fygbidj+7V0p0HJtct6DGj7coXRcgI9gTWLlSCrNNY3PBcmlsuIw1vz50TB5ez+ VBYHkFxSWUAGxoGji/cMxFhkLVxs0egdtFKuHTg79lhZU9gd1kuk87maLUBPEs2BGhLq Byh8N2s3LpGb+SQN2oj5IXS+IozJRmpu94UcRkk3TlNhaBpU2UW9/Jh8AyT9vEUEv/Xl Fo7JSvxRAA4hWnSHxbohG0X4FxhuW9WyVQPgU2scr/hD+xEMVsqoYJXr9skBXfqjULa8 HQMQ== X-Gm-Message-State: AOAM530X9z+0PydqlkMf925S86/e4xfwxGrTsnqvZqdUo7ZqejXJVSv6 8Xi2d4mr5TKai2UisI/tLwVOWg== X-Received: by 2002:a7b:c114:: with SMTP id w20mr15727927wmi.85.1628497482667; Mon, 09 Aug 2021 01:24:42 -0700 (PDT) Received: from srini-hackbox.lan (cpc86377-aztw32-2-0-cust226.18-1.cable.virginm.net. [92.233.226.227]) by smtp.gmail.com with ESMTPSA id t15sm18036371wrw.48.2021.08.09.01.24.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Aug 2021 01:24:42 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Srinivas Kandagatla , stable@vger.kernel.org Subject: [RESEND PATCH 3/4] slimbus: ngd: set correct device for pm Date: Mon, 9 Aug 2021 09:24:27 +0100 Message-Id: <20210809082428.11236-4-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20210809082428.11236-1-srinivas.kandagatla@linaro.org> References: <20210809082428.11236-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org For some reason we ended up using wrong device in some places for pm_runtime calls. Fix this so that NGG driver can do runtime pm correctly. Fixes: 917809e2280b ("slimbus: ngd: Add qcom SLIMBus NGD driver") Cc: Signed-off-by: Srinivas Kandagatla --- drivers/slimbus/qcom-ngd-ctrl.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) -- 2.21.0 diff --git a/drivers/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c index c054e83ab636..f3ee8e036372 100644 --- a/drivers/slimbus/qcom-ngd-ctrl.c +++ b/drivers/slimbus/qcom-ngd-ctrl.c @@ -618,7 +618,7 @@ static void qcom_slim_ngd_rx(struct qcom_slim_ngd_ctrl *ctrl, u8 *buf) (mc == SLIM_USR_MC_GENERIC_ACK && mt == SLIM_MSG_MT_SRC_REFERRED_USER)) { slim_msg_response(&ctrl->ctrl, &buf[4], buf[3], len - 4); - pm_runtime_mark_last_busy(ctrl->dev); + pm_runtime_mark_last_busy(ctrl->ctrl.dev); } } @@ -1257,13 +1257,14 @@ static int qcom_slim_ngd_enable(struct qcom_slim_ngd_ctrl *ctrl, bool enable) } /* controller state should be in sync with framework state */ complete(&ctrl->qmi.qmi_comp); - if (!pm_runtime_enabled(ctrl->dev) || - !pm_runtime_suspended(ctrl->dev)) - qcom_slim_ngd_runtime_resume(ctrl->dev); + if (!pm_runtime_enabled(ctrl->ctrl.dev) || + !pm_runtime_suspended(ctrl->ctrl.dev)) + qcom_slim_ngd_runtime_resume(ctrl->ctrl.dev); else - pm_runtime_resume(ctrl->dev); - pm_runtime_mark_last_busy(ctrl->dev); - pm_runtime_put(ctrl->dev); + pm_runtime_resume(ctrl->ctrl.dev); + + pm_runtime_mark_last_busy(ctrl->ctrl.dev); + pm_runtime_put(ctrl->ctrl.dev); ret = slim_register_controller(&ctrl->ctrl); if (ret) { @@ -1389,7 +1390,7 @@ static int qcom_slim_ngd_ssr_pdr_notify(struct qcom_slim_ngd_ctrl *ctrl, /* Make sure the last dma xfer is finished */ mutex_lock(&ctrl->tx_lock); if (ctrl->state != QCOM_SLIM_NGD_CTRL_DOWN) { - pm_runtime_get_noresume(ctrl->dev); + pm_runtime_get_noresume(ctrl->ctrl.dev); ctrl->state = QCOM_SLIM_NGD_CTRL_DOWN; qcom_slim_ngd_down(ctrl); qcom_slim_ngd_exit_dma(ctrl); From patchwork Mon Aug 9 08:24:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 493839 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp2688721jap; Mon, 9 Aug 2021 01:24:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyb9vKKvGWuZhALnM/JfdTbq3fIpkEoLgzZuf3XPlvC0WiYtMYMCE9P/ripEe/DMduvt+An X-Received: by 2002:a05:6638:1004:: with SMTP id r4mr21701960jab.105.1628497488588; Mon, 09 Aug 2021 01:24:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628497488; cv=none; d=google.com; s=arc-20160816; b=Dxx2bZCvMt5xAyoh9WD3r9Y+rFgjfcS2UukgLxuADZvgMzdx48PrfcFgAuIX3b59WP /gZaP5IePUJj+jtoIEEGbgMtrqJSmER+PZVunTbHaDZigaOF546faqPAcHtVYlc6oFVT L0/xXkJqPFb5vvk2HHOctf4nT0I+fj2pLUc6tV3yZNyv+rPBWkefdrmzenijfev1riVz ucvwDM8U/H7/IToPnEMrCi4K+MTy2lxueCag5A2A+mDgCH1N68guAxtExHkPoVw7Qiq6 wACq7r7gI8on5NG3COLIsqCdSDiPO5K/9OaCt7EJI+cC0TMWJNE25f7dgRAZ54ooiO/j wjeQ== 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=P17OeSiwNU27tPgzIXbVaCeJQjA2Rn8XgRVpE6+nR8Q=; b=ZMxXRJic+ziJOv1DP7fZc2zpG24NNInSQseHOionMR6hI3T00yGXv3U0eUoXTlDXQI 9+mbSe2PdM/TgsGO0Oj3Y/AXhGcFfSVgpc7aYnVM8ki8VxVJUlc+JMh5gPQ4xBmWaxVU BkRD+jPwLwXqDfeZ5moXRcgjUSCw5H+61brjWSm67LIbJzYDB4sVZsQPtL3tYT2YvNxj 48OS7hNeG7iuFklW6oKT3ZMaw8k6anp8ajXrhEGbmXnOV4dzujee3VeNKpI4mkXSVx6W MD57chlrFtkcFkDK6Yl82QUOj8PdffqoZiTGQUYdDgraueiiNWbFIq9MY3J3EpzmocJe Ulew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FfNaBNHt; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 o12si18238814ilu.155.2021.08.09.01.24.48; Mon, 09 Aug 2021 01:24:48 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-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=FfNaBNHt; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 S233959AbhHIIZG (ORCPT + 12 others); Mon, 9 Aug 2021 04:25:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233926AbhHIIZF (ORCPT ); Mon, 9 Aug 2021 04:25:05 -0400 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E82FAC06179A for ; Mon, 9 Aug 2021 01:24:44 -0700 (PDT) Received: by mail-wm1-x333.google.com with SMTP id l34-20020a05600c1d22b02902573c214807so13910408wms.2 for ; Mon, 09 Aug 2021 01:24:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=P17OeSiwNU27tPgzIXbVaCeJQjA2Rn8XgRVpE6+nR8Q=; b=FfNaBNHtenFz64h3TEkWwoH4t4gtVDyUsXq6bYM5JzZsupGRdA4O02JGELm1/pC33f cR6SswkNuCn+rTBtMGi1wH1JWVkA9U8vx8p7lJme69+B3Q5FEs3MAzADYPWDRAeh4J0G xIG+1Lf1m5RxobQ6EIhoqBznLHx0QyQpJIABoxTfJecQ72CFrStJjpwpKf+uX4nNNir9 f/zdA/J7Z0kVMo9eZnEt+CZhazZ+s2HARiGtB5YKDX3zueUf9SNj5seWG281oXr+Tbz+ voxm58rgi2nElKh++Xa3aw3zOCZeheCi1WV+sk61M7JbFc32EFpGDIGDow87LWlBX5Y7 8xYg== 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=P17OeSiwNU27tPgzIXbVaCeJQjA2Rn8XgRVpE6+nR8Q=; b=WkOMWRsJ5BxGjoVfN8FhesvHYS+Cv2fRpYV52VSwAsp/Me6FRnY0AOCxcAQSnVC8lY RH6zwb1oQkbU0x18K2M3keAxbVawGr3dVr8ZE6MoO4pATnJw2v3cIUZBeQW3J77buokN o4gGWPEQXxlVsOaBbHbEfMH/fCoAMFC2EMrbmT0AnoYMBOx3AOMVchFcLLEpc+wxQ5qu CTu/OYdjaserrqDlccyPMuHT9SFc7kq/OivDKCFgkbSyMAACme3XCDMfUGDQoWKPOVfr j6jmd8x2tEQbG0R6imhqs8OyFSw50jTypMq3Q2YC6JtQ6bmdNYdqSQLMxtUomPBPH9cm BN7w== X-Gm-Message-State: AOAM531xFL/M5XBbMN4/pLLGTcjwpbcrISJn5GGltdUWTAfCNk1jWMjM W4m3FHmZdoE93wyS+3lMcIN3MPVKFI5tTA== X-Received: by 2002:a1c:cc05:: with SMTP id h5mr32650946wmb.5.1628497483634; Mon, 09 Aug 2021 01:24:43 -0700 (PDT) Received: from srini-hackbox.lan (cpc86377-aztw32-2-0-cust226.18-1.cable.virginm.net. [92.233.226.227]) by smtp.gmail.com with ESMTPSA id t15sm18036371wrw.48.2021.08.09.01.24.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Aug 2021 01:24:43 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Srinivas Kandagatla , stable@vger.kernel.org Subject: [RESEND PATCH 4/4] slimbus: ngd: reset dma setup during runtime pm Date: Mon, 9 Aug 2021 09:24:28 +0100 Message-Id: <20210809082428.11236-5-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20210809082428.11236-1-srinivas.kandagatla@linaro.org> References: <20210809082428.11236-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org During suspend/resume NGD remote instance is power cycled along with remotely controlled bam dma engine. So Reset the dma configuration during this suspend resume path so that we are not dealing with any stale dma setup. Without this transactions timeout after first suspend resume path. Fixes: 917809e2280b ("slimbus: ngd: Add qcom SLIMBus NGD driver") Cc: Signed-off-by: Srinivas Kandagatla --- drivers/slimbus/qcom-ngd-ctrl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) -- 2.21.0 diff --git a/drivers/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c index f3ee8e036372..7040293c2ee8 100644 --- a/drivers/slimbus/qcom-ngd-ctrl.c +++ b/drivers/slimbus/qcom-ngd-ctrl.c @@ -1080,7 +1080,8 @@ static void qcom_slim_ngd_setup(struct qcom_slim_ngd_ctrl *ctrl) { u32 cfg = readl_relaxed(ctrl->ngd->base); - if (ctrl->state == QCOM_SLIM_NGD_CTRL_DOWN) + if (ctrl->state == QCOM_SLIM_NGD_CTRL_DOWN || + ctrl->state == QCOM_SLIM_NGD_CTRL_ASLEEP) qcom_slim_ngd_init_dma(ctrl); /* By default enable message queues */ @@ -1131,6 +1132,7 @@ static int qcom_slim_ngd_power_up(struct qcom_slim_ngd_ctrl *ctrl) dev_info(ctrl->dev, "Subsys restart: ADSP active framer\n"); return 0; } + qcom_slim_ngd_setup(ctrl); return 0; } @@ -1618,6 +1620,7 @@ static int __maybe_unused qcom_slim_ngd_runtime_suspend(struct device *dev) struct qcom_slim_ngd_ctrl *ctrl = dev_get_drvdata(dev); int ret = 0; + qcom_slim_ngd_exit_dma(ctrl); if (!ctrl->qmi.handle) return 0;