From patchwork Mon Jun 16 11:23:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sricharan R X-Patchwork-Id: 31935 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f200.google.com (mail-ve0-f200.google.com [209.85.128.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EA4AD20E7A for ; Mon, 16 Jun 2014 11:26:04 +0000 (UTC) Received: by mail-ve0-f200.google.com with SMTP id i13sf14597047veh.3 for ; Mon, 16 Jun 2014 04:26:04 -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:cc:subject:date:message-id :in-reply-to:references:mime-version:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=CaReitGrUIHaDuwkksRYdayy/gRlaTBc/bBP241v1S4=; b=Wlce9VKMriEITRy0qDZ3Dx+U0pWoMJqtCnJ+pH8S0Cba1mRxI7tqH0Amy86KkmHbbz il6AosDV0gSOBocUqsoBTPSH9pj1FvALHmSuvywHHgbhnJHsFqOVZD4ZLLDQ6oV28HiR 2r5ujruBsUUUX4mVrwx+osRCX6XIweqUL40/5ntUCIq7pm+AYb+Vs3EPmxbgoqVFsLYC c/5ZlCrKu0Q/CkFH1BAWgcNq9wXnG4tGNBBO+ZwLHoyA+XjO/KbiZtEcBRsrMmkKx8l0 vpK3CM/lou4uXA86OP03o4jCKWQy4gAWI1+krvLKzHuNWPB+6zrpBDkKHc2v2T4rBdtG 2rFw== X-Gm-Message-State: ALoCoQkjnRaPbrFDf8hJCkulqSQ1UVv4HkTfQ6BpETyr0lJxcnaeP113JTt8+p3fgASLJL91caXk X-Received: by 10.236.124.100 with SMTP id w64mr513529yhh.57.1402917964490; Mon, 16 Jun 2014 04:26:04 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.27.103 with SMTP id 94ls4438414qgw.13.gmail; Mon, 16 Jun 2014 04:26:04 -0700 (PDT) X-Received: by 10.53.1.71 with SMTP id be7mr32911vdd.92.1402917964410; Mon, 16 Jun 2014 04:26:04 -0700 (PDT) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by mx.google.com with ESMTPS id dc1si3984741vdc.4.2014.06.16.04.26.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Jun 2014 04:26:04 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.177 as permitted sender) client-ip=209.85.220.177; Received: by mail-vc0-f177.google.com with SMTP id ij19so4650460vcb.8 for ; Mon, 16 Jun 2014 04:26:04 -0700 (PDT) X-Received: by 10.52.52.168 with SMTP id u8mr13163420vdo.25.1402917964322; Mon, 16 Jun 2014 04:26:04 -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.54.6 with SMTP id vs6csp127264vcb; Mon, 16 Jun 2014 04:26:03 -0700 (PDT) X-Received: by 10.66.149.102 with SMTP id tz6mr23437012pab.76.1402917963533; Mon, 16 Jun 2014 04:26:03 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id yh3si13339101pab.170.2014.06.16.04.26.02; Mon, 16 Jun 2014 04:26:02 -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 S1755138AbaFPL0B (ORCPT + 9 others); Mon, 16 Jun 2014 07:26:01 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:41692 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753227AbaFPLZz (ORCPT ); Mon, 16 Jun 2014 07:25:55 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id s5GBPH3c018861; Mon, 16 Jun 2014 06:25:17 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s5GBPHfF025808; Mon, 16 Jun 2014 06:25:17 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.174.1; Mon, 16 Jun 2014 06:25:17 -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 s5GBOx3x008965; Mon, 16 Jun 2014 06:25:12 -0500 From: Sricharan R To: , , , CC: , , , , , , , , Subject: [PATCH V3 02/16] irqchip: crossbar: check for premapped crossbar before allocating Date: Mon, 16 Jun 2014 16:53:02 +0530 Message-ID: <1402917796-31574-3-git-send-email-r.sricharan@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1402917796-31574-1-git-send-email-r.sricharan@ti.com> References: <1402917796-31574-1-git-send-email-r.sricharan@ti.com> MIME-Version: 1.0 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: 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.177 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: 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 --- 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; }