Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp819994rdb; Tue, 19 Sep 2023 11:02:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEFihn4ceOZnQDkYLiK7DePMLrYER8+EDfyQRQtOftztYCMRoW7YiK2KOAogNCOP2Ela7uL X-Received: by 2002:a05:6a20:5488:b0:133:8784:15f7 with SMTP id i8-20020a056a20548800b00133878415f7mr4128693pzk.14.1695146531822; Tue, 19 Sep 2023 11:02:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695146531; cv=none; d=google.com; s=arc-20160816; b=yIU2Bv7WgvOnWPgQV/wpZ+OIMEK6TSgjqY3P9hU8GsOJl0VwYXbQm+SU2oDGrkL1SJ CzmdhOP/qiVkgJkVikEh37T4RiSZ7et9iKQNjlxTzcNSMOjjxQdCi279QIxhG9FRwrn3 0+0Ujv4p54fzvykWr/sucPqIVO4QXXPstMxr0gpcFXoGb+P+My9mK6dUkEsD/pcmt7vW rUAtaTw3XT4b6dj+0n2e43h9TbXnsok0AZCPuM/TVo+pi/5AisVOF3JG++pcVt0ZkEIl ooa3edsCbLvvOwWzmqPAMRFhrlLB4niJLv1maNSRkyX01tHveHw/yMBzigPhh6Fy9EaN yS+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=wadIVfqlESM5a6EiU3NriwgWYc8PERb8uL3hTdC3S5g=; fh=4el59U4+pZcpwEMge0ez0uyzWGPv5BNsUtYmk+IM8i0=; b=HM9f0sbLxRiySmquptvs7UfRr9QetAUQySmH1pgTM4SJznNXFbVVE/NclSG/tSD7GV nfQARB78fiCV/Fg3FDllU+B1EeAcr1ocD3NTrJ8Fgr4mnoyzsE+bkBGGQa7ijCV5jnb4 FT2eBAKAA6MzYEdUTxE4Gl3KPASZbW+nb3FYpZYySBJi/GLX10ZW3ihh4xh/D6Wbzet0 UTGRIrM3TMbMeVj7s4dwdZ0nbknCxYzjtsz/VbAnQF6l2+SBllgGEuVYj2kIKhvvf9lQ GwphXa2O5hlq2SFE2UD0DCRsme9SeVGGEUrh1/gneXJfPwSwXdg85uw50Liv44zMVPLC O3aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=FMl3t6ng; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id x24-20020a631718000000b0057751b7788esi10006183pgl.488.2023.09.19.11.02.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 11:02:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=FMl3t6ng; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 637F680BD3BE; Mon, 18 Sep 2023 23:20:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230377AbjISGU1 (ORCPT + 99 others); Tue, 19 Sep 2023 02:20:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230006AbjISGUU (ORCPT ); Tue, 19 Sep 2023 02:20:20 -0400 Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07AFA102 for ; Mon, 18 Sep 2023 23:20:13 -0700 (PDT) Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 38J6JRoS033901; Tue, 19 Sep 2023 01:19:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1695104367; bh=wadIVfqlESM5a6EiU3NriwgWYc8PERb8uL3hTdC3S5g=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=FMl3t6ngf0FZAd+pVId+Gp1u1NVeHn4rEhBJC/Jxb1GHCe8Nf1jHd2HnOW4ZyHXEK nyAZt1QTAJ+f0XzqnLAq1VDs4AOaN1dD0OcBvEftli/qWkUj695ilOvtLbJNBfDxUc AQwNciqmvWLJ30RElTNCLiYQeAPHOoGb1oGt2I3g= Received: from DFLE102.ent.ti.com (dfle102.ent.ti.com [10.64.6.23]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 38J6JQ1l023687 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 19 Sep 2023 01:19:26 -0500 Received: from DFLE107.ent.ti.com (10.64.6.28) by DFLE102.ent.ti.com (10.64.6.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Tue, 19 Sep 2023 01:19:26 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE107.ent.ti.com (10.64.6.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Tue, 19 Sep 2023 01:19:26 -0500 Received: from lelv0854.itg.ti.com (lelv0854.itg.ti.com [10.181.64.140]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 38J6JQpt084815; Tue, 19 Sep 2023 01:19:26 -0500 Received: from localhost (danish-tpc.dhcp.ti.com [10.24.69.199]) by lelv0854.itg.ti.com (8.14.7/8.14.7) with ESMTP id 38J6JPOU016522; Tue, 19 Sep 2023 01:19:26 -0500 From: MD Danish Anwar To: Grzegorz Jaszczyk , Suman Anna , David Lechner , Roger Quadros , "Andrew F. Davis" , Marc Zyngier , Thomas Gleixner CC: , , , , Subject: [PATCH 3/3] irqchip/irq-pruss-intc: Fix processing of IEP interrupts Date: Tue, 19 Sep 2023 11:49:00 +0530 Message-ID: <20230919061900.369300-4-danishanwar@ti.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230919061900.369300-1-danishanwar@ti.com> References: <20230919061900.369300-1-danishanwar@ti.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,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 agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Mon, 18 Sep 2023 23:20:50 -0700 (PDT) From: Suman Anna It was discovered that IEP capture/compare IRQs (event #7 on all SoCs and event #56 on K3 SoCs) are always triggered twice when PPS is generated and CMP hit event detected by IEP. An example of the problem is: pruss_intc_irq_handler generic_handle_irq handle_level_irq mask_ack_irq -> IRQ 7 masked and asked in INTC, but it's not yet cleared on HW level handle_irq_event() icss_iep_cap_cmp_handler() -> IRQ 7 is actually processed in HW irq_finalize_oneshot() unmask_irq() pruss_intc_irq_unmask() -> IRQ 7 status is still observed as set The solution is to actually ack these IRQs from pruss_intc_irq_unmask() after the IRQ source is cleared in HW. No public errata available for this yet. Fixes: 04e2d1e06978 ("irqchip/irq-pruss-intc: Add a PRUSS irqchip driver for PRUSS interrupts") Signed-off-by: Grygorii Strashko Signed-off-by: Suman Anna Signed-off-by: MD Danish Anwar --- drivers/irqchip/irq-pruss-intc.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/irqchip/irq-pruss-intc.c b/drivers/irqchip/irq-pruss-intc.c index 3cf684ede564..9907847dbda8 100644 --- a/drivers/irqchip/irq-pruss-intc.c +++ b/drivers/irqchip/irq-pruss-intc.c @@ -70,6 +70,8 @@ #define MAX_PRU_SYS_EVENTS 160 #define MAX_PRU_CHANNELS 20 +#define MAX_PRU_INT_EVENTS 64 + /** * struct pruss_intc_map_record - keeps track of actual mapping state * @value: The currently mapped value (channel or host) @@ -85,10 +87,13 @@ struct pruss_intc_map_record { * @num_system_events: number of input system events handled by the PRUSS INTC * @num_host_events: number of host events (which is equal to number of * channels) supported by the PRUSS INTC + * @quirky_events: bitmask of events that need quirky IRQ handling (limited to + * (internal sources only for now, so 64 bits suffice) */ struct pruss_intc_match_data { u8 num_system_events; u8 num_host_events; + u64 quirky_events; }; /** @@ -304,6 +309,10 @@ static void pruss_intc_irq_ack(struct irq_data *data) struct pruss_intc *intc = irq_data_get_irq_chip_data(data); unsigned int hwirq = data->hwirq; + if (hwirq < MAX_PRU_INT_EVENTS && + intc->soc_config->quirky_events & BIT_ULL(hwirq)) + return; + pruss_intc_write_reg(intc, PRU_INTC_SICR, hwirq); } @@ -320,6 +329,9 @@ static void pruss_intc_irq_unmask(struct irq_data *data) struct pruss_intc *intc = irq_data_get_irq_chip_data(data); unsigned int hwirq = data->hwirq; + if (hwirq < MAX_PRU_INT_EVENTS && + intc->soc_config->quirky_events & BIT_ULL(hwirq)) + pruss_intc_write_reg(intc, PRU_INTC_SICR, hwirq); pruss_intc_write_reg(intc, PRU_INTC_EISR, hwirq); } @@ -644,11 +656,13 @@ static int pruss_intc_remove(struct platform_device *pdev) static const struct pruss_intc_match_data pruss_intc_data = { .num_system_events = 64, .num_host_events = 10, + .quirky_events = BIT_ULL(7), /* IEP capture/compare event */ }; static const struct pruss_intc_match_data icssg_intc_data = { .num_system_events = 160, .num_host_events = 20, + .quirky_events = BIT_ULL(7) | BIT_ULL(56), /* IEP{0,1} capture/compare events */ }; static const struct of_device_id pruss_intc_of_match[] = { -- 2.34.1