Commit d4d1c0f3 authored by Joerg Roedel's avatar Joerg Roedel

iommu/vt-d: Set IRTA in intel_setup_irq_remapping

This way we can give the hardware the new IR table right
after it has been allocated and initialized.
Tested-by: default avatarZhenHua Li <zhen-hual@hp.com>
Tested-by: default avatarBaoquan He <bhe@redhat.com>
Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent c676f587
...@@ -428,9 +428,9 @@ static int set_msi_sid(struct irte *irte, struct pci_dev *dev) ...@@ -428,9 +428,9 @@ static int set_msi_sid(struct irte *irte, struct pci_dev *dev)
static void iommu_set_irq_remapping(struct intel_iommu *iommu, int mode) static void iommu_set_irq_remapping(struct intel_iommu *iommu, int mode)
{ {
unsigned long flags;
u64 addr; u64 addr;
u32 sts; u32 sts;
unsigned long flags;
addr = virt_to_phys((void *)iommu->ir_table->base); addr = virt_to_phys((void *)iommu->ir_table->base);
...@@ -447,10 +447,16 @@ static void iommu_set_irq_remapping(struct intel_iommu *iommu, int mode) ...@@ -447,10 +447,16 @@ static void iommu_set_irq_remapping(struct intel_iommu *iommu, int mode)
raw_spin_unlock_irqrestore(&iommu->register_lock, flags); raw_spin_unlock_irqrestore(&iommu->register_lock, flags);
/* /*
* global invalidation of interrupt entry cache before enabling * Global invalidation of interrupt entry cache to make sure the
* interrupt-remapping. * hardware uses the new irq remapping table.
*/ */
qi_global_iec(iommu); qi_global_iec(iommu);
}
static void iommu_enable_irq_remapping(struct intel_iommu *iommu)
{
unsigned long flags;
u32 sts;
raw_spin_lock_irqsave(&iommu->register_lock, flags); raw_spin_lock_irqsave(&iommu->register_lock, flags);
...@@ -525,6 +531,8 @@ static int intel_setup_irq_remapping(struct intel_iommu *iommu) ...@@ -525,6 +531,8 @@ static int intel_setup_irq_remapping(struct intel_iommu *iommu)
} }
} }
iommu_set_irq_remapping(iommu, eim_mode);
return 0; return 0;
out_free_bitmap: out_free_bitmap:
...@@ -689,7 +697,7 @@ static int __init intel_enable_irq_remapping(void) ...@@ -689,7 +697,7 @@ static int __init intel_enable_irq_remapping(void)
* Setup Interrupt-remapping for all the DRHD's now. * Setup Interrupt-remapping for all the DRHD's now.
*/ */
for_each_iommu(iommu, drhd) { for_each_iommu(iommu, drhd) {
iommu_set_irq_remapping(iommu, eim_mode); iommu_enable_irq_remapping(iommu);
setup = true; setup = true;
} }
...@@ -926,6 +934,7 @@ static int reenable_irq_remapping(int eim) ...@@ -926,6 +934,7 @@ static int reenable_irq_remapping(int eim)
/* Set up interrupt remapping for iommu.*/ /* Set up interrupt remapping for iommu.*/
iommu_set_irq_remapping(iommu, eim); iommu_set_irq_remapping(iommu, eim);
iommu_enable_irq_remapping(iommu);
setup = true; setup = true;
} }
...@@ -1241,7 +1250,7 @@ static int dmar_ir_add(struct dmar_drhd_unit *dmaru, struct intel_iommu *iommu) ...@@ -1241,7 +1250,7 @@ static int dmar_ir_add(struct dmar_drhd_unit *dmaru, struct intel_iommu *iommu)
intel_teardown_irq_remapping(iommu); intel_teardown_irq_remapping(iommu);
ir_remove_ioapic_hpet_scope(iommu); ir_remove_ioapic_hpet_scope(iommu);
} else { } else {
iommu_set_irq_remapping(iommu, eim); iommu_enable_irq_remapping(iommu);
} }
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment