Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753725AbbFMGty (ORCPT ); Sat, 13 Jun 2015 02:49:54 -0400 Received: from 8bytes.org ([81.169.241.247]:51360 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751096AbbFMGr4 (ORCPT ); Sat, 13 Jun 2015 02:47:56 -0400 From: Joerg Roedel To: iommu@lists.linux-foundation.org Cc: David Woodhouse , zhen-hual@hp.com, bhe@redhat.com, ddutile@redhat.com, alex.williamson@redhat.com, dyoung@redhat.com, linux-kernel@vger.kernel.org, jroedel@8bytes.org, joro@8bytes.org, Joerg Roedel Subject: [PATCH 16/19] iommu/vt-d: Set IRTA in intel_setup_irq_remapping Date: Sat, 13 Jun 2015 08:47:24 +0200 Message-Id: <1434178047-17809-17-git-send-email-joro@8bytes.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1434178047-17809-1-git-send-email-joro@8bytes.org> References: <1434178047-17809-1-git-send-email-joro@8bytes.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2563 Lines: 87 From: Joerg Roedel This way we can give the hardware the new IR table right after it has been allocated and initialized. Signed-off-by: Joerg Roedel --- drivers/iommu/intel_irq_remapping.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/iommu/intel_irq_remapping.c b/drivers/iommu/intel_irq_remapping.c index f1711836..8497028 100644 --- a/drivers/iommu/intel_irq_remapping.c +++ b/drivers/iommu/intel_irq_remapping.c @@ -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) { + unsigned long flags; u64 addr; u32 sts; - unsigned long flags; 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) raw_spin_unlock_irqrestore(&iommu->register_lock, flags); /* - * global invalidation of interrupt entry cache before enabling - * interrupt-remapping. + * Global invalidation of interrupt entry cache to make sure the + * hardware uses the new irq remapping table. */ 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); @@ -525,6 +531,8 @@ static int intel_setup_irq_remapping(struct intel_iommu *iommu) } } + iommu_set_irq_remapping(iommu, eim_mode); + return 0; out_free_bitmap: @@ -689,7 +697,7 @@ static int __init intel_enable_irq_remapping(void) * Setup Interrupt-remapping for all the DRHD's now. */ for_each_iommu(iommu, drhd) { - iommu_set_irq_remapping(iommu, eim_mode); + iommu_enable_irq_remapping(iommu); setup = true; } @@ -926,6 +934,7 @@ static int reenable_irq_remapping(int eim) /* Set up interrupt remapping for iommu.*/ iommu_set_irq_remapping(iommu, eim); + iommu_enable_irq_remapping(iommu); setup = true; } @@ -1241,7 +1250,7 @@ static int dmar_ir_add(struct dmar_drhd_unit *dmaru, struct intel_iommu *iommu) intel_teardown_irq_remapping(iommu); ir_remove_ioapic_hpet_scope(iommu); } else { - iommu_set_irq_remapping(iommu, eim); + iommu_enable_irq_remapping(iommu); } return ret; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/