* MRST only have IOAPIC, the PCI irq lines are 1:1 mapped to
         * IOAPIC RTE entries, so we just enable RTE for the device.
         */
+       if (mp_map_gsi_to_irq(dev->irq, IOAPIC_MAP_ALLOC) < 0)
+               return -EBUSY;
+
        irq_attr.ioapic = mp_find_ioapic(dev->irq);
        irq_attr.ioapic_pin = dev->irq;
        irq_attr.trigger = 1; /* level */
 
                                        /* PNW and CLV go with active low */
                                        irq_attr.polarity = 1;
                                }
+                               WARN_ON(mp_map_gsi_to_irq(irq,
+                                               IOAPIC_MAP_ALLOC) < 0);
                                io_apic_set_pci_routing(NULL, irq, &irq_attr);
                        }
                } else {
 
 #include <linux/init.h>
 #include <linux/sfi.h>
 #include <linux/io.h>
+#include <linux/irqdomain.h>
 
 #include <asm/io_apic.h>
 #include <asm/mpspec.h>
 #endif /* CONFIG_X86_LOCAL_APIC */
 
 #ifdef CONFIG_X86_IO_APIC
+static struct irq_domain_ops sfi_ioapic_irqdomain_ops;
 
 static int __init sfi_parse_ioapic(struct sfi_table_header *table)
 {
        struct sfi_table_simple *sb;
        struct sfi_apic_table_entry *pentry;
        int i, num;
+       struct ioapic_domain_cfg cfg = {
+               .type = IOAPIC_DOMAIN_STRICT,
+               .ops = &sfi_ioapic_irqdomain_ops,
+       };
 
        sb = (struct sfi_table_simple *)table;
        num = SFI_GET_NUM_ENTRIES(sb, struct sfi_apic_table_entry);
        pentry = (struct sfi_apic_table_entry *)sb->pentry;
 
        for (i = 0; i < num; i++) {
-               mp_register_ioapic(i, pentry->phys_addr, gsi_top, NULL);
+               mp_register_ioapic(i, pentry->phys_addr, gsi_top, &cfg);
                pentry++;
        }