diff mbox series

[ndctl,v3,3/4] papr: Add support to parse save_fail flag for dimm

Message ID 20210311074652.2783560-3-santosh@fossix.org (mailing list archive)
State New, archived
Headers show
Series [ndctl,v3,1/4] libndctl: test enablement for non-nfit devices | expand

Commit Message

Santosh Sivaraj March 11, 2021, 7:46 a.m. UTC
This will help in getting the dimm fail tests to run on papr family too.
Also add nvdimm_test compatibility string for recognizing the test module.

Signed-off-by: Santosh Sivaraj <santosh@fossix.org>
---
 ndctl/lib/libndctl.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Verma, Vishal L March 17, 2021, 10:18 p.m. UTC | #1
On Thu, 2021-03-11 at 13:16 +0530, Santosh Sivaraj wrote:
> This will help in getting the dimm fail tests to run on papr family too.
> Also add nvdimm_test compatibility string for recognizing the test module.
> 
> Signed-off-by: Santosh Sivaraj <santosh@fossix.org>
> ---
>  ndctl/lib/libndctl.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c
> index 26b9317..dd1a5fc 100644
> --- a/ndctl/lib/libndctl.c
> +++ b/ndctl/lib/libndctl.c
> @@ -805,6 +805,8 @@ static void parse_papr_flags(struct ndctl_dimm *dimm, char *flags)
>  			dimm->flags.f_restore = 1;
>  		else if (strcmp(start, "smart_notify") == 0)
>  			dimm->flags.f_smart = 1;
> +		else if (strcmp(start, "save_fail") == 0)
> +			dimm->flags.f_save = 1;
>  		start = end + 1;
>  	}
>  	if (end != start)
> @@ -1035,7 +1037,8 @@ NDCTL_EXPORT int ndctl_bus_is_papr_scm(struct ndctl_bus *bus)
>  	if (sysfs_read_attr(bus->ctx, bus->bus_buf, buf) < 0)
>  		return 0;
> 
> -	return (strcmp(buf, "ibm,pmemory") == 0);
> +	return (strcmp(buf, "ibm,pmemory") == 0 ||
> +		strcmp(buf, "nvdimm_test") == 0);

I'm guessing this name comes from the kernel? It would be nice to make
it symmetrical with 'nfit_test' by calling the bus 'papr_test' maybe,
but no worries if it is too late for that.

>  }
> 
>  /**
diff mbox series

Patch

diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c
index 26b9317..dd1a5fc 100644
--- a/ndctl/lib/libndctl.c
+++ b/ndctl/lib/libndctl.c
@@ -805,6 +805,8 @@  static void parse_papr_flags(struct ndctl_dimm *dimm, char *flags)
 			dimm->flags.f_restore = 1;
 		else if (strcmp(start, "smart_notify") == 0)
 			dimm->flags.f_smart = 1;
+		else if (strcmp(start, "save_fail") == 0)
+			dimm->flags.f_save = 1;
 		start = end + 1;
 	}
 	if (end != start)
@@ -1035,7 +1037,8 @@  NDCTL_EXPORT int ndctl_bus_is_papr_scm(struct ndctl_bus *bus)
 	if (sysfs_read_attr(bus->ctx, bus->bus_buf, buf) < 0)
 		return 0;
 
-	return (strcmp(buf, "ibm,pmemory") == 0);
+	return (strcmp(buf, "ibm,pmemory") == 0 ||
+		strcmp(buf, "nvdimm_test") == 0);
 }
 
 /**