From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E68BC0755A for ; Mon, 27 Nov 2023 07:14:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232442AbjK0HO3 (ORCPT ); Mon, 27 Nov 2023 02:14:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232434AbjK0HO1 (ORCPT ); Mon, 27 Nov 2023 02:14:27 -0500 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7959C3 for ; Sun, 26 Nov 2023 23:14:33 -0800 (PST) Received: by verein.lst.de (Postfix, from userid 2407) id 3D98568AFE; Mon, 27 Nov 2023 08:14:30 +0100 (CET) Date: Mon, 27 Nov 2023 08:14:30 +0100 From: Christoph Hellwig To: "zhaoyang.huang" Cc: Christoph Hellwig , Marek Szyprowski , Robin Murphy , iommu@lists.linux.dev, linux-kernel@vger.kernel.org, Zhaoyang Huang , steve.kang@unisoc.com Subject: Re: [PATCH] kernel: dma: let dma use vmalloc area Message-ID: <20231127071430.GA28214@lst.de> References: <20231127030930.1074374-1-zhaoyang.huang@unisoc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231127030930.1074374-1-zhaoyang.huang@unisoc.com> User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 27, 2023 at 11:09:30AM +0800, zhaoyang.huang wrote: > From: Zhaoyang Huang > > memremap within dma_init_coherent_memory will map the given phys_addr > into vmalloc area if the pa is not found during iterating iomem_resources, > which conflict the rejection of vmalloc area in dma_map_single_attrs. I can't parse this sentence. > IMO, it is find to let all valid virtual address be valid for DMA as the > user will keep corresponding RAM safe for transfer. No, vmalloc address can't be passed to map_single. You need to pass the page to dma_map_page, and explicitly mange cache consistency using the invalidate_kernel_vmap_range and flush_kernel_vmap_range helpers.