From patchwork Fri Mar 23 08:12:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver O'Halloran X-Patchwork-Id: 889796 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 406xCx1T36z9s0q for ; Fri, 23 Mar 2018 19:14:53 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="tK5kMXzj"; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 406xCw6gP2zF20R for ; Fri, 23 Mar 2018 19:14:52 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="tK5kMXzj"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400e:c05::243; helo=mail-pg0-x243.google.com; envelope-from=oohall@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="tK5kMXzj"; dkim-atps=neutral Received: from mail-pg0-x243.google.com (mail-pg0-x243.google.com [IPv6:2607:f8b0:400e:c05::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 406x9426BKzF20R for ; Fri, 23 Mar 2018 19:12:23 +1100 (AEDT) Received: by mail-pg0-x243.google.com with SMTP id y63so1175226pgy.12 for ; Fri, 23 Mar 2018 01:12:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=osit9TNON2pNfGB1uxXl9hQDhYDjUtzCLZVDhqiSqfA=; b=tK5kMXzj01xoYu1/SsSqraHhdXEq0diDLr/uyE64QuRL0MKgtHcNGXrZUK7HCm087k JbVz1YUF0/8CQS0AfS+da9f99ipF6U6zJgmaA3usx8aJwS5SCmmUcnnt2aPOinuAf7Qx Ei8xDTwNAl4Iz5rAqSBA5+/YmjNT13A5IBJe5kTAAPqNEDCBBm2uFw4n4ElNwJlNRG2d 4Jij9xsHksgKzWGgmHUVKb1xVe9TyDDu9QbRRq0Pt7qTLFAi97vyGv72Gb0B5vzrEMsI VVW+wxP+8KDfETOhsQks/nrmpNHjf0WGz5I4h+ClI+7xYPwh2RQ6E2D+Q03Rfg4EJGlK QHxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=osit9TNON2pNfGB1uxXl9hQDhYDjUtzCLZVDhqiSqfA=; b=F4N5KlzcCUHr9Oah0MFkogoXrzPvGXbsNCjsJxkOP59LSFIPSfJVlv/xCoG0xdCyvm dLK3iZi3kIC9+WzC96e3kvZeLG/+z1V5Ph5UkK8LGo1yu4sthjb2c0FHy+eA21FhbSdl pVPXVfmhDqtEKrteFkoYXMPHuMQ6Cb9xBVThI2ebqae4ooP8vsTI21dW4yiTqskVtJMS njworUEeCFKGW8Z//86TMdJwysAzQ0malPXgU1jhMVd37dhKmB8L3xGCybJ5VywKTPNb Ca3rgbsGhupMdtVMFAymkrMzt7q7TBbxEcAt67/kstUCyhHKAPubGKc7I5BdmuPXbJAy 6PKw== X-Gm-Message-State: AElRT7EJLSB/fWMSO3MDaLzSQLaKEy2kKi3Km5aCytDtBT1srRq2O2HB iZgUJz2RbwLAj2L5tqhv9n17RQ== X-Google-Smtp-Source: AG47ELtwRLO6bG1flt5ZHh2bxBJLB8l93TfHx7mdHFnxsB9FH9lS6f5jeNQ004HHS9KgG7qqwcHVMw== X-Received: by 10.99.170.70 with SMTP id x6mr18190158pgo.114.1521792741563; Fri, 23 Mar 2018 01:12:21 -0700 (PDT) Received: from localhost.localdomain ([203.220.205.233]) by smtp.gmail.com with ESMTPSA id q67sm7474808pfg.39.2018.03.23.01.12.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Mar 2018 01:12:20 -0700 (PDT) From: Oliver O'Halloran To: linux-nvdimm@lists.01.org Subject: [PATCH 1/6] libnvdimm: Add of_node to region and bus descriptors Date: Fri, 23 Mar 2018 19:12:04 +1100 Message-Id: <20180323081209.31387-1-oohall@gmail.com> X-Mailer: git-send-email 2.9.5 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Oliver O'Halloran , linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" We want to be able to cross reference the region and bus devices with the device tree node that they were spawned from. libNVDIMM handles creating the actual devices for these internally, so we need to pass in a pointer to the relevant node in the descriptor. Signed-off-by: Oliver O'Halloran Acked-by: Dan Williams Acked-by: Balbir Singh --- drivers/nvdimm/bus.c | 1 + drivers/nvdimm/region_devs.c | 1 + include/linux/libnvdimm.h | 3 +++ 3 files changed, 5 insertions(+) diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c index 78eabc3a1ab1..c6106914f396 100644 --- a/drivers/nvdimm/bus.c +++ b/drivers/nvdimm/bus.c @@ -358,6 +358,7 @@ struct nvdimm_bus *nvdimm_bus_register(struct device *parent, nvdimm_bus->dev.release = nvdimm_bus_release; nvdimm_bus->dev.groups = nd_desc->attr_groups; nvdimm_bus->dev.bus = &nvdimm_bus_type; + nvdimm_bus->dev.of_node = nd_desc->of_node; dev_set_name(&nvdimm_bus->dev, "ndbus%d", nvdimm_bus->id); rc = device_register(&nvdimm_bus->dev); if (rc) { diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c index e6d01911e092..2f1d5771100e 100644 --- a/drivers/nvdimm/region_devs.c +++ b/drivers/nvdimm/region_devs.c @@ -1005,6 +1005,7 @@ static struct nd_region *nd_region_create(struct nvdimm_bus *nvdimm_bus, dev->parent = &nvdimm_bus->dev; dev->type = dev_type; dev->groups = ndr_desc->attr_groups; + dev->of_node = ndr_desc->of_node; nd_region->ndr_size = resource_size(ndr_desc->res); nd_region->ndr_start = ndr_desc->res->start; nd_device_register(dev); diff --git a/include/linux/libnvdimm.h b/include/linux/libnvdimm.h index ff855ed965fb..f61cb5050297 100644 --- a/include/linux/libnvdimm.h +++ b/include/linux/libnvdimm.h @@ -76,12 +76,14 @@ typedef int (*ndctl_fn)(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm, unsigned int cmd, void *buf, unsigned int buf_len, int *cmd_rc); +struct device_node; struct nvdimm_bus_descriptor { const struct attribute_group **attr_groups; unsigned long bus_dsm_mask; unsigned long cmd_mask; struct module *module; char *provider_name; + struct device_node *of_node; ndctl_fn ndctl; int (*flush_probe)(struct nvdimm_bus_descriptor *nd_desc); int (*clear_to_send)(struct nvdimm_bus_descriptor *nd_desc, @@ -123,6 +125,7 @@ struct nd_region_desc { int num_lanes; int numa_node; unsigned long flags; + struct device_node *of_node; }; struct device; From patchwork Fri Mar 23 08:12:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver O'Halloran X-Patchwork-Id: 889797 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 406xGq0j9Gz9s0q for ; Fri, 23 Mar 2018 19:17:23 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="YjFBcRJs"; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 406xGp6K1JzF21j for ; Fri, 23 Mar 2018 19:17:22 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="YjFBcRJs"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400e:c01::241; helo=mail-pl0-x241.google.com; envelope-from=oohall@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="YjFBcRJs"; dkim-atps=neutral Received: from mail-pl0-x241.google.com (mail-pl0-x241.google.com [IPv6:2607:f8b0:400e:c01::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 406x964lYHzF20R for ; Fri, 23 Mar 2018 19:12:26 +1100 (AEDT) Received: by mail-pl0-x241.google.com with SMTP id n15-v6so7004382plp.12 for ; Fri, 23 Mar 2018 01:12:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=pZCWi94tFBMlcsfsvdVxdI5gRTtgRYBtxNz9YTem+qc=; b=YjFBcRJsIx7LnAxVP5zyZ8pW9jY/zzq6Y799cPduS0NHXRFG2Rk2UudRDrJm1TJ1md QO1FTbbVJaaCHCNC8Sa/5RTCbmnXt6vNoRztx1hhknxavl0riADxTVzHQluSlIh+27yf GBShR4rElLn1DtzSD9ozwE+gRiBtyMBkjDNu/jpzCVqsOMAqFfJRTcndMhbE/lFAvUd/ c3wK/eSswLruq71XHlVNWBc3poykajs8MH1GhaHdidqcIvz0OhXFvQI/rqn0ous8cDm7 RINXjUknLi/z4reZJKe+HHeJCxR4x0Umm9YsVu9sP8OF5Oej+dDJDAJo0u3m78euYsJz SOQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=pZCWi94tFBMlcsfsvdVxdI5gRTtgRYBtxNz9YTem+qc=; b=eVVlUU83MBapHy6h9GvsjMZdxScmD1tCl7UJP+mCeRuHJMIev5fD1Z76dfS5/F4LbY Ah0iZucKKm7sd+R4+UWOCQ6DWwtMH37Kl4CXgbO8k5Eg1ETgiIISQ8MO3n5XNcSZdFLZ MXRscldFl6fykjWo2YDfwDDuZ5C154Rwrzq4i95JwNJS2lJdQ5LPnwryfMhRKMGSFouV YFqLUDWRBR0fEPuGAOkkiDs8NSXGpqgw2KbxBjm9xikxjrdHdGjZ+agPatuQMcvEcrv4 0EQ+xhgWWUDmTje6n8kHxqz2sfotcdcb7FJceQDEaH6IT0uZXrEUOpmhXDkoU/lRalso V7qw== X-Gm-Message-State: AElRT7GfZ6+K8v2UDBQeh6cVqst1Nn/FRF9bUy6rnkyPwHK6Ukdi/Jb4 spK3sfCt0wEJB+hEomfCWDo= X-Google-Smtp-Source: AG47ELu7KlEMSFo3iaapzHqvTjDK030X1vT+9qJiohxy69/7Aab5Qqs1swx/OWeMbzdon5dan9rZrA== X-Received: by 2002:a17:902:a5c5:: with SMTP id t5-v6mr28794326plq.244.1521792744471; Fri, 23 Mar 2018 01:12:24 -0700 (PDT) Received: from localhost.localdomain ([203.220.205.233]) by smtp.gmail.com with ESMTPSA id q67sm7474808pfg.39.2018.03.23.01.12.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Mar 2018 01:12:23 -0700 (PDT) From: Oliver O'Halloran To: linux-nvdimm@lists.01.org Subject: [PATCH 2/6] libnvdimm: Add nd_region_destroy() Date: Fri, 23 Mar 2018 19:12:05 +1100 Message-Id: <20180323081209.31387-2-oohall@gmail.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20180323081209.31387-1-oohall@gmail.com> References: <20180323081209.31387-1-oohall@gmail.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Oliver O'Halloran , linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Currently there's no way to remove a region from and nvdimm_bus without tearing down the whole bus. This patch adds an API for removing a single region from the bus so that we can implement a sensible unbind operation for the of_nd_region platform driver. Signed-off-by: Oliver O'Halloran --- drivers/nvdimm/region_devs.c | 6 ++++++ include/linux/libnvdimm.h | 1 + 2 files changed, 7 insertions(+) diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c index 2f1d5771100e..76f46fd1fae0 100644 --- a/drivers/nvdimm/region_devs.c +++ b/drivers/nvdimm/region_devs.c @@ -1039,6 +1039,12 @@ struct nd_region *nvdimm_blk_region_create(struct nvdimm_bus *nvdimm_bus, } EXPORT_SYMBOL_GPL(nvdimm_blk_region_create); +void nd_region_destroy(struct nd_region *region) +{ + nd_device_unregister(®ion->dev, ND_SYNC); +} +EXPORT_SYMBOL_GPL(nd_region_destroy); + struct nd_region *nvdimm_volatile_region_create(struct nvdimm_bus *nvdimm_bus, struct nd_region_desc *ndr_desc) { diff --git a/include/linux/libnvdimm.h b/include/linux/libnvdimm.h index f61cb5050297..df21ca176e98 100644 --- a/include/linux/libnvdimm.h +++ b/include/linux/libnvdimm.h @@ -192,6 +192,7 @@ struct nd_region *nvdimm_blk_region_create(struct nvdimm_bus *nvdimm_bus, struct nd_region_desc *ndr_desc); struct nd_region *nvdimm_volatile_region_create(struct nvdimm_bus *nvdimm_bus, struct nd_region_desc *ndr_desc); +void nd_region_destroy(struct nd_region *region); void *nd_region_provider_data(struct nd_region *nd_region); void *nd_blk_region_provider_data(struct nd_blk_region *ndbr); void nd_blk_region_set_provider_data(struct nd_blk_region *ndbr, void *data); From patchwork Fri Mar 23 08:12:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver O'Halloran X-Patchwork-Id: 889799 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 406xKx5Flbz9s0q for ; Fri, 23 Mar 2018 19:20:05 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="I9EhcSPo"; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 406xKx3WRszF1x0 for ; Fri, 23 Mar 2018 19:20:05 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="I9EhcSPo"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400e:c01::243; helo=mail-pl0-x243.google.com; envelope-from=oohall@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="I9EhcSPo"; dkim-atps=neutral Received: from mail-pl0-x243.google.com (mail-pl0-x243.google.com [IPv6:2607:f8b0:400e:c01::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 406x990571zF20R for ; Fri, 23 Mar 2018 19:12:28 +1100 (AEDT) Received: by mail-pl0-x243.google.com with SMTP id u11-v6so7025077plq.1 for ; Fri, 23 Mar 2018 01:12:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=OhPSyAqauZu4OcCPzSjC1rUS42tb5ogkdPbbCbLPdGw=; b=I9EhcSPoyZ4qn/NpR6bD1LJSex7j2sXDYTYi53fWOLRlT/NlR1ukqSMG/DkzcZK8/v wrFU+u8pv5YjxckMbQ5TIWgmvuVoCxd0rKu3A1Q2/ImU0uUlN15XYAqBCXQCALvF7UX1 iXM/fpwP+9psD/XWcGqEA7vvNTpEMcRqt5ndsLPR+ZrE6W2GNFxUjnCIIzQ0haO+FX15 aSbSAzwPTOXIOdoIUJdPAUHVcL3WQJ8h7vK4CBFLU+Z9LtlVVtFNAKwjiLn2/oXYBD8l 2TNKpcEgJBe2e/J7m+kPp2uiI4D3/EdWmgUp9WhgmdES/vdjXhpxFfpoWYfxyQ7KNaWq k8SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=OhPSyAqauZu4OcCPzSjC1rUS42tb5ogkdPbbCbLPdGw=; b=F3ZujvEPLtH6eARBcmiPima+mMHo9smdrykFNIOlIAvo52em0XiUz31K8yvfmMoiwG GRfwr4zlqDDg4aibskqk+oaOzBmvBFoN1WC1a3I2vQfC0sP5D72eZjI/n6Q/rP/F065H FlW2FcJIYt0WTeYlI3Q1h356nNpAaiPkxR0nDKwpoCTadcpCQs7N5kwGYQpQKYNemYAz qHzDrMvhCGtjJERiXw4mDn9uGhqIhtCZIHizpJzcnHw8F9PlyWb+xJ0bie9A2cLMqSiP 5KQK5SempeRepuOAXF6xugLWqAYYEzMoRMCpQnCXmXIgNKCfPFPP0F6Kw2ZeHB47/etM mQDA== X-Gm-Message-State: AElRT7G5dazZ0ixz6dMtnts5UJEu0MgoOC1QwcZv87nFTQpIYTNEzsd6 cuSuaHWJNZ/CqfB59S6Gdbo= X-Google-Smtp-Source: AG47ELsxtwE8/K80jrPEs1vi11uexnUicHlDSCdY/pQkjjiP8/kN17nqnhtBvWj1UIrg05EfGR1yDg== X-Received: by 2002:a17:902:309:: with SMTP id 9-v6mr29033125pld.63.1521792747141; Fri, 23 Mar 2018 01:12:27 -0700 (PDT) Received: from localhost.localdomain ([203.220.205.233]) by smtp.gmail.com with ESMTPSA id q67sm7474808pfg.39.2018.03.23.01.12.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Mar 2018 01:12:26 -0700 (PDT) From: Oliver O'Halloran To: linux-nvdimm@lists.01.org Subject: [PATCH 3/6] libnvdimm: Add device-tree based driver Date: Fri, 23 Mar 2018 19:12:06 +1100 Message-Id: <20180323081209.31387-3-oohall@gmail.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20180323081209.31387-1-oohall@gmail.com> References: <20180323081209.31387-1-oohall@gmail.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Oliver O'Halloran , linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" This patch adds peliminary device-tree bindings for the NVDIMM driver. Currently this only supports one bus (created at probe time) which all regions are added to with individual regions being created by a platform device driver. Signed-off-by: Oliver O'Halloran --- I suspect the platform driver should be holding a reference to the created region. I left that out here since previously Dan has said he'd rather keep the struct device internal to libnvdimm and the only other way a region device can disappear is when the bus is unregistered. --- MAINTAINERS | 8 +++ drivers/nvdimm/Kconfig | 10 ++++ drivers/nvdimm/Makefile | 1 + drivers/nvdimm/of_nvdimm.c | 130 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 149 insertions(+) create mode 100644 drivers/nvdimm/of_nvdimm.c diff --git a/MAINTAINERS b/MAINTAINERS index 4e62756936fa..e3fc47fbfc7a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -8035,6 +8035,14 @@ Q: https://patchwork.kernel.org/project/linux-nvdimm/list/ S: Supported F: drivers/nvdimm/pmem* +LIBNVDIMM: DEVICETREE BINDINGS +M: Oliver O'Halloran +L: linux-nvdimm@lists.01.org +Q: https://patchwork.kernel.org/project/linux-nvdimm/list/ +S: Supported +F: drivers/nvdimm/of_nvdimm.c +F: Documentation/devicetree/bindings/nvdimm/nvdimm-bus.txt + LIBNVDIMM: NON-VOLATILE MEMORY DEVICE SUBSYSTEM M: Dan Williams L: linux-nvdimm@lists.01.org diff --git a/drivers/nvdimm/Kconfig b/drivers/nvdimm/Kconfig index a65f2e1d9f53..505a9bbbe49f 100644 --- a/drivers/nvdimm/Kconfig +++ b/drivers/nvdimm/Kconfig @@ -102,4 +102,14 @@ config NVDIMM_DAX Select Y if unsure +config OF_NVDIMM + tristate "Device-tree support for NVDIMMs" + depends on OF + default LIBNVDIMM + help + Allows byte addressable persistent memory regions to be described in the + device-tree. + + Select Y if unsure. + endif diff --git a/drivers/nvdimm/Makefile b/drivers/nvdimm/Makefile index 70d5f3ad9909..fd6a5838aa25 100644 --- a/drivers/nvdimm/Makefile +++ b/drivers/nvdimm/Makefile @@ -4,6 +4,7 @@ obj-$(CONFIG_BLK_DEV_PMEM) += nd_pmem.o obj-$(CONFIG_ND_BTT) += nd_btt.o obj-$(CONFIG_ND_BLK) += nd_blk.o obj-$(CONFIG_X86_PMEM_LEGACY) += nd_e820.o +obj-$(CONFIG_OF_NVDIMM) += of_nvdimm.o nd_pmem-y := pmem.o diff --git a/drivers/nvdimm/of_nvdimm.c b/drivers/nvdimm/of_nvdimm.c new file mode 100644 index 000000000000..79c28291f420 --- /dev/null +++ b/drivers/nvdimm/of_nvdimm.c @@ -0,0 +1,130 @@ +// SPDX-License-Identifier: GPL-2.0+ + +#define pr_fmt(fmt) "of_nvdimm: " fmt + +#include +#include +#include +#include +#include +#include + +/* + * Container bus stuff. For now we just chunk regions into a default + * bus with no ndctl support. In the future we'll add some mechanism + * for dispatching regions into the correct bus type, but this is useful + * for now. + */ +struct nvdimm_bus_descriptor bus_desc; +struct nvdimm_bus *bus; + +/* region driver */ + +static const struct attribute_group *region_attr_groups[] = { + &nd_region_attribute_group, + &nd_device_attribute_group, + NULL, +}; + +static const struct attribute_group *bus_attr_groups[] = { + &nvdimm_bus_attribute_group, + NULL, +}; + +static int of_nd_region_probe(struct platform_device *pdev) +{ + struct nd_region_desc ndr_desc; + struct resource temp_res; + struct nd_region *region; + struct device_node *np; + + np = dev_of_node(&pdev->dev); + if (!np) + return -ENXIO; + + pr_err("registering region for %pOF\n", np); + + if (of_address_to_resource(np, 0, &temp_res)) { + pr_warn("Unable to parse reg[0] for %pOF\n", np); + return -ENXIO; + } + + memset(&ndr_desc, 0, sizeof(ndr_desc)); + ndr_desc.res = &temp_res; + ndr_desc.of_node = np; + ndr_desc.attr_groups = region_attr_groups; + ndr_desc.numa_node = of_node_to_nid(np); + set_bit(ND_REGION_PAGEMAP, &ndr_desc.flags); + + /* + * NB: libnvdimm copies the data from ndr_desc into it's own structures + * so passing stack pointers is fine. + */ + if (of_get_property(np, "volatile", NULL)) + region = nvdimm_volatile_region_create(bus, &ndr_desc); + else + region = nvdimm_pmem_region_create(bus, &ndr_desc); + + pr_warn("registered pmem region %px\n", region); + if (!region) + return -ENXIO; + + platform_set_drvdata(pdev, region); + + return 0; +} + +static int of_nd_region_remove(struct platform_device *pdev) +{ + struct nd_region *r = platform_get_drvdata(pdev); + + nd_region_destroy(r); + + return 0; +} + +static const struct of_device_id of_nd_region_match[] = { + { .compatible = "nvdimm-region" }, + { }, +}; + +static struct platform_driver of_nd_region_driver = { + .probe = of_nd_region_probe, + .remove = of_nd_region_remove, + .driver = { + .name = "of_nd_region", + .owner = THIS_MODULE, + .of_match_table = of_nd_region_match, + }, +}; + +/* bus wrangling */ + +static int __init of_nvdimm_init(void) +{ + /* register */ + bus_desc.attr_groups = bus_attr_groups; + bus_desc.provider_name = "of_nvdimm"; + bus_desc.module = THIS_MODULE; + + /* does parent == NULL work? */ + bus = nvdimm_bus_register(NULL, &bus_desc); + if (!bus) + return -ENODEV; + + platform_driver_register(&of_nd_region_driver); + + return 0; +} +module_init(of_nvdimm_init); + +static void __init of_nvdimm_exit(void) +{ + nvdimm_bus_unregister(bus); + platform_driver_unregister(&of_nd_region_driver); +} +module_exit(of_nvdimm_exit); + +MODULE_DEVICE_TABLE(of, of_nd_region_match); +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("IBM Corporation"); From patchwork Fri Mar 23 08:12:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver O'Halloran X-Patchwork-Id: 889800 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 406xNt0b9Zz9s0w for ; Fri, 23 Mar 2018 19:22:38 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="vMDJvW+g"; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 406xNs66CtzF21j for ; Fri, 23 Mar 2018 19:22:37 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="vMDJvW+g"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400e:c00::241; helo=mail-pf0-x241.google.com; envelope-from=oohall@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="vMDJvW+g"; dkim-atps=neutral Received: from mail-pf0-x241.google.com (mail-pf0-x241.google.com [IPv6:2607:f8b0:400e:c00::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 406x9D3dymzF22F for ; Fri, 23 Mar 2018 19:12:32 +1100 (AEDT) Received: by mail-pf0-x241.google.com with SMTP id 123so4445763pfe.0 for ; Fri, 23 Mar 2018 01:12:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=08DEVr3itYiVos2O7WPC8SknnPT1Z7TCM1BNjqCX0ng=; b=vMDJvW+gUiInpw74dMIDqJbdjwytKQED5yE5yss9mS9leuy7fuI0DK516+DlWFdwF0 QJEFRaacAWFanjQMKVB4XHIj68jD0jtLFkWs3DDDzZqPhrmVLWw8V+ND/g7ooLiTM1Tk 2X7QFIhDASWuQ9JYsa9u8JEp6+U8S2AUlNJgFDfVPKBsBrTLqKPUNqX1awaQxXSRQ2bK KgLdtIbyzLghGfc8ffE3s7VJYsttvM96DPW94iyG4d4x1jiDTTgHZ5jOZDWI0P9J+38r sNpRnw4LntMTGbEN5zhg3XYEnw8Qntew5BWVyBalBNDrzejp8IcBoeHL2XGCZ0tMw7Bk 7zQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=08DEVr3itYiVos2O7WPC8SknnPT1Z7TCM1BNjqCX0ng=; b=CwY6fQh4tLI0sn6zISEfwHUseIxGfuRIMyMzIvAu1OK/oZbNGDUSb6OnrddPPxFG2Z yOmiV5/V9qpSeOCb03BO5xVtMcWFmn7VV7CFnoyOtKXIJlsnKZL4VyRM/XBoL7XOjIuJ AmBqmu/2YIHaJym//0RxqmiciKUUxO7LUz0cIJbKWDu1Mh7X+8iY9RlyHBXjAfJBvIgD loqrGc+SRdYKFMhS1RihOeORIlvIUaFpIZIrTKe/NiCQS+SUbo4PzDBSNxCoM2DTBL2y gUsNEVty/5GJksRX+Kn2AWTk8VMjLRb1Jal3vZfjGNv5i6qTjNxqeXrHZ/iWpXtXz9R/ H/eQ== X-Gm-Message-State: AElRT7FQC1bNWxFXwtQV6qcT+PR0gki1j5BvNepqBamXjaGRKUa93NBj ke6pgeN/iS9hBz2alsI4D9bcjQ== X-Google-Smtp-Source: AG47ELsUcXfRCABYifRiQFLYREoUMkfneYKXg9+cnQgQtMUnzLXZb5p29H2XS1rUP8jejHmXdQFE6A== X-Received: by 10.99.184.1 with SMTP id p1mr17573416pge.96.1521792749776; Fri, 23 Mar 2018 01:12:29 -0700 (PDT) Received: from localhost.localdomain ([203.220.205.233]) by smtp.gmail.com with ESMTPSA id q67sm7474808pfg.39.2018.03.23.01.12.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Mar 2018 01:12:29 -0700 (PDT) From: Oliver O'Halloran To: linux-nvdimm@lists.01.org Subject: [PATCH 4/6] libnvdimm/of: Symlink platform and region devices Date: Fri, 23 Mar 2018 19:12:07 +1100 Message-Id: <20180323081209.31387-4-oohall@gmail.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20180323081209.31387-1-oohall@gmail.com> References: <20180323081209.31387-1-oohall@gmail.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Oliver O'Halloran , linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Add a way direct link between the region and the platform device that creates the region. Signed-off-by: Oliver O'Halloran --- drivers/nvdimm/of_nvdimm.c | 11 +++++++++++ drivers/nvdimm/region_devs.c | 13 +++++++++++++ include/linux/libnvdimm.h | 1 + 3 files changed, 25 insertions(+) diff --git a/drivers/nvdimm/of_nvdimm.c b/drivers/nvdimm/of_nvdimm.c index 79c28291f420..28f4ca23a690 100644 --- a/drivers/nvdimm/of_nvdimm.c +++ b/drivers/nvdimm/of_nvdimm.c @@ -37,6 +37,7 @@ static int of_nd_region_probe(struct platform_device *pdev) struct resource temp_res; struct nd_region *region; struct device_node *np; + int rc; np = dev_of_node(&pdev->dev); if (!np) @@ -71,6 +72,15 @@ static int of_nd_region_probe(struct platform_device *pdev) platform_set_drvdata(pdev, region); + /* + * Add a symlink to the ndbus region object. Without this there's no + * simple way to go from the platform device to the region it spawned. + */ + rc = sysfs_create_link(&pdev->dev.kobj, + nd_region_kobj(region), "region"); + if (rc) + pr_warn("Failed to create symlink to region (rc = %d)!\n", rc); + return 0; } @@ -78,6 +88,7 @@ static int of_nd_region_remove(struct platform_device *pdev) { struct nd_region *r = platform_get_drvdata(pdev); + sysfs_delete_link(&pdev->dev.kobj, nd_region_kobj(r), "region"); nd_region_destroy(r); return 0; diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c index 76f46fd1fae0..af09acc1d93b 100644 --- a/drivers/nvdimm/region_devs.c +++ b/drivers/nvdimm/region_devs.c @@ -1054,6 +1054,19 @@ struct nd_region *nvdimm_volatile_region_create(struct nvdimm_bus *nvdimm_bus, } EXPORT_SYMBOL_GPL(nvdimm_volatile_region_create); +struct kobject *nd_region_kobj(struct nd_region *region) +{ + /* + * region init is async so we need to explicitly synchronise + * to prevent handing out a kobj reference before device_add() + * has been run + */ + nd_synchronize(); + + return ®ion->dev.kobj; +} +EXPORT_SYMBOL_GPL(nd_region_kobj); + /** * nvdimm_flush - flush any posted write queues between the cpu and pmem media * @nd_region: blk or interleaved pmem region diff --git a/include/linux/libnvdimm.h b/include/linux/libnvdimm.h index df21ca176e98..a4b3663bac38 100644 --- a/include/linux/libnvdimm.h +++ b/include/linux/libnvdimm.h @@ -172,6 +172,7 @@ struct nvdimm_bus_descriptor *to_nd_desc(struct nvdimm_bus *nvdimm_bus); struct device *to_nvdimm_bus_dev(struct nvdimm_bus *nvdimm_bus); const char *nvdimm_name(struct nvdimm *nvdimm); struct kobject *nvdimm_kobj(struct nvdimm *nvdimm); +struct kobject *nd_region_kobj(struct nd_region *region); unsigned long nvdimm_cmd_mask(struct nvdimm *nvdimm); void *nvdimm_provider_data(struct nvdimm *nvdimm); struct nvdimm *nvdimm_create(struct nvdimm_bus *nvdimm_bus, void *provider_data, From patchwork Fri Mar 23 08:12:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver O'Halloran X-Patchwork-Id: 889804 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 406xRp6BcWz9s1B for ; Fri, 23 Mar 2018 19:25:10 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="lrymREjs"; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 406xRp4XLyzF0QC for ; Fri, 23 Mar 2018 19:25:10 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="lrymREjs"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400e:c05::242; helo=mail-pg0-x242.google.com; envelope-from=oohall@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="lrymREjs"; dkim-atps=neutral Received: from mail-pg0-x242.google.com (mail-pg0-x242.google.com [IPv6:2607:f8b0:400e:c05::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 406x9H1QpGzF21K for ; Fri, 23 Mar 2018 19:12:35 +1100 (AEDT) Received: by mail-pg0-x242.google.com with SMTP id v26so1796852pge.11 for ; Fri, 23 Mar 2018 01:12:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=bDukI+qndcZv3FlCitgq33eNZpzcSDhQMhFZJaX0kR8=; b=lrymREjsoxu7WgAOY1Sg1G/Ps8oheqo7k4L/WQcA85m0E0jakAodk39fQq2C9GWRY+ W8wRHJJR4eHkl6smpr7RnpYRtBdlzvsYHacLK0tEyPtx5WLL9VUcowX/1rfOWNenszan 3T8HsSmQhsSt7GX+SJEZg8pqtzC1foQ2iCSMuAErXa4edstY9WPRFRzimspr7Cdade2L EWwN7i3U8YWpoWOfR7Pgnd1nY8FB3BEpClnCqDAwUhUxKM1cMO/3/75J7KgF+JHQGWto 2llQraKXpJFASyP7rSvZv9DTnlgZpsbTAwiRWehDaodnbFEgEM6ZrNmoULHGNfUw+9a3 dq/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=bDukI+qndcZv3FlCitgq33eNZpzcSDhQMhFZJaX0kR8=; b=KNyAEvv5JkZ2I71pdVwn7sfQxUYcFGZ6IUNd7snMBwOb2in5LUInlMcxOL6Rl86a6u dFeR8EnptryoqHiJOOkVymxjrCNyzDMephAR7kTpj4xEjzzd0bs3e7L8M2E0vwA9STUm IQiwko9JqVM6Gcm7X+3xY0x0brnOSzmTURxt+wQyxl/GOeg48qA/A/4oQXtx+dftXKYo qjV3gypUluIQUEWyYtqarp2zxgob+6K3t9AyDspRyr32t5fhve88d2UkAuoFD+jJHxEk JJLc45XI4+6vz8+fqlBjf0WReW2mP6FRzN9btTbk2UBrdHPOVIsg5zBF6/UcvVE1h6tZ trhg== X-Gm-Message-State: AElRT7EIPpZE3nf4Kp8W7jF+VN/kPUgyvAh5W7pQ/9YQysqy/PbiE8dv gQ3yM6myX40xKgEcwJExy9Y= X-Google-Smtp-Source: AG47ELufUNbYzaNphSSGkbcCNWSHRo+gixF+u/oE1s7ffSSUXXmYZVxTUbScjjTAd7CSCeSl+KacQg== X-Received: by 10.101.101.204 with SMTP id y12mr20492820pgv.142.1521792752778; Fri, 23 Mar 2018 01:12:32 -0700 (PDT) Received: from localhost.localdomain ([203.220.205.233]) by smtp.gmail.com with ESMTPSA id q67sm7474808pfg.39.2018.03.23.01.12.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Mar 2018 01:12:32 -0700 (PDT) From: Oliver O'Halloran To: linux-nvdimm@lists.01.org Subject: [PATCH 5/6] powerpc/powernv: Create platform devs for nvdimm buses Date: Fri, 23 Mar 2018 19:12:08 +1100 Message-Id: <20180323081209.31387-5-oohall@gmail.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20180323081209.31387-1-oohall@gmail.com> References: <20180323081209.31387-1-oohall@gmail.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Oliver O'Halloran , linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Scan the devicetree for an nvdimm-bus compatible and create a platform device for them. Signed-off-by: Oliver O'Halloran --- arch/powerpc/platforms/powernv/opal.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c index c15182765ff5..a16f4b63ccf2 100644 --- a/arch/powerpc/platforms/powernv/opal.c +++ b/arch/powerpc/platforms/powernv/opal.c @@ -821,6 +821,9 @@ static int __init opal_init(void) /* Create i2c platform devices */ opal_pdev_init("ibm,opal-i2c"); + /* Handle non-volatile memory devices */ + opal_pdev_init("nvdimm-region"); + /* Setup a heatbeat thread if requested by OPAL */ opal_init_heartbeat(); From patchwork Fri Mar 23 08:12:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver O'Halloran X-Patchwork-Id: 889809 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 406xVl0J8gz9s1B for ; Fri, 23 Mar 2018 19:27:43 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Kn5ePw84"; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 406xVk5hqkzDq85 for ; Fri, 23 Mar 2018 19:27:42 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Kn5ePw84"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400e:c00::241; helo=mail-pf0-x241.google.com; envelope-from=oohall@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Kn5ePw84"; dkim-atps=neutral Received: from mail-pf0-x241.google.com (mail-pf0-x241.google.com [IPv6:2607:f8b0:400e:c00::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 406x9K6GwSzF21K for ; Fri, 23 Mar 2018 19:12:37 +1100 (AEDT) Received: by mail-pf0-x241.google.com with SMTP id d26so4441335pfn.5 for ; Fri, 23 Mar 2018 01:12:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/EZGlDXJ8j0mcmeud2ubkmNc3x8F7+NFN8VZRaJiACk=; b=Kn5ePw84fckyb5PwdcSSRDPK31zEGfXZGUFkmCB6uVkTh6jxDcOnD6ePmoUdgRq4b/ t6GZhqtt3XtaHcaUiBh6SJrEyv9o4hMUyauOblGFn146IvqgTXSb59Nj0i95LEXvNLWv qd4alMg4ciF0/PARwTYjuIksiHZYKJYmupNU+VCQF532eb79WaPhzdzwNFl2CwIt/fra sdJ8lOIb16wfYrEJncQmSqcza/5fihT1bam0PbkwYKnFX7bPYm7KJ7Hr/RePFGLlUnxJ SoUZ9QwxVCqW3vcWYRj5loAZlObyRqzGx7swlz1jpKZiIEi+4boZH2ZpLZ+L5OWDcVLK NHew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/EZGlDXJ8j0mcmeud2ubkmNc3x8F7+NFN8VZRaJiACk=; b=WGQBTXJZ/O1VtPUhHrlBOfTlVL7ZbUwA0OgFWAfTtk0uLAWjAV5vO8wK8sD1p95+QW ruseKnWJJr67LZMl8u0ZB4y0+Uk0dPEPZ9TBziF6pSxoQz2xHUN5P8pt2+XUJQl1a4e3 2uiyynQAP4IkqzjeLHY+EOzGjOD+xZgzPgBp6aOog29LBlozh2hs6uMH7jrE/nd2UQC2 gVY6dq6srVzoG2peLwUD2NAgHPRjd0TlpoWVnSDFK0N7fgxfHUN6gEt7+yaVBQBuLwnp qceWO0qioXJa6Mp91hoxswm2GldKcMn6H/9rxgWtOlUq5tvXIrHJ+0B5y8OZoVVLit8b uDcQ== X-Gm-Message-State: AElRT7FzZ8LTMEoJjqUs6kYKNFyYv5CHpzsVzaCeI0FB4O4kWbVso8bl KSwW8TLWtVa/W3ORxRM0vsYWdg== X-Google-Smtp-Source: AG47ELvBoQmhTltykyz4xsICKrIQpY5NxRH93YpOLSc5ce1CAt6GMWleJPipqgmw817LOjmYt8cZoA== X-Received: by 10.99.132.72 with SMTP id k69mr20358464pgd.367.1521792755540; Fri, 23 Mar 2018 01:12:35 -0700 (PDT) Received: from localhost.localdomain ([203.220.205.233]) by smtp.gmail.com with ESMTPSA id q67sm7474808pfg.39.2018.03.23.01.12.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Mar 2018 01:12:35 -0700 (PDT) From: Oliver O'Halloran To: linux-nvdimm@lists.01.org Subject: [PATCH 6/6] doc/devicetree: NVDIMM region documentation Date: Fri, 23 Mar 2018 19:12:09 +1100 Message-Id: <20180323081209.31387-6-oohall@gmail.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20180323081209.31387-1-oohall@gmail.com> References: <20180323081209.31387-1-oohall@gmail.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Oliver O'Halloran , linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Add device-tree binding documentation for the nvdimm region driver. Cc: devicetree@vger.kernel.org Signed-off-by: Oliver O'Halloran --- .../devicetree/bindings/nvdimm/nvdimm-region.txt | 45 ++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 Documentation/devicetree/bindings/nvdimm/nvdimm-region.txt diff --git a/Documentation/devicetree/bindings/nvdimm/nvdimm-region.txt b/Documentation/devicetree/bindings/nvdimm/nvdimm-region.txt new file mode 100644 index 000000000000..02091117ff16 --- /dev/null +++ b/Documentation/devicetree/bindings/nvdimm/nvdimm-region.txt @@ -0,0 +1,45 @@ +Device-tree bindings for NVDIMM memory regions +----------------------------------------------------- + +Non-volatile DIMMs are memory modules used to provide (cacheable) main memory +that retains its contents across power cycles. In more practical terms, they +are kind of storage device where the contents can be accessed by the CPU +directly, rather than indirectly via a storage controller or similar. The an +nvdimm-region specifies a physical address range that is hosted on an NVDIMM +device. + +Bindings for the region nodes: +----------------------------- + +Required properties: + - compatible = "nvdimm-region" + + - reg = ; + The system physical address range of this nvdimm region. + +Optional properties: + - Any relevant NUMA assocativity properties for the target platform. + - A "volatile" property indicating that this region is actually in + normal DRAM and does not require cache flushes after each write. + +A complete example: +-------------------- + +/ { + #size-cells = <2>; + #address-cells = <2>; + + platform { + region@5000 { + compatible = "nvdimm-region; + reg = <0x00000001 0x00000000 0x00000000 0x40000000> + + }; + + region@6000 { + compatible = "nvdimm-region"; + reg = <0x00000001 0x00000000 0x00000000 0x40000000> + volatile; + }; + }; +};