All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] nvdimm: Add an IOCTL pass thru for DSM calls
@ 2015-11-06 22:27 ` Jerry Hoemann
  0 siblings, 0 replies; 47+ messages in thread
From: Jerry Hoemann @ 2015-11-06 22:27 UTC (permalink / raw)
  To: ross.zwisler, rjw, lenb, dan.j.williams
  Cc: linux-nvdimm, linux-acpi, linux-kernel, Jerry Hoemann

The NVDIMM code in the kernel supports an IOCTL interface to user
space based upon the Intel Example DSM:

	http://pmem.io/documents/NVDIMM_DSM_Interface_Example.pdf

This interface cannot be used by other NVDIMM DSMs that support
incompatible functions.

This patch set adds a generic "passthru" IOCTL interface which
is not tied to a particular DSM.

A new IOCTL type "P" is added for the pass thru call.

The new data structure ndn_pkg serves as a wrapper for the passthru
calls.  This wrapper supplies the data that the kernel needs to
make the _DSM call.

Unlike the definitions of the _DSM functions themselves, the ndn_pkg
provides the calling information (input/output sizes) in an uniform
manner making the kernel marshaling of the arguments straight
forward.

This shifts the marshaling burden from the kernel to the user
space application while still permitting the kernel to internally
calling _DSM functions.

To make the resultant kernel code easier to understand the existing
functions acpi_nfit_ctl and __nd_ioctl were renamed to .*_intel to
denote calling mechanism as in 4.2 tailored to the Intel Example DSM.
New functions acpi_nfit_ctl_passthru and __nd_ioctl_passthru were
created to supply the pass thru interface.


These changes are based upon the 4.3 kernel.


Jerry Hoemann (4):
  nvdimm: Add wrapper for IOCTL pass thru.
  nvdimm: Add IOCTL pass thru
  nvdimm: Add IOCTL pass thru
  nvdimm: rename functions that aren't IOCTL passthru

 drivers/acpi/nfit.c        |  91 ++++++++++++++++++++++++++++++++--
 drivers/nvdimm/bus.c       | 118 +++++++++++++++++++++++++++++++++++++++++----
 drivers/nvdimm/dimm_devs.c |   6 +--
 include/linux/libnvdimm.h  |   3 +-
 include/uapi/linux/ndctl.h |  20 +++++++-
 5 files changed, 220 insertions(+), 18 deletions(-)

-- 
1.7.11.3


^ permalink raw reply	[flat|nested] 47+ messages in thread
* Re: [PATCH 3/4] nvdimm: Add IOCTL pass thru
@ 2015-11-07 14:02 ` Dmitry Krivenok
  0 siblings, 0 replies; 47+ messages in thread
From: Dmitry Krivenok @ 2015-11-07 14:02 UTC (permalink / raw)
  To: Jerry Hoemann
  Cc: ross.zwisler, rjw, lenb, dan.j.williams, linux-acpi,
	linux-kernel, linux-nvdimm

> +       if (IS_ENABLED(CONFIG_ACPI_NFIT_DEBUG)) {
> +               dev_dbg(dev, "%s:%s cmd: %d input length: %d\n", __func__,
> +                               dimm_name, cmd, in_buf.buffer.length);
> +               print_hex_dump_debug("cmd: ", DUMP_PREFIX_OFFSET, 4,
> +                               4, in_buf.buffer.pointer, min_t(u32, 128,
> +                                       in_buf.buffer.length), true);
> +       }

Maybe move this code to a helper function? There are 4 almost
identical blocks now in acpi_nfit_ctl_passthru and
acpi_nfit_ctl_intel.

> +       for (i = 0; i < ARRAY_SIZE(pkg.h.res); i++)
> +               if (pkg.h.res[i])
> +                       return -EINVAL;

I'd rename "res" to "reserved" for clarity.

> +       /* This may be bigger that the fixed portion of the pakcage */

s/that/than/
s/pakcage/package/

