Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp976428ybl; Fri, 10 Jan 2020 09:52:25 -0800 (PST) X-Google-Smtp-Source: APXvYqzLNkkcQFDO1lPFEo4V3ymN/vKvcukFcL/a/CMdMAO4LRgOKDMMguuRlUNcEMycfywTg4SA X-Received: by 2002:a05:6830:2099:: with SMTP id y25mr3364338otq.87.1578678745883; Fri, 10 Jan 2020 09:52:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578678745; cv=none; d=google.com; s=arc-20160816; b=SskJG3qDw8wuh0n/scPP1p1vqPONHWuSePpAVWLGeWAptf1aV5rpJXJitxqKQ5+S5L f/MVjnHkRM6IV67e06Kw0hizgsNAiIugKxGxY4eCx2YBia2f945GOVwc23U6hUfU8EZy oVlJHHHdI5iOrmpuwAcVesebHBMBZPl5+lKXR12+Kr9rlKw1QlrdCOQDYdxAcm3bhZqR F3ZSXrRkB0zZhNNE04L8JejYwYbs504TJqBgWl8ItOXv7E5gAfqfaKVZKwHnvqekCLbJ geHiO+3oGhjqgIm1T8Svd7R9ijwaO8vHneLc1Bnsr+gZGypgpPLFiGT3kCw4k0QQ6plb IQyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :dkim-signature; bh=VmrJ62al7CSJqDnZbgM4IQGS6w64QwkkFSJjUF2T67A=; b=Eu+akJv9ZmJA20Qf473nW+Ca9uVVIxgWORN8FUflmsZTygyCOk5EN0F+AemJAxtaOL ym5iBlaMjAG2jnZuCI0d4ENdVfgpHODBsOP4HfCFwd/+haHXHUx8XCKXLL18+HX+VX7S biPIyI+5V7v6tcOl6Yj89N1g9NgDeCyctymPR0TV1CJrKKegIw6mWwjy6L5AiYTAdo3A XXtuNVtRy1A99ks+0KJl2+1HHZnJVmRo/kP8EKe76SKgtZ16H+LsK9AgtBGmnv0JCDYv p8yEbMLKFggTrPk9+2bs4LhEaYDDDvu7b3+Rm0W+J2Lp4scEa66SLNa+69FMi2dugmZI huUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@raspberrypi.org header.s=pp header.b=bnG0n5CN; dkim=pass header.i=@raspberrypi.org header.s=google header.b=a3TmIFfN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=raspberrypi.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y140si1464226oia.49.2020.01.10.09.52.14; Fri, 10 Jan 2020 09:52:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@raspberrypi.org header.s=pp header.b=bnG0n5CN; dkim=pass header.i=@raspberrypi.org header.s=google header.b=a3TmIFfN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=raspberrypi.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728570AbgAJRuC (ORCPT + 99 others); Fri, 10 Jan 2020 12:50:02 -0500 Received: from mx07-00252a01.pphosted.com ([62.209.51.214]:8468 "EHLO mx07-00252a01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728486AbgAJRuB (ORCPT ); Fri, 10 Jan 2020 12:50:01 -0500 X-Greylist: delayed 806 seconds by postgrey-1.27 at vger.kernel.org; Fri, 10 Jan 2020 12:49:59 EST Received: from pps.filterd (m0102628.ppops.net [127.0.0.1]) by mx07-00252a01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 00AHYixs006123 for ; Fri, 10 Jan 2020 17:36:32 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.org; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=pp; bh=VmrJ62al7CSJqDnZbgM4IQGS6w64QwkkFSJjUF2T67A=; b=bnG0n5CNWRLpdwoBy0ZppXxnMv+lNIZF0QOpWYqODOU2OrFw+gMiIYtQnEXo2UMQMinC UlGooeJTWUGbtYbhG/Oy5gD6ZvEp8tXD09mYXqTub4S79hg6ILj5zruS8D2bvyJ2JU4O j4Cd3pbfdrI/xPCq1+1v8ItnaLad7WR2TDCvw4pJ/BxdaDcUBf5OEziwDqrII62morBh aDu91ZXp8bHzwcnIC9bDehykeSGSoV+r2gbvT45OFZ7hi1iRQjJLkRORPFN3AU4XGkel LyP+rMx2XgULCsGqJPYY1dGFnVD6NiHcMZ7GW0Phdo0v4QY73tYq/CrxXfFVV+DhgN9h fQ== Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by mx07-00252a01.pphosted.com with ESMTP id 2xah08u1a8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK) for ; Fri, 10 Jan 2020 17:36:32 +0000 Received: by mail-wm1-f70.google.com with SMTP id p2so1120479wma.3 for ; Fri, 10 Jan 2020 09:36:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=VmrJ62al7CSJqDnZbgM4IQGS6w64QwkkFSJjUF2T67A=; b=a3TmIFfNvj4nYPFfMcdti6+6y11Xg4eEdOHhKxwUmJ8oYyMjA6U9KxONMotcplKM8C CZ/hcWsj0dvzLWXnc7WSG+MHyxNY9g/qcmZvauM6yq+7RDn4CMMYZMnEuccMdZKCgn5O gkDGb20Yg3UeemE1aB5DuJRncTCp2vopjmP4xDc8Of/k9QRKkXuFBP3BcqxpnksQdNY6 n9jYSTeC2OXIFLlauIQTzrHY+3fKFAeFI4k19oCqaGc/AeLvFXX55SO218Fsph8eC5OF wHVhdxXufcBfIgRYa1jPpaTPu1pHEfIzwpUx1oYk8CEoQgJshFiTQSp62u7fXW1vm+Jw Pe/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=VmrJ62al7CSJqDnZbgM4IQGS6w64QwkkFSJjUF2T67A=; b=P7ALkOkepkYgJLgSsnh8rkY0Z0vzeRpiAvlzO3anxbXSFg1c4uFyYdHVF84JFp189u U7GYoUrprwFSGaySx2l7/vjZ+JBgb9qsPqm3rRXQI7PHJJMRMQpuPW1C54t8oaUGCWVU nmDJimF3CIePRrMK4JF3PkGR0EeAR4OV5OsLD6pVsotbYWOMRfgZTylOITGQ/FAQR0YS jsy3EHymnUKA7RbEPG+AL0+lVvpHvXOM2CS0K1LDT2jD+8ehV3WGWmnEcTQRlS13t+D0 6f2pgfo14fGtv/pUEesdulCzltK/hm1WlnqQka4aDn6kcyTC9LwOaxSkO2n30zkH5LJ0 HqaA== X-Gm-Message-State: APjAAAXgFA56hWGDHC3zpddP0C1oUqW2IrS/4zGsvQjYAmYgjaPT136P Muz+zhMG8UImN3eFb2gtiEQtnDStE3fKqWLRhRImwVFsEJUIsDjmcX9JE625IiVcPuUVKZ4YPK6 aBYm7+dTjxZIJvQ2hIA6xygVU X-Received: by 2002:a1c:730d:: with SMTP id d13mr5439679wmb.126.1578677791645; Fri, 10 Jan 2020 09:36:31 -0800 (PST) X-Received: by 2002:a1c:730d:: with SMTP id d13mr5439668wmb.126.1578677791447; Fri, 10 Jan 2020 09:36:31 -0800 (PST) Received: from ?IPv6:2a00:1098:3142:14:910a:522a:cf5c:edd0? ([2a00:1098:3142:14:910a:522a:cf5c:edd0]) by smtp.gmail.com with ESMTPSA id f1sm3134788wmc.45.2020.01.10.09.36.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 10 Jan 2020 09:36:30 -0800 (PST) Subject: Re: [PATCH] dma-contiguous: CMA: give precedence to cmdline To: Nicolas Saenz Julienne , Christoph Hellwig , Marek Szyprowski , Robin Murphy Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org References: <20200110171933.15014-1-nsaenzjulienne@suse.de> From: Phil Elwell Message-ID: <7ae5bad5-eee6-407f-bfa1-aff34f1a0550@raspberrypi.org> Date: Fri, 10 Jan 2020 17:36:30 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 MIME-Version: 1.0 In-Reply-To: <20200110171933.15014-1-nsaenzjulienne@suse.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.572 definitions=2020-01-10_01:2020-01-10,2020-01-09 signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Nicolas, On 10/01/2020 17:19, Nicolas Saenz Julienne wrote: > Although the device tree might contain a reserved-memory DT node > dedicated as the default CMA pool, users might want to change CMA's > parameters using the kernel command line for debugging purposes and > whatnot. Honor this by bypassing the reserved memory CMA setup, which > will ultimately end up freeing the memblock and allow the command line > CMA configuration routine to run. > > Signed-off-by: Nicolas Saenz Julienne > --- > > NOTE: Tested this on arm and arm64 with the Raspberry Pi 4. > > kernel/dma/contiguous.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/kernel/dma/contiguous.c b/kernel/dma/contiguous.c > index daa4e6eefdde..8bc6f2d670f9 100644 > --- a/kernel/dma/contiguous.c > +++ b/kernel/dma/contiguous.c > @@ -302,9 +302,16 @@ static int __init rmem_cma_setup(struct reserved_mem *rmem) > phys_addr_t align = PAGE_SIZE << max(MAX_ORDER - 1, pageblock_order); > phys_addr_t mask = align - 1; > unsigned long node = rmem->fdt_node; > + bool default_cma = of_get_flat_dt_prop(node, "linux,cma-default", NULL); > struct cma *cma; > int err; > > + if (size_cmdline != -1 && default_cma) { > + pr_info("Reserved memory: bypass %s node, using cmdline CMA params instead\n", > + rmem->name); > + return -EBUSY; > + } > + > if (!of_get_flat_dt_prop(node, "reusable", NULL) || > of_get_flat_dt_prop(node, "no-map", NULL)) > return -EINVAL; > @@ -322,7 +329,7 @@ static int __init rmem_cma_setup(struct reserved_mem *rmem) > /* Architecture specific contiguous memory fixup. */ > dma_contiguous_early_fixup(rmem->base, rmem->size); > > - if (of_get_flat_dt_prop(node, "linux,cma-default", NULL)) > + if (default_cma) > dma_contiguous_set_default(cma); > > rmem->ops = &rmem_cma_ops; > For what it's worth, Reviewed-by: Phil Elwell Phil