From patchwork Fri Jul 16 10:21:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 479296 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 493B0C12002 for ; Fri, 16 Jul 2021 10:24:26 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 36B5E613F6 for ; Fri, 16 Jul 2021 10:24:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 36B5E613F6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id AC085167E; Fri, 16 Jul 2021 12:23:31 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz AC085167E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1626431061; bh=yM3a8dQxSPHCAFE6FjkNkxyi3MxoRGJVXEcHD22Fnj0=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=AsjI5/LNKFn5wyqvTAbnpJ50dvh7XYxnwBTLlGD8MkzhnWf1kV251Gn3GHo7QB2bT fv+CEUa6i/qaB3OPfdRYL/N5Awd6wBGZ8YTbBUh6a9JQDWCcRANn3dWN9oPAtgzVRo S0Fye0wg4yKEsTIIfCZ9ruUtwJLh4rOVVDGRtXZI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 272C7F8025B; Fri, 16 Jul 2021 12:22:45 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9CDD1F80424; Fri, 16 Jul 2021 12:22:43 +0200 (CEST) Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 6FF89F800FB for ; Fri, 16 Jul 2021 12:22:37 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 6FF89F800FB Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="MOrqkMTR" Received: by mail-wm1-x32c.google.com with SMTP id l18-20020a1ced120000b029014c1adff1edso7860645wmh.4 for ; Fri, 16 Jul 2021 03:22:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+agN8Y7YKzZWGYmosJCMKjDZQDR4OYf00Q82/uMWOlg=; b=MOrqkMTRaghA4zePX8fRMewT5cG3NtLKJzS7iORpeQbcGZqwTYyZCtkxuk2rmNk0Ud djO3kn4BW1OIclMYeYfeHmGGbHvAV3vxxRIQFWFGQI3+6qfgDH/6vzD8WIn2ZgPZ2YGG 7VCJ/kdpZhu1Fs9zeX1ssJZEYGjYnz04CfnR2KJDmNiSL02A5ncCqCaeFAPYAK4Vj8r5 0EHWwTzmSJT/LXy096e6SydUisLTV6va0I8EBMhJoszJKXvhTDpagssqecy9J/QWpZiZ t9hi8nEZDokN4SbyG1sbLgskvyuzQCoXUcEr0qgmPoIaAUfuWmfLQM0GZTEhy4XB/UJM Fcgg== 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=+agN8Y7YKzZWGYmosJCMKjDZQDR4OYf00Q82/uMWOlg=; b=ZHdLeB2B8JpNUs9UAX263x4Nr5DCloaUL03OpmY0bCDWU4kaNoIteAURrx1g2mYUxX 8q+G9tJvs6jvDI9R6uxX/Zz1BhUShnyIJwPgz0fGHOLKAxvxAY+pYxcXfq6mrACKk+5o upLLjRMLWqmCmP30c5ihsYhkIfMyPqG4aXSuF3ImKdoWWxvx4HnqtdfRuI55okldgm7r 6ADT//bbrLo7twmkYiQ5Af3dcyoToW+KuXA7IAYuzneL36QxNDhm3sqTfpMtTXzaJtEU Bdysvq9onSCdlcrlv5kd4XBTpdFtW6bAVCysm4v+GrM81VIKbNQsQsd9I7xCj4P+Gdr7 O8+g== X-Gm-Message-State: AOAM530HgLw9ctxQWd9Iwv3qqMIAn6Jx7YEdsVMz0jtOG1x/NCXUCeJW wpp+zxVJ4rk3ilaM0aY6oTs/7g== X-Google-Smtp-Source: ABdhPJwNc+AyvJtfQ9kkcmoxhYtdC+xXLCIe0+rEhwDGj7Jiug7pX6oKrAKZ8OzjWmM5DCK45wh0CQ== X-Received: by 2002:a7b:c1cd:: with SMTP id a13mr15467463wmj.75.1626430956488; Fri, 16 Jul 2021 03:22:36 -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 g15sm7421796wmh.44.2021.07.16.03.22.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Jul 2021 03:22:36 -0700 (PDT) From: Srinivas Kandagatla To: srini@kernel.org Subject: [PATCH 1/4] slimbus: messaging: start transaction ids from 1 instead of zero Date: Fri, 16 Jul 2021 11:21:20 +0100 Message-Id: <20210716102123.26861-2-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20210716102123.26861-1-srinivas.kandagatla@linaro.org> References: <20210716102123.26861-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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()") Signed-off-by: Srinivas Kandagatla --- drivers/slimbus/messaging.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 Jul 16 10:21:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 478409 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8D27C12002 for ; Fri, 16 Jul 2021 10:24:30 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 38F25613EB for ; Fri, 16 Jul 2021 10:24:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 38F25613EB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 82446167A; Fri, 16 Jul 2021 12:23:36 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 82446167A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1626431066; bh=pKXBkdbUeVSarutX28w7pKmDiH9qplJt0HAHjvlym/w=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=D0ewhpRbWNT2yk3ktRiLCUiuxHd5sAijQwKxMW9+mnDtDR34ye9aW0Ht4asWecZYR YtxnQYK1TnhfeO2gLRVbE5v2ZKTELlIfjNSSM0nv1taAuT2dnwBX5GC1Rmh8LQ311K Sdq69kwh5QXH/Bm0FxGSy3uRss1pI9gtAMiY6Sn0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 97E73F804DF; Fri, 16 Jul 2021 12:22:47 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 47A48F802E7; Fri, 16 Jul 2021 12:22:44 +0200 (CEST) Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 3A37EF8013C for ; Fri, 16 Jul 2021 12:22:38 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 3A37EF8013C Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="F0ZYk8ZG" Received: by mail-wr1-x42b.google.com with SMTP id v5so11503778wrt.3 for ; Fri, 16 Jul 2021 03:22:38 -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=LjxLxmgZBDZkyIZTSdcwCO6eZCtubh4Qr/3hT9cegm0=; b=F0ZYk8ZGiCL5U+lH8QEtTnltPQiNIQnjz0z/c579UaUs+5wyoSP6EgvAQFOmjGinFe NAXuffXbmgEmrG89uz7iJd/A6IUZQQHGRq6pSrqW8h/pKNcIPs8nLZZxLSCnYkvPNt35 GZqU7gm+Bm21IJqEBxlN8/7VXSSYakxIsr7/ekfMikyCi0juwf7+zjP87eLzK+OZPVv/ CSC2iaeL/cSlC8OuBtprye/h6zYLEtSCnZyHenOf2yVccW6f5bStJe9tfQOfaoonhZgS zZxTqchQttzbX2LSxeJTv0S+riT0tMdFcjBXEHYW7cjJc9o1sNymDKhQtoxviN4PO0RP Cx6Q== 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=LjxLxmgZBDZkyIZTSdcwCO6eZCtubh4Qr/3hT9cegm0=; b=IsATi12I3f/EdENNphND+zzHBpPOOQN/YRv5g9RA/jQXzsZ0l64+laQ3yNwHgSpaQR X9w7f3+AKkCqnxVf1GSJBel/mdWK7ehrjJQklE6HYzitrJ8/G0/9USApWLTkvkTM+ET6 kB2ueUsxHWNcqZLgidHHHYdoXJit6XDKDbjeFHq+/Mvl0//d7/Vvkpe+rqQTO99cZu9m aD0CgVCkLtvQBFENAKW4wkzWKn4W4gZLj7bqDlasVF8GFJuZC3tt3AeeKB+yO9vH/dZF ShmcOrGMaX7LLgkoOcDfSS9ne3yrPp8Kr60/5E38z9WhVbLB7bocLllCFYQ4pCBSSBYM 2sgg== X-Gm-Message-State: AOAM5310VgOAUnqp6PENowPvFjQ0XXTu1Q88+aRxFFR/OfVPaq3orQ3l 1tkkA1V+zEXU5WVaHmJMnSbWEQ== X-Google-Smtp-Source: ABdhPJw/ypVuRpbiqTH/2yAp3WpRaCk+U4+ybol9ZhHDa803+5l610ecL9x5ZvNZgj0CtbSXVePB4A== X-Received: by 2002:a5d:4b42:: with SMTP id w2mr11210193wrs.47.1626430957487; Fri, 16 Jul 2021 03:22:37 -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 g15sm7421796wmh.44.2021.07.16.03.22.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Jul 2021 03:22:37 -0700 (PDT) From: Srinivas Kandagatla To: srini@kernel.org Subject: [PATCH 2/4] slimbus: messaging: check for valid transaction id Date: Fri, 16 Jul 2021 11:21:21 +0100 Message-Id: <20210716102123.26861-3-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20210716102123.26861-1-srinivas.kandagatla@linaro.org> References: <20210716102123.26861-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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()") Signed-off-by: Srinivas Kandagatla --- drivers/slimbus/messaging.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 Jul 16 10:21:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 479295 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85C3BC07E95 for ; Fri, 16 Jul 2021 10:25:04 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 958DB613EB for ; Fri, 16 Jul 2021 10:25:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 958DB613EB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 18A44169B; Fri, 16 Jul 2021 12:24:12 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 18A44169B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1626431102; bh=M8OCnyw2vkf8WdKQTzUIX6K9NX7wGgYzbCqnAQX+1AQ=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=hy144/TwaI7YplFTQJtescGFVWSF+FsqpJnaYRJ1d46EyCFlUoOsFDX/3c7H4/Qwx 3uJb1/lzMUd/6NGE6BQVdbNU8MU/+9lK1MAILF/JaIAo3GFN3WtAa1bSnUPgEjbX5N kEq6zqTuFVLKlnH50aeVH6jowJPaJQrey7rx9OR0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 47260F804E0; Fri, 16 Jul 2021 12:22:48 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 16429F80424; Fri, 16 Jul 2021 12:22:46 +0200 (CEST) Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 28A32F80254 for ; Fri, 16 Jul 2021 12:22:38 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 28A32F80254 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="xSyYife0" Received: by mail-wr1-x42c.google.com with SMTP id f9so11451169wrq.11 for ; Fri, 16 Jul 2021 03:22:38 -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=RH8cJpfI22EW3WzQFW97y0L55bfdGZoYafA5iYEI+Gs=; b=xSyYife0tK8Wfn1AeIqVivedOLa58eDWnp2XZ/NO8MbdLNwDv2h5WY/icWPtYUorEv THnhvCJFfY7DbION+eaZnVdlFIo738ELu3z8hK8jH9RXCWUgYR+QwdMIBb8qsBjl3AID dYx6WsO6/rcNYAtbvNOFWhUB4TLof2I2fLpplYd6Z2pMjhgEBipZ1gVN6l435fPoOyTy OfLIyNn28MNMJJOT343A8thpGAzWkTSshp8RvfD3OK+6la4NtmUSs9JbNjDY9uBlRcqo wowE1Y6vWw9i+wu7Iohh1HamHfw3xUnGcc6srf/d+35Zhht1z42oazBl3f3f3voecOar Vbqg== 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=RH8cJpfI22EW3WzQFW97y0L55bfdGZoYafA5iYEI+Gs=; b=Qd/7BLxCdMc7Bpp+qtcLbhJjXvl4MIP8BLkChBlAKT5NiMkFKLl3JJAqISwuqecfjB FuV5ifsRIxQyGXUKaHgXJ878QV2i3pby1hjODaB/EVNbL+dzMajXYdzB0kbe+RkwhzT4 UOd2fBdsCOpzhNRj7SBNogZSw7wY2JRBgmtOFl7xND5uJsyQf+KvYy6zLIQZ/IFVr5Pg 41kwKCsJ3+GBRIpmziIwZ+YO0NymNhQ1+jWI0dc/Za9XP3Kun6oSzmDYQ4ZJxUmljiW+ NaYqua9AzT3K7PgXWX8vAmKi8FfCjR366AIW6QaDvR/dHwIUWYWDWrboajCvmOGaKyLP g46Q== X-Gm-Message-State: AOAM530f6XJd3MmQuCKsjqwqzJ/GtXP3711JuKKKMdg5m2mmjc8GfzT5 nPWSto96Jv/gFIhB3mb/S4PFOg== X-Google-Smtp-Source: ABdhPJxkdjbtScSNsWZzVR5VWqcv2L/5BW51zAQpb8zHod1cXpcF3Ss+cnsGhFs2Bqw+BOUK9cyoNA== X-Received: by 2002:adf:e107:: with SMTP id t7mr11391576wrz.165.1626430958309; Fri, 16 Jul 2021 03:22:38 -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 g15sm7421796wmh.44.2021.07.16.03.22.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Jul 2021 03:22:37 -0700 (PDT) From: Srinivas Kandagatla To: srini@kernel.org Subject: [PATCH 3/4] slimbus: ngd: set correct device for pm Date: Fri, 16 Jul 2021 11:21:22 +0100 Message-Id: <20210716102123.26861-4-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20210716102123.26861-1-srinivas.kandagatla@linaro.org> References: <20210716102123.26861-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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") Signed-off-by: Srinivas Kandagatla --- drivers/slimbus/qcom-ngd-ctrl.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) 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 Jul 16 10:21:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 478408 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B9E8C07E95 for ; Fri, 16 Jul 2021 10:25:17 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 342D4613EB for ; Fri, 16 Jul 2021 10:25:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 342D4613EB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id B8FEF169E; Fri, 16 Jul 2021 12:24:24 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz B8FEF169E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1626431114; bh=jFYjOkx/i7sWLMhI9VYqYgK0iSETaXPo7ZQNnOt5kig=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=o6ocZrvBZzTQWlJrLm0Xop6hZf0R4qpnwvcQvkoXoOoYgheAbu/8M/uvrh23Oh42S Th68SyvC7eQ+aez+kIhgJQzF8sQLyl32m8vkQURhlHzuhj/M3xHsS7FwAtEvJ+5LJx 06AfqJNBVGWSQ45xbiFUr4w85dXdu912ccQWpKfU= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id E6828F804E6; Fri, 16 Jul 2021 12:22:49 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8533CF804E6; Fri, 16 Jul 2021 12:22:48 +0200 (CEST) Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id ADB8CF8026D for ; Fri, 16 Jul 2021 12:22:39 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz ADB8CF8026D Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="RtMIQpqg" Received: by mail-wr1-x42b.google.com with SMTP id u1so11527272wrs.1 for ; Fri, 16 Jul 2021 03:22:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=phsqVDKt7cS5gPFlQtF9euIsqh6Lyd2uhcBMlgfbuug=; b=RtMIQpqgVXDnA7mNNctHnw56XAzb+jtElYAMhxhCoKj31wcOD2of9eOV5AF5H2iw0t 5PnhV/EhLW5DTYV9G8tA46UxrsZpjxQ7MZvbzbR3U5fi+VhV3FDD3D9qLDuzkDzKnyig 4TJwJp2TVuO7zP/kEEd2ZSYh1rDmw+MK6ji2Onh96ti5KlcyVCNkHVH282Vd9393OIt+ ROyoCwrwwx5pwJjHKJzAHgLsQtldUdSDOZ8qDUJ/qXUy22iNNjbuyMrt1q/sOwwumgj6 cIrObp9ZMrjQJs4OJTLiAfmvR9TF8B2++M4n6VvldrpIKKZR5QuX1Dj3gkJbQvJQHu/y AlSQ== 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=phsqVDKt7cS5gPFlQtF9euIsqh6Lyd2uhcBMlgfbuug=; b=mSbpZfrEUfWJvFGzkM/4NRIfAPxpMyr4vQwgn0Y6ztODP6SQpgStLZj+rIAcPj7/fA hgTHx8b5dGbtZKG6ylmMbGVzYM4Gxj9+XC3ot4UyV1pOaJFnP1yMn+bVz6/uZwjovJoL YcMkPmUzb8KUO248KZfs8UM1pzFxYcLyxwmV6DenhFOXAB6f79i8/Rai1rHqQ6+KzQEa UEZBUiAMoUDuyVrmA0bs8EpjfQjlR70XO4n+lF4b6CyVxBPY3QBiGBHRf/CB25SnAkr4 uvJp+id1x090JJlso1Z3XBgaHfggN3uxYMHMAy9p0Fx6cnTrGlEXcjLZiDnWHsWTRSuM 1GUw== X-Gm-Message-State: AOAM530VUWkxS3MnM15P1CIWYoAukAXuC/Ab9XCqUiE85dqlYMml4hVr PQ8dPMhVFwpCLS/mNOQvM7YZqg== X-Google-Smtp-Source: ABdhPJxjZzopWWGCvCIFeBejgXYqA5vngsb3D5YCPozsZs+/7/AGqcMT6p2CiHWlc5BZ8MP4jg8kVw== X-Received: by 2002:adf:fc85:: with SMTP id g5mr11523289wrr.296.1626430959130; Fri, 16 Jul 2021 03:22:39 -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 g15sm7421796wmh.44.2021.07.16.03.22.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Jul 2021 03:22:38 -0700 (PDT) From: Srinivas Kandagatla To: srini@kernel.org Subject: [PATCH 4/4] slimbus: ngd: reset dma setup during runtime pm Date: Fri, 16 Jul 2021 11:21:23 +0100 Message-Id: <20210716102123.26861-5-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20210716102123.26861-1-srinivas.kandagatla@linaro.org> References: <20210716102123.26861-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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") Signed-off-by: Srinivas Kandagatla --- drivers/slimbus/qcom-ngd-ctrl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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;