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=-10.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,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=unavailable 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 17F4AC2B9F4 for ; Mon, 14 Jun 2021 10:10:00 +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 D4D8E610C8 for ; Mon, 14 Jun 2021 10:09:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D4D8E610C8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.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:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Xq+Zovy32QHjfqm+6qcExc4GB97N5jBCAl8dOCvR0LM=; b=V7n2cz0qWUxv9R diGqMsGqmdJCkmn7tqsJJEVDsQMoNkxqgyBa9LSXm+m3ooxDBUcGYMMAghJAmfHRotqSOkFlX06oG TYXQbnCfkiBjp8BdpNk7TYyhGnUylvdZUG3kft6/NWa6VRvAsiX2ayaiKdT0D2IbqLooMMWC4FOwV eEGpKFce8qFjmBBdciUDURAUYKQWz7anr6e0a19N/A+EJoCpzMe9FQ/BAmGFCKJ2WWs3l63rz0Cvn S7161eQKuS+RKK0IeRjS6hDRFutuJW2ZB4+plXTc5WXtjh9EK2X0q5ZZeL5HJNxMq88PiAGfRptNK dXMqltzUXZpdrCWfgvag==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lsjWA-00DVRd-5k; Mon, 14 Jun 2021 10:08:30 +0000 Received: from mail-oo1-xc2c.google.com ([2607:f8b0:4864:20::c2c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lsjW5-00DVPX-Lh for linux-arm-kernel@lists.infradead.org; Mon, 14 Jun 2021 10:08:27 +0000 Received: by mail-oo1-xc2c.google.com with SMTP id o5-20020a4a2c050000b0290245d6c7b555so2502755ooo.11 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=O7b4SqU4L5H3h7pFj4o/IcMhfHt3gjKxKaNSYgf1ZdaE8x7zYDSYLy1uJggL56aXCC VsPyueRBFS1kg/2ukvW3u+eixkWv8iuLwv/XppbFkHwcHgXMuzm16wIQNUDPKPBfYyGH Ab7w3/kzePDrnCIHpna2hpjoiCRmfewUEyrX+a/VLjHLmWTFkaobAqWU+bwIfwwt9Lht 1k6/o/IzhO1w/qDvTiU3zqN+0ukb8W2UcxbbeOuG2mlgktou29sCHVvUf/U27+k/PT/Y whDIBV/o8g1ipWzkXrWrZnanIX9fVfCky8kw6w33I1YsAMIZYNcXVi7Qx6mwO3LNykx/ CseQ== X-Gm-Message-State: AOAM533DzrkgHIz1+K9ca20ofikYZEnT+nWLFoJ7FtpPz7w29J5uCVFU NF8kZRhrcN/SihxtOks196Ur1Joc7R1Sq+lU1jA= 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210614_030825_733250_F7086EBA X-CRM114-Status: GOOD ( 27.39 ) 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 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 > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel