From patchwork Thu Jun 26 07:10:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sricharan R X-Patchwork-Id: 32534 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f72.google.com (mail-pa0-f72.google.com [209.85.220.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 80AC6201EF for ; Thu, 26 Jun 2014 07:15:30 +0000 (UTC) Received: by mail-pa0-f72.google.com with SMTP id rd3sf12214703pab.11 for ; Thu, 26 Jun 2014 00:15:29 -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:mime-version:cc:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:content-type :content-transfer-encoding; bh=41ljeDfPR+YyPjcwq2kKMCSG/nneVt5T4jc/UWCa5NM=; b=GmN9pa7JOJwYcrSVE4jHDtlDPxD+7Zsue4gpyO91ucU0OdBCUkZ/jul93Dw7VCXvBL U+mSdsAC1DJE/ELU5atbbaU5jGN8Csb4pPCMpxuYVVHviS1jAAOHjvIrY7B2IprxZkiP Eyhg3EIjjXPkQDeA2uRo2XV+Imt8rZqSYcRX1LkXZSNZpdMALrrssO5Ug5hMztFKEufI lsn186NRGT7mAYoe5RgCzUdx8Q6IcNVpwQj6qqjkJ1mZvoI1h86usZMC/XU3bSttUNzE xoF9AA1GpI6lQMppXE9k0bS6NJfl0ENSokFqb/DjPR5+mjLOO5bllt2WlFGfyBMXJ2sJ HiFA== X-Gm-Message-State: ALoCoQnrenGWJ/3fAUpymyfluxTL5OfWQBZKU5AXQImN7H3Hzg5f5zKLA3jyI7wv3uX1abKnjhZj X-Received: by 10.66.137.2 with SMTP id qe2mr7263537pab.43.1403766929846; Thu, 26 Jun 2014 00:15:29 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.88.101 with SMTP id s92ls88634qgd.77.gmail; Thu, 26 Jun 2014 00:15:29 -0700 (PDT) X-Received: by 10.220.92.193 with SMTP id s1mr11605005vcm.34.1403766929706; Thu, 26 Jun 2014 00:15:29 -0700 (PDT) Received: from mail-vc0-f172.google.com (mail-vc0-f172.google.com [209.85.220.172]) by mx.google.com with ESMTPS id kt17si3844534veb.84.2014.06.26.00.15.29 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 26 Jun 2014 00:15:29 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.172 as permitted sender) client-ip=209.85.220.172; Received: by mail-vc0-f172.google.com with SMTP id hy10so3111123vcb.3 for ; Thu, 26 Jun 2014 00:15:29 -0700 (PDT) X-Received: by 10.58.187.19 with SMTP id fo19mr557832vec.45.1403766929621; Thu, 26 Jun 2014 00:15:29 -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 tc5csp10327vcb; Thu, 26 Jun 2014 00:15:29 -0700 (PDT) X-Received: by 10.68.239.137 with SMTP id vs9mr19161682pbc.84.1403766928890; Thu, 26 Jun 2014 00:15:28 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id ig10si8503369pad.194.2014.06.26.00.15.28 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Jun 2014 00:15:28 -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 1X03s9-0003sm-O2; Thu, 26 Jun 2014 07:13:29 +0000 Received: from bear.ext.ti.com ([192.94.94.41]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X03s1-0003oF-Tf for linux-arm-kernel@lists.infradead.org; Thu, 26 Jun 2014 07:13:23 +0000 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id s5Q7CjBF009766; Thu, 26 Jun 2014 02:12:45 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s5Q7CjUP016176; Thu, 26 Jun 2014 02:12:45 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.174.1; Thu, 26 Jun 2014 02:12:44 -0500 Received: from uda0393807.india.ti.com. (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s5Q7CTST000852; Thu, 26 Jun 2014 02:12:41 -0500 From: Sricharan R To: , , , Subject: [PATCH V4 02/16] irqchip: crossbar: Check for premapped crossbar before allocating Date: Thu, 26 Jun 2014 12:40:20 +0530 Message-ID: <1403766634-18543-3-git-send-email-r.sricharan@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1403766634-18543-1-git-send-email-r.sricharan@ti.com> References: <1403766634-18543-1-git-send-email-r.sricharan@ti.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140626_001322_133960_30B5031A X-CRM114-Status: GOOD ( 10.79 ) X-Spam-Score: -5.0 (-----) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-5.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [192.94.94.41 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [192.94.94.41 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders Cc: nm@ti.com, linux@arm.linux.org.uk, jason@lakedaemon.net, tony@atomide.com, rnayak@ti.com, r.sricharan@ti.com, santosh.shilimkar@ti.com, joe@perches.com, tglx@linutronix.de 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: , 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: r.sricharan@ti.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.172 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 From: Nishanth Menon If irq_of_parse_and_map is executed twice, the same crossbar is mapped to two different GIC interrupts. This is completely undesirable. Instead, check if the requested crossbar event is pre-allocated and provide that GIC mapping back to caller if already allocated. Signed-off-by: Nishanth Menon Signed-off-by: Sricharan R Acked-by: Santosh Shilimkar --- drivers/irqchip/irq-crossbar.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/irqchip/irq-crossbar.c b/drivers/irqchip/irq-crossbar.c index 20105bc..51d4b87 100644 --- a/drivers/irqchip/irq-crossbar.c +++ b/drivers/irqchip/irq-crossbar.c @@ -51,6 +51,17 @@ static inline void crossbar_writeb(int irq_no, int cb_no) writeb(cb_no, cb->crossbar_base + cb->register_offsets[irq_no]); } +static inline int get_prev_map_irq(int cb_no) +{ + int i; + + for (i = 0; i < cb->int_max; i++) + if (cb->irq_map[i] == cb_no) + return i; + + return -ENODEV; +} + static inline int allocate_free_irq(int cb_no) { int i; @@ -88,11 +99,16 @@ static int crossbar_domain_xlate(struct irq_domain *d, { unsigned long ret; + ret = get_prev_map_irq(intspec[1]); + if (!IS_ERR_VALUE(ret)) + goto found; + ret = allocate_free_irq(intspec[1]); if (IS_ERR_VALUE(ret)) return ret; +found: *out_hwirq = ret + GIC_IRQ_START; return 0; }