From patchwork Tue Jun 19 14:16:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10474627 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 183DD603B5 for ; Tue, 19 Jun 2018 14:17:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0A9B82860B for ; Tue, 19 Jun 2018 14:17:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F3A4728C13; Tue, 19 Jun 2018 14:17:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 96D1A2860B for ; Tue, 19 Jun 2018 14:17:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S937792AbeFSORT (ORCPT ); Tue, 19 Jun 2018 10:17:19 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:50940 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S937635AbeFSORQ (ORCPT ); Tue, 19 Jun 2018 10:17:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=GT5g6poAcrCJ+0mPrQT1zQLNey5Q+q7kLjRpdHJhN30=; b=OVPawb++3dBcnEKYUr2qd7Jmk XjqTHLDM8yGjvpaqERxn4q0EOJ/zfplylQLbLcYoUenwHjfAa56Nh3TLIPqNF+3OkPaCOZxPyR1Zl u1ldIo4v4gyCIEXXTVUjsvrSaZmw1CC9FIqKA9udNfpK9bZIOuzU6wkYONPKU5r5F3EWlAhcfEoHg gUDIG+u3eyXULHcyGhpzJGiFvsv/Lc7CxLMbco2/IXwd/om5TD4+/JrklCO87JWj8aK2LhYNtrc29 8dHS1UvZ5CfVyNoKOxZiWFAIcgAA37gZiRfKj+Vx5Q2hvIMSF2X5Qldqf/Xmklnr/IIIuXsdWbNYn y3aOGMqCA==; Received: from 089144192009.atnat0001.highway.a1.net ([89.144.192.9] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fVHRY-0001Qo-Qj; Tue, 19 Jun 2018 14:17:13 +0000 From: Christoph Hellwig To: Lorenzo Pieralisi , Bjorn Helgaas Cc: Palmer Dabbelt , "Wesley W . Terpstra" , linux-pci@vger.kernel.org, linux-riscv@lists.infradead.org Subject: [PATCH 2/3] PCI/xilinx: Work-around for hardware DMA limit (32 bits) Date: Tue, 19 Jun 2018 16:16:59 +0200 Message-Id: <20180619141700.7842-3-hch@lst.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180619141700.7842-1-hch@lst.de> References: <20180619141700.7842-1-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Wesley W. Terpstra" This PCIe bridge only has a 32 bit bus master interface, thus truncating the DMA capability of all PCIe devices attached beneath it. This caps the child device capability so that these devices work on systems with physical memory beyond the 4GiB threshold. Signed-off-by: Wesley W. Terpstra [hch: switched to setting the dma_32bit_limit flag instead of overriding the dma_map_ops] Signed-off-by: Christoph Hellwig --- drivers/pci/controller/pcie-xilinx.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/pci/controller/pcie-xilinx.c b/drivers/pci/controller/pcie-xilinx.c index b110a3a814e3..f6b41df59886 100644 --- a/drivers/pci/controller/pcie-xilinx.c +++ b/drivers/pci/controller/pcie-xilinx.c @@ -197,11 +197,21 @@ static void __iomem *xilinx_pcie_map_bus(struct pci_bus *bus, return port->reg_base + relbus + where; } +/* + * This PCIe bridge only has a 32 bit bus master interface, thus truncating + * the DMA capability of all PCIe devices attached beneath it. + */ +static void xilinx_pcie_add_dev(struct pci_dev *pdev, struct pci_bus *bus) +{ + pdev->dev.dma_32bit_limit = true; +} + /* PCIe operations */ static struct pci_ops xilinx_pcie_ops = { .map_bus = xilinx_pcie_map_bus, .read = pci_generic_config_read, .write = pci_generic_config_write, + .add_dev = xilinx_pcie_add_dev, }; /* MSI functions */