Axe MINIMUM_MSI_INT.

Just allow MSI interrupts to always start at the end of the I/O APIC
pins.  Since existing machines already have more than 255 I/O APIC
pins, IRQ 255 is no longer reliably invalid, so just remove the
minimum starting value for MSI.

Reviewed by:	kib, markj
Differential Revision:	https://reviews.freebsd.org/D17991
This commit is contained in:
jhb 2018-11-16 23:39:39 +00:00
parent 3cd0168095
commit 477f6a3a87
4 changed files with 9 additions and 11 deletions

View File

@ -51,15 +51,11 @@
* IRQ values returned by ACPI methods such as _CRS can be used * IRQ values returned by ACPI methods such as _CRS can be used
* directly by the ACPI bus driver. * directly by the ACPI bus driver.
* *
* MSI interrupts allocate a block of interrupts starting at either * MSI interrupts allocate a block of interrupts starting at the end
* the end of the I/O APIC range or 256, whichever is higher. When * of the I/O APIC range. When running under the Xen Hypervisor, an
* running under the Xen Hypervisor, an additional range of IRQ values * additional range of IRQ values are available for binding to event
* are available for binding to event channel events. We use 256 as * channel events.
* the minimum IRQ value for MSI interrupts to attempt to leave 255
* unused since 255 is used in PCI to indicate an invalid INTx IRQ.
*/ */
#define MINIMUM_MSI_INT 256
extern u_int first_msi_irq; extern u_int first_msi_irq;
extern u_int num_io_irqs; extern u_int num_io_irqs;
extern u_int num_msi_irqs; extern u_int num_msi_irqs;

View File

@ -153,6 +153,8 @@ struct pic msi_pic = {
}; };
u_int first_msi_irq; u_int first_msi_irq;
SYSCTL_UINT(_machdep, OID_AUTO, first_msi_irq, CTLFLAG_RD, &first_msi_irq, 0,
"Number of first IRQ reserved for MSI and MSI-X interrupts");
u_int num_msi_irqs = 512; u_int num_msi_irqs = 512;
SYSCTL_UINT(_machdep, OID_AUTO, num_msi_irqs, CTLFLAG_RDTUN, &num_msi_irqs, 0, SYSCTL_UINT(_machdep, OID_AUTO, num_msi_irqs, CTLFLAG_RDTUN, &num_msi_irqs, 0,
@ -339,7 +341,7 @@ msi_init(void)
if (num_msi_irqs == 0) if (num_msi_irqs == 0)
return; return;
first_msi_irq = max(MINIMUM_MSI_INT, num_io_irqs); first_msi_irq = num_io_irqs;
if (num_msi_irqs > UINT_MAX - first_msi_irq) if (num_msi_irqs > UINT_MAX - first_msi_irq)
panic("num_msi_irq too high"); panic("num_msi_irq too high");
num_io_irqs = first_msi_irq + num_msi_irqs; num_io_irqs = first_msi_irq + num_msi_irqs;

View File

@ -199,7 +199,7 @@ xenpv_setup_io(void)
* this is legacy code so just keep using the previous * this is legacy code so just keep using the previous
* behaviour and assume a maximum of 256 interrupts. * behaviour and assume a maximum of 256 interrupts.
*/ */
num_io_irqs = max(MINIMUM_MSI_INT - 1, num_io_irqs); num_io_irqs = max(255, num_io_irqs);
acpi_SetDefaultIntrModel(ACPI_INTR_APIC); acpi_SetDefaultIntrModel(ACPI_INTR_APIC);
} }

View File

@ -57,7 +57,7 @@ xen_msi_init(void)
{ {
MPASS(num_io_irqs > 0); MPASS(num_io_irqs > 0);
first_msi_irq = min(MINIMUM_MSI_INT, num_io_irqs); first_msi_irq = num_io_irqs;
if (num_msi_irqs > UINT_MAX - first_msi_irq) if (num_msi_irqs > UINT_MAX - first_msi_irq)
panic("num_msi_irq too high"); panic("num_msi_irq too high");
num_io_irqs = first_msi_irq + num_msi_irqs; num_io_irqs = first_msi_irq + num_msi_irqs;