Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp870652imm; Fri, 11 May 2018 07:38:08 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqeO/+SEsMBvHX7QF0u8Cz0QjlQoFiR76LbHNmEDbEHY67YcyIe0EOmF2QSBLdvIEB/1cdw X-Received: by 2002:a65:5cc6:: with SMTP id b6-v6mr4542133pgt.84.1526049488370; Fri, 11 May 2018 07:38:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526049488; cv=none; d=google.com; s=arc-20160816; b=Of6MDEHR2cFS0AQlwpl+qLYgrr6ZJzJe9LhdV+d+tAqB8GKTJz/nkTd8IkeGLaXlyi QIxiYidDbM9tzWxNu8jqWW+pXnCsCXfnGT6ICv1o2nVXDnFcGnp9Rh7fgT1nc7YEFaU3 NnV/6cOyJOXNhDBLcvaAv7UpTN37/ryYoXviJPvIW3AFpn+DvoHcMtFt/KhFcGmCzUNH +jJSkRUs4BYbPaBn5jb/GmScTUwjAuj7aXBzumkujBcOZlot7xhjkrq+xNefjbY+4usf GJXVCsRJ4hry+TrqWCr2eLuLXXFr1N0llCxo3Jnaqnzkp+qnPIDSEXhYFmoHakkaeJvT kFYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=v8eUGPxZH8WgaJWoBYC0oJdl1msrCGqIdYzjlI3iua8=; b=HGr4Hl02XLr/UTr5Dc8nuRTfLjJXj3KQgyFi36upg6RlPPn+zJbkaTW1jg7/JmvvaY 7BkbjP6S9kPW8zUQvsIsDW2T1fIRl7icuxUMOfAZr39rs6st3Koza5roro2ghcbVi+f7 +bFtJdSsJF+F9UIYieQKjp/0ZteVvQD3KminWd/gHF0piVIW+ssrIXOQWq8hkh49xYPE goH4ab4o8kQZwDxjJzKolZqRKIfYh1FlU8RkQPxjZ4JUQaREt+ZnMjKVJe8Cx3YFEgqL yO+sShu1dahDzqZRYNTCecfnqhCIU3TFBOPgskX0xFe5SeEsceP62z8zbeRkqth9kYeO 1lLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=U/pGaNru; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w17-v6si2708927pgm.604.2018.05.11.07.37.53; Fri, 11 May 2018 07:38:08 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=U/pGaNru; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753185AbeEKOhf (ORCPT + 99 others); Fri, 11 May 2018 10:37:35 -0400 Received: from mail-ua0-f172.google.com ([209.85.217.172]:37225 "EHLO mail-ua0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752017AbeEKOhe (ORCPT ); Fri, 11 May 2018 10:37:34 -0400 Received: by mail-ua0-f172.google.com with SMTP id i3-v6so3742159uad.4 for ; Fri, 11 May 2018 07:37:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=v8eUGPxZH8WgaJWoBYC0oJdl1msrCGqIdYzjlI3iua8=; b=U/pGaNruIdGqM8tLOHu8xy/yCqKCDJHT+FL0PGewFNht91aok31aHVUDLi4jugFgaw TXuX9Y+EUa0iPFb4331karIhRxvQ2ekoHQAaEmN/yrVlp314ZI2G7leUMnFbFKPYSKMt hledAMC3zxU5kn3iDxcKZSONOK8+UnSzDJbl2C8tOxGo0IqV/Ho9c4UkKjwb31G0CLod AivqNihUwiP+/nSfndWO6VOnGJob531QuCih8P+baTdyqryn+xpTya1lVIncMVXqiofq vXYv4ynsTVbSIxqAivtVOsxDHql4/vHRQxDyLgQeKECxDTDUgANm3yx7nqq0uQkzIcgX LbtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=v8eUGPxZH8WgaJWoBYC0oJdl1msrCGqIdYzjlI3iua8=; b=eHvL1hVDuScmjl/xWPf/xRgdj7/PmArRid2iBdkHC/4jhiE5tYgMDsKB0Z1ZcLkQvI pGuYrcciTs1mZSqCb3ZOPIq801SAslwxSdK+W5hjKnvepEKqxt3+V+e7oQ7SJEtTnobF uFe4wyhbXvSv99UU0vcx4txocR9AbMdBRcv9G2l9UIxSCfjgbBhzahCoThWG4f3WS3uM l8vhzi9FGbUICjJHk3SOa8oFk7L9IAAF4OVTt3RF5Q6iiYxRCKJbpD+o8hjijYrj6Oad q+aGNZyjree2GDENGsY0Gd2I4Mv4gGM1blPDsLr0ebf2RWB2YbwX9jAiyWnd95IsilPO G+Fw== X-Gm-Message-State: ALKqPwfNKrLXTD77XzvPPcbhqISKseAvcOEXLgPVqH+A1O+rocNo8mX4 RkxOJMUpymBJXIxq9QiGFYBVo9tnkxsDvWilP8M= X-Received: by 2002:ab0:4d4d:: with SMTP id k13-v6mr1537333uag.136.1526049453648; Fri, 11 May 2018 07:37:33 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.144.74 with HTTP; Fri, 11 May 2018 07:37:33 -0700 (PDT) In-Reply-To: References: <5af57fea.1c69fb81.885f0.2377.GMRIR@mx.google.com> <20180511123915.GC16141@n2100.armlinux.org.uk> From: Pintu Kumar Date: Fri, 11 May 2018 20:07:33 +0530 Message-ID: Subject: Re: Delivery Status Notification (Failure) To: Lucas Stach Cc: Russell King - ARM Linux , open list , linux-arm-kernel@lists.infradead.org, kernelnewbies@kernelnewbies.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 11, 2018 at 6:34 PM, Lucas Stach 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