Allow XEN_SYSCTL_nvdimm_pmem_get_regions_nr to return the number of
management PMEM regions.

Signed-off-by: Haozhong Zhang <[email protected]>
---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Tim Deegan <[email protected]>
---
 tools/libxc/xc_misc.c | 4 +++-
 xen/common/pmem.c     | 4 ++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/tools/libxc/xc_misc.c b/tools/libxc/xc_misc.c
index d6b30534d2..bc0be2e1ae 100644
--- a/tools/libxc/xc_misc.c
+++ b/tools/libxc/xc_misc.c
@@ -894,7 +894,9 @@ int xc_nvdimm_pmem_get_regions_nr(xc_interface *xch, 
uint8_t type, uint32_t *nr)
     struct xen_sysctl_nvdimm_op *nvdimm = &sysctl.u.nvdimm;
     int rc;
 
-    if ( !nr || type != PMEM_REGION_TYPE_RAW )
+    if ( !nr ||
+         (type != PMEM_REGION_TYPE_RAW &&
+          type != PMEM_REGION_TYPE_MGMT) )
         return -EINVAL;
 
     sysctl.cmd = XEN_SYSCTL_nvdimm_op;
diff --git a/xen/common/pmem.c b/xen/common/pmem.c
index 936cf1423f..4de03f6f2d 100644
--- a/xen/common/pmem.c
+++ b/xen/common/pmem.c
@@ -134,6 +134,10 @@ static int 
pmem_get_regions_nr(xen_sysctl_nvdimm_pmem_regions_nr_t *regions_nr)
         regions_nr->num_regions = nr_raw_regions;
         break;
 
+    case PMEM_REGION_TYPE_MGMT:
+        regions_nr->num_regions = nr_mgmt_regions;
+        break;
+
     default:
         rc = -EINVAL;
     }
-- 
2.15.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to