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

x86/ioapic: Use irq_find_matching_fwspec() to find remapping irqdomain

All possible parent domains have a select method now. Make use of it.

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20201024213535.443185-29-dwmw2@infradead.org

authored by

David Woodhouse and committed by
Thomas Gleixner
b643128b c2a5881c

+13 -12
+13 -12
arch/x86/kernel/apic/io_apic.c
··· 2320 2320 2321 2321 static int mp_irqdomain_create(int ioapic) 2322 2322 { 2323 - struct irq_alloc_info info; 2324 2323 struct irq_domain *parent; 2325 2324 int hwirqs = mp_ioapic_pin_count(ioapic); 2326 2325 struct ioapic *ip = &ioapics[ioapic]; 2327 2326 struct ioapic_domain_cfg *cfg = &ip->irqdomain_cfg; 2328 2327 struct mp_ioapic_gsi *gsi_cfg = mp_ioapic_gsi_routing(ioapic); 2329 2328 struct fwnode_handle *fn; 2330 - char *name = "IO-APIC"; 2329 + struct irq_fwspec fwspec; 2331 2330 2332 2331 if (cfg->type == IOAPIC_DOMAIN_INVALID) 2333 2332 return 0; 2334 - 2335 - init_irq_alloc_info(&info, NULL); 2336 - info.type = X86_IRQ_ALLOC_TYPE_IOAPIC_GET_PARENT; 2337 - info.devid = mpc_ioapic_id(ioapic); 2338 - parent = irq_remapping_get_irq_domain(&info); 2339 - if (!parent) 2340 - parent = x86_vector_domain; 2341 - else 2342 - name = "IO-APIC-IR"; 2343 2333 2344 2334 /* Handle device tree enumerated APICs proper */ 2345 2335 if (cfg->dev) { 2346 2336 fn = of_node_to_fwnode(cfg->dev); 2347 2337 } else { 2348 - fn = irq_domain_alloc_named_id_fwnode(name, ioapic); 2338 + fn = irq_domain_alloc_named_id_fwnode("IO-APIC", ioapic); 2349 2339 if (!fn) 2350 2340 return -ENOMEM; 2341 + } 2342 + 2343 + fwspec.fwnode = fn; 2344 + fwspec.param_count = 1; 2345 + fwspec.param[0] = ioapic; 2346 + 2347 + parent = irq_find_matching_fwspec(&fwspec, DOMAIN_BUS_ANY); 2348 + if (!parent) { 2349 + if (!cfg->dev) 2350 + irq_domain_free_fwnode(fn); 2351 + return -ENODEV; 2351 2352 } 2352 2353 2353 2354 ip->irqdomain = irq_domain_create_linear(fn, hwirqs, cfg->ops,