From patchwork Tue Jul 8 13:10:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 33211 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f200.google.com (mail-pd0-f200.google.com [209.85.192.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9B84B20969 for ; Tue, 8 Jul 2014 13:14:03 +0000 (UTC) Received: by mail-pd0-f200.google.com with SMTP id v10sf38702828pde.3 for ; Tue, 08 Jul 2014 06:14:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=tgj3+2i2GHzcxzRDIkWoo4cdq8RMfuvW1G/8tMyDQrc=; b=Dm5g01BOXD/7d/VtNL7BszG8+Cs2/UG7hQrYHZW6KUuOd+FokTQuzfIsV+7RrNCf5K HknA0I1C04p7o97l/ggsSl1i9GN9DmgGVk8Xl5Iq5c5Vmuq45ymQMtWNIJTmboyqZzsB SvIa8vejHkQlIQMzkIxko6urv3Vw+O/6Ds7teszgfqe67YJbEYx4TMgXtSovgIE71ZZe npIpG/qFuvBiLdKZnyd0bf7m4ve24CoBuWS6DMYDVh9zTDZ4IuvhC1HnV6YSHOzXC88j henMJIOCCUyKiIV9tt6NX0Cc1v4a2Cfq/iCfw2oSAhE+r7F0/w9vVhUp3xzHUwKqFQIH 545Q== X-Gm-Message-State: ALoCoQkdG3Kl5rCwNgvNBsZdllNSFMby09fY/QWokQikVgG/xvYcUD5qmN0WVJL8kLx8Ynh6JaF5 X-Received: by 10.66.154.233 with SMTP id vr9mr15606311pab.36.1404825241911; Tue, 08 Jul 2014 06:14:01 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.24.242 with SMTP id 105ls1773436qgr.59.gmail; Tue, 08 Jul 2014 06:14:01 -0700 (PDT) X-Received: by 10.220.167.2 with SMTP id o2mr33502667vcy.8.1404825241798; Tue, 08 Jul 2014 06:14:01 -0700 (PDT) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id sb6si20113667veb.66.2014.07.08.06.14.01 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 08 Jul 2014 06:14:01 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.180 as permitted sender) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id im17so5472582vcb.11 for ; Tue, 08 Jul 2014 06:14:01 -0700 (PDT) X-Received: by 10.52.23.71 with SMTP id k7mr28213292vdf.27.1404825241729; Tue, 08 Jul 2014 06:14:01 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp769512vcb; Tue, 8 Jul 2014 06:14:01 -0700 (PDT) X-Received: by 10.69.26.68 with SMTP id iw4mr3059602pbd.137.1404825240904; Tue, 08 Jul 2014 06:14:00 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id ck17si6050286pdb.292.2014.07.08.06.14.00 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Jul 2014 06:14:00 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X4VCS-0006rJ-JV; Tue, 08 Jul 2014 13:12:48 +0000 Received: from inca-roads.misterjones.org ([213.251.177.50]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X4VAx-0005m5-9f for linux-arm-kernel@lists.infradead.org; Tue, 08 Jul 2014 13:11:34 +0000 Received: from [176.25.195.83] (helo=why.wild-wind.fr.eu.org) by cheepnis.misterjones.org with esmtpsa (TLSv1.2:AES128-SHA256:128) (Exim 4.80) (envelope-from ) id 1X4VAX-0006Ke-7q; Tue, 08 Jul 2014 15:10:49 +0200 From: Marc Zyngier To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 02/15] ARM: pass IRQ domain to the core IRQ handler Date: Tue, 8 Jul 2014 14:10:25 +0100 Message-Id: <1404825038-547-3-git-send-email-marc.zyngier@arm.com> X-Mailer: git-send-email 2.0.0 In-Reply-To: <1404825038-547-1-git-send-email-marc.zyngier@arm.com> References: <1404825038-547-1-git-send-email-marc.zyngier@arm.com> X-SA-Exim-Connect-IP: 176.25.195.83 X-SA-Exim-Rcpt-To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux@arm.linux.org.uk, catalin.marinas@arm.com, will.deacon@arm.com, tglx@linutronix.de, jason@lakedaemon.net, shc_work@mail.ru, baohua@kernel.org, maxime.ripard@free-electrons.com, khilman@linaro.org, daniel.lezcano@linaro.org, lorenzo.pieralisi@arm.com, larry.bassel@linaro.org, mark.rutland@arm.com, sudeep.holla@arm.com X-SA-Exim-Mail-From: marc.zyngier@arm.com X-SA-Exim-Scanned: No (on cheepnis.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140708_061115_480445_1C7FACE8 X-CRM114-Status: GOOD ( 15.77 ) X-Spam-Score: 1.0 (+) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (1.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) Cc: Mark Rutland , Barry Song , Kevin Hilman , Russell King , Jason Cooper , Alexander Shiyan , Larry Bassel , Catalin Marinas , Daniel Lezcano , Will Deacon , Lorenzo Pieralisi , Sudeep Holla , Thomas Gleixner , Maxime Ripard X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: marc.zyngier@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.180 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Calling irq_find_mapping from outside a irq_{enter,exit} section is unsafe and produces ugly messages if CONFIG_PROVE_RCU is enabled: If coming from the idle state, the rcu_read_lock call in irq_find_mapping will generate an an unpleasant warning. A solution is to add a new handle_domain_irq entry point into the arm code that the interrupt controller code can call. This new function takes an irq_domain, and calls into irq_find_domain inside the irq_{enter,exit} block. Interrupt controllers can then be updated to use the new mechanism. Signed-off-by: Marc Zyngier --- arch/arm/include/asm/irq.h | 2 ++ arch/arm/kernel/irq.c | 23 +++++++++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/arch/arm/include/asm/irq.h b/arch/arm/include/asm/irq.h index 53c15de..8578811 100644 --- a/arch/arm/include/asm/irq.h +++ b/arch/arm/include/asm/irq.h @@ -24,10 +24,12 @@ #ifndef __ASSEMBLY__ struct irqaction; struct pt_regs; +struct irq_domain; extern void migrate_irqs(void); extern void asm_do_IRQ(unsigned int, struct pt_regs *); void handle_IRQ(unsigned int, struct pt_regs *); +void handle_domain_irq(struct irq_domain *, unsigned int, struct pt_regs *); void init_IRQ(void); #ifdef CONFIG_MULTI_IRQ_HANDLER diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c index 2c42576..d6af69f5 100644 --- a/arch/arm/kernel/irq.c +++ b/arch/arm/kernel/irq.c @@ -62,20 +62,30 @@ int arch_show_interrupts(struct seq_file *p, int prec) * not come via this function. Instead, they should provide their * own 'handler'. Used by platform code implementing C-based 1st * level decoding. + * + * handle_domain_irq does the same thing, but also converts the HW + * interrupt number into a logical one using the provided domain. A + * NULL domain indicates that this conversion has already been done. */ -void handle_IRQ(unsigned int irq, struct pt_regs *regs) +void handle_domain_irq(struct irq_domain *domain, + unsigned int hwirq, struct pt_regs *regs) { struct pt_regs *old_regs = set_irq_regs(regs); + unsigned int irq; irq_enter(); + if (domain) + irq = irq_find_mapping(domain, hwirq); + else + irq = hwirq; + /* * Some hardware gives randomly wrong interrupts. Rather * than crashing, do something sensible. */ - if (unlikely(irq >= nr_irqs)) { - if (printk_ratelimit()) - printk(KERN_WARNING "Bad IRQ%u\n", irq); + if (unlikely(!irq || irq >= nr_irqs)) { + pr_warn_ratelimited("Bad IRQ%u (%u)\n", irq, hwirq); ack_bad_irq(irq); } else { generic_handle_irq(irq); @@ -85,6 +95,11 @@ void handle_IRQ(unsigned int irq, struct pt_regs *regs) set_irq_regs(old_regs); } +void handle_IRQ(unsigned int irq, struct pt_regs *regs) +{ + handle_domain_irq(NULL, irq, regs); +} + /* * asm_do_IRQ is the interface to be used from assembly code. */