Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp4865489imm; Tue, 9 Oct 2018 06:28:44 -0700 (PDT) X-Google-Smtp-Source: ACcGV60ZHZgEQxtwgFDiWNA9OUJ823u5MRuJq9E32Y69YVHaxKynsCW0CXFDaRMxeMrIngf3ITDB X-Received: by 2002:a17:902:aa47:: with SMTP id c7-v6mr29390571plr.100.1539091724654; Tue, 09 Oct 2018 06:28:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539091724; cv=none; d=google.com; s=arc-20160816; b=IlgkDtQ91pK9IS49g9Dt1Er835Bqj4uoNm7Mq6w/tE60CwJ/R406gUJlgMRWodsJr7 0nvu8e/nLn5C2j2XxPBBpKexP6THYgJb80SE1ahjMiHS1nvNbLpaLcDYKy3qRIeiPG57 3xSUywIDCMpuYTnUYlwGrM1zqjKupN7vTqDBicRa6qO1BBUAPHxZ188CsZpydb1Bkw8F cmts3gvQQZr+Ipv2MM+ZLADT1O9AT3dpmyIxXXFrgvCpKaSAuq990kSWjlxewlv1zhTD oP6KBTo8fCSJv4GnlH6+Zv5QEVnks9Ngozn1zktjunVA/UkNoYEw3r03Ws2fGr1ZMI1h SA8A== 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=5zhArYVOfpz3UhaczPVMIKMuoMp45C3OR3JQcBbTR4Q=; b=Qff4SjR8RCAQSkdUC1c+QUUlc3028XUsqrqo9MRztRtVoRgtdA+t9ulMFnS0AClXYv PgzDgyRhx8pI1rH5TPDPpyycgRjU7tMSFB4qgxabVXDTb0VcDqcgyQMHn/43hOraAQav DDA1J/yrLMQp1hbDKGtmjGO4iE3boOXh9SKtsI2rP1YR+rzKc8gNAaWBSCzgdBxRDbA8 055MAhMnpCTaD+EMcY0zLM8MZ5ptPZ+K0bmqtidqz/vBqpegvaHtSx5s/gUUj3Pn7HUQ eBSqpOG11j1RSMsoy12Hhxdvy34YDLg6Jl4fsZXs19r0ZbhTXolkjXgs7dIPVfCubLM3 z+dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=PEtGZznv; 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 x3-v6si19991491pgj.425.2018.10.09.06.28.30; Tue, 09 Oct 2018 06:28:44 -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=PEtGZznv; 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 S1727837AbeJIUnb (ORCPT + 99 others); Tue, 9 Oct 2018 16:43:31 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:50434 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727813AbeJIUnb (ORCPT ); Tue, 9 Oct 2018 16:43:31 -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=5zhArYVOfpz3UhaczPVMIKMuoMp45C3OR3JQcBbTR4Q=; b=PEtGZznvqjw8wP1A7IE3s7HgqV Decd25/6zt9jn4oWWFRxPmPK4LgotMOtwUgznAoFNeRbLrz/ug+wyEKCPIcF8WwlxqdyVO59W9yDE SKC/H5Ajlt6IlmlXMXFY/7a5Y06GWXqghS2wIrFZf9/O/IuZf/ay77uUu0cv3mycX3mvSnl8EnBCh gerYHus3pBh9CkGKEgQybx44AxRQ1erJlyA7MM86Ml/ravdyD4DQ3CUa09sY0pCH5LUFYj0o3aKqP IsilkrZNkNMGCo6dspHltDxM3yX7cNLTTb5mVYjMrkf+VCORu/lPswZCu987zHcheUK4F8UI9rvBi QD7c1j/A==; 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-0001Y9-ME; Tue, 09 Oct 2018 13:26:14 +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 28/33] powerpc/dma: use phys_to_dma instead of get_dma_offset Date: Tue, 9 Oct 2018 15:24:55 +0200 Message-Id: <20181009132500.17643-29-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 Use the standard portable helper instead of the powerpc specific one, which is about to go away. Signed-off-by: Christoph Hellwig Acked-by: Benjamin Herrenschmidt --- arch/powerpc/kernel/dma-swiotlb.c | 2 +- arch/powerpc/kernel/dma.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/kernel/dma-swiotlb.c b/arch/powerpc/kernel/dma-swiotlb.c index dba216dd70fd..d33caff8c684 100644 --- a/arch/powerpc/kernel/dma-swiotlb.c +++ b/arch/powerpc/kernel/dma-swiotlb.c @@ -11,7 +11,7 @@ * */ -#include +#include #include #include #include diff --git a/arch/powerpc/kernel/dma.c b/arch/powerpc/kernel/dma.c index 795afe387c91..7f7f3a069b63 100644 --- a/arch/powerpc/kernel/dma.c +++ b/arch/powerpc/kernel/dma.c @@ -6,7 +6,7 @@ */ #include -#include +#include #include #include #include @@ -42,7 +42,7 @@ static u64 __maybe_unused get_pfn_limit(struct device *dev) int dma_nommu_dma_supported(struct device *dev, u64 mask) { #ifdef CONFIG_PPC64 - u64 limit = get_dma_offset(dev) + (memblock_end_of_DRAM() - 1); + u64 limit = phys_to_dma(dev, (memblock_end_of_DRAM() - 1)); /* Limit fits in the mask, we are good */ if (mask >= limit) @@ -100,7 +100,7 @@ void *__dma_nommu_alloc_coherent(struct device *dev, size_t size, return NULL; ret = page_address(page); memset(ret, 0, size); - *dma_handle = __pa(ret) + get_dma_offset(dev); + *dma_handle = phys_to_dma(dev,__pa(ret)); return ret; } @@ -139,7 +139,7 @@ int dma_nommu_map_sg(struct device *dev, struct scatterlist *sgl, int i; for_each_sg(sgl, sg, nents, i) { - sg->dma_address = sg_phys(sg) + get_dma_offset(dev); + sg->dma_address = phys_to_dma(dev, sg_phys(sg)); sg->dma_length = sg->length; if (attrs & DMA_ATTR_SKIP_CPU_SYNC) @@ -158,7 +158,7 @@ dma_addr_t dma_nommu_map_page(struct device *dev, struct page *page, if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC)) __dma_sync_page(page, offset, size, dir); - return page_to_phys(page) + offset + get_dma_offset(dev); + return phys_to_dma(dev, page_to_phys(page)) + offset; } #ifdef CONFIG_NOT_COHERENT_CACHE -- 2.19.0