Message ID | 1603800624-180488-2-git-send-email-john.garry@huawei.com |
---|---|
State | Superseded |
Headers | show |
Series | Support managed interrupts for platform devices | expand |
John, On Tue, Oct 27 2020 at 20:10, John Garry wrote: > From: Thomas Gleixner <tglx@linutronix.de> > > Add a function to allow the affinity of an interrupt be switched to > managed, such that interrupts allocated for platform devices may be > managed. > > <Insert author sob> > > [jpg: Add commit message and add prototypes] > Signed-off-by: John Garry <john.garry@huawei.com> > --- > Thomas, I just made you author since you provided the original code, hope > it's ok. I already forgot about this. And in fact I only gave you a broken example. So just make yourself the author and add Suggested-by: tglx. Vs. merging. I'd like to pick that up myself as I might have other changes in that area coming up. I'll do it as a single commit on top of rc1 and tag it so the scsi people can just pull it in. Thanks, tglx
Hi Thomas, >> From: Thomas Gleixner <tglx@linutronix.de> >> >> Add a function to allow the affinity of an interrupt be switched to >> managed, such that interrupts allocated for platform devices may be >> managed. >> >> <Insert author sob> >> >> [jpg: Add commit message and add prototypes] >> Signed-off-by: John Garry <john.garry@huawei.com> >> --- >> Thomas, I just made you author since you provided the original code, hope >> it's ok. > > I already forgot about this. We needed some changes to go in to make the block CPU hotplug handling usable for some scsi drivers, which took a while. > And in fact I only gave you a broken > example. So just make yourself the author and add Suggested-by: tglx. > ok, will repost with that, cheers > Vs. merging. I'd like to pick that up myself as I might have other > changes in that area coming up. > > I'll do it as a single commit on top of rc1 and tag it so the scsi > people can just pull it in. I guess it's ok, I will defer to the maintainers on that. Thanks, John
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index ee8299eb1f52..870b3251e174 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h @@ -352,6 +352,8 @@ extern int irq_can_set_affinity(unsigned int irq); extern int irq_select_affinity(unsigned int irq); extern int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m); +extern int irq_update_affinity_desc(unsigned int irq, + struct irq_affinity_desc *affinity); extern int irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify); @@ -387,6 +389,12 @@ static inline int irq_set_affinity_hint(unsigned int irq, return -EINVAL; } +static inline int irq_update_affinity_desc(unsigned int irq, + struct irq_affinity_desc *affinity) +{ + return -EINVAL; +} + static inline int irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify) { diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index c460e0496006..b96af4cde4bc 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c @@ -371,6 +371,25 @@ int irq_set_affinity_locked(struct irq_data *data, const struct cpumask *mask, return ret; } +int irq_update_affinity_desc(unsigned int irq, + struct irq_affinity_desc *affinity) +{ + unsigned long flags; + struct irq_desc *desc = irq_get_desc_lock(irq, &flags, 0); + + if (!desc) + return -EINVAL; + + if (affinity->is_managed) { + irqd_set(&desc->irq_data, IRQD_AFFINITY_MANAGED); + irqd_set(&desc->irq_data, IRQD_MANAGED_SHUTDOWN); + } + + cpumask_copy(desc->irq_common_data.affinity, &affinity->mask); + irq_put_desc_unlock(desc, flags); + return 0; +} + int __irq_set_affinity(unsigned int irq, const struct cpumask *mask, bool force) { struct irq_desc *desc = irq_to_desc(irq);