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=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 D7277C2B9F4 for ; Mon, 14 Jun 2021 10:08:25 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 858A3610C8 for ; Mon, 14 Jun 2021 10:08:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 858A3610C8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C899A6B006C; Mon, 14 Jun 2021 06:08:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C60D46B006E; Mon, 14 Jun 2021 06:08:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B04716B0070; Mon, 14 Jun 2021 06:08:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0127.hostedemail.com [216.40.44.127]) by kanga.kvack.org (Postfix) with ESMTP id 7B2676B006C for ; Mon, 14 Jun 2021 06:08:24 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 1114B181AC9B6 for ; Mon, 14 Jun 2021 10:08:24 +0000 (UTC) X-FDA: 78251904528.15.8864234 Received: from mail-oo1-f42.google.com (mail-oo1-f42.google.com [209.85.161.42]) by imf12.hostedemail.com (Postfix) with ESMTP id 4ED3537E for ; Mon, 14 Jun 2021 10:08:12 +0000 (UTC) Received: by mail-oo1-f42.google.com with SMTP id z14-20020a4a984e0000b029024a8c622149so2002522ooi.10 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=WO7KOUCtHxbD4np+tFv+pxPeNCzJmEC1sgKmS/YdNxY4eB0jKtrUSOqL9NTtZ6Jibz tVLh8dd46al/NPMifVOvjUVMBSsN+RmYb382oSchxKYGvjAP+ZkbN7ypTM0fmYDlSa3O xithe5KoYKjYCXE6BY4b6g8d9czzB40W0OYhneF+nQKc6aOseWirqA5EJidUTMQpxaUr 6zw8ITG6KDDjM/+eh/ZYfRxtg+/D4gEMp0MkvoEQIgJCK7kqBCuksfGwfDEY/J6M8vbF ZMX/aUCJARuyYThWlY88YamcYllAuhL5LE8ZRB9VqLo3q11SLWzOgF8UQk8e0nONbCL5 W4/Q== X-Gm-Message-State: AOAM533IR6ZzX2GW2g65bG7pGsngly6vF6R+nDNpSUgPg+jn9BHmp6PN V/DYzNAt+pjnm2rLy3qlwZc+ct+ExHysPxS4hMY= X-Google-Smtp-Source: ABdhPJzT94HAfh7KH1qNLSmqXHnVlpNeuigsQEcfaynhB2GlcMTV+2U8AmlyonkjfOjKcDdy570egAaH81rScRC+Ydg= 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" Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=rNjbdGE1; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf12.hostedemail.com: domain of dongas86@gmail.com designates 209.85.161.42 as permitted sender) smtp.mailfrom=dongas86@gmail.com X-Stat-Signature: jp9zj5qbpn4ief9u7aift1bkp7o8ho7u X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 4ED3537E X-HE-Tag: 1623665292-18088 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 > >