From patchwork Mon Sep 11 04:38:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haozhong Zhang X-Patchwork-Id: 9946555 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A4807603F4 for ; Mon, 11 Sep 2017 04:41:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9AE54289DE for ; Mon, 11 Sep 2017 04:41:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8FC1128AD7; Mon, 11 Sep 2017 04:41:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3F7F928ABE for ; Mon, 11 Sep 2017 04:41:19 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1drGVV-00024u-N5; Mon, 11 Sep 2017 04:39:37 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1drGVU-00022S-KX for xen-devel@lists.xen.org; Mon, 11 Sep 2017 04:39:36 +0000 Received: from [193.109.254.147] by server-11.bemta-6.messagelabs.com id CA/31-03616-88316B95; Mon, 11 Sep 2017 04:39:36 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrNLMWRWlGSWpSXmKPExsXS1tYhotsuvC3 SoPejtMWSj4tZHBg9ju7+zRTAGMWamZeUX5HAmnHz4z7Ggj9cFf+Pn2FpYPzC0cXIxSEkMJ1R YvG0b4xdjJwcEgK8EkeWzWCFsAMkWo60sUEU9TJKTNuwDSzBJqAvseLxQTBbREBa4trny4wgR cwCp5gkOuYeYAZJCAsUS5z+dxOoiIODRUBV4vNTV5Awr4CdxJetr1ggFshL7Gq7CDaHEyh+8O U7sFYhAVuJBacXsE5g5F3AyLCKUaM4tagstUjXyFwvqSgzPaMkNzEzR9fQwEwvN7W4ODE9NSc xqVgvOT93EyMwIBiAYAfj4rWBhxglOZiURHnfHd8SKcSXlJ9SmZFYnBFfVJqTWnyIUYaDQ0mC V0VoW6SQYFFqempFWmYOMDRh0hIcPEoivFEgad7igsTc4sx0iNQpRl2Ojpt3/zAJseTl56VKi fPKgRQJgBRllObBjYDFySVGWSlhXkago4R4ClKLcjNLUOVfMYpzMCoJ80aATOHJzCuB2/QK6A gmoCN4Lm0BOaIkESEl1cCY9yq8lvWbvvx98VvTlnwN+dMixXbttWJ8nMmB6c0necKmFc9M/9P N9pTlz6XK+TliOy58czz1wlmTgaljwT6lkArr7abv1tY39ApPTTq6UOHl3cuqkpyXHnxYk+mW H8Sx5djETKnEz2Zb3h7avuJ2wYwjETKW3AFrtxy9sz13zRGmjtm9/w72KbEUZyQaajEXFScCA DZC8kOOAgAA X-Env-Sender: haozhong.zhang@intel.com X-Msg-Ref: server-2.tower-27.messagelabs.com!1505104735!56506342!18 X-Originating-IP: [134.134.136.20] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTM0LjEzNC4xMzYuMjAgPT4gMzU1MzU4\n X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 49940 invoked from network); 11 Sep 2017 04:39:35 -0000 Received: from mga02.intel.com (HELO mga02.intel.com) (134.134.136.20) by server-2.tower-27.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 11 Sep 2017 04:39:35 -0000 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Sep 2017 21:39:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.42,376,1500966000"; d="scan'208"; a="1217078488" Received: from hz-desktop.sh.intel.com (HELO localhost) ([10.239.159.142]) by fmsmga002.fm.intel.com with ESMTP; 10 Sep 2017 21:39:32 -0700 From: Haozhong Zhang To: xen-devel@lists.xen.org Date: Mon, 11 Sep 2017 12:38:04 +0800 Message-Id: <20170911043820.14617-24-haozhong.zhang@intel.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170911043820.14617-1-haozhong.zhang@intel.com> References: <20170911043820.14617-1-haozhong.zhang@intel.com> Cc: Haozhong Zhang , Wei Liu , Andrew Cooper , Ian Jackson , Jan Beulich , Chao Peng , Dan Williams Subject: [Xen-devel] [RFC XEN PATCH v3 23/39] xen/pmem: support PMEM_REGION_TYPE_DATA for XEN_SYSCTL_nvdimm_pmem_get_regions_nr X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Allow XEN_SYSCTL_nvdimm_pmem_get_regions_nr to return the number of data PMEM regions. Signed-off-by: Haozhong Zhang --- Cc: Ian Jackson Cc: Wei Liu Cc: Andrew Cooper Cc: Jan Beulich --- tools/libxc/xc_misc.c | 3 ++- xen/common/pmem.c | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/libxc/xc_misc.c b/tools/libxc/xc_misc.c index ef2e9e0656..db74df853a 100644 --- a/tools/libxc/xc_misc.c +++ b/tools/libxc/xc_misc.c @@ -896,7 +896,8 @@ int xc_nvdimm_pmem_get_regions_nr(xc_interface *xch, uint8_t type, uint32_t *nr) if ( !nr || (type != PMEM_REGION_TYPE_RAW && - type != PMEM_REGION_TYPE_MGMT) ) + type != PMEM_REGION_TYPE_MGMT && + type != PMEM_REGION_TYPE_DATA) ) return -EINVAL; sysctl.cmd = XEN_SYSCTL_nvdimm_op; diff --git a/xen/common/pmem.c b/xen/common/pmem.c index 6891ed7a47..cbe557c220 100644 --- a/xen/common/pmem.c +++ b/xen/common/pmem.c @@ -162,6 +162,10 @@ static int pmem_get_regions_nr(xen_sysctl_nvdimm_pmem_regions_nr_t *regions_nr) regions_nr->num_regions = nr_mgmt_regions; break; + case PMEM_REGION_TYPE_DATA: + regions_nr->num_regions = nr_data_regions; + break; + default: rc = -EINVAL; }