Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2683331yba; Mon, 22 Apr 2019 11:04:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqwa6/uALdL/rCLCqSUYFd9vyWG9Y6Nmg27+Qws+Y5J4rW+ZM1fshTHv4ouGkF1O6xDODmO1 X-Received: by 2002:a17:902:59d7:: with SMTP id d23mr13914128plj.197.1555956288860; Mon, 22 Apr 2019 11:04:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555956288; cv=none; d=google.com; s=arc-20160816; b=oQ8mPveT9lcsjL04h13qE6m1kaZHqBM9OpYFiAKAYYQG1rbs5w5DygriRUxG88/ReY BQvmwy3fsMTQC2O6LwP0wBSVl6oB2YgjQGz7Rjg+oc1rmdIZnkFVSb2E7zAFo2FRTmGR /icM9UXckk1Ou1BtKGnSfcga2aD4V3SJMS2kQJsXMHrxJoWtplyvu8utPE6Yy9l6hfRh K3hUpYO+VIzo0eNyR+liOpx9ikxvB0uPZab0YIi1trqBU1julEL5NMDC6+9YdUQgYjIU 38rXjsf+3J4g1KK1zt2wBYbqvKtRM6qTrYiKbSV3fu6Qqg8sSrIbHwWAFq9/Ua+Utps3 UlSg== 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=Df0F3GJIw856JDj29FbyyhQeVRaUqjwewBc2/XOVfNI=; b=alyF0FmYAEmTCP8m8vhMbAgh2PJp+w3jyi7acx0Y9zJ7c1R5YziDVXe8V/tToi/Ck9 tt8JGg6od8PgeDzMi/RW8h/bt07v67JLbhYcgRlL05r06w0kM/4xN+NkCcmYxt/n75Sf gW6Pqwv23jYqs3Dm9EX4kr2r1PLa72YwXfhPRd/t9pvE4YXADDg7ul7IvmPOHPY9nDu8 MaxsNSLW06AXrwUNXcwALJE33Usgrq5S//YsptzO9IZs30YR6OyO2uFxW+YApErn0zmy UMf8I/RmtAPGTMy4P4izRNLm2/UrmrztDGsuV/B/Ua0Wuzv1y2nKkf/LdRQJHBCCdcv+ woZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=nr6ZGAVT; 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 x21si3767011pgj.351.2019.04.22.11.04.24; Mon, 22 Apr 2019 11:04:48 -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=nr6ZGAVT; 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 S1728419AbfDVSAV (ORCPT + 99 others); Mon, 22 Apr 2019 14:00:21 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:35222 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728275AbfDVSAU (ORCPT ); Mon, 22 Apr 2019 14:00:20 -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=Df0F3GJIw856JDj29FbyyhQeVRaUqjwewBc2/XOVfNI=; b=nr6ZGAVTVFVW5vlEKbql7I5NYh fFtFDmQzkfxB5Ar7bHPJJ3Q/nvTCEF4ad6zGtoX8q5zRaDCM2yJ7rhlDcP5uBQV8kf4N5FdC6gHBn DW0sYOVZj+2pa+d0D4eZQCmVEMGXWDcNi15Yl9fboxGOrhkoeL1rt5mIi4b09RrShY+lC6q2OuqoI yxGOE9vLmIcYEatdbA2xMCCvWQahYtnHYb/GbhgMQzQNWQT8ZOH1GqipIfIjmxp3br76PrOYxC37z pIgPOn+9yaFsQ2D2QzvlyYmfbuoAFCTi2KgPmhS23mub7hinBR3fBZfHSHfVlq9zyYuX5UuP6KV0m c5+6ts1Q==; 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 1hIdEl-0001Tt-P9; Mon, 22 Apr 2019 18:00:16 +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 03/26] dma-mapping: add a Kconfig symbol to indicated arch_dma_prep_coherent presence Date: Mon, 22 Apr 2019 19:59:19 +0200 Message-Id: <20190422175942.18788-4-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 Add a Kconfig symbol that indicates an architecture provides a arch_dma_prep_coherent implementation, and provide a stub otherwise. This will allow the generic dma-iommu code to use it while still allowing to be built for cache coherent architectures. Signed-off-by: Christoph Hellwig Reviewed-by: Robin Murphy --- arch/arm64/Kconfig | 1 + arch/csky/Kconfig | 1 + include/linux/dma-noncoherent.h | 6 ++++++ kernel/dma/Kconfig | 3 +++ 4 files changed, 11 insertions(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 7e34b9eba5de..adda078d6df7 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -13,6 +13,7 @@ config ARM64 select ARCH_HAS_DEVMEM_IS_ALLOWED select ARCH_HAS_DMA_COHERENT_TO_PFN select ARCH_HAS_DMA_MMAP_PGPROT + select ARCH_HAS_DMA_PREP_COHERENT select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI select ARCH_HAS_ELF_RANDOMIZE select ARCH_HAS_FAST_MULTIPLIER diff --git a/arch/csky/Kconfig b/arch/csky/Kconfig index 725a115759c9..2c3178848b7d 100644 --- a/arch/csky/Kconfig +++ b/arch/csky/Kconfig @@ -1,6 +1,7 @@ config CSKY def_bool y select ARCH_32BIT_OFF_T + select ARCH_HAS_DMA_PREP_COHERENT select ARCH_HAS_SYNC_DMA_FOR_CPU select ARCH_HAS_SYNC_DMA_FOR_DEVICE select ARCH_USE_BUILTIN_BSWAP diff --git a/include/linux/dma-noncoherent.h b/include/linux/dma-noncoherent.h index 69b36ed31a99..9741767e400f 100644 --- a/include/linux/dma-noncoherent.h +++ b/include/linux/dma-noncoherent.h @@ -72,6 +72,12 @@ static inline void arch_sync_dma_for_cpu_all(struct device *dev) } #endif /* CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU_ALL */ +#ifdef CONFIG_ARCH_HAS_DMA_PREP_COHERENT void arch_dma_prep_coherent(struct page *page, size_t size); +#else +static inline void arch_dma_prep_coherent(struct page *page, size_t size) +{ +} +#endif /* CONFIG_ARCH_HAS_DMA_PREP_COHERENT */ #endif /* _LINUX_DMA_NONCOHERENT_H */ diff --git a/kernel/dma/Kconfig b/kernel/dma/Kconfig index a06ba3013b3b..feff2d21d8ee 100644 --- a/kernel/dma/Kconfig +++ b/kernel/dma/Kconfig @@ -38,6 +38,9 @@ config ARCH_HAS_SYNC_DMA_FOR_CPU config ARCH_HAS_SYNC_DMA_FOR_CPU_ALL bool +config ARCH_HAS_DMA_PREP_COHERENT + bool + config ARCH_HAS_DMA_COHERENT_TO_PFN bool -- 2.20.1