From patchwork Sat Aug 4 10:14:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 953428 X-Patchwork-Delegate: lorenzo.pieralisi@arm.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="c/wFVzt7"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 41jKWy4W0Dz9s0R for ; Sat, 4 Aug 2018 20:14:22 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727445AbeHDMO3 (ORCPT ); Sat, 4 Aug 2018 08:14:29 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:58596 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726744AbeHDMO3 (ORCPT ); Sat, 4 Aug 2018 08:14:29 -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=rrxMRGF3UYQv4miiHWfgGgZ7en8kVcEfCnnY62RSXwI=; b=c/wFVzt7V+wIOY+oWvA2P3ZkR L52lsenQKa856hKZ/6qUbtNDUhrf99ZgGbOvXpYEyRLnYO3gwdVU4ttaq8xyYjBLDBn1lvzEQyJ0T tRjNpgHZM8Z+r3ZGhvOxaO8FfrsSGwo4TpohRBoEXc6W3d7/suT4BvJFGO6V1LtF+XDTPuVgYJTYD PfphZ7FjLlzn0V3czWqpTSxCfgU1CTdNz5MIRsuOLgXZn6S6OQoPNQ+rkpHJTjZmP2t1IupmnLLr2 0MR5ZgC+hIlwrjppNdZUTP0yHGUMspuA5UcTvSjZ4yz1EU4YOQJOjRtnRYGDGQ3eixTxk9bMz8kE9 TlBWzjfuw==; Received: from [46.125.249.69] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fltZd-0000Ml-TK; Sat, 04 Aug 2018 10:14:14 +0000 From: Christoph Hellwig To: Lorenzo Pieralisi , Bjorn Helgaas Cc: Palmer Dabbelt , "Wesley W . Terpstra" , Arnd Bergmann , 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: Sat, 4 Aug 2018 12:14:01 +0200 Message-Id: <20180804101402.10022-3-hch@lst.de> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180804101402.10022-1-hch@lst.de> References: <20180804101402.10022-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 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. Based on an earlier patch from Wesley W. Terpstra . Signed-off-by: Christoph Hellwig --- drivers/pci/controller/pcie-xilinx.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/pci/controller/pcie-xilinx.c b/drivers/pci/controller/pcie-xilinx.c index 7b1389d8e2a5..ccfd91e0515f 100644 --- a/drivers/pci/controller/pcie-xilinx.c +++ b/drivers/pci/controller/pcie-xilinx.c @@ -197,6 +197,16 @@ 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 int xilinx_pcie_add_device(struct pci_dev *pdev) +{ + pdev->dev.bus_dma_mask = DMA_BIT_MASK(32); + return 0; +} + /* PCIe operations */ static struct pci_ops xilinx_pcie_ops = { .map_bus = xilinx_pcie_map_bus, @@ -665,6 +675,7 @@ static int xilinx_pcie_probe(struct platform_device *pdev) bridge->ops = &xilinx_pcie_ops; bridge->map_irq = of_irq_parse_and_map_pci; bridge->swizzle_irq = pci_common_swizzle; + bridge->add_device = xilinx_pcie_add_device; #ifdef CONFIG_PCI_MSI xilinx_pcie_msi_chip.dev = dev;