From patchwork Sun Apr 17 23:38:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerry Hoemann X-Patchwork-Id: 8864051 Return-Path: X-Original-To: patchwork-linux-nvdimm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D30A7BF29F for ; Sun, 17 Apr 2016 23:39:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ECCCC201B4 for ; Sun, 17 Apr 2016 23:39:02 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0DE37201ED for ; Sun, 17 Apr 2016 23:39:02 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id CB7531A2227; Sun, 17 Apr 2016 16:39:00 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from g2t4622.austin.hp.com (g2t4622.austin.hp.com [15.73.212.79]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 103B01A2169 for ; Sun, 17 Apr 2016 16:38:58 -0700 (PDT) Received: from g2t4688.austin.hpicorp.net (g2t4688.austin.hpicorp.net [15.94.10.174]) by g2t4622.austin.hp.com (Postfix) with ESMTP id 47EBE8C; Sun, 17 Apr 2016 23:38:57 +0000 (UTC) Received: from lxbuild.ftc.rdlabs.hpecorp.net (lxbuild.ftc.rdlabs.hpecorp.net [16.78.34.175]) by g2t4688.austin.hpicorp.net (Postfix) with ESMTP id F2A005E; Sun, 17 Apr 2016 23:38:56 +0000 (UTC) From: Jerry Hoemann To: dan.j.williams@intel.com Subject: [RFC v9 5/5] nvdimm: Add ioctl to return command mask. Date: Sun, 17 Apr 2016 17:38:47 -0600 Message-Id: <9f04df3b80c68dd6406cfee5ce11a2cd8ed33b64.1460936121.git.jerry.hoemann@hpe.com> X-Mailer: git-send-email 1.7.11.3 In-Reply-To: References: In-Reply-To: References: X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-nvdimm@lists.01.org MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The pass thru calls return command mask. Previously, bit zero wasn't part of command mask, but as it is now, this left commands_show displaying "unknown" for function zero. Add an ioctl interface to return command mask. Signed-off-by: Jerry Hoemann Reviewed-by: Johannes Thumshirn --- drivers/nvdimm/bus.c | 10 ++++++++-- include/uapi/linux/ndctl.h | 9 +++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c index b133301..047c364 100644 --- a/drivers/nvdimm/bus.c +++ b/drivers/nvdimm/bus.c @@ -404,7 +404,10 @@ void nvdimm_bus_destroy_ndctl(struct nvdimm_bus *nvdimm_bus) } static const struct nd_cmd_desc __nd_cmd_dimm_descs[] = { - [ND_CMD_IMPLEMENTED] = { }, + [ND_CMD_IMPLEMENTED] = { + .out_num = 1, + .out_sizes = { 8, }, + }, [ND_CMD_SMART] = { .out_num = 2, .out_sizes = { 4, 128, }, @@ -456,7 +459,10 @@ const struct nd_cmd_desc *nd_cmd_dimm_desc(int cmd) EXPORT_SYMBOL_GPL(nd_cmd_dimm_desc); static const struct nd_cmd_desc __nd_cmd_bus_descs[] = { - [ND_CMD_IMPLEMENTED] = { }, + [ND_CMD_IMPLEMENTED] = { + .out_num = 1, + .out_sizes = { 1, }, + }, [ND_CMD_ARS_CAP] = { .in_num = 2, .in_sizes = { 8, 8, }, diff --git a/include/uapi/linux/ndctl.h b/include/uapi/linux/ndctl.h index 9214af7..8c086b9 100644 --- a/include/uapi/linux/ndctl.h +++ b/include/uapi/linux/ndctl.h @@ -20,6 +20,10 @@ struct nd_cmd_smart { __u8 data[128]; } __packed; +struct nd_cmd_mask { + __u8 data[8]; +} __packed; + struct nd_cmd_smart_threshold { __u32 status; __u8 data[8]; @@ -136,6 +140,7 @@ enum { static inline const char *nvdimm_bus_cmd_name(unsigned cmd) { static const char * const names[] = { + [ND_CMD_IMPLEMENTED] = "cmd_mask", [ND_CMD_ARS_CAP] = "ars_cap", [ND_CMD_ARS_START] = "ars_start", [ND_CMD_ARS_STATUS] = "ars_status", @@ -150,6 +155,7 @@ static inline const char *nvdimm_bus_cmd_name(unsigned cmd) static inline const char *nvdimm_cmd_name(unsigned cmd) { static const char * const names[] = { + [ND_CMD_IMPLEMENTED] = "cmd_mask", [ND_CMD_SMART] = "smart", [ND_CMD_SMART_THRESHOLD] = "smart_thresh", [ND_CMD_DIMM_FLAGS] = "flags", @@ -169,6 +175,9 @@ static inline const char *nvdimm_cmd_name(unsigned cmd) #define ND_IOCTL 'N' +#define ND_IOCTL_CMD_MASK _IOWR(ND_IOCTL, ND_CMD_IMPLEMENTED,\ + struct nd_cmd_mask) + #define ND_IOCTL_SMART _IOWR(ND_IOCTL, ND_CMD_SMART,\ struct nd_cmd_smart)