diff mbox

[RESEND,v2,3/4] doc/devicetree: Persistent memory region bindings

Message ID 20180403142415.30083-3-oohall@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Oliver O'Halloran April 3, 2018, 2:24 p.m. UTC
Add device-tree binding documentation for the nvdimm region driver.

Cc: devicetree@vger.kernel.org
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
v2: Changed name from nvdimm-region to pmem-region.
    Cleaned up the example binding and fixed the overlapping regions.
    Added support for multiple regions in a single reg.
---
 .../devicetree/bindings/pmem/pmem-region.txt       | 80 ++++++++++++++++++++++
 MAINTAINERS                                        |  1 +
 2 files changed, 81 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pmem/pmem-region.txt

Comments

Dan Williams April 3, 2018, 5:37 p.m. UTC | #1
On Tue, Apr 3, 2018 at 7:24 AM, Oliver O'Halloran <oohall@gmail.com> wrote:
> Add device-tree binding documentation for the nvdimm region driver.
>
> Cc: devicetree@vger.kernel.org
> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
> ---
> v2: Changed name from nvdimm-region to pmem-region.
>     Cleaned up the example binding and fixed the overlapping regions.
>     Added support for multiple regions in a single reg.
> ---
>  .../devicetree/bindings/pmem/pmem-region.txt       | 80 ++++++++++++++++++++++
>  MAINTAINERS                                        |  1 +
>  2 files changed, 81 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/pmem/pmem-region.txt

Device-tree folks, does this look, ok?

Oliver, is there any concept of a management interface to the
device(s) backing these regions? libnvdimm calls these "nmem" devices
and support operations like health status and namespace label
management.
Education Directorate April 4, 2018, 12:07 p.m. UTC | #2
On Tue, 3 Apr 2018 10:37:51 -0700
Dan Williams <dan.j.williams@intel.com> wrote:

> On Tue, Apr 3, 2018 at 7:24 AM, Oliver O'Halloran <oohall@gmail.com> wrote:
> > Add device-tree binding documentation for the nvdimm region driver.
> >
> > Cc: devicetree@vger.kernel.org
> > Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
> > ---
> > v2: Changed name from nvdimm-region to pmem-region.
> >     Cleaned up the example binding and fixed the overlapping regions.
> >     Added support for multiple regions in a single reg.
> > ---
> >  .../devicetree/bindings/pmem/pmem-region.txt       | 80 ++++++++++++++++++++++
> >  MAINTAINERS                                        |  1 +
> >  2 files changed, 81 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/pmem/pmem-region.txt  
> 
> Device-tree folks, does this look, ok?
> 
> Oliver, is there any concept of a management interface to the
> device(s) backing these regions? libnvdimm calls these "nmem" devices
> and support operations like health status and namespace label
> management.

We would need a way to have nmem and pmem-regions find each other. Since we
don't have the ACPI abstractions, the nmem region would need to add the
ability for a driver to have a phandle to the interleaving and nmem properties.

I guess that would be a separate driver, that would manage the nmem devices
and there would be a way to relate the pmem and nmems. Oliver?

Balbir Singh.
Oliver O'Halloran April 4, 2018, 2:04 p.m. UTC | #3
On Wed, Apr 4, 2018 at 10:07 PM, Balbir Singh <bsingharora@gmail.com> wrote:
> On Tue, 3 Apr 2018 10:37:51 -0700
> Dan Williams <dan.j.williams@intel.com> wrote:
>
>> On Tue, Apr 3, 2018 at 7:24 AM, Oliver O'Halloran <oohall@gmail.com> wrote:
>> > Add device-tree binding documentation for the nvdimm region driver.
>> >
>> > Cc: devicetree@vger.kernel.org
>> > Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
>> > ---
>> > v2: Changed name from nvdimm-region to pmem-region.
>> >     Cleaned up the example binding and fixed the overlapping regions.
>> >     Added support for multiple regions in a single reg.
>> > ---
>> >  .../devicetree/bindings/pmem/pmem-region.txt       | 80 ++++++++++++++++++++++
>> >  MAINTAINERS                                        |  1 +
>> >  2 files changed, 81 insertions(+)
>> >  create mode 100644 Documentation/devicetree/bindings/pmem/pmem-region.txt
>>
>> Device-tree folks, does this look, ok?
>>
>> Oliver, is there any concept of a management interface to the
>> device(s) backing these regions? libnvdimm calls these "nmem" devices
>> and support operations like health status and namespace label
>> management.

