Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp4866846imm; Tue, 9 Oct 2018 06:29:46 -0700 (PDT) X-Google-Smtp-Source: ACcGV62lT9MbNkdp9LF55s/Kt4tEh90fMJlc15OClxU/nCmnCRrH8z4s8SOoADIQSpnYjD10+GrV X-Received: by 2002:a63:e47:: with SMTP id 7-v6mr21850762pgo.320.1539091785997; Tue, 09 Oct 2018 06:29:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539091785; cv=none; d=google.com; s=arc-20160816; b=k2WGzFy7nl+vMut5IsUMNMpDlZEtrS9ksG80Id54HW0BN2a/OB1HV+xQumeWXvxteH HkGx6ltM2S/79lixYfZQY8F+KhodrT7SHIvQ/a3qZzaY+xQQBqO66BvPWqShugNnG9Fk eoFv9pjreMB3lPvyPrB4ZYWPmNUYQxmx4mBBW+GCznUYB4+jgiJGqyIDOsjWZ9FCf+kc HJuU5Zt0oyTn3mCZVTyBrrYicD27jr20HCTmzU/Z1dpac5mcL9JOVX3VTbi5VvqJ41zN ++7FScIrfxGtLhslHySQ8flR4zrsQWSrfxjw4RSVfjqKc4XJlK0xQL3DGwZg8cX65wij JmxA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=qHIt8PU2ghlSSKLAslc/yyxBCNYkuCHyozLkBsIx2aI=; b=St9L9u5urggSiCgmFjOADojqdpBb5DYWndE2adG77oM/zX5b5UtblrbSzPDvpVIWoS coz5hTs2SyMpi8H9kprI9SRrImOdYjVevQNiSDb93BOLBTwzkt7S6Z0Ywp6+tsFYGcHt KcpP2GTiuwiw7ZM81+K7M3zOyr6mG8P09EFFmUvbT3+XGNKtIRYgIQUpr7/zs16dKL0r 1pYK7LvGs7nail10qJyeSB+NPZojjUzkoeAf0A09YR3hyT66Mp0gCYOKxf3CRT9nmkXt qZVqSxvlk83Sn7X1d1kglgwQCpcTjHC5PTTiwOyWHa/FVtMExFYc4wV8ocAk8p6cB/cL mkxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=OUQ35khO; 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 o127-v6si11890419pfb.128.2018.10.09.06.29.31; Tue, 09 Oct 2018 06:29:45 -0700 (PDT) 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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=OUQ35khO; 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 S1727439AbeJIUnJ (ORCPT + 99 others); Tue, 9 Oct 2018 16:43:09 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:49534 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727374AbeJIUnI (ORCPT ); Tue, 9 Oct 2018 16:43:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.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: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=qHIt8PU2ghlSSKLAslc/yyxBCNYkuCHyozLkBsIx2aI=; b=OUQ35khO0MRVkmARK+EPAPDiio UoKONGmkCbN4iVRt5myckpSTUi0gQSvXp7mBkf00cd+z8ObfihkHZtg9jkfOgSCUPvU5wOhduYRZS irqK3vMa2JbeXOE6li3QBYDfaRtv7dBvJHizrG5fAMwIEOvDCw+bbi5f3eCkTPuR7k0iA+XGPdOeP Oer1TgzuziP8S0iKDsxBVoAHn2fZJAWlJjBVHSQVraQUziWNRLVp6TgzLKze3AH3XUT/w16MG5MWj PqqJqoFK1HHkkOs73F2DLekxrbWK9j8gl04lyWUvh7LBzBPjFSPuZeBOHoDlL2FHxOqSr5I6gC6AS 3MewVvGA==; Received: from clnet-p19-102.ikbnet.co.at ([83.175.77.102] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1g9s1D-0001HQ-5k; Tue, 09 Oct 2018 13:25:47 +0000 From: Christoph Hellwig To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linuxppc-dev@lists.ozlabs.org, iommu@lists.linux-foundation.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 18/33] powerpc/dma: stop overriding dma_get_required_mask Date: Tue, 9 Oct 2018 15:24:45 +0200 Message-Id: <20181009132500.17643-19-hch@lst.de> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181009132500.17643-1-hch@lst.de> References: <20181009132500.17643-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The ppc_md and pci_controller_ops methods are unused now and can be removed. The dma_nommu implementation is generic to the generic one except for using max_pfn instead of calling into the memblock API, and all other dma_map_ops instances implement a method of their own. Signed-off-by: Christoph Hellwig --- arch/powerpc/include/asm/device.h | 2 -- arch/powerpc/include/asm/dma-mapping.h | 2 -- arch/powerpc/include/asm/machdep.h | 2 -- arch/powerpc/include/asm/pci-bridge.h | 1 - arch/powerpc/kernel/dma.c | 42 -------------------------- drivers/base/platform.c | 2 -- 6 files changed, 51 deletions(-) diff --git a/arch/powerpc/include/asm/device.h b/arch/powerpc/include/asm/device.h index 1aa53318b4bc..3814e1c2d4bc 100644 --- a/arch/powerpc/include/asm/device.h +++ b/arch/powerpc/include/asm/device.h @@ -59,6 +59,4 @@ struct pdev_archdata { u64 dma_mask; }; -#define ARCH_HAS_DMA_GET_REQUIRED_MASK - #endif /* _ASM_POWERPC_DEVICE_H */ diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/include/asm/dma-mapping.h index 59c090b7eaac..b1999880fc61 100644 --- a/arch/powerpc/include/asm/dma-mapping.h +++ b/arch/powerpc/include/asm/dma-mapping.h @@ -112,7 +112,5 @@ static inline void set_dma_offset(struct device *dev, dma_addr_t off) #define HAVE_ARCH_DMA_SET_MASK 1 extern int dma_set_mask(struct device *dev, u64 dma_mask); -extern u64 __dma_get_required_mask(struct device *dev); - #endif /* __KERNEL__ */ #endif /* _ASM_DMA_MAPPING_H */ diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h index a47de82fb8e2..99f06102474e 100644 --- a/arch/powerpc/include/asm/machdep.h +++ b/arch/powerpc/include/asm/machdep.h @@ -47,9 +47,7 @@ struct machdep_calls { #endif #endif /* CONFIG_PPC64 */ - /* Platform set_dma_mask and dma_get_required_mask overrides */ int (*dma_set_mask)(struct device *dev, u64 dma_mask); - u64 (*dma_get_required_mask)(struct device *dev); int (*probe)(void); void (*setup_arch)(void); /* Optional, may be NULL */ diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h index 5c7a1e7ffc8a..aace7033fa02 100644 --- a/arch/powerpc/include/asm/pci-bridge.h +++ b/arch/powerpc/include/asm/pci-bridge.h @@ -46,7 +46,6 @@ struct pci_controller_ops { #endif int (*dma_set_mask)(struct pci_dev *pdev, u64 dma_mask); - u64 (*dma_get_required_mask)(struct pci_dev *pdev); void (*shutdown)(struct pci_controller *hose); }; diff --git a/arch/powerpc/kernel/dma.c b/arch/powerpc/kernel/dma.c index 716b7eab3ee7..9ca9d2cec4ed 100644 --- a/arch/powerpc/kernel/dma.c +++ b/arch/powerpc/kernel/dma.c @@ -197,18 +197,6 @@ int dma_nommu_map_sg(struct device *dev, struct scatterlist *sgl, return nents; } -static u64 dma_nommu_get_required_mask(struct device *dev) -{ - u64 end, mask; - - end = memblock_end_of_DRAM() + get_dma_offset(dev); - - mask = 1ULL << (fls64(end) - 1); - mask += mask - 1; - - return mask; -} - dma_addr_t dma_nommu_map_page(struct device *dev, struct page *page, unsigned long offset, size_t size, enum dma_data_direction dir, unsigned long attrs) @@ -246,7 +234,6 @@ const struct dma_map_ops dma_nommu_ops = { .map_sg = dma_nommu_map_sg, .dma_supported = dma_nommu_dma_supported, .map_page = dma_nommu_map_page, - .get_required_mask = dma_nommu_get_required_mask, #ifdef CONFIG_NOT_COHERENT_CACHE .sync_single_for_cpu = dma_nommu_sync_single, .sync_single_for_device = dma_nommu_sync_single, @@ -294,35 +281,6 @@ int dma_set_mask(struct device *dev, u64 dma_mask) } EXPORT_SYMBOL(dma_set_mask); -u64 __dma_get_required_mask(struct device *dev) -{ - const struct dma_map_ops *dma_ops = get_dma_ops(dev); - - if (unlikely(dma_ops == NULL)) - return 0; - - if (dma_ops->get_required_mask) - return dma_ops->get_required_mask(dev); - - return DMA_BIT_MASK(8 * sizeof(dma_addr_t)); -} - -u64 dma_get_required_mask(struct device *dev) -{ - if (ppc_md.dma_get_required_mask) - return ppc_md.dma_get_required_mask(dev); - - if (dev_is_pci(dev)) { - struct pci_dev *pdev = to_pci_dev(dev); - struct pci_controller *phb = pci_bus_to_host(pdev->bus); - if (phb->controller_ops.dma_get_required_mask) - return phb->controller_ops.dma_get_required_mask(pdev); - } - - return __dma_get_required_mask(dev); -} -EXPORT_SYMBOL_GPL(dma_get_required_mask); - static int __init dma_init(void) { #ifdef CONFIG_IBMVIO diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 23cf4427f425..057357521561 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c @@ -1179,7 +1179,6 @@ int __init platform_bus_init(void) return error; } -#ifndef ARCH_HAS_DMA_GET_REQUIRED_MASK static u64 dma_default_get_required_mask(struct device *dev) { u32 low_totalram = ((max_pfn - 1) << PAGE_SHIFT); @@ -1208,7 +1207,6 @@ u64 dma_get_required_mask(struct device *dev) return dma_default_get_required_mask(dev); } EXPORT_SYMBOL_GPL(dma_get_required_mask); -#endif static __initdata LIST_HEAD(early_platform_driver_list); static __initdata LIST_HEAD(early_platform_device_list); -- 2.19.0