From patchwork Wed Sep 9 00:21:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 249395 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp5015031ilg; Tue, 8 Sep 2020 17:22:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw71/ChBfHxVjnmrVino0ohfHm7zhemRA0mhfSibWAv6jY0wUKa5k1GqRlZHmDfEiAqFRLa X-Received: by 2002:aa7:d606:: with SMTP id c6mr1602701edr.370.1599610926795; Tue, 08 Sep 2020 17:22:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599610926; cv=none; d=google.com; s=arc-20160816; b=IdHbATxfH9tCkHfquk+8eaaclL41Eeq0tKG5cAPJ6ZOJkaxTtPha4w/QPSNAMRpI5H ngSL4vDsiFKw/1UxAXhdO4vvwwN2UHRKy2CY+KgfUwY8njPi+dkjnYzMoEBdVDN1AeX+ uv6quU+cYV26P8D9HJjL52yGJoXmsTq+tVB2ORvLvAbTSBlo+ec2zPXuC/M+if9oI28u Adh6jDfTZ5Imgk/n9CHgbu/sMnrq4yoCDnnGLOJP+wj3dQaycyObPga7FQSD/D4lWX3Z a+2OSuDpUNv+jdKL9yVtaQHF6VsRfXUdF72Q4r735lyszwc3xuKTxzJHA952aJi+WhNe ecVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=4AO2162Bte/ulZ9CvnofKmBqr4RKglDOxVaujf63iCE=; b=K4j8xOkzk34tkUUCpb1KaCeKUAHbBmt/iVA6aHO2LRrkS5Dq2yGXbBgUE53VZ+KYw0 /YZymSWUZVWYove+FPk/Z/kvHN6dctY4Bu6yTlBwVAPFhHWJbpFOXkeUYD64XPOepMiK iB3fe7eqU2WgoIcwQXAFQ2sxbg5/hEeZxPS5YHRWT2HqAfI1/wBcFvd1d64fufFrdmGO ouc+WSq9fafVO3EQSh3t+4Wc3tyrT5XDDiXtk8Io6Rc/xWWkHgI0NyzA74ifOm6zdsVS YwmHpy26R3i/fOuOOdrS85A4y/2ozyYIAaxH2S8sfYIWnCj9PbqkKl03TYmWADmWJBgT ANYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=a1TuTK4M; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-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 l18si390477ejr.492.2020.09.08.17.22.06; Tue, 08 Sep 2020 17:22:06 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-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=a1TuTK4M; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-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 S1729622AbgIIAVy (ORCPT + 9 others); Tue, 8 Sep 2020 20:21:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727940AbgIIAVe (ORCPT ); Tue, 8 Sep 2020 20:21:34 -0400 Received: from mail-il1-x142.google.com (mail-il1-x142.google.com [IPv6:2607:f8b0:4864:20::142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4391C061756 for ; Tue, 8 Sep 2020 17:21:33 -0700 (PDT) Received: by mail-il1-x142.google.com with SMTP id y2so673403ilp.7 for ; Tue, 08 Sep 2020 17:21:33 -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=4AO2162Bte/ulZ9CvnofKmBqr4RKglDOxVaujf63iCE=; b=a1TuTK4MtJFjMI99KomH5XteYCTQYRkUTzIPMFhkGS3RBppusrMHJ1452iq2Akobdl mOT92hlud7Ezx19XbZ+Q+T9GD2D2QAwRSz5xDLCmueKASaMZy7Fb3pua5Yny9LJpyjay qt6AwEKqxOBcn/baHxGgfksCzuBagajdJD1ykKc5VUALsLpxNjjBwTKC0CHdWkdMD2qx nx20wh0CxVzBoW0f1K06wYNTOXdnEuNVA37OuJfS/CoWDbhAuF5OxGSlSQkGrrrpFy9O K4pJ6ejXwWaKa6UJegzqfqzGQDyIBFMGd9oYYDfdw1U7fttRIVZLGTzWtP1kF68lcN/j ukIQ== 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=4AO2162Bte/ulZ9CvnofKmBqr4RKglDOxVaujf63iCE=; b=t/EkyhclHaMKaR+vM0UiEbMq6kpIaf3Q3yhZfmxlSlP15FzcNvRp5EdVgE88zn/Rdh feG7XIFBAuvCZS2lkn50BhlCcXb1CqVmWRFBq8xy9NAn5BiYiABF7mHgQj1elESkTOb/ 4zos+LzNZEUVHkJ8stOjPXZ3eMqv14pEjC09IkSUlNnyMBSuXT9m3FEMQustvJiUsPnw 2PkKdif36Sk/Acq+fO9uVNYTxR+7mN4wRl6kffnlBEmKwpI84JwJiz3lOUs1WBROIdKV eSGjnWk4uho0d4ipjcro3JLgiW91WMFAOHSvyNiffE/L+hyuRo1F96JzUnIx/RCy/19Z rNNA== X-Gm-Message-State: AOAM532zXMIVjasdVhDyDMOE+wouMVS5araEMPQ+4MVH6xDBF6BEPCX6 QQVMGuMgJORYcQ0HduDd936RSQ== X-Received: by 2002:a92:9604:: with SMTP id g4mr1495062ilh.6.1599610893171; Tue, 08 Sep 2020 17:21:33 -0700 (PDT) Received: from beast.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id f21sm457739ioh.1.2020.09.08.17.21.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2020 17:21:32 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: evgreen@chromium.org, subashab@codeaurora.org, cpratapa@codeaurora.org, bjorn.andersson@linaro.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 1/5] net: ipa: use atomic exchange for suspend reference Date: Tue, 8 Sep 2020 19:21:23 -0500 Message-Id: <20200909002127.21089-2-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200909002127.21089-1-elder@linaro.org> References: <20200909002127.21089-1-elder@linaro.org> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org We take a single IPA clock reference to keep the clock running until we get a system suspend operation. When a system suspend request arrives, we drop that reference, and if that's the last reference (likely) we'll proceed with suspending endpoints and disabling the IPA core clock and interconnects. In most places we simply set the reference count to 0 or 1 atomically. Instead--primarily to catch coding errors--use an atomic exchange to update the reference count value, and report an error in the event the previous value was unexpected. In a few cases it's not hard to see that the error message should never be reported. Report them anyway, but add some excitement to the message by ending it with an exclamation point. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_main.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) -- 2.20.1 diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c index 1fdfec41e4421..6b843fc989122 100644 --- a/drivers/net/ipa/ipa_main.c +++ b/drivers/net/ipa/ipa_main.c @@ -83,6 +83,7 @@ static void ipa_suspend_handler(struct ipa *ipa, enum ipa_irq_id irq_id) /* Take a a single clock reference to prevent suspend. All * endpoints will be resumed as a result. This reference will * be dropped when we get a power management suspend request. + * The first call activates the clock; ignore any others. */ if (!atomic_xchg(&ipa->suspend_ref, 1)) ipa_clock_get(ipa); @@ -502,13 +503,15 @@ static void ipa_resource_deconfig(struct ipa *ipa) */ static int ipa_config(struct ipa *ipa, const struct ipa_data *data) { + struct device *dev = &ipa->pdev->dev; int ret; /* Get a clock reference to allow initialization. This reference * is held after initialization completes, and won't get dropped * unless/until a system suspend request arrives. */ - atomic_set(&ipa->suspend_ref, 1); + if (atomic_xchg(&ipa->suspend_ref, 1)) + dev_err(dev, "suspend clock reference already taken!\n"); ipa_clock_get(ipa); ipa_hardware_config(ipa); @@ -544,7 +547,8 @@ static int ipa_config(struct ipa *ipa, const struct ipa_data *data) err_hardware_deconfig: ipa_hardware_deconfig(ipa); ipa_clock_put(ipa); - atomic_set(&ipa->suspend_ref, 0); + if (!atomic_xchg(&ipa->suspend_ref, 0)) + dev_err(dev, "suspend clock reference already dropped!\n"); return ret; } @@ -562,7 +566,8 @@ static void ipa_deconfig(struct ipa *ipa) ipa_endpoint_deconfig(ipa); ipa_hardware_deconfig(ipa); ipa_clock_put(ipa); - atomic_set(&ipa->suspend_ref, 0); + if (!atomic_xchg(&ipa->suspend_ref, 0)) + dev_err(&ipa->pdev->dev, "no suspend clock reference\n"); } static int ipa_firmware_load(struct device *dev) @@ -913,7 +918,8 @@ static int ipa_suspend(struct device *dev) struct ipa *ipa = dev_get_drvdata(dev); ipa_clock_put(ipa); - atomic_set(&ipa->suspend_ref, 0); + if (!atomic_xchg(&ipa->suspend_ref, 0)) + dev_err(dev, "suspend: missing suspend clock reference\n"); return 0; } @@ -933,7 +939,8 @@ static int ipa_resume(struct device *dev) /* This clock reference will keep the IPA out of suspend * until we get a power management suspend request. */ - atomic_set(&ipa->suspend_ref, 1); + if (atomic_xchg(&ipa->suspend_ref, 1)) + dev_err(dev, "resume: duplicate suspend clock reference\n"); ipa_clock_get(ipa); return 0; From patchwork Wed Sep 9 00:21:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 249401 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp5015287ilg; Tue, 8 Sep 2020 17:22:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzsCsbdhoC/IoEbtMkX3fV4GfIH1o0LEcdCnO8hxThfZiYolFzzC12/zyt+WYdqnUnSSTYS X-Received: by 2002:a05:6402:1710:: with SMTP id y16mr1618566edu.197.1599610960454; Tue, 08 Sep 2020 17:22:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599610960; cv=none; d=google.com; s=arc-20160816; b=tQR6KHsYBjzkJt39dHE3Xd5+KbxW9DEIARrG5QEfnmgvpmUk2WyiF4Op+XNGJAys4p egtq0XpQE/uofnIsCzRFX6m/taElpw5uDSeO4TQXPkxdFyX78gVcP04LMvxb/1FYa1oy MPq1Tan7LGx1aMdZub0wvXNCXBw95sqd98UM8c48ijtnqlXuBy+lpWeQ9Izhm/obvgwA duadsn4yPgjajIHRYsRg3xft1L+pYUxLFCRA0UwSk5XW2IhqKY8qFJG5AIWYElNbJrwY 6aAOv/R6QRwaLnS3Kl2cvJSpKVfGlq869xyAKNb/IUtsOZkyG+tGI3T60FiHlbDbhsRp tj/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=CLkAtO8yV6hC5XQeCIKds/Y/O7Y4arloVOta9bNoDaY=; b=xq1onc8VtzcWsAjh2Sf34PQtnVbnqe5+57oED26+01awdORVhsIPXljV9Rl6DsNbq6 kn+lkttsIKJHuk0IH/BvTYKgxm7pPHPAL541bGItHJtWMP6lIIMoOVZmIZ3D0rmhj0c/ Pmb4yGFESKgirE0bc1JCmCNzwi29Id3ZjAN6iNqa0UHpIuItBxHck+ZEQDSUDLRXmW84 YYav5jcfDY8m5b+7HgCfyXfdww9fObl4StTjPpnTiZyuC8THB5SBR3vgtREY4ClTTfOu OiDVAS/PurMHs6c/t/IQh/RQXKpgscmkg+nhL8/Q4N6eaaTJmWGbtM2RryI8elR7iIqM 57cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hq5DELpR; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-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 t16si419828ejt.27.2020.09.08.17.22.40; Tue, 08 Sep 2020 17:22:40 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-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=hq5DELpR; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-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 S1729993AbgIIAWh (ORCPT + 9 others); Tue, 8 Sep 2020 20:22:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728633AbgIIAVl (ORCPT ); Tue, 8 Sep 2020 20:21:41 -0400 Received: from mail-io1-xd42.google.com (mail-io1-xd42.google.com [IPv6:2607:f8b0:4864:20::d42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF63EC061786 for ; Tue, 8 Sep 2020 17:21:34 -0700 (PDT) Received: by mail-io1-xd42.google.com with SMTP id u126so1286015iod.12 for ; Tue, 08 Sep 2020 17:21:34 -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=CLkAtO8yV6hC5XQeCIKds/Y/O7Y4arloVOta9bNoDaY=; b=hq5DELpR+vU0Y9o5e2HUj0mATndL/qH/lvWoOo5vpdPAnLmfDyqNVW2XmT94onsQsr qsowN6z3HwhMa7tuAn8DwOQrm6Va35JvqXV2sda28FRc5mgRitvOeT2mN3Ane0hyyDbU WYrH9+XjpJoYQz6usO7IoYk33gAKTd8gGyjs5nC9rd7DQk67XFE+YfhvlwrOzJJaf83w jqsDM1wexcB9D9Pc1af4smM3lwmMrlpX00yLkLx5ky2Q7GJRcpEDoZJ7+Ax5AZrPGVJZ hlgEBHyUZMu0dGFEZ5sa2cJ+/fb8ifo+9EtvXPcHkwQ4eFTqslM3Yt3+exuWte+6VHRt QulQ== 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=CLkAtO8yV6hC5XQeCIKds/Y/O7Y4arloVOta9bNoDaY=; b=i4Bq7UBZGxKE4I545VCsmBaPcQMVk53pSYANLzRwKg6n7zXxgKReoxFF84SJcXm+KL xyez4AiXMmvomEfv/2kEFZQq7U5XNId1jNleDNKXTXJ1BnuNKlFOH9Gn8IqsXVjyMkXM sXrunUYuUepW7EUkc6Mnd6afK6CV3sjkgbtub7pSZrfyENLHvU75ezoQW3a30Veov9w2 TWcGG/BxX3+9Y80/6RUpw8tTfYfl42FpnvY55eIM+HUAIIjh05PJp6pWd328Kh4/bPyq hyix3E7O7tKEw4sXzx4fPZrjBshNbpfa9kRnac4Ey7xMiKRHbRprkzn0MbMVKdebktFz EjEQ== X-Gm-Message-State: AOAM530Wgcce380c5vAD+ZsnV/XYn14jF8fFJ7klBCR12N5r40pfcnT+ 8jRpHW+PKi27/0EtcYtM/yYQSg== X-Received: by 2002:a02:ac5:: with SMTP id 188mr1673917jaw.79.1599610894247; Tue, 08 Sep 2020 17:21:34 -0700 (PDT) Received: from beast.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id f21sm457739ioh.1.2020.09.08.17.21.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2020 17:21:33 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: evgreen@chromium.org, subashab@codeaurora.org, cpratapa@codeaurora.org, bjorn.andersson@linaro.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 2/5] net: ipa: manage endpoints separate from clock Date: Tue, 8 Sep 2020 19:21:24 -0500 Message-Id: <20200909002127.21089-3-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200909002127.21089-1-elder@linaro.org> References: <20200909002127.21089-1-elder@linaro.org> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Currently, when (before) the last IPA clock reference is dropped, all endpoints are suspended. And whenever the first IPA clock reference is taken, all endpoints are resumed (or started). In most cases there's no need to start endpoints when the clock starts. So move the calls to ipa_endpoint_suspend() and ipa_endpoint_resume() out of ipa_clock_put() and ipa_clock_get(), respectiely. Instead, only suspend endpoints when handling a system suspend, and only resume endpoints when handling a system resume. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_clock.c | 4 ---- drivers/net/ipa/ipa_main.c | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) -- 2.20.1 diff --git a/drivers/net/ipa/ipa_clock.c b/drivers/net/ipa/ipa_clock.c index 398f2e47043d8..f2d61c35ef941 100644 --- a/drivers/net/ipa/ipa_clock.c +++ b/drivers/net/ipa/ipa_clock.c @@ -229,8 +229,6 @@ void ipa_clock_get(struct ipa *ipa) goto out_mutex_unlock; } - ipa_endpoint_resume(ipa); - atomic_inc(&clock->count); out_mutex_unlock: @@ -249,8 +247,6 @@ void ipa_clock_put(struct ipa *ipa) if (!atomic_dec_and_mutex_lock(&clock->count, &clock->mutex)) return; - ipa_endpoint_suspend(ipa); - ipa_clock_disable(ipa); mutex_unlock(&clock->mutex); diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c index 6b843fc989122..b8e4a2532fc1a 100644 --- a/drivers/net/ipa/ipa_main.c +++ b/drivers/net/ipa/ipa_main.c @@ -917,6 +917,8 @@ static int ipa_suspend(struct device *dev) { struct ipa *ipa = dev_get_drvdata(dev); + ipa_endpoint_suspend(ipa); + ipa_clock_put(ipa); if (!atomic_xchg(&ipa->suspend_ref, 0)) dev_err(dev, "suspend: missing suspend clock reference\n"); @@ -943,6 +945,8 @@ static int ipa_resume(struct device *dev) dev_err(dev, "resume: duplicate suspend clock reference\n"); ipa_clock_get(ipa); + ipa_endpoint_resume(ipa); + return 0; } From patchwork Wed Sep 9 00:21:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 249399 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp5015187ilg; Tue, 8 Sep 2020 17:22:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+VIVjyr4j96shVY64QMfqUwOYgazm7jM5w9LnCrQl3u93+bkCQd/Q5/owsFw5cxEGNotZ X-Received: by 2002:aa7:d593:: with SMTP id r19mr1595475edq.331.1599610947414; Tue, 08 Sep 2020 17:22:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599610947; cv=none; d=google.com; s=arc-20160816; b=KN5aQwEw5a0nKp8BlrxChXmyhbE6IJE2SZGu9gi9MhL1xgMU2bdyQpTcdL2TlPAmeJ DSYb1nqI4DgiVtMDU/nrQqKxLyUg1x33zAUFYJPwuZHEqL4B/1Efx4qnIU5CQM+ZRfFX M+pDivmz8RGevcZ/Iczftq+H5Zp59ng7/hzyfa/jA5Lwt+S1zcgoUyNeTkViC8VlQOhU s4qgmaOuTGWUIpS4poNrg/Fehjm6AhCD/LFiWZl6njOF6hbsvzEC9iv4Z+l2zaKk+cbm MMHGD3IjrzBHKQWBt3bCx1LOwS2VZjO35JVx2lwcKn5VaFTEiZOU9nN/sbvD1t4F1wiF lcCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=OPjPRK2p71t9ZdCjb3Zea5jYz+oh8o7PLedtAuj54eo=; b=hUkd1IrAMIBWHKfAY7HjvGe9WrT8vT0+CyKVz7G73h0HQln+lTLzR9MzGJtiTUG7uw zTmUJYqKuSOF0Pn/I+VD4A9UaYKRkxWTcnRwXIP7Pvhq0X3MwpztQw71HFL9SUARM6S3 Q+G7Sneht0TuekX0e+CsAaZMfKvJBc05ujKUoyJvLe40fkVDZ3mbbQd2kJMLNsWtzOFd ySVSE28/Y1SAI4yK6k5ZXq4YjF2Oq2ESrGkUOuf1Nv08wko9Rc4E0Vg7NAhZRHdUcIGC zn2UmJ1bjuwUOHAFN731EsJLWq8QkP71WF6vBK9FkwLTHC1hWE73vlEiLkk4ZVrO81H5 0ZAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=D+4idf1N; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-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 bn6si431931ejb.74.2020.09.08.17.22.27; Tue, 08 Sep 2020 17:22:27 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-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=D+4idf1N; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-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 S1729941AbgIIAWY (ORCPT + 9 others); Tue, 8 Sep 2020 20:22:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729005AbgIIAVl (ORCPT ); Tue, 8 Sep 2020 20:21:41 -0400 Received: from mail-il1-x142.google.com (mail-il1-x142.google.com [IPv6:2607:f8b0:4864:20::142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C88AC061796 for ; Tue, 8 Sep 2020 17:21:36 -0700 (PDT) Received: by mail-il1-x142.google.com with SMTP id a8so706686ilk.1 for ; Tue, 08 Sep 2020 17:21:36 -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=OPjPRK2p71t9ZdCjb3Zea5jYz+oh8o7PLedtAuj54eo=; b=D+4idf1NZ8wKX+Bvh68xw2GihYbk8Qrdt50Io/Apvp1qPCja9YQMLuhYNc1SwEtQ0d pRabs+i056pIR1SzF5zNKXdS3jwfmE9D6vm4W1INKUsfuK35MyUKZPi6G2YmNDGwlObH bG2vUjwff2txxqMpwnlVvP1SYKohPJ7+t24tNF1/CGd1Z2Jg9QPtapDL8bVHcjds3Az2 HaqCT8rGI1rT2StYCoV7MMMPDY2bV3wO8VMldMU3PJJO/olsqMmePxogbIsKIgZFFS6t jT9m7keaOEDXMcmXW8O9C7ARqeTcsj1mfIe9QAdMmfZKGqmgMdE8sTCiEiLPYaeNSgJN SOcA== 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=OPjPRK2p71t9ZdCjb3Zea5jYz+oh8o7PLedtAuj54eo=; b=i7etoOtCZ6pbcLvpkrBHyxKhFOiSabMcYZOx8z6ODm3jSpopXYgLlEzqdxugHOcThI ItTwXe5K5IHdMAFZe/7hMzdiIYAEzDlL7cKSC0YIellrL4r6wEYmKPBYz8L8/MaXOI+6 kuvXY2v1vtCJ+ktUfAuUIbfJPRh/9qJGx5OrtRf2AFQLch7LjuzutVnsBbs8MB+gDSCa Mt0BgDzrnTBjIiW7uSuIlEBh4zBcN9Npmk7/1At+o1gbVaW5b2zqpQhNCyZcJQcQvF41 FZ2UZW8CeuKmEVBf8VnAei9JIjE43DngUEsu0GcLfThL3O+MC6XRyjttv61r4yry0PaR ZR5w== X-Gm-Message-State: AOAM532ik+qfXc/JwU0o/Wn2Qw01Q8rwqSDHcT3L8SL7etG4Ei9jt0WF QSsFq8oiZyXHak7xrx5fcvT88A== X-Received: by 2002:a05:6e02:1023:: with SMTP id o3mr1396823ilj.141.1599610895311; Tue, 08 Sep 2020 17:21:35 -0700 (PDT) Received: from beast.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id f21sm457739ioh.1.2020.09.08.17.21.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2020 17:21:34 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: evgreen@chromium.org, subashab@codeaurora.org, cpratapa@codeaurora.org, bjorn.andersson@linaro.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 3/5] net: ipa: use device_init_wakeup() Date: Tue, 8 Sep 2020 19:21:25 -0500 Message-Id: <20200909002127.21089-4-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200909002127.21089-1-elder@linaro.org> References: <20200909002127.21089-1-elder@linaro.org> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The call to wakeup_source_register() in ipa_probe() does not do what it was intended to do. Call device_init_wakeup() in ipa_setup() instead, to set the IPA device as wakeup-capable and to initially enable wakeup capability. When we receive a SUSPEND interrupt, call pm_wakeup_dev_event() with a zero processing time, to simply call for a resume without any other processing. The ipa_resume() call will take care of waking things up again, and will handle receiving the packet. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa.h | 2 -- drivers/net/ipa/ipa_main.c | 43 ++++++++++++++++---------------------- 2 files changed, 18 insertions(+), 27 deletions(-) -- 2.20.1 diff --git a/drivers/net/ipa/ipa.h b/drivers/net/ipa/ipa.h index 407fee841a9a8..a1adc308e030f 100644 --- a/drivers/net/ipa/ipa.h +++ b/drivers/net/ipa/ipa.h @@ -104,8 +104,6 @@ struct ipa { void *zero_virt; size_t zero_size; - struct wakeup_source *wakeup_source; - /* Bit masks indicating endpoint state */ u32 available; /* supported by hardware */ u32 filter_map; diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c index b8e4a2532fc1a..92ea6a811ae31 100644 --- a/drivers/net/ipa/ipa_main.c +++ b/drivers/net/ipa/ipa_main.c @@ -75,18 +75,19 @@ * @ipa: IPA pointer * @irq_id: IPA interrupt type (unused) * - * When in suspended state, the IPA can trigger a resume by sending a SUSPEND - * IPA interrupt. + * If an RX endpoint is in suspend state, and the IPA has a packet + * destined for that endpoint, the IPA generates a SUSPEND interrupt + * to inform the AP that it should resume the endpoint. If we get + * one of these interrupts we just resume everything. */ static void ipa_suspend_handler(struct ipa *ipa, enum ipa_irq_id irq_id) { - /* Take a a single clock reference to prevent suspend. All - * endpoints will be resumed as a result. This reference will - * be dropped when we get a power management suspend request. - * The first call activates the clock; ignore any others. + /* Just report the event, and let system resume handle the rest. + * More than one endpoint could signal this; if so, ignore + * all but the first. */ if (!atomic_xchg(&ipa->suspend_ref, 1)) - ipa_clock_get(ipa); + pm_wakeup_dev_event(&ipa->pdev->dev, 0, true); /* Acknowledge/clear the suspend interrupt on all endpoints */ ipa_interrupt_suspend_clear_all(ipa->interrupt); @@ -107,6 +108,7 @@ int ipa_setup(struct ipa *ipa) { struct ipa_endpoint *exception_endpoint; struct ipa_endpoint *command_endpoint; + struct device *dev = &ipa->pdev->dev; int ret; /* Setup for IPA v3.5.1 has some slight differences */ @@ -124,6 +126,10 @@ int ipa_setup(struct ipa *ipa) ipa_uc_setup(ipa); + ret = device_init_wakeup(dev, true); + if (ret) + goto err_uc_teardown; + ipa_endpoint_setup(ipa); /* We need to use the AP command TX endpoint to perform other @@ -159,7 +165,7 @@ int ipa_setup(struct ipa *ipa) ipa->setup_complete = true; - dev_info(&ipa->pdev->dev, "IPA driver setup completed successfully\n"); + dev_info(dev, "IPA driver setup completed successfully\n"); return 0; @@ -174,6 +180,8 @@ int ipa_setup(struct ipa *ipa) ipa_endpoint_disable_one(command_endpoint); err_endpoint_teardown: ipa_endpoint_teardown(ipa); + (void)device_init_wakeup(dev, false); +err_uc_teardown: ipa_uc_teardown(ipa); ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_TX_SUSPEND); ipa_interrupt_teardown(ipa->interrupt); @@ -201,6 +209,7 @@ static void ipa_teardown(struct ipa *ipa) command_endpoint = ipa->name_map[IPA_ENDPOINT_AP_COMMAND_TX]; ipa_endpoint_disable_one(command_endpoint); ipa_endpoint_teardown(ipa); + (void)device_init_wakeup(&ipa->pdev->dev, false); ipa_uc_teardown(ipa); ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_TX_SUSPEND); ipa_interrupt_teardown(ipa->interrupt); @@ -714,7 +723,6 @@ static void ipa_validate_build(void) */ static int ipa_probe(struct platform_device *pdev) { - struct wakeup_source *wakeup_source; struct device *dev = &pdev->dev; const struct ipa_data *data; struct ipa_clock *clock; @@ -763,19 +771,11 @@ static int ipa_probe(struct platform_device *pdev) goto err_clock_exit; } - /* Create a wakeup source. */ - wakeup_source = wakeup_source_register(dev, "ipa"); - if (!wakeup_source) { - /* The most likely reason for failure is memory exhaustion */ - ret = -ENOMEM; - goto err_clock_exit; - } - /* Allocate and initialize the IPA structure */ ipa = kzalloc(sizeof(*ipa), GFP_KERNEL); if (!ipa) { ret = -ENOMEM; - goto err_wakeup_source_unregister; + goto err_clock_exit; } ipa->pdev = pdev; @@ -783,7 +783,6 @@ static int ipa_probe(struct platform_device *pdev) ipa->modem_rproc = rproc; ipa->clock = clock; atomic_set(&ipa->suspend_ref, 0); - ipa->wakeup_source = wakeup_source; ipa->version = data->version; ret = ipa_reg_init(ipa); @@ -862,8 +861,6 @@ static int ipa_probe(struct platform_device *pdev) ipa_reg_exit(ipa); err_kfree_ipa: kfree(ipa); -err_wakeup_source_unregister: - wakeup_source_unregister(wakeup_source); err_clock_exit: ipa_clock_exit(clock); err_rproc_put: @@ -877,11 +874,8 @@ static int ipa_remove(struct platform_device *pdev) struct ipa *ipa = dev_get_drvdata(&pdev->dev); struct rproc *rproc = ipa->modem_rproc; struct ipa_clock *clock = ipa->clock; - struct wakeup_source *wakeup_source; int ret; - wakeup_source = ipa->wakeup_source; - if (ipa->setup_complete) { ret = ipa_modem_stop(ipa); if (ret) @@ -898,7 +892,6 @@ static int ipa_remove(struct platform_device *pdev) ipa_mem_exit(ipa); ipa_reg_exit(ipa); kfree(ipa); - wakeup_source_unregister(wakeup_source); ipa_clock_exit(clock); rproc_put(rproc); From patchwork Wed Sep 9 00:21:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 249394 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp5014988ilg; Tue, 8 Sep 2020 17:22:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxdcJ5QD/Hh2Vp0bwpwog74vmAaF+uwgHAozHhbjJzWtPnL7NGNSFvOTaktKrlcaIz6NfOq X-Received: by 2002:a17:906:63c9:: with SMTP id u9mr1062337ejk.82.1599610921452; Tue, 08 Sep 2020 17:22:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599610921; cv=none; d=google.com; s=arc-20160816; b=EdDgeJMEIYF4yp2EjLPtybV8zfglU+RtoG3oWseKJzXCw34tEY0xkHgIg5eMv/R4+x eFBfJdfSKptHvS14K24MKp0yhXWjSedBefnhKEIy5ozHD0C5kgLRxXSR3uY3rLIMw76+ +O51OxEKZh3AgZDsrnSyxzwLj7JQkMHmzym2fkqXpyOY+TZ1lGU3tCpYOBjxfOKZ6Jqc q71/smtPXgMVY7qNzLeTL8sVXGBEeiNA1b8BXovOBl0qLaYrhn6k1WwFfMahIrjTml0C pgB7BEmkRECTCO0a+JOKaCNLQAfvbLG6jN8SDkuwKzxH1ONBBihvmOz0MgqsV5zCih6p bGaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=C+4RJZne7XWnSNpMScCQkiPgvon7cqSHe4LlitFTkv0=; b=vMeM/hslDkcU5v9FXICqIrww4w3IBdM10R5M5nHBiDdoWJ02SlIAZWwbjXqZW/IIx/ /xypglVGf6LYpugkMtPEg/snPXnxy1h4hm84u0vCahUe/AIzWEot5XEwK8CydP9VgylK x/LVDyhMDtbuyIDMr4biGU1fQm7IE5eqZr4XgUXR/ibYircE6e7hIDPEki3PKi38cFy3 iQJCrzbDqyH/MYMrhtVGsnvK+7cjGiv7l6jWEKblgd3TyBnbBGuiJoZ04108L+B5dYlw 7GkPYZkOwa6yQTOn5g1BI/sqA+XGYrNkbxxQcLjlmfI30x6D0WbglmhgPVEAha0K+ReO 2Gig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GtxiWvZy; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-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 rh24si419953ejb.283.2020.09.08.17.22.01; Tue, 08 Sep 2020 17:22:01 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-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=GtxiWvZy; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-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 S1729779AbgIIAVz (ORCPT + 9 others); Tue, 8 Sep 2020 20:21:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728971AbgIIAVl (ORCPT ); Tue, 8 Sep 2020 20:21:41 -0400 Received: from mail-il1-x144.google.com (mail-il1-x144.google.com [IPv6:2607:f8b0:4864:20::144]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1947C061798 for ; Tue, 8 Sep 2020 17:21:37 -0700 (PDT) Received: by mail-il1-x144.google.com with SMTP id q6so641666ild.12 for ; Tue, 08 Sep 2020 17:21: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=C+4RJZne7XWnSNpMScCQkiPgvon7cqSHe4LlitFTkv0=; b=GtxiWvZyyPJXhAnEqPmFRyB1Iwm/yOJg+CcAcbtkzQyjJlbWzaEyhnOQjzqBwXKo3D 9JQyr17zUT2RnvfiYlhhg3oFOt7Ogs/pthIq4Jxc0vPVcajwml3Ip/jlx14KcCPydm4O JYB143HO5vjRwfNMfCVFSpFU7oJmHFoVbV/b2CaOVhksmyiM/8WYLTfiQuq45Nl30hRr l7PdGLTfb8XG17Fo1zl2RODD1wxEPrqzK8Pf/Oq7xbUWViY87GPdn2Wl72j02Te8ayT4 R06fi0wDnpGU879RpFlzPmpmyDbjXusF9id9XZHmuRMO4Gf8WbAUpRENTeOMxVVFDmDT EjaA== 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=C+4RJZne7XWnSNpMScCQkiPgvon7cqSHe4LlitFTkv0=; b=jZJNB6CVUE7jRWH52hJlsBfjD7wb3NQchOiKhae5QhhALbT0MCVG/nrVh68cTeQ6zf hUZhQlrU3/YQ+vrzK2rKErcwUg2HBOo72YmDucMd0p571f5TwPkwa0K3e9ik3r5eqMlX N38CfRDyNuE4oBHVS0uHHFsqqO77ZEUEp1RKwrSVCg2ZNvpahFjvmXsOvyn+q0QWE556 4+DwbIBItsy46eGuRIa4zhfZibiwFiO2qm0xjtxLSOq4H3I0/2MOXtXb7bmhpJSUnHt+ W6wyvfgueDV6WeU2hcW+VEI77iEyVeMHeTK7QE5rp9uBHadVhQZo3D9LR15mYDuYMuBT S6mQ== X-Gm-Message-State: AOAM533Gkm3T9vLiUWOMZ9+CK3smIw+qmAoGOgOC5SH0nyvQ8dAZBZYn str4nCRgUkg6qySgjOS/oSLhJA== X-Received: by 2002:a05:6e02:1205:: with SMTP id a5mr1440543ilq.167.1599610896416; Tue, 08 Sep 2020 17:21:36 -0700 (PDT) Received: from beast.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id f21sm457739ioh.1.2020.09.08.17.21.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2020 17:21:35 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: evgreen@chromium.org, subashab@codeaurora.org, cpratapa@codeaurora.org, bjorn.andersson@linaro.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 4/5] net: ipa: enable wakeup on IPA interrupt Date: Tue, 8 Sep 2020 19:21:26 -0500 Message-Id: <20200909002127.21089-5-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200909002127.21089-1-elder@linaro.org> References: <20200909002127.21089-1-elder@linaro.org> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Now that we handle wakeup interrupts properly, arrange for the IPA interrupt to be treated as a wakeup interrupt. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_interrupt.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) -- 2.20.1 diff --git a/drivers/net/ipa/ipa_interrupt.c b/drivers/net/ipa/ipa_interrupt.c index 90353987c45fc..cc1ea28f7bc2e 100644 --- a/drivers/net/ipa/ipa_interrupt.c +++ b/drivers/net/ipa/ipa_interrupt.c @@ -237,8 +237,16 @@ struct ipa_interrupt *ipa_interrupt_setup(struct ipa *ipa) goto err_kfree; } + ret = enable_irq_wake(irq); + if (ret) { + dev_err(dev, "error %d enabling wakeup for \"ipa\" IRQ\n", ret); + goto err_free_irq; + } + return interrupt; +err_free_irq: + free_irq(interrupt->irq, interrupt); err_kfree: kfree(interrupt); @@ -248,6 +256,12 @@ struct ipa_interrupt *ipa_interrupt_setup(struct ipa *ipa) /* Tear down the IPA interrupt framework */ void ipa_interrupt_teardown(struct ipa_interrupt *interrupt) { + struct device *dev = &interrupt->ipa->pdev->dev; + int ret; + + ret = disable_irq_wake(interrupt->irq); + if (ret) + dev_err(dev, "error %d disabling \"ipa\" IRQ wakeup\n", ret); free_irq(interrupt->irq, interrupt); kfree(interrupt); } From patchwork Wed Sep 9 00:21:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 249400 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp5015228ilg; Tue, 8 Sep 2020 17:22:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2rlCHJXM85Ft0cNHhQTQrpyL9X0JWYpmgtFBTf82+jfManexO3MBYuNsgLdbN5tlEZXzq X-Received: by 2002:a05:6402:1d05:: with SMTP id dg5mr1535780edb.67.1599610953325; Tue, 08 Sep 2020 17:22:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599610953; cv=none; d=google.com; s=arc-20160816; b=w19P4Y1DMO928QQEg5V6NJ6+jidLJOsiaF5m8qK5oTzUuSgWn4rsa1kM90HPnlOChP FX0EwicrPhxDx3Yc97pP0mh5e7/WzkYwKVQMmybIqrmmTMsSKR1MMlrUFFKnBJFi7iJM f3402bOE5rSW9+qTDYDKfKXWh1nb555TTV3pl6alFsB1I/z8bBER7gWV+mWdsiDwQFIe nOpBmF3iWIS16L6x0ztfPtpIMknjf2T7u59om9idLPCo94CdKkkgbuI7bySFod+FMgRs l11ODYi80FsRiEPP188VaxnrZNyAsmwG8EWHRV052YCaHwMzaEvi2zUiNP3gcUtX/JDX bEVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=GXt6HV+Ir2mOjyqv+jsDtLLXzMvpXAXcGItzvsZha8c=; b=HZxXgEyvc6Nr6W+wCdtUB6T0P3Z7x7SgEiW6wTusmoY1Kk3qiMEUzcqLvxKxBbMt+U mZwUKnKbq/x6UfI4Rw0ITQjDH3MLnenH88/zOpkPsxzX82hLuhwqHdbxz9bBSXudizpr ofB7805oauXieoKkQQxw8lMFBYoh/ZjKa20C3WcjMkRJzK5EhNBfEFR031OwMLU3uy+J qxPfoFjhG/WIooJJxisdJhck3e0g1ZA/kYyvsxQONpGllP8K2J2+Kk2xxWMt4j9XN1fa VyrIy9ozHqAqZzSQ0YXWQ4kSzRFaFnBhGBiMJ3TRON7IeMNNOWPTLrOhg2WpBaxtlMJk rfBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=K1ikBxwO; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-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 bn6si431931ejb.74.2020.09.08.17.22.33; Tue, 08 Sep 2020 17:22:33 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-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=K1ikBxwO; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-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 S1729876AbgIIAWW (ORCPT + 9 others); Tue, 8 Sep 2020 20:22:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729129AbgIIAVl (ORCPT ); Tue, 8 Sep 2020 20:21:41 -0400 Received: from mail-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE443C061799 for ; Tue, 8 Sep 2020 17:21:38 -0700 (PDT) Received: by mail-il1-x12b.google.com with SMTP id t18so67620ilp.5 for ; Tue, 08 Sep 2020 17:21: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=GXt6HV+Ir2mOjyqv+jsDtLLXzMvpXAXcGItzvsZha8c=; b=K1ikBxwOY2ZfMmKbyNAEfa+2REjTqMN5eToafYQxqDBbSkbgmYHhxvACi/tyeBGRuU YYlVJsbOjE1qn4oxIJMnuCo2jsxS080MXAa4SsC+XWNS257yjSYa3VBOFh47Cox/ZfKA MrFt1VB9WWLDTG8FYVgjeOtWDiwnXS0PIG403ri43pQKqqpnf1/DDayLHncvpXuT+fR/ YUJhPqJvB0IoSw9DiUJ/G7uR2HGzAAahhgrEz+ao7bb67jFJjrpDVYqYvwiv0KRyE6gI TjVyR6PeWVZsQm0KVeM7LKeAydLYQLR7tHOlSKvxMdeQB0R9wxuhC//7VP5+5i/wBBKp U/Fg== 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=GXt6HV+Ir2mOjyqv+jsDtLLXzMvpXAXcGItzvsZha8c=; b=W2PtnmjrLc18y9ezjlNZZSQYeK9udHtNUHLJ4AhoP3+o5H++F9tOuXw8Hwhds9JrZ/ to2fWhm4ZJoP1pC2CEfUmBmbkrDbwvB9WGtzcz1retCxRjJsZkWDwuSa4sNwSXgLxRTN Ay3FUXbqCImkIsO+c4gVSZQi5uhRSd0M0aMUsrSloWKGoiazvqJe4dXoViuUov3T5ICx J+dDf6xEtYdTLOvxCBN/gUnjOtSjXcGa7hadVff5rmyz2L0ccm2qedUV7BvXL6blatfm VCyM8rawaK5hnnMU3rLS9OeO4htEdUwum8ABvXYEnJnqt1YclBFBvWyo2JtXT/Mjwk9Y +G8w== X-Gm-Message-State: AOAM531Yb5gjsoTG/iOwJMTbe7aYEBdPY5oo4EDWUhCcIZ9dmUeF1MQy Abz+wBLvPvV4GAQvfmi2bgZFeQ== X-Received: by 2002:a92:9145:: with SMTP id t66mr1300389ild.305.1599610897475; Tue, 08 Sep 2020 17:21:37 -0700 (PDT) Received: from beast.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id f21sm457739ioh.1.2020.09.08.17.21.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2020 17:21:37 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: evgreen@chromium.org, subashab@codeaurora.org, cpratapa@codeaurora.org, bjorn.andersson@linaro.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 5/5] net: ipa: do not enable GSI interrupt for wakeup Date: Tue, 8 Sep 2020 19:21:27 -0500 Message-Id: <20200909002127.21089-6-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200909002127.21089-1-elder@linaro.org> References: <20200909002127.21089-1-elder@linaro.org> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org We now trigger a system resume when we receive an IPA SUSPEND interrupt. We should *not* wake up on GSI interrupts. Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.c | 17 ++++------------- drivers/net/ipa/gsi.h | 1 - 2 files changed, 4 insertions(+), 14 deletions(-) -- 2.20.1 diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index 0e63d35320aaf..cb75f7d540571 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -1987,31 +1987,26 @@ int gsi_init(struct gsi *gsi, struct platform_device *pdev, bool prefetch, } gsi->irq = irq; - ret = enable_irq_wake(gsi->irq); - if (ret) - dev_warn(dev, "error %d enabling gsi wake irq\n", ret); - gsi->irq_wake_enabled = !ret; - /* Get GSI memory range and map it */ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "gsi"); if (!res) { dev_err(dev, "DT error getting \"gsi\" memory property\n"); ret = -ENODEV; - goto err_disable_irq_wake; + goto err_free_irq; } size = resource_size(res); if (res->start > U32_MAX || size > U32_MAX - res->start) { dev_err(dev, "DT memory resource \"gsi\" out of range\n"); ret = -EINVAL; - goto err_disable_irq_wake; + goto err_free_irq; } gsi->virt = ioremap(res->start, size); if (!gsi->virt) { dev_err(dev, "unable to remap \"gsi\" memory\n"); ret = -ENOMEM; - goto err_disable_irq_wake; + goto err_free_irq; } ret = gsi_channel_init(gsi, prefetch, count, data, modem_alloc); @@ -2025,9 +2020,7 @@ int gsi_init(struct gsi *gsi, struct platform_device *pdev, bool prefetch, err_iounmap: iounmap(gsi->virt); -err_disable_irq_wake: - if (gsi->irq_wake_enabled) - (void)disable_irq_wake(gsi->irq); +err_free_irq: free_irq(gsi->irq, gsi); return ret; @@ -2038,8 +2031,6 @@ void gsi_exit(struct gsi *gsi) { mutex_destroy(&gsi->mutex); gsi_channel_exit(gsi); - if (gsi->irq_wake_enabled) - (void)disable_irq_wake(gsi->irq); free_irq(gsi->irq, gsi); iounmap(gsi->virt); } diff --git a/drivers/net/ipa/gsi.h b/drivers/net/ipa/gsi.h index 061312773df09..3f9f29d531c43 100644 --- a/drivers/net/ipa/gsi.h +++ b/drivers/net/ipa/gsi.h @@ -150,7 +150,6 @@ struct gsi { struct net_device dummy_dev; /* needed for NAPI */ void __iomem *virt; u32 irq; - bool irq_wake_enabled; u32 channel_count; u32 evt_ring_count; struct gsi_channel channel[GSI_CHANNEL_COUNT_MAX];