Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4707869yba; Mon, 20 May 2019 02:16:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqzfDeal0xLPqNfVb71azuKSfkZ/26fAdbqJvztLEUrnNRbeSw1ZGJD+BqTzqPbIuDGBxx1c X-Received: by 2002:aa7:951c:: with SMTP id b28mr60452934pfp.99.1558343784359; Mon, 20 May 2019 02:16:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558343784; cv=none; d=google.com; s=arc-20160816; b=JV/uwdMf3rINg9LIGGaD3PLk2sqBcnlStD8iSB23y7P8IQNFCrfYueWBZwFOpb/Mn6 hroRS1KLT39WvkH3dUuOAAH1aJtvWcAzv27xvO2/Q2O615Zt6xD3v+Ip/5WToCjq2pdS eYR9/vvSbAuOtB3iLjcFasOiP1iAauhX3Hq05qtcYPJYaGuNyqAlcmdey8vx/gxjEpTJ E3Z0J08LKKsWj09eYBunThFbslo7BBmNeNv3R2ZRPiAsqcnBJXf4mupNZZLF4UzfA/iu kZ4+xNsAZJuA/2dCajXyVA6+H7TqsFddrmQFtmPmQRvwU/Ro7JdUWW0tBFifF3gDqikO 5P3A== 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=1A0CYmcWhvy+wKWSP4NfkY1WYeE32cXUa3720dOqw2s=; b=aHww67KAj4OJmizfRWWNUynshwzeLtsbOqt44ZYKtf0zHuAPDlPzfnHZM238nWVBAd jy7bbLfVgGQ33cjUWLyCHNuMQ54Po1oQYZnaFVCNRsji3w0tz1EM1MkkWZUGti6IPD0F TzGWIia1izL+qF6fYHsEcDRZT4DpZ2md2HL5tpJkfrx42NgwgSSNRewJzfs/DthlI0JG t83d1tm2ZFtgVpdHmcQatg81lZYJZ34C45cAw1hCvCSn8mlnh/uD0CqzIL0J+28d5ECQ 1sOs/qaK0i05FW0WW8+muTbqRQsrEAPc42L7LnBizjRPyl0iMpbAU2wOqLSDnZqnGFpB 9g+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=ZqoDgKnp; 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 p14si17410690plq.318.2019.05.20.02.16.08; Mon, 20 May 2019 02:16:24 -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=ZqoDgKnp; 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 S1730766AbfETHa5 (ORCPT + 99 others); Mon, 20 May 2019 03:30:57 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:42518 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730563AbfETHaz (ORCPT ); Mon, 20 May 2019 03:30:55 -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=1A0CYmcWhvy+wKWSP4NfkY1WYeE32cXUa3720dOqw2s=; b=ZqoDgKnpNSoOLRPJRgoXZ0xiDw 72WtofO5FCpkfkoyO8xSWDh1fomjrasHJTCiS9LBJ7OtU0nP/xEji2ip8Jurk3z++rZzIy+9NTAKh GU/4fGQ+NYCNPCx2KIO47KxL8eO20uNEXRYdSQE8U36HWPYrp4Wcnc8SFANAV1EJaXTjxK4EPKI2/ G2Pcy/GI0+RMe767czhqJgAi270YXAjlGH6+dmWgLaM1e0sH4R/hiL3QMYUw95FJyvr1BnTTRtwwa wt5LcVSTnC/hOwb6vwZljqWVd1YdnwfT4RiaHKG9Igx2TsENFZXoyGvNnQ3vddk9wbWiuN9k8Du1P Y+8ocWQw==; Received: from 089144206147.atnat0015.highway.bob.at ([89.144.206.147] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hSckx-0003ld-Mz; Mon, 20 May 2019 07:30:48 +0000 From: Christoph Hellwig To: Robin Murphy Cc: Joerg Roedel , Catalin Marinas , Will Deacon , Tom Murphy , iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 03/24] iommu/dma: Remove the flush_page callback Date: Mon, 20 May 2019 09:29:27 +0200 Message-Id: <20190520072948.11412-4-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520072948.11412-1-hch@lst.de> References: <20190520072948.11412-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 We now have a arch_dma_prep_coherent architecture hook that is used for the generic DMA remap allocator, and we should use the same interface for the dma-iommu code. Signed-off-by: Christoph Hellwig Reviewed-by: Robin Murphy Acked-by: Catalin Marinas --- arch/arm64/mm/dma-mapping.c | 8 +------- drivers/iommu/dma-iommu.c | 8 +++----- include/linux/dma-iommu.h | 3 +-- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c index 674860e3e478..10a8852c8b6a 100644 --- a/arch/arm64/mm/dma-mapping.c +++ b/arch/arm64/mm/dma-mapping.c @@ -104,12 +104,6 @@ arch_initcall(arm64_dma_init); #include #include -/* Thankfully, all cache ops are by VA so we can ignore phys here */ -static void flush_page(struct device *dev, const void *virt, phys_addr_t phys) -{ - __dma_flush_area(virt, PAGE_SIZE); -} - static void *__iommu_alloc_attrs(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp, unsigned long attrs) @@ -186,7 +180,7 @@ static void *__iommu_alloc_attrs(struct device *dev, size_t size, struct page **pages; pages = iommu_dma_alloc(dev, iosize, gfp, attrs, ioprot, - handle, flush_page); + handle); if (!pages) return NULL; diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index 129c4badf9ae..aac12433ffef 100644 --- a/drivers/iommu/dma-iommu.c +++ b/drivers/iommu/dma-iommu.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -560,8 +561,6 @@ void iommu_dma_free(struct device *dev, struct page **pages, size_t size, * @attrs: DMA attributes for this allocation * @prot: IOMMU mapping flags * @handle: Out argument for allocated DMA handle - * @flush_page: Arch callback which must ensure PAGE_SIZE bytes from the - * given VA/PA are visible to the given non-coherent device. * * If @size is less than PAGE_SIZE, then a full CPU page will be allocated, * but an IOMMU which supports smaller pages might not map the whole thing. @@ -570,8 +569,7 @@ void iommu_dma_free(struct device *dev, struct page **pages, size_t size, * or NULL on failure. */ struct page **iommu_dma_alloc(struct device *dev, size_t size, gfp_t gfp, - unsigned long attrs, int prot, dma_addr_t *handle, - void (*flush_page)(struct device *, const void *, phys_addr_t)) + unsigned long attrs, int prot, dma_addr_t *handle) { struct iommu_domain *domain = iommu_get_dma_domain(dev); struct iommu_dma_cookie *cookie = domain->iova_cookie; @@ -615,7 +613,7 @@ struct page **iommu_dma_alloc(struct device *dev, size_t size, gfp_t gfp, */ sg_miter_start(&miter, sgt.sgl, sgt.orig_nents, SG_MITER_FROM_SG); while (sg_miter_next(&miter)) - flush_page(dev, miter.addr, page_to_phys(miter.page)); + arch_dma_prep_coherent(miter.page, PAGE_SIZE); sg_miter_stop(&miter); } diff --git a/include/linux/dma-iommu.h b/include/linux/dma-iommu.h index dfb83f9c24dc..e1ef265b578b 100644 --- a/include/linux/dma-iommu.h +++ b/include/linux/dma-iommu.h @@ -44,8 +44,7 @@ int dma_info_to_prot(enum dma_data_direction dir, bool coherent, * the arch code to take care of attributes and cache maintenance */ struct page **iommu_dma_alloc(struct device *dev, size_t size, gfp_t gfp, - unsigned long attrs, int prot, dma_addr_t *handle, - void (*flush_page)(struct device *, const void *, phys_addr_t)); + unsigned long attrs, int prot, dma_addr_t *handle); void iommu_dma_free(struct device *dev, struct page **pages, size_t size, dma_addr_t *handle); -- 2.20.1