From patchwork Tue Jul 8 13:10:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 33208 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 574DF20969 for ; Tue, 8 Jul 2014 13:13:36 +0000 (UTC) Received: by mail-qa0-f69.google.com with SMTP id w8sf17451364qac.8 for ; Tue, 08 Jul 2014 06:13:36 -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=wSTs8epWdclOB/G7AP/kfRp1GOBvilqo6O88uVY1SdI=; b=k4Xi4DXh5rDpiTnurTVC9P53t1pNVE9BhFndj28OCCc+GaGReI9w4tcmTeHIPhpcTU +G2GF5EceDy5iBKCLWBqyh9p1FJynyVnpnPabeg2sDy9OQYbheO3bcixJVjqIZ0tVoFY 5HuhEd2oKUhgz3jhoZyUoAlMGpW0HiUE81TcVezsu17lFpDrp2SVlRPZeiIATyr8zDa/ Df03h9cLrM6aP5Jc0CMjcm82XKLZHwolFbSSOwTjL9QzjnAdJwad03WPhsYqWZ8y97xh fPcEt1hjI0E2j2EKDtDj+TMulZLVGI1YZn1d0Y5AYzZxKQNFFXqVD6pLFK5sNmhHtZPH hwwg== X-Gm-Message-State: ALoCoQljTUnB7fMhUptjyl1iiWtPxAHRE9Qb7eFEOu0cJLFL0cg53En1zhrVoL2PmkJ2lQRxeyfc X-Received: by 10.236.123.68 with SMTP id u44mr15092610yhh.19.1404825216194; Tue, 08 Jul 2014 06:13:36 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.20.132 with SMTP id 4ls1319539qgj.12.gmail; Tue, 08 Jul 2014 06:13:36 -0700 (PDT) X-Received: by 10.58.209.7 with SMTP id mi7mr40576vec.80.1404825216116; Tue, 08 Jul 2014 06:13:36 -0700 (PDT) Received: from mail-ve0-f171.google.com (mail-ve0-f171.google.com [209.85.128.171]) by mx.google.com with ESMTPS id ya3si20110331vec.105.2014.07.08.06.13.36 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 08 Jul 2014 06:13:36 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.171 as permitted sender) client-ip=209.85.128.171; Received: by mail-ve0-f171.google.com with SMTP id db12so957225veb.16 for ; Tue, 08 Jul 2014 06:13:36 -0700 (PDT) X-Received: by 10.58.220.230 with SMTP id pz6mr33653852vec.9.1404825216032; Tue, 08 Jul 2014 06:13:36 -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 tc5csp769481vcb; Tue, 8 Jul 2014 06:13:35 -0700 (PDT) X-Received: by 10.69.31.235 with SMTP id kp11mr34664411pbd.59.1404825215146; Tue, 08 Jul 2014 06:13:35 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id kz4si43489642pbc.58.2014.07.08.06.13.34 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Jul 2014 06:13:35 -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 1X4VC5-0006V9-2F; Tue, 08 Jul 2014 13:12:25 +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-0005m4-6r for linux-arm-kernel@lists.infradead.org; Tue, 08 Jul 2014 13:11:24 +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 1X4VAW-0006Ke-NO; Tue, 08 Jul 2014 15:10:48 +0200 From: Marc Zyngier To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 01/15] arm64: pass IRQ domain to the core IRQ handler Date: Tue, 8 Jul 2014 14:10:24 +0100 Message-Id: <1404825038-547-2-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_391959_8034CB58 X-CRM114-Status: GOOD ( 17.14 ) 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.128.171 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: =============================== [ INFO: suspicious RCU usage. ] 3.16.0-rc1+ #135 Not tainted ------------------------------- include/linux/rcupdate.h:871 rcu_read_lock() used illegally while idle! other info that might help us debug this: RCU used illegally from idle CPU! rcu_scheduler_active = 1, debug_locks = 0 RCU used illegally from extended quiescent state! 1 lock held by swapper/0/0: #0: (rcu_read_lock){......}, at: [] irq_find_mapping+0x4c/0x198 A solution is to add a new handle_domain_irq entry point into the arm64 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. Reported-by: Vladimir Murzin Signed-off-by: Marc Zyngier --- arch/arm64/include/asm/hardirq.h | 4 ++++ arch/arm64/kernel/irq.c | 23 ++++++++++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/arch/arm64/include/asm/hardirq.h b/arch/arm64/include/asm/hardirq.h index 0be6782..fb3e318 100644 --- a/arch/arm64/include/asm/hardirq.h +++ b/arch/arm64/include/asm/hardirq.h @@ -49,6 +49,10 @@ static inline void ack_bad_irq(unsigned int irq) extern void handle_IRQ(unsigned int, struct pt_regs *); +struct irq_domain; +extern void handle_domain_irq(struct irq_domain *, + unsigned int, struct pt_regs *); + /* * No arch-specific IRQ flags. */ diff --git a/arch/arm64/kernel/irq.c b/arch/arm64/kernel/irq.c index 0f08dfd..cb487ad 100644 --- a/arch/arm64/kernel/irq.c +++ b/arch/arm64/kernel/irq.c @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -45,19 +46,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)) { - pr_warn_ratelimited("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); @@ -67,6 +79,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); +} + void __init set_handle_irq(void (*handle_irq)(struct pt_regs *)) { if (handle_arch_irq)