From patchwork Tue Aug 5 14:58:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Joe.C" X-Patchwork-Id: 34957 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oi0-f70.google.com (mail-oi0-f70.google.com [209.85.218.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7EDAC2397D for ; Tue, 5 Aug 2014 15:06:18 +0000 (UTC) Received: by mail-oi0-f70.google.com with SMTP id u20sf3914745oif.5 for ; Tue, 05 Aug 2014 08:06:18 -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=Au93Rkv4P4NGzhm8L0CwF0QxdjTBZe9wn6skOFCaZM0=; b=kT2VPDCssQTNa5Do4a09nU0GrvIpBZokfWkB9lDcbV3kGQfLxqobCR495CFDFR8djx wZMiFXrOeFiJV7BubRKui1l2qnEX8HlelduB+remN1kJr/ZAjSN+Vjzhr8KDVcbVbXd/ XZqjoHwevO1wrof1rXoMY36IuTmMUirwVArZVb7Bj4gHPu3gcVarq7ERNGVRyE1U3FS3 OKYYcS6g2MrfQWG5WW9u+14Fk8ML4jzHGl+1O1D+qf+6deOjpUpbkbmREjkY16c6YkiU rEOpb4Ix+zeUedY7+B3qzZxR28NXE0sUS15OcvMEoJBgZwsoLbCoHjEBA7TKdJ6s90xV iYfw== X-Gm-Message-State: ALoCoQkokph/kaBVp9vuZOh5If4I0UvdAfkBmZpT06ukW7iDGsOn5cg07rR98cNro8Otx3W0p+DH X-Received: by 10.42.37.71 with SMTP id x7mr2939446icd.4.1407251177999; Tue, 05 Aug 2014 08:06:17 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.106.139 with SMTP id e11ls281063qgf.36.gmail; Tue, 05 Aug 2014 08:06:17 -0700 (PDT) X-Received: by 10.52.36.131 with SMTP id q3mr1606870vdj.90.1407251177800; Tue, 05 Aug 2014 08:06:17 -0700 (PDT) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id ee14si1286988vcb.93.2014.08.05.08.06.17 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 05 Aug 2014 08:06:17 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.180 as permitted sender) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id ij19so1695009vcb.25 for ; Tue, 05 Aug 2014 08:06:17 -0700 (PDT) X-Received: by 10.221.5.137 with SMTP id og9mr3331775vcb.18.1407251177685; Tue, 05 Aug 2014 08:06:17 -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 tc5csp396439vcb; Tue, 5 Aug 2014 08:06:17 -0700 (PDT) X-Received: by 10.68.166.36 with SMTP id zd4mr5085825pbb.54.1407251176649; Tue, 05 Aug 2014 08:06:16 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id qo7si2217665pac.190.2014.08.05.08.06.16 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Aug 2014 08:06:16 -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 1XEgHv-0007La-Ot; Tue, 05 Aug 2014 15:04:31 +0000 Received: from [210.61.82.183] (helo=mailgw01.mediatek.com) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XEgHg-0007Ej-6S for linux-arm-kernel@lists.infradead.org; Tue, 05 Aug 2014 15:04:25 +0000 X-Listener-Flag: 11101 Received: from mtkhts09.mediatek.inc [(172.21.101.70)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 609326988; Tue, 05 Aug 2014 22:58:14 +0800 Received: from mtksdtcf02.mediatek.inc (10.21.12.142) by mtkhts09.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 14.3.181.6; Tue, 5 Aug 2014 22:58:13 +0800 From: Joe.C To: , Subject: [PATCH 1/3] irqchip: gic: Change irq type check when extension is present Date: Tue, 5 Aug 2014 22:58:08 +0800 Message-ID: <1407250690-2858-2-git-send-email-srv_yingjoe.chen@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1407250690-2858-1-git-send-email-srv_yingjoe.chen@mediatek.com> References: <1407250690-2858-1-git-send-email-srv_yingjoe.chen@mediatek.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140805_080416_447236_4D10D4B4 X-CRM114-Status: GOOD ( 11.94 ) X-Spam-Score: 1.3 (+) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (1.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines Cc: yingjoe.chen@gmail.com, srv_heupstream@mediatek.com, hc.yen@mediatek.com, yh.chen@mediatek.com, olof@lixom.net, nathan.chung@mediatek.com, Matthias Brugger , eddie.huang@mediatek.com 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: patch@linaro.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.220.180 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: "Joe.C" GIC supports the combination with external extensions. But this is not reflected in the checks of the interrupt type flag. This patch allows interrupt types other than the one supported by GIC, if an architecture extension is present and supports them. Signed-off-by: Joe.C --- drivers/irqchip/irq-gic.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c index 57d165e..66485ab 100644 --- a/drivers/irqchip/irq-gic.c +++ b/drivers/irqchip/irq-gic.c @@ -194,23 +194,32 @@ static int gic_set_type(struct irq_data *d, unsigned int type) u32 confoff = (gicirq / 16) * 4; bool enabled = false; u32 val; + int ret = 0; /* Interrupt configuration for SGIs can't be changed */ if (gicirq < 16) return -EINVAL; - if (type != IRQ_TYPE_LEVEL_HIGH && type != IRQ_TYPE_EDGE_RISING) - return -EINVAL; - raw_spin_lock(&irq_controller_lock); - if (gic_arch_extn.irq_set_type) - gic_arch_extn.irq_set_type(d, type); + if (gic_arch_extn.irq_set_type) { + ret = gic_arch_extn.irq_set_type(d, type); + if (ret) + goto out; + } else if (type != IRQ_TYPE_LEVEL_HIGH && + type != IRQ_TYPE_EDGE_RISING) { + ret = -EINVAL; + goto out; + } val = readl_relaxed(base + GIC_DIST_CONFIG + confoff); - if (type == IRQ_TYPE_LEVEL_HIGH) + /* Check for both edge and level here, so we can support GIC irq + polarity extension in gic_arch_extn.irq_set_type. If arch + doesn't support polarity extension, the check above will reject + improper type. */ + if (type & IRQ_TYPE_LEVEL_MASK) val &= ~confmask; - else if (type == IRQ_TYPE_EDGE_RISING) + else if (type & IRQ_TYPE_EDGE_BOTH) val |= confmask; /* @@ -226,10 +235,10 @@ static int gic_set_type(struct irq_data *d, unsigned int type) if (enabled) writel_relaxed(enablemask, base + GIC_DIST_ENABLE_SET + enableoff); - +out: raw_spin_unlock(&irq_controller_lock); - return 0; + return ret; } static int gic_retrigger(struct irq_data *d)