Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4336210imm; Mon, 14 May 2018 06:12:41 -0700 (PDT) X-Google-Smtp-Source: AB8JxZq3CgmLMO2VvOLw7QnlmWSdf1u2ow5CkQQg6wKddUmhKDOXjjFDomP7HpfTintogG+KIUq2 X-Received: by 2002:a65:5008:: with SMTP id f8-v6mr4676646pgo.349.1526303561893; Mon, 14 May 2018 06:12:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526303561; cv=none; d=google.com; s=arc-20160816; b=KlfSXxm+Uxp/Yu7VgNhobOupJLYKlr/MquYS5XRXTv7193O4qtivBxyZF5evof6fAM cWOy9qvJ1VoA925RSPwvcU50Q2c9H8AhulwVMkRgZX7usv2eSDUB6DYBz+5iUrwMORRw Q/6i2xgJfVeqtlyse9QFysVcx1y6tlX8xVhlsH/+Bw2HGMSAZKJPG5x2y8fJTaYLCerJ yNou5twscKzTlwrDeJU0PO3DYaGECt/aClNgI0YcjIyCj/Zz8RJAnvPcxeVKBseYvqOI c9P5/+Qu78cQGR4nx3iI3xN+dt17YNWFug6RffUyLbXDfPtPTxnBLeIpu7klqL7xMlSR 8vzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :arc-authentication-results; bh=FeApGq9OlM47UAlZQVb85wrYNiZFhlX+qYZFBlosMxQ=; b=TaqOMf9yPC9pkBm7NT++GdEqf53adyZqeSEcpC2yjtEmTMVytECPeEh0gSLlVVFQ1y E5FAp6xyw3brLThPtAGkH9MOr/ee6g1tzoyFeUWeVKre/N5tFDQsBRPWLP8U31zq9CCV zILdbY00sAQkJKumKmDoPJeX7VHjit/s9jy4m3Zx1ZlDsQx6It7YKYVPCgDToO4G5y/s oCmu3burYUlBHU50BS3eYDbW4CLFzwOjc3j4st8aYN41ZRweMxCIEHPxlv5yxGXQ37Zw NWQhmzR5xSm5Q7dpXJ4Nas5DdD4AA8nV/ycNonsrUFvOW/i4WyMW8Of8zhi6oqQZZHcU vZbw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m2-v6si7750597pgs.349.2018.05.14.06.12.00; Mon, 14 May 2018 06:12:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753659AbeENNLo (ORCPT + 99 others); Mon, 14 May 2018 09:11:44 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:43271 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753270AbeENNLl (ORCPT ); Mon, 14 May 2018 09:11:41 -0400 Received: from weser.hi.pengutronix.de ([2001:67c:670:100:fa0f:41ff:fe58:4010]) by metis.ext.pengutronix.de with esmtp (Exim 4.89) (envelope-from ) id 1fIDGN-0006nB-P3; Mon, 14 May 2018 15:11:39 +0200 Message-ID: <1526303498.3494.11.camel@pengutronix.de> Subject: Re: Delivery Status Notification (Failure) From: Lucas Stach To: Pintu Kumar Cc: Russell King - ARM Linux , open list , linux-arm-kernel@lists.infradead.org, kernelnewbies@kernelnewbies.org Date: Mon, 14 May 2018 15:11:38 +0200 In-Reply-To: References: <5af57fea.1c69fb81.885f0.2377.GMRIR@mx.google.com> <20180511123915.GC16141@n2100.armlinux.org.uk> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.22.6-1+deb9u1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 2001:67c:670:100:fa0f:41ff:fe58:4010 X-SA-Exim-Mail-From: l.stach@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am Montag, den 14.05.2018, 17:42 +0530 schrieb Pintu Kumar: > Hi, > > Is there any work around possible to set IRQ affinity for some GPIO > interrupt ? > How to avoid CPU0 to receive the current GPIO interrupt ? > How do we assign GPIO interrupts to any CPU other than CPU0 ? > Is it possible to isolate CPU0 for a sometime, from my GPIO driver so > that GPIO interrupt can be served by another CPU ? > > Need your inputs to decide whether it is still possible to set > affinity for GPIO interrupt, or its impossible ? This is not possible. The GPIO IRQs are aggregated into one GPC/GIC IRQ line per GPIO bank, so it is not possible to change affinity of a single GPIO interrupt to another CPU. Best we could do is change the affinity of the whole bank, but given the limited usefulness of something like that, nobody bothered to implement such a thing. Regards, Lucas > > > On Fri, May 11, 2018 at 8:07 PM, Pintu Kumar > wrote: > > On Fri, May 11, 2018 at 6:34 PM, Lucas Stach > e> wrote: > > > Am Freitag, den 11.05.2018, 13:39 +0100 schrieb Russell King - > > > ARM Linux: > > > > On Fri, May 11, 2018 at 05:07:37PM +0530, Pintu Kumar wrote: > > > > > Hi, > > > > > > > > > > I need one help. > > > > > I am using i.MX7 Sabre board with kernel version 4.1.15 > > > > > > > > > > Let's say I am interested in GPIO number: 21 > > > > > I wanted to set CPU affinity for particular GPIO->IRQ number, > > > > > so I > > > > > tried the below steps: > > > > > root@10:~# echo 21 > /sys/class/gpio/export > > > > > root@10:~# echo "rising" > /sys/class/gpio/gpio21/edge > > > > > root@10:~# cat /proc/interrupts | grep 21 > > > > >   47: 0 0 gpio-mxc 21 Edge gpiolib > > > > > root@10:~# cat /sys/class/gpio/gpio21/direction > > > > > in > > > > > root@10:~# cat /proc/irq/47/smp_affinity > > > > > 3 > > > > > root@10:~# echo 2 > /proc/irq/47/smp_affinity > > > > > -bash: echo: write error: Input/output error > > > > > > > > > > But I get input/output error. > > > > > When I debug further, found that irq_can_set_affinity is > > > > > returning 0: > > > > > [    0.000000] genirq: irq_can_set_affinity (0): balance: 1, > > > > > irq_data.chip: a81b7e48, irq_set_affinity:   (null) > > > > > [    0.000000] write_irq_affinity: FAIL > > > > > > > > > > I also tried first setting /proc/irq/default_smp_affinity to > > > > > 2 (from 3). > > > > > This change is working, but the smp_affinity setting for the > > > > > new IRQ > > > > > is not working. > > > > > > > > > > When I try to set smp_affinity for mmc0, then it works. > > > > > # cat /proc/interrupts | grep mmc > > > > > 295:         55          0     GPCV2  22 Edge      mmc0 > > > > > 296:          0          0     GPCV2  23 Edge      mmc1 > > > > > 297:         52          0     GPCV2  24 Edge      mmc2 > > > > > > > > > > root@10:~# echo 2 > /proc/irq/295/smp_affinity > > > > > root@10:~# > > > > > > > > > > > > > > > So, I wanted to know what are the conditions for which > > > > > setting > > > > > smp_affinity for an IRQ will work ? > > > > > > > > > > Is there any way by which I can set CPU affinity to a GPIO -> > > > > > IRQ ? > > > > > Whether, irq_set_affinity_hint() will work in this case ? > > > > > > > > IRQ affinity is only supported where interrupts are _directly_ > > > > wired to > > > > the GIC.  It's the GIC which does the interrupt steering to the > > > > CPU > > > > cores. > > > > > > > > Interrupts on downstream interrupt controllers (such as GPCV2) > > > > have no > > > > ability to be directed independently to other CPUs - the only > > > > possible > > > > way to change the mapping is to move _all_ interrupts on that > > > > controller, > > > > and any downstream chained interrupts at GIC level. > > > > > > > > Hence why Interrupt 295 has no irq_set_affinity function: there > > > > is no way > > > > for the interrupt controller itself to change the affinity of > > > > the input > > > > interrupt. > > > > > > The GPCv2 though is a secondary IRQ controller which has a 1:1 > > > mapping > > > of its input IRQs to the upstream GIC IRQ lines. Affinity can > > > thus be > > > handled by forwarding the request to the GIC by > > > irq_chip_set_affinity_parent(). > > > > > > As this is handled correctly in the upstream kernel since the > > > first > > > commit introducing support for the GPCv2, it seems the issue is > > > only > > > present in some downstream kernel. > > > > > > > OK. Thanks so much for your reply. > > > > I saw some of the drivers using irq_set_affinity_hint() to force > > the > > IRQ affinity to a particular CPU. > > This is the sample: > > { > > cpumask_clear(mask); > > cpumask_set_cpu(cpu, mask); > > irq_set_affinity_hint(irq, mask); > > } > > > > Whether this logic will work for a particular GPIO pin ? > > > > > > > Regards, > > > Lucas