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

irq_domain/x86: Convert x86 (embedded) to use common irq_domain

This patch removes the x86-specific definition of irq_domain and replaces
it with the common implementation.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Rob Herring <rob.herring@calxeda.com>
Cc: Thomas Gleixner <tglx@linutronix.de>

+34 -95
+2
arch/x86/Kconfig
··· 398 398 select X86_REBOOTFIXUPS 399 399 select OF 400 400 select OF_EARLY_FLATTREE 401 + select IRQ_DOMAIN 401 402 ---help--- 402 403 Select for the Intel CE media processor (CE4100) SOC. 403 404 This option compiles in support for the CE4100 SOC for settop ··· 2077 2076 select GPIOLIB 2078 2077 select OF 2079 2078 select OF_PROMTREE 2079 + select IRQ_DOMAIN 2080 2080 ---help--- 2081 2081 Add support for detecting the unique features of the OLPC 2082 2082 XO hardware.
-12
arch/x86/include/asm/irq_controller.h
··· 1 - #ifndef __IRQ_CONTROLLER__ 2 - #define __IRQ_CONTROLLER__ 3 - 4 - struct irq_domain { 5 - int (*xlate)(struct irq_domain *h, const u32 *intspec, u32 intsize, 6 - u32 *out_hwirq, u32 *out_type); 7 - void *priv; 8 - struct device_node *controller; 9 - struct list_head l; 10 - }; 11 - 12 - #endif
-10
arch/x86/include/asm/prom.h
··· 21 21 #include <asm/irq.h> 22 22 #include <linux/atomic.h> 23 23 #include <asm/setup.h> 24 - #include <asm/irq_controller.h> 25 24 26 25 #ifdef CONFIG_OF 27 26 extern int of_ioapic; ··· 41 42 42 43 #define pci_address_to_pio pci_address_to_pio 43 44 unsigned long pci_address_to_pio(phys_addr_t addr); 44 - 45 - /** 46 - * irq_dispose_mapping - Unmap an interrupt 47 - * @virq: linux virq number of the interrupt to unmap 48 - * 49 - * FIXME: We really should implement proper virq handling like power, 50 - * but that's going to be major surgery. 51 - */ 52 - static inline void irq_dispose_mapping(unsigned int virq) { } 53 45 54 46 #define HAVE_ARCH_DEVTREE_FIXUPS 55 47
+30 -71
arch/x86/kernel/devicetree.c
··· 4 4 #include <linux/bootmem.h> 5 5 #include <linux/export.h> 6 6 #include <linux/io.h> 7 + #include <linux/irqdomain.h> 7 8 #include <linux/interrupt.h> 8 9 #include <linux/list.h> 9 10 #include <linux/of.h> ··· 18 17 #include <linux/initrd.h> 19 18 20 19 #include <asm/hpet.h> 21 - #include <asm/irq_controller.h> 22 20 #include <asm/apic.h> 23 21 #include <asm/pci_x86.h> 24 22 25 23 __initdata u64 initial_dtb; 26 24 char __initdata cmd_line[COMMAND_LINE_SIZE]; 27 - static LIST_HEAD(irq_domains); 28 - static DEFINE_RAW_SPINLOCK(big_irq_lock); 29 25 30 26 int __initdata of_ioapic; 31 - 32 - #ifdef CONFIG_X86_IO_APIC 33 - static void add_interrupt_host(struct irq_domain *ih) 34 - { 35 - unsigned long flags; 36 - 37 - raw_spin_lock_irqsave(&big_irq_lock, flags); 38 - list_add(&ih->l, &irq_domains); 39 - raw_spin_unlock_irqrestore(&big_irq_lock, flags); 40 - } 41 - #endif 42 - 43 - static struct irq_domain *get_ih_from_node(struct device_node *controller) 44 - { 45 - struct irq_domain *ih, *found = NULL; 46 - unsigned long flags; 47 - 48 - raw_spin_lock_irqsave(&big_irq_lock, flags); 49 - list_for_each_entry(ih, &irq_domains, l) { 50 - if (ih->controller == controller) { 51 - found = ih; 52 - break; 53 - } 54 - } 55 - raw_spin_unlock_irqrestore(&big_irq_lock, flags); 56 - return found; 57 - } 58 - 59 - unsigned int irq_create_of_mapping(struct device_node *controller, 60 - const u32 *intspec, unsigned int intsize) 61 - { 62 - struct irq_domain *ih; 63 - u32 virq, type; 64 - int ret; 65 - 66 - ih = get_ih_from_node(controller); 67 - if (!ih) 68 - return 0; 69 - ret = ih->xlate(ih, intspec, intsize, &virq, &type); 70 - if (ret) 71 - return 0; 72 - if (type == IRQ_TYPE_NONE) 73 - return virq; 74 - irq_set_irq_type(virq, type); 75 - return virq; 76 - } 77 - EXPORT_SYMBOL_GPL(irq_create_of_mapping); 78 27 79 28 unsigned long pci_address_to_pio(phys_addr_t address) 80 29 { ··· 305 354 }, 306 355 }; 307 356 308 - static int ioapic_xlate(struct irq_domain *id, const u32 *intspec, u32 intsize, 309 - u32 *out_hwirq, u32 *out_type) 357 + static int ioapic_xlate(struct irq_domain *domain, 358 + struct device_node *controller, 359 + const u32 *intspec, u32 intsize, 360 + irq_hw_number_t *out_hwirq, u32 *out_type) 310 361 { 311 - struct mp_ioapic_gsi *gsi_cfg; 312 362 struct io_apic_irq_attr attr; 313 363 struct of_ioapic_type *it; 314 - u32 line, idx, type; 364 + u32 line, idx; 365 + int rc; 315 366 316 - if (intsize < 2) 367 + if (WARN_ON(intsize < 2)) 317 368 return -EINVAL; 318 369 319 - line = *intspec; 320 - idx = (u32) id->priv; 321 - gsi_cfg = mp_ioapic_gsi_routing(idx); 322 - *out_hwirq = line + gsi_cfg->gsi_base; 370 + line = intspec[0]; 323 371 324 - intspec++; 325 - type = *intspec; 326 - 327 - if (type >= ARRAY_SIZE(of_ioapic_type)) 372 + if (intspec[1] >= ARRAY_SIZE(of_ioapic_type)) 328 373 return -EINVAL; 329 374 330 - it = of_ioapic_type + type; 331 - *out_type = it->out_type; 375 + it = &of_ioapic_type[intspec[1]]; 332 376 377 + idx = (u32) domain->host_data; 333 378 set_io_apic_irq_attr(&attr, idx, line, it->trigger, it->polarity); 334 379 335 - return io_apic_setup_irq_pin_once(*out_hwirq, cpu_to_node(0), &attr); 380 + rc = io_apic_setup_irq_pin_once(irq_find_mapping(domain, line), 381 + cpu_to_node(0), &attr); 382 + if (rc) 383 + return rc; 384 + 385 + *out_hwirq = line; 386 + *out_type = it->out_type; 387 + return 0; 336 388 } 389 + 390 + const struct irq_domain_ops ioapic_irq_domain_ops = { 391 + .xlate = ioapic_xlate, 392 + }; 337 393 338 394 static void __init ioapic_add_ofnode(struct device_node *np) 339 395 { ··· 357 399 for (i = 0; i < nr_ioapics; i++) { 358 400 if (r.start == mpc_ioapic_addr(i)) { 359 401 struct irq_domain *id; 402 + struct mp_ioapic_gsi *gsi_cfg; 360 403 361 - id = kzalloc(sizeof(*id), GFP_KERNEL); 404 + gsi_cfg = mp_ioapic_gsi_routing(i); 405 + 406 + id = irq_domain_add_legacy(np, 32, gsi_cfg->gsi_base, 0, 407 + &ioapic_irq_domain_ops, 408 + (void*)i); 362 409 BUG_ON(!id); 363 - id->controller = np; 364 - id->xlate = ioapic_xlate; 365 - id->priv = (void *)i; 366 - add_interrupt_host(id); 367 410 return; 368 411 } 369 412 }
+2 -2
drivers/net/phy/mdio-gpio.c
··· 255 255 return platform_driver_register(&mdio_ofgpio_driver); 256 256 } 257 257 258 - static inline void __exit mdio_ofgpio_exit(void) 258 + static inline void mdio_ofgpio_exit(void) 259 259 { 260 260 platform_driver_unregister(&mdio_ofgpio_driver); 261 261 } 262 262 #else 263 263 static inline int __init mdio_ofgpio_init(void) { return 0; } 264 - static inline void __exit mdio_ofgpio_exit(void) { } 264 + static inline void mdio_ofgpio_exit(void) { } 265 265 #endif /* CONFIG_OF_GPIO */ 266 266 267 267 static struct platform_driver mdio_gpio_driver = {