diff options
Diffstat (limited to 'drivers/iommu/intel_irq_remapping.c')
-rw-r--r-- | drivers/iommu/intel_irq_remapping.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/drivers/iommu/intel_irq_remapping.c b/drivers/iommu/intel_irq_remapping.c index 6d347064b8b0..e0b18f3ae9a8 100644 --- a/drivers/iommu/intel_irq_remapping.c +++ b/drivers/iommu/intel_irq_remapping.c | |||
@@ -902,7 +902,6 @@ static int intel_setup_ioapic_entry(int irq, | |||
902 | return 0; | 902 | return 0; |
903 | } | 903 | } |
904 | 904 | ||
905 | #ifdef CONFIG_SMP | ||
906 | /* | 905 | /* |
907 | * Migrate the IO-APIC irq in the presence of intr-remapping. | 906 | * Migrate the IO-APIC irq in the presence of intr-remapping. |
908 | * | 907 | * |
@@ -924,6 +923,10 @@ intel_ioapic_set_affinity(struct irq_data *data, const struct cpumask *mask, | |||
924 | struct irq_cfg *cfg = data->chip_data; | 923 | struct irq_cfg *cfg = data->chip_data; |
925 | unsigned int dest, irq = data->irq; | 924 | unsigned int dest, irq = data->irq; |
926 | struct irte irte; | 925 | struct irte irte; |
926 | int err; | ||
927 | |||
928 | if (!config_enabled(CONFIG_SMP)) | ||
929 | return -EINVAL; | ||
927 | 930 | ||
928 | if (!cpumask_intersects(mask, cpu_online_mask)) | 931 | if (!cpumask_intersects(mask, cpu_online_mask)) |
929 | return -EINVAL; | 932 | return -EINVAL; |
@@ -931,10 +934,16 @@ intel_ioapic_set_affinity(struct irq_data *data, const struct cpumask *mask, | |||
931 | if (get_irte(irq, &irte)) | 934 | if (get_irte(irq, &irte)) |
932 | return -EBUSY; | 935 | return -EBUSY; |
933 | 936 | ||
934 | if (assign_irq_vector(irq, cfg, mask)) | 937 | err = assign_irq_vector(irq, cfg, mask); |
935 | return -EBUSY; | 938 | if (err) |
939 | return err; | ||
936 | 940 | ||
937 | dest = apic->cpu_mask_to_apicid_and(cfg->domain, mask); | 941 | err = apic->cpu_mask_to_apicid_and(cfg->domain, mask, &dest); |
942 | if (err) { | ||
943 | if (assign_irq_vector(irq, cfg, data->affinity)) | ||
944 | pr_err("Failed to recover vector for irq %d\n", irq); | ||
945 | return err; | ||
946 | } | ||
938 | 947 | ||
939 | irte.vector = cfg->vector; | 948 | irte.vector = cfg->vector; |
940 | irte.dest_id = IRTE_DEST(dest); | 949 | irte.dest_id = IRTE_DEST(dest); |
@@ -956,7 +965,6 @@ intel_ioapic_set_affinity(struct irq_data *data, const struct cpumask *mask, | |||
956 | cpumask_copy(data->affinity, mask); | 965 | cpumask_copy(data->affinity, mask); |
957 | return 0; | 966 | return 0; |
958 | } | 967 | } |
959 | #endif | ||
960 | 968 | ||
961 | static void intel_compose_msi_msg(struct pci_dev *pdev, | 969 | static void intel_compose_msi_msg(struct pci_dev *pdev, |
962 | unsigned int irq, unsigned int dest, | 970 | unsigned int irq, unsigned int dest, |
@@ -1058,9 +1066,7 @@ struct irq_remap_ops intel_irq_remap_ops = { | |||
1058 | .reenable = reenable_irq_remapping, | 1066 | .reenable = reenable_irq_remapping, |
1059 | .enable_faulting = enable_drhd_fault_handling, | 1067 | .enable_faulting = enable_drhd_fault_handling, |
1060 | .setup_ioapic_entry = intel_setup_ioapic_entry, | 1068 | .setup_ioapic_entry = intel_setup_ioapic_entry, |
1061 | #ifdef CONFIG_SMP | ||
1062 | .set_affinity = intel_ioapic_set_affinity, | 1069 | .set_affinity = intel_ioapic_set_affinity, |
1063 | #endif | ||
1064 | .free_irq = free_irte, | 1070 | .free_irq = free_irte, |
1065 | .compose_msi_msg = intel_compose_msi_msg, | 1071 | .compose_msi_msg = intel_compose_msi_msg, |
1066 | .msi_alloc_irq = intel_msi_alloc_irq, | 1072 | .msi_alloc_irq = intel_msi_alloc_irq, |