From patchwork Thu Mar 3 14:53:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacek Lawrynowicz X-Patchwork-Id: 8493331 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 85AE0C0553 for ; Thu, 3 Mar 2016 14:53:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7524920295 for ; Thu, 3 Mar 2016 14:53:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 812B0202AE for ; Thu, 3 Mar 2016 14:53:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932460AbcCCOx1 (ORCPT ); Thu, 3 Mar 2016 09:53:27 -0500 Received: from mga09.intel.com ([134.134.136.24]:41637 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932333AbcCCOx0 (ORCPT ); Thu, 3 Mar 2016 09:53:26 -0500 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP; 03 Mar 2016 06:53:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,532,1449561600"; d="scan'208";a="928856137" Received: from gklab-119a-034.igk.intel.com ([10.91.119.34]) by fmsmga002.fm.intel.com with ESMTP; 03 Mar 2016 06:53:24 -0800 From: Jacek Lawrynowicz To: helgaas@kernel.org Cc: jroedel@suse.de, dwmw2@infradead.org, alex.williamson@redhat.com, linux-pci@vger.kernel.org, iommu@lists.linux-foundation.org, Jacek Lawrynowicz Subject: [PATCH v5 5/6] PCI: Add DMA alias quirk for mic_x200_dma Date: Thu, 3 Mar 2016 15:53:20 +0100 Message-Id: <1457016800-11903-1-git-send-email-jacek.lawrynowicz@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <20160224194423.7585.46582.stgit@bhelgaas-glaptop2.roam.corp.google.com> References: <20160224194423.7585.46582.stgit@bhelgaas-glaptop2.roam.corp.google.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 Acked-by: David Woodhouse Reviewed-by: Alex Williamson --- Updated quirk comment with requirement that aliases have to be matching values programmed in the EEPROM. The LUT table on x200 is static so there is no need to program it from the driver. drivers/pci/quirks.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 51927a5..e66f09d 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -3696,6 +3696,20 @@ 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 RIDs. They have to + * be added as aliases to the DMA device in order to allow buffer access + * when IOMMU is enabled. Following devfns have to match RIT-LUT table + * programmed in the EEPROM. + */ +static void quirk_mic_x200_dma_alias(struct pci_dev *pdev) +{ + pci_add_dma_alias(pdev, PCI_DEVFN(0x10, 0x0)); + pci_add_dma_alias(pdev, PCI_DEVFN(0x11, 0x0)); + pci_add_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. */