linux-nvdimm.lists.01.org archive mirror
 help / color / mirror / Atom feed
* [ndctl PATCH] Expose ndctl_bus_nfit_translate_spa as a public function.
@ 2021-02-24 23:48 Tsaur, Erwin
  2021-02-26 19:20 ` Dan Williams
  2021-02-26 21:41 ` Verma, Vishal L
  0 siblings, 2 replies; 3+ messages in thread
From: Tsaur, Erwin @ 2021-02-24 23:48 UTC (permalink / raw)
  To: linux-nvdimm; +Cc: Tsaur, Erwin

The motivation is to allow access to ACPI defined NVDIMM Root Device _DSM Function Index 5(Translate SPA).  The rest of the _DSM functions, which are mostly ARS related, are already public.

Basically move ndctl_bus_nfit_translate_spa declaration from private.h to libndctl.h.
---
 ndctl/lib/libndctl.sym | 4 ++++
 ndctl/lib/nfit.c       | 2 +-
 ndctl/lib/private.h    | 2 --
 ndctl/libndctl.h       | 2 ++
 4 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/ndctl/lib/libndctl.sym b/ndctl/lib/libndctl.sym
index 0a82616..58afb74 100644
--- a/ndctl/lib/libndctl.sym
+++ b/ndctl/lib/libndctl.sym
@@ -451,3 +451,7 @@ LIBNDCTL_25 {
 	ndctl_bus_clear_fw_activate_nosuspend;
 	ndctl_bus_activate_firmware;
 } LIBNDCTL_24;
+
+LIBNDCTL_26 {
+	ndctl_bus_nfit_translate_spa;
+} LIBNDCTL_25;
diff --git a/ndctl/lib/nfit.c b/ndctl/lib/nfit.c
index 6f68fcf..d85682f 100644
--- a/ndctl/lib/nfit.c
+++ b/ndctl/lib/nfit.c
@@ -114,7 +114,7 @@ static int is_valid_spa(struct ndctl_bus *bus, unsigned long long spa)
  *
  * If success, returns zero, store dimm's @handle, and @dpa.
  */
