Skip to content

Commit 43001c5

Browse files
oohalmpe
authored andcommitted
powerpc/papr_scm: Use ibm,unit-guid as the iset cookie
The interleave set cookie is used to determine if a label stored in the metadata space should be applied to the current region. This is important in the case of NVDIMMs since the firmware may change the interleaving configuration of a DIMM which would invalidate the existing labels. In our case the hypervisor hides those details from us so we don't really care, but libnvdimm still requires the interleave set cookie to be non-zero. For our purposes we just need the set cookie to be unique and fixed for a given PAPR SCM region and using the unit-guid (really a UUID) is fine for this purpose. Fixes: b5beae5 ("powerpc/pseries: Add driver for PAPR SCM regions") Signed-off-by: Oliver O'Halloran <oohall@gmail.com> [mpe: Use kernel types (u64)] Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
1 parent b0d65a8 commit 43001c5

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

arch/powerpc/platforms/pseries/papr_scm.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,8 @@ static int papr_scm_probe(struct platform_device *pdev)
264264
u32 drc_index, metadata_size;
265265
u64 blocks, block_size;
266266
struct papr_scm_priv *p;
267+
const char *uuid_str;
268+
u64 uuid[2];
267269
int rc;
268270

269271
/* check we have all the required DT properties */
@@ -282,6 +284,11 @@ static int papr_scm_probe(struct platform_device *pdev)
282284
return -ENODEV;
283285
}
284286

287+
if (of_property_read_string(dn, "ibm,unit-guid", &uuid_str)) {
288+
dev_err(&pdev->dev, "%pOF: missing unit-guid!\n", dn);
289+
return -ENODEV;
290+
}
291+
285292
p = kzalloc(sizeof(*p), GFP_KERNEL);
286293
if (!p)
287294
return -ENOMEM;
@@ -294,6 +301,11 @@ static int papr_scm_probe(struct platform_device *pdev)
294301
p->block_size = block_size;
295302
p->blocks = blocks;
296303

304+
/* We just need to ensure that set cookies are unique across */
305+
uuid_parse(uuid_str, (uuid_t *) uuid);
306+
p->nd_set.cookie1 = uuid[0];
307+
p->nd_set.cookie2 = uuid[1];
308+
297309
/* might be zero */
298310
p->metadata_size = metadata_size;
299311
p->pdev = pdev;

0 commit comments

Comments
 (0)