aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/realtek/patches-5.15/316-otto-gpio-uniprocessor-irq-mask.patch
diff options
context:
space:
mode:
authorINAGAKI Hiroshi <musashino.open@gmail.com>2022-09-09 22:08:16 +0900
committerSander Vanheule <sander@svanheule.net>2022-12-15 20:52:09 +0100
commit8fb15ea52a02b0578c11897afd1a87f8502d8f52 (patch)
treea65ae72710e84420cad6e500a2b781abce0cd9a0 /target/linux/realtek/patches-5.15/316-otto-gpio-uniprocessor-irq-mask.patch
parentfef55d5ffd31bd6e0d157df784f47fe8ce0f1494 (diff)
downloadupstream-8fb15ea52a02b0578c11897afd1a87f8502d8f52.tar.gz
upstream-8fb15ea52a02b0578c11897afd1a87f8502d8f52.tar.bz2
upstream-8fb15ea52a02b0578c11897afd1a87f8502d8f52.zip
realtek: copy dts/files/patches/configs for 5.15
Copy dts/files/patches/configs from 5.10 to 5.15. Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com> [refresh with updated DGS-1210 dts files] Signed-off-by: Sander Vanheule <sander@svanheule.net>
Diffstat (limited to 'target/linux/realtek/patches-5.15/316-otto-gpio-uniprocessor-irq-mask.patch')
-rw-r--r--target/linux/realtek/patches-5.15/316-otto-gpio-uniprocessor-irq-mask.patch51
1 files changed, 51 insertions, 0 deletions
diff --git a/target/linux/realtek/patches-5.15/316-otto-gpio-uniprocessor-irq-mask.patch b/target/linux/realtek/patches-5.15/316-otto-gpio-uniprocessor-irq-mask.patch
new file mode 100644
index 0000000000..3980875dd4
--- /dev/null
+++ b/target/linux/realtek/patches-5.15/316-otto-gpio-uniprocessor-irq-mask.patch
@@ -0,0 +1,51 @@
+From bde6311569ef25a00c3beaeabfd6b78b19651872 Mon Sep 17 00:00:00 2001
+From: Sander Vanheule <sander@svanheule.net>
+Date: Sun, 29 May 2022 19:38:09 +0200
+Subject: [PATCH] realtek: don't unmask non-maskable GPIO IRQs
+
+On uniprocessor builds, for_each_cpu(cpu, mask) will assume 'mask'
+always contains exactly one CPU, and ignore the actual mask contents.
+This causes the loop to run, even when it shouldn't on an empty mask,
+and tries to access an uninitialised pointer.
+
+Fix this by wrapping the loop in a cpumask_empty() check, to ensure it
+will not run on uniprocessor builds if the CPU mask is empty.
+
+Fixes: af6cd37f42f3 ("realtek: replace RTL93xx GPIO patches")
+Reported-by: INAGAKI Hiroshi <musashino.open@gmail.com>
+Reported-by: Robert Marko <robimarko@gmail.com>
+Tested-by: Robert Marko <robimarko@gmail.com>
+Submitted-by: Sander Vanheule <sander@svanheule.net>
+---
+ drivers/gpio/gpio-realtek-otto.c | 9 +++++++++++--
+ 1 file changed, 11 insertions(+), 2 deletions(-)
+
+--- a/drivers/gpio/gpio-realtek-otto.c
++++ b/drivers/gpio/gpio-realtek-otto.c
+@@ -304,6 +304,7 @@ static int realtek_gpio_irq_set_affinity
+ static int realtek_gpio_irq_init(struct gpio_chip *gc)
+ {
+ struct realtek_gpio_ctrl *ctrl = gpiochip_get_data(gc);
++ void __iomem *irq_cpu_mask;
+ unsigned int port;
+ int cpu;
+
+@@ -311,8 +312,16 @@ static int realtek_gpio_irq_init(struct
+ realtek_gpio_write_imr(ctrl, port, 0, 0);
+ realtek_gpio_clear_isr(ctrl, port, GENMASK(7, 0));
+
+- for_each_cpu(cpu, &ctrl->cpu_irq_maskable)
+- iowrite8(GENMASK(7, 0), realtek_gpio_irq_cpu_mask(ctrl, port, cpu));
++ /*
++ * Uniprocessor builds assume a mask always contains one CPU,
++ * so only start the loop if we have at least one maskable CPU.
++ */
++ if(!cpumask_empty(&ctrl->cpu_irq_maskable)) {
++ for_each_cpu(cpu, &ctrl->cpu_irq_maskable) {
++ irq_cpu_mask = realtek_gpio_irq_cpu_mask(ctrl, port, cpu);
++ iowrite8(GENMASK(7, 0), irq_cpu_mask);
++ }
++ }
+ }
+
+ return 0;