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 X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 871F8C2B9F4 for ; Mon, 14 Jun 2021 14:53:11 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4D89360FE5 for ; Mon, 14 Jun 2021 14:53:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4D89360FE5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=lZdMEgZlXKgswe+YulYNfD+sK4TOu7lxbZzOo5oa69I=; b=2B3tkOoK+v8tTk +QGe0mi2GK3CU9luF/ZRtEaDKN5MYVH80i4GnR8PFtWUvVojuzHpwoyHRi3Nyj/r7L90+QsXdAHI2 DAQdlouAfQgGt+BEwXnj5n5xceJQ9z2yPvBJuuAG/ATC6vlcw03tQ2ZL5/G+ZY1gLj9aKeZfs10KY s7pebOc7zUvxZG1wBNAZ9r3HJAzewPZGAn3Dfj8NcEimTAOLnXJ7OUtJoUQhLYiPpnFRP8X96ZYsU qhTYms8QkdAaHIfK96tUgH0vizCefrU2k9wjaE3QF+1mQUvikkHnhcRGuv9tUy/FHGBvn+XcO2UyL KubQrRkEsNAIELZi2Llg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lsnvp-00EbzG-HC; Mon, 14 Jun 2021 14:51:17 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lsnvi-00EbxF-2A for linux-arm-kernel@lists.infradead.org; Mon, 14 Jun 2021 14:51:13 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id A31186128C; Mon, 14 Jun 2021 14:51:07 +0000 (UTC) Date: Mon, 14 Jun 2021 15:51:05 +0100 From: Catalin Marinas To: Dong Aisheng Cc: Will Deacon , Dong Aisheng , iommu@lists.linux-foundation.org, open list , linux-mm@kvack.org, "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" , Christoph Hellwig , Marek Szyprowski , Robin Murphy Subject: Re: [PATCH 1/1] dma: coherent: check no-map property for arm64 Message-ID: <20210614145105.GC30667@arm.com> References: <20210611131056.3731084-1-aisheng.dong@nxp.com> <20210614083609.GA18701@willie-the-truck> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210614_075110_171238_9D1367CF X-CRM114-Status: GOOD ( 28.43 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Jun 14, 2021 at 06:07:04PM +0800, Dong Aisheng wrote: > On Mon, Jun 14, 2021 at 4:36 PM Will Deacon wrote: > > On Fri, Jun 11, 2021 at 09:10:56PM +0800, Dong Aisheng wrote: > > > Coherent dma on ARM64 also can't work with mapped system ram, > > > that means 'no-map' property must be specified in dts. > > > Add the missing check for ARM64 platforms as well. > > > Besides 'no-map' checking, 'linux,dma-default' feature is also > > > enabled for ARM64 along with this patch. > > > > Please can you explain _why_ it can't work? We don't need to tear down > > aliases from the linear map for the streaming DMA API, so why is this > > case different? Also, coherent devices wouldn't need this either way, > > would they? What problem are you solving here? > > > > Not sure if i get your point correctly. Here is my understanding. (fix > me if wrong) > In current implementation, the coherent dma memory will be remapped as > writecombine and uncached type which can't reuse the linear mapping. > The prerequisite to do this is the memory must not be mapped System RAM. > e.g. reserved memory with no-map property and invisible to the buddy system. The architecture allows the system RAM to be mapped in the linear map while there's another writecombine alias, as long as there are no dirty cache lines that could be evicted randomly. This works fine with the DMA API (and we have some cache maintenance when the non-cacheable mapping is first created). Looking at the rmem_dma_device_init() -> dma_init_coherent_memory(), it ends up calling memremap(MEMREMAP_WC) which would warn if it intersects with system RAM regardless of the architecture. If the memory region is nomap, it doesn't end up as IORESOURCE_SYSTEM_RAM, so memremap() won't warn. But why is this specific only to arm (or arm64)? Is the "shared-dma-pool" property only meant for Normal Non-cacheable memory (hence the MEMREMAP_WC flag)? If a system is fully cache coherent, does this check still make sense or the DT is not supposed to have such nodes? > This seems a little different from CMA which the memory is still > underlying managed by the buddy system in order to support migration. > > The patch here does not resolve a real issue but just open the sanity check for > ARM64 case as well as ARM which reports the issue a little bit earlier at > rmem_dma_setup() time. I think we first need to figure out what the real issue is and then try to solve it. -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel