summaryrefslogtreecommitdiffstats
path: root/sys/x86/include/apicvar.h
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2015-03-19 13:57:47 +0000
committerkib <kib@FreeBSD.org>2015-03-19 13:57:47 +0000
commitb178649de896674ad1d1de14d554fa49b29ec19b (patch)
treebc4c0aab833a1f9083c48f4140f80b20dc7747c1 /sys/x86/include/apicvar.h
parent0c72282747e49fc0753ced46a2a4cd43aea47717 (diff)
downloadFreeBSD-src-b178649de896674ad1d1de14d554fa49b29ec19b.zip
FreeBSD-src-b178649de896674ad1d1de14d554fa49b29ec19b.tar.gz
Use VT-d interrupt remapping block (IR) to perform FSB messages
translation. In particular, despite IO-APICs only take 8bit apic id, IR translation structures accept 32bit APIC Id, which allows x2APIC mode to function properly. Extend msi_cpu of struct msi_intrsrc and io_cpu of ioapic_intsrc to full int from one byte. KPI of IR is isolated into the x86/iommu/iommu_intrmap.h, to avoid bringing all dmar headers into interrupt code. The non-PCI(e) devices which generate message interrupts on FSB require special handling. The HPET FSB interrupts are remapped, while DMAR interrupts are not. For each msi and ioapic interrupt source, the iommu cookie is added, which is in fact index of the IRE (interrupt remap entry) in the IR table. Cookie is made at the source allocation time, and then used at the map time to fill both IRE and device registers. The MSI address/data registers and IO-APIC redirection registers are programmed with the special values which are recognized by IR and used to restore the IRE index, to find proper delivery mode and target. Map all MSI interrupts in the block when msi_map() is called. Since an interrupt source setup and dismantle code are done in the non-sleepable context, flushing interrupt entries cache in the IR hardware, which is done async and ideally waits for the interrupt, requires busy-wait for queue to drain. The dmar_qi_wait_for_seq() is modified to take a boolean argument requesting busy-wait for the written sequence number instead of waiting for interrupt. Some interrupts are configured before IR is initialized, e.g. ACPI SCI. Add intr_reprogram() function to reprogram all already configured interrupts, and call it immediately before an IR unit is enabled. There is still a small window after the IO-APIC redirection entry is reprogrammed with cookie but before the unit is enabled, but to fix this properly, IR must be started much earlier. Add workarounds for 5500 and X58 northbridges, some revisions of which have severe flaws in handling IR. Use the same identification methods as employed by Linux. Review: https://reviews.freebsd.org/D1892 Reviewed by: neel Discussed with: jhb Tested by: glebius, pho (previous versions) Sponsored by: The FreeBSD Foundation MFC after: 3 weeks
Diffstat (limited to 'sys/x86/include/apicvar.h')
-rw-r--r--sys/x86/include/apicvar.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/sys/x86/include/apicvar.h b/sys/x86/include/apicvar.h
index 0ed65de..818a831 100644
--- a/sys/x86/include/apicvar.h
+++ b/sys/x86/include/apicvar.h
@@ -155,6 +155,11 @@
#define APIC_BUS_PCI 2
#define APIC_BUS_MAX APIC_BUS_PCI
+#define IRQ_EXTINT (NUM_IO_INTS + 1)
+#define IRQ_NMI (NUM_IO_INTS + 2)
+#define IRQ_SMI (NUM_IO_INTS + 3)
+#define IRQ_DISABLED (NUM_IO_INTS + 4)
+
/*
* An APIC enumerator is a psuedo bus driver that enumerates APIC's including
* CPU's and I/O APIC's.
OpenPOWER on IntegriCloud