Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp3646663ybg; Fri, 25 Oct 2019 07:04:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqy+jnNCvpK9/0CUQBD2+5aJs0G6Vf/69D/d2kmy2OWK5TEUgLcKjBrxSLirijlN3S9O9+1s X-Received: by 2002:a5d:5388:: with SMTP id d8mr3289106wrv.92.1572012264543; Fri, 25 Oct 2019 07:04:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572012264; cv=none; d=google.com; s=arc-20160816; b=PTHAc4vnAd9KmewVT0gRnWJh3Zva9gKhFQ2oc5rzyvk7stT5EmNRsESwMFjCuR4Jh6 c/YVQJ68iB3bg2wM5h7unzk+z39YVVXYq7zgMXhNFNxRGPPSDIebDro0Gt7gEIMXiKhQ junRWON5N6+cT4pDsYMxjmhXgCQlRT1ixa7v802dviwqZzCZNptdZQAXNpQjIEp3Qp1G FZZyU24XjY0zdqKFYFvkfZtBFoJd716gPjG2hZPMhEpCJPK6KSKIIq3Tg6PiOBb5zSb2 H0zI85DaUeWuEZXsnPBNUdgXrPGGQ93joe3cqAVkogjrcSFwhgZDWSG0UuUfxKYqNnrT TuIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=hROxnBgx4kK6e7imLlW71ty0VmkFU+lMk/hgET/QYIg=; b=EhcSUuyDwn6K4L1pFt8xr1P4p1VKV1/mHM3g4gcLH0f3nmJwSgfIcia8jQyaY1kYbt +ptB4ykhofe2xtXQTDBRtJJPXM46X0V0snUXJ1n/mAonTngylbkREbTmd0AtATQAfE9l 2BrI6hpcNw1j8YXecSo5/2BSYmOLfCg+pbXfHTT6Up4aWZnac3E5AjVY6aNcdJO9hHdo 0lxJqqJPgcSbWoSniGxEA9/ths1zONx6H75kUNDgjV/ci7iRDLvECvM3/DdZ02Rq19Sw /F3TObQHwsQBiJMHwqZZ/JXAQp/nEuu4eAeEYDqBvrW/j6ahSVzCRSIOAfWIYTBPgNUt 8RVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AhLTlEbl; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o7si1353462edc.342.2019.10.25.07.03.48; Fri, 25 Oct 2019 07:04:24 -0700 (PDT) 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=@kernel.org header.s=default header.b=AhLTlEbl; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2409504AbfJXOvS (ORCPT + 99 others); Thu, 24 Oct 2019 10:51:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:57052 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2409497AbfJXOvS (ORCPT ); Thu, 24 Oct 2019 10:51:18 -0400 Received: from mail-qt1-f181.google.com (mail-qt1-f181.google.com [209.85.160.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C3597205F4; Thu, 24 Oct 2019 14:51:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571928676; bh=MEaP5IL/IqooQRDNdNUcu8iypLi1gD3g0148DaXxsOA=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=AhLTlEblswmwrWUsuXYU6je5kiKbSEAz/M0zJZKKJ0DIQ60EIdRbWyrk5REfexOGm Oe4Ph5iPBlOcnF2uQ0YfG5vcfCeB+jCFaTgmE7IuBNtSLI7D7+S483zv39vG/VvGE/ YHxedsM80fsfFCj4chEONOo9lXEDwHlLnhWbiK70= Received: by mail-qt1-f181.google.com with SMTP id m15so38352940qtq.2; Thu, 24 Oct 2019 07:51:16 -0700 (PDT) X-Gm-Message-State: APjAAAXTuaOrKY8k7tl0wIDwXyQaCMwBhzyLj7F6xornI5ysT4P6BTqe SYH84T/DVBWUE0RR7FdLhR1mcEjHRUP+5tJYLQ== X-Received: by 2002:a0c:f792:: with SMTP id s18mr14841198qvn.20.1571928675962; Thu, 24 Oct 2019 07:51:15 -0700 (PDT) MIME-Version: 1.0 References: <20191024142211.GA29467@arm.com> In-Reply-To: <20191024142211.GA29467@arm.com> From: Rob Herring Date: Thu, 24 Oct 2019 09:51:04 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Question regarding "reserved-memory" To: Ayan Halder Cc: Mark Rutland , "devicetree@vger.kernel.org" , "m.szyprowski@samsung.com" , "dri-devel@lists.freedesktop.org" , "linux-kernel@vger.kernel.org" , Liviu Dudau , Mihail Atanassov , "james qian wang (Arm Technology China)" , Brian Starkey , nd Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 24, 2019 at 9:22 AM Ayan Halder wrote: > > > Hi Folks, > > I have a question regarding "reserved-memory". I am using an Arm Juno > platform which has a chunk of ram in its fpga. I intend to make this > memory as reserved so that it can be shared between various devices > for passing framebuffer. > > My dts looks like the following:- > > / { > .... // some nodes > > tlx@60000000 { > compatible = "simple-bus"; > ... > > juno_wrapper { > > ... /* here we have all the nodes */ > /* corresponding to the devices in the fpga */ > > memory@d000000 { > device_type = "memory"; > reg = <0x00 0x60000000 0x00 0x8000000>; > }; > > reserved-memory { > #address-cells = <0x01>; > #size-cells = <0x01>; > ranges; > > framebuffer@d000000 { > compatible = "shared-dma-pool"; > linux,cma-default; > reusable; > reg = <0x00 0x60000000 0x00 0x8000000>; > phandle = <0x44>; > }; > }; > ... > } > } > ... > } > > Note that the depth of the "reserved-memory" node is 3. > > Refer __fdt_scan_reserved_mem() :- > > if (!found && depth == 1 && strcmp(uname, "reserved-memory") == 0) { > > if (__reserved_mem_check_root(node) != 0) { > pr_err("Reserved memory: unsupported node > format, ignoring\n"); > /* break scan */ > return 1; > } > found = 1; > > /* scan next node */ > return 0; > } > > It expects the "reserved-memory" node to be at depth == 1 and so it > does not probe it in our case. > > Niether from the > Documentation/devicetree/bindings/reserved-memory/reserved-memory.txt > nor from commit - e8d9d1f5485b52ec3c4d7af839e6914438f6c285, > I could understand the reason for such restriction. > > So, I seek the community's advice as to whether I should fix up > __fdt_scan_reserved_mem() so as to do away with the restriction or > put the "reserved-memory" node outside of 'tlx@60000000' (which looks > logically incorrect as the memory is on the fpga platform). For now, I'm going to say it must be at the root level. I'd guess the memory@d000000 node is also just ignored (wrong unit-address BTW). I think you're also forgetting the later unflattened parsing of /reserved-memory. The other complication IIRC is booting with UEFI does it's own reserved memory table which often uses the DT table as its source. Rob