From patchwork Tue Jul 8 13:45:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 33221 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f69.google.com (mail-qa0-f69.google.com [209.85.216.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 78C152070A for ; Tue, 8 Jul 2014 13:46:19 +0000 (UTC) Received: by mail-qa0-f69.google.com with SMTP id w8sf17543511qac.8 for ; Tue, 08 Jul 2014 06:46:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=Lsw9WhCVx/4ovPKCcQDpFZd66JCN18pjC7rz8D/5l7I=; b=cEK0NFv7yr5vECc0/tFKV/l8Spq557a0QoRYosg2muQU01Gc9EHTpdsO7DRTYaql8N lApl5K2V5jdDgvkRPQ/T8oNDJud4ZRhHRAPkcmYk35Nf5rqUBgAqhSlmP8Zc4Z53Aet0 5PA7JUWhbLeI31eYGzY/IiUR8kybP+JRI6KyUnlT3b9hbccLR7Ug7pU7WkyrqMn1eYeY 7gxP5dAEwnH799U5Zyn0vY4Zx9qx+V81UvZwCUNzEIu6XxvHTi92IxooVOwyJp3NyNeX hYPtp/GQznQqskS2FF63HVnFoRkW/+Xxmuuzsu1cr3oKZdZqSYReOk9iiwySVuElNK0j CgZQ== X-Gm-Message-State: ALoCoQn/hGeqsyn2ivBnSAOkjgKj130zgVFkZrwmhZqrhxBA0fF0/G+x/20Idy/RwsHf4rb7PhTV X-Received: by 10.236.159.198 with SMTP id s46mr5644761yhk.17.1404827179270; Tue, 08 Jul 2014 06:46:19 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.88.165 with SMTP id t34ls2224684qgd.93.gmail; Tue, 08 Jul 2014 06:46:19 -0700 (PDT) X-Received: by 10.52.182.163 with SMTP id ef3mr28199485vdc.22.1404827179180; Tue, 08 Jul 2014 06:46:19 -0700 (PDT) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id x3si8560340vep.58.2014.07.08.06.46.19 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 08 Jul 2014 06:46:19 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) client-ip=209.85.220.179; Received: by mail-vc0-f179.google.com with SMTP id id10so5387282vcb.24 for ; Tue, 08 Jul 2014 06:46:19 -0700 (PDT) X-Received: by 10.52.144.235 with SMTP id sp11mr12084087vdb.25.1404827179107; Tue, 08 Jul 2014 06:46:19 -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 tc5csp771990vcb; Tue, 8 Jul 2014 06:46:18 -0700 (PDT) X-Received: by 10.66.131.39 with SMTP id oj7mr35399304pab.20.1404827178300; Tue, 08 Jul 2014 06:46:18 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id da4si43485028pbb.222.2014.07.08.06.46.17; Tue, 08 Jul 2014 06:46:17 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754279AbaGHNpv (ORCPT + 27 others); Tue, 8 Jul 2014 09:45:51 -0400 Received: from inca-roads.misterjones.org ([213.251.177.50]:58178 "EHLO inca-roads.misterjones.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752912AbaGHNpt (ORCPT ); Tue, 8 Jul 2014 09:45:49 -0400 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 1X4ViN-00076z-Qd; Tue, 08 Jul 2014 15:45:47 +0200 From: Marc Zyngier To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Russell King , Catalin Marinas , Will Deacon , Thomas Gleixner , Jason Cooper , Alexander Shiyan , Barry Song , Maxime Ripard , Kevin Hilman , Daniel Lezcano , Lorenzo Pieralisi , Larry Bassel , Mark Rutland , Sudeep Holla Subject: [PATCH v2 02/15] ARM: pass IRQ domain to the core IRQ handler Date: Tue, 8 Jul 2014 14:45:40 +0100 Message-Id: <1404827141-30381-1-git-send-email-marc.zyngier@arm.com> X-Mailer: git-send-email 2.0.0 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.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.179 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 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 Acked-by: Jason Cooper --- Sending the right patch this time, with the missing includes that would otherwise break the build... arch/arm/include/asm/irq.h | 2 ++ arch/arm/kernel/irq.c | 25 +++++++++++++++++++++---- 2 files changed, 23 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..a9e37434 100644 --- a/arch/arm/kernel/irq.c +++ b/arch/arm/kernel/irq.c @@ -27,7 +27,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -62,20 +64,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 +97,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. */