浏览代码

x86, SFI, irq: Provide basic irqdomain support

Enhance SFI to provide basic support of irqdomain with identity mapping
between GSIs and IRQs.

Some Intel MID platforms assumes identity mapping between GSI and IRQ,
so we can't dynamically allocate IRQ number on demand.

Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: H. Peter Anvin <hpa@linux.intel.com>
Cc: sfi-devel@simplefirmware.org
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Grant Likely <grant.likely@linaro.org>
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Len Brown <lenb@kernel.org>
Cc: David Cohen <david.a.cohen@linux.intel.com>
Cc: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Link: http://lkml.kernel.org/r/1402302011-23642-28-git-send-email-jiang.liu@linux.intel.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Jiang Liu 11 年之前
父节点
当前提交
1b5d3e00d4
共有 3 个文件被更改,包括 12 次插入1 次删除
  1. 3 0
      arch/x86/pci/intel_mid_pci.c
  2. 2 0
      arch/x86/platform/intel-mid/sfi.c
  3. 7 1
      arch/x86/platform/sfi/sfi.c

+ 3 - 0
arch/x86/pci/intel_mid_pci.c

@@ -217,6 +217,9 @@ static int intel_mid_pci_irq_enable(struct pci_dev *dev)
 	 * MRST only have IOAPIC, the PCI irq lines are 1:1 mapped to
 	 * MRST only have IOAPIC, the PCI irq lines are 1:1 mapped to
 	 * IOAPIC RTE entries, so we just enable RTE for the device.
 	 * 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 = mp_find_ioapic(dev->irq);
 	irq_attr.ioapic_pin = dev->irq;
 	irq_attr.ioapic_pin = dev->irq;
 	irq_attr.trigger = 1; /* level */
 	irq_attr.trigger = 1; /* level */

+ 2 - 0
arch/x86/platform/intel-mid/sfi.c

@@ -473,6 +473,8 @@ static int __init sfi_parse_devs(struct sfi_table_header *table)
 					/* PNW and CLV go with active low */
 					/* PNW and CLV go with active low */
 					irq_attr.polarity = 1;
 					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);
 				io_apic_set_pci_routing(NULL, irq, &irq_attr);
 			}
 			}
 		} else {
 		} else {

+ 7 - 1
arch/x86/platform/sfi/sfi.c

@@ -25,6 +25,7 @@
 #include <linux/init.h>
 #include <linux/init.h>
 #include <linux/sfi.h>
 #include <linux/sfi.h>
 #include <linux/io.h>
 #include <linux/io.h>
+#include <linux/irqdomain.h>
 
 
 #include <asm/io_apic.h>
 #include <asm/io_apic.h>
 #include <asm/mpspec.h>
 #include <asm/mpspec.h>
@@ -70,19 +71,24 @@ static int __init sfi_parse_cpus(struct sfi_table_header *table)
 #endif /* CONFIG_X86_LOCAL_APIC */
 #endif /* CONFIG_X86_LOCAL_APIC */
 
 
 #ifdef CONFIG_X86_IO_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)
 static int __init sfi_parse_ioapic(struct sfi_table_header *table)
 {
 {
 	struct sfi_table_simple *sb;
 	struct sfi_table_simple *sb;
 	struct sfi_apic_table_entry *pentry;
 	struct sfi_apic_table_entry *pentry;
 	int i, num;
 	int i, num;
+	struct ioapic_domain_cfg cfg = {
+		.type = IOAPIC_DOMAIN_STRICT,
+		.ops = &sfi_ioapic_irqdomain_ops,
+	};
 
 
 	sb = (struct sfi_table_simple *)table;
 	sb = (struct sfi_table_simple *)table;
 	num = SFI_GET_NUM_ENTRIES(sb, struct sfi_apic_table_entry);
 	num = SFI_GET_NUM_ENTRIES(sb, struct sfi_apic_table_entry);
 	pentry = (struct sfi_apic_table_entry *)sb->pentry;
 	pentry = (struct sfi_apic_table_entry *)sb->pentry;
 
 
 	for (i = 0; i < num; i++) {
 	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++;
 		pentry++;
 	}
 	}