Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Jiang Liu and committed by
Thomas Gleixner
1b5d3e00 74501edc

+12 -1
+3
arch/x86/pci/intel_mid_pci.c
··· 217 217 * MRST only have IOAPIC, the PCI irq lines are 1:1 mapped to 218 218 * IOAPIC RTE entries, so we just enable RTE for the device. 219 219 */ 220 + if (mp_map_gsi_to_irq(dev->irq, IOAPIC_MAP_ALLOC) < 0) 221 + return -EBUSY; 222 + 220 223 irq_attr.ioapic = mp_find_ioapic(dev->irq); 221 224 irq_attr.ioapic_pin = dev->irq; 222 225 irq_attr.trigger = 1; /* level */
+2
arch/x86/platform/intel-mid/sfi.c
··· 473 473 /* PNW and CLV go with active low */ 474 474 irq_attr.polarity = 1; 475 475 } 476 + WARN_ON(mp_map_gsi_to_irq(irq, 477 + IOAPIC_MAP_ALLOC) < 0); 476 478 io_apic_set_pci_routing(NULL, irq, &irq_attr); 477 479 } 478 480 } else {
+7 -1
arch/x86/platform/sfi/sfi.c
··· 25 25 #include <linux/init.h> 26 26 #include <linux/sfi.h> 27 27 #include <linux/io.h> 28 + #include <linux/irqdomain.h> 28 29 29 30 #include <asm/io_apic.h> 30 31 #include <asm/mpspec.h> ··· 71 70 #endif /* CONFIG_X86_LOCAL_APIC */ 72 71 73 72 #ifdef CONFIG_X86_IO_APIC 73 + static struct irq_domain_ops sfi_ioapic_irqdomain_ops; 74 74 75 75 static int __init sfi_parse_ioapic(struct sfi_table_header *table) 76 76 { 77 77 struct sfi_table_simple *sb; 78 78 struct sfi_apic_table_entry *pentry; 79 79 int i, num; 80 + struct ioapic_domain_cfg cfg = { 81 + .type = IOAPIC_DOMAIN_STRICT, 82 + .ops = &sfi_ioapic_irqdomain_ops, 83 + }; 80 84 81 85 sb = (struct sfi_table_simple *)table; 82 86 num = SFI_GET_NUM_ENTRIES(sb, struct sfi_apic_table_entry); 83 87 pentry = (struct sfi_apic_table_entry *)sb->pentry; 84 88 85 89 for (i = 0; i < num; i++) { 86 - mp_register_ioapic(i, pentry->phys_addr, gsi_top, NULL); 90 + mp_register_ioapic(i, pentry->phys_addr, gsi_top, &cfg); 87 91 pentry++; 88 92 } 89 93