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 */