From patchwork Tue Aug 3 14:00:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 490952 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp677123jap; Tue, 3 Aug 2021 07:01:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCdJ7vvyJFd++XFvRX8/9GxacEquMa2o2NyZxOIM2pda9mlz2HFzWkgA2CNWv46LLYqQg7 X-Received: by 2002:a92:3642:: with SMTP id d2mr556188ilf.253.1627999282645; Tue, 03 Aug 2021 07:01:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627999282; cv=none; d=google.com; s=arc-20160816; b=IAiKt72HZ74FRNpvlarvxh6f4U3GgxiCspZm2lvOMZVlArUt/hzKaAqyBp/fCqoO0i KTYmBWLh3d3/TbKdonl0NYfEs3VRYs+Uf/hLPAvXZ9FvZWv2jlu7/TJ8iTqK3uhWymcI MhEHTfUk96Hv6RHBXmkefPNo38Z29V7RPsAyw8NNUFBZxxgeKeWuy5oqxlgDQuqnCddT CPoMMU1PvZrjIPSH/51XKIbXakF5608/yMSbsq5vY//LFG0GEKddXViAi1bS2lt4r+Sg O/39K2Dfk9QvfyXGb6t6TeBP70Nfx8HLjqZUZUo3rqTKmWaEwyzTL/UMDXqic8qP5I/S WsnA== 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=4FkXmwZPUxx9Kh0iEhc1aEIbzGzoOTpM7okfkLR98cU=; b=TToI+BU02wc3snFGG6qs0/510XcB5SYZ3Wy2avwSprT+3ER+cjxhjOxH6us6oWZNkK ty+AFnWBwMCUtJmCdVIRuwmzxTwdW8N/k8StTP4E/9jymfds4MmxDZ3Rl9/L8EJVRhZS rUSCPAFwlxM917XNGtOmzpIHygtfIvGCPpnonaLjODfZlsxZYlgaT2PmFUxXebz1Z5tg ieGYSQYITNgUpGscUnYAyb/mAWmfVA7gG8EgDg6JiFJHgiZ6zW6uW2c9snkDkS1/GHNc Lua/eCmDTnP4lKSCUNx8iwnOu8xh8gNLCUWQW3E6Yj/5ppVf6oJqcjUrhFs3kCVwO/DW pr2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aF9KTYAg; 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 m19si17481244jat.15.2021.08.03.07.01.22; Tue, 03 Aug 2021 07:01:22 -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=aF9KTYAg; 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 S236454AbhHCOBZ (ORCPT + 8 others); Tue, 3 Aug 2021 10:01:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236425AbhHCOBU (ORCPT ); Tue, 3 Aug 2021 10:01:20 -0400 Received: from mail-il1-x130.google.com (mail-il1-x130.google.com [IPv6:2607:f8b0:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 589C5C061757 for ; Tue, 3 Aug 2021 07:01:09 -0700 (PDT) Received: by mail-il1-x130.google.com with SMTP id z3so19530195ile.12 for ; Tue, 03 Aug 2021 07:01:09 -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=4FkXmwZPUxx9Kh0iEhc1aEIbzGzoOTpM7okfkLR98cU=; b=aF9KTYAgOsz50XZP4YPUlPm/QRzuXhmNTsANGWhurLcpCVFS5is8Yv36Nr/jWPRvPS AAS94gr2lbE8EDGjGQugS1gb8asej41DSwXPo2KcJN2cL7gnaQjSQBxiF1Q55ZFnsNmo cGf9MuFMEbvCIloQEz4YB7WjpK4lH/wCPqhWLr2P1s1pRXLyBt98aag+hj8kfE+krrzv n/G3Qw9NKCnJKHulNP1KEtrgr+KohM4lEV3RXMRMeXlNaDYeot5AMbGzCLUZvpFX6T6g IODxbCiS3LnElBpBTWzFEjolqoPMcpeMh7B5YkohquHyd2Hv+47hoSDqTrQKPbFb/VRD owgA== 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=4FkXmwZPUxx9Kh0iEhc1aEIbzGzoOTpM7okfkLR98cU=; b=HzCWY1gZbk674Ycm+sU36+590CKYL/ufmlub1oFn6LzBLYt7bk7BiKDUmBXVEqnfku k/yQ+q3OsQ+X4lvLhvk0kXVKUOcyHVM5QbRMOGpjbQbBgmDSNxWCMI513bJovF+MgtmB GG6Lu0nGgn2O5n0MN9Tj1zCDMNomr3WWe//7svav58tvkvlqNjnyDUr/2ftQYU7gdR4n 2xYFphhPkeqAvYEcewXh9PIfG07xQ7XOYQ5h1yxweTQo7yLQ0WWYcxuZIbT/LDBF5X+Q gM7bhGNMaZPCqSIpoCoNf1f/4FBSbm5v30sKIMyV+bUyX16XSKmwFUxvE8r/XZ4fDPfL wspw== X-Gm-Message-State: AOAM5339RxB0RRIV6rGo5mBh3mQyKuZtUcOOrrnIC51jutMMZi2WWX0h DgWoAhQyvSQNGpnOZDr/48ikAA== X-Received: by 2002:a05:6e02:198f:: with SMTP id g15mr199659ilf.120.1627999268671; Tue, 03 Aug 2021 07:01:08 -0700 (PDT) Received: from presto.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id w7sm9456798iox.1.2021.08.03.07.01.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Aug 2021 07:01:08 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: bjorn.andersson@linaro.org, evgreen@chromium.org, cpratapa@codeaurora.org, subashab@codeaurora.org, elder@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 1/6] net: ipa: use gsi->version for channel suspend/resume Date: Tue, 3 Aug 2021 09:00:58 -0500 Message-Id: <20210803140103.1012697-2-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210803140103.1012697-1-elder@linaro.org> References: <20210803140103.1012697-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The GSI layer has the IPA version now, so there's no need for version-specific flags to be passed from IPA. One instance of this is in gsi_channel_suspend() and gsi_channel_resume(), which indicate whether or not the endpoint suspend is implemented by GSI stopping the channel. We can make that determination based on gsi->version, eliminating the need for a Boolean flag in those functions. Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.c | 14 ++++++++------ drivers/net/ipa/gsi.h | 19 +++++++++++++++++-- drivers/net/ipa/ipa_endpoint.c | 14 ++------------ 3 files changed, 27 insertions(+), 20 deletions(-) -- 2.27.0 diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index 3de67ba066a68..e143deddb7c09 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -1026,13 +1026,14 @@ void gsi_channel_reset(struct gsi *gsi, u32 channel_id, bool doorbell) mutex_unlock(&gsi->mutex); } -/* Stop a STARTED channel for suspend (using stop if requested) */ -int gsi_channel_suspend(struct gsi *gsi, u32 channel_id, bool stop) +/* Stop a started channel for suspend */ +int gsi_channel_suspend(struct gsi *gsi, u32 channel_id) { struct gsi_channel *channel = &gsi->channel[channel_id]; int ret; - ret = __gsi_channel_stop(channel, stop); + /* Prior to IPA v4.0 suspend/resume is not implemented by GSI */ + ret = __gsi_channel_stop(channel, gsi->version >= IPA_VERSION_4_0); if (ret) return ret; @@ -1042,12 +1043,13 @@ int gsi_channel_suspend(struct gsi *gsi, u32 channel_id, bool stop) return 0; } -/* Resume a suspended channel (starting will be requested if STOPPED) */ -int gsi_channel_resume(struct gsi *gsi, u32 channel_id, bool start) +/* Resume a suspended channel (starting if stopped) */ +int gsi_channel_resume(struct gsi *gsi, u32 channel_id) { struct gsi_channel *channel = &gsi->channel[channel_id]; - return __gsi_channel_start(channel, start); + /* Prior to IPA v4.0 suspend/resume is not implemented by GSI */ + return __gsi_channel_start(channel, gsi->version >= IPA_VERSION_4_0); } /** diff --git a/drivers/net/ipa/gsi.h b/drivers/net/ipa/gsi.h index 81cd7b07f6e14..97163b58b4ebc 100644 --- a/drivers/net/ipa/gsi.h +++ b/drivers/net/ipa/gsi.h @@ -232,8 +232,23 @@ int gsi_channel_stop(struct gsi *gsi, u32 channel_id); */ void gsi_channel_reset(struct gsi *gsi, u32 channel_id, bool doorbell); -int gsi_channel_suspend(struct gsi *gsi, u32 channel_id, bool stop); -int gsi_channel_resume(struct gsi *gsi, u32 channel_id, bool start); +/** + * gsi_channel_suspend() - Suspend a GSI channel + * @gsi: GSI pointer + * @channel_id: Channel to suspend + * + * For IPA v4.0+, suspend is implemented by stopping the channel. + */ +int gsi_channel_suspend(struct gsi *gsi, u32 channel_id); + +/** + * gsi_channel_resume() - Resume a suspended GSI channel + * @gsi: GSI pointer + * @channel_id: Channel to resume + * + * For IPA v4.0+, the stopped channel is started again. + */ +int gsi_channel_resume(struct gsi *gsi, u32 channel_id); /** * gsi_init() - Initialize the GSI subsystem diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c index 8070d1a1d5dfd..08ee37ae28813 100644 --- a/drivers/net/ipa/ipa_endpoint.c +++ b/drivers/net/ipa/ipa_endpoint.c @@ -1587,7 +1587,6 @@ void ipa_endpoint_suspend_one(struct ipa_endpoint *endpoint) { struct device *dev = &endpoint->ipa->pdev->dev; struct gsi *gsi = &endpoint->ipa->gsi; - bool stop_channel; int ret; if (!(endpoint->ipa->enabled & BIT(endpoint->endpoint_id))) @@ -1598,11 +1597,7 @@ void ipa_endpoint_suspend_one(struct ipa_endpoint *endpoint) (void)ipa_endpoint_program_suspend(endpoint, true); } - /* Starting with IPA v4.0, endpoints are suspended by stopping the - * underlying GSI channel rather than using endpoint suspend mode. - */ - stop_channel = endpoint->ipa->version >= IPA_VERSION_4_0; - ret = gsi_channel_suspend(gsi, endpoint->channel_id, stop_channel); + ret = gsi_channel_suspend(gsi, endpoint->channel_id); if (ret) dev_err(dev, "error %d suspending channel %u\n", ret, endpoint->channel_id); @@ -1612,7 +1607,6 @@ void ipa_endpoint_resume_one(struct ipa_endpoint *endpoint) { struct device *dev = &endpoint->ipa->pdev->dev; struct gsi *gsi = &endpoint->ipa->gsi; - bool start_channel; int ret; if (!(endpoint->ipa->enabled & BIT(endpoint->endpoint_id))) @@ -1621,11 +1615,7 @@ void ipa_endpoint_resume_one(struct ipa_endpoint *endpoint) if (!endpoint->toward_ipa) (void)ipa_endpoint_program_suspend(endpoint, false); - /* Starting with IPA v4.0, the underlying GSI channel must be - * restarted for resume. - */ - start_channel = endpoint->ipa->version >= IPA_VERSION_4_0; - ret = gsi_channel_resume(gsi, endpoint->channel_id, start_channel); + ret = gsi_channel_resume(gsi, endpoint->channel_id); if (ret) dev_err(dev, "error %d resuming channel %u\n", ret, endpoint->channel_id); From patchwork Tue Aug 3 14:00:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 490953 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp677188jap; Tue, 3 Aug 2021 07:01:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxGmWOLi504xK8xpLcZgXm//WQYxOQHTjJ+E0BHTNEtbV9W83ZstvNUTLTWBZQBHLWSEQzG X-Received: by 2002:a05:6602:2424:: with SMTP id g4mr110596iob.189.1627999285751; Tue, 03 Aug 2021 07:01:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627999285; cv=none; d=google.com; s=arc-20160816; b=z2l6GP9M8JYjjy0CW3d9Cs0QtIyKDwNGUTnfK0dnY+vadzHWl8TKh/zG6hah2l6Qo7 B65hFa+J2lL/HVDKZnb/ADyNJBmj1ERq4F6pvF1UB0uZqNvaUBDyBK4bL4seIF5tXYnr qnberB3UxUkPednZt0BIEhNySdMVmz5KN2IrsDp+QHmfzktrBpmysllP6QtZYV/pasyf 3zMbjqtDxliTijDwF4CyZmqtGTZQWUcznovueFB2PXZ+5v4EwfbqbmlYtNkMdrn/gtoa rI7TpnryJjwmiS3/LZj0zL3YBTAVA9On7K1iy+NP0OcKnz+kalM5v5zEMPdMAaVvO/d9 j9zg== 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=HPmPU/IPZMujqhjgqF3ovBGi7NkWBNCG5MxA59CMXOc=; b=q9GJgrxWR3PGK6ZkiU9JRAwQzWep1VAcp+CayJpVsIolCNj0ptb6fh/XWlwKKwkWFY zWvKfWjX3rbNRmIsROtUdtonQMwUnwYfEezv7KKocfISgnfXGwJEJjeMB1YJOQaXYL+T izxxfbHgH3rA4mRLjDV4pAxDo02cY4oL33XZXhLJPiIlVQBMacocuQS4Y1JR5p9n3mK9 sLltxyNYq49jEtCLgU6FQ1LHR2M90wLNq/zXe26WNqb4t2PeLooNKoHYCb17IFFThxyT /hXvgXryzOY+eVA8mFKfxo7Ffhl5aEe4cYIomJeaa/5b6lN+UkFUkjLlquF1gbpArzS1 nR1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zzCH1hgo; 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 q5si15069670jaj.40.2021.08.03.07.01.25; Tue, 03 Aug 2021 07:01:25 -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=zzCH1hgo; 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 S236509AbhHCOBb (ORCPT + 8 others); Tue, 3 Aug 2021 10:01:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236331AbhHCOBW (ORCPT ); Tue, 3 Aug 2021 10:01:22 -0400 Received: from mail-io1-xd2a.google.com (mail-io1-xd2a.google.com [IPv6:2607:f8b0:4864:20::d2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D77CC061764 for ; Tue, 3 Aug 2021 07:01:10 -0700 (PDT) Received: by mail-io1-xd2a.google.com with SMTP id f11so24339125ioj.3 for ; Tue, 03 Aug 2021 07:01:10 -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=HPmPU/IPZMujqhjgqF3ovBGi7NkWBNCG5MxA59CMXOc=; b=zzCH1hgowuyikO+j9qETjeo6hgLWKMkC3jRc9nK6vE/GVwrsaJmim0dmquUBbubDpy DAV6pwCyejx37x7biAhO6Xk0e6ShCL5VcNJBb0ZB4eHKpEnfiEZGP9lAztEi0s6eRwVQ /UDIGOq4UrOax0HhmIex59Akk2GrWKUUb9hRpk61GXtCEBBHoVARSo5H6dj7KwcKxmgm bh+tbhKlIrDzSbmN9230RrY8y90Yf2sKnVso/lJjuQyec2jM65G+5TEPZx/NoNpKG99y CQcHIEJiZuNCPv+koUBnm/TBvXJPb+OwCENA+KyQS2Hm3l+nBkh6vVH5AxDYPtzIxRQe N1Vg== 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=HPmPU/IPZMujqhjgqF3ovBGi7NkWBNCG5MxA59CMXOc=; b=LWAEQGlKB0Vb1LQDyz/ziT6o87dY0eVsEr7+MMZZ6OhB5BNg0L4b/nwAzYLM3vCtwl v5aRu5+LWyOCuc5m/cY5aCxb/lz7UoHFvpx9cTlVNBJa5PHCzA2grKwI0f0Bw0PiZyjz z3CMMGAInqwUn3nhG9PueqIDDpPQz8jN/u6AkteqIesLdz8AzNzftEhcaABx4kPhv0O7 mXJw0HRi46n/8TD1DyGGoJr1gywGkX4GpwrEZJICpERyisQbXUU8OlBuGY59W6s0z9mr JClSuFlMLAzwmssLp+bY4AgbCpkCdQbYl5KAgKhM83PlLE4RpN+rZY5QYanW3wY/deqH a8eg== X-Gm-Message-State: AOAM533sXPzjatMVgysUXYXVPU+/P73fVwcaV1fKbaJAiO3bME9/Tim2 XrbFtoynzFU863Qz9eOln5wkLA== X-Received: by 2002:a05:6638:306:: with SMTP id w6mr11459438jap.132.1627999270154; Tue, 03 Aug 2021 07:01:10 -0700 (PDT) Received: from presto.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id w7sm9456798iox.1.2021.08.03.07.01.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Aug 2021 07:01:09 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: bjorn.andersson@linaro.org, evgreen@chromium.org, cpratapa@codeaurora.org, subashab@codeaurora.org, elder@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 2/6] net: ipa: move version check for channel suspend/resume Date: Tue, 3 Aug 2021 09:00:59 -0500 Message-Id: <20210803140103.1012697-3-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210803140103.1012697-1-elder@linaro.org> References: <20210803140103.1012697-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Change the Boolean flags passed to __gsi_channel_start() and __gsi_channel_stop() so they represent whether the request is being made to implement suspend (versus stop) or resume (versus start). Then stop or start the channel for suspend/resume requests only if the hardware version indicates it should be done. Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) -- 2.27.0 diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index e143deddb7c09..5c5a2571d2faf 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -920,12 +920,13 @@ static void gsi_channel_program(struct gsi_channel *channel, bool doorbell) /* All done! */ } -static int __gsi_channel_start(struct gsi_channel *channel, bool start) +static int __gsi_channel_start(struct gsi_channel *channel, bool resume) { struct gsi *gsi = channel->gsi; int ret; - if (!start) + /* Prior to IPA v4.0 suspend/resume is not implemented by GSI */ + if (resume && gsi->version < IPA_VERSION_4_0) return 0; mutex_lock(&gsi->mutex); @@ -947,7 +948,7 @@ int gsi_channel_start(struct gsi *gsi, u32 channel_id) napi_enable(&channel->napi); gsi_irq_ieob_enable_one(gsi, channel->evt_ring_id); - ret = __gsi_channel_start(channel, true); + ret = __gsi_channel_start(channel, false); if (ret) { gsi_irq_ieob_disable_one(gsi, channel->evt_ring_id); napi_disable(&channel->napi); @@ -971,7 +972,7 @@ static int gsi_channel_stop_retry(struct gsi_channel *channel) return ret; } -static int __gsi_channel_stop(struct gsi_channel *channel, bool stop) +static int __gsi_channel_stop(struct gsi_channel *channel, bool suspend) { struct gsi *gsi = channel->gsi; int ret; @@ -979,7 +980,8 @@ static int __gsi_channel_stop(struct gsi_channel *channel, bool stop) /* Wait for any underway transactions to complete before stopping. */ gsi_channel_trans_quiesce(channel); - if (!stop) + /* Prior to IPA v4.0 suspend/resume is not implemented by GSI */ + if (suspend && gsi->version < IPA_VERSION_4_0) return 0; mutex_lock(&gsi->mutex); @@ -997,7 +999,7 @@ int gsi_channel_stop(struct gsi *gsi, u32 channel_id) struct gsi_channel *channel = &gsi->channel[channel_id]; int ret; - ret = __gsi_channel_stop(channel, true); + ret = __gsi_channel_stop(channel, false); if (ret) return ret; @@ -1032,8 +1034,7 @@ int gsi_channel_suspend(struct gsi *gsi, u32 channel_id) struct gsi_channel *channel = &gsi->channel[channel_id]; int ret; - /* Prior to IPA v4.0 suspend/resume is not implemented by GSI */ - ret = __gsi_channel_stop(channel, gsi->version >= IPA_VERSION_4_0); + ret = __gsi_channel_stop(channel, true); if (ret) return ret; @@ -1048,8 +1049,7 @@ int gsi_channel_resume(struct gsi *gsi, u32 channel_id) { struct gsi_channel *channel = &gsi->channel[channel_id]; - /* Prior to IPA v4.0 suspend/resume is not implemented by GSI */ - return __gsi_channel_start(channel, gsi->version >= IPA_VERSION_4_0); + return __gsi_channel_start(channel, true); } /** From patchwork Tue Aug 3 14:01:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 490954 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp677249jap; Tue, 3 Aug 2021 07:01:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyx9BDKxyMHhjgZm8qMd5qJf7Lswh/xdHynyxpItDvhAYcPDvE3e386esjuu9OZKA1ZUtjd X-Received: by 2002:a05:6e02:1a67:: with SMTP id w7mr464484ilv.175.1627999288346; Tue, 03 Aug 2021 07:01:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627999288; cv=none; d=google.com; s=arc-20160816; b=gRaHnrlNEe9Rlr+HodDgO7C0ZPzQLF9QLGAi9Xdi6ptLGjCvoeKloyiN65iCqG4IYc W+u2fwDXsl2DDU9bxa5qPBHcLEVheV9duqGiArjz9IvI4Iv/aU4kDNGgFefQXxu20OHN WEQ5d+6kAZdN7jNlnaFtoloEn4i+/wicZMb0RwXbZGlHyvR8ssO6TG0Lzwd7rRdoeaUk qap/irs6FeadkWynbyBtUTPJHzqq+7MK2kmybri3Z0QDCvTpUhodL0bi3147TBTpIOhf egHkRY4pKfA17TMvDx1kl8bg/GtawIKDliGRaFSB3j7mGSnyPiBxZnLbBecEfLORektb vo7A== 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=jTGvfFyrFctJIWi/cCKby6tPrdVdtZKue9ulwhsCP2w=; b=izaqWj37EOqhv72pQ9orF47LkY0D/Wg+drhuV0v+A8Uc7Fbca3QQXkT/mpI5JDeEor FPnkzegeBZgM2aRd02VC2+p9MLGHpGX9AgDDESlLnMqZULnD2WU4m/Nztinv5gvOCl0n mk1R7ksPnqNzyH35oXXQLzsz9R3dEeU3lzKR+sg03hQidJE1JVopRMsnGnPYaxWa6uga QyUySWxIkrNAksS83QlshQKK7bgIkpZkOFIFl/tc4AvpEmGRalWiyGabnJnbG71P7Hmk N/3JUTu1ft2h9vIzj2LP3Lf0T71Gvervkku65s0qo1B06w7E0UDRcofvWgGgIAUb17iR nD4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="H5/W9PO4"; 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 e16si17170049ils.75.2021.08.03.07.01.28; Tue, 03 Aug 2021 07:01:28 -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="H5/W9PO4"; 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 S236533AbhHCOBf (ORCPT + 8 others); Tue, 3 Aug 2021 10:01:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236436AbhHCOBW (ORCPT ); Tue, 3 Aug 2021 10:01:22 -0400 Received: from mail-il1-x132.google.com (mail-il1-x132.google.com [IPv6:2607:f8b0:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9CEDC061798 for ; Tue, 3 Aug 2021 07:01:11 -0700 (PDT) Received: by mail-il1-x132.google.com with SMTP id a14so19587464ila.1 for ; Tue, 03 Aug 2021 07:01:11 -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=jTGvfFyrFctJIWi/cCKby6tPrdVdtZKue9ulwhsCP2w=; b=H5/W9PO44intcwnyeGgl/bJL25N3vDbYZSSweM7vIW9mVsNmi9JwcZ/PRsBLsRjCOH N3C3/GrK/SY/qgWjtnig6HjSHPU2ZA5f2Q5DHzPkZZP/47ljq2DEOBm06vWu3iwgufsE mAH6AehWcXX8aQQ6xQosMSTkCw1H3tnme1XtqCs9ablEtqn0JFVI1ZEKigvLhlMeN1MO I1m6mK4WY+z3kTf29KCsszdQYcKMszPjK/DmqyzP/SfN2OxBKBKHWUTnZTuydYFUg4N/ 897L9rsMtRJrjbhg7NleGS9Nwe7arcsYExqFRtamM0P0vvr9SYqjpdBa3Z8tn+SgiJOx 8pEA== 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=jTGvfFyrFctJIWi/cCKby6tPrdVdtZKue9ulwhsCP2w=; b=hmrEZvYpbwWiW275Yi9Su7aoszFIXnjnaCXN5Nuxscv6Igh5BBFuLkzu7lnOirdj7A X8jU8YMTGAmGuKUh35OkrfsaFlgjkHTyGfC9jZcpQkGb9SCbKKELugPe3WM2H2lpeKl5 iEFnbXS3bT5nBrwY2ZM2HY22x3r6fq5OG2nSu/DTBduXeZDNpC4Rm5DKi66MNRY0PyHk hPtx0qrRFbqQ0RFcOUfeapXh4iN2Si/celfWWehhqInjYDoiYGMjLT7NDsajYVXxc7mK UcGhyKE216037sTTvhCF5lB46vhXBoLoJYYtn1FBlJbif3dn2AiSFTrCOUDtTF0AvkUy dZ4w== X-Gm-Message-State: AOAM533DIZbCdIgnZQTvWYfQ0dxkuEbQHTttta6zTbsstP841Y+CDO0x I2FObqUIsCEUEL9lds6GogNS7w== X-Received: by 2002:a92:cd50:: with SMTP id v16mr736836ilq.141.1627999271035; Tue, 03 Aug 2021 07:01:11 -0700 (PDT) Received: from presto.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id w7sm9456798iox.1.2021.08.03.07.01.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Aug 2021 07:01:10 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: bjorn.andersson@linaro.org, evgreen@chromium.org, cpratapa@codeaurora.org, subashab@codeaurora.org, elder@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 3/6] net: ipa: move some GSI setup functions Date: Tue, 3 Aug 2021 09:01:00 -0500 Message-Id: <20210803140103.1012697-4-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210803140103.1012697-1-elder@linaro.org> References: <20210803140103.1012697-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Move gsi_irq_setup() and gsi_ring_setup() so they're defined right above gsi_setup() where they're called. This is a trivial movement of code to prepare for upcoming patches. Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.c | 142 +++++++++++++++++++++--------------------- 1 file changed, 71 insertions(+), 71 deletions(-) -- 2.27.0 diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index 5c5a2571d2faf..a5d23a2837cb6 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -198,77 +198,6 @@ static void gsi_irq_type_disable(struct gsi *gsi, enum gsi_irq_type_id type_id) gsi_irq_type_update(gsi, gsi->type_enabled_bitmap & ~BIT(type_id)); } -/* Turn off all GSI interrupts initially; there is no gsi_irq_teardown() */ -static void gsi_irq_setup(struct gsi *gsi) -{ - /* Disable all interrupt types */ - gsi_irq_type_update(gsi, 0); - - /* Clear all type-specific interrupt masks */ - iowrite32(0, gsi->virt + GSI_CNTXT_SRC_CH_IRQ_MSK_OFFSET); - iowrite32(0, gsi->virt + GSI_CNTXT_SRC_EV_CH_IRQ_MSK_OFFSET); - iowrite32(0, gsi->virt + GSI_CNTXT_GLOB_IRQ_EN_OFFSET); - iowrite32(0, gsi->virt + GSI_CNTXT_SRC_IEOB_IRQ_MSK_OFFSET); - - /* The inter-EE interrupts are not supported for IPA v3.0-v3.1 */ - if (gsi->version > IPA_VERSION_3_1) { - u32 offset; - - /* These registers are in the non-adjusted address range */ - offset = GSI_INTER_EE_SRC_CH_IRQ_MSK_OFFSET; - iowrite32(0, gsi->virt_raw + offset); - offset = GSI_INTER_EE_SRC_EV_CH_IRQ_MSK_OFFSET; - iowrite32(0, gsi->virt_raw + offset); - } - - iowrite32(0, gsi->virt + GSI_CNTXT_GSI_IRQ_EN_OFFSET); -} - -/* Get # supported channel and event rings; there is no gsi_ring_teardown() */ -static int gsi_ring_setup(struct gsi *gsi) -{ - struct device *dev = gsi->dev; - u32 count; - u32 val; - - if (gsi->version < IPA_VERSION_3_5_1) { - /* No HW_PARAM_2 register prior to IPA v3.5.1, assume the max */ - gsi->channel_count = GSI_CHANNEL_COUNT_MAX; - gsi->evt_ring_count = GSI_EVT_RING_COUNT_MAX; - - return 0; - } - - val = ioread32(gsi->virt + GSI_GSI_HW_PARAM_2_OFFSET); - - count = u32_get_bits(val, NUM_CH_PER_EE_FMASK); - if (!count) { - dev_err(dev, "GSI reports zero channels supported\n"); - return -EINVAL; - } - if (count > GSI_CHANNEL_COUNT_MAX) { - dev_warn(dev, "limiting to %u channels; hardware supports %u\n", - GSI_CHANNEL_COUNT_MAX, count); - count = GSI_CHANNEL_COUNT_MAX; - } - gsi->channel_count = count; - - count = u32_get_bits(val, NUM_EV_PER_EE_FMASK); - if (!count) { - dev_err(dev, "GSI reports zero event rings supported\n"); - return -EINVAL; - } - if (count > GSI_EVT_RING_COUNT_MAX) { - dev_warn(dev, - "limiting to %u event rings; hardware supports %u\n", - GSI_EVT_RING_COUNT_MAX, count); - count = GSI_EVT_RING_COUNT_MAX; - } - gsi->evt_ring_count = count; - - return 0; -} - /* Event ring commands are performed one at a time. Their completion * is signaled by the event ring control GSI interrupt type, which is * only enabled when we issue an event ring command. Only the event @@ -1878,6 +1807,77 @@ static void gsi_channel_teardown(struct gsi *gsi) gsi_irq_disable(gsi); } +/* Turn off all GSI interrupts initially; there is no gsi_irq_teardown() */ +static void gsi_irq_setup(struct gsi *gsi) +{ + /* Disable all interrupt types */ + gsi_irq_type_update(gsi, 0); + + /* Clear all type-specific interrupt masks */ + iowrite32(0, gsi->virt + GSI_CNTXT_SRC_CH_IRQ_MSK_OFFSET); + iowrite32(0, gsi->virt + GSI_CNTXT_SRC_EV_CH_IRQ_MSK_OFFSET); + iowrite32(0, gsi->virt + GSI_CNTXT_GLOB_IRQ_EN_OFFSET); + iowrite32(0, gsi->virt + GSI_CNTXT_SRC_IEOB_IRQ_MSK_OFFSET); + + /* The inter-EE interrupts are not supported for IPA v3.0-v3.1 */ + if (gsi->version > IPA_VERSION_3_1) { + u32 offset; + + /* These registers are in the non-adjusted address range */ + offset = GSI_INTER_EE_SRC_CH_IRQ_MSK_OFFSET; + iowrite32(0, gsi->virt_raw + offset); + offset = GSI_INTER_EE_SRC_EV_CH_IRQ_MSK_OFFSET; + iowrite32(0, gsi->virt_raw + offset); + } + + iowrite32(0, gsi->virt + GSI_CNTXT_GSI_IRQ_EN_OFFSET); +} + +/* Get # supported channel and event rings; there is no gsi_ring_teardown() */ +static int gsi_ring_setup(struct gsi *gsi) +{ + struct device *dev = gsi->dev; + u32 count; + u32 val; + + if (gsi->version < IPA_VERSION_3_5_1) { + /* No HW_PARAM_2 register prior to IPA v3.5.1, assume the max */ + gsi->channel_count = GSI_CHANNEL_COUNT_MAX; + gsi->evt_ring_count = GSI_EVT_RING_COUNT_MAX; + + return 0; + } + + val = ioread32(gsi->virt + GSI_GSI_HW_PARAM_2_OFFSET); + + count = u32_get_bits(val, NUM_CH_PER_EE_FMASK); + if (!count) { + dev_err(dev, "GSI reports zero channels supported\n"); + return -EINVAL; + } + if (count > GSI_CHANNEL_COUNT_MAX) { + dev_warn(dev, "limiting to %u channels; hardware supports %u\n", + GSI_CHANNEL_COUNT_MAX, count); + count = GSI_CHANNEL_COUNT_MAX; + } + gsi->channel_count = count; + + count = u32_get_bits(val, NUM_EV_PER_EE_FMASK); + if (!count) { + dev_err(dev, "GSI reports zero event rings supported\n"); + return -EINVAL; + } + if (count > GSI_EVT_RING_COUNT_MAX) { + dev_warn(dev, + "limiting to %u event rings; hardware supports %u\n", + GSI_EVT_RING_COUNT_MAX, count); + count = GSI_EVT_RING_COUNT_MAX; + } + gsi->evt_ring_count = count; + + return 0; +} + /* Setup function for GSI. GSI firmware must be loaded and initialized */ int gsi_setup(struct gsi *gsi) { From patchwork Tue Aug 3 14:01:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 490955 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp677269jap; Tue, 3 Aug 2021 07:01:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwETJapMV48S+Lfz1MZhrMJ2Mca9U07sNIZoPqeOCtpz8t/VEjvE86OWdAvwJqlOdfX4jKZ X-Received: by 2002:a92:6809:: with SMTP id d9mr872966ilc.174.1627999289594; Tue, 03 Aug 2021 07:01:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627999289; cv=none; d=google.com; s=arc-20160816; b=hLu6Me9Bp1HaDK2hZisVbBo+JaVoj0CK3/srhTGOrnamkLR3XDc671znzMJuH2udYA +dWCpJQcnDAFzhLdpNhTkhHbTCc7+Shf9c6hwzX7fU6xTPmsttnWjARA7/W7IiroFg1Z 5PxxDdbYxvYHABxURHN5l5DUhG+vsni08aC41HYBR9tOEcDpmTGNFz/o980mXB/LsRY/ F06Nx2nMbrUiBrHucEqeztv236Q8fSf/3Z/oOyUOLy1JhM9uHXSXdyJ46UA/kXRn289t /h5Hh5ggSVC19KHQGGXVE/B0Bvu/CQzlKLqmY+WXJgMnvfwONnUain7ZIQlpSvoip7SC 1cbQ== 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=PtQLPSseXwgcXWxbV0GTVE8n9SJgEFIFbxs9fZ84aRA=; b=QRSAVWGu+HCwUldzeaG50/epzmF9UjEam+lfbVw2a1R5HRopS6BhUXRN1dvRWkh47c uOGI5b5Zd/YUMd1VDFDS4V6E/4UNsB3e5AbreQFMUTgIQyDk/77ndzaumUVBRp8CjuF3 hMW/yhsfJVpd41ITEJM/uI65uY7fwSqPalMNFbxf5udwy5W5VhAcGZu7xkTi/PY7coc9 0uQmV6/n2VnehOkgrMRP4rkZRmv6Mx6n84uOvgvGFqDc02kP2884rxehlTExaZ4WwGJY ZorTZzZrFhyCKqDVB1lAqmNC4r6g4fqvklSJNuk+JSgxLl5m0eK6S138MR98IqaO0ppx mxiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wbylETv5; 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 e16si17170049ils.75.2021.08.03.07.01.29; Tue, 03 Aug 2021 07:01:29 -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=wbylETv5; 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 S236562AbhHCOBi (ORCPT + 8 others); Tue, 3 Aug 2021 10:01:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236386AbhHCOBX (ORCPT ); Tue, 3 Aug 2021 10:01:23 -0400 Received: from mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB105C0613D5 for ; Tue, 3 Aug 2021 07:01:12 -0700 (PDT) Received: by mail-io1-xd29.google.com with SMTP id r6so16080068ioj.8 for ; Tue, 03 Aug 2021 07:01:12 -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=PtQLPSseXwgcXWxbV0GTVE8n9SJgEFIFbxs9fZ84aRA=; b=wbylETv5vnvmDPaVcbGsCeoWhKCZAnyQ+225qyafuZslTvRqdGl6+217DdQjaX5Re+ 4M7TDRY3ZzAvBuQ2BFgyCkEmyV+KZ1/tf2CQADMisFgIJG8v0M7BfFFbRgDuCO2iFT0v LZLgn0GlO/0MhUnr/Pm+F8GJdA3WswI41knmUxJNcu9DL0fcZqtpH74AyvfwOnzRCDM8 2zX9XitaX7598xTk+VI+Ac6jKeKb0X9UtvEDXhbXxdtw5D3CoCsy7QG/ffjzrHtBWMfx QJ20gzCpK1b9pcQTUGINyK+DBwSHX7TKu/8VTk7Q7t3ekUfdRrNnv5VkIzTI5QLRd2Ss dz8Q== 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=PtQLPSseXwgcXWxbV0GTVE8n9SJgEFIFbxs9fZ84aRA=; b=BYr/uteUguisRztBXtTcntR8TASkotOup3rarARamHmfLqriq6dCkfNCqDzShLYaxA 6qvhEHSNmRGOCqHh0Po31FH7MmehI9GCCn9BvsvH1xn67fik6oqdIYGwT5/le6/EmDWA OMeFi58du7j7GxmASaSVEdJQSH1jcjpdx5PiLSIpulw5Jyv6YALvoSRakW3nMtayHn+m FslTVVpfKlv+MendoE8+vkEYBD+o/AbGj9oHw0mWUGPYikmg3lMiIrF6ZumbegGp3y87 zTWSbiWGtNcCngBuZE9M4W1qXpFmuR49yA8aE0tWnNiGWfT8diRYLZI3lGf26Bo7Xsi6 4pjA== X-Gm-Message-State: AOAM531FcRc4glHr9ujfNOiD4AqpdNC84c0ZYb4s4HMYdDatwIJqWHa2 yQ0mL5gpfYA0E/umXWBvJs589A== X-Received: by 2002:a5e:d905:: with SMTP id n5mr1145832iop.136.1627999272164; Tue, 03 Aug 2021 07:01:12 -0700 (PDT) Received: from presto.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id w7sm9456798iox.1.2021.08.03.07.01.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Aug 2021 07:01:11 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: bjorn.andersson@linaro.org, evgreen@chromium.org, cpratapa@codeaurora.org, subashab@codeaurora.org, elder@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 4/6] net: ipa: have gsi_irq_setup() return an error code Date: Tue, 3 Aug 2021 09:01:01 -0500 Message-Id: <20210803140103.1012697-5-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210803140103.1012697-1-elder@linaro.org> References: <20210803140103.1012697-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Change gsi_irq_setup() so it returns an error value, and introduce gsi_irq_teardown() as its inverse. Set the interrupt type (IRQ rather than MSI) in gsi_irq_setup(). Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.c | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) -- 2.27.0 diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index a5d23a2837cb6..be069d7c4feb9 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -1807,9 +1807,12 @@ static void gsi_channel_teardown(struct gsi *gsi) gsi_irq_disable(gsi); } -/* Turn off all GSI interrupts initially; there is no gsi_irq_teardown() */ -static void gsi_irq_setup(struct gsi *gsi) +/* Turn off all GSI interrupts initially */ +static int gsi_irq_setup(struct gsi *gsi) { + /* Writing 1 indicates IRQ interrupts; 0 would be MSI */ + iowrite32(1, gsi->virt + GSI_CNTXT_INTSET_OFFSET); + /* Disable all interrupt types */ gsi_irq_type_update(gsi, 0); @@ -1831,6 +1834,12 @@ static void gsi_irq_setup(struct gsi *gsi) } iowrite32(0, gsi->virt + GSI_CNTXT_GSI_IRQ_EN_OFFSET); + + return 0; +} + +static void gsi_irq_teardown(struct gsi *gsi) +{ } /* Get # supported channel and event rings; there is no gsi_ring_teardown() */ @@ -1891,25 +1900,34 @@ int gsi_setup(struct gsi *gsi) return -EIO; } - gsi_irq_setup(gsi); /* No matching teardown required */ + ret = gsi_irq_setup(gsi); + if (ret) + return ret; ret = gsi_ring_setup(gsi); /* No matching teardown required */ if (ret) - return ret; + goto err_irq_teardown; /* Initialize the error log */ iowrite32(0, gsi->virt + GSI_ERROR_LOG_OFFSET); - /* Writing 1 indicates IRQ interrupts; 0 would be MSI */ - iowrite32(1, gsi->virt + GSI_CNTXT_INTSET_OFFSET); + ret = gsi_channel_setup(gsi); + if (ret) + goto err_irq_teardown; - return gsi_channel_setup(gsi); + return 0; + +err_irq_teardown: + gsi_irq_teardown(gsi); + + return ret; } /* Inverse of gsi_setup() */ void gsi_teardown(struct gsi *gsi) { gsi_channel_teardown(gsi); + gsi_irq_teardown(gsi); } /* Initialize a channel's event ring */ From patchwork Tue Aug 3 14:01:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 490956 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp677291jap; Tue, 3 Aug 2021 07:01:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzExrS7Da6Yyx22niNlYzs57Ns3ckLWS1PhbSnkGR4g1pFVTt6mGiFaUvoY+2SnOqed15A0 X-Received: by 2002:a5d:858d:: with SMTP id f13mr55439ioj.197.1627999290814; Tue, 03 Aug 2021 07:01:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627999290; cv=none; d=google.com; s=arc-20160816; b=vkJlKoGRmUT6ak2jy93K1LXAu0h35UJkYKKrwETEls85pjsWZN4q6+zVI34RmKHy7V sM1f62EjDtLlqTQjecrs8YVHXUhyAMedOkTc1zCmJ87ERhaf8TbIQ4wQuBpOqk3/HR2G g436Tyo4MTzoS4DIemL/AbwCofC1+Nv1cJiUm+RKkf/y7iMcY7+hTgU1fcdbM0HaRmEC P94HyT94HcU0zyX9leePOcp3/Hl/SOkLkwkJVEXpfFX5XX76amzolrjCHye43jeMNKcP G1F5UHl5i7AwR/NRjwk0ZTkOiTcDE7zcTx2Scur/OKQ8D9apvRVkt9gDoRuunQl+MpaW DYRg== 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=+yxvUAjlQXeGYAgTSezvFwBfFS0lHATudjbMDmfcOIk=; b=pZGpKxlRNqC0tI1II2Hr+PgG9GCjJTm9LPRh3lGJ3Oo2VvhdXQt/N8C01xHsyhB3YT rTSPwkke3cZ7p4+Z1Abacjrw9Z/BB17FF6b6F654I1MpslQwQJiOZE3Mpudm/xKdTgw9 o6TaqJFLEAk+ZuwAtHR87ocBA7kpztxmLCpGok6jMGXHfxj1X1ZhaYwD6VHvjL4Q+GXV w9w7OCm0Z96bmIE7cIJAYa+g5aHPc2IE/TdKbQUyj5BdE89b47zrRJrTvK+ZvvNeeHDX cmKsREhtV9G/LrYBwgFeI62MHGHmqFZwA9qvacLkl4Md1PoISG8qD1vwnxsdhJwrkMkU wjYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Dm3YNwsg; 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 e16si17170049ils.75.2021.08.03.07.01.30; Tue, 03 Aug 2021 07:01:30 -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=Dm3YNwsg; 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 S236503AbhHCOBj (ORCPT + 8 others); Tue, 3 Aug 2021 10:01:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236464AbhHCOBY (ORCPT ); Tue, 3 Aug 2021 10:01:24 -0400 Received: from mail-il1-x12f.google.com (mail-il1-x12f.google.com [IPv6:2607:f8b0:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CC84C061757 for ; Tue, 3 Aug 2021 07:01:13 -0700 (PDT) Received: by mail-il1-x12f.google.com with SMTP id i13so7659682ilm.11 for ; Tue, 03 Aug 2021 07:01:13 -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=+yxvUAjlQXeGYAgTSezvFwBfFS0lHATudjbMDmfcOIk=; b=Dm3YNwsg0N6z7fNUXisHxsWrxCpPda9PcrAhzw44fFqIANO0//ygJq53XY6I+9mQhh xhl7BFHEVuHuwcg+lp8btAUOn0bTwn6wUA04Cw9zdDWKjTchYP5bN91bKBP4NTcqWxQv v2MI64FvF+QEo2xolfDQoqt0tknzL7PsBS7lFdfmtSBZWYbTkuSxYE7OdxV79cvAqWFb sziAz2oc6Oz2ynfV/SbC5Tepm1URTx6zcJMNBjsPakXllAAZur1wy3FlGZPENoIuuY81 nPiBJNuwIs0A170yiZtrzIaxgOMK2D/izOxyJIe5YSbUGJcwFLz//HrbTKUWfS4fzPlh Pwsw== 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=+yxvUAjlQXeGYAgTSezvFwBfFS0lHATudjbMDmfcOIk=; b=dZV2MIrMPFGzEya1OW5XE/fiZZewTRzEu3fDqRjG+5BwTpJfIY3WOjJV6WNwWe+ope oNYQeXLn2S737isHrbkqQrmL+NtkfL7Png0tXftQzMrNt5v519lTtjn2U+5xioTLg2cj JJne7vhfxyIR5Hox+dhhqoNeHbQ7lm/FsX12jguxTK7+gSuNhmfMl8kWklBmsL9+JcNB B3/s3NjoEAWv5AxH9lYexj88mrgCcz3hVENbKmz7bKmg/rAEaKKYyI4ysXkxcUtqedZV 3R/TKkjQdRHEIWrFlWoktJ58WWAvtcUl+CiYBF/yWAd0LQT57mFhRAHp1z2D5t3dt/C8 wU+w== X-Gm-Message-State: AOAM533PWwef2YMG2bFyRkuJH9/xn4IrHc9RDWvikUZA39dedVNKmxce kl/+bdUgrLdsC6fOAZMnnv23LsahlATWTQ== X-Received: by 2002:a92:ca45:: with SMTP id q5mr778759ilo.7.1627999273004; Tue, 03 Aug 2021 07:01:13 -0700 (PDT) Received: from presto.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id w7sm9456798iox.1.2021.08.03.07.01.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Aug 2021 07:01:12 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: bjorn.andersson@linaro.org, evgreen@chromium.org, cpratapa@codeaurora.org, subashab@codeaurora.org, elder@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 5/6] net: ipa: move gsi_irq_init() code into setup Date: Tue, 3 Aug 2021 09:01:02 -0500 Message-Id: <20210803140103.1012697-6-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210803140103.1012697-1-elder@linaro.org> References: <20210803140103.1012697-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The GSI IRQ handler could be triggered as soon as it is registered with request_irq(). The handler function, gsi_isr(), touches hardware, meaning the IPA clock must be operational. The IPA clock is not operating when the handler is registered (in gsi_irq_init()), so this is a problem. Move the call to request_irq() for the GSI interrupt handler into gsi_irq_setup(), which is called when the IPA clock is known to be operational (and furthermore, the GSI firmware will have been loaded). Request the IRQ at the end of that function, after all interrupt types have been disabled and masked. Move the matching free_irq() call into gsi_irq_teardown(), and get rid of the now empty gsi_irq_exit(), Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.c | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) -- 2.27.0 diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index be069d7c4feb9..c555ccd778bb8 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -1303,33 +1303,20 @@ static irqreturn_t gsi_isr(int irq, void *dev_id) return IRQ_HANDLED; } +/* Init function for GSI IRQ lookup; there is no gsi_irq_exit() */ static int gsi_irq_init(struct gsi *gsi, struct platform_device *pdev) { - struct device *dev = &pdev->dev; - unsigned int irq; int ret; ret = platform_get_irq_byname(pdev, "gsi"); if (ret <= 0) return ret ? : -EINVAL; - irq = ret; - - ret = request_irq(irq, gsi_isr, 0, "gsi", gsi); - if (ret) { - dev_err(dev, "error %d requesting \"gsi\" IRQ\n", ret); - return ret; - } - gsi->irq = irq; + gsi->irq = ret; return 0; } -static void gsi_irq_exit(struct gsi *gsi) -{ - free_irq(gsi->irq, gsi); -} - /* Return the transaction associated with a transfer completion event */ static struct gsi_trans *gsi_event_trans(struct gsi_channel *channel, struct gsi_event *event) @@ -1810,6 +1797,8 @@ static void gsi_channel_teardown(struct gsi *gsi) /* Turn off all GSI interrupts initially */ static int gsi_irq_setup(struct gsi *gsi) { + int ret; + /* Writing 1 indicates IRQ interrupts; 0 would be MSI */ iowrite32(1, gsi->virt + GSI_CNTXT_INTSET_OFFSET); @@ -1835,11 +1824,16 @@ static int gsi_irq_setup(struct gsi *gsi) iowrite32(0, gsi->virt + GSI_CNTXT_GSI_IRQ_EN_OFFSET); - return 0; + ret = request_irq(gsi->irq, gsi_isr, 0, "gsi", gsi); + if (ret) + dev_err(gsi->dev, "error %d requesting \"gsi\" IRQ\n", ret); + + return ret; } static void gsi_irq_teardown(struct gsi *gsi) { + free_irq(gsi->irq, gsi); } /* Get # supported channel and event rings; there is no gsi_ring_teardown() */ @@ -2224,20 +2218,18 @@ int gsi_init(struct gsi *gsi, struct platform_device *pdev, init_completion(&gsi->completion); - ret = gsi_irq_init(gsi, pdev); + ret = gsi_irq_init(gsi, pdev); /* No matching exit required */ if (ret) goto err_iounmap; ret = gsi_channel_init(gsi, count, data); if (ret) - goto err_irq_exit; + goto err_iounmap; mutex_init(&gsi->mutex); return 0; -err_irq_exit: - gsi_irq_exit(gsi); err_iounmap: iounmap(gsi->virt_raw); @@ -2249,7 +2241,6 @@ void gsi_exit(struct gsi *gsi) { mutex_destroy(&gsi->mutex); gsi_channel_exit(gsi); - gsi_irq_exit(gsi); iounmap(gsi->virt_raw); } From patchwork Tue Aug 3 14:01:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 490957 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp677311jap; Tue, 3 Aug 2021 07:01:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvoRh/SHgf7fN1GvqWiPTrcFDotPC9cOFXUJopxl57cRm5Hj40sJ29hyuQGJqE237yKwYy X-Received: by 2002:a92:c746:: with SMTP id y6mr2271248ilp.211.1627999292098; Tue, 03 Aug 2021 07:01:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627999292; cv=none; d=google.com; s=arc-20160816; b=F52vA8Y5nqCC+k1mFWGmxjbPuOwe12whvX/HsKn7BXAQFEgOrdvZRaHTKCuC5JUjkn favw3QdfI1ajxp1G10KW12lQn0lJF3iCQhN+T3VTQBAdJ/46gKqv9TasA6PqlBo0wO6n tODv4BhY/XcPZnRub4ZhYChSXifE7VuRWXk5VCL9gW6WlJ6waA/Aw4jDEtIglV+cC+5g BLDPLKk3RbhiPaOC+jtJVfVz9caycgiYoXdHaF4S448kHm+6ESTb/HyEmKeI3hxdGiIc XEvhUE7cJKcC3x6Zzb/z1C0PglBAalHJOda1Mv+pXABnWC8eJS9E6RxeaAFF6cowfq6+ 5FUA== 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=9xgFJ2O3o+xh8TRsR9/dwHZ0i0/DPfaZ/VOsIjzUQQc=; b=m0G1ZZem8KVPm+4FNPfL5tUKYLoqL6SWuTBqT6loD54I2zKN3IXQCfC4/coVy+a000 rvLKReAGbaPs7kiZ/tguooFbz21FD6sJzSw1XvbKgYsIFhS0hNA1QuJeioGezi5WHK4M jKRL0RIuVXdVYsINoG+UoAd1pTi0N+Nj7nI3qGk7/fQFdBu6cZEDDoyMLrTTBDmAr2OU bWf4BCQ49AcKZH/OS5BplStPU5kps4j67DIAcuWzqPrD4o6UQe8Fb/RhwHofn+bxt2k9 ADwm4WUFfu2i9MGkHtN37SObQLNW7WF+WySWtQTX6MOS5ZL0OUpJctNCnNPDPMJZeiLi MR8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pJQoaQvV; 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 e16si17170049ils.75.2021.08.03.07.01.31; Tue, 03 Aug 2021 07:01:32 -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=pJQoaQvV; 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 S236590AbhHCOBl (ORCPT + 8 others); Tue, 3 Aug 2021 10:01:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236479AbhHCOB0 (ORCPT ); Tue, 3 Aug 2021 10:01:26 -0400 Received: from mail-io1-xd36.google.com (mail-io1-xd36.google.com [IPv6:2607:f8b0:4864:20::d36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FE6FC061799 for ; Tue, 3 Aug 2021 07:01:14 -0700 (PDT) Received: by mail-io1-xd36.google.com with SMTP id h1so24360434iol.9 for ; Tue, 03 Aug 2021 07:01:14 -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=9xgFJ2O3o+xh8TRsR9/dwHZ0i0/DPfaZ/VOsIjzUQQc=; b=pJQoaQvVUn3JNlOc3qa2UNUQeOtRG3JUgNv/NUMugpxH7VOCBRVsXw2QXW8JFkRbep gW0cSP5UpfReiKlli569aEtyPVKy9j5i8/plWbXFvUvrUiXjtHaX9gHZi9rGCsVLHUjT acSJqMXURRPcsfTw/oPUtjZ+7mgPMun8ikMCEdVkKqx2Wne9jgZ3pIZwDGmEEnucwed5 FHHbK+kcZv5FyrEx8XmXUA8bnt9ERQHwN6IanyDdgwWo0tP3vVwPjk1BwbdL5e7ge4MR wSeKaUpJHTZ98PhIHORLybGkqDkWKC59jzXcX/rFTg6jApLk5AZdzpxajye0bk9lV1ip i22A== 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=9xgFJ2O3o+xh8TRsR9/dwHZ0i0/DPfaZ/VOsIjzUQQc=; b=Chuz1+dTmn3wP28El54HhrSHWl9BRu0r26WJo9u8RjUSNxSZ8RMBquD8qy1fZRHyoQ ahBfMWihkNIGk/13+E7t2WATaCiLcl8jWepvYnWec0ozENe2M7dGoIS24dtFSuSLCApH YLzZzoK16WL4F0LLgjincfTREbyslgE9E7GEePJNwvsuY7Jes5/7U4gnxqUGt79aw7di ZkGnw8Dx3rv2cXYVbr5ykq2Y6hHOLHKSqdFP5nyJWT/MxHNXx6XM6NHBiNr45R4AOrbP Y/WLVrVs6vdorZH8WzrU+MQm0QGZ88YsNe3ImM9ZDOhnE3oYR+zN49mPtMVG7WrXfa0A b1+Q== X-Gm-Message-State: AOAM533vJzH9txq+SnnbQJDOFHXErE+e11rp9EBeKImWhSSXBllhFVfd q790fCb65/KAcJyxKaUo6AukPA== X-Received: by 2002:a05:6602:1790:: with SMTP id y16mr2071136iox.12.1627999273887; Tue, 03 Aug 2021 07:01:13 -0700 (PDT) Received: from presto.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id w7sm9456798iox.1.2021.08.03.07.01.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Aug 2021 07:01:13 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: bjorn.andersson@linaro.org, evgreen@chromium.org, cpratapa@codeaurora.org, subashab@codeaurora.org, elder@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 6/6] net: ipa: disable GSI interrupts while suspended Date: Tue, 3 Aug 2021 09:01:03 -0500 Message-Id: <20210803140103.1012697-7-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210803140103.1012697-1-elder@linaro.org> References: <20210803140103.1012697-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Introduce new functions gsi_suspend() and gsi_resume(), which will disable the GSI interrupt handler after all endpoints are suspended and re-enable it before endpoints are resumed. This will ensure no GSI interrupt handler will fire when the hardware is suspended. Here's a little further explanation. There are seven GSI interrupt types, and most are disabled except when needed. - These two are not used (never enabled): GSI_INTER_EE_CH_CTRL GSI_INTER_EE_EV_CTRL - These two are only used to implement channel and event ring commands, and are only enabled while a command is underway: GSI_CH_CTRL GSI_EV_CTRL - The IEOB interrupt signals I/O completion. It will not fire when a channel is stopped (or "suspended"). GSI_IEOB - This interrupt is used to allocate or halt modem channels, and is only enabled while such a command is underway. GSI_GLOB_EE However it also is used to signal certain errors, and this could occur at any time. - The general interrupt signals general errors, and could occur at any time. GSI_GENERAL The purpose for this change is to ensure no global or general interrupts fire due to errors while the hardware is suspended. We enable the clock on resume, and at that time we can "handle" (at least report) these error conditions. Signed-off-by: Alex Elder --- drivers/net/ipa/gsi.c | 12 ++++++++++++ drivers/net/ipa/gsi.h | 12 ++++++++++++ drivers/net/ipa/ipa_main.c | 5 ++++- 3 files changed, 28 insertions(+), 1 deletion(-) -- 2.27.0 diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index c555ccd778bb8..a2fcdb1abdb96 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -981,6 +981,18 @@ int gsi_channel_resume(struct gsi *gsi, u32 channel_id) return __gsi_channel_start(channel, true); } +/* Prevent all GSI interrupts while suspended */ +void gsi_suspend(struct gsi *gsi) +{ + disable_irq(gsi->irq); +} + +/* Allow all GSI interrupts again when resuming */ +void gsi_resume(struct gsi *gsi) +{ + enable_irq(gsi->irq); +} + /** * gsi_channel_tx_queued() - Report queued TX transfers for a channel * @channel: Channel for which to report diff --git a/drivers/net/ipa/gsi.h b/drivers/net/ipa/gsi.h index 97163b58b4ebc..88b80dc3db79f 100644 --- a/drivers/net/ipa/gsi.h +++ b/drivers/net/ipa/gsi.h @@ -232,6 +232,18 @@ int gsi_channel_stop(struct gsi *gsi, u32 channel_id); */ void gsi_channel_reset(struct gsi *gsi, u32 channel_id, bool doorbell); +/** + * gsi_suspend() - Prepare the GSI subsystem for suspend + * @gsi: GSI pointer + */ +void gsi_suspend(struct gsi *gsi); + +/** + * gsi_resume() - Resume the GSI subsystem following suspend + * @gsi: GSI pointer + */ +void gsi_resume(struct gsi *gsi); + /** * gsi_channel_suspend() - Suspend a GSI channel * @gsi: GSI pointer diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c index 2e728d4914c82..ae51109dea01b 100644 --- a/drivers/net/ipa/ipa_main.c +++ b/drivers/net/ipa/ipa_main.c @@ -892,6 +892,7 @@ static int ipa_suspend(struct device *dev) if (ipa->setup_complete) { __clear_bit(IPA_FLAG_RESUMED, ipa->flags); ipa_endpoint_suspend(ipa); + gsi_suspend(&ipa->gsi); } ipa_clock_put(ipa); @@ -919,8 +920,10 @@ static int ipa_resume(struct device *dev) ipa_clock_get(ipa); /* Endpoints aren't usable until setup is complete */ - if (ipa->setup_complete) + if (ipa->setup_complete) { + gsi_resume(&ipa->gsi); ipa_endpoint_resume(ipa); + } return 0; }