From 3fc3c2e4c5a39579ceaadad4fbc62518c5e95771 Mon Sep 17 00:00:00 2001 From: by Date: Fri, 3 Apr 2026 19:05:36 +0200 Subject: [PATCH 1/2] mfd: rp1: fix IRQ thread affinity on PREEMPT_RT rp1_irq_set_affinity() delegates to msi_domain_set_affinity() but does not call irq_data_update_effective_affinity() and does not return IRQ_SET_MASK_OK_DONE. Without this, the generic IRQ core never calls irq_set_thread_affinity(), so on PREEMPT_RT the force-threaded handler remains pinned to its original CPU even though the hardware interrupt is steered correctly. This causes PPS timestamps to be captured on a non-isolated CPU, adding variable latency to precision timing applications. Fix by updating the effective affinity and returning IRQ_SET_MASK_OK_DONE on success. Fixes: https://github.com/raspberrypi/linux/issues/7301 Signed-off-by: Michael Byczkowski --- drivers/mfd/rp1.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/mfd/rp1.c b/drivers/mfd/rp1.c index 0f85981da8e5ef..5de7270b12c738 100644 --- a/drivers/mfd/rp1.c +++ b/drivers/mfd/rp1.c @@ -145,8 +145,14 @@ static int rp1_irq_set_affinity(struct irq_data *irqd, const struct cpumask *des { struct rp1_dev *rp1 = irqd->domain->host_data; struct irq_data *pcie_irqd = rp1->pcie_irqds[irqd->hwirq]; + int ret; - return msi_domain_set_affinity(pcie_irqd, dest, force); + ret = msi_domain_set_affinity(pcie_irqd, dest, force); + if (ret >= 0) { + irq_data_update_effective_affinity(irqd, dest); + return IRQ_SET_MASK_OK_DONE; + } + return ret; } static struct irq_chip rp1_irq_chip = { From 9d128f965bd53f9874af9ca8fb3cda4c1ffee62c Mon Sep 17 00:00:00 2001 From: by Date: Fri, 3 Apr 2026 20:43:41 +0200 Subject: [PATCH 2/2] pinctrl: rp1: fix GPIO IRQ thread affinity on PREEMPT_RT rp1_gpio_irq_set_affinity() delegates to the parent chip but does not call irq_data_update_effective_affinity() and does not return IRQ_SET_MASK_OK_DONE. This causes the same PREEMPT_RT thread affinity problem as in the MFD layer, at the pinctrl level of the interrupt hierarchy. Fix by updating the effective affinity and returning IRQ_SET_MASK_OK_DONE on success. Fixes: https://github.com/raspberrypi/linux/issues/7301 Signed-off-by: Michael Byczkowski --- drivers/pinctrl/pinctrl-rp1.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/pinctrl-rp1.c b/drivers/pinctrl/pinctrl-rp1.c index 158cea41d9b943..22720e8a3aa830 100644 --- a/drivers/pinctrl/pinctrl-rp1.c +++ b/drivers/pinctrl/pinctrl-rp1.c @@ -958,8 +958,15 @@ static int rp1_gpio_irq_set_affinity(struct irq_data *data, const struct cpumask } } - if (parent_data && parent_data->chip->irq_set_affinity) - return parent_data->chip->irq_set_affinity(parent_data, dest, force); + if (parent_data && parent_data->chip->irq_set_affinity) { + int ret = parent_data->chip->irq_set_affinity(parent_data, dest, force); + + if (ret >= 0) { + irq_data_update_effective_affinity(data, dest); + return IRQ_SET_MASK_OK_DONE; + } + return ret; + } return -EINVAL; }