Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp178571ybb; Tue, 24 Mar 2020 19:36:09 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsFriJp0sPMsRcs5LfsD9RdWjQfpX3cMcwBxyedEscE/UNHedbcdNhlo60mNLAbldOHgBEL X-Received: by 2002:a9d:7607:: with SMTP id k7mr863625otl.205.1585103769328; Tue, 24 Mar 2020 19:36:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585103769; cv=none; d=google.com; s=arc-20160816; b=Ez1QFF32OTBAVD8dmJ2QV68G3x2L7wKkJF5gjfFqxklJw4rx8NJ7QRQDqQyKK6yXMW qDCbBNDMUyZMxW3sxGCgbjXrg0GX7sIki/0zj6du85YW2t8qFWhLb5Z3fMGne+TV+enI T6w7rfB/Cxuku8mNGpDnOkvhl3n3YSZ2lXWC5Pp2Ksi5Cer7J6PscQCy9CtCafdvXHRz Tp1ylytijd+2c9uvAmIwg1K9cNS+msampUzyX9GU4zWL7OW+9hGl1fD/Vp39f1G2JNcf Z8SHkfsPRYmytCpFi/ldh6322U78ZK7goOWdvOIA4t1cSk0zUXzAxVfQYXM4noMhMWvJ EpCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:subject:message-id:cc:to:from :dkim-signature; bh=ptczmo4zdH5SitmdgLb31uq0UnwEPiyg4NeT2CVppvU=; b=cY2qyEwjOlx5DF8FZC87MJUvtRgvTBc8c2UPhve7XH6KSEFnZM4NsZJNrwRWeJ1cWn vCfJ8w3UoPIv6+bw31RyFAHuiPenQkdBfrGNZMe9y/X9wyF4vDhRUKAHleVCPSiEix4l +TJ6cbnRaz2xOygFDdd81XBs+zHFLwcxVurmSvVSi8nrclbRFpuvWeELBUFNiFBQqeFH LhUtBiWy7CNMAyFbqoCPD7LLS5X364Ifor5DG/Hntkn4pEk5AKyI9F8XM+0NZczgnsUP HhSYvZ5raRlFlsKG8UvsZ1bQghO8RBYEmuu2SA2JwUd2434GtmMxqmiIWyvmrNQ38+JM 6rOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@flygoat.com header.s=mail header.b=U3fLccN5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u10si10084377otj.235.2020.03.24.19.35.57; Tue, 24 Mar 2020 19:36:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@flygoat.com header.s=mail header.b=U3fLccN5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=flygoat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727368AbgCYCem (ORCPT + 99 others); Tue, 24 Mar 2020 22:34:42 -0400 Received: from sender3-op-o12.zoho.com.cn ([124.251.121.243]:17873 "EHLO sender3-op-o12.zoho.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727268AbgCYCel (ORCPT ); Tue, 24 Mar 2020 22:34:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1585103520; s=mail; d=flygoat.com; i=jiaxun.yang@flygoat.com; h=From:To:Cc:Message-ID:Subject:Date:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Content-Type; bh=ptczmo4zdH5SitmdgLb31uq0UnwEPiyg4NeT2CVppvU=; b=U3fLccN5PpEN49FIfATzRjJH80dFiWVFbyS9eIHRHxNtbZ3rggAtvKp3FwKs8mAG q94WljlhqdA05aYmCnLeye4R9VeNNfC8rIUJCz1DVLO3TjEnKUr+4lqC1fmktHctRVd uDRtf6qVragd+LeKaRrQvbOMick44tJkpo0Qj5Yk= Received: from localhost.localdomain (39.155.141.144 [39.155.141.144]) by mx.zoho.com.cn with SMTPS id 1585103517027656.9551692102889; Wed, 25 Mar 2020 10:31:57 +0800 (CST) From: Jiaxun Yang To: linux-mips@vger.kernel.org Cc: Jiaxun Yang , Huacai Chen , Marc Zyngier , Thomas Gleixner , Jason Cooper , Rob Herring , Mark Rutland , Thomas Bogendoerfer , Jonathan Corbet , Paul Cercueil , John Crispin , Matthias Brugger , Jean Delvare , "David S. Miller" , Mauro Carvalho Chehab , Jonathan Cameron , Greg Kroah-Hartman , Andy Shevchenko , Krzysztof Kozlowski , Andi Kleen , Geert Uytterhoeven , Kees Cook , Miquel Raynal , "H. Nikolaus Schaller" , "Eric W. Biederman" , Yinglu Yang , Tiezhu Yang , Allison Randal , Paul Burton , Manuel Lauss , Bartlomiej Zolnierkiewicz , Serge Semin , Matt Redfearn , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-doc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-ide@vger.kernel.org Message-ID: <20200325022916.106641-4-jiaxun.yang@flygoat.com> Subject: [PATCH v7 02/12] irqchip: loongson-liointc: Workaround LPC IRQ Errata Date: Wed, 25 Mar 2020 10:28:19 +0800 X-Mailer: git-send-email 2.26.0.rc2 In-Reply-To: <20200325022916.106641-1-jiaxun.yang@flygoat.com> References: <20200325022916.106641-1-jiaxun.yang@flygoat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoCNMailClient: External Content-Type: text/plain; charset=utf8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The 1.0 version of that controller has a bug that status bit of LPC IRQ sometimes doesn't get set correctly. So we can always blame LPC IRQ when spurious interrupt happens at the parent interrupt line which LPC IRQ supposed to route to. Signed-off-by: Jiaxun Yang Co-developed-by: Huacai Chen Signed-off-by: Huacai Chen Reviewed-by: Marc Zyngier --- drivers/irqchip/irq-loongson-liointc.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/irqchip/irq-loongson-liointc.c b/drivers/irqchip/irq-l= oongson-liointc.c index 18de2c09ece4..7d2339e638db 100644 --- a/drivers/irqchip/irq-loongson-liointc.c +++ b/drivers/irqchip/irq-loongson-liointc.c @@ -32,6 +32,8 @@ =20 #define LIOINTC_SHIFT_INTx=094 =20 +#define LIOINTC_ERRATA_IRQ=0910 + struct liointc_handler_data { =09struct liointc_priv=09*priv; =09u32=09=09=09parent_int_map; @@ -41,6 +43,7 @@ struct liointc_priv { =09struct irq_chip_generic=09=09*gc; =09struct liointc_handler_data=09handler[LIOINTC_NUM_PARENT]; =09u8=09=09=09=09map_cache[LIOINTC_CHIP_IRQ]; +=09bool=09=09=09=09have_lpc_irq_errata; }; =20 static void liointc_chained_handle_irq(struct irq_desc *desc) @@ -54,8 +57,15 @@ static void liointc_chained_handle_irq(struct irq_desc *= desc) =20 =09pending =3D readl(gc->reg_base + LIOINTC_REG_INTC_STATUS); =20 -=09if (!pending) -=09=09spurious_interrupt(); +=09if (!pending) { +=09=09/* Always blame LPC IRQ if we have that bug */ +=09=09if (handler->priv->have_lpc_irq_errata && +=09=09=09(handler->parent_int_map & ~gc->mask_cache & +=09=09=09BIT(LIOINTC_ERRATA_IRQ))) +=09=09=09pending =3D BIT(LIOINTC_ERRATA_IRQ); +=09=09else +=09=09=09spurious_interrupt(); +=09} =20 =09while (pending) { =09=09int bit =3D __ffs(pending); --=20 2.26.0.rc2