freebsd-skq/sys/x86/include
John Baldwin fd036deac1 Dynamically allocate IRQ ranges on x86.
Previously, x86 used static ranges of IRQ values for different types
of I/O interrupts.  Interrupt pins on I/O APICs and 8259A PICs used
IRQ values from 0 to 254.  MSI interrupts used a compile-time-defined
range starting at 256, and Xen event channels used a
compile-time-defined range after MSI.  Some recent systems have more
than 255 I/O APIC interrupt pins which resulted in those IRQ values
overflowing into the MSI range triggering an assertion failure.

Replace statically assigned ranges with dynamic ranges.  Do a single
pass computing the sizes of the IRQ ranges (PICs, MSI, Xen) to
determine the total number of IRQs required.  Allocate the interrupt
source and interrupt count arrays dynamically once this pass has
completed.  To minimize runtime complexity these arrays are only sized
once during bootup.  The PIC range is determined by the PICs present
in the system.  The MSI and Xen ranges continue to use a fixed size,
though this does make it possible to turn the MSI range size into a
tunable in the future.

As a result, various places are updated to use dynamic limits instead
of constants.  In addition, the vmstat(8) utility has been taught to
understand that some kernels may treat 'intrcnt' and 'intrnames' as
pointers rather than arrays when extracting interrupt stats from a
crashdump.  This is determined by the presence (vs absence) of a
global 'nintrcnt' symbol.

This change reverts r189404 which worked around a buggy BIOS which
enumerated an I/O APIC twice (using the same memory mapped address for
both entries but using an IRQ base of 256 for one entry and a valid
IRQ base for the second entry).  Making the "base" of MSI IRQ values
dynamic avoids the panic that r189404 worked around, and there may now
be valid I/O APICs with an IRQ base above 256 which this workaround
would incorrectly skip.

If in the future the issue reported in PR 130483 reoccurs, we will
have to add a pass over the I/O APIC entries in the MADT to detect
duplicates using the memory mapped address and use some strategy to
choose the "correct" one.

While here, reserve room in intrcnts for the Hyper-V counters.

PR:		229429, 130483
Reviewed by:	kib, royger, cem
Tested by:	royger (Xen), kib (DMAR)
Approved by:	re (gjb)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D16861
2018-08-28 21:09:19 +00:00
..
xen
_align.h spdx: initial adoption of licensing ID tags. 2017-11-18 14:26:50 +00:00
_inttypes.h sys/x86: further adoption of SPDX licensing ID tags. 2017-11-27 15:11:47 +00:00
_limits.h sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
_stdint.h sys/x86: further adoption of SPDX licensing ID tags. 2017-11-27 15:11:47 +00:00
_types.h Do not include float interfaces when using libsa. 2018-02-23 04:04:25 +00:00
acpica_machdep.h sys/x86: further adoption of SPDX licensing ID tags. 2017-11-27 15:11:47 +00:00
apicreg.h sys/x86: further adoption of SPDX licensing ID tags. 2017-11-27 15:11:47 +00:00
apicvar.h Dynamically allocate IRQ ranges on x86. 2018-08-28 21:09:19 +00:00
apm_bios.h
bus_dma.h Clean up MD pollution of bus_dma.h: 2017-07-01 05:35:29 +00:00
bus.h amd64: Add a 48-bit MAXADDR constant 2018-01-13 17:55:22 +00:00
busdma_impl.h Add support for NUMA domains to bus dma tags. This causes all memory 2018-01-12 23:34:16 +00:00
cputypes.h
dump.h
elf.h sys/x86: further adoption of SPDX licensing ID tags. 2017-11-27 15:11:47 +00:00
endian.h sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
fdt.h sys/x86: further adoption of SPDX licensing ID tags. 2017-11-27 15:11:47 +00:00
float.h sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
fpu.h Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
frame.h sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
ifunc.h Add helper macros to hide some boring repeatable ceremonies to define 2018-05-03 21:45:59 +00:00
init.h x86: improve reservation of AP trampoline memory 2018-04-05 14:39:51 +00:00
intr_machdep.h Dynamically allocate IRQ ranges on x86. 2018-08-28 21:09:19 +00:00
legacyvar.h sys/x86: further adoption of SPDX licensing ID tags. 2017-11-27 15:11:47 +00:00
mca.h sys/x86: further adoption of SPDX licensing ID tags. 2017-11-27 15:11:47 +00:00
metadata.h
mptable.h sys/x86: further adoption of SPDX licensing ID tags. 2017-11-27 15:11:47 +00:00
ofw_machdep.h sys/x86: further adoption of SPDX licensing ID tags. 2017-11-27 15:11:47 +00:00
pci_cfgreg.h sys/x86: further adoption of SPDX licensing ID tags. 2017-11-27 15:11:47 +00:00
psl.h sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
ptrace.h sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
pvclock.h
reg.h Cleanups related to debug exceptions on x86. 2018-05-22 00:45:00 +00:00
segments.h sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
setjmp.h sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
sigframe.h sys/x86: further adoption of SPDX licensing ID tags. 2017-11-27 15:11:47 +00:00
signal.h Remove very old and unused signal information codes. 2018-03-27 20:57:51 +00:00
specialreg.h Add definitions related to the L1D flush operation capability and MSR. 2018-08-14 17:19:11 +00:00
stack.h
stdarg.h Introduce an architecture-agnostic <sys/_stdarg.h> to reduce 2017-12-25 20:54:00 +00:00
sysarch.h sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
trap.h Remove very old and unused signal information codes. 2018-03-27 20:57:51 +00:00
ucode.h Implement kernel support for early loading of Intel microcode updates. 2018-08-13 17:13:09 +00:00
ucontext.h Fix a typo. 2018-03-19 17:14:56 +00:00
vdso.h sys/x86: further adoption of SPDX licensing ID tags. 2017-11-27 15:11:47 +00:00
vmware.h
x86_smp.h x86: improve reservation of AP trampoline memory 2018-04-05 14:39:51 +00:00
x86_var.h Provide a helper function acpi_get_fadt_bootflags() to fetch the FADT 2018-06-25 11:01:12 +00:00