Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2734437yba; Mon, 22 Apr 2019 11:59:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqydm1lOgI6aU/VQf2RHwHkCe97eeRDADVpk5YJ0YHeQb8qEdcYT5bTRnCXbunbiQs0vJ+0S X-Received: by 2002:a17:902:e508:: with SMTP id ck8mr21739323plb.96.1555959574507; Mon, 22 Apr 2019 11:59:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555959574; cv=none; d=google.com; s=arc-20160816; b=et3tIMCtIClW6LjhRm3WBVIojCCQ9Av3rCTqBm5igX/AxTMpBVILL0P4ReyZ9GJ84D mH1wHa9mN+AqTcUznBZQ02NE76VMb8sHqanh5yKT2zUtwnB4oxd97+zxap63CtrHAMl6 Ya07Ei+ejMmpBwHGFuXHtRAdHbSxj7g4pLKoWWlT9bIYypDIhlTSAPWjujmDpgu6njQb KpPDvz9ynqppH7X7bUwvk7zZM+s4ny+LGO+7LAvnk+gE9nBXFjwEBgpYuB0yOHlDL1pU g1UusPPo+ynt+w6y6kWt10C8ODYEI7lAP+RTdcqRDlnMB+GrsPI2jpffAdU0Cti6qVdF Xx/A== 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=+jMzZFOPfJnFL4vOsXlyyPeK+em3M78tdAFmKUySwbc=; b=b4y1ZnWru9uXWazihrqYvJqoMZsPWIqF+DCz4CU19PHbMIOkDtHzIoDSVPvg3KGttX HIyi2Qx4ufy/fg54AROIlZQJa0jrlqGY9LclZDhG3RTI8n0uqKiKLNOt8RKFzNtlDBoC TjrD8sVJt2pqKrrrGrNI+4ZD2eAnoqWfx216mZqvEmN/PEknksZtwpNDwf8DH2apKw68 yj8YRy663J8bwh3xTAsi1HIgWznll6AnrDfJcrKvwUukQvrrFtJCcEcWxFTKGN0AGWR5 wi1C7OsecYdeCQD4L4bgpoKYTFxDHiSjpU8ciRnmPgDl9D4UP9AXlBmbDXBUd8JZxhGM J1aA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=AYl7tOE6; 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 f1si6037989pgj.369.2019.04.22.11.59.18; Mon, 22 Apr 2019 11:59:34 -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=AYl7tOE6; 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 S1728447AbfDVSA0 (ORCPT + 99 others); Mon, 22 Apr 2019 14:00:26 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:35494 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726132AbfDVSAY (ORCPT ); Mon, 22 Apr 2019 14:00:24 -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=+jMzZFOPfJnFL4vOsXlyyPeK+em3M78tdAFmKUySwbc=; b=AYl7tOE6zZsPgM5+LAGBugalG6 sNzI+wsiWJacXnjHtMxUoiaC6/jDFcwzWfbMzorM4ZoxwWjXcf5Z6dR8+OXk5au+vjnmZnc25LxBe UPfm4cxeImvTddGEWABl1gS9yQsB7ZDbdBjx8OZeOdaX1ETPKnCG9oFwzHUHCxeWo4PZaP08uWDMJ 4cGXEq/4u887eksFk5cwCmkuXITccwSKjCxNEYHP8x68I2PixvnaSybMjsf3bwH3pQBBPfRO6zm/d 69MW0XZ5oeFlAdoamGTg1/SY8tQqVsadTeLPWxGQAvqpXqJI6XWTknFwPJ1hP26eRfhVjcht5mkCe 3nO0SQuA==; Received: from 213-225-37-80.nat.highway.a1.net ([213.225.37.80] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hIdEq-0001af-MG; Mon, 22 Apr 2019 18:00:21 +0000 From: Christoph Hellwig To: Robin Murphy Cc: Joerg Roedel , Catalin Marinas , Will Deacon , Tom Lendacky , iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 05/26] iommu/dma: Remove the flush_page callback Date: Mon, 22 Apr 2019 19:59:21 +0200 Message-Id: <20190422175942.18788-6-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190422175942.18788-1-hch@lst.de> References: <20190422175942.18788-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 --- 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 604c638b2787..636fa7c64370 100644 --- a/arch/arm64/mm/dma-mapping.c +++ b/arch/arm64/mm/dma-mapping.c @@ -94,12 +94,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) @@ -176,7 +170,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 77aabe637a60..77d704c8f565 100644 --- a/drivers/iommu/dma-iommu.c +++ b/drivers/iommu/dma-iommu.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -531,8 +532,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. @@ -541,8 +540,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; @@ -586,7 +584,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 8741637941ca..3216447178a7 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