From patchwork Fri Aug 6 09:16:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 492818 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp123193jap; Fri, 6 Aug 2021 02:16:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxwyp0RJOLOLYU2pErLE4+oSsiEO8rarUOZDrgMg659Kfw5bHpUD40Z6oIRUauargpcvl0 X-Received: by 2002:a05:6638:2186:: with SMTP id s6mr8812441jaj.127.1628241410756; Fri, 06 Aug 2021 02:16:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628241410; cv=none; d=google.com; s=arc-20160816; b=NnMhxnuTgPr/+mVzCDmLfDIz+CG+kcBzfMWP/xy2kbiJfLlfXvjREMHEqbwtm503v+ bZ/NfGGSItQPtih+8OvMS4KOEAX94FLpQounbcqMDeezuDIpZ+q9vPxaDIhXv0Uj0d94 s6194O1nZhEn0tazLUgHCf20GsmzTFjYVtYrBpWq5VrmkJsOQnCQRIBUHEYgFgfdZbx2 0jvIYYzcthH4Y2bJqGMgxgt8+sYTTrz4SnU/mK8t0M2luGRSmtnp7fUctBoravYFyeHg SKwKUFe9DfK5eb5AYA1twgjDHZoejLNnRJvfUEoK0ppMJlf/T2/SSjuw+ulKPPyN4oyA 0Z4A== 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=Z3nZX3icXm1s5Sg760cgan/OibnwiRKmCWhYwzLOSF4jYVN+DwcwvSnHl94CLN1hQV OyhAsFT75wOHuE5Ney2IhmdamsdoR/G/QlSZG99YHq4gQJ4s53wqHZ30WnHX75w856QF xYGHbr5boRjsWky+XZ9HmgsKt+LED0SRUOEYnDC3O9+EdCMH56bpq8d92KLXsrX2UUdA /JTEE2T65xqw7r8oqGncunjie95lMlDTmmxynkKBEJUF8zGVtVLuww0pbuMJ9pascQxC RLSfpzniSfViLEgpvs/qh/lYWvw/3QOLxCBzsGLAdo0rnx7bq7xK4iomIood0TZfC3P7 3dqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NDNa8CSx; 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 h17si8426949jav.110.2021.08.06.02.16.50; Fri, 06 Aug 2021 02:16:50 -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=NDNa8CSx; 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 S244377AbhHFJRE (ORCPT + 12 others); Fri, 6 Aug 2021 05:17:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244195AbhHFJRE (ORCPT ); Fri, 6 Aug 2021 05:17:04 -0400 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8462BC061799 for ; Fri, 6 Aug 2021 02:16:47 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id k38-20020a05600c1ca6b029025af5e0f38bso8365133wms.5 for ; Fri, 06 Aug 2021 02:16:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8M4d0Uxz/0+0kMFPkk4zFO2m4csYlGTmBy9HzP7nwc4=; b=NDNa8CSxRoQ91d6lqFXRz3nSHq0My/Nma95MTVyL/jnxP7OT39/uNT6L1dG9frwSq5 +f2Uq7dzvOStYq0NvabTdUdKo1fRcEFCXHuTOFyMWZzSUgvAHFAJhQfwUPNjFM7RYqfL wINr5PM2rr9TwV490Cx4asjLZipz77JOaZ2+rKgz7leMu1eXxXP2MeuQs3Ryqtko0mNl xhWS0YcT5FQ0EExhusaEvK7XWGD7Yc83dn8RS3aw2/oV2wn7nCzlMqvcjb0nGPf2KN+I 5gys4Qoiv3pa+exlxkBGOzHaZfCDf8L5wwIFtF13JRY/LP3UDr83p51dd0I7fZvw4gAx GR0w== 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=gnkjQj/vdRtmi3jzR/YcCevJKX3UOKkZF+97PEvsYgS/fvea8F/Ulc4kYAddMb0rQd 1xrZh7ElaAbfppcXGkQl/pIkWprdOYjORCNG+hvafYR5mtM5xJNI5F4OJmnWt4SfUXFo 1pDcnzStM4WjQeBrBMpMYaBX1ezSLKDKnlvx8pe5gX5UM3FU/2p0Oen8lk5/9FrhnymA fFyabC81DKkZ6ClILEFkrA6vqM2gvEVRIO3USlicUXViOUPqbDoZVBmMV2b5wIIIpLbo ZwHAvqr+9IR627fSh9JpUkzJ6DWI6AsXqsEagYqAW0/Gb6G71PlCid0uRcrx6ukbJUg0 EsTQ== X-Gm-Message-State: AOAM530xZ2qafRZivClvJ3kUcGPETL7ANMcpvhvTjWzRI2t3nptgpehZ 3jORO5m37LOH8ou6NJpmeVGZvw== X-Received: by 2002:a05:600c:1906:: with SMTP id j6mr18507085wmq.108.1628241406206; Fri, 06 Aug 2021 02:16:46 -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 w3sm7811760wmi.44.2021.08.06.02.16.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Aug 2021 02:16:45 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Srinivas Kandagatla , stable@vger.kernel.org Subject: [PATCH 1/4] slimbus: messaging: start transaction ids from 1 instead of zero Date: Fri, 6 Aug 2021 10:16:36 +0100 Message-Id: <20210806091639.532-2-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20210806091639.532-1-srinivas.kandagatla@linaro.org> References: <20210806091639.532-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 Fri Aug 6 09:16:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 492819 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp123208jap; Fri, 6 Aug 2021 02:16:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJydNDlPBfuxDki3Uz59u2PFRrBWfwYu0pZPI046cYzoMK9iXD8SbqhnFs3V7Xptdkb7wN4d X-Received: by 2002:a05:6e02:e0c:: with SMTP id a12mr385798ilk.179.1628241411448; Fri, 06 Aug 2021 02:16:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628241411; cv=none; d=google.com; s=arc-20160816; b=Gy2FFXfXPfYcj0GfGjLbXed6TSv6CsZpgQUtrGXej6pATxWQNjgnaZbwtNY0qX6pUZ O8SxpNIYpYBVRIC2wEzE+CKoHRw6D9ofSE9A/60qVth0qp5mglFI9IusJYLGUcD5IYzl RHf+fhk4BWmrq6PeY54usSuScRmGs9/ENJAzu/7+qtgtvUSLguO3h7moDArt4F095ID2 WvInRlCnTMQPhU3sn2uuAUqMRqb2I40YNGDqNQhXJ5C9bDH/rR8DKHDPfnZhvM6WLpZm iW+cpQ4GoQdLaM/g4U23jwyZyV6n8AB2B3yHGM2PWzRXx4oBHY2mgsrcUiW7wY0GlK2X 8QmA== 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=xe6A5wZPGBX+yc3tfy02kq5uYxx+OxRRYgjG1oOw290u4fyL1IZZLn7EoYrRobkNED pIj6COS/qbPUE0YmG48YQEm/a7XgKLAMzwwpdpc1qFoCnYtJ2d40Zolltx7nqlx5ilwa KFGTFQK77wrKJJSmUGIt+VtS7rLgZOI21t0bRGEcgR/XM92QeUT14ElTfUo8PTSEZ0DP TbptoNE+aYucYJwbpu57BHPiOuOx9mKockBAQJgWhfB0G5ZWMshRNkVczvJ/0+GmkQiW tr+W3I8nYZ8BBm15LkahAD5qrE7UioCLQDN1lKWWB91HreOBy62aXm9c7SMTMs5uTNMx /DJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CTsTQ5Cd; 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 h17si8426949jav.110.2021.08.06.02.16.51; Fri, 06 Aug 2021 02:16:51 -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=CTsTQ5Cd; 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 S244397AbhHFJRE (ORCPT + 12 others); Fri, 6 Aug 2021 05:17:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244284AbhHFJRE (ORCPT ); Fri, 6 Aug 2021 05:17:04 -0400 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94A4AC06179A for ; Fri, 6 Aug 2021 02:16:48 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id b13so10198454wrs.3 for ; Fri, 06 Aug 2021 02:16:48 -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=CTsTQ5CdR0fxHvvCIoS9tNDA0sUK84/WUyUlnqDsq8r5oi/5Lmtqvy6WOoe1PnqaTs SPpc51eVB3nsqE69kNwJq+4XOyLSiwF3cQhZwLZFYqTviCPGIU+zRiRdrJAl6ASz1Hpl 2s48XrQvUirUV+y0yhnA8yqPflmipPsr3DQRxk5dCtPLFqmujhLWoE4V7RETLpfVkTSH Vqqwc/Ftv8aH4tb9rZwo/X6V7lesM+XgO828GL28gOlfPMnq8yPuF7RFZlTFD9B/J3ts uB3gsZuipYzN+bDmHUBF5E8qdnkYwx7t7YmSp67ddwL3GhMkF6H9qXM5kpXJVzqEIUnq 9aIw== 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=CUZ0FsQptbcTmiGOQExIFBtNmct+UCtFSRZUY35o1c7Hx6pohXsaHauHHzQbdTKjzi RyCyxJEuz69tfS4Ton+25av65Y3eoxLfJX/BYS0rDAoiZkrz2UJQjPt8ZQziGHJOMn2F p3jxi6FJsDHJ3NC2SLsni/Yf0VK6OxR5tieOCdaFldXPk51gTV5oR0lQVf07s8ORyZyd Xzu27bo2tANqNKX8vGSpxouUIpbrqXYmhVlqT8OXCmHPzrs1ISOLQ9M9NY2yb63y9WNk S18zKgXJ9V3AdXIkaJebAbCKSPssnqUJEkqbvLRKddHg74dUIfBtQsGeDPFe+i4Dae1J MAHA== X-Gm-Message-State: AOAM531azbfivtOQ860T50aSC1N8JnYiI8mbLDQp59/4qawLsXWQ5DQl lcjdMoDyOldKxRM7dO+GRl0ZvA== X-Received: by 2002:a5d:4dc7:: with SMTP id f7mr9899726wru.118.1628241407222; Fri, 06 Aug 2021 02:16:47 -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 w3sm7811760wmi.44.2021.08.06.02.16.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Aug 2021 02:16:46 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Srinivas Kandagatla , stable@vger.kernel.org Subject: [PATCH 2/4] slimbus: messaging: check for valid transaction id Date: Fri, 6 Aug 2021 10:16:37 +0100 Message-Id: <20210806091639.532-3-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20210806091639.532-1-srinivas.kandagatla@linaro.org> References: <20210806091639.532-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 Fri Aug 6 09:16:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 492820 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp123257jap; Fri, 6 Aug 2021 02:16:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJydUw9mrtS0cpg83LQAAl1DR2o/AKdsu2SdUBiuLEuBOwzBUKsf7/tNeRrfPWjJbjo8td6v X-Received: by 2002:a92:dd88:: with SMTP id g8mr1937409iln.158.1628241416934; Fri, 06 Aug 2021 02:16:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628241416; cv=none; d=google.com; s=arc-20160816; b=T4cZXZ13OF1XS6Jz142NYq/O5YHQNuwAO4XU5g9owy9TZsJGN3ZfMRk780j8+yAyft nFnLGhKbpQ/Zze3B+cb91iPfFIJUdfK/GMz3IojYyqBZbjgL4iM0/0tATBVWr1BFJtrc 2ocrjU93HpNnT+vU61mR1vsRCJneZGOD6r1TsM4Rtwy8iAM8e4GLVMas/WDEHlJCduLJ 9dZtfvwzuUhP3wmEtdXcAnB7Usw9D8py0AIGvqoPtVpp+TirzKaggjxKGtypAmBWWgRf BYQQyN55pBycGB77gBSoMHAvz4gbdYRmnAJWmS4MX7wAoXKvdKPxA8nbiH3UtErj5ERG c+rw== 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=cmn5konnbr4dDb433/ZtvaQXIAEUUoUmhyhcRqEBmgj7Xbj38TDgl9OVmNY3Rxjwqx rgWslshel6k7piNODA2eiJVm+bzz+gCVZEhCC7a9BRSzIW22R49A0JCY7kfnbXXqF2O7 FhizIi/23qGHz4D1XArdmUYqUxyP73YMjicBj8gz/HxHVglXqQS0hBq25TzO8yjEm9HD jfKwJN0tdTW9ygImE0lkzWiZ0rL+iZhR9cLvZau/4LHxqi0XVAtQ2iwcXigzpatI4JI6 cfKfMGnHkRxHK8dkSLnQPWOoFeW2PR2vhlN4fniBYgs6PlPtSSa7phpwKKi6ooppV5AH 4EiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=C+M+wamI; 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 h17si8426949jav.110.2021.08.06.02.16.55; Fri, 06 Aug 2021 02:16:55 -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=C+M+wamI; 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 S244468AbhHFJRK (ORCPT + 12 others); Fri, 6 Aug 2021 05:17:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244402AbhHFJRF (ORCPT ); Fri, 6 Aug 2021 05:17:05 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 703ACC06179A for ; Fri, 6 Aug 2021 02:16:49 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id b13so10198520wrs.3 for ; Fri, 06 Aug 2021 02:16:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MMllCfmYFnjcwZk6yJ9SVZujM0OJeGztI30MGIz0Avw=; b=C+M+wamIDYBLchdf5EIbEUE8eIQaJfS6Ld5016M5g/s/yPTVB3y5mDTqOxxcK9eP0L z3z/DR9Ch2hZP9i1WpJel5qKzCUcFndM/FWQY0mIuRgCw/7S8y5FkcSa1hCvKVchrFDY 6aBHrEjtzc87Kgm6jEgYTJsfbQrKPs0gUup76RHeNhmpkynWKUEsFfuK66D95OvCxHof Nhi/ofrwV0XlWJyIB24+ounrK8+1sR2HyZFH8+cL4I4js9xTyzFJoHjEDUoaDq7F5OUd N/t8fLofeAZbTOVciTk16cd5sjxII1ZiosngcYeqDGnFXcQpPBwC4z2pAxOROfvld0oT lKYA== 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=ocW3fUwPIpEhnInwIlzoHhu4I2BhgC7R25vvDsZn0Py5cI8p8n4Pr0kQBLSLIW7hmh s/2dd48nuHefDwqrGtVg0h1BhrdpEO5kdNDSiDWNpx0EqxwHF5KeShUSWIG4mmj9AbB2 g+J9ZhiRhqMiimEcW3wjivwtGnLrHrNXs+4LzrO+aN+/oY5zG46uQGhfz2MpVaNrvv7P gHJrHafU1z1G14oa9/o1bdXJ6qTrV7vnAVAZPdc0jZXHTL7FOX42hTTSGvuZ2gHuvu+n fViHzodY0ows0N1qzqdMxdgddBtOijLvC2qLQQCU/RVIH5RuT7Hfth97YhT136Ts+quc fr9Q== X-Gm-Message-State: AOAM532135hbrJCFXkn+34ocjbBaqOv3+dveURXSHXvSTdand0Bnx9tX AJNTgpuMH7awmLEZFrTWGJwJaw== X-Received: by 2002:a5d:6b8f:: with SMTP id n15mr9496103wrx.103.1628241408108; Fri, 06 Aug 2021 02:16:48 -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 w3sm7811760wmi.44.2021.08.06.02.16.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Aug 2021 02:16:47 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Srinivas Kandagatla , stable@vger.kernel.org Subject: [PATCH 3/4] slimbus: ngd: set correct device for pm Date: Fri, 6 Aug 2021 10:16:38 +0100 Message-Id: <20210806091639.532-4-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20210806091639.532-1-srinivas.kandagatla@linaro.org> References: <20210806091639.532-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 Fri Aug 6 09:16:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 492821 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp123271jap; Fri, 6 Aug 2021 02:16:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw1L3S314ub11jUgzVL+6TP3b0dJe3Zyn5/SOwIPrIe7/MaQpP63AKFaoViiIXl5HoKGvOO X-Received: by 2002:a5d:8e11:: with SMTP id e17mr5263iod.138.1628241417834; Fri, 06 Aug 2021 02:16:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628241417; cv=none; d=google.com; s=arc-20160816; b=NDxxOrm8IYLHeZ+MVLd0JqSdYCOYuEepn9hIl854wHNFv88I9o4JBHyGgU8c0aNlU9 +68iffyeyJnhH1l26vnSPObvUiR+mmqTYpXZIOf2RLSlzGjvgsaLHTgA9DCXuXhnFCWT DunJ1P/nBNSoEY1ek9FDhgaUJvHjriqPpDwfaihVXxjjVIKaoeUHFAx4ORMfzLmFak4d cJwZEQSInO7bZvBcQ4cSl5V6ehlIg20knZcZmBaOpIk5UMAfqPOKk8wGn1kZw1tFI8cO yZNz1Zd1g7aliw/2dTUhtU6JE+u5ucdoeiskfh8flCs52FzY6r3S9Uf7KT3QdXSYxwE8 ovXg== 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=RkDrw62gmktGJ8T0sZH1ZMmzuGwGKSVJK0hF34w/urKU/M3tWU45OR+uYLb3LwSpC2 cuC6eb0n9LNUx9RsPG+BCNIqHdck5L6436pSZXjd3zulBR8dbE1mPcmDh7S+nTUjjy9k FRGEYIF8fo2qZDfLBGWJ9RTHpCVBmepuCZNIjcxu/OdSk805r8cqcQyToREEfnCGgsk0 of0khWQZ7HpI8fpCPiYy2jCGMnn+GPnIsBh31a+O816BGnidbe+/0lKXUEwDGGwgHgPS KtalG58gZKyTA0v0L+6j5Z6sebHDAUkxAZHZFMqXvLfv3cS92RmJ+Y8tGL7BHAeFQuxF dgug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hwATRVzG; 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 h17si8426949jav.110.2021.08.06.02.16.57; Fri, 06 Aug 2021 02:16:57 -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=hwATRVzG; 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 S244411AbhHFJRK (ORCPT + 12 others); Fri, 6 Aug 2021 05:17:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244432AbhHFJRG (ORCPT ); Fri, 6 Aug 2021 05:17:06 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6101FC061799 for ; Fri, 6 Aug 2021 02:16:50 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id d8so10188275wrm.4 for ; Fri, 06 Aug 2021 02:16:50 -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=hwATRVzGY1MjEK9PKMjeKcQc8kTgnMbjTwOt54o80ZKcWiuvv7ji8lT4fr1+5FCbLB LALOGZyytElaOH589hrZKAf3ty5yd4TzFn+FiMrtk81opkB1GU5Z4YqHOZmMcMOsMRqL 2O0B7sq6Wc+bLmhtBExf/XhSdwd4xEZvSMEriiiXTheeomulez9olz/O8F6pjR3JxnuB W2LsyDk2rPIm57peb9aELWMawJCKxQbLcRXmpCw11SAddMmgP13mKv/5O6b7o81elxRa j8TmEAyOoNIPnVnDSnQbSCHaYrVgtX7MDpwMn01ifOaG7tpJAsO+HYqH+G4fV6my987Z uG6A== 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=kDWOrCZhY5zx2wWvwisC0IyGEL4BpIF7NXNO4Y2OyliPT1++vatMnpaxwkMF3u3DfX fbsi3+f9QpWtwCdoZVM+quISpgMHvioljPYhZfMQGhQ6Gzq8Jy908sBERdMY8fhBlWoI NpX79aCseHCt3an4McqUNdyJwgzqcC0zA7ZwFwKnJFEKQlWTwuj5kXSSMPmpw2zZuNBk uu1QV3gJr/xNivwhtjT4kY9nI23AiirahMbTz5KwRovruXc8m68Pm8PL1Qosk6k6Vqo/ oY7UfMNvrDiLjxXzMrXCsceLhRNTX0EvpT5+ymntl+soq6qkXVLXrrViswtauHYLz0ZO soqg== X-Gm-Message-State: AOAM532RAihXcAajJOFo0ntVB4iYlg87ngpbwevHUKynrFauaKJtmQVW gZD1kvEYvzJ5mr5VoE3B1w4Mrd0H93+Ssg== X-Received: by 2002:a5d:6891:: with SMTP id h17mr9284173wru.324.1628241409049; Fri, 06 Aug 2021 02:16:49 -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 w3sm7811760wmi.44.2021.08.06.02.16.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Aug 2021 02:16:48 -0700 (PDT) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Srinivas Kandagatla , stable@vger.kernel.org Subject: [PATCH 4/4] slimbus: ngd: reset dma setup during runtime pm Date: Fri, 6 Aug 2021 10:16:39 +0100 Message-Id: <20210806091639.532-5-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20210806091639.532-1-srinivas.kandagatla@linaro.org> References: <20210806091639.532-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;