Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1588937ybv; Thu, 20 Feb 2020 23:50:42 -0800 (PST) X-Google-Smtp-Source: APXvYqyucNuHqJjp9hz0fPSWp3MLjbIvXqHMUNEvdLFssu9QucATfzeoGrZTVa+2SmPL51HxZgtA X-Received: by 2002:aca:43c1:: with SMTP id q184mr898369oia.116.1582271441884; Thu, 20 Feb 2020 23:50:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582271441; cv=none; d=google.com; s=arc-20160816; b=jJzLQXcMevSDjsM3vtw064vtp9cOKxlQpRLJhAAAdQP93B4bu+oItFhC+Jyqd1Wb0s hnH+8i1fWPAAS5WXtvDOvWEwrAyE5fnS4YVIJiiwLrDqACJilrIyOQ+I3qPnY/z+8fkn f/cV5XehbMq7dRYAAESQee8k/YeJVCpv17oP8i+kL23Klud3RdEdtiEBzuULa577LR0O 1UvR2V///uhmPwh7XbEk0ggyaJ+q6e+8w2iQTssx8C7SClhUVzzZf2Gc0hN1f1rgL0vm G/+XWiF3NH1sFOo6YOhqQt0RnFzylLJ88TWZ/7fOA4FqrQtCLnMNgkFJCQNHZXWjJNf9 Tt5g== 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=C1Kgi4OPryMYHmugLWxo0PX6uvKdnoS6xo4DiMivSUo=; b=xDOsqJFIKn9bXxe9rsdgAd4UG0ANj1VeUkRsVzBaO8hTLO2p+WC3zr4jDS11qcbhGd k71WXf8otR5rIKMe26XLBpGV8HOQfMgx0rr4OcdsORWby2lq5F8w2YGPdZnHBFCP8U2s s6e5G2MZuABy639pCyknNFXENAmlHQOolsFZmdMLLXRN2IbPXm76vLsauJyMbMpYNOR9 hXn3GMx+plo51/X5v3AkKK6lo+XFg3SBfTyaCp+3prq0zky9q0cC8mjxYH4DlmmZcqSp PMzw2qFZBrNvMKm/HvXLIzDCYWR1JbMLyyISAZbMpkTmJbVi4gi9YDG2Ou74VwjrBoPh YVHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=KlWo+22a; 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 g6si1053858otk.171.2020.02.20.23.50.29; Thu, 20 Feb 2020 23:50:41 -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=KlWo+22a; 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 S1729051AbgBUHu0 (ORCPT + 99 others); Fri, 21 Feb 2020 02:50:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:47286 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729528AbgBUHuX (ORCPT ); Fri, 21 Feb 2020 02:50:23 -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 9A79A207FD; Fri, 21 Feb 2020 07:50:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582271423; bh=Nst9ebLRaE3NHXB6enkxe0pAhC967ktXa0/Y8kcJryM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KlWo+22aYOpk+499H1KaaX4j+rIACcXZuX6I8wM9GPqna/+ky7dG3YAZec6+onZD2 yBwVb9afqaDZghF9QO+ljHy/jS5I61uNaTzzVYjYtGzVQr3MaMNEsI0tSQsrEofccx /LO5n2Cw1D9aHYckYjVnKzBxOV7muw/IlS4o2qZk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, James Sewart , Bjorn Helgaas , Logan Gunthorpe , Sasha Levin Subject: [PATCH 5.5 153/399] PCI: Add DMA alias quirk for PLX PEX NTB Date: Fri, 21 Feb 2020 08:37:58 +0100 Message-Id: <20200221072417.363036813@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200221072402.315346745@linuxfoundation.org> References: <20200221072402.315346745@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: James Sewart [ Upstream commit 7b90dfc4873b87c468cc6046538f46a531c1d785 ] The PLX PEX NTB forwards DMA transactions using Requester IDs that don't exist as PCI devices. The devfn for a transaction is used as an index into a lookup table storing the origin of a transaction on the other side of the bridge. Alias all possible devfns to the NTB device so that any transaction coming in is governed by the mappings for the NTB. Signed-off-by: James Sewart Signed-off-by: Bjorn Helgaas Reviewed-by: Logan Gunthorpe Signed-off-by: Sasha Levin --- drivers/pci/quirks.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 9aa590eb712fe..83953752337c4 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -5371,6 +5371,21 @@ SWITCHTEC_QUIRK(0x8574); /* PFXI 64XG3 */ SWITCHTEC_QUIRK(0x8575); /* PFXI 80XG3 */ SWITCHTEC_QUIRK(0x8576); /* PFXI 96XG3 */ +/* + * The PLX NTB uses devfn proxy IDs to move TLPs between NT endpoints. + * These IDs are used to forward responses to the originator on the other + * side of the NTB. Alias all possible IDs to the NTB to permit access when + * the IOMMU is turned on. + */ +static void quirk_plx_ntb_dma_alias(struct pci_dev *pdev) +{ + pci_info(pdev, "Setting PLX NTB proxy ID aliases\n"); + /* PLX NTB may use all 256 devfns */ + pci_add_dma_alias(pdev, 0, 256); +} +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_PLX, 0x87b0, quirk_plx_ntb_dma_alias); +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_PLX, 0x87b1, quirk_plx_ntb_dma_alias); + /* * On Lenovo Thinkpad P50 SKUs with a Nvidia Quadro M1000M, the BIOS does * not always reset the secondary Nvidia GPU between reboots if the system -- 2.20.1