aboutsummaryrefslogtreecommitdiff
path: root/sys/x86/xen
diff options
context:
space:
mode:
authorRoger Pau Monné <royger@FreeBSD.org>2018-09-13 07:14:11 +0000
committerRoger Pau Monné <royger@FreeBSD.org>2018-09-13 07:14:11 +0000
commita74cdf4e747667a8d7db4dcdc57cf97db822444d (patch)
tree3ec7ed612e3418f4cd03c186af1828911adea52d /sys/x86/xen
parentd7627401ecaa772ca6034eb64c8810369448e579 (diff)
downloadsrc-a74cdf4e747667a8d7db4dcdc57cf97db822444d.tar.gz
src-a74cdf4e747667a8d7db4dcdc57cf97db822444d.zip
xen: legacy PVH fixes for the new interrupt count
Register interrupts using the PIC pic_register_sources method instead of doing it in apic_setup_io. This is now required, since the internal interrupt structures are not yet setup when calling apic_setup_io. Approved by: re (gjb) Sponsored by: Citrix Systems R&D
Notes
Notes: svn path=/head/; revision=338631
Diffstat (limited to 'sys/x86/xen')
-rw-r--r--sys/x86/xen/pvcpu_enum.c93
-rw-r--r--sys/x86/xen/xen_intr.c3
2 files changed, 56 insertions, 40 deletions
diff --git a/sys/x86/xen/pvcpu_enum.c b/sys/x86/xen/pvcpu_enum.c
index b65f2bdb3a69..4c4bcec186bb 100644
--- a/sys/x86/xen/pvcpu_enum.c
+++ b/sys/x86/xen/pvcpu_enum.c
@@ -193,54 +193,67 @@ xenpv_setup_io(void)
{
if (xen_initial_domain()) {
- int i, ret;
-
- /* Map MADT */
- madt_physaddr = acpi_find_table(ACPI_SIG_MADT);
- madt = acpi_map_table(madt_physaddr, ACPI_SIG_MADT);
- madt_length = madt->Header.Length;
-
- /* Try to initialize ACPI so that we can access the FADT. */
- i = acpi_Startup();
- if (ACPI_FAILURE(i)) {
- printf("MADT: ACPI Startup failed with %s\n",
- AcpiFormatException(i));
- printf("Try disabling either ACPI or apic support.\n");
- panic("Using MADT but ACPI doesn't work");
- }
-
- /* Run through the table to see if there are any overrides. */
- madt_walk_table(madt_parse_ints, NULL);
-
/*
- * If there was not an explicit override entry for the SCI,
- * force it to use level trigger and active-low polarity.
+ * NB: we could iterate over the MADT IOAPIC entries in order
+ * to figure out the exact number of IOAPIC interrupts, but
+ * this is legacy code so just keep using the previous
+ * behaviour and assume a maximum of 256 interrupts.
*/
- if (!madt_found_sci_override) {
- printf(
- "MADT: Forcing active-low polarity and level trigger for SCI\n");
- ret = xen_register_pirq(AcpiGbl_FADT.SciInterrupt,
- INTR_TRIGGER_LEVEL, INTR_POLARITY_LOW);
- if (ret != 0)
- panic("Unable to register SCI IRQ");
- }
-
- /* Register legacy ISA IRQs */
- for (i = 1; i < 16; i++) {
- if (intr_lookup_source(i) != NULL)
- continue;
- ret = xen_register_pirq(i, INTR_TRIGGER_EDGE,
- INTR_POLARITY_LOW);
- if (ret != 0 && bootverbose)
- printf("Unable to register legacy IRQ#%d: %d\n",
- i, ret);
- }
+ num_io_irqs = max(MINIMUM_MSI_INT - 1, num_io_irqs);
acpi_SetDefaultIntrModel(ACPI_INTR_APIC);
}
return (0);
}
+void
+xenpv_register_pirqs(struct pic *pic __unused)
+{
+ unsigned int i;
+ int ret;
+
+ /* Map MADT */
+ madt_physaddr = acpi_find_table(ACPI_SIG_MADT);
+ madt = acpi_map_table(madt_physaddr, ACPI_SIG_MADT);
+ madt_length = madt->Header.Length;
+
+ /* Try to initialize ACPI so that we can access the FADT. */
+ ret = acpi_Startup();
+ if (ACPI_FAILURE(ret)) {
+ printf("MADT: ACPI Startup failed with %s\n",
+ AcpiFormatException(ret));
+ printf("Try disabling either ACPI or apic support.\n");
+ panic("Using MADT but ACPI doesn't work");
+ }
+
+ /* Run through the table to see if there are any overrides. */
+ madt_walk_table(madt_parse_ints, NULL);
+
+ /*
+ * If there was not an explicit override entry for the SCI,
+ * force it to use level trigger and active-low polarity.
+ */
+ if (!madt_found_sci_override) {
+ printf(
+"MADT: Forcing active-low polarity and level trigger for SCI\n");
+ ret = xen_register_pirq(AcpiGbl_FADT.SciInterrupt,
+ INTR_TRIGGER_LEVEL, INTR_POLARITY_LOW);
+ if (ret != 0)
+ panic("Unable to register SCI IRQ");
+ }
+
+ /* Register legacy ISA IRQs */
+ for (i = 1; i < 16; i++) {
+ if (intr_lookup_source(i) != NULL)
+ continue;
+ ret = xen_register_pirq(i, INTR_TRIGGER_EDGE,
+ INTR_POLARITY_LOW);
+ if (ret != 0 && bootverbose)
+ printf("Unable to register legacy IRQ#%u: %d\n", i,
+ ret);
+ }
+}
+
static void
xenpv_register(void *dummy __unused)
{
diff --git a/sys/x86/xen/xen_intr.c b/sys/x86/xen/xen_intr.c
index 59eeea2ad1fd..c1cb0707cde9 100644
--- a/sys/x86/xen/xen_intr.c
+++ b/sys/x86/xen/xen_intr.c
@@ -178,6 +178,9 @@ struct pic xen_intr_pic = {
* physical interrupt sources.
*/
struct pic xen_intr_pirq_pic = {
+#ifdef __amd64__
+ .pic_register_sources = xenpv_register_pirqs,
+#endif
.pic_enable_source = xen_intr_pirq_enable_source,
.pic_disable_source = xen_intr_pirq_disable_source,
.pic_eoi_source = xen_intr_pirq_eoi_source,