From patchwork Tue Sep 17 09:20:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kitszel, PrzemyslawX" X-Patchwork-Id: 11148329 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4E52413BD for ; Tue, 17 Sep 2019 09:20:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 363DD21881 for ; Tue, 17 Sep 2019 09:20:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727095AbfIQJUv (ORCPT ); Tue, 17 Sep 2019 05:20:51 -0400 Received: from mga02.intel.com ([134.134.136.20]:46780 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726091AbfIQJUv (ORCPT ); Tue, 17 Sep 2019 05:20:51 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Sep 2019 02:20:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,515,1559545200"; d="scan'208,223";a="177330062" Received: from irsmsx101.ger.corp.intel.com ([163.33.3.153]) by orsmga007.jf.intel.com with ESMTP; 17 Sep 2019 02:20:49 -0700 Received: from irsmsx102.ger.corp.intel.com ([169.254.2.160]) by IRSMSX101.ger.corp.intel.com ([169.254.1.129]) with mapi id 14.03.0439.000; Tue, 17 Sep 2019 10:20:49 +0100 From: "Kitszel, PrzemyslawX" To: "linux-pci@vger.kernel.org" CC: "Maslowski, Karol" , Andrew Murray Subject: [PATCH v2] PCI: Add quirk for VCA NTB Thread-Topic: [PATCH v2] PCI: Add quirk for VCA NTB Thread-Index: AdVtOOaQdSICRsZWRI++mrPh949BAA== Date: Tue, 17 Sep 2019 09:20:48 +0000 Message-ID: <5683A335CC8BE1438C3C30C49DCC38DF637CED8E@IRSMSX102.ger.corp.intel.com> Accept-Language: pl-PL, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.600.7 dlp-reaction: no-action x-originating-ip: [163.33.239.180] MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From 8ec717d913bba70e3e0dd783eebf355e0d64a159 Mon Sep 17 00:00:00 2001 From: Slawomir Pawlowski Date: Fri, 21 Sep 2018 15:55:12 +0200 Subject: [PATCH v2] PCI: Add quirk for VCA NTB Intel Visual Compute Accelerator (VCA) is a family of PCIe add-in devices exposing computational units via Non Transparent Bridges (NTB, PEX 87xx). Similarly to MIC x200, there is need to add DMA aliases to allow buffer access when IOMMU is enabled. Following aliases are allowing host device and computational unit to access each other. Together those aliases marks whole VCA device as one IOMMU group. All possible slot numbers (0x20) are used, since we are unable to tell what slot is used on other side. This quirk is intended for both host and computational unit sides. The VCA devices have up to 5 functions - 4 for DMA channels and one additional. Signed-off-by: Slawomir Pawlowski Signed-off-by: Przemek Kitszel --- Changes in v2: - fix typos: s/sine/since/g drivers/pci/quirks.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index ded60757a573..921a080146f3 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -4062,6 +4062,38 @@ static void quirk_mic_x200_dma_alias(struct pci_dev *pdev) DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2260, quirk_mic_x200_dma_alias); DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2264, quirk_mic_x200_dma_alias); +/* + * Intel Visual Compute Accelerator (VCA) is a family of PCIe add-in devices + * exposing computational units via Non Transparent Bridges (NTB, PEX 87xx). + * Similarly to MIC x200, there is need to add DMA aliases to allow buffer + * access when IOMMU is enabled. + * Following aliases are allowing host device and computational unit to access + * each other. Together those aliases marks whole VCA device as one IOMMU group. + * All possible slot numbers (0x20) are used, since we are unable to tell what + * slot is used on other side. + * This quirk is intended for both host and computational unit sides. + * The VCA devices have up to 5 functions (4 for DMA channels and 1 additional). + */ +static void quirk_pex_vca_alias(struct pci_dev *pdev) +{ + const unsigned int num_pci_slots = 0x20; + unsigned int slot; + + for (slot = 0; slot < num_pci_slots; slot++) { + pci_add_dma_alias(pdev, PCI_DEVFN(slot, 0x0)); + pci_add_dma_alias(pdev, PCI_DEVFN(slot, 0x1)); + pci_add_dma_alias(pdev, PCI_DEVFN(slot, 0x2)); + pci_add_dma_alias(pdev, PCI_DEVFN(slot, 0x3)); + pci_add_dma_alias(pdev, PCI_DEVFN(slot, 0x4)); + } +} +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2954, quirk_pex_vca_alias); +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2955, quirk_pex_vca_alias); +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2956, quirk_pex_vca_alias); +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2958, quirk_pex_vca_alias); +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2959, quirk_pex_vca_alias); +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x295A, quirk_pex_vca_alias); + /* * The IOMMU and interrupt controller on Broadcom Vulcan/Cavium ThunderX2 are * associated not at the root bus, but at a bridge below. This quirk avoids