It's something I'm planning on implementing as soon as someone gives
me some hardware that isn't hacked up lab crap. I'm posting this
version with just regions since people have been asking for something
in upstream even if it's not fully featured.

Grumbling aside, the plan is to have separate drivers for the DIMM
type. Discovering DIMM devices happens via the normal discovery
mechanisms (e.g. an NVDIMM supporting the JEDEC interface is an I2C
device) and when binding to a specific DIMM device it registers a DIMM
descriptor structure and a ndctl implementation for that DIMM type
with of_pmem. When of_pmem binds to a region it can plug everything
into the region specific bus. There's a few details to work out, but I
think it's a reasonable approach.

> We would need a way to have nmem and pmem-regions find each other. Since we
> don't have the ACPI abstractions, the nmem region would need to add the
> ability for a driver to have a phandle to the interleaving and nmem properties.
>
> I guess that would be a separate driver, that would manage the nmem devices
> and there would be a way to relate the pmem and nmems. Oliver?

Yes, that's the plan.
Dan Williams April 4, 2018, 2:21 p.m. UTC | #4
On Wed, Apr 4, 2018 at 7:04 AM, Oliver <oohall@gmail.com> wrote:
> On Wed, Apr 4, 2018 at 10:07 PM, Balbir Singh <bsingharora@gmail.com> wrote:
>> On Tue, 3 Apr 2018 10:37:51 -0700
>> Dan Williams <dan.j.williams@intel.com> wrote:
>>
>>> On Tue, Apr 3, 2018 at 7:24 AM, Oliver O'Halloran <oohall@gmail.com> wrote:
>>> > Add device-tree binding documentation for the nvdimm region driver.
>>> >
>>> > Cc: devicetree@vger.kernel.org
>>> > Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
>>> > ---
>>> > v2: Changed name from nvdimm-region to pmem-region.
>>> >     Cleaned up the example binding and fixed the overlapping regions.
>>> >     Added support for multiple regions in a single reg.
>>> > ---
>>> >  .../devicetree/bindings/pmem/pmem-region.txt       | 80 ++++++++++++++++++++++
>>> >  MAINTAINERS                                        |  1 +
>>> >  2 files changed, 81 insertions(+)
>>> >  create mode 100644 Documentation/devicetree/bindings/pmem/pmem-region.txt
>>>
>>> Device-tree folks, does this look, ok?
>>>
>>> Oliver, is there any concept of a management interface to the
>>> device(s) backing these regions? libnvdimm calls these "nmem" devices
>>> and support operations like health status and namespace label
>>> management.
>
> It's something I'm planning on implementing as soon as someone gives
> me some hardware that isn't hacked up lab crap. I'm posting this
> version with just regions since people have been asking for something
> in upstream even if it's not fully featured.
>
> Grumbling aside, the plan is to have separate drivers for the DIMM
> type. Discovering DIMM devices happens via the normal discovery
> mechanisms (e.g. an NVDIMM supporting the JEDEC interface is an I2C
> device) and when binding to a specific DIMM device it registers a DIMM
> descriptor structure and a ndctl implementation for that DIMM type
> with of_pmem. When of_pmem binds to a region it can plug everything
> into the region specific bus. There's a few details to work out, but I
> think it's a reasonable approach.

