From patchwork Tue Jan 26 10:31:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacek Lawrynowicz X-Patchwork-Id: 8119911 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 5D697BEEE5 for ; Tue, 26 Jan 2016 10:32:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9AF5820263 for ; Tue, 26 Jan 2016 10:32:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B480D201FA for ; Tue, 26 Jan 2016 10:32:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965094AbcAZKcX (ORCPT ); Tue, 26 Jan 2016 05:32:23 -0500 Received: from mga02.intel.com ([134.134.136.20]:58966 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965093AbcAZKcV (ORCPT ); Tue, 26 Jan 2016 05:32:21 -0500 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 26 Jan 2016 02:32:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,349,1449561600"; d="scan'208";a="868840089" Received: from gklab-119a-230.igk.intel.com ([10.91.119.230]) by orsmga001.jf.intel.com with ESMTP; 26 Jan 2016 02:32:18 -0800 From: Jacek Lawrynowicz To: linux-pci@vger.kernel.org Cc: bhelgaas@google.com, alex.williamson@redhat.com, dwmw2@infradead.org, jroedel@suse.de, jacek.lawrynowicz@intel.com Subject: [PATCH v2 2/2] pci: Add DMA alias quirk for mic_x200_dma Date: Tue, 26 Jan 2016 11:31:50 +0100 Message-Id: <1453804310-12946-2-git-send-email-jacek.lawrynowicz@intel.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1453804310-12946-1-git-send-email-jacek.lawrynowicz@intel.com> References: <1453804310-12946-1-git-send-email-jacek.lawrynowicz@intel.com> 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.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 MIC x200 NTB forwards PCIe traffic using multiple alien RID. They have to be added as aliases to the DMA device in order to allow buffer access when IOMMU is enabled. Signed-off-by: Jacek Lawrynowicz --- drivers/pci/quirks.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index b094061..bc23bc8 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -3703,6 +3703,21 @@ DECLARE_PCI_FIXUP_HEADER(0x1283, 0x8892, quirk_use_pcie_bridge_dma_alias); DECLARE_PCI_FIXUP_HEADER(0x8086, 0x244e, quirk_use_pcie_bridge_dma_alias); /* + * MIC x200 NTB forwards PCIe traffic using multiple alien RID. They have to + * be added as aliases to the DMA device in order to allow buffer access + * when IOMMU is enabled. + */ +static void quirk_mic_x200_dma_alias(struct pci_dev *pdev) +{ + if (iommu_present(pdev->dev.bus)) { + pci_enable_dma_alias(pdev, PCI_DEVFN(0x10, 0x0)); + pci_enable_dma_alias(pdev, PCI_DEVFN(0x11, 0x0)); + pci_enable_dma_alias(pdev, PCI_DEVFN(0x12, 0x3)); + } +} +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2264, quirk_mic_x200_dma_alias); + +/* * Intersil/Techwell TW686[4589]-based video capture cards have an empty (zero) * class code. Fix it. */