Changeset View
Changeset View
Standalone View
Standalone View
head/sys/x86/x86/msi.c
Show All 40 Lines | |||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/bus.h> | #include <sys/bus.h> | ||||
#include <sys/kernel.h> | #include <sys/kernel.h> | ||||
#include <sys/lock.h> | #include <sys/lock.h> | ||||
#include <sys/malloc.h> | #include <sys/malloc.h> | ||||
#include <sys/mutex.h> | #include <sys/mutex.h> | ||||
#include <sys/sx.h> | #include <sys/sx.h> | ||||
#include <sys/sysctl.h> | |||||
#include <sys/systm.h> | #include <sys/systm.h> | ||||
#include <x86/apicreg.h> | #include <x86/apicreg.h> | ||||
#include <machine/cputypes.h> | #include <machine/cputypes.h> | ||||
#include <machine/md_var.h> | #include <machine/md_var.h> | ||||
#include <machine/frame.h> | #include <machine/frame.h> | ||||
#include <machine/intr_machdep.h> | #include <machine/intr_machdep.h> | ||||
#include <x86/apicvar.h> | #include <x86/apicvar.h> | ||||
#include <x86/iommu/iommu_intrmap.h> | #include <x86/iommu/iommu_intrmap.h> | ||||
▲ Show 20 Lines • Show All 86 Lines • ▼ Show 20 Lines | struct pic msi_pic = { | ||||
.pic_source_pending = msi_source_pending, | .pic_source_pending = msi_source_pending, | ||||
.pic_suspend = NULL, | .pic_suspend = NULL, | ||||
.pic_resume = NULL, | .pic_resume = NULL, | ||||
.pic_config_intr = msi_config_intr, | .pic_config_intr = msi_config_intr, | ||||
.pic_assign_cpu = msi_assign_cpu, | .pic_assign_cpu = msi_assign_cpu, | ||||
.pic_reprogram_pin = NULL, | .pic_reprogram_pin = NULL, | ||||
}; | }; | ||||
/* | |||||
* Xen hypervisors prior to 4.6.0 do not properly handle updates to | |||||
* enabled MSI-X table entries. Allow migration of MSI-X interrupts | |||||
* to be disabled via a tunable. | |||||
*/ | |||||
static int msix_disable_migration = 0; | |||||
SYSCTL_INT(_machdep, OID_AUTO, disable_msix_migration, CTLFLAG_RDTUN, | |||||
&msix_disable_migration, 0, | |||||
"Disable migration of MSI-X interrupts between CPUs"); | |||||
static int msi_enabled; | static int msi_enabled; | ||||
static int msi_last_irq; | static int msi_last_irq; | ||||
static struct mtx msi_lock; | static struct mtx msi_lock; | ||||
static void | static void | ||||
msi_enable_source(struct intsrc *isrc) | msi_enable_source(struct intsrc *isrc) | ||||
{ | { | ||||
} | } | ||||
▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | msi_assign_cpu(struct intsrc *isrc, u_int apic_id) | ||||
u_int old_id; | u_int old_id; | ||||
int i, vector; | int i, vector; | ||||
/* | /* | ||||
* Only allow CPUs to be assigned to the first message for an | * Only allow CPUs to be assigned to the first message for an | ||||
* MSI group. | * MSI group. | ||||
*/ | */ | ||||
if (msi->msi_first != msi) | if (msi->msi_first != msi) | ||||
return (EINVAL); | |||||
if (msix_disable_migration && msi->msi_msix) | |||||
return (EINVAL); | return (EINVAL); | ||||
/* Store information to free existing irq. */ | /* Store information to free existing irq. */ | ||||
old_vector = msi->msi_vector; | old_vector = msi->msi_vector; | ||||
old_id = msi->msi_cpu; | old_id = msi->msi_cpu; | ||||
if (old_id == apic_id) | if (old_id == apic_id) | ||||
return (0); | return (0); | ||||
▲ Show 20 Lines • Show All 467 Lines • Show Last 20 Lines |