Yeah, that sounds reasonable. It would mean that your management
interface would need to understand that nmems on different buses could
potentially move to another bus after a reconfiguration, but that's
not too much different than the ACPI case where nmems can join and
leave regions after a reset / reconfig.

>> We would need a way to have nmem and pmem-regions find each other. Since we
>> don't have the ACPI abstractions, the nmem region would need to add the
>> ability for a driver to have a phandle to the interleaving and nmem properties.
>>
>> I guess that would be a separate driver, that would manage the nmem devices
>> and there would be a way to relate the pmem and nmems. Oliver?
>
> Yes, that's the plan.

So Balbir, is that enough for an Acked-by for this device-tree proposal?
Education Directorate April 5, 2018, 4:43 a.m. UTC | #5
On Wed, 4 Apr 2018 07:21:32 -0700
Dan Williams <dan.j.williams@intel.com> wrote:

> On Wed, Apr 4, 2018 at 7:04 AM, Oliver <oohall@gmail.com> wrote:
> > On Wed, Apr 4, 2018 at 10:07 PM, Balbir Singh <bsingharora@gmail.com> wrote:  
> >> On Tue, 3 Apr 2018 10:37:51 -0700
> >> Dan Williams <dan.j.williams@intel.com> wrote:
> >>  
> >>> On Tue, Apr 3, 2018 at 7:24 AM, Oliver O'Halloran <oohall@gmail.com> wrote:  
> >>> > Add device-tree binding documentation for the nvdimm region driver.
> >>> >
> >>> > Cc: devicetree@vger.kernel.org
> >>> > Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
> >>> > ---
> >>> > v2: Changed name from nvdimm-region to pmem-region.
> >>> >     Cleaned up the example binding and fixed the overlapping regions.
> >>> >     Added support for multiple regions in a single reg.
> >>> > ---
> >>> >  .../devicetree/bindings/pmem/pmem-region.txt       | 80 ++++++++++++++++++++++
> >>> >  MAINTAINERS                                        |  1 +
> >>> >  2 files changed, 81 insertions(+)
> >>> >  create mode 100644 Documentation/devicetree/bindings/pmem/pmem-region.txt  
> >>>
> >>> Device-tree folks, does this look, ok?
> >>>
> >>> Oliver, is there any concept of a management interface to the
> >>> device(s) backing these regions? libnvdimm calls these "nmem" devices
> >>> and support operations like health status and namespace label
> >>> management.  
> >
> > It's something I'm planning on implementing as soon as someone gives
> > me some hardware that isn't hacked up lab crap. I'm posting this
> > version with just regions since people have been asking for something
> > in upstream even if it's not fully featured.
> >
> > Grumbling aside, the plan is to have separate drivers for the DIMM
> > type. Discovering DIMM devices happens via the normal discovery
> > mechanisms (e.g. an NVDIMM supporting the JEDEC interface is an I2C
> > device) and when binding to a specific DIMM device it registers a DIMM
> > descriptor structure and a ndctl implementation for that DIMM type
> > with of_pmem. When of_pmem binds to a region it can plug everything
> > into the region specific bus. There's a few details to work out, but I
> > think it's a reasonable approach.  
> 
> Yeah, that sounds reasonable. It would mean that your management
> interface would need to understand that nmems on different buses could
> potentially move to another bus after a reconfiguration, but that's
> not too much different than the ACPI case where nmems can join and
> leave regions after a reset / reconfig.
> 
> >> We would need a way to have nmem and pmem-regions find each other. Since we
> >> don't have the ACPI abstractions, the nmem region would need to add the
> >> ability for a driver to have a phandle to the interleaving and nmem properties.
> >>
> >> I guess that would be a separate driver, that would manage the nmem devices
> >> and there would be a way to relate the pmem and nmems. Oliver?  
> >
> > Yes, that's the plan.  
> 
> So Balbir, is that enough for an Acked-by for this device-tree proposal?

I don't see any major problems with the binding, but I think Oliver wanted
to send in a few clarifications based on a private discussion.

