Skip to contentSkip to conversation

libnvdimm: Update persistence domain value for of_pmem and papr_scm device

PATCH In review Aneesh Kumar K.V 2 participants 2 messages Mar 24, 2020 – Mar 31, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 libnvdimm: Update persistence domain value for of_pmem and papr_scm device

Currently, kernel shows the below values
"persistence_domain":"cpu_cache"
"persistence_domain":"memory_controller"
"persistence_domain":"unknown"

"cpu_cache" indicates no extra instructions is needed to ensure the persistence of data in the pmem media on power failure.

"memory_controller" indicates cpu cache flush instructions are required to flush the data. Platform provides mechanisms to automatically flush outstanding write data from memory controler to pmem on system power loss.

Based on the above use memory_controller for non volatile regions on ppc64.

---
Changes from V1:
* update commit message and retain ADR details in comment

 arch/powerpc/platforms/pseries/papr_scm.c | 4 +++-
 drivers/nvdimm/of_pmem.c                  | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)
arch/powerpc/platforms/pseries/papr_scm.c +3 -1
index 0b4467e378e5..922a4fc3b61b 100644
@@ -361,8 +361,10 @@ static int papr_scm_nvdimm_init(struct papr_scm_priv *p)
 
 	if (p->is_volatile)
 		p->region = nvdimm_volatile_region_create(p->bus, &ndr_desc);
-	else
+	else {
+		set_bit(ND_REGION_PERSIST_MEMCTRL, &ndr_desc.flags);
 		p->region = nvdimm_pmem_region_create(p->bus, &ndr_desc);
+	}
 	if (!p->region) {
 		dev_err(dev, "Error registering region %pR from %pOF\n",
 				ndr_desc.res, p->dn);
drivers/nvdimm/of_pmem.c +3 -1
index 8224d1431ea9..6826a274a1f1 100644
@@ -62,8 +62,10 @@ static int of_pmem_region_probe(struct platform_device *pdev)
 
 		if (is_volatile)
 			region = nvdimm_volatile_region_create(bus, &ndr_desc);
-		else
+		else {
+			set_bit(ND_REGION_PERSIST_MEMCTRL, &ndr_desc.flags);
 			region = nvdimm_pmem_region_create(bus, &ndr_desc);
+		}
 
 		if (!region)
 			dev_warn(&pdev->dev, "Unable to register region %pR from %pOF\n",
Signature · 4 lines
2.25.1
_______________________________________________
Linux-nvdimm mailing list -- [email protected]
To unsubscribe send an email to [email protected]
#1 lore raw
Quoted 13 lines · Aneesh Kumar K.V

Currently, kernel shows the below values
"persistence_domain":"cpu_cache"
"persistence_domain":"memory_controller"
"persistence_domain":"unknown"

"cpu_cache" indicates no extra instructions is needed to ensure the persistence of data in the pmem media on power failure.

"memory_controller" indicates cpu cache flush instructions are required to flush the data. Platform provides mechanisms to automatically flush outstanding write data from memory controler to pmem on system power loss.

Quoted 6 lines

Based on the above use memory_controller for non volatile regions on ppc64.

---
Changes from V1:
* update commit message and retain ADR details in comment

Looks good to me, applied.

Quoted 38 lines
 arch/powerpc/platforms/pseries/papr_scm.c | 4 +++-
 drivers/nvdimm/of_pmem.c                  | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)
arch/powerpc/platforms/pseries/papr_scm.c +3 -1
index 0b4467e378e5..922a4fc3b61b 100644
@@ -361,8 +361,10 @@ static int papr_scm_nvdimm_init(struct papr_scm_priv *p)
 
        if (p->is_volatile)
                p->region = nvdimm_volatile_region_create(p->bus, &ndr_desc);
-       else
+       else {
+               set_bit(ND_REGION_PERSIST_MEMCTRL, &ndr_desc.flags);
                p->region = nvdimm_pmem_region_create(p->bus, &ndr_desc);
+       }
        if (!p->region) {
                dev_err(dev, "Error registering region %pR from %pOF\n",
                                ndr_desc.res, p->dn);
drivers/nvdimm/of_pmem.c +3 -2
index 8224d1431ea9..6826a274a1f1 100644
@@ -62,8 +62,10 @@ static int of_pmem_region_probe(struct platform_device *pdev)
 
                if (is_volatile)
                        region = nvdimm_volatile_region_create(bus, &ndr_desc);
-               else
+               else {
+                       set_bit(ND_REGION_PERSIST_MEMCTRL, &ndr_desc.flags);
                        region = nvdimm_pmem_region_create(bus, &ndr_desc);
+               }
 
                if (!region)
                        dev_warn(&pdev->dev, "Unable to register region %pR from %pOF\n",
--
Quoted 2 lines

2.25.1

_______________________________________________
Linux-nvdimm mailing list -- [email protected] To unsubscribe send an email to [email protected]