Message ID | 20231119092909.3018578-1-youngmin.nam@samsung.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp1557672vqn; Sun, 19 Nov 2023 00:54:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IH6T8voqohvVrYzxm1jGcP8PBMR2dGtj/Q4JvJJFS19AYJ+XgMAF5jA5fQmySkbr8li7Ikw X-Received: by 2002:a05:6871:10d:b0:1bf:b863:b6d with SMTP id y13-20020a056871010d00b001bfb8630b6dmr5583204oab.1.1700384098069; Sun, 19 Nov 2023 00:54:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700384098; cv=none; d=google.com; s=arc-20160816; b=HnEOceGyUFmG7xIL26B27X5FDhoXpvbHnNJ4GtK361np645G98n9Yt9JYtG9A4Qsu1 EYniBsRrcEGmJLC6n92dLInb64sPzD+RTfi3/XwzKh1WG8uwXV7suoICnBxNc/+CD6EW 0RmSxHuzGJiGb9rQjl1LSPLdVWYsbWZPloKldkE9CZ48cIeeve+ojXTuDorQNXMkobiz yCdXI+G1oIHxvw1lN9hhDEmLHoOm30x5Rl7Je0PbDFYA+sK4NubwztQgz4VF8F4AJgGV URPdPvXoQu8PnxNd8Okz7vKTc56OXASAdEOAgz4PjAElLdynawB6ADEW8ZcwFeQ7k/yd pLZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature:dkim-filter; bh=aUl24Gac6V4qeYPQFo9QasuwMm4N5iU9VP5YIzb5kFs=; fh=UOWUHydFlZyUEt6ulKh2rg45KKSpuCfCDZgfOZ7i+EU=; b=bZPl5Ec4T5awMwJiz/y2BsY8MHCeKr5i8a6aMQiH0G14dP/BGJlE6E2Na613JW0Q3L 96sTVwKJaPZpSgfquywCpJiB+AQ9L1QYxXX79fvWk9+5Si5pWcL/1/YPGiEZCE7rlX2c wP8N5KHY23CSgtYHKZWm31vwqjEL7aV6DHzUBinx6l0qlt4OTc0d3lFqJQKaILzGCyNn du9wIeWYEj7nBVDT/sG1h0QAYlmceovhubGIgf0UHidIzIKbEqJoUkQbYmsXCQ4H3BkG AvGV6Ip+7/SX5Zikplc51cZXJtE6ffmIg1XA+sUbrVv4ABc7P4Qz8/esCCRFXrJaAVew Hl5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=sCuuYSSy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id lp17-20020a17090b4a9100b00280479459f7si8901070pjb.50.2023.11.19.00.54.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Nov 2023 00:54:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=sCuuYSSy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 16CE88056A33; Sun, 19 Nov 2023 00:54:54 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229668AbjKSIyy (ORCPT <rfc822;ouuuleilei@gmail.com> + 99 others); Sun, 19 Nov 2023 03:54:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229454AbjKSIyx (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 19 Nov 2023 03:54:53 -0500 Received: from mailout2.samsung.com (mailout2.samsung.com [203.254.224.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CC0BE5 for <linux-kernel@vger.kernel.org>; Sun, 19 Nov 2023 00:54:48 -0800 (PST) Received: from epcas2p4.samsung.com (unknown [182.195.41.56]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20231119085443epoutp022f23a6f1f3616becbe28c2b1aa5218b6~Y_lCm_Vvm2602726027epoutp02R for <linux-kernel@vger.kernel.org>; Sun, 19 Nov 2023 08:54:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20231119085443epoutp022f23a6f1f3616becbe28c2b1aa5218b6~Y_lCm_Vvm2602726027epoutp02R DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1700384083; bh=aUl24Gac6V4qeYPQFo9QasuwMm4N5iU9VP5YIzb5kFs=; h=From:To:Cc:Subject:Date:References:From; b=sCuuYSSydd5RKckJ43Qr6SeMmEBAD4LV1ReXNhDZMAPdyE5GABAxJLsDA8mBvbPiU nXJ9sj8M71m2MM5FLozUfza57FtBjiGW2xAN9wLwh2pqnNj+Tkx8DsOTdTt007AzGU YASC24rqoBy+4IJTV3jF8LwadXitnnaMfvOqcwjI= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20231119085442epcas2p370350440fbfcf488feb10a8e309a2ac4~Y_lBUYAx71040310403epcas2p3y; Sun, 19 Nov 2023 08:54:42 +0000 (GMT) Received: from epsmges2p3.samsung.com (unknown [182.195.36.89]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4SY4Fs6ncwz4x9Pp; Sun, 19 Nov 2023 08:54:41 +0000 (GMT) Received: from epcas2p3.samsung.com ( [182.195.41.55]) by epsmges2p3.samsung.com (Symantec Messaging Gateway) with SMTP id 1A.9C.10022.15DC9556; Sun, 19 Nov 2023 17:54:41 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas2p3.samsung.com (KnoxPortal) with ESMTPA id 20231119085440epcas2p375fa3b2999e1a3ceeff9949136db7e28~Y_k-zOBqs1033410334epcas2p35; Sun, 19 Nov 2023 08:54:40 +0000 (GMT) Received: from epsmgmcp1.samsung.com (unknown [182.195.42.82]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20231119085440epsmtrp1dbac461351964514c6477a126c1ee07d~Y_k-yeKgU2939629396epsmtrp1h; Sun, 19 Nov 2023 08:54:40 +0000 (GMT) X-AuditID: b6c32a47-9a3ff70000002726-ba-6559cd5151cd Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgmcp1.samsung.com (Symantec Messaging Gateway) with SMTP id 63.0A.18939.05DC9556; Sun, 19 Nov 2023 17:54:40 +0900 (KST) Received: from perf.dsn.sec.samsung.com (unknown [10.229.95.91]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20231119085440epsmtip2c458c7eef622a9fabea8b8d2e7842d12~Y_k-kPdsJ3102631026epsmtip2t; Sun, 19 Nov 2023 08:54:40 +0000 (GMT) From: Youngmin Nam <youngmin.nam@samsung.com> To: tomasz.figa@gmail.com, krzysztof.kozlowski@linaro.org, s.nawrocki@samsung.com, alim.akhtar@samsung.com, linus.walleij@linaro.org Cc: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, semen.protsenko@linaro.org, Youngmin Nam <youngmin.nam@samsung.com> Subject: [PATCH] pinctrl: samsung: add irq_set_affinity() for non wake up external gpio interrupt Date: Sun, 19 Nov 2023 18:29:09 +0900 Message-Id: <20231119092909.3018578-1-youngmin.nam@samsung.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupjk+LIzCtJLcpLzFFi42LZdljTXDfwbGSqwbvXBhYP5m1js9j7eiu7 xZQ/y5ksNj2+xmqxef4fRovLu+awWcw4v4/J4vCbdlaL531A1qpdQInFBz6xO3B77Jx1l93j zrU9bB6bl9R79G1ZxejxeZNcAGtUtk1GamJKapFCal5yfkpmXrqtkndwvHO8qZmBoa6hpYW5 kkJeYm6qrZKLT4CuW2YO0GVKCmWJOaVAoYDE4mIlfTubovzSklSFjPziElul1IKUnALzAr3i xNzi0rx0vbzUEitDAwMjU6DChOyM978yC2aJVnTsOc3awHidv4uRk0NCwETiSssixi5GLg4h gR2MEgumHmCDcD4xSizafZEFzln75TlQhgOs5fNmc5BuIYGdjBKvvwpB1HxllFg84yATSIJN QFdi24l/jCC2iEAbo0Tn3gCQImaBc4wS93smMIMkhAWSJT7cf8ECMpRFQFXiwZdskDCvgL3E 9pdPWSF2yUssfiABERaUODnzCQuIzQwUbt46mxlkpITAI3aJjp+LWCDecZE4PPcQE4QtLPHq +BZ2CFtK4mV/G5SdLbH61yUou0Ki/V4PM4RtLDHrWTsjyF5mAU2J9bv0IU5QljhyC2otn0TH 4b/sEGFeiY42IYhGNYlfUzYwQtgyErsXr4Aa6CHx6PAGdkhIxUpsWnWQdQKj/Cwkz8xC8sws hL0LGJlXMYqlFhTnpqcWGxUYwyM0OT93EyM4YWq572Cc8faD3iFGJg7GQ4wSHMxKIrzfhCJS hXhTEiurUovy44tKc1KLDzGaAgN3IrOUaHI+MGXnlcQbmlgamJiZGZobmRqYK4nz3mudmyIk kJ5YkpqdmlqQWgTTx8TBKdXAVOs5d5VEaYXAEf3z69umi015cPTiv5Q7zpnc1/sEtq1oFDTa 7XlQeKJY0o1bJUdj/sQt1y6t/BCS9InB83R7GQv7Ebf1urUOdiuUJBdFfu7sMJS5LaZSkHj+ N+P5n3trzIMPOxnmZEe8s2PS9I6offKmUe3Ok7faGyyvfqiq3Oea4XxsdxDn++mlUa0r6m78 7Fmxg+0ro0NFrlBJTaFpOWfkJk0BSRP22/pv/U8cWTZXx2LxhUMNq1VuH4iRSe96/u9cd7jr F82b4TKPTXrC1r8Q4U3xU26/oLnFZlWjw+qlXp5WjXttZntevT79bLDkGm9GiV+Tbx89WisX FqM44+fF6Sy749UUP5aq2QcosRRnJBpqMRcVJwIA+8ribyEEAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrDLMWRmVeSWpSXmKPExsWy7bCSvG7A2chUg/57MhYP5m1js9j7eiu7 xZQ/y5ksNj2+xmqxef4fRovLu+awWcw4v4/J4vCbdlaL531A1qpdQInFBz6xO3B77Jx1l93j zrU9bB6bl9R79G1ZxejxeZNcAGsUl01Kak5mWWqRvl0CV8b7X5kFs0QrOvacZm1gvM7fxcjB ISFgIvF5s3kXIxeHkMB2RonDvy6xdjFyAsVlJG6vvAxlC0vcbznCClH0mVHi0uNNTCAJNgFd iW0n/jGCJEQEehglNr+awALiMAtcYZTYsngpI0iVsECixOst+9lA1rEIqEo8+JINEuYVsJfY /vIpK8QV8hKLH0hAhAUlTs58wgJiMwOFm7fOZp7AyDcLSWoWktQCRqZVjKKpBcW56bnJBYZ6 xYm5xaV56XrJ+bmbGMEBrBW0g3HZ+r96hxiZOBgPMUpwMCuJ8H4TikgV4k1JrKxKLcqPLyrN SS0+xCjNwaIkzquc05kiJJCeWJKanZpakFoEk2Xi4JRqYHK/zZ0QoCr89msDU7bvO41PZY9N yxRZ+1LObLNYsKJ9+7XDGk+YjLbGfy4prNGa8/hU+/Gmv0GNue+j/py9bVW8KI1dbOH3lp/3 Mg9eCNaX5durMvHLzRrniEingiuKjHVJD7UDV1TxqnQUvDIp+s9U4F59mOePfknwTMZ1DOKZ V5YLvrDNkDrcdUNe2ZSZ53erXvMjyd/PfTLr7qX/b5j8WqRwy83cyV1bxRVPRvDN3XRjY8kr b9a9E6xaFNImXuW8o9S9vj3hf+gzsRt9F5Zb/4t9z+iRnHQh8ZzVn7SlxoeV5HRCPlrwzP3d 6MQT4e16ZKVJQOwThp0ajOfYrzjO/fwlsJ7BhOndBv8wJZbijERDLeai4kQAcY1Q7M8CAAA= X-CMS-MailID: 20231119085440epcas2p375fa3b2999e1a3ceeff9949136db7e28 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20231119085440epcas2p375fa3b2999e1a3ceeff9949136db7e28 References: <CGME20231119085440epcas2p375fa3b2999e1a3ceeff9949136db7e28@epcas2p3.samsung.com> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Sun, 19 Nov 2023 00:54:54 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782981955781615519 X-GMAIL-MSGID: 1782981955781615519 |
Series |
pinctrl: samsung: add irq_set_affinity() for non wake up external gpio interrupt
|
|
Commit Message
Youngmin Nam
Nov. 19, 2023, 9:29 a.m. UTC
To support affinity setting for non wake up external gpio interrupt,
we add a new irq_set_affinity callback using irq number which is in pinctrl
driver data.
Before applying this patch, we couldn't change irq affinity of gpio interrupt.
* before
erd9945:/proc/irq/418 # cat smp_affinity
3ff
erd9945:/proc/irq/418 # echo 00f > smp_affinity
erd9945:/proc/irq/418 # cat smp_affinity
3ff
erd9945:/proc/irq/418 # cat /proc/interrupts
CPU0 CPU1 CPU2 CPU3 CPU4 CPU5 CPU6 CPU7 CPU8 CPU9
418: 3631 0 0 0 0 0 0 0 0 0 gpg2 0 Edge 19100000.drmdecon
After applying this patch, we can change irq affinity of gpio interrupt as below.
* after
erd9945:/proc/irq/418 # cat smp_affinity
3ff
erd9945:/proc/irq/418 # echo 00f > smp_affinity
erd9945:/proc/irq/418 # cat smp_affinity
00f
erd9945:/proc/irq/418 # cat /proc/interrupts
CPU0 CPU1 CPU2 CPU3 CPU4 CPU5 CPU6 CPU7 CPU8 CPU9
418: 3893 201 181 188 0 0 0 0 0 0 gpg2 0 Edge 19100000.drmdecon
Signed-off-by: Youngmin Nam <youngmin.nam@samsung.com>
---
drivers/pinctrl/samsung/pinctrl-exynos.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
Comments
On Sun, Nov 19, 2023 at 2:54 AM Youngmin Nam <youngmin.nam@samsung.com> wrote: > > To support affinity setting for non wake up external gpio interrupt, > we add a new irq_set_affinity callback using irq number which is in pinctrl > driver data. > > Before applying this patch, we couldn't change irq affinity of gpio interrupt. > * before > erd9945:/proc/irq/418 # cat smp_affinity > 3ff > erd9945:/proc/irq/418 # echo 00f > smp_affinity > erd9945:/proc/irq/418 # cat smp_affinity > 3ff > erd9945:/proc/irq/418 # cat /proc/interrupts > CPU0 CPU1 CPU2 CPU3 CPU4 CPU5 CPU6 CPU7 CPU8 CPU9 > 418: 3631 0 0 0 0 0 0 0 0 0 gpg2 0 Edge 19100000.drmdecon > > After applying this patch, we can change irq affinity of gpio interrupt as below. > * after > erd9945:/proc/irq/418 # cat smp_affinity > 3ff > erd9945:/proc/irq/418 # echo 00f > smp_affinity > erd9945:/proc/irq/418 # cat smp_affinity > 00f > erd9945:/proc/irq/418 # cat /proc/interrupts > CPU0 CPU1 CPU2 CPU3 CPU4 CPU5 CPU6 CPU7 CPU8 CPU9 > 418: 3893 201 181 188 0 0 0 0 0 0 gpg2 0 Edge 19100000.drmdecon > Suggest formatting the commit message as follows, to make it more readable: 8<-------------------------------------------------------------------------->8 To support affinity setting for non wake up external gpio interrupt, add irq_set_affinity callback using irq number from pinctrl driver data. Before this patch, changing the irq affinity of gpio interrupt is not possible: # cat /proc/irq/418/smp_affinity 3ff # echo 00f > /proc/irq/418/smp_affinity # cat /proc/irq/418/smp_affinity 3ff # cat /proc/interrupts CPU0 CPU1 CPU2 CPU3 ... 418: 3631 0 0 0 ... With this patch applied, it's possible to change irq affinity of gpio interrupt: # cat /proc/irq/418/smp_affinity 3ff # echo 00f > /proc/irq/418/smp_affinity # cat /proc/irq/418/smp_affinity 00f # cat /proc/interrupts CPU0 CPU1 CPU2 CPU3 ... 418: 3893 201 181 188 ... 8<-------------------------------------------------------------------------->8 > Signed-off-by: Youngmin Nam <youngmin.nam@samsung.com> > --- > drivers/pinctrl/samsung/pinctrl-exynos.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/drivers/pinctrl/samsung/pinctrl-exynos.c b/drivers/pinctrl/samsung/pinctrl-exynos.c > index 6b58ec84e34b..5d7b788282e9 100644 > --- a/drivers/pinctrl/samsung/pinctrl-exynos.c > +++ b/drivers/pinctrl/samsung/pinctrl-exynos.c > @@ -147,6 +147,19 @@ static int exynos_irq_set_type(struct irq_data *irqd, unsigned int type) > return 0; > } > > +static int exynos_irq_set_affinity(struct irq_data *irqd, > + const struct cpumask *dest, bool force) > +{ > + struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd); > + struct samsung_pinctrl_drv_data *d = bank->drvdata; > + struct irq_data *parent = irq_get_irq_data(d->irq); I'm probably missing something, but: why not just use "irqd" parameter and avoid declaring "bank" and "d"? Is "d->irq" somehow different from "irqd"? > + > + if (parent) > + return parent->chip->irq_set_affinity(parent, dest, force); > + Why not use irq_chip_set_affinity_parent() API? > + return -EINVAL; Maybe use something like this instead: if (!irqd->parent_data) return -EINVAL; return irq_chip_set_affinity_parent(irqd, dest, force); Can you please test if this code works? > +} > + > static int exynos_irq_request_resources(struct irq_data *irqd) > { > struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd); > @@ -212,6 +225,7 @@ static const struct exynos_irq_chip exynos_gpio_irq_chip __initconst = { > .irq_mask = exynos_irq_mask, > .irq_ack = exynos_irq_ack, > .irq_set_type = exynos_irq_set_type, > + .irq_set_affinity = exynos_irq_set_affinity, What happens if we just assign irq_chip_set_affinity_parent() here? Would it work, or Exynos case is more complicated than this? > .irq_request_resources = exynos_irq_request_resources, > .irq_release_resources = exynos_irq_release_resources, > }, > -- > 2.39.2 >
On Tue, Nov 21, 2023 at 12:33:51PM -0600, Sam Protsenko wrote: > On Sun, Nov 19, 2023 at 2:54 AM Youngmin Nam <youngmin.nam@samsung.com> wrote: > > > > To support affinity setting for non wake up external gpio interrupt, > > we add a new irq_set_affinity callback using irq number which is in pinctrl > > driver data. > > > > Before applying this patch, we couldn't change irq affinity of gpio interrupt. > > * before > > erd9945:/proc/irq/418 # cat smp_affinity > > 3ff > > erd9945:/proc/irq/418 # echo 00f > smp_affinity > > erd9945:/proc/irq/418 # cat smp_affinity > > 3ff > > erd9945:/proc/irq/418 # cat /proc/interrupts > > CPU0 CPU1 CPU2 CPU3 CPU4 CPU5 CPU6 CPU7 CPU8 CPU9 > > 418: 3631 0 0 0 0 0 0 0 0 0 gpg2 0 Edge 19100000.drmdecon > > > > After applying this patch, we can change irq affinity of gpio interrupt as below. > > * after > > erd9945:/proc/irq/418 # cat smp_affinity > > 3ff > > erd9945:/proc/irq/418 # echo 00f > smp_affinity > > erd9945:/proc/irq/418 # cat smp_affinity > > 00f > > erd9945:/proc/irq/418 # cat /proc/interrupts > > CPU0 CPU1 CPU2 CPU3 CPU4 CPU5 CPU6 CPU7 CPU8 CPU9 > > 418: 3893 201 181 188 0 0 0 0 0 0 gpg2 0 Edge 19100000.drmdecon > > > > Suggest formatting the commit message as follows, to make it more readable: > > 8<-------------------------------------------------------------------------->8 > To support affinity setting for non wake up external gpio interrupt, > add irq_set_affinity callback using irq number from pinctrl driver > data. > > Before this patch, changing the irq affinity of gpio interrupt is not > possible: > > # cat /proc/irq/418/smp_affinity > 3ff > # echo 00f > /proc/irq/418/smp_affinity > # cat /proc/irq/418/smp_affinity > 3ff > # cat /proc/interrupts > CPU0 CPU1 CPU2 CPU3 ... > 418: 3631 0 0 0 ... > > With this patch applied, it's possible to change irq affinity of gpio > interrupt: > > # cat /proc/irq/418/smp_affinity > 3ff > # echo 00f > /proc/irq/418/smp_affinity > # cat /proc/irq/418/smp_affinity > 00f > # cat /proc/interrupts > CPU0 CPU1 CPU2 CPU3 ... > 418: 3893 201 181 188 ... > 8<-------------------------------------------------------------------------->8 > Thanks for your suggestion. I'll modify it. > > Signed-off-by: Youngmin Nam <youngmin.nam@samsung.com> > > --- > > drivers/pinctrl/samsung/pinctrl-exynos.c | 14 ++++++++++++++ > > 1 file changed, 14 insertions(+) > > > > diff --git a/drivers/pinctrl/samsung/pinctrl-exynos.c b/drivers/pinctrl/samsung/pinctrl-exynos.c > > index 6b58ec84e34b..5d7b788282e9 100644 > > --- a/drivers/pinctrl/samsung/pinctrl-exynos.c > > +++ b/drivers/pinctrl/samsung/pinctrl-exynos.c > > @@ -147,6 +147,19 @@ static int exynos_irq_set_type(struct irq_data *irqd, unsigned int type) > > return 0; > > } > > > > +static int exynos_irq_set_affinity(struct irq_data *irqd, > > + const struct cpumask *dest, bool force) > > +{ > > + struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd); > > + struct samsung_pinctrl_drv_data *d = bank->drvdata; > > + struct irq_data *parent = irq_get_irq_data(d->irq); > > I'm probably missing something, but: why not just use "irqd" parameter > and avoid declaring "bank" and "d"? Is "d->irq" somehow different from > "irqd"? > Yes, irqd->irq is different from d->irq as below. [ 188.230707] irqd->irq is 417 [ 188.230837] d->irq is 133 We have to use d->irq(133) instead of irqd->irq(417) because d->irq has GICv3 as a IRQ chip. To use set_affinity() call back of GICv3, d->irq is needed. IRQ HWIRQ Type Affinity IRQ_DESC CPU0 CPU1 CPU2 CPU3 ... Chip Name 133 603 Level 0x3ff 0xffffff883b25d800 52260 0 0 0 ... GICv3 11030000.pinctrl 417 0 Edge 0xffffffff 0xffffff883b68a800 52259 0 0 0 ... gpg2 19100000.drmdecon erd9945: # cat /proc/interrupts | grep gpg2 417: 9250 48 45 45 ... gpg2 0 Edge 19100000.drmdecon erd9945: # cat /proc/interrupts | grep 11030000 133: 9250 48 45 45 ... GICv3 603 Level 11030000.pinctrl > > + > > + if (parent) > > + return parent->chip->irq_set_affinity(parent, dest, force); > > + > > Why not use irq_chip_set_affinity_parent() API? > > > + return -EINVAL; > > Maybe use something like this instead: > > if (!irqd->parent_data) > return -EINVAL; > > return irq_chip_set_affinity_parent(irqd, dest, force); > > Can you please test if this code works? > I tested as you suggested as below. diff --git a/drivers/pinctrl/samsung/pinctrl-exynos.c b/drivers/pinctrl/samsung/pinctrl-exynos.c index bf8dd5e3c3d2..593320b408ce 100644 --- a/drivers/pinctrl/samsung/pinctrl-exynos.c +++ b/drivers/pinctrl/samsung/pinctrl-exynos.c @@ -153,14 +153,12 @@ static int exynos_irq_set_type(struct irq_data *irqd, unsigned int type) static int exynos_irq_set_affinity(struct irq_data *irqd, const struct cpumask *dest, bool force) { - struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd); - struct samsung_pinctrl_drv_data *d = bank->drvdata; - struct irq_data *parent = irq_get_irq_data(d->irq); - - if (parent) - return parent->chip->irq_set_affinity(parent, dest, force); + if (!irqd->parent_data) { + pr_err("irqd->parent_data is null!!\n"); + return -EINVAL; + } - return -EINVAL; + return irq_chip_set_affinity_parent(irqd, dest, force); } [ 149.658395] irqd->parent_data is null!! Currently, irqd->paranet_data is null. > > +} > > + > > static int exynos_irq_request_resources(struct irq_data *irqd) > > { > > struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd); > > @@ -212,6 +225,7 @@ static const struct exynos_irq_chip exynos_gpio_irq_chip __initconst = { > > .irq_mask = exynos_irq_mask, > > .irq_ack = exynos_irq_ack, > > .irq_set_type = exynos_irq_set_type, > > + .irq_set_affinity = exynos_irq_set_affinity, > > What happens if we just assign irq_chip_set_affinity_parent() here? > Would it work, or Exynos case is more complicated than this? > Yes, I couldn't find how to use irq_chip_set_affinity_parent() directly yet. > > .irq_request_resources = exynos_irq_request_resources, > > .irq_release_resources = exynos_irq_release_resources, > > }, > > -- > > 2.39.2 > > >
On Thu, Nov 23, 2023 at 10:00 PM Youngmin Nam <youngmin.nam@samsung.com> wrote: > > On Tue, Nov 21, 2023 at 12:33:51PM -0600, Sam Protsenko wrote: > > On Sun, Nov 19, 2023 at 2:54 AM Youngmin Nam <youngmin.nam@samsung.com> wrote: > > > > > > To support affinity setting for non wake up external gpio interrupt, > > > we add a new irq_set_affinity callback using irq number which is in pinctrl > > > driver data. > > > > > > Before applying this patch, we couldn't change irq affinity of gpio interrupt. > > > * before > > > erd9945:/proc/irq/418 # cat smp_affinity > > > 3ff > > > erd9945:/proc/irq/418 # echo 00f > smp_affinity > > > erd9945:/proc/irq/418 # cat smp_affinity > > > 3ff > > > erd9945:/proc/irq/418 # cat /proc/interrupts > > > CPU0 CPU1 CPU2 CPU3 CPU4 CPU5 CPU6 CPU7 CPU8 CPU9 > > > 418: 3631 0 0 0 0 0 0 0 0 0 gpg2 0 Edge 19100000.drmdecon > > > > > > After applying this patch, we can change irq affinity of gpio interrupt as below. > > > * after > > > erd9945:/proc/irq/418 # cat smp_affinity > > > 3ff > > > erd9945:/proc/irq/418 # echo 00f > smp_affinity > > > erd9945:/proc/irq/418 # cat smp_affinity > > > 00f > > > erd9945:/proc/irq/418 # cat /proc/interrupts > > > CPU0 CPU1 CPU2 CPU3 CPU4 CPU5 CPU6 CPU7 CPU8 CPU9 > > > 418: 3893 201 181 188 0 0 0 0 0 0 gpg2 0 Edge 19100000.drmdecon > > > > > > > Suggest formatting the commit message as follows, to make it more readable: > > > > 8<-------------------------------------------------------------------------->8 > > To support affinity setting for non wake up external gpio interrupt, > > add irq_set_affinity callback using irq number from pinctrl driver > > data. > > > > Before this patch, changing the irq affinity of gpio interrupt is not > > possible: > > > > # cat /proc/irq/418/smp_affinity > > 3ff > > # echo 00f > /proc/irq/418/smp_affinity > > # cat /proc/irq/418/smp_affinity > > 3ff > > # cat /proc/interrupts > > CPU0 CPU1 CPU2 CPU3 ... > > 418: 3631 0 0 0 ... > > > > With this patch applied, it's possible to change irq affinity of gpio > > interrupt: > > > > # cat /proc/irq/418/smp_affinity > > 3ff > > # echo 00f > /proc/irq/418/smp_affinity > > # cat /proc/irq/418/smp_affinity > > 00f > > # cat /proc/interrupts > > CPU0 CPU1 CPU2 CPU3 ... > > 418: 3893 201 181 188 ... > > 8<-------------------------------------------------------------------------->8 > > > > Thanks for your suggestion. I'll modify it. > > > > Signed-off-by: Youngmin Nam <youngmin.nam@samsung.com> > > > --- > > > drivers/pinctrl/samsung/pinctrl-exynos.c | 14 ++++++++++++++ > > > 1 file changed, 14 insertions(+) > > > > > > diff --git a/drivers/pinctrl/samsung/pinctrl-exynos.c b/drivers/pinctrl/samsung/pinctrl-exynos.c > > > index 6b58ec84e34b..5d7b788282e9 100644 > > > --- a/drivers/pinctrl/samsung/pinctrl-exynos.c > > > +++ b/drivers/pinctrl/samsung/pinctrl-exynos.c > > > @@ -147,6 +147,19 @@ static int exynos_irq_set_type(struct irq_data *irqd, unsigned int type) > > > return 0; > > > } > > > > > > +static int exynos_irq_set_affinity(struct irq_data *irqd, > > > + const struct cpumask *dest, bool force) > > > +{ > > > + struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd); > > > + struct samsung_pinctrl_drv_data *d = bank->drvdata; > > > + struct irq_data *parent = irq_get_irq_data(d->irq); > > > > I'm probably missing something, but: why not just use "irqd" parameter > > and avoid declaring "bank" and "d"? Is "d->irq" somehow different from > > "irqd"? > > > > Yes, irqd->irq is different from d->irq as below. > > [ 188.230707] irqd->irq is 417 > [ 188.230837] d->irq is 133 > > We have to use d->irq(133) instead of irqd->irq(417) because d->irq has GICv3 as a IRQ chip. > To use set_affinity() call back of GICv3, d->irq is needed. > > IRQ HWIRQ Type Affinity IRQ_DESC CPU0 CPU1 CPU2 CPU3 ... Chip Name > 133 603 Level 0x3ff 0xffffff883b25d800 52260 0 0 0 ... GICv3 11030000.pinctrl > 417 0 Edge 0xffffffff 0xffffff883b68a800 52259 0 0 0 ... gpg2 19100000.drmdecon > > erd9945: # cat /proc/interrupts | grep gpg2 > 417: 9250 48 45 45 ... gpg2 0 Edge 19100000.drmdecon > > erd9945: # cat /proc/interrupts | grep 11030000 > 133: 9250 48 45 45 ... GICv3 603 Level 11030000.pinctrl > Thanks for the explanation! Apart from my suggestion for the commit message: Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org> > > > + > > > + if (parent) > > > + return parent->chip->irq_set_affinity(parent, dest, force); > > > + > > > > Why not use irq_chip_set_affinity_parent() API? > > > > > + return -EINVAL; > > > > Maybe use something like this instead: > > > > if (!irqd->parent_data) > > return -EINVAL; > > > > return irq_chip_set_affinity_parent(irqd, dest, force); > > > > Can you please test if this code works? > > > > I tested as you suggested as below. > > diff --git a/drivers/pinctrl/samsung/pinctrl-exynos.c b/drivers/pinctrl/samsung/pinctrl-exynos.c > index bf8dd5e3c3d2..593320b408ce 100644 > --- a/drivers/pinctrl/samsung/pinctrl-exynos.c > +++ b/drivers/pinctrl/samsung/pinctrl-exynos.c > @@ -153,14 +153,12 @@ static int exynos_irq_set_type(struct irq_data *irqd, unsigned int type) > static int exynos_irq_set_affinity(struct irq_data *irqd, > const struct cpumask *dest, bool force) > { > - struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd); > - struct samsung_pinctrl_drv_data *d = bank->drvdata; > - struct irq_data *parent = irq_get_irq_data(d->irq); > - > - if (parent) > - return parent->chip->irq_set_affinity(parent, dest, force); > + if (!irqd->parent_data) { > + pr_err("irqd->parent_data is null!!\n"); > + return -EINVAL; > + } > > - return -EINVAL; > + return irq_chip_set_affinity_parent(irqd, dest, force); > } > > [ 149.658395] irqd->parent_data is null!! > > Currently, irqd->paranet_data is null. > > > > +} > > > + > > > static int exynos_irq_request_resources(struct irq_data *irqd) > > > { > > > struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd); > > > @@ -212,6 +225,7 @@ static const struct exynos_irq_chip exynos_gpio_irq_chip __initconst = { > > > .irq_mask = exynos_irq_mask, > > > .irq_ack = exynos_irq_ack, > > > .irq_set_type = exynos_irq_set_type, > > > + .irq_set_affinity = exynos_irq_set_affinity, > > > > What happens if we just assign irq_chip_set_affinity_parent() here? > > Would it work, or Exynos case is more complicated than this? > > > > Yes, I couldn't find how to use irq_chip_set_affinity_parent() directly yet. > > > > .irq_request_resources = exynos_irq_request_resources, > > > .irq_release_resources = exynos_irq_release_resources, > > > }, > > > -- > > > 2.39.2 > > > > >
diff --git a/drivers/pinctrl/samsung/pinctrl-exynos.c b/drivers/pinctrl/samsung/pinctrl-exynos.c index 6b58ec84e34b..5d7b788282e9 100644 --- a/drivers/pinctrl/samsung/pinctrl-exynos.c +++ b/drivers/pinctrl/samsung/pinctrl-exynos.c @@ -147,6 +147,19 @@ static int exynos_irq_set_type(struct irq_data *irqd, unsigned int type) return 0; } +static int exynos_irq_set_affinity(struct irq_data *irqd, + const struct cpumask *dest, bool force) +{ + struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd); + struct samsung_pinctrl_drv_data *d = bank->drvdata; + struct irq_data *parent = irq_get_irq_data(d->irq); + + if (parent) + return parent->chip->irq_set_affinity(parent, dest, force); + + return -EINVAL; +} + static int exynos_irq_request_resources(struct irq_data *irqd) { struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd); @@ -212,6 +225,7 @@ static const struct exynos_irq_chip exynos_gpio_irq_chip __initconst = { .irq_mask = exynos_irq_mask, .irq_ack = exynos_irq_ack, .irq_set_type = exynos_irq_set_type, + .irq_set_affinity = exynos_irq_set_affinity, .irq_request_resources = exynos_irq_request_resources, .irq_release_resources = exynos_irq_release_resources, },