* [ndctl PATCH v3] ndctl: add an api for getting the ars_status overflow flag
@ 2018-06-06 20:18 Vishal Verma
2018-06-06 20:22 ` Dan Williams
0 siblings, 1 reply; 3+ messages in thread
From: Vishal Verma @ 2018-06-06 20:18 UTC (permalink / raw)
To: linux-nvdimm; +Cc: Jacek Zloch
The ARS status command defines a 'flags' field that wasn't being exposed
via an API yet. Since there is only one flag defined in ACPI 6.2, add a
helper for retrieving it (overflow flag).
Reported-by: Jacek Zloch <jacek.zloch@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
---
ndctl/lib/ars.c | 11 +++++++++++
ndctl/lib/libndctl.sym | 1 +
ndctl/libndctl.h | 4 ++++
3 files changed, 16 insertions(+)
v3: ensure we can only return 0, 1, or -error from this interface. (Dan)
diff --git a/ndctl/lib/ars.c b/ndctl/lib/ars.c
index e04b51e..c78e3bf 100644
--- a/ndctl/lib/ars.c
+++ b/ndctl/lib/ars.c
@@ -269,6 +269,17 @@ NDCTL_EXPORT unsigned long long ndctl_cmd_ars_get_record_len(
return ars_stat->ars_status->records[rec_index].length;
}
+NDCTL_EXPORT int ndctl_cmd_ars_stat_get_flag_overflow(
+ struct ndctl_cmd *ars_stat)
+{
+ struct ndctl_ctx *ctx = ndctl_bus_get_ctx(cmd_to_bus(ars_stat));
+
+ if (!validate_ars_stat(ctx, ars_stat))
+ return -EINVAL;
+
+ return !!(ars_stat->ars_status->flags & ND_ARS_STAT_FLAG_OVERFLOW);
+}
+
NDCTL_EXPORT struct ndctl_cmd *ndctl_bus_cmd_new_clear_error(
unsigned long long address, unsigned long long len,
struct ndctl_cmd *ars_cap)
diff --git a/ndctl/lib/libndctl.sym b/ndctl/lib/libndctl.sym
index c1228e5..e939993 100644
--- a/ndctl/lib/libndctl.sym
+++ b/ndctl/lib/libndctl.sym
@@ -365,4 +365,5 @@ global:
ndctl_cmd_ars_cap_get_clear_unit;
ndctl_namespace_inject_error2;
ndctl_namespace_uninject_error2;
+ ndctl_cmd_ars_stat_get_flag_overflow;
} LIBNDCTL_15;
diff --git a/ndctl/libndctl.h b/ndctl/libndctl.h
index be997ac..3d141a6 100644
--- a/ndctl/libndctl.h
+++ b/ndctl/libndctl.h
@@ -187,6 +187,9 @@ int ndctl_dimm_is_enabled(struct ndctl_dimm *dimm);
int ndctl_dimm_disable(struct ndctl_dimm *dimm);
int ndctl_dimm_enable(struct ndctl_dimm *dimm);
+/* ars_status flags */
+#define ND_ARS_STAT_FLAG_OVERFLOW (1 << 0)
+
struct ndctl_cmd;
struct ndctl_cmd *ndctl_bus_cmd_new_ars_cap(struct ndctl_bus *bus,
unsigned long long address, unsigned long long len);
@@ -210,6 +213,7 @@ struct ndctl_cmd *ndctl_bus_cmd_new_clear_error(unsigned long long address,
unsigned long long ndctl_cmd_clear_error_get_cleared(
struct ndctl_cmd *clear_err);
unsigned int ndctl_cmd_ars_cap_get_clear_unit(struct ndctl_cmd *ars_cap);
+int ndctl_cmd_ars_stat_get_flag_overflow(struct ndctl_cmd *ars_stat);
/*
* Note: ndctl_cmd_smart_get_temperature is an alias for
--
2.17.0
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [ndctl PATCH v3] ndctl: add an api for getting the ars_status overflow flag
2018-06-06 20:18 [ndctl PATCH v3] ndctl: add an api for getting the ars_status overflow flag Vishal Verma
@ 2018-06-06 20:22 ` Dan Williams
2018-06-06 21:44 ` Verma, Vishal L
0 siblings, 1 reply; 3+ messages in thread
From: Dan Williams @ 2018-06-06 20:22 UTC (permalink / raw)
To: Vishal Verma; +Cc: Jacek Zloch, linux-nvdimm
On Wed, Jun 6, 2018 at 1:18 PM, Vishal Verma <vishal.l.verma@intel.com> wrote:
> The ARS status command defines a 'flags' field that wasn't being exposed
> via an API yet. Since there is only one flag defined in ACPI 6.2, add a
> helper for retrieving it (overflow flag).
>
> Reported-by: Jacek Zloch <jacek.zloch@intel.com>
> Cc: Dan Williams <dan.j.williams@intel.com>
> Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
> ---
> ndctl/lib/ars.c | 11 +++++++++++
> ndctl/lib/libndctl.sym | 1 +
> ndctl/libndctl.h | 4 ++++
> 3 files changed, 16 insertions(+)
>
> v3: ensure we can only return 0, 1, or -error from this interface. (Dan)
>
> diff --git a/ndctl/lib/ars.c b/ndctl/lib/ars.c
> index e04b51e..c78e3bf 100644
> --- a/ndctl/lib/ars.c
> +++ b/ndctl/lib/ars.c
> @@ -269,6 +269,17 @@ NDCTL_EXPORT unsigned long long ndctl_cmd_ars_get_record_len(
> return ars_stat->ars_status->records[rec_index].length;
> }
>
> +NDCTL_EXPORT int ndctl_cmd_ars_stat_get_flag_overflow(
> + struct ndctl_cmd *ars_stat)
> +{
> + struct ndctl_ctx *ctx = ndctl_bus_get_ctx(cmd_to_bus(ars_stat));
> +
> + if (!validate_ars_stat(ctx, ars_stat))
> + return -EINVAL;
> +
> + return !!(ars_stat->ars_status->flags & ND_ARS_STAT_FLAG_OVERFLOW);
> +}
> +
> NDCTL_EXPORT struct ndctl_cmd *ndctl_bus_cmd_new_clear_error(
> unsigned long long address, unsigned long long len,
> struct ndctl_cmd *ars_cap)
> diff --git a/ndctl/lib/libndctl.sym b/ndctl/lib/libndctl.sym
> index c1228e5..e939993 100644
> --- a/ndctl/lib/libndctl.sym
> +++ b/ndctl/lib/libndctl.sym
> @@ -365,4 +365,5 @@ global:
> ndctl_cmd_ars_cap_get_clear_unit;
> ndctl_namespace_inject_error2;
> ndctl_namespace_uninject_error2;
> + ndctl_cmd_ars_stat_get_flag_overflow;
> } LIBNDCTL_15;
> diff --git a/ndctl/libndctl.h b/ndctl/libndctl.h
> index be997ac..3d141a6 100644
> --- a/ndctl/libndctl.h
> +++ b/ndctl/libndctl.h
> @@ -187,6 +187,9 @@ int ndctl_dimm_is_enabled(struct ndctl_dimm *dimm);
> int ndctl_dimm_disable(struct ndctl_dimm *dimm);
> int ndctl_dimm_enable(struct ndctl_dimm *dimm);
>
> +/* ars_status flags */
> +#define ND_ARS_STAT_FLAG_OVERFLOW (1 << 0)
Oh, sorry, one more thing. This should move to ndctl/lib/private.h, right?
With that you can add:
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [ndctl PATCH v3] ndctl: add an api for getting the ars_status overflow flag
2018-06-06 20:22 ` Dan Williams
@ 2018-06-06 21:44 ` Verma, Vishal L
0 siblings, 0 replies; 3+ messages in thread
From: Verma, Vishal L @ 2018-06-06 21:44 UTC (permalink / raw)
To: Williams, Dan J; +Cc: Zloch, Jacek, linux-nvdimm@lists.01.org
On Wed, 2018-06-06 at 13:22 -0700, Dan Williams wrote:
> On Wed, Jun 6, 2018 at 1:18 PM, Vishal Verma <vishal.l.verma@intel.com>
> wrote:
> > The ARS status command defines a 'flags' field that wasn't being
> > exposed
> > via an API yet. Since there is only one flag defined in ACPI 6.2, add a
> > helper for retrieving it (overflow flag).
> >
> > Reported-by: Jacek Zloch <jacek.zloch@intel.com>
> > Cc: Dan Williams <dan.j.williams@intel.com>
> > Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
> > ---
> > ndctl/lib/ars.c | 11 +++++++++++
> > ndctl/lib/libndctl.sym | 1 +
> > ndctl/libndctl.h | 4 ++++
> > 3 files changed, 16 insertions(+)
> >
> > v3: ensure we can only return 0, 1, or -error from this interface.
> > (Dan)
> >
> > diff --git a/ndctl/lib/ars.c b/ndctl/lib/ars.c
> > index e04b51e..c78e3bf 100644
> > --- a/ndctl/lib/ars.c
> > +++ b/ndctl/lib/ars.c
> > @@ -269,6 +269,17 @@ NDCTL_EXPORT unsigned long long
> > ndctl_cmd_ars_get_record_len(
> > return ars_stat->ars_status->records[rec_index].length;
> > }
> >
> > +NDCTL_EXPORT int ndctl_cmd_ars_stat_get_flag_overflow(
> > + struct ndctl_cmd *ars_stat)
> > +{
> > + struct ndctl_ctx *ctx =
> > ndctl_bus_get_ctx(cmd_to_bus(ars_stat));
> > +
> > + if (!validate_ars_stat(ctx, ars_stat))
> > + return -EINVAL;
> > +
> > + return !!(ars_stat->ars_status->flags &
> > ND_ARS_STAT_FLAG_OVERFLOW);
> > +}
> > +
> > NDCTL_EXPORT struct ndctl_cmd *ndctl_bus_cmd_new_clear_error(
> > unsigned long long address, unsigned long long len,
> > struct ndctl_cmd *ars_cap)
> > diff --git a/ndctl/lib/libndctl.sym b/ndctl/lib/libndctl.sym
> > index c1228e5..e939993 100644
> > --- a/ndctl/lib/libndctl.sym
> > +++ b/ndctl/lib/libndctl.sym
> > @@ -365,4 +365,5 @@ global:
> > ndctl_cmd_ars_cap_get_clear_unit;
> > ndctl_namespace_inject_error2;
> > ndctl_namespace_uninject_error2;
> > + ndctl_cmd_ars_stat_get_flag_overflow;
> > } LIBNDCTL_15;
> > diff --git a/ndctl/libndctl.h b/ndctl/libndctl.h
> > index be997ac..3d141a6 100644
> > --- a/ndctl/libndctl.h
> > +++ b/ndctl/libndctl.h
> > @@ -187,6 +187,9 @@ int ndctl_dimm_is_enabled(struct ndctl_dimm *dimm);
> > int ndctl_dimm_disable(struct ndctl_dimm *dimm);
> > int ndctl_dimm_enable(struct ndctl_dimm *dimm);
> >
> > +/* ars_status flags */
> > +#define ND_ARS_STAT_FLAG_OVERFLOW (1 << 0)
>
> Oh, sorry, one more thing. This should move to ndctl/lib/private.h,
> right?
Yes, good catch, thanks!
>
> With that you can add:
>
> Reviewed-by: Dan Williams <dan.j.williams@intel.com>
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-06-06 21:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-06 20:18 [ndctl PATCH v3] ndctl: add an api for getting the ars_status overflow flag Vishal Verma
2018-06-06 20:22 ` Dan Williams
2018-06-06 21:44 ` Verma, Vishal L
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.