aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>2007-07-17 08:21:48 -0400
committerTony Luck <tony.luck@intel.com>2007-07-17 12:50:44 -0400
commiteb21ab24955ee025434ad09cd8e5e1a74c798777 (patch)
treeef50e56b1bde28d6f9fffb7319ffcf49484cdc11
parentc1726d6f1ad2f1d83e5db1e0142756e9255a82b3 (diff)
[IA64] Use dynamic irq for iosapic interrupts
Use create_irq()/destroy_irq() for iosapic interrupts. Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com> Signed-off-by: Tony Luck <tony.luck@intel.com>
-rw-r--r--arch/ia64/kernel/iosapic.c39
1 files changed, 15 insertions, 24 deletions
diff --git a/arch/ia64/kernel/iosapic.c b/arch/ia64/kernel/iosapic.c
index 29fea0a8c2c6..4c531953e2e1 100644
--- a/arch/ia64/kernel/iosapic.c
+++ b/arch/ia64/kernel/iosapic.c
@@ -533,12 +533,13 @@ static int iosapic_find_sharable_vector (unsigned long trigger,
533static void __init 533static void __init
534iosapic_reassign_vector (int vector) 534iosapic_reassign_vector (int vector)
535{ 535{
536 int new_vector; 536 int irq, new_vector;
537 537
538 if (!list_empty(&iosapic_intr_info[vector].rtes)) { 538 if (!list_empty(&iosapic_intr_info[vector].rtes)) {
539 new_vector = assign_irq_vector(AUTO_ASSIGN); 539 irq = create_irq();
540 if (new_vector < 0) 540 if (irq < 0)
541 panic("%s: out of interrupt vectors!\n", __FUNCTION__); 541 panic("%s: out of interrupt vectors!\n", __FUNCTION__);
542 new_vector = irq_to_vector(irq);
542 printk(KERN_INFO "Reassigning vector %d to %d\n", 543 printk(KERN_INFO "Reassigning vector %d to %d\n",
543 vector, new_vector); 544 vector, new_vector);
544 memcpy(&iosapic_intr_info[new_vector], &iosapic_intr_info[vector], 545 memcpy(&iosapic_intr_info[new_vector], &iosapic_intr_info[vector],
@@ -753,7 +754,7 @@ int
753iosapic_register_intr (unsigned int gsi, 754iosapic_register_intr (unsigned int gsi,
754 unsigned long polarity, unsigned long trigger) 755 unsigned long polarity, unsigned long trigger)
755{ 756{
756 int vector, mask = 1, err; 757 int irq, vector, mask = 1, err;
757 unsigned int dest; 758 unsigned int dest;
758 unsigned long flags; 759 unsigned long flags;
759 struct iosapic_rte_info *rte; 760 struct iosapic_rte_info *rte;
@@ -773,12 +774,13 @@ iosapic_register_intr (unsigned int gsi,
773 } 774 }
774 775
775 /* If vector is running out, we try to find a sharable vector */ 776 /* If vector is running out, we try to find a sharable vector */
776 vector = assign_irq_vector(AUTO_ASSIGN); 777 irq = create_irq();
777 if (vector < 0) { 778 if (irq < 0) {
778 vector = iosapic_find_sharable_vector(trigger, polarity); 779 vector = iosapic_find_sharable_vector(trigger, polarity);
779 if (vector < 0) 780 if (vector < 0)
780 goto unlock_iosapic_lock; 781 goto unlock_iosapic_lock;
781 } 782 } else
783 vector = irq_to_vector(irq);
782 784
783 spin_lock(&irq_desc[vector].lock); 785 spin_lock(&irq_desc[vector].lock);
784 dest = get_target_cpu(gsi, vector); 786 dest = get_target_cpu(gsi, vector);
@@ -873,30 +875,18 @@ iosapic_unregister_intr (unsigned int gsi)
873 if (list_empty(&iosapic_intr_info[vector].rtes)) { 875 if (list_empty(&iosapic_intr_info[vector].rtes)) {
874 /* Sanity check */ 876 /* Sanity check */
875 BUG_ON(iosapic_intr_info[vector].count); 877 BUG_ON(iosapic_intr_info[vector].count);
876
877 /* Clear the interrupt controller descriptor */
878 idesc->chip = &no_irq_type;
879
880#ifdef CONFIG_SMP 878#ifdef CONFIG_SMP
881 /* Clear affinity */ 879 /* Clear affinity */
882 cpus_setall(idesc->affinity); 880 cpus_setall(idesc->affinity);
883#endif 881#endif
884
885 /* Clear the interrupt information */ 882 /* Clear the interrupt information */
886 memset(&iosapic_intr_info[vector], 0, 883 memset(&iosapic_intr_info[vector], 0,
887 sizeof(struct iosapic_intr_info)); 884 sizeof(struct iosapic_intr_info));
888 iosapic_intr_info[vector].low32 |= IOSAPIC_MASK; 885 iosapic_intr_info[vector].low32 |= IOSAPIC_MASK;
889 INIT_LIST_HEAD(&iosapic_intr_info[vector].rtes); 886 INIT_LIST_HEAD(&iosapic_intr_info[vector].rtes);
890 887
891 if (idesc->action) { 888 /* Destroy IRQ */
892 printk(KERN_ERR 889 destroy_irq(irq);
893 "interrupt handlers still exist on IRQ %u\n",
894 irq);
895 WARN_ON(1);
896 }
897
898 /* Free the interrupt vector */
899 free_irq_vector(vector);
900 } 890 }
901 out: 891 out:
902 spin_unlock_irqrestore(&iosapic_lock, flags); 892 spin_unlock_irqrestore(&iosapic_lock, flags);
@@ -912,7 +902,7 @@ iosapic_register_platform_intr (u32 int_type, unsigned int gsi,
912{ 902{
913 static const char * const name[] = {"unknown", "PMI", "INIT", "CPEI"}; 903 static const char * const name[] = {"unknown", "PMI", "INIT", "CPEI"};
914 unsigned char delivery; 904 unsigned char delivery;
915 int vector, mask = 0; 905 int irq, vector, mask = 0;
916 unsigned int dest = ((id << 8) | eid) & 0xffff; 906 unsigned int dest = ((id << 8) | eid) & 0xffff;
917 907
918 switch (int_type) { 908 switch (int_type) {
@@ -926,9 +916,10 @@ iosapic_register_platform_intr (u32 int_type, unsigned int gsi,
926 delivery = IOSAPIC_PMI; 916 delivery = IOSAPIC_PMI;
927 break; 917 break;
928 case ACPI_INTERRUPT_INIT: 918 case ACPI_INTERRUPT_INIT:
929 vector = assign_irq_vector(AUTO_ASSIGN); 919 irq = create_irq();
930 if (vector < 0) 920 if (irq < 0)
931 panic("%s: out of interrupt vectors!\n", __FUNCTION__); 921 panic("%s: out of interrupt vectors!\n", __FUNCTION__);
922 vector = irq_to_vector(irq);
932 delivery = IOSAPIC_INIT; 923 delivery = IOSAPIC_INIT;
933 break; 924 break;
934 case ACPI_INTERRUPT_CPEI: 925 case ACPI_INTERRUPT_CPEI: