Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp568673ybe; Mon, 2 Sep 2019 06:07:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqzQ4j+4jYkvo1Jx+PWP7/x5yY7IFRlZk4rqJ2Kd5eE/phrlmy/JIx8v1ebhs52S5NhJ/fHR X-Received: by 2002:a17:90a:ba04:: with SMTP id s4mr13453751pjr.73.1567429623528; Mon, 02 Sep 2019 06:07:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567429623; cv=none; d=google.com; s=arc-20160816; b=ZHAC88UB6wc1pX+zULchogI2xrtWBcAPh2TXVN1Be0fIclmFRVvML+AFj6cvwjvjWb p+SxikDBCc4qwE17nz2Bk/xjx/a6eSDj7hglDTvGZmjFmn6JaIFUVXihoEKyEXcgChq+ YlVY9s7ric9V71B3JYtsp5X39nEtZTLONpK0EQQ8CehgatwGoM79O2Hm3AcEhgVaMjKs 2ZedpHSc/UNS1cEIESBF0sIMTEq0bnC7M1Uth1nlH12dUlmcYfeAJ3zZWhEsCUK1vUAt D/7m8PjEil1Z9WAoEGiY8V1v6N90C6lB0tACFyzuMC/X/9AizV4Y5lbD7UG4eFoNWBYV OIug== 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=ToLkGG7hwcxGGmygjG5jqhrOLfqqyuWhx32hjXfzR00=; b=ju+NEq4rZOVcddQAgh0R0BiLHyxVry1K/oKb6CYHR5YqEHTsiUxYCBpQlKqMzFEmep ITMjs1u++GMbIzx4SgvMr9t/+PG3A49aH6WtsjaoBEziE1/hqoEwDqj1S7vvvnM56Csn vTOENOtU61ya7TUbm6372ci8nFNKGHW7r6o9M9OCsVhfScZC+oQDkeBlG65FXGx6uQsw eEu4PSZl7V1rYQYLPY6eal4zYP34FnFyr96tiS5Zyb5YYTgSkdmK7+wdZ68mb6Ud/v1d 7YHXn7/hA/kXKdRd5LZZW1VNI9n2pSeGQOGeo1ltpXShPQWGrP93lP9vIyiqav8z/+aM W5Dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=nRpECok3; 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 l13si10223575ply.240.2019.09.02.06.06.47; Mon, 02 Sep 2019 06:07:03 -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=nRpECok3; 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 S1730429AbfIBND7 (ORCPT + 99 others); Mon, 2 Sep 2019 09:03:59 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:36712 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730364AbfIBND4 (ORCPT ); Mon, 2 Sep 2019 09:03:56 -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=ToLkGG7hwcxGGmygjG5jqhrOLfqqyuWhx32hjXfzR00=; b=nRpECok3/eweOrrPhNk5NDe553 cmXyS7OPMtXE3dpV783E5aW6fg39Z311AMoOLuCk8KNamSQ+iiW86P52uMp24wfS+6YDKV3iCwDW/ kaj2zbspGG1rvpP2UHGMPRyO7BsI6n+X01H+Vq8x4SY3Vf2CR9vMeCFLpe20RGfnyKiJC2yJadUQQ yF9vUzqv3FXC59Che4IQ7/SrgSJXdwmFuYDGGG7RNhdWb22NN/4I7WyrH2EHLyhzsC7Sj4h3Y/dtx 28ZvFiUclJHtKvwTi6zIi/AcugVUrvmaEaxSn4pL+Gn2C3Xr1olvbk7eGS6nFY4hZTYrB9qzqLP8m J1tqK+6A==; Received: from [2001:4bb8:18c:1755:c70:4a89:bc61:2] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1i4lzs-0001K3-5C; Mon, 02 Sep 2019 13:03:52 +0000 From: Christoph Hellwig To: Stefano Stabellini , Konrad Rzeszutek Wilk , gross@suse.com, boris.ostrovsky@oracle.com Cc: x86@kernel.org, linux-arm-kernel@lists.infradead.org, xen-devel@lists.xenproject.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Julien Grall Subject: [PATCH 03/13] xen/arm: use dev_is_dma_coherent Date: Mon, 2 Sep 2019 15:03:29 +0200 Message-Id: <20190902130339.23163-4-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190902130339.23163-1-hch@lst.de> References: <20190902130339.23163-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 dma-noncoherent dev_is_dma_coherent helper instead of the home grown variant. Note that both are always initialized to the same value in arch_setup_dma_ops. Signed-off-by: Christoph Hellwig Reviewed-by: Julien Grall Reviewed-by: Stefano Stabellini --- arch/arm/include/asm/dma-mapping.h | 6 ------ arch/arm/xen/mm.c | 12 ++++++------ arch/arm64/include/asm/dma-mapping.h | 9 --------- 3 files changed, 6 insertions(+), 21 deletions(-) diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h index dba9355e2484..bdd80ddbca34 100644 --- a/arch/arm/include/asm/dma-mapping.h +++ b/arch/arm/include/asm/dma-mapping.h @@ -91,12 +91,6 @@ static inline dma_addr_t virt_to_dma(struct device *dev, void *addr) } #endif -/* do not use this function in a driver */ -static inline bool is_device_dma_coherent(struct device *dev) -{ - return dev->archdata.dma_coherent; -} - /** * arm_dma_alloc - allocate consistent memory for DMA * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices diff --git a/arch/arm/xen/mm.c b/arch/arm/xen/mm.c index d33b77e9add3..90574d89d0d4 100644 --- a/arch/arm/xen/mm.c +++ b/arch/arm/xen/mm.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only #include -#include +#include #include #include #include @@ -99,7 +99,7 @@ void __xen_dma_map_page(struct device *hwdev, struct page *page, dma_addr_t dev_addr, unsigned long offset, size_t size, enum dma_data_direction dir, unsigned long attrs) { - if (is_device_dma_coherent(hwdev)) + if (dev_is_dma_coherent(hwdev)) return; if (attrs & DMA_ATTR_SKIP_CPU_SYNC) return; @@ -112,7 +112,7 @@ void __xen_dma_unmap_page(struct device *hwdev, dma_addr_t handle, unsigned long attrs) { - if (is_device_dma_coherent(hwdev)) + if (dev_is_dma_coherent(hwdev)) return; if (attrs & DMA_ATTR_SKIP_CPU_SYNC) return; @@ -123,7 +123,7 @@ void __xen_dma_unmap_page(struct device *hwdev, dma_addr_t handle, void __xen_dma_sync_single_for_cpu(struct device *hwdev, dma_addr_t handle, size_t size, enum dma_data_direction dir) { - if (is_device_dma_coherent(hwdev)) + if (dev_is_dma_coherent(hwdev)) return; __xen_dma_page_dev_to_cpu(hwdev, handle, size, dir); } @@ -131,7 +131,7 @@ void __xen_dma_sync_single_for_cpu(struct device *hwdev, void __xen_dma_sync_single_for_device(struct device *hwdev, dma_addr_t handle, size_t size, enum dma_data_direction dir) { - if (is_device_dma_coherent(hwdev)) + if (dev_is_dma_coherent(hwdev)) return; __xen_dma_page_cpu_to_dev(hwdev, handle, size, dir); } @@ -159,7 +159,7 @@ bool xen_arch_need_swiotlb(struct device *dev, * memory and we are not able to flush the cache. */ return (!hypercall_cflush && (xen_pfn != bfn) && - !is_device_dma_coherent(dev)); + !dev_is_dma_coherent(dev)); } int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order, diff --git a/arch/arm64/include/asm/dma-mapping.h b/arch/arm64/include/asm/dma-mapping.h index bdcb0922a40c..67243255a858 100644 --- a/arch/arm64/include/asm/dma-mapping.h +++ b/arch/arm64/include/asm/dma-mapping.h @@ -18,14 +18,5 @@ static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) return NULL; } -/* - * Do not use this function in a driver, it is only provided for - * arch/arm/mm/xen.c, which is used by arm64 as well. - */ -static inline bool is_device_dma_coherent(struct device *dev) -{ - return dev->dma_coherent; -} - #endif /* __KERNEL__ */ #endif /* __ASM_DMA_MAPPING_H */ -- 2.20.1