From patchwork Fri Nov 14 15:31:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 40833 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 77175240ED for ; Fri, 14 Nov 2014 15:32:03 +0000 (UTC) Received: by mail-lb0-f200.google.com with SMTP id f15sf9477314lbj.7 for ; Fri, 14 Nov 2014 07:32:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:message-id:date:from:user-agent :mime-version:to:cc:subject:references:in-reply-to:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe :content-type:content-transfer-encoding; bh=bbw46JUEnqjf0/Ps68AZO6RMZej7MzS18NOADJvJYcI=; b=BM2DKq/L5/wjAszOSg4fekR2nSBnw4I81/q+giaTy4kmmJcjBUHsEmMglREkj0P0tz Fi9WYx6tGkenmhmsDiWmNPHv8yjUe1GrsCeWPbeIFsEUtpKPNhNTbGE8j6jrsdhGE07Q UevqoTbgNSZ5xGvFZV3RG+aXkbnoqeUNZybMsj28XcHuGyXpnPtpLXNtjvrLKQ65c7gV DCxEtcG5lX4F0Vb7ybbTV4sFZdS5BjgGu27QX079EHreq5Ses3thDebI5L0bHGxzVw1B Ts3zqGBvKHmGotnC82MXV+bU998/P5to61Gpco+zn84zyWafCRPWHkID7222aLu1xAai JKJw== X-Gm-Message-State: ALoCoQkWKe0q430rVvnNiZZY6o3vMjVu8ij9pcWQHT+OUF/jM69Xl+IbgBwJc/rNFcEdFEEHLM1L X-Received: by 10.152.36.135 with SMTP id q7mr476976laj.8.1415979122391; Fri, 14 Nov 2014 07:32:02 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.26.228 with SMTP id o4ls860853lag.66.gmail; Fri, 14 Nov 2014 07:32:02 -0800 (PST) X-Received: by 10.152.88.46 with SMTP id bd14mr8969233lab.30.1415979122120; Fri, 14 Nov 2014 07:32:02 -0800 (PST) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id n9si42139594laa.10.2014.11.14.07.32.02 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 14 Nov 2014 07:32:02 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by mail-la0-f43.google.com with SMTP id ge10so15411308lab.16 for ; Fri, 14 Nov 2014 07:32:02 -0800 (PST) X-Received: by 10.152.37.69 with SMTP id w5mr8688303laj.67.1415979121983; Fri, 14 Nov 2014 07:32:01 -0800 (PST) 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.112.184.201 with SMTP id ew9csp780230lbc; Fri, 14 Nov 2014 07:32:01 -0800 (PST) X-Received: by 10.70.61.136 with SMTP id p8mr10791164pdr.98.1415979120025; Fri, 14 Nov 2014 07:32:00 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id fw12si28619700pdb.207.2014.11.14.07.31.59 for ; Fri, 14 Nov 2014 07:31:59 -0800 (PST) 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 S965874AbaKNPby (ORCPT + 26 others); Fri, 14 Nov 2014 10:31:54 -0500 Received: from service87.mimecast.com ([91.220.42.44]:44986 "EHLO service87.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965567AbaKNPbv convert rfc822-to-8bit (ORCPT ); Fri, 14 Nov 2014 10:31:51 -0500 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Fri, 14 Nov 2014 15:31:49 +0000 Received: from [10.1.209.143] ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 14 Nov 2014 15:31:47 +0000 Message-ID: <54662062.8030807@arm.com> Date: Fri, 14 Nov 2014 15:31:46 +0000 From: Marc Zyngier User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130330 Thunderbird/17.0.5 MIME-Version: 1.0 To: Thomas Gleixner CC: LKML , Jiang Liu , Bjorn Helgaas , "grant.likely@linaro.org" , Yingjoe Chen , Yijing Wang Subject: Re: [patch 07/16] genirq: Introduce helper irq_domain_set_info() to reduce duplicated code References: <20141112133941.647950773@linutronix.de> <20141112134120.393705922@linutronix.de> In-Reply-To: <20141112134120.393705922@linutronix.de> X-Enigmail-Version: 1.4.6 X-OriginalArrivalTime: 14 Nov 2014 15:31:47.0113 (UTC) FILETIME=[1A21F190:01D00020] X-MC-Unique: 114111415314908801 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.215.43 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: , On 12/11/14 13:43, Thomas Gleixner wrote: > From: Jiang Liu > > Signed-off-by: Jiang Liu > Cc: Bjorn Helgaas > Cc: Grant Likely > Cc: Marc Zyngier > Cc: Yingjoe Chen > Cc: Yijing Wang > Signed-off-by: Thomas Gleixner > --- > include/linux/irqdomain.h | 5 +++++ > kernel/irq/irqdomain.c | 10 ++++++++++ > 2 files changed, 15 insertions(+) > > Index: tip/include/linux/irqdomain.h > =================================================================== > --- tip.orig/include/linux/irqdomain.h > +++ tip/include/linux/irqdomain.h > @@ -33,6 +33,7 @@ > #define _LINUX_IRQDOMAIN_H > > #include > +#include > #include > > struct device_node; > @@ -263,6 +264,10 @@ extern int irq_domain_set_hwirq_and_chip > irq_hw_number_t hwirq, > struct irq_chip *chip, > void *chip_data); > +extern void irq_domain_set_info(struct irq_domain *domain, unsigned int virq, > + irq_hw_number_t hwirq, struct irq_chip *chip, > + void *chip_data, irq_flow_handler_t handler, > + void *handler_data, const char *handler_name); > extern void irq_domain_reset_irq_data(struct irq_data *irq_data); > extern void irq_domain_free_irqs_common(struct irq_domain *domain, > int virq, int nr_irqs); > Index: tip/kernel/irq/irqdomain.c > =================================================================== > --- tip.orig/kernel/irq/irqdomain.c > +++ tip/kernel/irq/irqdomain.c > @@ -882,6 +882,16 @@ int irq_domain_set_hwirq_and_chip(struct > return 0; > } > > +void irq_domain_set_info(struct irq_domain *domain, unsigned int virq, > + irq_hw_number_t hwirq, struct irq_chip *chip, > + void *chip_data, irq_flow_handler_t handler, > + void *handler_data, const char *handler_name) > +{ > + irq_domain_set_hwirq_and_chip(domain, virq, hwirq, chip, chip_data); > + __irq_set_handler(virq, handler, 0, handler_name); > + irq_set_handler_data(virq, handler_data); > +} > + We still have the issue that, depending on where in the stack this is called, this will succeed or fail: If this is called from the inner irqchip, __irq_set_handler() will fail, as it will look at the outer domain as the (desc->irq_data.chip == &no_irq_chip) test fails (we haven't set the top level yet). I have this very imperfect workaround in my tree: Which translate into: If there is at least one irqchip in the domain, it will probably sort itself out. Not ideal. Any real solution to this problem? GICv2 faces this exact problem, as some of its interrupts are used directly, and some others are used through the MSI domain. In the GIC driver, it is almost impossible to find out... Thanks, M. diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c index d028b34..91e6515 100644 --- a/kernel/irq/chip.c +++ b/kernel/irq/chip.c @@ -731,7 +731,16 @@ __irq_set_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained, if (!handle) { handle = handle_bad_irq; } else { - if (WARN_ON(desc->irq_data.chip == &no_irq_chip)) +#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY + struct irq_data *irq_data = &desc->irq_data; + while (irq_data) { + if (irq_data->chip != &no_irq_chip) + break; + irq_data = irq_data->parent_data; + } +#endif + + if (WARN_ON(!irq_data || irq_data->chip == &no_irq_chip)) goto out; }