lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231119092909.3018578-1-youngmin.nam@samsung.com>
Date:   Sun, 19 Nov 2023 18:29:09 +0900
From:   Youngmin Nam <youngmin.nam@...sung.com>
To:     tomasz.figa@...il.com, krzysztof.kozlowski@...aro.org,
        s.nawrocki@...sung.com, alim.akhtar@...sung.com,
        linus.walleij@...aro.org
Cc:     linux-arm-kernel@...ts.infradead.org,
        linux-samsung-soc@...r.kernel.org, linux-gpio@...r.kernel.org,
        linux-kernel@...r.kernel.org, semen.protsenko@...aro.org,
        Youngmin Nam <youngmin.nam@...sung.com>
Subject: [PATCH] pinctrl: samsung: add irq_set_affinity() for non wake up
 external gpio interrupt

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@...sung.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);
+
+	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,
 	},
-- 
2.39.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