From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 584F3C43461 for ; Thu, 17 Sep 2020 17:39:12 +0000 (UTC) Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C282020872 for ; Thu, 17 Sep 2020 17:39:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="ph3uLJKZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C282020872 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=iommu-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 59D8E87956; Thu, 17 Sep 2020 17:39:11 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pzLp9H9sfdBH; Thu, 17 Sep 2020 17:39:10 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id 34A47872F1; Thu, 17 Sep 2020 17:39:10 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 195B9C0888; Thu, 17 Sep 2020 17:39:10 +0000 (UTC) Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id D2CAFC0859 for ; Thu, 17 Sep 2020 17:39:08 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id C89ED876C8 for ; Thu, 17 Sep 2020 17:39:08 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GKaWAEc-he6A for ; Thu, 17 Sep 2020 17:39:08 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by hemlock.osuosl.org (Postfix) with ESMTPS id C3A9087427 for ; Thu, 17 Sep 2020 17:39:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=VYUzAIxzefItAIMc2bAxCCwS4TSxDuuY0l1BQz5HsqM=; b=ph3uLJKZ1SEIYRoNExzFzxbNX8 lA3e4IsBsmRH7GSKbLajZdCqiPlICxMl83Ius2GubVRyJ6+8ndYHPBHPKTq59HVM6I9u+OtRYdQly bhQ535OV0TkCxvrLtvNFzSx61cEueXeap4y29JbU95oarup6bq+RYJC1zQrJwko09yiZLZxQXycZm AoXi4BcbYGt9LSDVBXEup+EqaNHwaLj5MoHP06siCL3nmUCR/LMxzRiIVsTw5/UoBIxGGSPEDaOxK jH8QV7CNC3jCdDNmcZTMDDYdRI9A8Zoj17YkwE6s1nGRHnm8oJgXN4PDUQk/mYXdxSlAPstbRXNDN u1AbPGOg==; Received: from 089144214092.atnat0023.highway.a1.net ([89.144.214.92] helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIxs6-0003B9-91; Thu, 17 Sep 2020 17:39:02 +0000 From: Christoph Hellwig To: Russell King Subject: [PATCH 2/4] ARM/footbridge: switch to use dma_direct_set_offset for lbus DMA offsets Date: Thu, 17 Sep 2020 19:32:27 +0200 Message-Id: <20200917173229.3311382-3-hch@lst.de> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200917173229.3311382-1-hch@lst.de> References: <20200917173229.3311382-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Cc: Aaro Koskinen , Tony Lindgren , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, linux-omap@vger.kernel.org, Robin Murphy , linux-arm-kernel@lists.infradead.org X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" Switch the footbridge PCI devices to use dma_direct_set_offset to set the DMA offset instead of using direct hooks into the DMA mapping code and remove the now unused hooks. Signed-off-by: Christoph Hellwig --- arch/arm/include/asm/dma-direct.h | 4 +- arch/arm/include/asm/memory.h | 2 - arch/arm/mach-footbridge/cats-pci.c | 7 +++- arch/arm/mach-footbridge/common.c | 40 ++++++++++++++----- arch/arm/mach-footbridge/common.h | 3 ++ arch/arm/mach-footbridge/ebsa285-pci.c | 7 +++- .../arm/mach-footbridge/include/mach/memory.h | 4 -- arch/arm/mach-footbridge/netwinder-pci.c | 7 +++- arch/arm/mach-footbridge/personal-pci.c | 7 +++- 9 files changed, 54 insertions(+), 27 deletions(-) diff --git a/arch/arm/include/asm/dma-direct.h b/arch/arm/include/asm/dma-direct.h index 77fcb7ee5ec907..1f04a5e1c615de 100644 --- a/arch/arm/include/asm/dma-direct.h +++ b/arch/arm/include/asm/dma-direct.h @@ -13,12 +13,12 @@ static inline dma_addr_t pfn_to_dma(struct device *dev, unsigned long pfn) { if (dev && dev->dma_range_map) pfn = PFN_DOWN(translate_phys_to_dma(dev, PFN_PHYS(pfn))); - return (dma_addr_t)__pfn_to_bus(pfn); + return (dma_addr_t)__pfn_to_phys(pfn); } static inline unsigned long dma_to_pfn(struct device *dev, dma_addr_t addr) { - unsigned long pfn = __bus_to_pfn(addr); + unsigned long pfn = __phys_to_pfn(addr); if (dev && dev->dma_range_map) pfn = PFN_DOWN(translate_dma_to_phys(dev, PFN_PHYS(pfn))); diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h index 99035b5891ef44..af612606136ff2 100644 --- a/arch/arm/include/asm/memory.h +++ b/arch/arm/include/asm/memory.h @@ -346,8 +346,6 @@ static inline unsigned long __virt_to_idmap(unsigned long x) #ifndef __virt_to_bus #define __virt_to_bus __virt_to_phys #define __bus_to_virt __phys_to_virt -#define __pfn_to_bus(x) __pfn_to_phys(x) -#define __bus_to_pfn(x) __phys_to_pfn(x) #endif /* diff --git a/arch/arm/mach-footbridge/cats-pci.c b/arch/arm/mach-footbridge/cats-pci.c index 0b2fd7e2e9b429..257cb068ac0c5b 100644 --- a/arch/arm/mach-footbridge/cats-pci.c +++ b/arch/arm/mach-footbridge/cats-pci.c @@ -13,6 +13,7 @@ #include #include #include +#include "common.h" /* cats host-specific stuff */ static int irqmap_cats[] __initdata = { IRQ_PCI, IRQ_IN0, IRQ_IN1, IRQ_IN3 }; @@ -56,8 +57,10 @@ static struct hw_pci cats_pci __initdata = { static int __init cats_pci_init(void) { - if (machine_is_cats()) - pci_common_init(&cats_pci); + if (!machine_is_cats()) + return 0; + bus_register_notifier(&pci_bus_type, &footbridge_pci_dma_nb); + pci_common_init(&cats_pci); return 0; } diff --git a/arch/arm/mach-footbridge/common.c b/arch/arm/mach-footbridge/common.c index eee095f0e2f6c2..dc14d72ca7bb3f 100644 --- a/arch/arm/mach-footbridge/common.c +++ b/arch/arm/mach-footbridge/common.c @@ -12,6 +12,8 @@ #include #include #include +#include +#include #include