Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2617759pxj; Mon, 14 Jun 2021 03:09:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzLDvtFxYm1idTQmn1OmDo+boGrn0ESp0O3x+TnzWZM8318khThVrkiyh0Z7pns8UjAdlrT X-Received: by 2002:a17:906:2752:: with SMTP id a18mr9842754ejd.458.1623665390942; Mon, 14 Jun 2021 03:09:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623665390; cv=none; d=google.com; s=arc-20160816; b=bUAkLjZkdkyFhTtG66DoDepM/h2q9gqKUhBIuAexgcwntvp1eK0vKEnZGQQFQex3jK Mr7z+w+UcOZY8jT0MHoPLiZ0Cte0LPMWH8X6KgZgZlba+5xg3uJ4N+0ulwBahyFw9Zxt pDkmbhihN7BQp0QmpDJZlGNteiXzl7SWetuDIC8ZtXbQ5PqFJ6cpb+NREltN7dgXAOOu Pi4uBD7bez/vbEokfaqKN20rqWZlqIcT8AYsF9gvtCL5xENjAHVUa9p1xcUm7j7XJIIt xTBbfSNjissPB0sMZBF4LPqzvwXwgntMZdRBqvTa0Uwpv8JVKuOianhMcy+LXSqhO1oG VO5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=2VU+I2JY7nagoQJLZQjBNcNIb1qYx8IdZde11I0FLps=; b=EVAmIITEZyikfG8HKDo1E5TuagVYqkvgaP4lfallcVMB/nhZw4XDHaBHEJV8AA6VNw jFcDVxrymCTxwTYJY8rxPklZ4Xr0zwOJTrrc8ncfB30oqxXh7nUl4dxtPWUg3Wsw3+S/ KH09B3M53Jy/MYmZ8CMKwa0S3ZnCHdw8H0pivZtCTkTAJdjx6LfN+OhOPZOTY9EzaIpf ZV2zY1szmJSQ84Lp/8H8InQojK7JiRo0iFSFsWF5q45ESQUXOUsoQcZpVUpfLMI3Xbz+ 8bVzKSfbJE6/nGPjipqd/U7zOMAnh4dfWcCQ8/wTPxhL541njJthqQ7mYbGDlm2gRNC1 8onQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rNjbdGE1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bt12si11834732ejb.669.2021.06.14.03.09.27; Mon, 14 Jun 2021 03:09:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rNjbdGE1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232739AbhFNKK3 (ORCPT + 99 others); Mon, 14 Jun 2021 06:10:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232579AbhFNKK1 (ORCPT ); Mon, 14 Jun 2021 06:10:27 -0400 Received: from mail-oo1-xc2f.google.com (mail-oo1-xc2f.google.com [IPv6:2607:f8b0:4864:20::c2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7A09C061574 for ; Mon, 14 Jun 2021 03:08:23 -0700 (PDT) Received: by mail-oo1-xc2f.google.com with SMTP id 67-20020a4a01460000b0290245b81f6261so2514292oor.6 for ; Mon, 14 Jun 2021 03:08:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=2VU+I2JY7nagoQJLZQjBNcNIb1qYx8IdZde11I0FLps=; b=rNjbdGE1R6371RlbKuw0VPLhk0hVt+tVCRj+HwZIWyGIyJmhmjaOFD7SKz++9Kx4gX bikuCAeXdr5XAPh2pkrHHoQwlPN9xvxMdPaA6yopfD9r7KAoh7yqVpRELa+nqS5J4tC3 QegydvRCFFQ3nrKsJEaU2V0YPw1gZyK6Tmiydu7JlsvaqicIg1Bod1OVmLcMmIlxhCbQ 4s0rJ2G1wmaxFcM1kHGmd82ABBRgRm3JmCE0y+H06KHrL5budfoXvEmJ5baAODQr1o8U ColYeKSuvr0YztdKM/VPSsIObiebDsbu0cmjc8sxCk2n4mckaoh68/wyNibGa85Bk5IP VXdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=2VU+I2JY7nagoQJLZQjBNcNIb1qYx8IdZde11I0FLps=; b=mOnLTkqLBveSxB4SEd1yW2xQv93PQ+GB1eZ+Uz/X9bC/6bx4NHhDObc7c7QzB3bM9B 0Qseg9XBls1XE074cUvGLMK2Wv/JE12YjTSzxGrMN9OzVdf+w3IfYko09SB0YnbMGk6L 7CsJ2jn32MGUT0Gzor/olFqutpDPW9TQaxfLPxoxxwsS9StgiMb6MRQ75pd6aSdkxF0J fu0sxqphajNuyGliWW4aCgp8uTghdBpO7sssAoXvRBaK2nBjjjypWQkc5OXNuda365MW V0P7Zlar8XHWx3cN0P3i70DDqUWH1koJAiZ82Fit6DtC+gaZX52HRvWndNn4UmK2N50w vs0A== X-Gm-Message-State: AOAM531sL6Sqyu7uC5UNaTIBSNwycUUXRbvNdo+TsXIhddj/nhbWoxTw 12evozZ1WC3iTJPdlssOyhfXYTE0mui8Z+09fk4= X-Received: by 2002:a4a:e887:: with SMTP id g7mr12530141ooe.64.1623665303198; Mon, 14 Jun 2021 03:08:23 -0700 (PDT) MIME-Version: 1.0 References: <20210611131056.3731084-1-aisheng.dong@nxp.com> <20210614083609.GA18701@willie-the-truck> In-Reply-To: <20210614083609.GA18701@willie-the-truck> From: Dong Aisheng Date: Mon, 14 Jun 2021 18:07:04 +0800 Message-ID: Subject: Re: [PATCH 1/1] dma: coherent: check no-map property for arm64 To: Will Deacon Cc: 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 , Catalin Marinas Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Will, On Mon, Jun 14, 2021 at 4:36 PM Will Deacon wrote: > > [+Catalin] > > 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. 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. Regards Aisheng > Thanks, > > Will > > > > > Cc: Christoph Hellwig > > Cc: Marek Szyprowski > > Cc: Robin Murphy > > Signed-off-by: Dong Aisheng > > --- > > kernel/dma/coherent.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/kernel/dma/coherent.c b/kernel/dma/coherent.c > > index 5b5b6c7ec7f2..d1831da7afba 100644 > > --- a/kernel/dma/coherent.c > > +++ b/kernel/dma/coherent.c > > @@ -356,7 +356,7 @@ static int __init rmem_dma_setup(struct reserved_mem *rmem) > > if (of_get_flat_dt_prop(node, "reusable", NULL)) > > return -EINVAL; > > > > -#ifdef CONFIG_ARM > > +#if defined(CONFIG_ARM) || defined(CONFIG_ARM64) > > if (!of_get_flat_dt_prop(node, "no-map", NULL)) { > > pr_err("Reserved memory: regions without no-map are not yet supported\n"); > > return -EINVAL; > > -- > > 2.25.1 > >