aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2017-09-13 17:29:47 -0400
committerThomas Gleixner <tglx@linutronix.de>2017-09-25 14:52:00 -0400
commitd491bdff888e8a287f6017c70a8dd10f46984851 (patch)
tree23506d25e606ad82c345b75dcb9bd2053c3a2d35
parent2a85386a73fa57b114ba66421b57d3850dbcef9f (diff)
iommu/vt-d: Reevaluate vector configuration on activate()
With the upcoming reservation/management scheme, early activation will assign a special vector. The final activation at request_irq() assigns a real vector, which needs to be updated in the tables. Split out the reconfiguration code in set_affinity and use it for reactivation. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Tested-by: Juergen Gross <jgross@suse.com> Tested-by: Yu Chen <yu.c.chen@intel.com> Acked-by: Juergen Gross <jgross@suse.com> Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com> Cc: Tony Luck <tony.luck@intel.com> Cc: Marc Zyngier <marc.zyngier@arm.com> Cc: Alok Kataria <akataria@vmware.com> Cc: Joerg Roedel <joro@8bytes.org> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Christoph Hellwig <hch@lst.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: iommu@lists.linux-foundation.org Cc: Borislav Petkov <bp@alien8.de> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Rui Zhang <rui.zhang@intel.com> Cc: "K. Y. Srinivasan" <kys@microsoft.com> Cc: Arjan van de Ven <arjan@linux.intel.com> Cc: Dan Williams <dan.j.williams@intel.com> Cc: Len Brown <lenb@kernel.org> Link: https://lkml.kernel.org/r/20170913213155.853028808@linutronix.de
-rw-r--r--drivers/iommu/intel_irq_remapping.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/drivers/iommu/intel_irq_remapping.c b/drivers/iommu/intel_irq_remapping.c
index 762d84713b7a..e274d9d12ba4 100644
--- a/drivers/iommu/intel_irq_remapping.c
+++ b/drivers/iommu/intel_irq_remapping.c
@@ -1121,6 +1121,24 @@ struct irq_remap_ops intel_irq_remap_ops = {
1121 .get_irq_domain = intel_get_irq_domain, 1121 .get_irq_domain = intel_get_irq_domain,
1122}; 1122};
1123 1123
1124static void intel_ir_reconfigure_irte(struct irq_data *irqd, bool force)
1125{
1126 struct intel_ir_data *ir_data = irqd->chip_data;
1127 struct irte *irte = &ir_data->irte_entry;
1128 struct irq_cfg *cfg = irqd_cfg(irqd);
1129
1130 /*
1131 * Atomically updates the IRTE with the new destination, vector
1132 * and flushes the interrupt entry cache.
1133 */
1134 irte->vector = cfg->vector;
1135 irte->dest_id = IRTE_DEST(cfg->dest_apicid);
1136
1137 /* Update the hardware only if the interrupt is in remapped mode. */
1138 if (!force || ir_data->irq_2_iommu.mode == IRQ_REMAPPING)
1139 modify_irte(&ir_data->irq_2_iommu, irte);
1140}
1141
1124/* 1142/*
1125 * Migrate the IO-APIC irq in the presence of intr-remapping. 1143 * Migrate the IO-APIC irq in the presence of intr-remapping.
1126 * 1144 *
@@ -1139,27 +1157,15 @@ static int
1139intel_ir_set_affinity(struct irq_data *data, const struct cpumask *mask, 1157intel_ir_set_affinity(struct irq_data *data, const struct cpumask *mask,
1140 bool force) 1158 bool force)
1141{ 1159{
1142 struct intel_ir_data *ir_data = data->chip_data;
1143 struct irte *irte = &ir_data->irte_entry;
1144 struct irq_cfg *cfg = irqd_cfg(data);
1145 struct irq_data *parent = data->parent_data; 1160 struct irq_data *parent = data->parent_data;
1161 struct irq_cfg *cfg = irqd_cfg(data);
1146 int ret; 1162 int ret;
1147 1163
1148 ret = parent->chip->irq_set_affinity(parent, mask, force); 1164 ret = parent->chip->irq_set_affinity(parent, mask, force);
1149 if (ret < 0 || ret == IRQ_SET_MASK_OK_DONE) 1165 if (ret < 0 || ret == IRQ_SET_MASK_OK_DONE)
1150 return ret; 1166 return ret;
1151 1167
1152 /* 1168 intel_ir_reconfigure_irte(data, false);
1153 * Atomically updates the IRTE with the new destination, vector
1154 * and flushes the interrupt entry cache.
1155 */
1156 irte->vector = cfg->vector;
1157 irte->dest_id = IRTE_DEST(cfg->dest_apicid);
1158
1159 /* Update the hardware only if the interrupt is in remapped mode. */
1160 if (ir_data->irq_2_iommu.mode == IRQ_REMAPPING)
1161 modify_irte(&ir_data->irq_2_iommu, irte);
1162
1163 /* 1169 /*
1164 * After this point, all the interrupts will start arriving 1170 * After this point, all the interrupts will start arriving
1165 * at the new destination. So, time to cleanup the previous 1171 * at the new destination. So, time to cleanup the previous
@@ -1392,9 +1398,7 @@ static void intel_irq_remapping_free(struct irq_domain *domain,
1392static int intel_irq_remapping_activate(struct irq_domain *domain, 1398static int intel_irq_remapping_activate(struct irq_domain *domain,
1393 struct irq_data *irq_data, bool early) 1399 struct irq_data *irq_data, bool early)
1394{ 1400{
1395 struct intel_ir_data *data = irq_data->chip_data; 1401 intel_ir_reconfigure_irte(irq_data, true);
1396
1397 modify_irte(&data->irq_2_iommu, &data->irte_entry);
1398 return 0; 1402 return 0;
1399} 1403}
1400 1404