From: Alistair Delva <adelva@google.com>
To: "Oliver O'Halloran" <oohall@gmail.com>
Cc: Ira Weiny <ira.weiny@intel.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Kenny Root <kroot@google.com>, Rob Herring <robh+dt@kernel.org>,
Dan Williams <dan.j.williams@intel.com>,
Vishal Verma <vishal.l.verma@intel.com>,
Dave Jiang <dave.jiang@intel.com>,
Device Tree <devicetree@vger.kernel.org>,
"linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>,
kernel-team@android.com
Subject: Re: [PATCH 1/2] libnvdimm/of_pmem: handle memory-region in DT
Date: Sun, 23 Feb 2020 17:43:29 -0800 [thread overview]
Message-ID: <CANDihLF8bjOVAypQF-L-h82wcW5OBj4MQZRNRthAoaXPM51gpA@mail.gmail.com> (raw)
In-Reply-To: <CAOSf1CH-WMA5DDt9LKcPPZwb-ya-y=1WCc8mrUEEDMjg0WeX5g@mail.gmail.com>
On Sun, Feb 23, 2020 at 5:42 PM Oliver O'Halloran <oohall@gmail.com> wrote:
>
> On Mon, Feb 24, 2020 at 1:56 AM Ira Weiny <ira.weiny@intel.com> wrote:
> >
> > On Sat, Feb 22, 2020 at 10:30:09AM -0800, Alistair Delva wrote:
> > > From: Kenny Root <kroot@google.com>
> > >
> > > Add support for parsing the 'memory-region' DT property in addition to
> > > the 'reg' DT property. This enables use cases where the pmem region is
> > > not in I/O address space or dedicated memory (e.g. a bootloader
> > > carveout).
> > >
> > > Signed-off-by: Kenny Root <kroot@google.com>
> > > Signed-off-by: Alistair Delva <adelva@google.com>
> > > Cc: "Oliver O'Halloran" <oohall@gmail.com>
> > > Cc: Rob Herring <robh+dt@kernel.org>
> > > Cc: Dan Williams <dan.j.williams@intel.com>
> > > Cc: Vishal Verma <vishal.l.verma@intel.com>
> > > Cc: Dave Jiang <dave.jiang@intel.com>
> > > Cc: Ira Weiny <ira.weiny@intel.com>
> > > Cc: devicetree@vger.kernel.org
> > > Cc: linux-nvdimm@lists.01.org
> > > Cc: kernel-team@android.com
> > > ---
> > > drivers/nvdimm/of_pmem.c | 75 ++++++++++++++++++++++++++--------------
> > > 1 file changed, 50 insertions(+), 25 deletions(-)
> > >
> > > diff --git a/drivers/nvdimm/of_pmem.c b/drivers/nvdimm/of_pmem.c
> > > index 8224d1431ea9..a68e44fb0041 100644
> > > --- a/drivers/nvdimm/of_pmem.c
> > > +++ b/drivers/nvdimm/of_pmem.c
> > > @@ -14,13 +14,47 @@ struct of_pmem_private {
> > > struct nvdimm_bus *bus;
> > > };
> > >
> > > +static void of_pmem_register_region(struct platform_device *pdev,
> > > + struct nvdimm_bus *bus,
> > > + struct device_node *np,
> > > + struct resource *res, bool is_volatile)
> >
> > FWIW it would be easier to review if this was splut into a patch which created
> > the helper of_pmem_register_region() without the new logic. Then added the new
> > logic here.
>
> Yeah, that wouldn't hurt.
>
> *snip*
>
> > > + i = 0;
> > > + while ((mr_np = of_parse_phandle(np, "memory-region", i++))) {
> > > + ret = of_address_to_resource(mr_np, 0, &res);
> > > + if (ret)
> > > + dev_warn(
> > > + &pdev->dev,
> > > + "Unable to acquire memory-region from %pOF: %d\n",
> > > + mr_np, ret);
> > > else
> > > - dev_dbg(&pdev->dev, "Registered region %pR from %pOF\n",
> > > - ndr_desc.res, np);
> > > + of_pmem_register_region(pdev, bus, np, &res,
> > > + is_volatile);
> > > + of_node_put(mr_np);
> >
> > Why of_node_put()?
>
> "memory-region" is an array of pointers to nodes in /reserved-memory/
> which describe the actual memory region. of_parse_phandle() elevates
> the refcount of the returned node and we need to balance that.
That was my understanding too.
Thanks both for the review and sorry for the last minute untested
variable rename! I'll fix both and split the refactoring out in v2.
> >
> > Ira
> > > }
> > >
> > > return 0;
> > > --
> > > 2.25.0.265.gbab2e86ba0-goog
> > >
next prev parent reply other threads:[~2020-02-24 1:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-22 18:30 [PATCH 1/2] libnvdimm/of_pmem: handle memory-region in DT Alistair Delva
2020-02-22 18:30 ` [PATCH 2/2] dt-bindings: pmem-region: Document memory-region Alistair Delva
2020-02-23 14:56 ` [PATCH 1/2] libnvdimm/of_pmem: handle memory-region in DT Ira Weiny
2020-02-24 1:41 ` Oliver O'Halloran
2020-02-24 1:43 ` Alistair Delva [this message]
2020-02-24 1:30 ` Oliver O'Halloran
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CANDihLF8bjOVAypQF-L-h82wcW5OBj4MQZRNRthAoaXPM51gpA@mail.gmail.com \
--to=adelva@google.com \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=devicetree@vger.kernel.org \
--cc=ira.weiny@intel.com \
--cc=kernel-team@android.com \
--cc=kroot@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvdimm@lists.01.org \
--cc=oohall@gmail.com \
--cc=robh+dt@kernel.org \
--cc=vishal.l.verma@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).