Balbir Singh.
Oliver O'Halloran April 5, 2018, 11:34 a.m. UTC | #6
On Thu, Apr 5, 2018 at 12:21 AM, Dan Williams <dan.j.williams@intel.com> wrote:
> On Wed, Apr 4, 2018 at 7:04 AM, Oliver <oohall@gmail.com> wrote:
>> On Wed, Apr 4, 2018 at 10:07 PM, Balbir Singh <bsingharora@gmail.com> wrote:
>>> On Tue, 3 Apr 2018 10:37:51 -0700
>>> Dan Williams <dan.j.williams@intel.com> wrote:
>>>
>>>> On Tue, Apr 3, 2018 at 7:24 AM, Oliver O'Halloran <oohall@gmail.com> wrote:
>>>> > Add device-tree binding documentation for the nvdimm region driver.
>>>> >
>>>> > Cc: devicetree@vger.kernel.org
>>>> > Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
>>>> > ---
>>>> > v2: Changed name from nvdimm-region to pmem-region.
>>>> >     Cleaned up the example binding and fixed the overlapping regions.
>>>> >     Added support for multiple regions in a single reg.
>>>> > ---
>>>> >  .../devicetree/bindings/pmem/pmem-region.txt       | 80 ++++++++++++++++++++++
>>>> >  MAINTAINERS                                        |  1 +
>>>> >  2 files changed, 81 insertions(+)
>>>> >  create mode 100644 Documentation/devicetree/bindings/pmem/pmem-region.txt
>>>>
>>>> Device-tree folks, does this look, ok?
>>>>
>>>> Oliver, is there any concept of a management interface to the
>>>> device(s) backing these regions? libnvdimm calls these "nmem" devices
>>>> and support operations like health status and namespace label
>>>> management.
>>
>> It's something I'm planning on implementing as soon as someone gives
>> me some hardware that isn't hacked up lab crap. I'm posting this
>> version with just regions since people have been asking for something
>> in upstream even if it's not fully featured.
>>
>> Grumbling aside, the plan is to have separate drivers for the DIMM
>> type. Discovering DIMM devices happens via the normal discovery
>> mechanisms (e.g. an NVDIMM supporting the JEDEC interface is an I2C
>> device) and when binding to a specific DIMM device it registers a DIMM
>> descriptor structure and a ndctl implementation for that DIMM type
>> with of_pmem. When of_pmem binds to a region it can plug everything
>> into the region specific bus. There's a few details to work out, but I
>> think it's a reasonable approach.
>
> Yeah, that sounds reasonable. It would mean that your management
> interface would need to understand that nmems on different buses could
> potentially move to another bus after a reconfiguration, but that's
> not too much different than the ACPI case where nmems can join and
> leave regions after a reset / reconfig.
>
>>> We would need a way to have nmem and pmem-regions find each other. Since we
>>> don't have the ACPI abstractions, the nmem region would need to add the
>>> ability for a driver to have a phandle to the interleaving and nmem properties.
>>>
>>> I guess that would be a separate driver, that would manage the nmem devices
>>> and there would be a way to relate the pmem and nmems. Oliver?
>>
>> Yes, that's the plan.
>
> So Balbir, is that enough for an Acked-by for this device-tree proposal?

For context Balbir is working with me on some of the pmem stuff. You
probably want an Ack from Rob rather than one of us.
Michael Ellerman April 5, 2018, 12:11 p.m. UTC | #7
Oliver <oohall@gmail.com> writes:
...
>
> For context Balbir is working with me on some of the pmem stuff. You
> probably want an Ack from Rob rather than one of us.

I'll ack it if you make all the niggly nit picky trivial annoying
changes I asked for :D

