Lines Matching full:ioapic
107 static struct ioapic { struct
142 static inline int mp_ioapic_pin_count(int ioapic) in mp_ioapic_pin_count() argument
144 struct mp_ioapic_gsi *gsi_cfg = mp_ioapic_gsi_routing(ioapic); in mp_ioapic_pin_count()
149 static inline u32 mp_pin_to_gsi(int ioapic, int pin) in mp_pin_to_gsi() argument
151 return mp_ioapic_gsi_routing(ioapic)->gsi_base + pin; in mp_pin_to_gsi()
159 static inline struct irq_domain *mp_ioapic_irqdomain(int ioapic) in mp_ioapic_irqdomain() argument
161 return ioapics[ioapic].irqdomain; in mp_ioapic_irqdomain()
184 * disable_ioapic_support() - disables ioapic support at runtime
233 pr_err("IOAPIC %d: suspend/resume impossible!\n", idx); in alloc_ioapic_saved_registers()
660 * Restore IO APIC entries which was saved in the ioapic structure.
754 pr_warn("IOAPIC: Invalid polarity: 2, defaulting to low\n"); in irq_active_low()
792 pr_warn("IOAPIC: Invalid srcbus: %d defaulting to level\n", bus); in eisa_irq_is_level()
822 pr_warn("IOAPIC: Invalid trigger mode 2 defaulting to level\n"); in irq_is_level()
832 int ioapic, pin, idx; in __acpi_get_override_irq() local
837 ioapic = mp_find_ioapic(gsi); in __acpi_get_override_irq()
838 if (ioapic < 0) in __acpi_get_override_irq()
841 pin = mp_find_ioapic_pin(ioapic, gsi); in __acpi_get_override_irq()
845 idx = find_irq_entry(ioapic, pin, mp_INT); in __acpi_get_override_irq()
868 info->ioapic.node = node; in ioapic_set_alloc_attr()
869 info->ioapic.is_level = trigger; in ioapic_set_alloc_attr()
870 info->ioapic.active_low = polarity; in ioapic_set_alloc_attr()
871 info->ioapic.valid = 1; in ioapic_set_alloc_attr()
883 dst->ioapic.pin = pin; in ioapic_copy_alloc_attr()
884 dst->ioapic.valid = 1; in ioapic_copy_alloc_attr()
885 if (src && src->ioapic.valid) { in ioapic_copy_alloc_attr()
886 dst->ioapic.node = src->ioapic.node; in ioapic_copy_alloc_attr()
887 dst->ioapic.is_level = src->ioapic.is_level; in ioapic_copy_alloc_attr()
888 dst->ioapic.active_low = src->ioapic.active_low; in ioapic_copy_alloc_attr()
890 dst->ioapic.node = NUMA_NO_NODE; in ioapic_copy_alloc_attr()
892 dst->ioapic.is_level = level; in ioapic_copy_alloc_attr()
893 dst->ioapic.active_low = pol_low; in ioapic_copy_alloc_attr()
899 dst->ioapic.is_level = true; in ioapic_copy_alloc_attr()
900 dst->ioapic.active_low = true; in ioapic_copy_alloc_attr()
907 return (info && info->ioapic.valid) ? info->ioapic.node : NUMA_NO_NODE; in ioapic_alloc_attr_node()
937 if (info->ioapic.is_level != data->is_level) in mp_check_pin_attr()
938 mp_register_handler(irq, info->ioapic.is_level); in mp_check_pin_attr()
939 data->entry.is_level = data->is_level = info->ioapic.is_level; in mp_check_pin_attr()
940 data->entry.active_low = data->active_low = info->ioapic.active_low; in mp_check_pin_attr()
943 return data->is_level == info->ioapic.is_level && in mp_check_pin_attr()
944 data->active_low == info->ioapic.active_low; in mp_check_pin_attr()
947 static int alloc_irq_from_domain(struct irq_domain *domain, int ioapic, u32 gsi, in alloc_irq_from_domain() argument
952 int type = ioapics[ioapic].irqdomain_cfg.type; in alloc_irq_from_domain()
970 WARN(1, "ioapic: unknown irqdomain type %d\n", type); in alloc_irq_from_domain()
980 * Need special handling for ISA IRQs because there may be multiple IOAPIC pins
982 * between IOAPIC pin and IRQ number. A typical IOAPIC has 24 pins, pin 0-15 are
990 int irq, int ioapic, int pin, in alloc_isa_irq_from_domain() argument
999 * the pin list associated with this IRQ and program the IOAPIC in alloc_isa_irq_from_domain()
1005 if (__add_pin_to_irq_node(irq_data->chip_data, node, ioapic, in alloc_isa_irq_from_domain()
1006 info->ioapic.pin)) in alloc_isa_irq_from_domain()
1022 static int mp_map_pin_to_irq(u32 gsi, int idx, int ioapic, int pin, in mp_map_pin_to_irq() argument
1029 struct irq_domain *domain = mp_ioapic_irqdomain(ioapic); in mp_map_pin_to_irq()
1057 ioapic_copy_alloc_attr(&tmp, info, gsi, ioapic, pin); in mp_map_pin_to_irq()
1060 ioapic, pin, &tmp); in mp_map_pin_to_irq()
1062 irq = alloc_irq_from_domain(domain, ioapic, gsi, &tmp); in mp_map_pin_to_irq()
1075 static int pin_2_irq(int idx, int ioapic, int pin, unsigned int flags) in pin_2_irq() argument
1077 u32 gsi = mp_pin_to_gsi(ioapic, pin); in pin_2_irq()
1105 return mp_map_pin_to_irq(gsi, idx, ioapic, pin, flags, NULL); in pin_2_irq()
1110 int ioapic, pin, idx; in mp_map_gsi_to_irq() local
1112 ioapic = mp_find_ioapic(gsi); in mp_map_gsi_to_irq()
1113 if (ioapic < 0) in mp_map_gsi_to_irq()
1116 pin = mp_find_ioapic_pin(ioapic, gsi); in mp_map_gsi_to_irq()
1117 idx = find_irq_entry(ioapic, pin, mp_INT); in mp_map_gsi_to_irq()
1121 return mp_map_pin_to_irq(gsi, idx, ioapic, pin, flags, info); in mp_map_gsi_to_irq()
1209 unsigned int ioapic, pin; in setup_IO_APIC_irqs() local
1214 for_each_ioapic_pin(ioapic, pin) { in setup_IO_APIC_irqs()
1215 idx = find_irq_entry(ioapic, pin, mp_INT); in setup_IO_APIC_irqs()
1219 mpc_ioapic_id(ioapic), pin); in setup_IO_APIC_irqs()
1221 pin_2_irq(idx, ioapic, pin, in setup_IO_APIC_irqs()
1222 ioapic ? 0 : IOAPIC_MAP_ALLOC); in setup_IO_APIC_irqs()
1237 printk(KERN_DEBUG "IOAPIC %d:\n", apic); in io_apic_print_entries()
1391 /* If we could not find the appropriate pin by looking at the ioapic in enable_IO_APIC()
1392 * the i8259 probably is not connected the ioapic but give the in enable_IO_APIC()
1419 * If the i8259 is routed through an IOAPIC in native_restore_boot_irq_mode()
1420 * Put that IOAPIC in virtual wire mode in native_restore_boot_irq_mode()
1477 * Set the IOAPIC ID to the value stored in the MPC table. in setup_ioapic_ids_from_mpc_nocheck()
1656 * In the SMP+IOAPIC case it might happen that there are an unspecified
1742 * of the ioapic. This has two effects. in ioapic_finish_move()
1743 * - On any sane system the read of the ioapic will in ioapic_finish_move()
1744 * flush writes (and acks) going to the ioapic from in ioapic_finish_move()
1749 * ioapic entry from outside of irq context starting in ioapic_finish_move()
1750 * with masking the ioapic entry and then polling until in ioapic_finish_move()
1752 * ioapic I don't trust the Remote IRR bit to be in ioapic_finish_move()
1883 * - DMAR/IR: 8bit subhandle (ioapic.pin) in ioapic_setup_msg_from_msi()
1934 * Interrupt shutdown masks the ioapic pin, but the interrupt might already
2137 static int mp_alloc_timer_irq(int ioapic, int pin) in mp_alloc_timer_irq() argument
2140 struct irq_domain *domain = mp_ioapic_irqdomain(ioapic); in mp_alloc_timer_irq()
2146 info.devid = mpc_ioapic_id(ioapic); in mp_alloc_timer_irq()
2147 info.ioapic.pin = pin; in mp_alloc_timer_irq()
2149 irq = alloc_isa_irq_from_domain(domain, 0, ioapic, pin, &info); in mp_alloc_timer_irq()
2222 /* Ok, does IRQ0 through the IOAPIC work? */ in check_timer()
2331 static int mp_irqdomain_create(int ioapic) in mp_irqdomain_create() argument
2334 int hwirqs = mp_ioapic_pin_count(ioapic); in mp_irqdomain_create()
2335 struct ioapic *ip = &ioapics[ioapic]; in mp_irqdomain_create()
2337 struct mp_ioapic_gsi *gsi_cfg = mp_ioapic_gsi_routing(ioapic); in mp_irqdomain_create()
2348 fn = irq_domain_alloc_named_id_fwnode("IO-APIC", mpc_ioapic_id(ioapic)); in mp_irqdomain_create()
2355 fwspec.param[0] = mpc_ioapic_id(ioapic); in mp_irqdomain_create()
2365 (void *)(long)ioapic); in mp_irqdomain_create()
2396 int ioapic; in setup_IO_APIC() local
2404 for_each_ioapic(ioapic) in setup_IO_APIC()
2405 BUG_ON(mp_irqdomain_create(ioapic)); in setup_IO_APIC()
2459 static int io_apic_get_redir_entries(int ioapic) in io_apic_get_redir_entries() argument
2465 reg_01.raw = io_apic_read(ioapic, 1); in io_apic_get_redir_entries()
2495 static int io_apic_get_unique_id(int ioapic, int apic_id) in io_apic_get_unique_id() argument
2508 * TBD: Expand LAPIC/IOAPIC support on P4-class systems to take full in io_apic_get_unique_id()
2516 reg_00.raw = io_apic_read(ioapic, 0); in io_apic_get_unique_id()
2520 printk(KERN_WARNING "IOAPIC[%d]: Invalid apic_id %d, trying " in io_apic_get_unique_id()
2521 "%d\n", ioapic, apic_id, reg_00.bits.ID); in io_apic_get_unique_id()
2539 printk(KERN_WARNING "IOAPIC[%d]: apic_id %d already used, " in io_apic_get_unique_id()
2540 "trying %d\n", ioapic, apic_id, i); in io_apic_get_unique_id()
2552 io_apic_write(ioapic, 0, reg_00.raw); in io_apic_get_unique_id()
2553 reg_00.raw = io_apic_read(ioapic, 0); in io_apic_get_unique_id()
2558 pr_err("IOAPIC[%d]: Unable to change apic_id!\n", in io_apic_get_unique_id()
2559 ioapic); in io_apic_get_unique_id()
2565 "IOAPIC[%d]: Assigned apic_id %d\n", ioapic, apic_id); in io_apic_get_unique_id()
2596 * Read the current id from the ioapic and keep it if in io_apic_unique_id()
2605 "IOAPIC[%d]: Using reg apic_id %d instead of %d\n", in io_apic_unique_id()
2611 * Get the next free id and write it to the ioapic. in io_apic_unique_id()
2626 static int io_apic_get_version(int ioapic) in io_apic_get_version() argument
2632 reg_01.raw = io_apic_read(ioapic, 1); in io_apic_get_version()
2639 * This function updates target affinity of IOAPIC interrupts to include
2669 snprintf(mem, IOAPIC_RESOURCE_NAME_SIZE, "IOAPIC %u", i); in ioapic_setup_resources()
2730 apic_printk(APIC_VERBOSE, "mapped IOAPIC to %08lx (%08lx)\n", in io_apic_init_mappings()
2766 /* Find the IOAPIC that manages this GSI. */ in mp_find_ioapic()
2773 printk(KERN_ERR "ERROR: Unable to locate IOAPIC for GSI %d\n", gsi); in mp_find_ioapic()
2777 int mp_find_ioapic_pin(int ioapic, u32 gsi) in mp_find_ioapic_pin() argument
2781 if (WARN_ON(ioapic < 0)) in mp_find_ioapic_pin()
2784 gsi_cfg = mp_ioapic_gsi_routing(ioapic); in mp_find_ioapic_pin()
2822 * mp_register_ioapic - Register an IOAPIC device
2823 * @id: hardware IOAPIC ID
2824 * @address: physical address of IOAPIC register area
2825 * @gsi_base: base of GSI associated with the IOAPIC
2826 * @cfg: configuration information for the IOAPIC
2833 int idx, ioapic, entries; in mp_register_ioapic() local
2840 for_each_ioapic(ioapic) in mp_register_ioapic()
2841 if (ioapics[ioapic].mp_config.apicaddr == address) { in mp_register_ioapic()
2842 pr_warn("address 0x%x conflicts with IOAPIC%d\n", in mp_register_ioapic()
2843 address, ioapic); in mp_register_ioapic()
2869 * and to prevent reprogramming of IOAPIC pins (PCI GSIs). in mp_register_ioapic()
2873 for_each_ioapic(ioapic) { in mp_register_ioapic()
2874 gsi_cfg = mp_ioapic_gsi_routing(ioapic); in mp_register_ioapic()
2879 pr_warn("GSI range [%u-%u] for new IOAPIC conflicts with GSI[%u-%u]\n", in mp_register_ioapic()
2914 pr_info("IOAPIC[%d]: apic_id %d, version %d, address 0x%x, GSI %d-%d\n", in mp_register_ioapic()
2924 int ioapic, pin; in mp_unregister_ioapic() local
2927 for_each_ioapic(ioapic) in mp_unregister_ioapic()
2928 if (ioapics[ioapic].gsi_config.gsi_base == gsi_base) { in mp_unregister_ioapic()
2933 pr_warn("can't find IOAPIC for GSI %d\n", gsi_base); in mp_unregister_ioapic()
2937 for_each_pin(ioapic, pin) { in mp_unregister_ioapic()
2938 u32 gsi = mp_pin_to_gsi(ioapic, pin); in mp_unregister_ioapic()
2945 pr_warn("pin%d on IOAPIC%d is still in use.\n", in mp_unregister_ioapic()
2946 pin, ioapic); in mp_unregister_ioapic()
2953 ioapics[ioapic].nr_registers = 0; in mp_unregister_ioapic()
2954 ioapic_destroy_irqdomain(ioapic); in mp_unregister_ioapic()
2955 free_ioapic_saved_registers(ioapic); in mp_unregister_ioapic()
2956 if (ioapics[ioapic].iomem_res) in mp_unregister_ioapic()
2957 release_resource(ioapics[ioapic].iomem_res); in mp_unregister_ioapic()
2958 clear_fixmap(FIX_IO_APIC_BASE_0 + ioapic); in mp_unregister_ioapic()
2959 memset(&ioapics[ioapic], 0, sizeof(ioapics[ioapic])); in mp_unregister_ioapic()
2966 int ioapic; in mp_ioapic_registered() local
2968 for_each_ioapic(ioapic) in mp_ioapic_registered()
2969 if (ioapics[ioapic].gsi_config.gsi_base == gsi_base) in mp_ioapic_registered()
2978 if (info && info->ioapic.valid) { in mp_irqdomain_get_attr()
2979 data->is_level = info->ioapic.is_level; in mp_irqdomain_get_attr()
2980 data->active_low = info->ioapic.active_low; in mp_irqdomain_get_attr()
3021 int ret, ioapic, pin; in mp_irqdomain_alloc() local
3030 ioapic = mp_irqdomain_ioapic_idx(domain); in mp_irqdomain_alloc()
3031 pin = info->ioapic.pin; in mp_irqdomain_alloc()
3046 irq_data->hwirq = info->ioapic.pin; in mp_irqdomain_alloc()
3050 mp_irqdomain_get_attr(mp_pin_to_gsi(ioapic, pin), data, info); in mp_irqdomain_alloc()
3052 add_pin_to_irq_node(data, ioapic_alloc_attr_node(info), ioapic, pin); in mp_irqdomain_alloc()
3063 "IOAPIC[%d]: Preconfigured routing entry (%d-%d -> IRQ %d Level:%i ActiveLow:%i)\n", in mp_irqdomain_alloc()
3064 ioapic, mpc_ioapic_id(ioapic), pin, virq, in mp_irqdomain_alloc()
3101 /* It won't be called for IRQ with multiple IOAPIC pins associated */ in mp_irqdomain_deactivate()