Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp4864196imm; Tue, 9 Oct 2018 06:27:40 -0700 (PDT) X-Google-Smtp-Source: ACcGV633YWDOtVTb6T6DCefBblXxBYqeTzFGeJV80yVXcMvskC57s5rRpjl2i9JJY4MBcE0T4OR7 X-Received: by 2002:a17:902:2e83:: with SMTP id r3-v6mr29130324plb.80.1539091660060; Tue, 09 Oct 2018 06:27:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539091660; cv=none; d=google.com; s=arc-20160816; b=v3cTbGFQFJPyWaaqSKr5MKKnGfBoSUwC0UqW4jBhaCs5RomwsudsTeqJrjPglK21jQ oajwwSwL965wIvWc8PvcfjSK/dgee1GYOL/lOs0t1LHtijdUBJAb3byT53M4zmh8A78A frJ/EdOqJti8+1p+XQQwdLiG6ZWSJ73CCDOBSMgxIvA7M705wP37rEj1+axitDSPsQe7 KYOU05e0wz4ftJHwzVuvLXuG4HFn3WMpfcliihimSWMOWzqzO3KWzYXOzCutSRXDmPJ/ /qrN8zfw9GL1PZ5a9QyW3j5lI/aE3qz0wHg6zCZkI08eczfuSs3Mty/vrrEc4J6TVW5o aKiQ== 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=0a3Usd7jISHTGQntO/3u9QFE1XioH+LvsPG+jqWFCRw=; b=oH+BiNAdbOTuKr8Fwc4k6xEqMYvs052jnq447bNdDMqeZf16L/Vf7SW7uc3Y/SRWJw P8cxS7G26/ry/np/rZIeBk+syeFpDZL8SaqPYzISAMxFuv+bzI/Ib2A3iJhurPe0sy0o DHFHqUPoMT4LMtilSv0NIiU5cQ5vo9eibaqRJYF2Zxf4VopTNEIfut1Z4yUwU5pOWxo4 SrxiSPUKgPMASNVvU8fxGciXlvwOyXHmAygMpuZb2JjBr0RMbDnlfx9gRGfu09isnyvE L82JM+goqHPBmVTL0yg1MUvaMIbBtrdoWuNAtPHoc6U58epSLtM5ngMTjTgLWbN1Z3kC vl5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=eDYizs2X; 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 j30-v6si17454974pgl.4.2018.10.09.06.27.25; Tue, 09 Oct 2018 06:27:40 -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=eDYizs2X; 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 S1727882AbeJIUnd (ORCPT + 99 others); Tue, 9 Oct 2018 16:43:33 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:50494 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727002AbeJIUnc (ORCPT ); Tue, 9 Oct 2018 16:43:32 -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=0a3Usd7jISHTGQntO/3u9QFE1XioH+LvsPG+jqWFCRw=; b=eDYizs2Xcd5TrD/sOO26KGAHiv OUMKqDL3TKwqnqPEvYkhQj3NeBiVzC8WaY1/SQV5Twiij5ZbZD66jlOEAf98dAH+K37FyNYWGlJwo 4Ps62LlJgN+MUKAEyCEl7rC/xRb9HEbmiwprcGpQZpWnJaj0p9xuKgrobTJBpounX5xjYSKHWu7sm WLTIoBf1e6I6ctKR7hTKwcE9BC+1dOWTAzM238wpoK5VoJQL45yrGYcos547K+dWkuNH6WKggk6c5 IT10ZxJecfQwnxgoTxGilho39M7pUX+wJZ/72l33cs2gsBux6OzamTM+Wu84g40giU4pt9dtL8l8i n+7WOvnA==; 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 1g9s1g-0001aC-Eb; Tue, 09 Oct 2018 13:26:16 +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 29/33] powerpc/dma: remove get_dma_offset Date: Tue, 9 Oct 2018 15:24:56 +0200 Message-Id: <20181009132500.17643-30-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 Just fold the calculation into __phys_to_dma/__dma_to_phys as those are the only places that should know about it. Signed-off-by: Christoph Hellwig Acked-by: Benjamin Herrenschmidt --- arch/powerpc/include/asm/dma-direct.h | 8 ++++++-- arch/powerpc/include/asm/dma-mapping.h | 16 ---------------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/arch/powerpc/include/asm/dma-direct.h b/arch/powerpc/include/asm/dma-direct.h index 92d8aed86422..a2912b47102c 100644 --- a/arch/powerpc/include/asm/dma-direct.h +++ b/arch/powerpc/include/asm/dma-direct.h @@ -13,11 +13,15 @@ static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size) static inline dma_addr_t __phys_to_dma(struct device *dev, phys_addr_t paddr) { - return paddr + get_dma_offset(dev); + if (!dev) + return paddr + PCI_DRAM_OFFSET; + return paddr + dev->archdata.dma_offset; } static inline phys_addr_t __dma_to_phys(struct device *dev, dma_addr_t daddr) { - return daddr - get_dma_offset(dev); + if (!dev) + return daddr - PCI_DRAM_OFFSET; + return daddr - dev->archdata.dma_offset; } #endif /* ASM_POWERPC_DMA_DIRECT_H */ diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/include/asm/dma-mapping.h index 7694985f05ee..2d0879b0acf3 100644 --- a/arch/powerpc/include/asm/dma-mapping.h +++ b/arch/powerpc/include/asm/dma-mapping.h @@ -87,22 +87,6 @@ static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) return NULL; } -/* - * get_dma_offset() - * - * Get the dma offset on configurations where the dma address can be determined - * from the physical address by looking at a simple offset. Direct dma and - * swiotlb use this function, but it is typically not used by implementations - * with an iommu. - */ -static inline dma_addr_t get_dma_offset(struct device *dev) -{ - if (dev) - return dev->archdata.dma_offset; - - return PCI_DRAM_OFFSET; -} - static inline void set_dma_offset(struct device *dev, dma_addr_t off) { if (dev) -- 2.19.0