cheers
Oliver O'Halloran April 5, 2018, 12:43 p.m. UTC | #8
On Thu, Apr 5, 2018 at 10:11 PM, Michael Ellerman <mpe@ellerman.id.au> wrote:
> Oliver <oohall@gmail.com> writes:
> ...
>>
>> For context Balbir is working with me on some of the pmem stuff. You
>> probably want an Ack from Rob rather than one of us.
>
> I'll ack it if you make all the niggly nit picky trivial annoying
> changes I asked for :D

*groan*

Fine, I'll respin it tomorrow. If anyone else has comments now would
be the time to make them.

>
> cheers
Dan Williams April 5, 2018, 2:43 p.m. UTC | #9
On Thu, Apr 5, 2018 at 5:43 AM, Oliver <oohall@gmail.com> wrote:
> On Thu, Apr 5, 2018 at 10:11 PM, Michael Ellerman <mpe@ellerman.id.au> wrote:
>> Oliver <oohall@gmail.com> writes:
>> ...
>>>
>>> For context Balbir is working with me on some of the pmem stuff. You
>>> probably want an Ack from Rob rather than one of us.
>>
>> I'll ack it if you make all the niggly nit picky trivial annoying
>> changes I asked for :D
>
> *groan*
>
> Fine, I'll respin it tomorrow. If anyone else has comments now would
> be the time to make them.

Please also include my niggly nit picky trivial annoying bike shed
color for the driver name to *not* use the "nd_region" suffix for a
driver registering "nvdimm_bus" objects. "of_pmem_range" or
"of_pmem_bus" or almost anything else would be fine.
Oliver O'Halloran April 6, 2018, 2:14 a.m. UTC | #10
On Fri, Apr 6, 2018 at 12:43 AM, Dan Williams <dan.j.williams@intel.com> wrote:
> On Thu, Apr 5, 2018 at 5:43 AM, Oliver <oohall@gmail.com> wrote:
>> On Thu, Apr 5, 2018 at 10:11 PM, Michael Ellerman <mpe@ellerman.id.au> wrote:
>>> Oliver <oohall@gmail.com> writes:
>>> ...
>>>>
>>>> For context Balbir is working with me on some of the pmem stuff. You
>>>> probably want an Ack from Rob rather than one of us.
>>>
>>> I'll ack it if you make all the niggly nit picky trivial annoying
>>> changes I asked for :D
>>
>> *groan*
>>
>> Fine, I'll respin it tomorrow. If anyone else has comments now would
>> be the time to make them.
>
> Please also include my niggly nit picky trivial annoying bike shed
> color for the driver name to *not* use the "nd_region" suffix for a
> driver registering "nvdimm_bus" objects. "of_pmem_range" or
> "of_pmem_bus" or almost anything else would be fine.

Oh sure, would using of_pmem_region to match the compatible be ok?
Dan Williams April 6, 2018, 2:25 a.m. UTC | #11
On Thu, Apr 5, 2018 at 7:14 PM, Oliver <oohall@gmail.com> wrote:
>
> On Fri, Apr 6, 2018 at 12:43 AM, Dan Williams <dan.j.williams@intel.com> wrote:
> > On Thu, Apr 5, 2018 at 5:43 AM, Oliver <oohall@gmail.com> wrote:
> >> On Thu, Apr 5, 2018 at 10:11 PM, Michael Ellerman <mpe@ellerman.id.au> wrote:
> >>> Oliver <oohall@gmail.com> writes:
> >>> ...
> >>>>
> >>>> For context Balbir is working with me on some of the pmem stuff. You
> >>>> probably want an Ack from Rob rather than one of us.
> >>>
> >>> I'll ack it if you make all the niggly nit picky trivial annoying
> >>> changes I asked for :D
> >>
> >> *groan*
> >>
> >> Fine, I'll respin it tomorrow. If anyone else has comments now would
> >> be the time to make them.
> >
> > Please also include my niggly nit picky trivial annoying bike shed
> > color for the driver name to *not* use the "nd_region" suffix for a
> > driver registering "nvdimm_bus" objects. "of_pmem_range" or
> > "of_pmem_bus" or almost anything else would be fine.
>
> Oh sure, would using of_pmem_region to match the compatible be ok?

