LinuxKPI: add irq_set_affinity_hint()

Add an implementation for irq_set_affinity_hint() to linux/interrupt.h
and include linux/hardirq.h for synchronize_irq() as needed by
wireless drivers.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D30427
This commit is contained in:
Bjoern A. Zeeb 2021-05-24 18:14:37 +00:00
parent b26fb63f2b
commit 602e4e433d

View File

@ -31,12 +31,15 @@
#ifndef _LINUX_INTERRUPT_H_ #ifndef _LINUX_INTERRUPT_H_
#define _LINUX_INTERRUPT_H_ #define _LINUX_INTERRUPT_H_
#include <linux/cpu.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/irqreturn.h> #include <linux/irqreturn.h>
#include <linux/hardirq.h>
#include <sys/bus.h> #include <sys/bus.h>
#include <sys/rman.h> #include <sys/rman.h>
#include <sys/interrupt.h>
typedef irqreturn_t (*irq_handler_t)(int, void *); typedef irqreturn_t (*irq_handler_t)(int, void *);
@ -183,6 +186,19 @@ free_irq(unsigned int irq, void *device)
kfree(irqe); kfree(irqe);
} }
static inline int
irq_set_affinity_hint(int vector, cpumask_t *mask)
{
int error;
if (mask != NULL)
error = intr_setaffinity(vector, CPU_WHICH_IRQ, mask);
else
error = intr_setaffinity(vector, CPU_WHICH_IRQ, cpuset_root);
return (-error);
}
/* /*
* LinuxKPI tasklet support * LinuxKPI tasklet support
*/ */