> +               switch (type) {
> +               case NVDIMM_TYPE_INTEL:
> +                       rc = __nd_ioctl(nvdimm_bus, nvdimm, ro, cmd, arg);
> +                       break;
> +               case NVDIMM_TYPE_PASSTHRU:
> +                       rc = __nd_ioctl_passthru(nvdimm_bus, nvdimm, ro, cmd, arg);
> +                       break;
> +               default:
> +                       rc = -ENOTTY;
> +               }

The same comment. Identical code in nd_ioctl and nvdimm_ioctl.
Perhaps move to a helper function?

Thanks,
Dmitry

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

end of thread, other threads:[~2015-11-12 15:33 UTC | newest]

Thread overview: 47+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-06 22:27 [PATCH 0/4] nvdimm: Add an IOCTL pass thru for DSM calls Jerry Hoemann
2015-11-06 22:27 ` Jerry Hoemann
2015-11-06 22:27 ` [PATCH 1/4] nvdimm: Add wrapper for IOCTL pass thru Jerry Hoemann
2015-11-06 22:27   ` Jerry Hoemann
2015-11-10 17:51   ` Jeff Moyer
2015-11-10 18:05     ` Dan Williams
2015-11-10 19:49     ` Jerry Hoemann
2015-11-10 20:26       ` Jeff Moyer
2015-11-11  0:44         ` Jerry Hoemann
2015-11-11  0:49           ` Dan Williams
2015-11-11 15:47           ` Jeff Moyer
2015-11-10 20:27       ` Dan Williams
2015-11-10 20:53         ` Linda Knippers
2015-11-10 22:20           ` Dan Williams
2015-11-10 19:04   ` Elliott, Robert (Persistent Memory)
2015-11-10 19:04     ` Elliott, Robert (Persistent Memory)
2015-11-10 21:25     ` Jerry Hoemann
2015-11-10 21:25       ` Jerry Hoemann
2015-11-06 22:27 ` [PATCH 2/4] nvdimm: Add " Jerry Hoemann
2015-11-06 22:27   ` Jerry Hoemann
2015-11-10 18:05   ` Jeff Moyer
2015-11-10 22:13     ` Jerry Hoemann
2015-11-11 15:41       ` Jeff Moyer
2015-11-06 22:27 ` [PATCH 3/4] " Jerry Hoemann
2015-11-06 22:27   ` Jerry Hoemann
2015-11-10 16:24   ` Jeff Moyer
2015-11-10 21:36     ` Jerry Hoemann
2015-11-10 21:45       ` Jeff Moyer
2015-11-10 22:15         ` Jerry Hoemann
2015-11-10 21:54   ` Jeff Moyer
2015-11-11  1:42     ` Jerry Hoemann
2015-11-06 22:27 ` [PATCH 4/4] nvdimm: rename functions that aren't IOCTL passthru Jerry Hoemann
2015-11-06 22:27   ` Jerry Hoemann
2015-11-10 15:33 ` [PATCH 0/4] nvdimm: Add an IOCTL pass thru for DSM calls Jeff Moyer
2015-11-10 21:39   ` Jerry Hoemann
2015-11-07 14:02 [PATCH 3/4] nvdimm: Add IOCTL pass thru Dmitry Krivenok
2015-11-07 14:02 ` Dmitry Krivenok
2015-11-09 21:59 ` Jerry Hoemann
2015-11-09 21:59   ` Jerry Hoemann
2015-11-10 15:05   ` Dmitry Krivenok
2015-11-10 15:05     ` Dmitry Krivenok
2015-11-11 21:44     ` Jerry Hoemann
2015-11-11 21:44       ` Jerry Hoemann
2015-11-11 21:52       ` Dmitry Krivenok
2015-11-11 21:52         ` Dmitry Krivenok
2015-11-12 15:33         ` Jerry Hoemann
2015-11-12 15:33           ` Jerry Hoemann

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.