From patchwork Tue Oct 6 21:30:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 299401 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1E533C3279D for ; Tue, 6 Oct 2020 21:31:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CFA9A20897 for ; Tue, 6 Oct 2020 21:31:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="JJREY7PR" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727527AbgJFVbA (ORCPT ); Tue, 6 Oct 2020 17:31:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727301AbgJFVa5 (ORCPT ); Tue, 6 Oct 2020 17:30:57 -0400 Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1B0BC0613D3 for ; Tue, 6 Oct 2020 14:30:57 -0700 (PDT) Received: by mail-io1-xd44.google.com with SMTP id k6so68624ior.2 for ; Tue, 06 Oct 2020 14:30:57 -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=qs9Gy3dxzM7xaThHwcW4AxTAzloEsG+6Jlaezs70FgI=; b=JJREY7PRIfXcfFUfrKQ0pV2ZtTzN3H1y28QrSUrmiP0RDxh0oUYkKafN6gCc2kfkqt R1kog4Sn/ZPdmKpcixk8bbWS0BvSd8JwPujsLgrNkOsvTadS5lf4gYitrKf8mKMgI6wh mriTtJa1fxhS1GQJyNLaar0GYQ8BATzhYFkS6tqiBEYWPiUj/Rj0yMqC19NRzBcEsvqP cL0qjX1KW27H4x865EIJOuaaA3luz+CMJAZUHYv5hYMTHji0wkNJ5HMvYFFpTKcT9KbI jTWM1Tdjb+HBuJmZWYLaLOam+2lBYPbENZxa/MAJdRG3ymw3o3qLER9rhM1mRuZcI0mH E0xQ== 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=qs9Gy3dxzM7xaThHwcW4AxTAzloEsG+6Jlaezs70FgI=; b=G+wJmMYPUvdHoXxjdeqX6KMgQtdpc9kNPgQ+dlxE4TiBRo87+H0UXL+/j4sF74YjfZ KNA84yKPL3CGO5cC2So1/eW5D1QGH8gDPWTXegm3pTHkyg3j3W8JVWoT+S+UwouXLU7u H2Yaca2wv6+6zskB0Z9LNYeWdvg/aT/50lykYtZKoEwE4Z0jt9hWQ6aTD0J5NT2jD6Fj qbGrB+fCUap73sAlyjZHaqwVEPqi3fBuMs4pMKbrbEFQ3twWAky3bTQnsuio/rKqN+eE FaiFm+2Id9D5U/ldQiPNt4r3wc4s4iILDLi34WZd7UNZvLdUJ1khpaOj590LZ3PBQE34 5ymg== X-Gm-Message-State: AOAM5304+j6eaEhU5ivgG7vy/flDTV0aDWfpN5jXC+FFmwOR4hPyRlL3 Qrnmg/Bk4t+PnXK9H9hkF8w1Lw== X-Google-Smtp-Source: ABdhPJzp6fzi8JE8LPCtdYy1WOfzLeWtA7+QJwd9ggA1EAXbQTtSt3ayQUIKQIXmN/8d0vwMu1mRCQ== X-Received: by 2002:a6b:9243:: with SMTP id u64mr2733135iod.197.1602019856978; Tue, 06 Oct 2020 14:30:56 -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 z20sm2043215ior.2.2020.10.06.14.30.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Oct 2020 14:30:56 -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, mka@chromium.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net 1/2] net: ipa: only clear hardware state if setup has completed Date: Tue, 6 Oct 2020 16:30:46 -0500 Message-Id: <20201006213047.31308-2-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201006213047.31308-1-elder@linaro.org> References: <20201006213047.31308-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org In the setup phase of initialization, GSI firmware gets loaded and initialized, and the AP command TX and default RX endpoints get set up. Until that happens, IPA commands must not be issued to the hardware. If the modem crashes, we stop endpoint channels and perform a number of other activities to clear modem-related IPA state, including zeroing filter and routing tables (using IPA commands). This is a bug if setup is not complete. We should also not be performing the other cleanup activity in that case either. Fix this by returning immediately when handling a modem crash if we haven't completed setup. Fixes: a646d6ec9098 ("soc: qcom: ipa: modem and microcontroller") Tested-by: Matthias Kaehlcke Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_modem.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ipa/ipa_modem.c b/drivers/net/ipa/ipa_modem.c index e34fe2d77324e..dd5b89c5cb2d4 100644 --- a/drivers/net/ipa/ipa_modem.c +++ b/drivers/net/ipa/ipa_modem.c @@ -285,6 +285,9 @@ static void ipa_modem_crashed(struct ipa *ipa) struct device *dev = &ipa->pdev->dev; int ret; + if (!ipa->setup_complete) + return; + ipa_endpoint_modem_pause_all(ipa, true); ipa_endpoint_modem_hol_block_clear_all(ipa); From patchwork Tue Oct 6 21:30:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 288918 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9BA0FC4363D for ; Tue, 6 Oct 2020 21:31:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3A7F5208B6 for ; Tue, 6 Oct 2020 21:31:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="fJ1d5oEd" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727566AbgJFVbI (ORCPT ); Tue, 6 Oct 2020 17:31:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727535AbgJFVbA (ORCPT ); Tue, 6 Oct 2020 17:31:00 -0400 Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C293C0613D4 for ; Tue, 6 Oct 2020 14:30:59 -0700 (PDT) Received: by mail-io1-xd44.google.com with SMTP id 67so25068iob.8 for ; Tue, 06 Oct 2020 14:30:59 -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=SeRQNuUdnOGTder7Ky3iLwHcr5kl6r9wzx3ytZhXRHM=; b=fJ1d5oEdTTRDoZEZYc7+uJD9E26J1Ulv2STtWruQ/rVOpCh8/JQoD7CeGhsVDMUUzq vWmfmY+74UnmgTAVJ/cAhw7QTP1Y48rz5/yZE+HIviCHEu+NKvrfmDMQLFmveT3isahZ iX8we2w3S6LOpPexhnjQK8dWXziqzgTAn2FB+y/74qTiRdhKCLzeFFGrISK9B83XIwrn rRlBZUmnvFVFuSXXTnaKd55jKDSxP/hqVxA4ZlWQCps3BazpNfdmmnx5Al9AF6j5HPJB iHaZiDgnrGi8Vn4pFZhS0uUUEKkjiSCECvP9HvvmzlGgf4Lp9M714NlzDU+CG1UqLZZf UVKw== 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=SeRQNuUdnOGTder7Ky3iLwHcr5kl6r9wzx3ytZhXRHM=; b=dBYPr8CELO6wyfG4rDUy7SGHIEvIq/dC0UMoGDiYBJThYOSQcthDF4Cu7x3ZmZS4aD k2KJnOVpBfIq4h2zcy4qAYfNuYF0QbL51PKBiG8dNcPnx90nQJMGwwF59qGuR3ZdN7Bc MBGEbzck9X5MBu27Ax/3L06WLKgspb1eo5SJByGiJT4vxO214zfi+wDq2KRKrnSfRLMP /ylpAz/0Obd7OVy8zsTeoGWKj48bsRfonJ++13yO7p4oqxpDbH1vGcy7p61UUFjuWlI8 AKBPbkvKuT96cKD6Gh5Jsp+m/f5Wll+IX4E31Dalep99nXjSMu8Gdx2H0sZSluyCy3i7 hkdQ== X-Gm-Message-State: AOAM532dcdDJ5E4qz4ptfIjvuXPbotXDAEvnYeI99BlFvZ50At20G/Ec eUbW79ycoFufQ4vHgRMaLUzz4l4oI1hC8g== X-Google-Smtp-Source: ABdhPJzDr4PRceMlDmLxQwdrbTzP3K8MGoWz3gki9rB86SibkOnGYFFTCykXgk1plTn1ocsbTsCDkg== X-Received: by 2002:a05:6602:2f07:: with SMTP id q7mr2795506iow.191.1602019858519; Tue, 06 Oct 2020 14:30:58 -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 z20sm2043215ior.2.2020.10.06.14.30.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Oct 2020 14:30:57 -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, mka@chromium.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net 2/2] net: ipa: skip suspend/resume activities if not set up Date: Tue, 6 Oct 2020 16:30:47 -0500 Message-Id: <20201006213047.31308-3-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201006213047.31308-1-elder@linaro.org> References: <20201006213047.31308-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org When processing a system suspend request we suspend modem endpoints if they are enabled, and call ipa_cmd_tag_process() (which issues IPA commands) to ensure the IPA pipeline is cleared. It is an error to attempt to issue an IPA command before setup is complete, so this is clearly a bug. But we also shouldn't suspend or resume any endpoints that have not been set up. Have ipa_endpoint_suspend() and ipa_endpoint_resume() immediately return if setup hasn't completed, to avoid any attempt to configure endpoints or issue IPA commands in that case. Fixes: 84f9bd12d46d ("soc: qcom: ipa: IPA endpoints") Tested-by: Matthias Kaehlcke Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_endpoint.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c index b7efd7c95e9c8..ed60fa5bcdaca 100644 --- a/drivers/net/ipa/ipa_endpoint.c +++ b/drivers/net/ipa/ipa_endpoint.c @@ -1471,6 +1471,9 @@ void ipa_endpoint_resume_one(struct ipa_endpoint *endpoint) void ipa_endpoint_suspend(struct ipa *ipa) { + if (!ipa->setup_complete) + return; + if (ipa->modem_netdev) ipa_modem_suspend(ipa->modem_netdev); @@ -1482,6 +1485,9 @@ void ipa_endpoint_suspend(struct ipa *ipa) void ipa_endpoint_resume(struct ipa *ipa) { + if (!ipa->setup_complete) + return; + ipa_endpoint_resume_one(ipa->name_map[IPA_ENDPOINT_AP_COMMAND_TX]); ipa_endpoint_resume_one(ipa->name_map[IPA_ENDPOINT_AP_LAN_RX]);