Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1852570ybb; Sat, 21 Mar 2020 07:15:13 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsrtQjOvRgU0BU1wp9203r1ZI3Zlln0zkgJRZu6JHGDYjtk4YhMo5AL6JWHF9/NB5XvdWHm X-Received: by 2002:a9d:6a91:: with SMTP id l17mr11397844otq.29.1584800113660; Sat, 21 Mar 2020 07:15:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584800113; cv=none; d=google.com; s=arc-20160816; b=B1m/8/QjmthrsKyquVOlDVYDlvNClvfe2rN9AX8G7UaJRSlF5G32EcrZaZB9s9/vcD aHz/Q+jLWanG5oiC7ysctriwDJ1fqPCYTEfiIaft6cUTjL4pZFwPX0uifp++/NDxJc0T 1sJeRv1VaEu1oN5E7ao98Uu6AwLhxw3+ruGswaWc2iMp7WqJ1e+1IO8GBxHtyL5bbTNg c0OJ/YrBPNdvE1kDOA4JiOXC1Y3onxRgA8lZOjE3MCxdKgK13vWMKCmuCrVwmRw74WiZ VttVVEp1SBOCLfVa1rrkI/wrlvjfRKRJEDdDWIlVCj9FcX8YHbvn41CudvodpdvYl0bw rkuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature; bh=f1dyDYcIfXFzL/5sM96QBXercHrXfSeWiREEdObMdE0=; b=c56nGKUW1HfuPmTYC6YSYMd6PNYeEKl33LWqNVlW4kZgljnQYHW/vnuG5jJ/Ld5j8A 5uMC4qR4JrzcwkKozS9mucfCMYeb5omSEkJ2y/CoDPj2CuaR1BWqAe3s6kot17FMCf8n /g/JAgx45KK62tGrHsbRotxfAm/r6NMblHPV1pD1d70Fv9kYr6qS9TTMu5aTCfBkbp/d hRYZr6EMmNfZZ/TnflVs13mVPMxUPnM0qc1SbxAQ9v2LXuqOxuF1xQDPJIDCrxiibZgS TEuE+FxAJxk7uwzOE8QexEyyZa6i0NRtbf9U6EJ7/+KpmOnvgL4ll8yMr9GvPboyleSi U/zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Cz1IsoUn; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n190si4671590oig.207.2020.03.21.07.15.00; Sat, 21 Mar 2020 07:15:13 -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=@kernel.org header.s=default header.b=Cz1IsoUn; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727232AbgCUOOm (ORCPT + 99 others); Sat, 21 Mar 2020 10:14:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:56194 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726823AbgCUOOm (ORCPT ); Sat, 21 Mar 2020 10:14:42 -0400 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 77C5E20658; Sat, 21 Mar 2020 14:14:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584800081; bh=BkafZo5ywLgZLTC3Js/WXCIoJuWRu5WaImZuPyUfdoE=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Cz1IsoUnhrqVIT/1pySZTxYw0qA3gXQQrCtot7/Pyy8OENEBLxg+RmrD54NQuPM09 5t1M7MDdNPhUiiLmXbxJxvAxAtxrXU5i+FIobbWx4j6EsDTmxYrG5O+CV8flUdoYZl 2UhQlh8R2x4iRVWOKfxfkhCZXRXNzE62EA7qPR5o= Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jFetb-00EVd4-NJ; Sat, 21 Mar 2020 14:14:39 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Sat, 21 Mar 2020 14:14:39 +0000 From: Marc Zyngier To: Jiaxun Yang Cc: linux-mips@vger.kernel.org, Huacai Chen , Thomas Gleixner , Jason Cooper , Rob Herring , Mark Rutland , Ralf Baechle , Paul Burton , Allison Randal , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: Re: [PATCH v5 04/11] irqchip: Add driver for Loongson-3 HyperTransport PIC controller In-Reply-To: <20200318062102.8145-5-jiaxun.yang@flygoat.com> References: <20200318062102.8145-1-jiaxun.yang@flygoat.com> <20200318062102.8145-5-jiaxun.yang@flygoat.com> Message-ID: X-Sender: maz@kernel.org User-Agent: Roundcube Webmail/1.3.10 X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: jiaxun.yang@flygoat.com, linux-mips@vger.kernel.org, chenhc@lemote.com, tglx@linutronix.de, jason@lakedaemon.net, robh+dt@kernel.org, mark.rutland@arm.com, ralf@linux-mips.org, paulburton@kernel.org, allison@lohutok.net, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-03-18 06:20, Jiaxun Yang wrote: > This controller appeared on Loongson-3 family of chips to receive > interrupts > from PCH PIC. > It is a I8259 with optimized interrupt polling flow. We can poll > interrupt number > from HT vector directly but still have to follow standard I8259 > routines to mask, > unmask and EOI. > > Co-developed-by: Huacai Chen > Signed-off-by: Jiaxun Yang > > --- > v4-v5: > Enhancements according to maz's suggestions: > - Add static for private struct > - Drop pointless rename > - Fix DT parse bug > - Clarifications in comments and commit message > --- > arch/mips/include/asm/i8259.h | 1 + > drivers/irqchip/Kconfig | 10 ++ > drivers/irqchip/Makefile | 1 + > drivers/irqchip/irq-loongson-htpic.c | 149 +++++++++++++++++++++++++++ > 4 files changed, 161 insertions(+) > create mode 100644 drivers/irqchip/irq-loongson-htpic.c [...] > +int __init htpic_of_init(struct device_node *node, struct device_node > *parent) > +{ > + unsigned int parent_irq[4]; > + int i, err; > + int num_parents = 0; > + > + if (htpic) { > + pr_err("loongson-htpic: Only one HTPIC is allowed in the system\n"); > + return -ENODEV; > + } > + > + htpic = kzalloc(sizeof(*htpic), GFP_KERNEL); > + if (!htpic) { > + err = -ENOMEM; > + goto out_free; > + } > + > + htpic->base = of_iomap(node, 0); > + if (!htpic->base) { > + err = -ENODEV; > + goto out_free; > + } > + > + htpic->domain = __init_i8259_irqs(node); > + if (!htpic->domain) { > + pr_err("loongson-htpic: Failed to initialize i8259 IRQs\n"); > + err = -ENOMEM; > + goto out_iounmap; > + } > + > + /* Interrupt may come from any of the 4 interrupt line */ > + for (i = 0; i < HTPIC_MAX_PARENT_IRQ; i++) { > + parent_irq[i] = irq_of_parse_and_map(node, i); > + if (parent_irq[i] < 0) irq_of_parse_and_map() returns 0 when there is no interrupt to be mapped. You should probably test for that too. Thanks, M. -- Jazz is not dead. It just smells funny...