From patchwork Wed Jan 4 17:52:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 39046 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp5274839wrt; Wed, 4 Jan 2023 09:57:40 -0800 (PST) X-Google-Smtp-Source: AMrXdXvUxHRzX9PWsXF6doItP8nI8ST5HpmuvPjbRPG3x3hoZ59cmRPDLZXa+JNYrJEYhbej1+Vf X-Received: by 2002:a17:906:d8ac:b0:7bc:9a78:bc3a with SMTP id qc12-20020a170906d8ac00b007bc9a78bc3amr40964510ejb.68.1672855059880; Wed, 04 Jan 2023 09:57:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672855059; cv=none; d=google.com; s=arc-20160816; b=vbpYIF94ChJC7pvTM1bMdgo2UN1rb4jg5vTc2RP10mj5NnCFK65x0wYw0bWXp+86pz qX9FtCeDVA86QmlmuPNc2cAb2wzZIJ8JmAv9cGymnoqAig/y5S7mucb6jPbg/m/MyuQz W6izIagpk4KPy3gI23jX6ZJTQW78iMk5D3pUIZemDM9FTKFcCCsuT5SFjmiFqjKSEo6o vxn0u+DTPWZY7Wy0UB1OEYr7Gfr8lJTUCrUcRPRngaUs8I5OTSYIMabwtloOV5xg3vTx VLeGBTvk98bktAzxnwJzyYbiXQ6Msdp9iMWjwTVi7PW0MPxvnoEcliyEoh2S1vxhZD4N udnQ== 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=gh2pdQ8Qz1jZcFQ0f9txmSCzOLVZiWWbqoSXvGeFz+g=; b=iPVOiXUXgv2xiJVwkEInGeXvWwVH1pahKDV4JFq2b+aWLTfd8kcL/7yAd/IbhcT+Qp ewhNkWdn02eIkYCkrM+KdP/f1bDMDGoliwryia98Xy3fo3NwUdJLfG6Gk2gjbA9fAxNt sb9hmFMbyOt7hRtaxgW4nU1EnOV0aSVTPh8vJSfcew1iIJWUF8SChKBWzjOOLBV1albH k0hIhQDCk/BHO3O9bsPrJ4YP767dmCCDNlNUSu6lunZ4vr04aDE502tdFF18mSDmipdH 8dlzTM9aEIJ2bE1QQksihcciBZ6pILsewDl4Mef7NvwiDh/WmMwZe6bASTQ8jH92qLwm l3cA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="pUy9/yLc"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ne35-20020a1709077ba300b0077d854aa10dsi31075934ejc.57.2023.01.04.09.57.15; Wed, 04 Jan 2023 09:57:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="pUy9/yLc"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-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 S239961AbjADRwx (ORCPT + 99 others); Wed, 4 Jan 2023 12:52:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239932AbjADRwn (ORCPT ); Wed, 4 Jan 2023 12:52:43 -0500 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 5CAC739F88 for ; Wed, 4 Jan 2023 09:52:39 -0800 (PST) Received: by mail-il1-x12a.google.com with SMTP id u8so12246625ilg.0 for ; Wed, 04 Jan 2023 09:52:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gh2pdQ8Qz1jZcFQ0f9txmSCzOLVZiWWbqoSXvGeFz+g=; b=pUy9/yLcTSPL3IuDyGbacdjkCGV31SZWZXUcFAvvR5SuvUSK9t8Ql7NYsCklIYZQYu J1SB9h06cnJXtaX8CHbdgXVSwh6wRc8rYlNGPNLPOFnSeY2cjK0o6K9LUeq2IhuRacCB uZWEb+gRXm3c8uEgmCqg3MbOpnxDCO5JXVqdTDnSvFoQxXbr5SQibLFbWpcI8pxZeSce ykTTiX+O8btx+tXQCpX7SgtGJHD/GBo3XrlX1kJNryu7m4U3Lc0cCoEeC2DRj0Cu5au+ z41K1/eSknnnxN45DKYEAj+nEi05h4+ZyanQJ6SFFO0VeZFbFZuRQs837KU/gLduUz7K K1ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gh2pdQ8Qz1jZcFQ0f9txmSCzOLVZiWWbqoSXvGeFz+g=; b=yvk7/8pWIUAIT5fYi20cbf/qdMYtVI+C5gooZnbrHK7lH+PDsm8/yBKlv+89RkFBx0 BzyqZwSpAzCEP53wXX4kr4sSJ17iiaCpIOSI0oRjOhuTiiNENGbwWm3snrLyPfrIVSEA h05jsNmhe8b+e0SRHa8+edqy9LETn49fw/r2Ttcn1rgiSJl2uKT+Sd1McqngJb2HmAvK 4uYJvSsvDlGqNEbYNMAzsiyHvQxop9OIeHfDcxDZeMeCxBDeAhNTS5+4J99yZS7aKM7l DAhbheUAdlQ1JshorBYkSqjOCdwoAEkqXFg77emTczXS7kDFazgcKWX5M2QXZ8SsYNYu lN/g== X-Gm-Message-State: AFqh2krtyODkb36kJW4SRzOF2b9XL4KsAAIDu+rWv63sBzd53QawB+e1 Wy/em2BS2uH9ilWYGm0g22HqBw== X-Received: by 2002:a92:c748:0:b0:30b:f2a7:92c2 with SMTP id y8-20020a92c748000000b0030bf2a792c2mr25965907ilp.7.1672854758677; Wed, 04 Jan 2023 09:52:38 -0800 (PST) Received: from presto.localdomain ([98.61.227.136]) by smtp.gmail.com with ESMTPSA id u3-20020a02cbc3000000b00375783003fcsm10872304jaq.136.2023.01.04.09.52.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 09:52:38 -0800 (PST) From: Alex Elder To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: caleb.connolly@linaro.org, mka@chromium.org, evgreen@chromium.org, andersson@kernel.org, quic_cpratapa@quicinc.com, quic_avuyyuru@quicinc.com, quic_jponduru@quicinc.com, quic_subashab@quicinc.com, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 1/6] net: ipa: introduce a common microcontroller interrupt handler Date: Wed, 4 Jan 2023 11:52:28 -0600 Message-Id: <20230104175233.2862874-2-elder@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230104175233.2862874-1-elder@linaro.org> References: <20230104175233.2862874-1-elder@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754115666998311891?= X-GMAIL-MSGID: =?utf-8?q?1754115666998311891?= The prototype for an IPA interrupt handler supplies the IPA interrupt ID, so it's possible to use a single function to handle any type of microcontroller interrupt. Introduce ipa_uc_interrupt_handler(), which calls the event or the response handler depending on the IRQ ID provided. Register the new function as the handler for both microcontroller IPA interrupt types. The called functions don't use their "irq_id" arguments, so remove them. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_uc.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/net/ipa/ipa_uc.c b/drivers/net/ipa/ipa_uc.c index f0ee472810153..0a890b44c09e1 100644 --- a/drivers/net/ipa/ipa_uc.c +++ b/drivers/net/ipa/ipa_uc.c @@ -124,7 +124,7 @@ static struct ipa_uc_mem_area *ipa_uc_shared(struct ipa *ipa) } /* Microcontroller event IPA interrupt handler */ -static void ipa_uc_event_handler(struct ipa *ipa, enum ipa_irq_id irq_id) +static void ipa_uc_event_handler(struct ipa *ipa) { struct ipa_uc_mem_area *shared = ipa_uc_shared(ipa); struct device *dev = &ipa->pdev->dev; @@ -138,7 +138,7 @@ static void ipa_uc_event_handler(struct ipa *ipa, enum ipa_irq_id irq_id) } /* Microcontroller response IPA interrupt handler */ -static void ipa_uc_response_hdlr(struct ipa *ipa, enum ipa_irq_id irq_id) +static void ipa_uc_response_hdlr(struct ipa *ipa) { struct ipa_uc_mem_area *shared = ipa_uc_shared(ipa); struct device *dev = &ipa->pdev->dev; @@ -170,13 +170,24 @@ static void ipa_uc_response_hdlr(struct ipa *ipa, enum ipa_irq_id irq_id) } } +static void ipa_uc_interrupt_handler(struct ipa *ipa, enum ipa_irq_id irq_id) +{ + /* Silently ignore anything unrecognized */ + if (irq_id == IPA_IRQ_UC_0) + ipa_uc_event_handler(ipa); + else if (irq_id == IPA_IRQ_UC_1) + ipa_uc_response_hdlr(ipa); +} + /* Configure the IPA microcontroller subsystem */ void ipa_uc_config(struct ipa *ipa) { + struct ipa_interrupt *interrupt = ipa->interrupt; + ipa->uc_powered = false; ipa->uc_loaded = false; - ipa_interrupt_add(ipa->interrupt, IPA_IRQ_UC_0, ipa_uc_event_handler); - ipa_interrupt_add(ipa->interrupt, IPA_IRQ_UC_1, ipa_uc_response_hdlr); + ipa_interrupt_add(interrupt, IPA_IRQ_UC_0, ipa_uc_interrupt_handler); + ipa_interrupt_add(interrupt, IPA_IRQ_UC_1, ipa_uc_interrupt_handler); } /* Inverse of ipa_uc_config() */ From patchwork Wed Jan 4 17:52:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 39047 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp5275157wrt; Wed, 4 Jan 2023 09:58:27 -0800 (PST) X-Google-Smtp-Source: AMrXdXuAqs3uNBepcChkpsTqApMDgvtS25+/DuNHM5x8R0k6jXEy4jSxCfXHmzAzVZzVrnXpvaAK X-Received: by 2002:a17:907:d389:b0:7c1:5a37:825 with SMTP id vh9-20020a170907d38900b007c15a370825mr54549680ejc.34.1672855107663; Wed, 04 Jan 2023 09:58:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672855107; cv=none; d=google.com; s=arc-20160816; b=Y9HnoEvvpVuWLGLHUsej+hVUCz15MJ31JCGVox+zyjzeSdtIACvYAyHTvj6AoBHdZ0 iigK83xwrHYxPD5hNxvrI2EooSqdFdcXZs/y92m+4vkmIxg5UYdt0+Fhtz56JzAeZlmH scPbaX9dxQobKqGL9fjTT6968OIB6+CyRdYTg4sFv4F4fu3haGHb7SvTfoNr3wvDN9QE dDpYoxIxH68gp+G063FokWKtiQpKAq+qmatjk6RgT+28XTRqP3+ab50uTnpx9VcZAf3h Q3cDCnJR/i+i0dvDtscSvDYJzXTYv6k+9qRvZ7bsFRVK+yYyGU0FxauohQdGf9oYl0Sb iXLw== 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=K4WtVwRcqcCUgmYfEzecLg1NkgyQK2BLzDcfIQJWkbQ=; b=iFY+kNphB9PMb/wYqKxoxyBVLhWJnOuN4tBJuHBvk7c07+yLHV1e8kEmtZ2qzh8RiC onY7H0gE6GkxaacyGvZmpyf8oQtc1nCekyjLvEuRe/i0eVpfxbZ3N3UryLcK8uEknuEC z61KBAwA+oWvvb/Kt9TmDCY0zsWzCxD6X7DlgEv5HHAbWJWKFAVhInP61Ef/nSGx3luv dH83LAV14BzVL3/wpCQzmNqPo6V8kyrKprRUOqI5ugY+K9fz4/mTjIBWgoZOqBGWkwcs OwmWLh54kAOfwvNVc8OnCfBw3ZVdInHH8Ikim1NyV0imnfhqAgACfODzGgyY3wm2+aQF +VBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=h8gnm6sj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y92-20020a50bb65000000b0046965a49126si29984548ede.528.2023.01.04.09.58.03; Wed, 04 Jan 2023 09:58:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=h8gnm6sj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-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 S240105AbjADRxA (ORCPT + 99 others); Wed, 4 Jan 2023 12:53:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239978AbjADRwp (ORCPT ); Wed, 4 Jan 2023 12:52:45 -0500 Received: from mail-io1-xd2d.google.com (mail-io1-xd2d.google.com [IPv6:2607:f8b0:4864:20::d2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C1F63AA86 for ; Wed, 4 Jan 2023 09:52:40 -0800 (PST) Received: by mail-io1-xd2d.google.com with SMTP id e129so9851831iof.3 for ; Wed, 04 Jan 2023 09:52:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=K4WtVwRcqcCUgmYfEzecLg1NkgyQK2BLzDcfIQJWkbQ=; b=h8gnm6sju51pnbVTrHG7dJ3fS0YGSSBjHduqzBKj7naghh/yHwuLG/OcorWd/hg/iI zAzVEhRojnlDUzHZgLq6J9qqivIm6QBOBR2H/lpci2TcI6u/7iU625Pm1MfE9dkYTCl3 uleCDGWgBPyI4lW1Pc7dnmz1iLic/ZgoSOLJXzIAUaflXCi7Yxhzx7YLEoy56lyEPM4L Oi7FYL6Ph8n/LTSjOMqXUj/GKxtoIH+1y9qO2LVYUj6D3Ot047MhzjGumq0HD50Md2m3 7sXd5nI9UfyxTfMYOVLIOz/+B9XxqeOoaDWjCOECf1PSZG1bcgKDN+ToSpZJ4i4/zNh+ wZLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=K4WtVwRcqcCUgmYfEzecLg1NkgyQK2BLzDcfIQJWkbQ=; b=g9OqtsXnhJy/lM71ZYAfjb4Oj0sV9NW5dFQaGXkpOGXloTnCiIm0ZzixKyqCusHaHB KW7KEl7vjjLIc8TOiOcIpfTuSKh7Tq+M6o9+OTDLpez1GM+Zv539WLNpm2Mk527uek9a yEiSJzysqMqThkWbdSm9Sx3YtOc2xjVWDYSyLD2xy2Jwylf4ilSYVKiCoh4taPA+w+28 UTaTCDK5Y8gHI1IaQQcm40pc7hcYGD13j+nOBmkSrLwgFrERAtlfKbPHaV78s3vkNw4N HzeLvNXsQ/Tgig6VQTt6xusSMRy/N55ATo6rpf1YhuiSfwXcC5Mf1VvRud5xHzAzobhy 6qKQ== X-Gm-Message-State: AFqh2kpJfB6YDWVk08TbKnSwoEvooqkTfXMYKNWtjALqKH4tq3l5Dzcm iHHAoBnu5dtYAAlSohmTk5nafw== X-Received: by 2002:a5e:a519:0:b0:6dc:30bd:ed81 with SMTP id 25-20020a5ea519000000b006dc30bded81mr31254368iog.20.1672854759828; Wed, 04 Jan 2023 09:52:39 -0800 (PST) Received: from presto.localdomain ([98.61.227.136]) by smtp.gmail.com with ESMTPSA id u3-20020a02cbc3000000b00375783003fcsm10872304jaq.136.2023.01.04.09.52.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 09:52:39 -0800 (PST) From: Alex Elder To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: caleb.connolly@linaro.org, mka@chromium.org, evgreen@chromium.org, andersson@kernel.org, quic_cpratapa@quicinc.com, quic_avuyyuru@quicinc.com, quic_jponduru@quicinc.com, quic_subashab@quicinc.com, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 2/6] net: ipa: introduce ipa_interrupt_enable() Date: Wed, 4 Jan 2023 11:52:29 -0600 Message-Id: <20230104175233.2862874-3-elder@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230104175233.2862874-1-elder@linaro.org> References: <20230104175233.2862874-1-elder@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754115717406653638?= X-GMAIL-MSGID: =?utf-8?q?1754115717406653638?= Create new function ipa_interrupt_enable() to encapsulate enabling one of the IPA interrupt types. Introduce ipa_interrupt_disable() to reverse that operation. Add a helper function to factor out the common register update used by both. Use these in ipa_interrupt_add() and ipa_interrupt_remove(). Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_interrupt.c | 41 ++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/drivers/net/ipa/ipa_interrupt.c b/drivers/net/ipa/ipa_interrupt.c index a49f66efacb87..7b7388c14806f 100644 --- a/drivers/net/ipa/ipa_interrupt.c +++ b/drivers/net/ipa/ipa_interrupt.c @@ -127,6 +127,29 @@ static irqreturn_t ipa_isr_thread(int irq, void *dev_id) return IRQ_HANDLED; } +static void ipa_interrupt_enabled_update(struct ipa *ipa) +{ + const struct ipa_reg *reg = ipa_reg(ipa, IPA_IRQ_EN); + + iowrite32(ipa->interrupt->enabled, ipa->reg_virt + ipa_reg_offset(reg)); +} + +/* Enable an IPA interrupt type */ +static void ipa_interrupt_enable(struct ipa *ipa, enum ipa_irq_id ipa_irq) +{ + /* Update the IPA interrupt mask to enable it */ + ipa->interrupt->enabled |= BIT(ipa_irq); + ipa_interrupt_enabled_update(ipa); +} + +/* Disable an IPA interrupt type */ +static void ipa_interrupt_disable(struct ipa *ipa, enum ipa_irq_id ipa_irq) +{ + /* Update the IPA interrupt mask to disable it */ + ipa->interrupt->enabled &= ~BIT(ipa_irq); + ipa_interrupt_enabled_update(ipa); +} + /* Common function used to enable/disable TX_SUSPEND for an endpoint */ static void ipa_interrupt_suspend_control(struct ipa_interrupt *interrupt, u32 endpoint_id, bool enable) @@ -205,36 +228,22 @@ void ipa_interrupt_simulate_suspend(struct ipa_interrupt *interrupt) void ipa_interrupt_add(struct ipa_interrupt *interrupt, enum ipa_irq_id ipa_irq, ipa_irq_handler_t handler) { - struct ipa *ipa = interrupt->ipa; - const struct ipa_reg *reg; - if (WARN_ON(ipa_irq >= IPA_IRQ_COUNT)) return; interrupt->handler[ipa_irq] = handler; - /* Update the IPA interrupt mask to enable it */ - interrupt->enabled |= BIT(ipa_irq); - - reg = ipa_reg(ipa, IPA_IRQ_EN); - iowrite32(interrupt->enabled, ipa->reg_virt + ipa_reg_offset(reg)); + ipa_interrupt_enable(interrupt->ipa, ipa_irq); } /* Remove the handler for an IPA interrupt type */ void ipa_interrupt_remove(struct ipa_interrupt *interrupt, enum ipa_irq_id ipa_irq) { - struct ipa *ipa = interrupt->ipa; - const struct ipa_reg *reg; - if (WARN_ON(ipa_irq >= IPA_IRQ_COUNT)) return; - /* Update the IPA interrupt mask to disable it */ - interrupt->enabled &= ~BIT(ipa_irq); - - reg = ipa_reg(ipa, IPA_IRQ_EN); - iowrite32(interrupt->enabled, ipa->reg_virt + ipa_reg_offset(reg)); + ipa_interrupt_disable(interrupt->ipa, ipa_irq); interrupt->handler[ipa_irq] = NULL; } From patchwork Wed Jan 4 17:52:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 39048 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp5275335wrt; Wed, 4 Jan 2023 09:58:51 -0800 (PST) X-Google-Smtp-Source: AMrXdXuHp8+o5WB8/NUHY0mmq69EXTaBhjz0LROqJcUPpmNwLO1oQkFiX9daqYVrDXph2mty1ah1 X-Received: by 2002:a17:907:7da4:b0:78d:f455:b5dc with SMTP id oz36-20020a1709077da400b0078df455b5dcmr50709020ejc.28.1672855131602; Wed, 04 Jan 2023 09:58:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672855131; cv=none; d=google.com; s=arc-20160816; b=xxUAK1w2kuVDjKaZhp4frFFk8o23aFqInDDiDIMJYBN9VYeBtdOZRxdeHKsz54pSzF QuYhZltyBD1KPFMGGAffWl9kuIe6XR9CHaayYla3di0kq9M8XyWWYC5JWWsqPDNiOpLT TKTD7nvs3tx5smwKaAu1fIGiadF0zCFKPPY1Jg1PCBXSfE+5riasNsJQaa/PLvEaEPFR roSiRdehfGUwgXE5rTOSyXtfynXmBX9P6QPQRDmxjWFxAeDB05OVSSozmaHAMPjxqUjW P/cR5BDLOJY8qdDfhl87borVoUsdYWtRubHFUBeedZdSqJOeG3mV1z3ml7Pvy0w0U0s6 IC+w== 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=ri11bVKWxZ8HBQVrgBnLCZL7on//0SsmMOvFkbNuqmY=; b=wYn+9Nfkfu43gzf/mj7XAj+tLEu54TvS+lV7//IYBG2An4jy0UWt7mf0H8jyUZy3XU Ter+kwyps5vG2WVah6EbBbXPM16Bj0hkjSOBG3gGM7qUhtPrK9dquyFOWDmU37TqKhEQ +G0q0P4q2hF0aZIYnmyxOnlSkyrlsCXgUFazobDGr9psfvKJnfx/lz66gIOmZZx6KS4i 50QY33cAWK22PBRHvA4zxj9BsewgioETFuhLh3pUmXhsSwF2CmywIOViZFY7grV+0Y2W bD5BrmbSRN4tYYy8DaWr8pA2flQNWjQGjkvV/7Auba7zFWsamQfBHPJPKAHxGvQZJiVL eRLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="hf9r/IxU"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p20-20020a1709060dd400b007c0d40cd759si22045580eji.827.2023.01.04.09.58.27; Wed, 04 Jan 2023 09:58:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="hf9r/IxU"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-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 S240124AbjADRxE (ORCPT + 99 others); Wed, 4 Jan 2023 12:53:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239998AbjADRwq (ORCPT ); Wed, 4 Jan 2023 12:52:46 -0500 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 B0C343AA9E for ; Wed, 4 Jan 2023 09:52:41 -0800 (PST) Received: by mail-il1-x130.google.com with SMTP id y2so19852144ily.5 for ; Wed, 04 Jan 2023 09:52:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ri11bVKWxZ8HBQVrgBnLCZL7on//0SsmMOvFkbNuqmY=; b=hf9r/IxUGvYos/EypH+LZsWy8zskjLfb8hLTytQYwDKiOfBHIQN9yppwS+wprEwTqp +KGvNPxNIF8/feFE5Dkbdft9D0c5Nhy0j8dRVcRSCRDFihBg1/Lyv5MRFEhGgtiXhD0A XlvOsCvqsjt/JsZ3Miy3cAdiAURANrXzx/dE6/HJ/TXC0mx7RwUbtGUboFhkoD5KoikE 8oRjsxL3uJdiqfc4DE9KrG5bhv6GIb3svJpl0KN+v+yYYYbxvAvemmzIbWBSrvnr/JFw JAHcKs9asNWQVBtiQ5yFhOEntOALTV0n+I1tnWSr1SmJq5vvAHpIpKUeZFzItzh4a2js NzKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ri11bVKWxZ8HBQVrgBnLCZL7on//0SsmMOvFkbNuqmY=; b=boCdpqAesgjAWxgnwA442OMASz9sGhQifOLawyHZzFUGDo3RuF9CAKKd7yk7eipIrL 1C3RgFKXpmMq8DuGCVRopsilw8P6nSYeiXm17gnWpWOczdaSI4JfmVwBJmVKiHf+xocr a82F2XskxV2PG2XmgH8BFtieHzbXv5yH6ELaIloK0QIwSDG0tOFS041M7itxqAYIV5Eh 1rDMNeNGLo80zBYMqXfXAlRDa55fuI0ZQZVv8gdGGSz8EiF9FT2m6wTWo/oudvEYgRNK heuM4DzyI72ftspJu3jduh36CpdojoSSwgFMkYRYeMqjytWER8Qj/Yi2S31mXJKCCndz BYew== X-Gm-Message-State: AFqh2ko3DiyE/EhFBovgOTrqJJHyXfpycRgj492+KyJi9tQbcPBUgYUk xy6/H6dQSvOOzVxuaSuOndZzIw== X-Received: by 2002:a05:6e02:13d2:b0:30c:251d:f98e with SMTP id v18-20020a056e0213d200b0030c251df98emr14071642ilj.27.1672854760959; Wed, 04 Jan 2023 09:52:40 -0800 (PST) Received: from presto.localdomain ([98.61.227.136]) by smtp.gmail.com with ESMTPSA id u3-20020a02cbc3000000b00375783003fcsm10872304jaq.136.2023.01.04.09.52.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 09:52:40 -0800 (PST) From: Alex Elder To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: caleb.connolly@linaro.org, mka@chromium.org, evgreen@chromium.org, andersson@kernel.org, quic_cpratapa@quicinc.com, quic_avuyyuru@quicinc.com, quic_jponduru@quicinc.com, quic_subashab@quicinc.com, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 3/6] net: ipa: enable IPA interrupt handlers separate from registration Date: Wed, 4 Jan 2023 11:52:30 -0600 Message-Id: <20230104175233.2862874-4-elder@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230104175233.2862874-1-elder@linaro.org> References: <20230104175233.2862874-1-elder@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754115742521134935?= X-GMAIL-MSGID: =?utf-8?q?1754115742521134935?= Expose ipa_interrupt_enable() and have functions that register IPA interrupt handlers enable them directly, rather than having the registration process do that. Do the same for disabling IPA interrupt handlers. Signed-off-by: Alex Elder --- v2 Declared enum ipa_irq_id at the top of "ipa_interrupt.c". drivers/net/ipa/ipa_interrupt.c | 8 ++------ drivers/net/ipa/ipa_interrupt.h | 15 +++++++++++++++ drivers/net/ipa/ipa_power.c | 6 +++++- drivers/net/ipa/ipa_uc.c | 4 ++++ 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/drivers/net/ipa/ipa_interrupt.c b/drivers/net/ipa/ipa_interrupt.c index 7b7388c14806f..87f4b94d02a3f 100644 --- a/drivers/net/ipa/ipa_interrupt.c +++ b/drivers/net/ipa/ipa_interrupt.c @@ -135,7 +135,7 @@ static void ipa_interrupt_enabled_update(struct ipa *ipa) } /* Enable an IPA interrupt type */ -static void ipa_interrupt_enable(struct ipa *ipa, enum ipa_irq_id ipa_irq) +void ipa_interrupt_enable(struct ipa *ipa, enum ipa_irq_id ipa_irq) { /* Update the IPA interrupt mask to enable it */ ipa->interrupt->enabled |= BIT(ipa_irq); @@ -143,7 +143,7 @@ static void ipa_interrupt_enable(struct ipa *ipa, enum ipa_irq_id ipa_irq) } /* Disable an IPA interrupt type */ -static void ipa_interrupt_disable(struct ipa *ipa, enum ipa_irq_id ipa_irq) +void ipa_interrupt_disable(struct ipa *ipa, enum ipa_irq_id ipa_irq) { /* Update the IPA interrupt mask to disable it */ ipa->interrupt->enabled &= ~BIT(ipa_irq); @@ -232,8 +232,6 @@ void ipa_interrupt_add(struct ipa_interrupt *interrupt, return; interrupt->handler[ipa_irq] = handler; - - ipa_interrupt_enable(interrupt->ipa, ipa_irq); } /* Remove the handler for an IPA interrupt type */ @@ -243,8 +241,6 @@ ipa_interrupt_remove(struct ipa_interrupt *interrupt, enum ipa_irq_id ipa_irq) if (WARN_ON(ipa_irq >= IPA_IRQ_COUNT)) return; - ipa_interrupt_disable(interrupt->ipa, ipa_irq); - interrupt->handler[ipa_irq] = NULL; } diff --git a/drivers/net/ipa/ipa_interrupt.h b/drivers/net/ipa/ipa_interrupt.h index f31fd9965fdc6..90b61e013064b 100644 --- a/drivers/net/ipa/ipa_interrupt.h +++ b/drivers/net/ipa/ipa_interrupt.h @@ -11,6 +11,7 @@ struct ipa; struct ipa_interrupt; +enum ipa_irq_id; /** * typedef ipa_irq_handler_t - IPA interrupt handler function type @@ -85,6 +86,20 @@ void ipa_interrupt_suspend_clear_all(struct ipa_interrupt *interrupt); */ void ipa_interrupt_simulate_suspend(struct ipa_interrupt *interrupt); +/** + * ipa_interrupt_enable() - Enable an IPA interrupt type + * @ipa: IPA pointer + * @ipa_irq: IPA interrupt ID + */ +void ipa_interrupt_enable(struct ipa *ipa, enum ipa_irq_id ipa_irq); + +/** + * ipa_interrupt_disable() - Disable an IPA interrupt type + * @ipa: IPA pointer + * @ipa_irq: IPA interrupt ID + */ +void ipa_interrupt_disable(struct ipa *ipa, enum ipa_irq_id ipa_irq); + /** * ipa_interrupt_config() - Configure the IPA interrupt framework * @ipa: IPA pointer diff --git a/drivers/net/ipa/ipa_power.c b/drivers/net/ipa/ipa_power.c index 8420f93128a26..9148d606d5fc2 100644 --- a/drivers/net/ipa/ipa_power.c +++ b/drivers/net/ipa/ipa_power.c @@ -337,10 +337,13 @@ int ipa_power_setup(struct ipa *ipa) ipa_interrupt_add(ipa->interrupt, IPA_IRQ_TX_SUSPEND, ipa_suspend_handler); + ipa_interrupt_enable(ipa, IPA_IRQ_TX_SUSPEND); ret = device_init_wakeup(&ipa->pdev->dev, true); - if (ret) + if (ret) { + ipa_interrupt_disable(ipa, IPA_IRQ_TX_SUSPEND); ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_TX_SUSPEND); + } return ret; } @@ -348,6 +351,7 @@ int ipa_power_setup(struct ipa *ipa) void ipa_power_teardown(struct ipa *ipa) { (void)device_init_wakeup(&ipa->pdev->dev, false); + ipa_interrupt_disable(ipa, IPA_IRQ_TX_SUSPEND); ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_TX_SUSPEND); } diff --git a/drivers/net/ipa/ipa_uc.c b/drivers/net/ipa/ipa_uc.c index 0a890b44c09e1..af541758d047f 100644 --- a/drivers/net/ipa/ipa_uc.c +++ b/drivers/net/ipa/ipa_uc.c @@ -187,7 +187,9 @@ void ipa_uc_config(struct ipa *ipa) ipa->uc_powered = false; ipa->uc_loaded = false; ipa_interrupt_add(interrupt, IPA_IRQ_UC_0, ipa_uc_interrupt_handler); + ipa_interrupt_enable(ipa, IPA_IRQ_UC_0); ipa_interrupt_add(interrupt, IPA_IRQ_UC_1, ipa_uc_interrupt_handler); + ipa_interrupt_enable(ipa, IPA_IRQ_UC_1); } /* Inverse of ipa_uc_config() */ @@ -195,7 +197,9 @@ void ipa_uc_deconfig(struct ipa *ipa) { struct device *dev = &ipa->pdev->dev; + ipa_interrupt_disable(ipa, IPA_IRQ_UC_1); ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_UC_1); + ipa_interrupt_disable(ipa, IPA_IRQ_UC_0); ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_UC_0); if (ipa->uc_loaded) ipa_power_retention(ipa, false); From patchwork Wed Jan 4 17:52:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 39052 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp5276524wrt; Wed, 4 Jan 2023 10:01:15 -0800 (PST) X-Google-Smtp-Source: AMrXdXsnVhpyG/g86zudsXj/uq4QuiwFliXZi2WCLOXbidsCMJQnITZSgG9MpO6pKlcWQbCi3rSB X-Received: by 2002:a17:906:fcc1:b0:7c0:e310:3191 with SMTP id qx1-20020a170906fcc100b007c0e3103191mr52998103ejb.11.1672855275148; Wed, 04 Jan 2023 10:01:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672855275; cv=none; d=google.com; s=arc-20160816; b=BfQbUEhDkw7094yQTjuF7UGEo0pxDDJ3iSfbRc/YkmDojINt5cXD+z0SvfdROPpc85 i1f1XhftUP6wPLh0nRvTaD3HHdXCPprSbc0K2z/sIq8g8bTscKLafeO3fVZpSPoYGm5n +gNIF5aalbdeb0stzh7PN2hAWcxTQ9zbkSeaRuaDVrk/bQeYp0MJCdZktq37CiIfe+of y87uTnCUpDgaCVO+YiNQ1aSb4INFDKDu3CmTBHd9XX8bfIxhxuChPCZLW7SS4ZiHq0mv 6HHtJuOBB22BbpBS36lRWf+PxpTd7X5GorsiL/56o+d63bCJtExguuvjOxzNg2o37c4Q 7L7w== 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=/QwLXlyTB2wFg+f6fFku0I75a5v4iUbGFGBGgx1ehZU=; b=ZWWctGgFTdpOvCSKX92luutd+l2qI4cp1C3SpqnZ3QtuXzaYYzz0+ipMtghPNGtJGp 0JRowXK9tyuI5AVX43498BzTF2fV5sbSGWTDByYnD7wTfOUqeMYkPL+oWIikcaO/d/L7 BAb3cbv9x5LMwNulC1ggZUuZnPEs0ASO59tVG+Dvcg1diKp/U4NOrJQRecqPvvG0YvTc aVC3sdW4Qdx4AB230NIp5ngRE6eQPKfQpdvkV1THbNOG6kdKMsa/Mop0hXLnkUjpSKkm PUWUuBLR7tiQMVMStQvv+yB5+R6sT8lAb2y365EqH95QbgngpkkbSXE2V1y7pxqWFw17 5ukw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xrrxam0X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 30-20020a17090600de00b007c17f750b75si25778539eji.796.2023.01.04.10.00.51; Wed, 04 Jan 2023 10:01:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xrrxam0X; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-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 S240133AbjADRxG (ORCPT + 99 others); Wed, 4 Jan 2023 12:53:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240019AbjADRwr (ORCPT ); Wed, 4 Jan 2023 12:52:47 -0500 Received: from mail-io1-xd30.google.com (mail-io1-xd30.google.com [IPv6:2607:f8b0:4864:20::d30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C42203B91C for ; Wed, 4 Jan 2023 09:52:42 -0800 (PST) Received: by mail-io1-xd30.google.com with SMTP id p66so18408197iof.1 for ; Wed, 04 Jan 2023 09:52:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/QwLXlyTB2wFg+f6fFku0I75a5v4iUbGFGBGgx1ehZU=; b=xrrxam0XOk7hykrPjRzHHIp0hv6JZmzE2vflvDLE1rjC6SR7Wt19lnE4BCK2OSlqF7 FRRdK76E2Ii6nVseaiIZ+AuHjnIfYccAj3WkNKPF4YWT0BEXaW0Y7PyRcOY5mYlGSKfJ H/cKOaqSxbOuLTratRvGFMmNa/+5p9Rbyu5Zg7Qarg7t2kDj2GxaxIgttXGOKAM5Un8y XOzE2XY5ss+E0FmBt1s7i4yju0XWtUdfd9Lshzaq8OUJR9n/dL0I/z/UM5u4PIwGajmq zfZtkvxuA8HHCCp85HCAeGovfy4g7Ank4ZULfl52A/yaMzIQN0L7nmJLZABfrvIt6Riw BlRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/QwLXlyTB2wFg+f6fFku0I75a5v4iUbGFGBGgx1ehZU=; b=tuhbhYK1w1RLX7xPoI+gxYTbw7kcQhi2AsWDeugkIDQLliVPTZoMlMyRudl7QNSohy i7Ar/Ed9uNklnW/VnRMsYQ3iL7yQCgA/7JUeLOnRSf29y48BEmlkEZxQxArFQq7x0t4b utD2JNP501sqiYAPqFSW5NqXUhWAUeZMMDfUo9o7G03tyKihVOIgtR/R9DqxgZPlnSv+ /Wy6N879ZSyFqScTODRLG+6+So77yK1vfQEmpbtA2aquZnJkzvF4X2/bIp4/4RCEmM+5 +of326HK7ruR7IFiXCNarQkFfdZZcUMNUnSJoV2cLucMrBM1i2tytAPmJshxKtoOTxjP 7KGQ== X-Gm-Message-State: AFqh2kr/Xn1MWnbu3N9v8/mEHdUDt5aEw73DFgw5P1YE+Rm4XEruQf5i zY5aRfP+0AmbaAUhwGeajsQVlA== X-Received: by 2002:a6b:f70e:0:b0:6e5:d22f:8566 with SMTP id k14-20020a6bf70e000000b006e5d22f8566mr43880789iog.14.1672854762126; Wed, 04 Jan 2023 09:52:42 -0800 (PST) Received: from presto.localdomain ([98.61.227.136]) by smtp.gmail.com with ESMTPSA id u3-20020a02cbc3000000b00375783003fcsm10872304jaq.136.2023.01.04.09.52.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 09:52:41 -0800 (PST) From: Alex Elder To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: caleb.connolly@linaro.org, mka@chromium.org, evgreen@chromium.org, andersson@kernel.org, quic_cpratapa@quicinc.com, quic_avuyyuru@quicinc.com, quic_jponduru@quicinc.com, quic_subashab@quicinc.com, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 4/6] net: ipa: register IPA interrupt handlers directly Date: Wed, 4 Jan 2023 11:52:31 -0600 Message-Id: <20230104175233.2862874-5-elder@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230104175233.2862874-1-elder@linaro.org> References: <20230104175233.2862874-1-elder@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754115893077838322?= X-GMAIL-MSGID: =?utf-8?q?1754115893077838322?= Declare the microcontroller IPA interrupt handler publicly, and assign it directly in ipa_interrupt_config(). Make the SUSPEND IPA interrupt handler public, and rename it ipa_power_suspend_handler(). Assign it directly in ipa_interrupt_config() as well. This makes it unnecessary to do this in ipa_interrupt_add(). Make similar changes for removing IPA interrupt handlers. The next two patches will finish the cleanup, removing the add/remove functions and the handler array entirely. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_interrupt.c | 16 ++++++++-------- drivers/net/ipa/ipa_power.c | 14 ++------------ drivers/net/ipa/ipa_power.h | 12 ++++++++++++ drivers/net/ipa/ipa_uc.c | 2 +- drivers/net/ipa/ipa_uc.h | 8 ++++++++ 5 files changed, 31 insertions(+), 21 deletions(-) diff --git a/drivers/net/ipa/ipa_interrupt.c b/drivers/net/ipa/ipa_interrupt.c index 87f4b94d02a3f..f32ac40a79372 100644 --- a/drivers/net/ipa/ipa_interrupt.c +++ b/drivers/net/ipa/ipa_interrupt.c @@ -26,6 +26,8 @@ #include "ipa.h" #include "ipa_reg.h" #include "ipa_endpoint.h" +#include "ipa_power.h" +#include "ipa_uc.h" #include "ipa_interrupt.h" /** @@ -228,20 +230,14 @@ void ipa_interrupt_simulate_suspend(struct ipa_interrupt *interrupt) void ipa_interrupt_add(struct ipa_interrupt *interrupt, enum ipa_irq_id ipa_irq, ipa_irq_handler_t handler) { - if (WARN_ON(ipa_irq >= IPA_IRQ_COUNT)) - return; - - interrupt->handler[ipa_irq] = handler; + WARN_ON(ipa_irq >= IPA_IRQ_COUNT); } /* Remove the handler for an IPA interrupt type */ void ipa_interrupt_remove(struct ipa_interrupt *interrupt, enum ipa_irq_id ipa_irq) { - if (WARN_ON(ipa_irq >= IPA_IRQ_COUNT)) - return; - - interrupt->handler[ipa_irq] = NULL; + WARN_ON(ipa_irq >= IPA_IRQ_COUNT); } /* Configure the IPA interrupt framework */ @@ -284,6 +280,10 @@ struct ipa_interrupt *ipa_interrupt_config(struct ipa *ipa) goto err_free_irq; } + interrupt->handler[IPA_IRQ_UC_0] = ipa_uc_interrupt_handler; + interrupt->handler[IPA_IRQ_UC_1] = ipa_uc_interrupt_handler; + interrupt->handler[IPA_IRQ_TX_SUSPEND] = ipa_power_suspend_handler; + return interrupt; err_free_irq: diff --git a/drivers/net/ipa/ipa_power.c b/drivers/net/ipa/ipa_power.c index 9148d606d5fc2..4198f8e97e40b 100644 --- a/drivers/net/ipa/ipa_power.c +++ b/drivers/net/ipa/ipa_power.c @@ -202,17 +202,7 @@ u32 ipa_core_clock_rate(struct ipa *ipa) return ipa->power ? (u32)clk_get_rate(ipa->power->core) : 0; } -/** - * ipa_suspend_handler() - Handle the suspend IPA interrupt - * @ipa: IPA pointer - * @irq_id: IPA interrupt type (unused) - * - * If an RX endpoint is suspended, and the IPA has a packet destined for - * that endpoint, the IPA generates a SUSPEND interrupt to inform the AP - * that it should resume the endpoint. If we get one of these interrupts - * we just wake up the system. - */ -static void ipa_suspend_handler(struct ipa *ipa, enum ipa_irq_id irq_id) +void ipa_power_suspend_handler(struct ipa *ipa, enum ipa_irq_id irq_id) { /* To handle an IPA interrupt we will have resumed the hardware * just to handle the interrupt, so we're done. If we are in a @@ -336,7 +326,7 @@ int ipa_power_setup(struct ipa *ipa) int ret; ipa_interrupt_add(ipa->interrupt, IPA_IRQ_TX_SUSPEND, - ipa_suspend_handler); + ipa_power_suspend_handler); ipa_interrupt_enable(ipa, IPA_IRQ_TX_SUSPEND); ret = device_init_wakeup(&ipa->pdev->dev, true); diff --git a/drivers/net/ipa/ipa_power.h b/drivers/net/ipa/ipa_power.h index 896f052e51a1c..3a4c59ea1222b 100644 --- a/drivers/net/ipa/ipa_power.h +++ b/drivers/net/ipa/ipa_power.h @@ -10,6 +10,7 @@ struct device; struct ipa; struct ipa_power_data; +enum ipa_irq_id; /* IPA device power management function block */ extern const struct dev_pm_ops ipa_pm_ops; @@ -47,6 +48,17 @@ void ipa_power_modem_queue_active(struct ipa *ipa); */ void ipa_power_retention(struct ipa *ipa, bool enable); +/** + * ipa_power_suspend_handler() - Handler for SUSPEND IPA interrupts + * @ipa: IPA pointer + * @irq_id: IPA interrupt ID (unused) + * + * If an RX endpoint is suspended, and the IPA has a packet destined for + * that endpoint, the IPA generates a SUSPEND interrupt to inform the AP + * that it should resume the endpoint. + */ +void ipa_power_suspend_handler(struct ipa *ipa, enum ipa_irq_id irq_id); + /** * ipa_power_setup() - Set up IPA power management * @ipa: IPA pointer diff --git a/drivers/net/ipa/ipa_uc.c b/drivers/net/ipa/ipa_uc.c index af541758d047f..6b7d289cfaffa 100644 --- a/drivers/net/ipa/ipa_uc.c +++ b/drivers/net/ipa/ipa_uc.c @@ -170,7 +170,7 @@ static void ipa_uc_response_hdlr(struct ipa *ipa) } } -static void ipa_uc_interrupt_handler(struct ipa *ipa, enum ipa_irq_id irq_id) +void ipa_uc_interrupt_handler(struct ipa *ipa, enum ipa_irq_id irq_id) { /* Silently ignore anything unrecognized */ if (irq_id == IPA_IRQ_UC_0) diff --git a/drivers/net/ipa/ipa_uc.h b/drivers/net/ipa/ipa_uc.h index 8514096e6f36f..85aa0df818c23 100644 --- a/drivers/net/ipa/ipa_uc.h +++ b/drivers/net/ipa/ipa_uc.h @@ -7,6 +7,14 @@ #define _IPA_UC_H_ struct ipa; +enum ipa_irq_id; + +/** + * ipa_uc_interrupt_handler() - Handler for microcontroller IPA interrupts + * @ipa: IPA pointer + * @irq_id: IPA interrupt ID + */ +void ipa_uc_interrupt_handler(struct ipa *ipa, enum ipa_irq_id irq_id); /** * ipa_uc_config() - Configure the IPA microcontroller subsystem From patchwork Wed Jan 4 17:52:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 39051 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp5275576wrt; Wed, 4 Jan 2023 09:59:35 -0800 (PST) X-Google-Smtp-Source: AMrXdXshJCfrzq2vgAr1FtX+neym7DDLwQv9PTcJWc65SesCW2I0IMzekB2FOFMa205AhtwF9qmE X-Received: by 2002:a17:907:c084:b0:7c1:22a6:818f with SMTP id st4-20020a170907c08400b007c122a6818fmr43364601ejc.25.1672855175851; Wed, 04 Jan 2023 09:59:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672855175; cv=none; d=google.com; s=arc-20160816; b=FlAwvc63apiUTFVvFjgxpMbjL9070BROYc7bUb86zi/ENgLo5rOZZRrbbN+NRq25L/ SlL7JYjjG0Xh5+dX+/P3rpirR6DucOZUjsM/GHni4wJkmU7mVBEAIuNQG1CCMLvL5gQe A4SsSuEscNjukbXFqqr8Cv3NCXxhNT4X46zGJF1tulE2mMZZ8hC4Sc+wKA811fQZitTI gAtSDFP1J4ZDE0E5fqCprv0y9fq/nyB4Gn3yW16jFVrgcdvWllf+g9/sO0syey/FLYBU yOZj/jOxpsptL0LSDXcFhA+znSqI/+L4UREHm//HNNdG0GnfXrMxH13N2q6bbk0oEzGi Jddw== 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=5Jqtwulo4xzPm3E3C/EoXy5OKlXyrXoplOZxQkvpLg0=; b=ocD6OsD/v95glkB4m8vgukm1QTWCpTVUE4PL7fAa+LoAkg5hZSH2Olvv0l5mDLpHbI b/33+bWfIODQJa3ghv2Bo4fLYowy28bGZp4Da3p1/hk/PtujxUT5I+3eHsisPA6mTCOE QE0xTrHBx2stmUWu6KLVPgDknkjociEdFlAmLVMqybcuESiHHPZmz1DFPXrRdCCvzmke LvxYlUDHBzqts02gaQyDTaAEHAFM1WR/1yrhRZAU4l95+FieP74niA0VeHBR63xqxVn1 148GuQwJ0QEYtdYKj8Cfg+6WziKlQkFp6eotENMzba3Tj7b42N5jmMemLjMPS2k/Quk7 BugQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i7I+Knrt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z10-20020a50cd0a000000b0046bdaa564bdsi28520070edi.419.2023.01.04.09.59.12; Wed, 04 Jan 2023 09:59:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i7I+Knrt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-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 S240153AbjADRxM (ORCPT + 99 others); Wed, 4 Jan 2023 12:53:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240040AbjADRws (ORCPT ); Wed, 4 Jan 2023 12:52:48 -0500 Received: from mail-il1-x131.google.com (mail-il1-x131.google.com [IPv6:2607:f8b0:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0999933D68 for ; Wed, 4 Jan 2023 09:52:44 -0800 (PST) Received: by mail-il1-x131.google.com with SMTP id y2so19852201ily.5 for ; Wed, 04 Jan 2023 09:52:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5Jqtwulo4xzPm3E3C/EoXy5OKlXyrXoplOZxQkvpLg0=; b=i7I+Knrt5TZe13bZa2OB2m65UCtltdGpXYGt7kgUBd9mUK3GECbDzOjwJU0xb2aeV2 YsykgCL/u0831awefPQ6L1vxBYNcn94VLsoYFkgjkqqaWEJitzDwnFPFFLvbu1ixOMNf 4GlakvnaiSiBxlvSqegICcSiZ3fFZcabGuHLPBSzXDNmZZF9L5o7Ccai17B8G6C/oqpO ZFjJq/Xp7M4uPjT9GBrGdGDhEi99ECUQn4bkoTxtHb/CjFWn1cNaHIuXhkL1X3Q9IoIV oqYGUn2dPE+bes8+9fGveAxO4FpHnrk2KLXvbtqAPLMvuipQcTXUFkhbjCITcybiZAGP 0t4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5Jqtwulo4xzPm3E3C/EoXy5OKlXyrXoplOZxQkvpLg0=; b=eiuTKSVE1x0pvuO+trtXn4X8XtbmrFLYMSSX7mOrBLqOp3aM0RbfIYyBkMBcfeSjZs afdweqYoLrscNaHjouOZwi6i8rdBnndAa3+0S6EVBb72F6Ma+vS1uu6OKvBDIKxIJ0ZZ g9F/nDW2xaIRKNTD0hlJ4aJQGLImOyfdtxP2tU1c1FALhPG6+SiydSsIgNsptTPFlcAJ DnHGMGZr4zN0ZzcOuoCSRO8N0mJzTI1iwP5h13PQlOoA4AEWtjWRBBdMCs+k5u+B4cVq yLp5NfqQdbG5kb82zsPJY8KsENjL63aHnCGbH45WMgmizjAJKzz7QXl6DWTdaFVaIGwL 5uIA== X-Gm-Message-State: AFqh2kpRucXDzSApltubD6j1pzX7T2wjZ7Isl0689zBf7U8JqE+FMB3q kLY3DCuFuV3GU0WsQu9235qh6g== X-Received: by 2002:a92:d811:0:b0:30a:fb1a:a037 with SMTP id y17-20020a92d811000000b0030afb1aa037mr38951857ilm.31.1672854763362; Wed, 04 Jan 2023 09:52:43 -0800 (PST) Received: from presto.localdomain ([98.61.227.136]) by smtp.gmail.com with ESMTPSA id u3-20020a02cbc3000000b00375783003fcsm10872304jaq.136.2023.01.04.09.52.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 09:52:42 -0800 (PST) From: Alex Elder To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: caleb.connolly@linaro.org, mka@chromium.org, evgreen@chromium.org, andersson@kernel.org, quic_cpratapa@quicinc.com, quic_avuyyuru@quicinc.com, quic_jponduru@quicinc.com, quic_subashab@quicinc.com, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 5/6] net: ipa: kill ipa_interrupt_add() Date: Wed, 4 Jan 2023 11:52:32 -0600 Message-Id: <20230104175233.2862874-6-elder@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230104175233.2862874-1-elder@linaro.org> References: <20230104175233.2862874-1-elder@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754115788861094988?= X-GMAIL-MSGID: =?utf-8?q?1754115788861094988?= The dynamic assignment of IPA interrupt handlers isn't needed; we only handle three IPA interrupt types, and their handler functions are now assigned directly. We can get rid of ipa_interrupt_add() and ipa_interrupt_remove() now, because they serve no purpose. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_interrupt.c | 16 ++-------------- drivers/net/ipa/ipa_interrupt.h | 33 --------------------------------- drivers/net/ipa/ipa_power.c | 7 +------ drivers/net/ipa/ipa_uc.c | 6 ------ 4 files changed, 3 insertions(+), 59 deletions(-) diff --git a/drivers/net/ipa/ipa_interrupt.c b/drivers/net/ipa/ipa_interrupt.c index f32ac40a79372..f0a68b0a242c1 100644 --- a/drivers/net/ipa/ipa_interrupt.c +++ b/drivers/net/ipa/ipa_interrupt.c @@ -30,6 +30,8 @@ #include "ipa_uc.h" #include "ipa_interrupt.h" +typedef void (*ipa_irq_handler_t)(struct ipa *ipa, enum ipa_irq_id irq_id); + /** * struct ipa_interrupt - IPA interrupt information * @ipa: IPA pointer @@ -226,20 +228,6 @@ void ipa_interrupt_simulate_suspend(struct ipa_interrupt *interrupt) ipa_interrupt_process(interrupt, IPA_IRQ_TX_SUSPEND); } -/* Add a handler for an IPA interrupt */ -void ipa_interrupt_add(struct ipa_interrupt *interrupt, - enum ipa_irq_id ipa_irq, ipa_irq_handler_t handler) -{ - WARN_ON(ipa_irq >= IPA_IRQ_COUNT); -} - -/* Remove the handler for an IPA interrupt type */ -void -ipa_interrupt_remove(struct ipa_interrupt *interrupt, enum ipa_irq_id ipa_irq) -{ - WARN_ON(ipa_irq >= IPA_IRQ_COUNT); -} - /* Configure the IPA interrupt framework */ struct ipa_interrupt *ipa_interrupt_config(struct ipa *ipa) { diff --git a/drivers/net/ipa/ipa_interrupt.h b/drivers/net/ipa/ipa_interrupt.h index 90b61e013064b..764a65e6b5036 100644 --- a/drivers/net/ipa/ipa_interrupt.h +++ b/drivers/net/ipa/ipa_interrupt.h @@ -13,39 +13,6 @@ struct ipa; struct ipa_interrupt; enum ipa_irq_id; -/** - * typedef ipa_irq_handler_t - IPA interrupt handler function type - * @ipa: IPA pointer - * @irq_id: interrupt type - * - * Callback function registered by ipa_interrupt_add() to handle a specific - * IPA interrupt type - */ -typedef void (*ipa_irq_handler_t)(struct ipa *ipa, enum ipa_irq_id irq_id); - -/** - * ipa_interrupt_add() - Register a handler for an IPA interrupt type - * @interrupt: IPA interrupt structure - * @irq_id: IPA interrupt type - * @handler: Handler function for the interrupt - * - * Add a handler for an IPA interrupt and enable it. IPA interrupt - * handlers are run in threaded interrupt context, so are allowed to - * block. - */ -void ipa_interrupt_add(struct ipa_interrupt *interrupt, enum ipa_irq_id irq_id, - ipa_irq_handler_t handler); - -/** - * ipa_interrupt_remove() - Remove the handler for an IPA interrupt type - * @interrupt: IPA interrupt structure - * @irq_id: IPA interrupt type - * - * Remove an IPA interrupt handler and disable it. - */ -void ipa_interrupt_remove(struct ipa_interrupt *interrupt, - enum ipa_irq_id irq_id); - /** * ipa_interrupt_suspend_enable - Enable TX_SUSPEND for an endpoint * @interrupt: IPA interrupt structure diff --git a/drivers/net/ipa/ipa_power.c b/drivers/net/ipa/ipa_power.c index 4198f8e97e40b..a282512ebd2d8 100644 --- a/drivers/net/ipa/ipa_power.c +++ b/drivers/net/ipa/ipa_power.c @@ -325,15 +325,11 @@ int ipa_power_setup(struct ipa *ipa) { int ret; - ipa_interrupt_add(ipa->interrupt, IPA_IRQ_TX_SUSPEND, - ipa_power_suspend_handler); ipa_interrupt_enable(ipa, IPA_IRQ_TX_SUSPEND); ret = device_init_wakeup(&ipa->pdev->dev, true); - if (ret) { + if (ret) ipa_interrupt_disable(ipa, IPA_IRQ_TX_SUSPEND); - ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_TX_SUSPEND); - } return ret; } @@ -342,7 +338,6 @@ void ipa_power_teardown(struct ipa *ipa) { (void)device_init_wakeup(&ipa->pdev->dev, false); ipa_interrupt_disable(ipa, IPA_IRQ_TX_SUSPEND); - ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_TX_SUSPEND); } /* Initialize IPA power management */ diff --git a/drivers/net/ipa/ipa_uc.c b/drivers/net/ipa/ipa_uc.c index 6b7d289cfaffa..cb8a76a75f21d 100644 --- a/drivers/net/ipa/ipa_uc.c +++ b/drivers/net/ipa/ipa_uc.c @@ -182,13 +182,9 @@ void ipa_uc_interrupt_handler(struct ipa *ipa, enum ipa_irq_id irq_id) /* Configure the IPA microcontroller subsystem */ void ipa_uc_config(struct ipa *ipa) { - struct ipa_interrupt *interrupt = ipa->interrupt; - ipa->uc_powered = false; ipa->uc_loaded = false; - ipa_interrupt_add(interrupt, IPA_IRQ_UC_0, ipa_uc_interrupt_handler); ipa_interrupt_enable(ipa, IPA_IRQ_UC_0); - ipa_interrupt_add(interrupt, IPA_IRQ_UC_1, ipa_uc_interrupt_handler); ipa_interrupt_enable(ipa, IPA_IRQ_UC_1); } @@ -198,9 +194,7 @@ void ipa_uc_deconfig(struct ipa *ipa) struct device *dev = &ipa->pdev->dev; ipa_interrupt_disable(ipa, IPA_IRQ_UC_1); - ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_UC_1); ipa_interrupt_disable(ipa, IPA_IRQ_UC_0); - ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_UC_0); if (ipa->uc_loaded) ipa_power_retention(ipa, false); From patchwork Wed Jan 4 17:52:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 39050 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp5275537wrt; Wed, 4 Jan 2023 09:59:27 -0800 (PST) X-Google-Smtp-Source: AMrXdXvR0nnsXzxKezQRu13tzS5v5iNeBSnAlOuZ1or2YSDrCuqTkIZGmYi2+k07B4I6UE+s4Yx6 X-Received: by 2002:a17:906:6dce:b0:7c3:e3ef:bca1 with SMTP id j14-20020a1709066dce00b007c3e3efbca1mr40216944ejt.60.1672855167466; Wed, 04 Jan 2023 09:59:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672855167; cv=none; d=google.com; s=arc-20160816; b=k262ZTruYf+M+m4ECrP/XeBaIwUDL8sMkU3Rrjvs+mBj7of6NqwdH4+Ok/zLeqyCcv RuF3HwB9LVIT2krmYy+tYw0XzXHyVm+LKhzCEz7HOCgptAqZdQl34K5Dqxz2c07AEcKm IG4EilwQx/QMz1jdnzFRogMCIP1Xi/OLmn6zA0YpeeQxoMUl+SYrjrWLSPva1blWxyCm qArNwjdbl9ZGbMDXGQAUJYqXpdfCba0z4rmjfvW7ESjqeYsB1/LZ4YloNgH9KVGJeHHP nKPBaZEPn/5VDbMOkwLwxI4izLNLgIMNRfIbE026GDYRr2xmrcy8AFUZTC56s/SqI1qO NaWg== 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=25pBUtrT1XiV3gX50trdZQF7DviwuSyPLPkde8po6zE=; b=Jrqrhu5EWVfnEQt6xtarzTQ0hWQuDsl2I4YDiQXU2ygO36kUJTFZlRiO+wIlxNX0Zn a8L4HCAHp4GI55oOIWC/kljQQKgYlBEemwSI1VZG+FpMpOnCPoubfPE+Sl25dcTJLGjk 7VHV0PwYgVWZC145fybTFs0e+3XPkeHVdZna1C4ZS9oljZ7OuWVNLihQd6OFfa8cHrMB /GAmWQL0OaFLFc+nMMQEP5KzzhJD7+6L+VQvlI9PsGDjN6KcUXlFqHsvGW7Ps2ytNS2w qAbZ7JYWoiIJh6YDT2krK1i7haH9iBzihuiKDSue6EyiVkbZWITk/rTEAxRs+7rWFPP4 69JA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QzGxU6Dy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i15-20020a1709064fcf00b0084c6438e6bdsi21957719ejw.805.2023.01.04.09.59.04; Wed, 04 Jan 2023 09:59:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QzGxU6Dy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-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 S240144AbjADRxJ (ORCPT + 99 others); Wed, 4 Jan 2023 12:53:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240062AbjADRws (ORCPT ); Wed, 4 Jan 2023 12:52:48 -0500 Received: from mail-il1-x12d.google.com (mail-il1-x12d.google.com [IPv6:2607:f8b0:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DA7E34762 for ; Wed, 4 Jan 2023 09:52:45 -0800 (PST) Received: by mail-il1-x12d.google.com with SMTP id c20so16007480ilj.10 for ; Wed, 04 Jan 2023 09:52:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=25pBUtrT1XiV3gX50trdZQF7DviwuSyPLPkde8po6zE=; b=QzGxU6DyX6RsSixFWY74idDrVdmgX5O5hTxK/7AVVmBGM8s0hr4iCZZLCcjXZoSEMo JWzBpHqdSe9BavTDo1C6VPwZBh4yd7D4SkIr78s8hd2a/rUmtt94bbBcBS0wh36WyGl4 ehpgsPYz5KsFI1zy4JkyPAitdwH94bdRfNRVIoWNP/AghYb1vvAbIevXUkR05tl9LG0R ClHyTNVjC3SAHP4TXVib2rWVo2QIUsLINdy0w03Q137gUED3/pE++84/SC0dxTQL/wTJ tuMTKY1bb/g08dJk51Lm0QdF2Gh3dqeintbZS179zTj2AOjauGzYOQCJ6dn03yb5ujgc Y8Rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=25pBUtrT1XiV3gX50trdZQF7DviwuSyPLPkde8po6zE=; b=Cqw+myGPVzAu+71NYpNHFcfQUtB9dKqqs7sgs7D3HSbIOYrrVAy+lEPTB7sBtSaATo bt5vbMHHqL2Cs27N3TEbahmvFnJ8xRCmPnOq9FcFB5OBLmhHItbCmZ0U2fh8KtG+c1yp ET4GqZqhx+GVO5rSc7XBuHxOYnqVZBgimJvGmPQMJ7IlVeF3tauBOjuvxgmKpVESHzwO u89SJLMomTWlg+FlOuxh+QrzyL8y+GXqYTSY8WGwxfqQs0K/Sn8ICafilPtFxin3eNnj cTTujNO355bGIUIT+rS03X7GUVGkcSvTkeG+iHa0xhhe+HaSeDVAU2eJTOstdQGbrwwI oZgA== X-Gm-Message-State: AFqh2kprVxDnP4j9FRoMv80S7dpEZplapdbi/71iP1vs66YXbksnjXWR kMH7Q5uj24nApvYQCMgCTXXWbA== X-Received: by 2002:a92:d06:0:b0:30c:2bb4:a2dc with SMTP id 6-20020a920d06000000b0030c2bb4a2dcmr12940791iln.22.1672854764635; Wed, 04 Jan 2023 09:52:44 -0800 (PST) Received: from presto.localdomain ([98.61.227.136]) by smtp.gmail.com with ESMTPSA id u3-20020a02cbc3000000b00375783003fcsm10872304jaq.136.2023.01.04.09.52.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 09:52:44 -0800 (PST) From: Alex Elder To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: caleb.connolly@linaro.org, mka@chromium.org, evgreen@chromium.org, andersson@kernel.org, quic_cpratapa@quicinc.com, quic_avuyyuru@quicinc.com, quic_jponduru@quicinc.com, quic_subashab@quicinc.com, elder@kernel.org, netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 6/6] net: ipa: don't maintain IPA interrupt handler array Date: Wed, 4 Jan 2023 11:52:33 -0600 Message-Id: <20230104175233.2862874-7-elder@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230104175233.2862874-1-elder@linaro.org> References: <20230104175233.2862874-1-elder@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754115779929796623?= X-GMAIL-MSGID: =?utf-8?q?1754115779929796623?= We can call the two IPA interrupt handler functions directly; there's no need to maintain the array of handler function pointers any more. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_interrupt.c | 46 ++++++++++++++------------------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/drivers/net/ipa/ipa_interrupt.c b/drivers/net/ipa/ipa_interrupt.c index f0a68b0a242c1..5f047b29e6ef0 100644 --- a/drivers/net/ipa/ipa_interrupt.c +++ b/drivers/net/ipa/ipa_interrupt.c @@ -30,54 +30,52 @@ #include "ipa_uc.h" #include "ipa_interrupt.h" -typedef void (*ipa_irq_handler_t)(struct ipa *ipa, enum ipa_irq_id irq_id); - /** * struct ipa_interrupt - IPA interrupt information * @ipa: IPA pointer * @irq: Linux IRQ number used for IPA interrupts * @enabled: Mask indicating which interrupts are enabled - * @handler: Array of handlers indexed by IPA interrupt ID */ struct ipa_interrupt { struct ipa *ipa; u32 irq; u32 enabled; - ipa_irq_handler_t handler[IPA_IRQ_COUNT]; }; -/* Returns true if the interrupt type is associated with the microcontroller */ -static bool ipa_interrupt_uc(struct ipa_interrupt *interrupt, u32 irq_id) -{ - return irq_id == IPA_IRQ_UC_0 || irq_id == IPA_IRQ_UC_1; -} - /* Process a particular interrupt type that has been received */ static void ipa_interrupt_process(struct ipa_interrupt *interrupt, u32 irq_id) { - bool uc_irq = ipa_interrupt_uc(interrupt, irq_id); struct ipa *ipa = interrupt->ipa; const struct ipa_reg *reg; u32 mask = BIT(irq_id); u32 offset; - /* For microcontroller interrupts, clear the interrupt right away, - * "to avoid clearing unhandled interrupts." - */ reg = ipa_reg(ipa, IPA_IRQ_CLR); offset = ipa_reg_offset(reg); - if (uc_irq) + + switch (irq_id) { + case IPA_IRQ_UC_0: + case IPA_IRQ_UC_1: + /* For microcontroller interrupts, clear the interrupt right + * away, "to avoid clearing unhandled interrupts." + */ iowrite32(mask, ipa->reg_virt + offset); + ipa_uc_interrupt_handler(ipa, irq_id); + break; - if (irq_id < IPA_IRQ_COUNT && interrupt->handler[irq_id]) - interrupt->handler[irq_id](interrupt->ipa, irq_id); + case IPA_IRQ_TX_SUSPEND: + /* Clearing the SUSPEND_TX interrupt also clears the + * register that tells us which suspended endpoint(s) + * caused the interrupt, so defer clearing until after + * the handler has been called. + */ + ipa_power_suspend_handler(ipa, irq_id); + fallthrough; - /* Clearing the SUSPEND_TX interrupt also clears the register - * that tells us which suspended endpoint(s) caused the interrupt, - * so defer clearing until after the handler has been called. - */ - if (!uc_irq) + default: /* Silently ignore (and clear) any other condition */ iowrite32(mask, ipa->reg_virt + offset); + break; + } } /* IPA IRQ handler is threaded */ @@ -268,10 +266,6 @@ struct ipa_interrupt *ipa_interrupt_config(struct ipa *ipa) goto err_free_irq; } - interrupt->handler[IPA_IRQ_UC_0] = ipa_uc_interrupt_handler; - interrupt->handler[IPA_IRQ_UC_1] = ipa_uc_interrupt_handler; - interrupt->handler[IPA_IRQ_TX_SUSPEND] = ipa_power_suspend_handler; - return interrupt; err_free_irq: