From patchwork Tue Jun 9 23:10:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Toshi Kani X-Patchwork-Id: 6575661 Return-Path: X-Original-To: patchwork-linux-acpi@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 7617C9F3D1 for ; Tue, 9 Jun 2015 23:11:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 86DA12054D for ; Tue, 9 Jun 2015 23:11:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9DCDC2055D for ; Tue, 9 Jun 2015 23:11:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932708AbbFIXLS (ORCPT ); Tue, 9 Jun 2015 19:11:18 -0400 Received: from g4t3427.houston.hp.com ([15.201.208.55]:56351 "EHLO g4t3427.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932532AbbFIXK4 (ORCPT ); Tue, 9 Jun 2015 19:10:56 -0400 Received: from g9t2301.houston.hp.com (g9t2301.houston.hp.com [16.216.185.78]) by g4t3427.houston.hp.com (Postfix) with ESMTP id 7513A166; Tue, 9 Jun 2015 23:10:55 +0000 (UTC) Received: from misato.fc.hp.com (misato.fc.hp.com [16.78.168.61]) by g9t2301.houston.hp.com (Postfix) with ESMTP id DB03283; Tue, 9 Jun 2015 23:10:54 +0000 (UTC) From: Toshi Kani To: rjw@rjwysocki.net, dan.j.williams@intel.com Cc: linux-acpi@vger.kernel.org, linux-nvdimm@lists.01.org, linux-kernel@vger.kernel.org, Toshi Kani Subject: [PATCH v2 2/3] libnvdimm: Set numa_node to NVDIMM devices Date: Tue, 9 Jun 2015 17:10:39 -0600 Message-Id: <1433891440-3515-3-git-send-email-toshi.kani@hp.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1433891440-3515-1-git-send-email-toshi.kani@hp.com> References: <1433891440-3515-1-git-send-email-toshi.kani@hp.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 ACPI NFIT table has System Physical Address Range Structure entries that describe a proximity ID of each range when ACPI_NFIT_PROXIMITY_VALID is set in the flags. Change acpi_nfit_register_region() to map a proximity ID to its node ID, and set it to a new numa_node field of nd_region_desc, which is then conveyed to nd_region. nd_region_probe() and nd_btt_probe() set the numa_node of nd_region to their device object being probed. A namespace device inherits the numa_node from the parent region device. Signed-off-by: Toshi Kani --- drivers/acpi/nfit.c | 6 ++++++ drivers/nvdimm/btt.c | 2 ++ drivers/nvdimm/nd.h | 1 + drivers/nvdimm/region.c | 1 + drivers/nvdimm/region_devs.c | 1 + include/linux/libnvdimm.h | 1 + 6 files changed, 12 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/acpi/nfit.c b/drivers/acpi/nfit.c index 5731e4a..69dc6e0 100644 --- a/drivers/acpi/nfit.c +++ b/drivers/acpi/nfit.c @@ -1255,6 +1255,12 @@ static int acpi_nfit_register_region(struct acpi_nfit_desc *acpi_desc, ndr_desc->res = &res; ndr_desc->provider_data = nfit_spa; ndr_desc->attr_groups = acpi_nfit_region_attribute_groups; + if (spa->flags & ACPI_NFIT_PROXIMITY_VALID) + ndr_desc->numa_node = acpi_map_pxm_to_online_node( + spa->proximity_domain); + else + ndr_desc->numa_node = NUMA_NO_NODE; + list_for_each_entry(nfit_memdev, &acpi_desc->memdevs, list) { struct acpi_nfit_memory_map *memdev = nfit_memdev->memdev; struct nd_mapping *nd_mapping; diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c index 2d7ce9e..3b3e115 100644 --- a/drivers/nvdimm/btt.c +++ b/drivers/nvdimm/btt.c @@ -1369,6 +1369,8 @@ static int nd_btt_probe(struct device *dev) rc = -ENOMEM; goto err_btt; } + + set_dev_node(dev, nd_region->numa_node); dev_set_drvdata(dev, btt); return 0; diff --git a/drivers/nvdimm/nd.h b/drivers/nvdimm/nd.h index c807379..fefd8f6 100644 --- a/drivers/nvdimm/nd.h +++ b/drivers/nvdimm/nd.h @@ -108,6 +108,7 @@ struct nd_region { u64 ndr_size; u64 ndr_start; int id, num_lanes; + int numa_node; void *provider_data; struct nd_interleave_set *nd_set; struct nd_mapping mapping[0]; diff --git a/drivers/nvdimm/region.c b/drivers/nvdimm/region.c index 373eab4..783220e 100644 --- a/drivers/nvdimm/region.c +++ b/drivers/nvdimm/region.c @@ -123,6 +123,7 @@ static int nd_region_probe(struct device *dev) num_ns->active = rc; num_ns->count = rc + err; + set_dev_node(dev, nd_region->numa_node); dev_set_drvdata(dev, num_ns); if (err == 0) diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c index 86adbd8..352bc80 100644 --- a/drivers/nvdimm/region_devs.c +++ b/drivers/nvdimm/region_devs.c @@ -627,6 +627,7 @@ static noinline struct nd_region *nd_region_create(struct nvdimm_bus *nvdimm_bus nd_region->provider_data = ndr_desc->provider_data; nd_region->nd_set = ndr_desc->nd_set; nd_region->num_lanes = ndr_desc->num_lanes; + nd_region->numa_node = ndr_desc->numa_node; ida_init(&nd_region->ns_ida); dev = &nd_region->dev; dev_set_name(dev, "region%d", nd_region->id); diff --git a/include/linux/libnvdimm.h b/include/linux/libnvdimm.h index 96b9507..5d0c75a 100644 --- a/include/linux/libnvdimm.h +++ b/include/linux/libnvdimm.h @@ -78,6 +78,7 @@ struct nd_region_desc { struct nd_interleave_set *nd_set; void *provider_data; int num_lanes; + int numa_node; }; struct nvdimm_bus;