summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSamuel Holland <samuel@sholland.org>2022-07-01 15:00:54 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-03-11 13:57:31 +0100
commitc775a5246151cd9f849be3a33681011b78365b35 (patch)
tree0d60fef0ab3f7a111d82b5f5d0233dd9b7f56764 /include
parent00340ccb5407e4c60fc339b16b5d975cbd04b540 (diff)
downloadlinux-c775a5246151cd9f849be3a33681011b78365b35.tar.gz
linux-c775a5246151cd9f849be3a33681011b78365b35.tar.bz2
linux-c775a5246151cd9f849be3a33681011b78365b35.zip
genirq: Add and use an irq_data_update_affinity helper
[ Upstream commit 073352e951f60946452da358d64841066c3142ff ] Some architectures and irqchip drivers modify the cpumask returned by irq_data_get_affinity_mask, usually by copying in to it. This is problematic for uniprocessor configurations, where the affinity mask should be constant, as it is known at compile time. Add and use a setter for the affinity mask, following the pattern of irq_data_update_effective_affinity. This allows the getter function to return a const cpumask pointer. Signed-off-by: Samuel Holland <samuel@sholland.org> Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com> # Xen bits Signed-off-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20220701200056.46555-7-samuel@sholland.org Stable-dep-of: feabecaff590 ("genirq/ipi: Fix NULL pointer deref in irq_data_get_affinity_mask()") Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/irq.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 5f8f0f24a280..f9e6449fbbba 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -880,6 +880,12 @@ static inline struct cpumask *irq_data_get_affinity_mask(struct irq_data *d)
return d->common->affinity;
}
+static inline void irq_data_update_affinity(struct irq_data *d,
+ const struct cpumask *m)
+{
+ cpumask_copy(d->common->affinity, m);
+}
+
static inline struct cpumask *irq_get_affinity_mask(int irq)
{
struct irq_data *d = irq_get_irq_data(irq);