From patchwork Wed Jan 13 05:39:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 8022171 Return-Path: X-Original-To: patchwork-linux-nvdimm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 30F059F3F6 for ; Wed, 13 Jan 2016 05:40:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 51B9E2040F for ; Wed, 13 Jan 2016 05:40:09 +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 649A1203DF for ; Wed, 13 Jan 2016 05:40:08 +0000 (UTC) Received: from ml01.vlan14.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 599C21A1F4F; Tue, 12 Jan 2016 21:40:08 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by ml01.01.org (Postfix) with ESMTP id 18E571A1F4F for ; Tue, 12 Jan 2016 21:40:07 -0800 (PST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP; 12 Jan 2016 21:40:07 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,287,1449561600"; d="scan'208";a="632604304" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.136]) by FMSMGA003.fm.intel.com with ESMTP; 12 Jan 2016 21:40:06 -0800 Subject: [RFC PATCH 4/6] libnvdimm: advertise 'call_dsm' support From: Dan Williams To: linux-nvdimm@lists.01.org Date: Tue, 12 Jan 2016 21:39:40 -0800 Message-ID: <20160113053940.6293.42599.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <20160113052327.6293.32858.stgit@dwillia2-desk3.amr.corp.intel.com> References: <20160113052327.6293.32858.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.17.1-9-g687f MIME-Version: 1.0 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Spam-Status: No, score=-1.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 Indicate to userspace that the generic 'dsm_call' capability is available for the given control device. Over time we want to deprecate the per-dsm function ioctl commands and direct everything through the generic envelope. Signed-off-by: Dan Williams --- drivers/acpi/nfit.c | 1 + drivers/nvdimm/core.c | 3 +++ drivers/nvdimm/dimm_devs.c | 8 +++++++- include/linux/libnvdimm.h | 1 + 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/nfit.c b/drivers/acpi/nfit.c index 00aa20adde7c..a60e174d6c2b 100644 --- a/drivers/acpi/nfit.c +++ b/drivers/acpi/nfit.c @@ -946,6 +946,7 @@ static void acpi_nfit_init_dsms(struct acpi_nfit_desc *acpi_desc) if (!adev) return; + nd_desc->call_dsm = 1; for (i = ND_CMD_ARS_CAP; i <= ND_CMD_ARS_STATUS; i++) if (acpi_check_dsm(adev->handle, uuid, 1, 1ULL << i)) set_bit(i, &nd_desc->dsm_mask); diff --git a/drivers/nvdimm/core.c b/drivers/nvdimm/core.c index 82c49bb87055..904bd5625234 100644 --- a/drivers/nvdimm/core.c +++ b/drivers/nvdimm/core.c @@ -252,6 +252,9 @@ static ssize_t commands_show(struct device *dev, for_each_set_bit(cmd, &nd_desc->dsm_mask, BITS_PER_LONG) len += sprintf(buf + len, "%s ", nvdimm_bus_cmd_name(cmd)); + if (nd_desc->call_dsm) + len += sprintf(buf + len, "%s ", + nvdimm_bus_cmd_name(ND_CMD_CALL_DSM)); len += sprintf(buf + len, "\n"); return len; } diff --git a/drivers/nvdimm/dimm_devs.c b/drivers/nvdimm/dimm_devs.c index 651b8d19d324..fb144d2be0a0 100644 --- a/drivers/nvdimm/dimm_devs.c +++ b/drivers/nvdimm/dimm_devs.c @@ -274,14 +274,20 @@ EXPORT_SYMBOL_GPL(nvdimm_provider_data); static ssize_t commands_show(struct device *dev, struct device_attribute *attr, char *buf) { + struct nvdimm_bus *nvdimm_bus = walk_to_nvdimm_bus(dev); struct nvdimm *nvdimm = to_nvdimm(dev); + struct nvdimm_bus_descriptor *nd_desc; int cmd, len = 0; - if (!nvdimm->dsm_mask) + if (!nvdimm->dsm_mask || !nvdimm_bus) return sprintf(buf, "\n"); for_each_set_bit(cmd, nvdimm->dsm_mask, BITS_PER_LONG) len += sprintf(buf + len, "%s ", nvdimm_cmd_name(cmd)); + nd_desc = nvdimm_bus->nd_desc; + if (nd_desc->call_dsm) + len += sprintf(buf + len, "%s ", + nvdimm_cmd_name(ND_CMD_CALL_DSM)); len += sprintf(buf + len, "\n"); return len; } diff --git a/include/linux/libnvdimm.h b/include/linux/libnvdimm.h index b0a2f6018740..4bf558d30699 100644 --- a/include/linux/libnvdimm.h +++ b/include/linux/libnvdimm.h @@ -69,6 +69,7 @@ struct nd_mapping { struct nvdimm_bus_descriptor { const struct attribute_group **attr_groups; + unsigned int call_dsm:1; unsigned long dsm_mask; char *provider_name; ndctl_fn ndctl;