-int ndctl_bus_nfit_translate_spa(struct ndctl_bus *bus,
+NDCTL_EXPORT int ndctl_bus_nfit_translate_spa(struct ndctl_bus *bus,
 	unsigned long long address, unsigned int *handle, unsigned long long *dpa)
 {
 
diff --git a/ndctl/lib/private.h b/ndctl/lib/private.h
index ede1300..8f4510e 100644
--- a/ndctl/lib/private.h
+++ b/ndctl/lib/private.h
@@ -370,8 +370,6 @@ static inline int check_kmod(struct kmod_ctx *kmod_ctx)
 	return kmod_ctx ? 0 : -ENXIO;
 }
 
-int ndctl_bus_nfit_translate_spa(struct ndctl_bus *bus, unsigned long long addr,
-		unsigned int *handle, unsigned long long *dpa);
 struct ndctl_cmd *ndctl_bus_cmd_new_err_inj(struct ndctl_bus *bus);
 struct ndctl_cmd *ndctl_bus_cmd_new_err_inj_clr(struct ndctl_bus *bus);
 struct ndctl_cmd *ndctl_bus_cmd_new_err_inj_stat(struct ndctl_bus *bus,
diff --git a/ndctl/libndctl.h b/ndctl/libndctl.h
index 60e1288..ee517a7 100644
--- a/ndctl/libndctl.h
+++ b/ndctl/libndctl.h
@@ -237,6 +237,8 @@ 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);
+int ndctl_bus_nfit_translate_spa(struct ndctl_bus *bus, unsigned long long addr,
+		unsigned int *handle, unsigned long long *dpa);
 
 /*
  * Note: ndctl_cmd_smart_get_temperature is an alias for
-- 
2.30.0
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [ndctl PATCH] Expose ndctl_bus_nfit_translate_spa as a public function.
  2021-02-24 23:48 [ndctl PATCH] Expose ndctl_bus_nfit_translate_spa as a public function Tsaur, Erwin
@ 2021-02-26 19:20 ` Dan Williams
  2021-02-26 21:41 ` Verma, Vishal L
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Williams @ 2021-02-26 19:20 UTC (permalink / raw)
  To: Tsaur, Erwin; +Cc: linux-nvdimm

On Wed, Feb 24, 2021 at 3:48 PM Tsaur, Erwin <erwin.tsaur@intel.com> wrote:
>
> The motivation is to allow access to ACPI defined NVDIMM Root Device _DSM Function Index 5(Translate SPA).  The rest of the _DSM functions, which are mostly ARS related, are already public.

For future reference you'll want to fix your editor to make sure it
wraps at 72 columns for commit messages. If you're a vim user, I have
the following in my .vimrc

set tw=72

...and then you can use the 'gq' command to fixup line wrapping after the fact.

Otherwise, looks good to me. I was worried that you needed to double
check that the bus argument actually is an nfit bus, but
bus_has_translate_spa() already takes care of that, so I think we're
good to go. Longer term if other buses grow the ability to return the
DPA we can add a proper generic wrapper for that, to date I have not
seen much support for RAS brewing in other buses.

Reviewed-by: Dan Williams <dan.j.williams@intel.com>
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [ndctl PATCH] Expose ndctl_bus_nfit_translate_spa as a public function.
  2021-02-24 23:48 [ndctl PATCH] Expose ndctl_bus_nfit_translate_spa as a public function Tsaur, Erwin
  2021-02-26 19:20 ` Dan Williams
@ 2021-02-26 21:41 ` Verma, Vishal L
  1 sibling, 0 replies; 3+ messages in thread
From: Verma, Vishal L @ 2021-02-26 21:41 UTC (permalink / raw)
  To: linux-nvdimm, Tsaur, Erwin

On Wed, 2021-02-24 at 15:48 -0800, Tsaur, Erwin wrote:
> The motivation is to allow access to ACPI defined NVDIMM Root Device _DSM Function Index 5(Translate SPA).  The rest of the _DSM functions, which are mostly ARS related, are already public.
> 
> Basically move ndctl_bus_nfit_translate_spa declaration from private.h to libndctl.h.
> ---
>  ndctl/lib/libndctl.sym | 4 ++++
>  ndctl/lib/nfit.c       | 2 +-
>  ndctl/lib/private.h    | 2 --
>  ndctl/libndctl.h       | 2 ++
>  4 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/ndctl/lib/libndctl.sym b/ndctl/lib/libndctl.sym
> index 0a82616..58afb74 100644
> --- a/ndctl/lib/libndctl.sym
> +++ b/ndctl/lib/libndctl.sym
> @@ -451,3 +451,7 @@ LIBNDCTL_25 {
>  	ndctl_bus_clear_fw_activate_nosuspend;
>  	ndctl_bus_activate_firmware;
>  } LIBNDCTL_24;
> +
> +LIBNDCTL_26 {
> +	ndctl_bus_nfit_translate_spa;
> +} LIBNDCTL_25;
> diff --git a/ndctl/lib/nfit.c b/ndctl/lib/nfit.c
> index 6f68fcf..d85682f 100644
> --- a/ndctl/lib/nfit.c
> +++ b/ndctl/lib/nfit.c
> @@ -114,7 +114,7 @@ static int is_valid_spa(struct ndctl_bus *bus, unsigned long long spa)
>   *
>   * If success, returns zero, store dimm's @handle, and @dpa.
>   */
> -int ndctl_bus_nfit_translate_spa(struct ndctl_bus *bus,
> +NDCTL_EXPORT int ndctl_bus_nfit_translate_spa(struct ndctl_bus *bus,
>  	unsigned long long address, unsigned int *handle, unsigned long long *dpa)
>  {
>  
> 
> 
> 
> diff --git a/ndctl/lib/private.h b/ndctl/lib/private.h
> index ede1300..8f4510e 100644
> --- a/ndctl/lib/private.h
> +++ b/ndctl/lib/private.h
> @@ -370,8 +370,6 @@ static inline int check_kmod(struct kmod_ctx *kmod_ctx)
>  	return kmod_ctx ? 0 : -ENXIO;
>  }
>  
> 
> 
> 
> -int ndctl_bus_nfit_translate_spa(struct ndctl_bus *bus, unsigned long long addr,
> -		unsigned int *handle, unsigned long long *dpa);
>  struct ndctl_cmd *ndctl_bus_cmd_new_err_inj(struct ndctl_bus *bus);
>  struct ndctl_cmd *ndctl_bus_cmd_new_err_inj_clr(struct ndctl_bus *bus);
>  struct ndctl_cmd *ndctl_bus_cmd_new_err_inj_stat(struct ndctl_bus *bus,
> diff --git a/ndctl/libndctl.h b/ndctl/libndctl.h
> index 60e1288..ee517a7 100644
> --- a/ndctl/libndctl.h
> +++ b/ndctl/libndctl.h
> @@ -237,6 +237,8 @@ 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);
> +int ndctl_bus_nfit_translate_spa(struct ndctl_bus *bus, unsigned long long addr,
> +		unsigned int *handle, unsigned long long *dpa);
>  

One nit here: can you group this with the other ndctl_bus_* function
declarations in this file?

Everything else looks good to me.


_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-02-26 21:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-24 23:48 [ndctl PATCH] Expose ndctl_bus_nfit_translate_spa as a public function Tsaur, Erwin
2021-02-26 19:20 ` Dan Williams
2021-02-26 21:41 ` Verma, Vishal L

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).