From patchwork Mon Jul 30 16:38:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 951189 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41fQgY6XTxz9rxx for ; Tue, 31 Jul 2018 02:55:53 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="Zqpg9hID"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41fQgY4yCqzF0jn for ; Tue, 31 Jul 2018 02:55:53 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="Zqpg9hID"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=bombadil.srs.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=batv+396ebc2d5722fb16c925+5454+infradead.org+hch@bombadil.srs.infradead.org; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="Zqpg9hID"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41fQHy2XdJzF14Y for ; Tue, 31 Jul 2018 02:38:54 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding: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=7rtgTHZEyEA6ntbj2z6+YOgukD6ct33yrti6d/2rxHY=; b=Zqpg9hID2uBI/nuT8Nia9PY3P ehQpZbRGjt/6WCB+0CDQhVbyq7zPv26Sn6/PzL6tEwqfzjjCN2iNzI1YcVpJO27E/9iRChksIT+So vCYfeNuZbGKUwD1Snty1A1m6Wh/41mrIwi6+bcNfdfsVHQveDTQn+9uaWsZTGdAg4VBA/5FfDgtgz Hs/8P6bPDTMzH4fJMBxbMrPJuCszEx3TTdY+iZHzDOGk01c9A7+vmsfBslkYri+buIfL+qsWy1jyF y2TciNK6z+5hEhjo5QbgUvyYtvC51/63jhWJn+khfWDOuhWxcJRxrEoQJb+4BfIJQXeeI3Sn9wNEq JPmbi3Tkw==; 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 1fkBBz-0005cZ-Ny; Mon, 30 Jul 2018 16:38:44 +0000 From: Christoph Hellwig To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Tony Luck , Fenghua Yu Subject: [PATCH 06/20] dma-noncoherent: add an optional arch hook for ->get_required_mask Date: Mon, 30 Jul 2018 18:38:10 +0200 Message-Id: <20180730163824.10064-7-hch@lst.de> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180730163824.10064-1-hch@lst.de> References: <20180730163824.10064-1-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linuxppc-dev@lists.ozlabs.org, iommu@lists.linux-foundation.org, linux-ia64@vger.kernel.org, Robin Murphy , Konrad Rzeszutek Wilk Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" This is need for powerpc for now. Hopefully we can come up with a clean generic implementation mid-term. Signed-off-by: Christoph Hellwig --- include/linux/dma-noncoherent.h | 6 ++++++ kernel/dma/Kconfig | 4 ++++ kernel/dma/noncoherent.c | 1 + 3 files changed, 11 insertions(+) diff --git a/include/linux/dma-noncoherent.h b/include/linux/dma-noncoherent.h index 10b2654d549b..61394c6e56df 100644 --- a/include/linux/dma-noncoherent.h +++ b/include/linux/dma-noncoherent.h @@ -17,6 +17,12 @@ int arch_dma_mmap(struct device *dev, struct vm_area_struct *vma, #define arch_dma_mmap NULL #endif /* CONFIG_DMA_NONCOHERENT_MMAP */ +#ifdef CONFIG_DMA_NONCOHERENT_GET_REQUIRED +u64 arch_get_required_mask(struct device *dev); +#else +#define arch_get_required_mask NULL +#endif + #ifdef CONFIG_DMA_NONCOHERENT_CACHE_SYNC void arch_dma_cache_sync(struct device *dev, void *vaddr, size_t size, enum dma_data_direction direction); diff --git a/kernel/dma/Kconfig b/kernel/dma/Kconfig index 9bd54304446f..b523104d6199 100644 --- a/kernel/dma/Kconfig +++ b/kernel/dma/Kconfig @@ -36,6 +36,10 @@ config DMA_NONCOHERENT_MMAP bool depends on DMA_NONCOHERENT_OPS +config DMA_NONCOHERENT_GET_REQUIRED + bool + depends on DMA_NONCOHERENT_OPS + config DMA_NONCOHERENT_CACHE_SYNC bool depends on DMA_NONCOHERENT_OPS diff --git a/kernel/dma/noncoherent.c b/kernel/dma/noncoherent.c index 79e9a757387f..cf4ffbe4a09d 100644 --- a/kernel/dma/noncoherent.c +++ b/kernel/dma/noncoherent.c @@ -98,5 +98,6 @@ const struct dma_map_ops dma_noncoherent_ops = { .dma_supported = dma_direct_supported, .mapping_error = dma_direct_mapping_error, .cache_sync = arch_dma_cache_sync, + .get_required_mask = arch_get_required_mask, }; EXPORT_SYMBOL(dma_noncoherent_ops);