That works for me.
Benjamin Herrenschmidt April 6, 2018, 3:57 a.m. UTC | #12
On Thu, 2018-04-05 at 19:25 -0700, Dan Williams wrote:
> > > Please also include my niggly nit picky trivial annoying bike shed
> > > color for the driver name to *not* use the "nd_region" suffix for a
> > > driver registering "nvdimm_bus" objects. "of_pmem_range" or
> > > "of_pmem_bus" or almost anything else would be fine.
> > 
> > Oh sure, would using of_pmem_region to match the compatible be ok?
> 
> That works for me.

The prefix "of" is not generally used in matching properties,...

my own pot of paint :)

Cheers,
Ben.
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/pmem/pmem-region.txt b/Documentation/devicetree/bindings/pmem/pmem-region.txt
new file mode 100644
index 000000000000..de48dc8cd562
--- /dev/null
+++ b/Documentation/devicetree/bindings/pmem/pmem-region.txt
@@ -0,0 +1,80 @@ 
+Device-tree bindings for persistent memory regions
+-----------------------------------------------------
+
+Persistent memory refers to a class of memory devices that are:
+
+	a) Usable as main system memory (i.e. cacheable), and
+	b) Retain their contents across power failure.
+
+Given b) it is best to think of persistent memory as a kind of memory mapped
+storage device. To ensure data integrity the operating system needs to manage
+persistent regions separately to the normal memory pool. To aid with that this
+binding provides a standardised interface for discovering where persistent
+memory regions exist inside the physical address space.
+
+Bindings for the region nodes:
+-----------------------------
+
+Required properties:
+	- compatible = "pmem-region"
+
+	- reg = <base, size>;
+		The system physical address range of this nvdimm region.
+
+		If the reg property contains multiple address ranges
+		each address range will be treated as though it was specified
+		in a separate device node. Having multiple address ranges in a
+		node implies no special relationship between the two ranges.
+
+Optional properties:
+	- Any relevant NUMA assocativity properties for the target platform.
+
+	- A "volatile" property indicating that this region is actually in
+	  normal DRAM and does not require cache flushes after each write.
+
+	  If this property is absent then the OS must assume that the region
+	  is backed by non-volatile memory.
+
+A complete example:
+--------------------
+
+Here we define three 4KB regions:
+
+	a) A volatile region at 0x5000 on numa node 0,
+	b) A non-volatile region at 0x6000, and
+	c) A non-volatile region at 0x8000.
+
+/dts-v1/;
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	platform {
+		compatible = "simple-bus";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges;
+
+		/*
+		 * This node specifies one non-volatile region spanning from
+		 * 0x5000 to 0x5fff.
+		 */
+		pmem@5000 {
+			compatible = "pmem-region";
+			reg = <0x00005000 0x00001000>;
+			numa-node-id = <0>;
+			volatile;
+		};
+
+		/*
+		 * This node specifies two 4KB regions that are backed by
+		 * volatile (normal) memory.
+		 */
+		pmem@6000 {
+			compatible = "pmem-region";
+			reg = <0x00006000 0x00001000 0x00008000 0x00001000>;
+		};
+	};
+};
+
diff --git a/MAINTAINERS b/MAINTAINERS
index 6ef38be700e8..fa3c9211d6ff 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -8041,6 +8041,7 @@  L:	linux-nvdimm@lists.01.org
 Q:	https://patchwork.kernel.org/project/linux-nvdimm/list/
 S:	Supported
 F:	drivers/nvdimm/of_pmem.c
+F:	Documentation/devicetree/bindings/pmem/pmem-region.txt
 
 LIBNVDIMM: NON-VOLATILE MEMORY DEVICE SUBSYSTEM
 M:	Dan Williams <dan.j.williams@intel.com>