From patchwork Fri Jun 5 14:10:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 6554491 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1D4B0C0020 for ; Fri, 5 Jun 2015 14:16:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 47FF0206FD for ; Fri, 5 Jun 2015 14:16:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4B531205C6 for ; Fri, 5 Jun 2015 14:16:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423044AbbFEOMl (ORCPT ); Fri, 5 Jun 2015 10:12:41 -0400 Received: from 8bytes.org ([81.169.241.247]:59220 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423045AbbFEOLU (ORCPT ); Fri, 5 Jun 2015 10:11:20 -0400 Received: by theia.8bytes.org (Postfix, from userid 1000) id BD78D785; Fri, 5 Jun 2015 16:11:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=8bytes.org; s=mail-1; t=1433513472; bh=WHEH/ETghZqWwpQpUJugKWrerwji1LnFuIOYE50ynuk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xn0Lyls2fh59VWB+HfPVyDgxBpPMJtkn/FDReah8AcKsAh5dxTtgs4L7xuFscl4rS tOsXCrb5uQ7PcKkEFlgKI4hBJVkihjszn+B8nTlvWASrqKUdB+SHvcyfEslMJjTeP7 A+caokVE9oBOH1YlVRHLe0dQNbfUh0A51Xt/XiH+Us3JtV0Atb0sk+NsIuDZHFL9pY df2GzBA91t47LBWYET98XBCHoMdca7FNGYQJ3lXU6Jj00PRWpTORP8PV8KmKk/LynA nyk0tCtDKwF8pXVSA2MzOxT45K6GcZxnMTFOf+/wFwHJOZK577sgYqYcBLN1Ivj8Th WLRH/6zM8R3WQ== From: Joerg Roedel To: iommu@lists.linux-foundation.org Cc: zhen-hual@hp.com, bhe@redhat.com, dwmw2@infradead.org, vgoyal@redhat.com, dyoung@redhat.com, alex.williamson@redhat.com, ddutile@redhat.com, ishii.hironobu@jp.fujitsu.com, indou.takao@jp.fujitsu.com, bhelgaas@google.com, doug.hatch@hp.com, jerry.hoemann@hp.com, tom.vaden@hp.com, li.zhang6@hp.com, lisa.mitchell@hp.com, billsumnerlinux@gmail.com, rwright@hp.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, kexec@lists.infradead.org, joro@8bytes.org, jroedel@suse.de Subject: [PATCH 13/17] iommu/vt-d: Split up iommu_set_irq_remapping Date: Fri, 5 Jun 2015 16:10:59 +0200 Message-Id: <1433513463-19128-14-git-send-email-joro@8bytes.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1433513463-19128-1-git-send-email-joro@8bytes.org> References: <1433513463-19128-1-git-send-email-joro@8bytes.org> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Joerg Roedel Split out the part that enables irq remapping into the new function iommu_enable_irq_remapping. This allows to program the irq remapping table to the hardware without enabling irq remapping. Tested-by: Baoquan He Signed-off-by: Joerg Roedel --- drivers/iommu/intel_irq_remapping.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/intel_irq_remapping.c b/drivers/iommu/intel_irq_remapping.c index 35d73f6..c3d1e63 100644 --- a/drivers/iommu/intel_irq_remapping.c +++ b/drivers/iommu/intel_irq_remapping.c @@ -440,9 +440,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); @@ -463,6 +463,12 @@ static void iommu_set_irq_remapping(struct intel_iommu *iommu, int mode) * interrupt-remapping. */ 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); @@ -700,8 +706,10 @@ static int __init intel_enable_irq_remapping(void) iommu->ir_table->base_old_phys, INTR_REMAP_TABLE_ENTRIES*sizeof(struct irte)); __iommu_load_old_irte(iommu); - } else + } else { iommu_set_irq_remapping(iommu, eim_mode); + iommu_enable_irq_remapping(iommu); + } setup = true; } @@ -939,6 +947,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; } @@ -1257,6 +1266,7 @@ static int dmar_ir_add(struct dmar_drhd_unit *dmaru, struct intel_iommu *iommu) ir_remove_ioapic_hpet_scope(iommu); } else { iommu_set_irq_remapping(iommu, eim); + iommu_enable_irq_remapping(iommu); } return ret;