From patchwork Thu Jan 7 21:43:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 358300 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp830823jai; Thu, 7 Jan 2021 13:45:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJz1y/pfZhcXAs2VK68dS0je6ppKwQXsuwZOwkJg7gbEBfAES7N3iqGFUjLBBYplEVjAEtHm X-Received: by 2002:a17:907:1009:: with SMTP id ox9mr593434ejb.37.1610055945325; Thu, 07 Jan 2021 13:45:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610055945; cv=none; d=google.com; s=arc-20160816; b=aqtmkj37Domiavttaa9r7vYvEig5zN/fPhn/Jq6SrWoGjliPfRlPIDQLo1Xh5TyxAZ AlJxQmvxFt57bHDIByBWMkdYkmXUvnBN3enrma75kJwM+uRTOeaC4GPJF7PtOfrQZgHo LquI5T38JoLTwJoLkluiCmuWcrrZAMaONJTb4IOaA+GLolkJJB9KusyAj5YPXxuse7pA GX+UaYR+afRm00lYRp8+5rBbCaOe7cyujN46JXilwy1XUsEjPI9rd+XOv5t8ux3AezJA 2zOaw/Er8SurY32FwloeKeP9VMZzKbEG/F//iYDRCXEaVGCFCyVN7T/7QgWjnC7Lvpfl dJMQ== 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=7IjbMJw+DvF3Ni9HvI6FJRuCxFX1OxpBhCEvG7fLR1g=; b=G4T1CH6W+i70OPyB6yiailjQUKhmQp7UES82GVXiaf8UWNKyVKHKlVB17got4GZWfl SRowaFxRnG4MfY8Ynl8sSbKp9RS1ztL2qZt4z7bVEejcphN6C1Yaw8LXpDKeykSdF4/N gj6F1tj2bK1MS5KU7E9YCwaDqoODbMp3hFHX7m3EHCESOdEIRy3HX8HjkBitE/V6QdK+ LphjV7GKzC/JatPojneNtc387SzjdI7ZQ6u+erupDDmtDBoawQw4Hsj72A+C5GsGR3rQ oJ8PhBGuEukZAIGnJWMD11Nn5BWtlIeE6MOfvEx9gqqq7FAdkl8Y1oWI+gjN1TEyC/W/ CI9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RPYiNJs1; 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 q4si2746323eji.447.2021.01.07.13.45.45; Thu, 07 Jan 2021 13:45:45 -0800 (PST) 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=RPYiNJs1; 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 S1727949AbhAGVoM (ORCPT + 7 others); Thu, 7 Jan 2021 16:44:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727903AbhAGVoL (ORCPT ); Thu, 7 Jan 2021 16:44:11 -0500 Received: from mail-io1-xd33.google.com (mail-io1-xd33.google.com [IPv6:2607:f8b0:4864:20::d33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1137BC0612F9 for ; Thu, 7 Jan 2021 13:43:31 -0800 (PST) Received: by mail-io1-xd33.google.com with SMTP id u26so7649567iof.3 for ; Thu, 07 Jan 2021 13:43:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7IjbMJw+DvF3Ni9HvI6FJRuCxFX1OxpBhCEvG7fLR1g=; b=RPYiNJs1/tdsdWLCx3Qssr91jNJaxMiV5KMUmZVfgmkXxFzcd/9VV9HMSsbYNCODKR 1lIPoZiS16R8PHAFJY13nPTPQBpS01UPjXVE51BTr6vp7Y76uBEmjb90plCVmCDlxqBf 56Oyyz9FNEHAjq9PNsc9jDTVawOpPWf5VmTr3c+Q2bx6oxl3Kc1jVupb/DZvpUVi/Fis jyV9SN0Frk6Rhfp3/SFxAA0KTBtBLnLx86wXukdT/c7Zoq/x52LLnpGzqGM57UBxpkKq vxbjWtAWThLjA059W/VIxLgya8InS9ktsfr7IdyIoZK6zfWvme9fiKZlPSxKvvpmR4nc g8iw== 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=7IjbMJw+DvF3Ni9HvI6FJRuCxFX1OxpBhCEvG7fLR1g=; b=Z1XS8OI7lTlkUiDbJ1KFQg3Ffo7dyOSjK+wYyv/l8kw3IIplDEMbGUky41z6rDx68M NTeigTEfTmCO6D7FbX3LPvxj6om3fKsqbOCkemklVRykbEUuGBYn8khztsQ0dl8aidiV C+PIUsPYsr9fZtlpzA0DZRbU61JVX8D/YjK1eA91UVQcHYN8kv1n3v4AFWfZ4+3iNYjm /EsvL17CCZS5e3Pi7SdkadpwdY9TEcIWp72/2e2QptHnBo2DWPZ20vCpd2FtyQAocIpj dKdpH3VtOUQ9jFVnfYpuuxMGl13v8HJyubSr60XjKNR/xkDm5y6i54kE2HHLk4bpB7v/ Ef0w== X-Gm-Message-State: AOAM530CcIefscVdl6WjVNBkfDV4lcMtG4M2LcrPRZVdsW3OlEFwwDu1 6kbvQDMHvanQG6tB1AYC18gUDA== X-Received: by 2002:a05:6638:f92:: with SMTP id h18mr507295jal.118.1610055810384; Thu, 07 Jan 2021 13:43:30 -0800 (PST) Received: from beast.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id f10sm5218260ilq.64.2021.01.07.13.43.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jan 2021 13:43:29 -0800 (PST) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: evgreen@chromium.org, bjorn.andersson@linaro.org, cpratapa@codeaurora.org, subashab@codeaurora.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net 1/2] net: ipa: introduce atomic channel STOPPING flag Date: Thu, 7 Jan 2021 15:43:24 -0600 Message-Id: <20210107214325.7077-2-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210107214325.7077-1-elder@linaro.org> References: <20210107214325.7077-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Introduce a new atomic flag bit to communicate that a channel is stopping. At the end of the NAPI poll loop, we normally re-enable the IEOB interrupt, but now we won't do that if the channel is being stopped. This is required for the next patch. Fixes: 650d1603825d8 ("soc: qcom: ipa: the generic software interface") Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.c | 11 ++++++++++- drivers/net/ipa/gsi.h | 6 ++++++ 2 files changed, 16 insertions(+), 1 deletion(-) -- 2.20.1 diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index 14d9a791924bf..7e7629902911e 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -739,6 +739,10 @@ static void gsi_channel_freeze(struct gsi_channel *channel) { gsi_channel_trans_quiesce(channel); + /* Don't let the NAPI poll loop re-enable interrupts when done */ + set_bit(GSI_CHANNEL_FLAG_STOPPING, channel->flags); + smp_mb__after_atomic(); /* Ensure gsi_channel_poll() sees new value */ + napi_disable(&channel->napi); gsi_irq_ieob_disable(channel->gsi, channel->evt_ring_id); @@ -749,6 +753,10 @@ static void gsi_channel_thaw(struct gsi_channel *channel) { gsi_irq_ieob_enable(channel->gsi, channel->evt_ring_id); + /* Allow the NAPI poll loop to re-enable interrupts again */ + clear_bit(GSI_CHANNEL_FLAG_STOPPING, channel->flags); + smp_mb__after_atomic(); /* Ensure gsi_channel_poll() sees new value */ + napi_enable(&channel->napi); } @@ -1536,7 +1544,8 @@ static int gsi_channel_poll(struct napi_struct *napi, int budget) if (count < budget) { napi_complete(&channel->napi); - gsi_irq_ieob_enable(channel->gsi, channel->evt_ring_id); + if (!test_bit(GSI_CHANNEL_FLAG_STOPPING, channel->flags)) + gsi_irq_ieob_enable(channel->gsi, channel->evt_ring_id); } return count; diff --git a/drivers/net/ipa/gsi.h b/drivers/net/ipa/gsi.h index 96c9aed397aad..8f0ae97c80c6e 100644 --- a/drivers/net/ipa/gsi.h +++ b/drivers/net/ipa/gsi.h @@ -104,9 +104,15 @@ enum gsi_channel_state { GSI_CHANNEL_STATE_ERROR = 0xf, }; +enum gsi_channel_flag { + GSI_CHANNEL_FLAG_STOPPING, + GSI_CHANNEL_FLAG_COUNT, /* Last; not a flag */ +}; + /* We only care about channels between IPA and AP */ struct gsi_channel { struct gsi *gsi; + DECLARE_BITMAP(flags, GSI_CHANNEL_FLAG_COUNT); bool toward_ipa; bool command; /* AP command TX channel or not */ From patchwork Thu Jan 7 21:43:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 358301 Delivered-To: patch@linaro.org Received: by 2002:a02:85a7:0:0:0:0:0 with SMTP id d36csp830841jai; Thu, 7 Jan 2021 13:45:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJzejWNcM/36fyFK3iprrYUBuavRtLtewonUhLf+UYwxJJSOPpwKC9XGmO6iuydLNZd6z8Zg X-Received: by 2002:a17:906:3099:: with SMTP id 25mr572294ejv.321.1610055946753; Thu, 07 Jan 2021 13:45:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610055946; cv=none; d=google.com; s=arc-20160816; b=rg2EOtihAJGVpoF0GiBpKNAg3kIHPg8kKbbIp9H6ZojxLzOgiYnlFWfBVJiDVqG5/f 58QV4GmDxej0AN6RfpjIccmVBzvQ64jWPfV3AEzpDvN2IZgCugyT9kO8CgQN0IMQgY4R WGD2dsniXtlQ4HuSbnuuRmmGXWq3YW6vHVRfyprUKs1X8ai+fSlMXtzGV5HnOu/8ZQLB wiQ6qGkJLkOeKeD60BXWWmtYMG/qhBECZ/DweMDbAlstvAazNVLHAgwHNK1t3dZDVrCS l9PaqzkITr/YnLWtJ+Jnc8Hswwj1zaTxvRMIfruYwnh3dK3vUGQCKFOIQs7H61KT7DY0 ySGQ== 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=D9HgxlCMRBRvY3EtPBfpOoI3TYfy8ZVEt5J8BdfVXKI=; b=fUv9UeMICd4df7N6LGVwbVZeXFt9dCeNYzYg3xM6lH6oayXhtk3H+Nd+bmuiwFoG2w Fc8YkUlMfjaAj/T7kJMaJFqcruOHHV3PN8XaAzu2j5j/T1J+qI3ac2AFNEZVt5hLHYuI ttO/ZNcTB5GHvL0ViEVg6YP1Viw0Zh2yztBcwmAsJacqE80ZtwCKhBtdE3uXZtgiT40K CfuE8jx024qgfnkAtVr7mLTvmi2FRlfuhg0OdLTPdZa/j9U4kXoS0CRTsXwdV/RH2VFK EfzOY4gr2m8eghOIaDGu/I/w/NG7kHVTqmjZeR5du0wIXJOsd6LOL19W6M+5KHxPXD6j OoZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=x5i3A8tf; 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 q4si2746323eji.447.2021.01.07.13.45.46; Thu, 07 Jan 2021 13:45:46 -0800 (PST) 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=x5i3A8tf; 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 S1727494AbhAGVol (ORCPT + 7 others); Thu, 7 Jan 2021 16:44:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726720AbhAGVol (ORCPT ); Thu, 7 Jan 2021 16:44:41 -0500 Received: from mail-io1-xd2b.google.com (mail-io1-xd2b.google.com [IPv6:2607:f8b0:4864:20::d2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29D58C0612FB for ; Thu, 7 Jan 2021 13:43:32 -0800 (PST) Received: by mail-io1-xd2b.google.com with SMTP id p187so7625102iod.4 for ; Thu, 07 Jan 2021 13:43:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=D9HgxlCMRBRvY3EtPBfpOoI3TYfy8ZVEt5J8BdfVXKI=; b=x5i3A8tfaLHchgjQEBdoO1VwSLM5+0GIPP0995ZsTGKIAI8HIpN+xsT6mgVuKrZenV 9IB2rSFQyxFuVMJG6wV5NsL1AmLa8521N51CgHMxp1fqaDfyXjZaRbq1gWGoIuZmQlMr dBS2A2zpsuPws1Ww9igyXEm1wSqZNjXu/6ovDA9r8ypbfv20E/KYns6XzDx5qVBo/WSU UgXIqivDZsgQBZvuqISF69y3McqXzBdFXkc4CEaz2FubZtWpV5dXm+AiV9XM6DSaBv3Z LGe1CAfXsovD4ND0sp971bMb6tY2j6NZuB0uCs4LU+0v5VPYiVj2uqW39r632w2+04Jc hmpQ== 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=D9HgxlCMRBRvY3EtPBfpOoI3TYfy8ZVEt5J8BdfVXKI=; b=g8pAMmYghMpyso5UA0VHVmSGQ2Kp6dDC1y5wjKO86nlpdWJNYv4tNv3n+ZoCQEYAd1 Y48580SkP76H1AHcLpPcXEQzyjyQMZE4uirH8kDL7hlJiHL1S6/xZmQo7wLiGLKPvyDH MNsz678CUzenmLUHVboQDaXpXEbhS9z2rwqpaYXBk20GKyxArii63nKKUBekJQUzzQH+ vukL3b8h6WtS3bAJrYrl5HSvP3UtotfkT1JK4Z2j8AKKP474PeiK87aF94sUzU26zzsq 3jxep0S5AQJ5iF3CLtbJRu8XGAuum8ahLEDqyYsefR4mI9vHsBPTTW7U/6S8k03Hbv+/ GxLQ== X-Gm-Message-State: AOAM532mSwvvhvi3q04Uy/1gFMdFWU1P4PL0DzN6aHem0C0tz43kRPsw 6kN69Dru1kbVg9vias+BuT4LZg== X-Received: by 2002:a5d:84cf:: with SMTP id z15mr2896543ior.81.1610055811515; Thu, 07 Jan 2021 13:43:31 -0800 (PST) Received: from beast.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id f10sm5218260ilq.64.2021.01.07.13.43.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jan 2021 13:43:30 -0800 (PST) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: evgreen@chromium.org, bjorn.andersson@linaro.org, cpratapa@codeaurora.org, subashab@codeaurora.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net 2/2] net: ipa: re-enable NAPI before enabling interrupt Date: Thu, 7 Jan 2021 15:43:25 -0600 Message-Id: <20210107214325.7077-3-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210107214325.7077-1-elder@linaro.org> References: <20210107214325.7077-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org When we stop or suspend a channel, we first "freeze" it. The last part of that involves disabling NAPI, and disabling the IEOB interrupt that schedules NAPI when it occurs. On resume, a "thaw" does the inverse of these activities, in reverse order. Currently these are ordered such that NAPI is disabled before interrupts on suspend, and NAPI is re-enabled after interrupts on resume. An interrupt occurring while NAPI is disabled will request a NAPI schedule, but polling is deferred until after NAPI is enabled again. When NAPI is re-enabled, polling is allowed again, but enabling NAPI does not schedule a poll (i.e., it won't trigger polling to handle a schedule request that occurred while disabled). Polling won't commence until the next napi_schedule() request occurs. Instead, disable completion interrupts *before* disabling NAPI when stopping a channel, and re-enable interrupts *after* re-enabling NAPI. That way NAPI is always enabled when an interrupt occurs, and polling to handle the interrupt can commence immediately. The channel STOPPING flag ensures the polling function won't re-enable the completion interrupt while we are stopping. Fixes: 650d1603825d8 ("soc: qcom: ipa: the generic software interface") Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.20.1 diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index 7e7629902911e..9bde6d02b1cd6 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -743,21 +743,21 @@ static void gsi_channel_freeze(struct gsi_channel *channel) set_bit(GSI_CHANNEL_FLAG_STOPPING, channel->flags); smp_mb__after_atomic(); /* Ensure gsi_channel_poll() sees new value */ - napi_disable(&channel->napi); - gsi_irq_ieob_disable(channel->gsi, channel->evt_ring_id); + + napi_disable(&channel->napi); } /* Allow transactions to be used on the channel again. */ static void gsi_channel_thaw(struct gsi_channel *channel) { - gsi_irq_ieob_enable(channel->gsi, channel->evt_ring_id); - /* Allow the NAPI poll loop to re-enable interrupts again */ clear_bit(GSI_CHANNEL_FLAG_STOPPING, channel->flags); smp_mb__after_atomic(); /* Ensure gsi_channel_poll() sees new value */ napi_enable(&channel->napi); + + gsi_irq_ieob_enable(channel->gsi, channel->evt_ring_id); } /* Program a channel for use */