From patchwork Tue Nov 4 12:01:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiang Liu X-Patchwork-Id: 40136 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f71.google.com (mail-ee0-f71.google.com [74.125.83.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B80B021894 for ; Tue, 4 Nov 2014 11:59:50 +0000 (UTC) Received: by mail-ee0-f71.google.com with SMTP id e51sf3985907eek.6 for ; Tue, 04 Nov 2014 03:59:50 -0800 (PST) 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:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=mrctp0JkB73ooaE8M4qEAOo57oUpLl7g57banQTNmdc=; b=RVHYsICv6acFcndHTdz8zSW6faX40DBkywWFoAqYyy3vlA2AzX00mDPoLxfjrhNF8r xSeT764XIuqWkUiw+/Kc9MHrgY/T7bHINofsQnmMj4cIQxixp4a4rKYq3BXpggxs5u/b JQAQAN8IVRVzGiuz5hjOI168+jnVx5imWMptH2Ts1zcT73jIm/9N/tl+oz0xtriblUbM pgwykGorlCJlTwB1NEae+RXVMVtukcaTIFTnorHBPqUB/PbPc4fUc2WfKI1LKRucPJpo 2oEFChYHq8d/Q2eY7cztUCzo+6zLGVudFRenQkQaT33hm15uiX+NTy92Y6oNOmhWRhDX skbg== X-Gm-Message-State: ALoCoQnypI4buKJox+dGqu3Ecs0MH3pfTzEGobKvHKwCoMxbPiK2VhPpXO86L/YgYHEcy5B6OFmc X-Received: by 10.180.90.115 with SMTP id bv19mr4094746wib.1.1415102389991; Tue, 04 Nov 2014 03:59:49 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.44.131 with SMTP id e3ls68218lam.31.gmail; Tue, 04 Nov 2014 03:59:49 -0800 (PST) X-Received: by 10.152.45.1 with SMTP id i1mr22527857lam.7.1415102389546; Tue, 04 Nov 2014 03:59:49 -0800 (PST) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com. [209.85.217.178]) by mx.google.com with ESMTPS id b4si346672lbd.70.2014.11.04.03.59.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 04 Nov 2014 03:59:49 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by mail-lb0-f178.google.com with SMTP id f15so12099838lbj.23 for ; Tue, 04 Nov 2014 03:59:49 -0800 (PST) X-Received: by 10.112.218.101 with SMTP id pf5mr22604585lbc.46.1415102389272; Tue, 04 Nov 2014 03:59:49 -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 ew9csp103076lbc; Tue, 4 Nov 2014 03:59:48 -0800 (PST) X-Received: by 10.66.142.137 with SMTP id rw9mr9722034pab.124.1415102387717; Tue, 04 Nov 2014 03:59:47 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id yo5si57794pbb.166.2014.11.04.03.59.46 for ; Tue, 04 Nov 2014 03:59:47 -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 S1753554AbaKDL7c (ORCPT + 25 others); Tue, 4 Nov 2014 06:59:32 -0500 Received: from mga11.intel.com ([192.55.52.93]:23727 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753470AbaKDL7Z (ORCPT ); Tue, 4 Nov 2014 06:59:25 -0500 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 04 Nov 2014 03:59:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.07,313,1413270000"; d="scan'208";a="616764901" Received: from gerry-dev.bj.intel.com ([10.238.158.52]) by fmsmga001.fm.intel.com with ESMTP; 04 Nov 2014 03:59:20 -0800 From: Jiang Liu To: Benjamin Herrenschmidt , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , "Rafael J. Wysocki" , Bjorn Helgaas , Randy Dunlap , Yinghai Lu , Borislav Petkov , Grant Likely , Marc Zyngier , Yingjoe Chen , Matthias Brugger Cc: Konrad Rzeszutek Wilk , Andrew Morton , Tony Luck , Joerg Roedel , Greg Kroah-Hartman , x86@kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Jiang Liu Subject: [Patch Part2 v4 02/31] irqdomain: Do irq_find_mapping and set_type for hierarchy irqdomain in case OF Date: Tue, 4 Nov 2014 20:01:36 +0800 Message-Id: <1415102525-9898-3-git-send-email-jiang.liu@linux.intel.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1415102525-9898-1-git-send-email-jiang.liu@linux.intel.com> References: <1415102525-9898-1-git-send-email-jiang.liu@linux.intel.com> 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: linux-kernel-owner@vger.kernel.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 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: , From: Yingjoe Chen It is possible to call irq_create_of_mapping to create/translate the same IRQ from DT for multiple times. Perform irq_find_mapping check and set_type for hierarchy irqdomain in irq_create_of_mapping() to avoid duplicate these functionality in all outer most irqdomain. Signed-off-by: Yingjoe Chen Signed-off-by: Jiang Liu --- kernel/irq/irqdomain.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index 899150452ae8..e1351b0bd7f8 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c @@ -478,11 +478,6 @@ unsigned int irq_create_of_mapping(struct of_phandle_args *irq_data) return 0; } - if (irq_domain_is_hierarchy(domain)) { - virq = irq_domain_alloc_irqs(domain, 1, NUMA_NO_NODE, irq_data); - return virq <= 0 ? 0 : virq; - } - /* If domain has no translation, then we assume interrupt line */ if (domain->ops->xlate == NULL) hwirq = irq_data->args[0]; @@ -492,10 +487,24 @@ unsigned int irq_create_of_mapping(struct of_phandle_args *irq_data) return 0; } - /* Create mapping */ - virq = irq_create_mapping(domain, hwirq); - if (!virq) - return virq; + if (irq_domain_is_hierarchy(domain)) { + /* + * If we've already configured this interrupt, + * don't do it again, or hell will break loose. + */ + virq = irq_find_mapping(domain, hwirq); + if (virq) + return virq; + + virq = irq_domain_alloc_irqs(domain, 1, NUMA_NO_NODE, irq_data); + if (virq <= 0) + return 0; + } else { + /* Create mapping */ + virq = irq_create_mapping(domain, hwirq); + if (!virq) + return virq; + } /* Set type if specified and different than the current one */ if (type != IRQ_TYPE_NONE &&