Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2097983ybl; Thu, 30 Jan 2020 11:19:04 -0800 (PST) X-Google-Smtp-Source: APXvYqwTsbMp41yJYCi8wYn+w0QpuPIKtVjJJwjPNyKsfVSV1gJJ5RCPrrkRDflY465CCuHIgnR0 X-Received: by 2002:aca:ab51:: with SMTP id u78mr3972185oie.21.1580411944604; Thu, 30 Jan 2020 11:19:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580411944; cv=none; d=google.com; s=arc-20160816; b=LriAQOWuQWfPbNUGwANwhIsacH4zhzFqQ70aSs1kNXK0Ix3BbPRgtsFCDV7LDKwAYz PHKheJhBEFqBb2PhCN+l1LA/IGJBO0pbGCjDyGQlDaZXtPT7O3MHWA9SA6sa0O5uijUD aiJcPI64mTF+j4Z7cYjK3QRm9ou5+tZP8b1j8t1O7DFXNvHaGKfkSAmXJMw+QpNrd8Gt NLySnnhmDATmz/xW4wRiEG/4ylNs0K2FD7llpVUxFYWw2VgB6umziMt86Gm8AshcxbLq bpH0NyZ4y8A1OeTppPXiQ422GpricYFesOfjA60IuEDjXnaafvZ4/xYmpRgIYqzeAZiv lhcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fd9WZ6uBdFnnX7LDnARUq62ra0CfLhHPDjJJzVsi1/g=; b=lEkL6iOS1NNj6rUQLYbzOD8/Ue5XaQEqOEyKWTCrTDzefGS6iCjnvNA+neTW9Ywmrn 7YbJteCDYSveE52KYXXawW574D1CzJX0wnFAKHXxV3Oet3ObJy/AcCTX0hhmlevcbI1N 2lZ4Bg4tixkmJhkPCXYDSJv+D/+tYYaC/WtUii8R+frzg+5FHNKxGaldMaMIcAdECEDl Ojk2poAS9RqZ2+ury7LylqZGRMANRfzupNpHPvldmSXsvJ+/F7GlgCaJT/k5dpo6UnB2 roChZvX8Ke4D3bfYE6pgfGjHmWzy2+d0LxXUhUFdCYpzrQzJ94DS4vJHRkSh0n5xWr41 /TAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yXmdeo5Z; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t127si2270229oih.45.2020.01.30.11.18.52; Thu, 30 Jan 2020 11:19:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yXmdeo5Z; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730994AbgA3SpQ (ORCPT + 99 others); Thu, 30 Jan 2020 13:45:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:54760 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730981AbgA3SpN (ORCPT ); Thu, 30 Jan 2020 13:45:13 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 73DB32082E; Thu, 30 Jan 2020 18:45:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580409912; bh=8SpjqQJ6XefrrOUtpsnLYmKICQ97bfsQ1FpvcQPhArE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yXmdeo5ZVAork8Hx6BDZYxGJ5FPRpnijTxgb5YwRTq+aM/ksd6R/NISFK15eLV4I3 dGkuVUc/WxHmQGpt71j58AIIKzB4+3org+7B8d7X5m8mpe0gAFhYyzp9xsDXPYN5yZ 4XLtVqH+YLKYUvKAJ1CdoxRglpcra5FKvwOMa964= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Slawomir Pawlowski , Przemek Kitszel , Bjorn Helgaas , Sasha Levin Subject: [PATCH 5.4 081/110] PCI: Add DMA alias quirk for Intel VCA NTB Date: Thu, 30 Jan 2020 19:38:57 +0100 Message-Id: <20200130183623.811457664@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200130183613.810054545@linuxfoundation.org> References: <20200130183613.810054545@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Slawomir Pawlowski [ Upstream commit 56b4cd4b7da9ee95778eb5c8abea49f641ebfd91 ] 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, we need to add DMA aliases to allow buffer access when IOMMU is enabled. Add aliases to allow computational unit access to host memory. These aliases mark the 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 five functions: four for DMA channels and one additional. Link: https://lore.kernel.org/r/5683A335CC8BE1438C3C30C49DCC38DF637CED8E@IRSMSX102.ger.corp.intel.com Signed-off-by: Slawomir Pawlowski Signed-off-by: Przemek Kitszel Signed-off-by: Bjorn Helgaas Signed-off-by: Sasha Levin --- drivers/pci/quirks.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 1593b8494ebbc..2f88b1ff7ada4 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -4080,6 +4080,40 @@ 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, we need to add DMA aliases to allow buffer access + * when IOMMU is enabled. These aliases allow computational unit access to + * host memory. These aliases mark the 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 five functions + * (four for DMA channels and one 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 -- 2.20.1