From patchwork Tue Jul 27 21:19:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 486770 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:1185:0:0:0:0 with SMTP id f5csp593239jas; Tue, 27 Jul 2021 14:21:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/qf1T7SnwqqJuDv4sq+ToRoBaS7xsy6/+CBZ/e34Z0FvztEK+ZtZV4P1MRbaZO+vxQzgt X-Received: by 2002:a5d:8358:: with SMTP id q24mr20220478ior.168.1627420898914; Tue, 27 Jul 2021 14:21:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627420898; cv=none; d=google.com; s=arc-20160816; b=aDhRn1f9rohjrrgnasTD6mlCUOvTeA+relSb9K0FsFhwX8yYX8k/vkgWeeB3x8S29q ZITFD7I3jBk+ydTq4cVJsGTWQrORp1q6gSCvmUiohJzbZcXhDR9rRNV7vICD0vgeBOyg Pt2aoxCp6jv5hU1PeDK5swYp4K3jKiSlFpIlGGOJSs24WETDaWj21xsi816rJjPqWy9z gCVke2EYPD4lcezS/z7njutOQjqzuLKBMx/HEn2ICLnsBqzUJNqGUETwvdXRSLkknjDQ 2+Dsjbex4wz3Mbg6Hlq22mQ2O8fpNH5X4n52BYVVBNFFS+jiwHAIdgC5nk60cfOOA4Mk C7Vw== 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=oi6124QyCYE8lAwaOWwJ6X0dUBFbQ7SiwlLUUvXeRnk=; b=WvgPibt0IwEbrkogkcZ6DAmQHlGQVazXF2GIgQ/H/AAZmWdgHjH4e8ybRRitj9vBPU LvuQge3XB4pdZI4k1qkZ07bvhfMcNVZ+TEdn/droVoPFMQI94Vhnlwp1Uhf1OBJimi3d 5TNKlcsEHKODzCIzlJSTJVCvziC8C78o9/mEKhFKb39JdbB7ndVQKi57VHOIL6EKWaZQ tx/EjQyBu2swvkc4olph/ax5Rhgi9EyWXKYxebjzwRCI0imNSo1QAUuk7SjZs6xulsgT xQZbAGBUyCwytrc7dNN131McCq4thqqAXaGThU5wcNV2IXFepl3dmds2RxVZZicArkKY hQBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pQsTQJp+; 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 y18si4172048ily.67.2021.07.27.14.21.38; Tue, 27 Jul 2021 14:21:38 -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=pQsTQJp+; 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 S234985AbhG0VVb (ORCPT + 8 others); Tue, 27 Jul 2021 17:21:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233741AbhG0VVL (ORCPT ); Tue, 27 Jul 2021 17:21:11 -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 9BCF0C0619E7 for ; Tue, 27 Jul 2021 14:19:37 -0700 (PDT) Received: by mail-il1-x132.google.com with SMTP id l11so652894iln.4 for ; Tue, 27 Jul 2021 14:19: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=oi6124QyCYE8lAwaOWwJ6X0dUBFbQ7SiwlLUUvXeRnk=; b=pQsTQJp+pV6ucEYpVO9R37BS3Z6n7HhaNCkUf5uPmRvwnTDhZHDI5oIyoOocUX5EfY NMX6RQI3qZ50JGGlzEbxtQo6JORPn3pN5j8ZuYGbE98OGkjUVuLMiZGya3unQaAbUAHO bTaxd1zHp69hgYKM3B3G2c6BTSspXTuD85rWrkNcobVUrDq16zyqdoueK/EYvgjtcgnO /RtFcUk+21szVAXoiuenisPfdZTxPezVSWkjOEQhNlz1hsyenSdlqsIJvhjT31sf8O63 HCaBlWW/xKXXVDbhto1FLCYrpq2z5O8u/g65U9TiBbpS84J7ZM1/EtD2F5wpjCFD/LZ1 rNsw== 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=oi6124QyCYE8lAwaOWwJ6X0dUBFbQ7SiwlLUUvXeRnk=; b=umcqf/NJas2tc/75UIXCCY2LgQR17Lw/cBfWc6nB3IsZ9qBy/Ray7BmfRfWLvTaM6r 1pLJsNpO/91B5QMouhjh3eLo8cRGR7rdMiPRb5FYFJCXjyO3WLIFUrsP5EsW/Mugc7jD 64kXTiIQ0G4bBhND9MphyQSh1b/K3NtDm00t8PNPV7lkezpZYuJJx/p9NsBmJlZdvmGW JzmCjtb9GNxYdApec7Df27YXyZ6mTPzWV1pCIrPWiP4REQ/xcXvqM+pdCU0DJv50yYGR iaOe3J+jUjq/UqStYb6NoanELBrNfKhWtkI/pJenFXuSnR9us2lNwEqOp1lC4U04q/DP ZQyA== X-Gm-Message-State: AOAM533XrL5fqYyJdI24EdC4AwmY8qhWtVqGWa/GMWLD1+fyq4Z5wGS8 8SgNHqRjVKr0+2C+V1BAATp6MA== X-Received: by 2002:a92:190f:: with SMTP id 15mr17352568ilz.45.1627420777012; Tue, 27 Jul 2021 14:19:37 -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 s21sm3136068iot.33.2021.07.27.14.19.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jul 2021 14:19:36 -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/5] net: ipa: get clock in ipa_probe() Date: Tue, 27 Jul 2021 16:19:29 -0500 Message-Id: <20210727211933.926593-2-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210727211933.926593-1-elder@linaro.org> References: <20210727211933.926593-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Any entry point that leads to IPA hardware access must ensure the hardware is operational (clocked). Currently we ensure this by taking an extra clock reference during setup that is not released until we receive a system suspend request. But this extra reference will soon go away. When the platform driver ->probe function is called, we first need hardware access in ipa_config(). Although ipa_config() takes an IPA clock reference, it the special reference taken to prevent suspending the hardware. Have ipa_probe() take a reference before calling ipa_config(), so that the "no-suspend" reference can eventually go away. Drop this reference before ipa_probe() returns. Similarly, the driver ->remove function can be called at any time. Take an IPA clock reference at the beginning of that function, and drop it again after the deconfig stage has completed (at which point hardware access is no longer needed). Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_main.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) -- 2.27.0 diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c index 5bcc6cd13a9a0..67aba68e6e3b4 100644 --- a/drivers/net/ipa/ipa_main.c +++ b/drivers/net/ipa/ipa_main.c @@ -770,9 +770,12 @@ static int ipa_probe(struct platform_device *pdev) if (ret) goto err_table_exit; + /* The clock needs to be active for config and setup */ + ipa_clock_get(ipa); + ret = ipa_config(ipa, data); if (ret) - goto err_modem_exit; + goto err_clock_put; /* Error */ dev_info(dev, "IPA driver initialized"); @@ -781,7 +784,7 @@ static int ipa_probe(struct platform_device *pdev) * we're done here. */ if (modem_init) - return 0; + goto out_clock_put; /* Done; no error */ /* Otherwise we need to load the firmware and have Trust Zone validate * and install it. If that succeeds we can proceed with setup. @@ -794,11 +797,15 @@ static int ipa_probe(struct platform_device *pdev) if (ret) goto err_deconfig; +out_clock_put: + ipa_clock_put(ipa); + return 0; err_deconfig: ipa_deconfig(ipa); -err_modem_exit: +err_clock_put: + ipa_clock_put(ipa); ipa_modem_exit(ipa); err_table_exit: ipa_table_exit(ipa); @@ -824,6 +831,8 @@ static int ipa_remove(struct platform_device *pdev) struct ipa_clock *clock = ipa->clock; int ret; + ipa_clock_get(ipa); + if (ipa->setup_complete) { ret = ipa_modem_stop(ipa); /* If starting or stopping is in progress, try once more */ @@ -838,6 +847,9 @@ static int ipa_remove(struct platform_device *pdev) } ipa_deconfig(ipa); + + ipa_clock_put(ipa); + ipa_modem_exit(ipa); ipa_table_exit(ipa); ipa_endpoint_exit(ipa); From patchwork Tue Jul 27 21:19:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 486769 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:1185:0:0:0:0 with SMTP id f5csp593154jas; Tue, 27 Jul 2021 14:21:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxjyjf13CZ5SxQLibcV9tl7IKw27p6LQQLGLyMW4xsVB0ZvgPnv6naCdUGp+bRjKhUXLpER X-Received: by 2002:a05:6602:59d:: with SMTP id v29mr20687612iox.132.1627420892073; Tue, 27 Jul 2021 14:21:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627420892; cv=none; d=google.com; s=arc-20160816; b=H71vwPnXP2zJ8V6HO+3cwmfbsZEYBJIcb8AkTu5ucYjDtHHmnFYF1UKqFkwXrPNH9N 1zvvHn3VmD00I7BD9wHqwbqknBmSN99UoEFBGu8OjscGGTAyrskTQ4QOQvyQGanvCNGV U/PnMLM/YhKxOijQcBcdFFRCg3cchD3S+falKmgDkxDjPVo5Ok1aNbOsRWTIdloEc4g5 XmMJZHxPFUanbuq/ukIm5paET2ckl+8YXdAuvtrsEWctTVyrC9JNR7p4de97x0o2LpZf F/B4Fwd5OAm58pur3AjANsxzOMqXvlwFl+9mrW3vZnDOC6Wo+gEHROGmLCwgLuK/dfkf Ijuw== 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=q3uz0iVJxizzXZ9+aams9EiglAvKImvZjcrox/hrMaU=; b=btrxEv3x27weD0SKSFfw0oxvT5xYlffx1U5oywBBliLx0Z9y+GH+cdG2ScZn8RZZkZ aUg9FBQCm0eWiOzdKED8Ju8vrzmdFu9/MkLKxZcAVM7SmBkFwD05v9xfCg8GJdrtUDwL erNuYr+vic6CXAoqRD6VUCyp5kP45Puqz5nbId8ViwqNUA3TG5YGAAtN6CVZs5nBd3i8 0vAdS4UHbBnM1jl/GjYjtBlavF44RzfK3GTAwu9Ll4p4yTWAJtPFUC7Eqj1IS7KdLumh sleenAm+LTj0HRx3eiYN8OpWa2E+VyPDXTlDo+n3OwG01A+T77ScIOrftG4moWnLzVPJ kVag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XTQ7C3gQ; 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 h21si3875899ila.73.2021.07.27.14.21.31; Tue, 27 Jul 2021 14:21: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=XTQ7C3gQ; 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 S234844AbhG0VV1 (ORCPT + 8 others); Tue, 27 Jul 2021 17:21:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232641AbhG0VVM (ORCPT ); Tue, 27 Jul 2021 17:21:12 -0400 Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53568C0619E9 for ; Tue, 27 Jul 2021 14:19:38 -0700 (PDT) Received: by mail-io1-xd32.google.com with SMTP id y9so441387iox.2 for ; Tue, 27 Jul 2021 14:19: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=q3uz0iVJxizzXZ9+aams9EiglAvKImvZjcrox/hrMaU=; b=XTQ7C3gQQt6VjfMHy9T420taCAaoshrC5lHVT9RchXvxeScTEKZH0dnecJm8ALnfe2 dWzyEreWASw+jAndnwiMj0oryVOhWIksXgV/b6qMv39Q8kHDFKCHLVo0bCKH+kxsNUYt xskGhYjF7daJXpA3VSqBh/xb9yCrsLibAbxjp+MMhdFefgIr7AdNYh408rIs8j/5+V+1 /rOPP7408dAub30ROjJSDaKYzwOr0QNVCX17hB31N40jSO2IUOBqaviUh+ULjJ8r0pzA vfBriODCNw8xO4foskaHthcq7x9Wx5CK0LTNZmDS5UMpplpZY4KozS6peWVLFKxEnxPm YiPA== 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=q3uz0iVJxizzXZ9+aams9EiglAvKImvZjcrox/hrMaU=; b=VjyLn4qHvyCSaNBaEfoj3w23s9xDH2nVjGZk3e8/eppZU4RQyUIi/1mFEuSxGkjhHv m5ouHcJqmsRPd1uJsSFqQzka/GFbh8AeMG4IN9G6YkOV2QXyDkMQ1LfRxV4abxarj3vt 8mKtBXG6ftxVxEzXn5QU/Rb+Ip/a8Skjb0HqFi2vtBUbTvK6RRGet3BwClxekn0guiFR XSMDvpQQq98pM0OK/DgJLqvZtHGyw0tEayMxsX7wQzSvmBush503HEsu6TzwqK6iXLtu XcmwY3V51bP2Di31p5wZ/m5tZnp4BHJ0orhx1m1uWoNKRfapG/7VQsmBNEu7zFwgGCSc PZDA== X-Gm-Message-State: AOAM530fd8ZuU4I8iktgvGOiUp8i7EaPPVsF9y8GxMxDds0dphcvSjyA Crfl3tjD4yLLaffjN8QsIPtnuA== X-Received: by 2002:a6b:6310:: with SMTP id p16mr20276050iog.148.1627420777830; Tue, 27 Jul 2021 14:19:37 -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 s21sm3136068iot.33.2021.07.27.14.19.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jul 2021 14:19:37 -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/5] net: ipa: get another clock for ipa_setup() Date: Tue, 27 Jul 2021 16:19:30 -0500 Message-Id: <20210727211933.926593-3-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210727211933.926593-1-elder@linaro.org> References: <20210727211933.926593-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Two places call ipa_setup(). The first, ipa_probe(), holds an IPA clock reference when calling ipa_setup() (if the AP is responsible for IPA firmware loading). But if the modem is loading IPA firmware, ipa_smp2p_modem_setup_ready_isr() calls ipa_setup() after the modem has signaled the hardware is ready. This can happen at any time, and there is no guarantee the hardware is active. Have ipa_smp2p_modem_setup() take an IPA clock reference before it calls ipa_setup(), and release it once setup is complete. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_smp2p.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.27.0 diff --git a/drivers/net/ipa/ipa_smp2p.c b/drivers/net/ipa/ipa_smp2p.c index 93270e50b6b35..0d15438a79e2d 100644 --- a/drivers/net/ipa/ipa_smp2p.c +++ b/drivers/net/ipa/ipa_smp2p.c @@ -156,11 +156,16 @@ static irqreturn_t ipa_smp2p_modem_setup_ready_isr(int irq, void *dev_id) if (!smp2p->disabled) { int ret; + /* The clock needs to be active for setup */ + ipa_clock_get(smp2p->ipa); + ret = ipa_setup(smp2p->ipa); if (ret) dev_err(&smp2p->ipa->pdev->dev, "error %d from ipa_setup()\n", ret); smp2p->disabled = true; + + ipa_clock_put(smp2p->ipa); } mutex_unlock(&smp2p->mutex); From patchwork Tue Jul 27 21:19:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 486768 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:1185:0:0:0:0 with SMTP id f5csp593121jas; Tue, 27 Jul 2021 14:21:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhP5pKIfDUk/GVZ6HxvJ99bQh3lJcdnU52JBzi/QP3MLphMBNc9kYPKpwXI3X9PxnZaEKy X-Received: by 2002:a5d:8456:: with SMTP id w22mr21187345ior.63.1627420888945; Tue, 27 Jul 2021 14:21:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627420888; cv=none; d=google.com; s=arc-20160816; b=Hbbacn7wflf2xrSpuQ/xAnmTuoBve5JyIttf+iPTShs3X4g6AJIbN6/oHA/st4JUcW hJeW1G3EFnjgV1NiTdabf429ppeNyqAlY+oXmtzEcm7nXkQxo4ffgAC5ALEloAaISphu IwypbvG2gQ/pt4V6BWRHfv8kQCM5SL9/1hOBH0bd6Z5aaD0UyC0zudqAqP/WIYk4IkHh /T5Cz74oh1A2xMQQ0n6VBca7J87S9Ho/XbTTkfqaGv7hcjQgSdatct+zWKArUMt8x2kU PPh6ZfSJG7uO4iUNiZNw6UiY6NlLWs5xGSWwCDvB0LbQOnrmPKtP1CpyUt4lmERVMq3D bZ/A== 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=Uxr6HGwaPwBEs31x3X5oKeAbqmL6VbyD6eX4zPry52o=; b=jEmBfi/ZUlr1rYa9cLUMYdiLLYmnacMnkdtmu/4jH0DGcwwTNGNNiyma1RVVvEyfv8 m4IMs1UOjYNcnRqFC+JosuRDneSsSk8VaGP5kfqXX4q0nbjQh6ysHoHc6IgY6BcEObzB RzflF9AInr7y2qeAiFT85rlhZIu6A9rX4VLJlO8Kgais6rYidVwkxTaJS/QK6ox4P6ri pfLSCISlicltipg0OY4/R5/e0cn6ry9GcoJ9CsPVpBXrS7as/Q6oEjRSItVdoLx/0LzD 6Yv/6OVx25sFfQ8BWkuvxx90lXxpBZPzRTbBe+XtjKApA2v6kVYSCzH++W5kftDzVhX6 ZXcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="npRv/52O"; 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 y14si4554728iot.9.2021.07.27.14.21.28; Tue, 27 Jul 2021 14:21: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="npRv/52O"; 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 S231706AbhG0VVZ (ORCPT + 8 others); Tue, 27 Jul 2021 17:21:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233116AbhG0VVO (ORCPT ); Tue, 27 Jul 2021 17:21:14 -0400 Received: from mail-il1-x12a.google.com (mail-il1-x12a.google.com [IPv6:2607:f8b0:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41946C0619EC for ; Tue, 27 Jul 2021 14:19:39 -0700 (PDT) Received: by mail-il1-x12a.google.com with SMTP id o7so621103ilh.11 for ; Tue, 27 Jul 2021 14:19:39 -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=Uxr6HGwaPwBEs31x3X5oKeAbqmL6VbyD6eX4zPry52o=; b=npRv/52O9Ij5zUv0wUR9QJ/AIumYBM3czuulN1dd6wfQ1K65Z+0dm0EkbmKiaOkHRS jafAmXiX4yBZwjt1M2yOTLDnmU4xXrfrUjP5DBHBYhDOKbBWSvQpFLU3eDHgOVvft7s7 PnDzrygzNENKwh0jFrSZdbuXRDF57VvoiklqwKawked3xicdq05p4+rpjywrGgOKTFlh A2isPKA0kca3tE/y3sUJSSGFKgsdCWvKEaS+S1mhmECLahmm9qbNBimz9iDH5jcZjiwo tjfsDNB1MO4yekGh5IfckpsyI9nvFZM2jfY0cI9ZZk5f0T0xqsqMxd5/8a/VEd8OSkFi 4zag== 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=Uxr6HGwaPwBEs31x3X5oKeAbqmL6VbyD6eX4zPry52o=; b=OkNfSunnOrTUdpZ2BNUm3vB+/fMQbgcyhfyw+XTBVSL1BVGSm8dZ33ldeU03NCm1VS 69QfvtLPsO7nNtg9YEzKHwgbUPMEKkxu1XySoJT2J7v0Pha2tIA+6S5/CdATPUeU+qVf XRebpQPaoN9fCQnsZRNfP491gFIRB/WqpiWaWc3oc2RiwBJvPAVkdJB7mekUjhGCXbG/ bUYNXitEU7ZiXvCfcHE9pIQzjF0p75T4eMpDfWBqSZLe2I4woCggs01w5hZq1WkKfw6B fkU9WiFadFWBDHtlSQKsP/Pwvmva9MeWWpz/ZJ12QmLMWt9AGxsnDnUhfLx5ROwaO/HC cBNQ== X-Gm-Message-State: AOAM530s7/aZhQQt5qln3W2IP6PJ9HtcSHY6001sCSW5W3D0xCO7lexa POND4iO/MNPhs/G20xAGrX4ogA== X-Received: by 2002:a05:6e02:1208:: with SMTP id a8mr18103144ilq.257.1627420778680; Tue, 27 Jul 2021 14:19:38 -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 s21sm3136068iot.33.2021.07.27.14.19.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jul 2021 14:19:38 -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/5] net: ipa: add clock reference for remoteproc SSR Date: Tue, 27 Jul 2021 16:19:31 -0500 Message-Id: <20210727211933.926593-4-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210727211933.926593-1-elder@linaro.org> References: <20210727211933.926593-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The remoteproc SSR callback function for the modem requires hardware access when handling a modem crash or shutdown. Take and later release an IPA clock reference in ipa_modem_crashed(), to ensure the hardware is operational. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_modem.c | 5 +++++ 1 file changed, 5 insertions(+) -- 2.27.0 diff --git a/drivers/net/ipa/ipa_modem.c b/drivers/net/ipa/ipa_modem.c index c851e2cf12552..a744b81db0d9f 100644 --- a/drivers/net/ipa/ipa_modem.c +++ b/drivers/net/ipa/ipa_modem.c @@ -20,6 +20,7 @@ #include "ipa_smp2p.h" #include "ipa_qmi.h" #include "ipa_uc.h" +#include "ipa_clock.h" #define IPA_NETDEV_NAME "rmnet_ipa%d" #define IPA_NETDEV_TAILROOM 0 /* for padding by mux layer */ @@ -279,6 +280,8 @@ static void ipa_modem_crashed(struct ipa *ipa) struct device *dev = &ipa->pdev->dev; int ret; + ipa_clock_get(ipa); + ipa_endpoint_modem_pause_all(ipa, true); ipa_endpoint_modem_hol_block_clear_all(ipa); @@ -303,6 +306,8 @@ static void ipa_modem_crashed(struct ipa *ipa) ret = ipa_mem_zero_modem(ipa); if (ret) dev_err(dev, "error %d zeroing modem memory regions\n", ret); + + ipa_clock_put(ipa); } static int ipa_modem_notify(struct notifier_block *nb, unsigned long action, From patchwork Tue Jul 27 21:19:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 486771 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:1185:0:0:0:0 with SMTP id f5csp593246jas; Tue, 27 Jul 2021 14:21:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxB6FYwiBJyc8PBvQyonxaIZB45sMkRbKFnOUG/JtPmzxufm8s2xtlDuLW3rIIWt8uG8Ak7 X-Received: by 2002:a05:6e02:1d8a:: with SMTP id h10mr13619313ila.20.1627420899244; Tue, 27 Jul 2021 14:21:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627420899; cv=none; d=google.com; s=arc-20160816; b=A2osR64cg49S/4bJhBwpwsy4Hg2NMLMYehfZxckMEYXF4FEuJv0dkFU+BRbrzdBeRx uSsz6IDI5+hlRsSPOnSOzBeBwLDybxRvrdeZLWZtVvTCvP3hMIZSKzUyTtlAdIXNnQ+A L7TCWBmjyS7CemTqkSey5rJp1qBhcosHoM4/eyF6rVarW+dXC3W4ignXz9Kx/p46FuPB nJUg0qkNp/S/5IYBcZCcPvsZP9OYZ31cF4ZSO40URrw5i6OH/89zUZ+H5+0eCZUPUqNx poY/1BpjTgckvEBJe6erN8Ir1iMEKfg/yLu2gLwMlCJeWyhqOqkk/b9whf8Ccx4PNYLb 0p6g== 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=eQ0hc8oNad64A8+9UICGjrxeLo53QWe70jQkDi/osB0=; b=OEL9R0cg7WhCJh10i0AlG0h/Hn4Oy3F2VWyVYnjbWUfoeMAF/j8pYuXLGw51TYh7fn q7/c22ThCl/xuL8bkkiBkaTzS1kFusy6M1zUfgj4RpaDb41TrQQ8gWVGTAv4cny+SuF7 ew4QkFdHsPOUt2Lzq3Y18WwtLT6uYCXkd031o5lNyKlSsFqon+jdqp0YAM8i2QGTFOmm MAzVmnwZmTkX0H1+blFcKVzhOdDef+E1YiawUQCk58FFkN3zjyNdK1L6EU1Gu0ApQHRF BXfObwWwImLygs5L4D1l6aNzN9iAX6AuK5hdc2ic6EpKHoEe7rdM6+PSP+KLyxmPVNrW uqNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RDm8E0R5; 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 y18si4172048ily.67.2021.07.27.14.21.39; Tue, 27 Jul 2021 14:21:39 -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=RDm8E0R5; 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 S235128AbhG0VVg (ORCPT + 8 others); Tue, 27 Jul 2021 17:21:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233373AbhG0VVO (ORCPT ); Tue, 27 Jul 2021 17:21:14 -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 1F88FC0619EE for ; Tue, 27 Jul 2021 14:19:40 -0700 (PDT) Received: by mail-io1-xd2a.google.com with SMTP id r18so421551iot.4 for ; Tue, 27 Jul 2021 14:19:40 -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=eQ0hc8oNad64A8+9UICGjrxeLo53QWe70jQkDi/osB0=; b=RDm8E0R5gVFNFF6I7jWcjqO9IBb4SgKvwFEh/9SaVA4RmsBUNC4YFun3P3vrUmwO6P w8IZfZyB9YKNO30/lw/7K8IGz1N7qmQezlvS1p7YVrqDAMUwm60V/FVdO15zRturGXrO yxulgpVRo7XisVygtT7mbxJsC9bYUCZJu+PBHxjakrwAXpsf3lGlRvMnhxtf+fNvvZtq 0lWMtw3ywvOEoeebWVZ55dQJqT3De7dvkiQTH4+l8Oz0qsTLiQ8TDKxfOGLrpbEgd2S6 UrbkNwbkPxpPdEPTleHSKOygAUFdmcDnYqORTr+J4PMomnKB2ovOnoJZCbTfZgrI6Map NrrA== 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=eQ0hc8oNad64A8+9UICGjrxeLo53QWe70jQkDi/osB0=; b=fpChbpv+1vZScXCKORCfg8+CZvmN7PDL33BO4yYrfvaakdbOL5kOWSnZ/8MR9DyEZp w7bgAwbfSqVMY+4vO8hQfPYpX8RCfeecGr+vxDNBuVPfnmT4C+lkyuczshJWz4vOHdg+ sNARgT0litUp5056p2ISjPmtwel/mxr23d2xdHrEZb9NRG1TjZSNq1JN1RWnzEFM3NNV YnC54DymG6bQYfM4aU6ZMawljc/nn6UM4mTUR3RaNzpMpfkGDW8u3x7+9s07SiV1Bikd CDFDXGzm0H2hsor7fGC348HvsxVWGfnBmoFay/s3IaLM67Ihz7DeLX/LIaQEcCQa2iFU ZdrQ== X-Gm-Message-State: AOAM530Vc0O/qEA+XwG2qlqAvAcNp6UrpWbkV+HpHV5I4lxTwwPFVI/V BQ+0bAFK/ij0JXBlGN7IjpyeDA== X-Received: by 2002:a6b:fe03:: with SMTP id x3mr20190538ioh.120.1627420779526; Tue, 27 Jul 2021 14:19:39 -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 s21sm3136068iot.33.2021.07.27.14.19.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jul 2021 14:19:39 -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/5] net: ipa: add a clock reference for netdev operations Date: Tue, 27 Jul 2021 16:19:32 -0500 Message-Id: <20210727211933.926593-5-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210727211933.926593-1-elder@linaro.org> References: <20210727211933.926593-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The IPA network device can be opened at any time, and an opened network device can be stopped any time. Both of these callback functions require access to the hardware, and therefore they need the IPA clock to be operational. Take an IPA clock reference in both the ->open and ->stop callback functions, dropping the reference when they are done accessing hardware. The ->start_xmit callback requires a little different handling, and that will be added separately. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_modem.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) -- 2.27.0 diff --git a/drivers/net/ipa/ipa_modem.c b/drivers/net/ipa/ipa_modem.c index a744b81db0d9f..4ea8287e9d237 100644 --- a/drivers/net/ipa/ipa_modem.c +++ b/drivers/net/ipa/ipa_modem.c @@ -45,9 +45,12 @@ static int ipa_open(struct net_device *netdev) struct ipa *ipa = priv->ipa; int ret; + ipa_clock_get(ipa); + ret = ipa_endpoint_enable_one(ipa->name_map[IPA_ENDPOINT_AP_MODEM_TX]); if (ret) - return ret; + goto err_clock_put; + ret = ipa_endpoint_enable_one(ipa->name_map[IPA_ENDPOINT_AP_MODEM_RX]); if (ret) goto err_disable_tx; @@ -58,6 +61,8 @@ static int ipa_open(struct net_device *netdev) err_disable_tx: ipa_endpoint_disable_one(ipa->name_map[IPA_ENDPOINT_AP_MODEM_TX]); +err_clock_put: + ipa_clock_put(ipa); return ret; } @@ -73,6 +78,8 @@ static int ipa_stop(struct net_device *netdev) ipa_endpoint_disable_one(ipa->name_map[IPA_ENDPOINT_AP_MODEM_RX]); ipa_endpoint_disable_one(ipa->name_map[IPA_ENDPOINT_AP_MODEM_TX]); + ipa_clock_put(ipa); + return 0; } From patchwork Tue Jul 27 21:19:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 486772 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:1185:0:0:0:0 with SMTP id f5csp593280jas; Tue, 27 Jul 2021 14:21:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzURL25LXHs0Y0CNrv/ploV4zWL128vYOV8rbqsDNoRhLDUxPj/uzZ7QIYE3okz86qtseke X-Received: by 2002:a05:6638:3824:: with SMTP id i36mr23281925jav.11.1627420902112; Tue, 27 Jul 2021 14:21:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627420902; cv=none; d=google.com; s=arc-20160816; b=h6MxqQpFotEXyTIvHpJEarKa2JA+7YmLEwYAhvYepfsUO3vE9XM4n3/lZ6mx12aMCC iL+GQcmJe6MkWB+qx8dOBZW0Rz5dZ8ZCkGHOeXP5WYOJaVAJGgQFb4uGEOgUgq4R1Hp2 RtY3Ko7nyDnSm3PT2DIll3cUvzhBU1oBcJ3OK+7MaSzuNXwC57wR0tiP/aWYNn5DfsAk EjFejq8prXdEg+smLriGpQywlkmfCruREFY8hq5Z7CO1YuI6au6zsKGX4KVT8/d3dCfu vACcsHojzQvICTUzqemJ8dakIgOkTBpsuHHvNolJCHJywSD1hsLMKxGlRVClE7pAswFo juBQ== 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=Ctl/Z08dFkY9O1sSrsyFhIw0eSry4lTuONlS/T0EM90=; b=RElZ9bhjrIIFbL7swD8ei91d98ANFs67xAznn2fGNO1ENYNA8G+59axsxFKPFXHZxz Upa9ckZgs2Bgmo7ak0v/hWUYM6EZ7wxLLwTpM4KJB9SFb6EoZRM2kIbwH6wFO2DtTX5p uhV1Q6jPhtLrR/4JHLKmV/Hz4prdk0H7ntIzk/O4ravV59oaUkSa6qAXuqs+913D7Pv0 w/TvqL7QNyPXX1UQFHA2NqzV9PPNOR7uxp1Psdp+TW8JDFa8lyNASp89OdHHiexThv/k INdQNqQlf+16CDdeKNBdLt1OSgs0mSPQ+JO9cWyhKGhYWchg/zu4wmnHN3EFhfSBCIQE slcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XTURmhTw; 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 x12si4283911ilm.5.2021.07.27.14.21.41; Tue, 27 Jul 2021 14:21:42 -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=XTURmhTw; 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 S235170AbhG0VVj (ORCPT + 8 others); Tue, 27 Jul 2021 17:21:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233449AbhG0VVP (ORCPT ); Tue, 27 Jul 2021 17:21:15 -0400 Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D88DC0619FF for ; Tue, 27 Jul 2021 14:19:41 -0700 (PDT) Received: by mail-io1-xd32.google.com with SMTP id j21so409156ioo.6 for ; Tue, 27 Jul 2021 14:19:41 -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=Ctl/Z08dFkY9O1sSrsyFhIw0eSry4lTuONlS/T0EM90=; b=XTURmhTwiW7Hfg9YNHm1nO1MyeyZHZtacTSnvfLAUsS21ypTKoAJZOaQ0NFqn09yaI bJbtJTI+9TbdpZPiDjhqXpvgaD4sF5OWPzayo04r79NNien2rcx2kLa1ldnwX6kEp4K3 tZ6vxqO3NyuB39tHLly9fKtEMTlhiNf71nRZ2xGXFowj8W09bEJz3QcO7gijMOznNr9k sQrEIun0zb9MSO14Y2r/oULsQ9b6uwRhyDPvsvSe1vwzByhPi+K7bfu6KxLmDIPH/1bd cvgJ5nD78hppb+xpxN9xjfQPGyN/6NiKfblMs1PZdwIDaUTQzeSw4WlMk5bzsPT0thVU m2ZA== 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=Ctl/Z08dFkY9O1sSrsyFhIw0eSry4lTuONlS/T0EM90=; b=P4a13tbkF1KtEw2lqcaGS9Z+j4Vaw8ieQPG/FcbyyLcn6bK1EZkg+Wu7Djz7yf7qbJ 3wfMTJkKv2ROj2Qj7T2kHid3UcsQg/7Ge1jGdGFQ/wj/ImtigMwQoq0yXLLO24mwHVMy zsYoklIBovjNo3q2I96ZsMJubuMpERt3DT3lzjFum5wvSRM4gxUZtaLdosypkRpBLrdD xHe8V8offa2bG8fc5u/RTjC2MvkIUm8X+oa4Go+l/PEqdameEis/bIenAw/4+a1s6+qR XqMEi+udXpJrPYIkrMkdi43ArfI6IoGbF/MAA352iZkPyBbZSRVLPbyTnsJRUis1+wwY M+bg== X-Gm-Message-State: AOAM533d1FdpKTjuKXCzkm0DOdSVzZ1YjwsB6wpdAK8D7R4MD8REstD1 Lw5HiGummblfeHrysot7JsP+bw== X-Received: by 2002:a05:6602:248f:: with SMTP id g15mr6353033ioe.198.1627420780474; Tue, 27 Jul 2021 14:19:40 -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 s21sm3136068iot.33.2021.07.27.14.19.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jul 2021 14:19:40 -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/5] net: ipa: don't suspend endpoints if setup not complete Date: Tue, 27 Jul 2021 16:19:33 -0500 Message-Id: <20210727211933.926593-6-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210727211933.926593-1-elder@linaro.org> References: <20210727211933.926593-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Until we complete the setup stage of initialization, GSI is not initialized and therefore endpoints aren't usable. So avoid suspending endpoints during system suspend unless setup is complete. Clear the setup_complete flag at the top of ipa_teardown() to reflect the fact that things are no longer in setup state. Get rid of a misplaced (and superfluous) comment. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_main.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) -- 2.27.0 diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c index 67aba68e6e3b4..2e728d4914c82 100644 --- a/drivers/net/ipa/ipa_main.c +++ b/drivers/net/ipa/ipa_main.c @@ -194,6 +194,9 @@ static void ipa_teardown(struct ipa *ipa) struct ipa_endpoint *exception_endpoint; struct ipa_endpoint *command_endpoint; + /* We're going to tear everything down, as if setup never completed */ + ipa->setup_complete = false; + ipa_qmi_teardown(ipa); ipa_endpoint_default_route_clear(ipa); exception_endpoint = ipa->name_map[IPA_ENDPOINT_AP_LAN_RX]; @@ -885,13 +888,11 @@ static int ipa_suspend(struct device *dev) { struct ipa *ipa = dev_get_drvdata(dev); - /* When a suspended RX endpoint has a packet ready to receive, we - * get an IPA SUSPEND interrupt. We trigger a system resume in - * that case, but only on the first such interrupt since suspend. - */ - __clear_bit(IPA_FLAG_RESUMED, ipa->flags); - - ipa_endpoint_suspend(ipa); + /* Endpoints aren't usable until setup is complete */ + if (ipa->setup_complete) { + __clear_bit(IPA_FLAG_RESUMED, ipa->flags); + ipa_endpoint_suspend(ipa); + } ipa_clock_put(ipa); @@ -917,7 +918,9 @@ static int ipa_resume(struct device *dev) */ ipa_clock_get(ipa); - ipa_endpoint_resume(ipa); + /* Endpoints aren't usable until setup is complete */ + if (ipa->setup_complete) + ipa_endpoint_resume(ipa); return 0; }