NVDIMM Device and Persistent Memory development
 help / color / mirror / Atom feed
From: Ira Weiny <ira.weiny@intel.com>
To: Alison Schofield <alison.schofield@intel.com>, <ira.weiny@intel.com>
Cc: Vishal Verma <vishal.l.verma@intel.com>,
	Jonathan Cameron <jonathan.cameron@huawei.com>,
	Fan Ni <fan.ni@samsung.com>,
	Navneet Singh <navneet.singh@intel.com>,
	Dan Williams <dan.j.williams@intel.com>,
	"Dave Jiang" <dave.jiang@intel.com>, <linux-cxl@vger.kernel.org>,
	<nvdimm@lists.linux.dev>,
	Sushant1 Kumar <sushant1.kumar@intel.com>
Subject: Re: [ndctl PATCH v2 4/6] cxl/region: Add creation of Dynamic capacity regions
Date: Thu, 7 Nov 2024 15:28:13 -0600	[thread overview]
Message-ID: <672d30ed15788_1b17eb29449@iweiny-mobl.notmuch> (raw)
In-Reply-To: <Zy0AK9FHMvst9fm3@aschofie-mobl2.lan>

Alison Schofield wrote:
> On Mon, Nov 04, 2024 at 08:10:48PM -0600, Ira Weiny wrote:
> > From: Navneet Singh <navneet.singh@intel.com>
> > 
> > CXL Dynamic Capacity Devices (DCDs) optionally support dynamic capacity
> > with up to eight partitions (Regions) (dc0-dc7).  CXL regions can now be
> > spare and defined as dynamic capacity (dc).
> > 
> > Add support for DCD devices.  Query for DCD capabilities.  Add the
> > ability to add DC partitions to a CXL DC region.
> > 
> > Signed-off-by: Navneet Singh <navneet.singh@intel.com>
> > Co-authored-by: Sushant1 Kumar <sushant1.kumar@intel.com>
> > Signed-off-by: Sushant1 Kumar <sushant1.kumar@intel.com>
> > Co-authored-by: Ira Weiny <ira.weiny@intel.com>
> > Signed-off-by: Ira Weiny <ira.weiny@intel.com>
> > 
> > ---
> > Changes:
> > [Fan: Properly initialize index]
> > ---
> >  cxl/json.c         | 26 +++++++++++++++
> >  cxl/lib/libcxl.c   | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
> >  cxl/lib/libcxl.sym |  3 ++
> >  cxl/lib/private.h  |  6 +++-
> >  cxl/libcxl.h       | 55 +++++++++++++++++++++++++++++--
> >  cxl/memdev.c       |  7 +++-
> >  cxl/region.c       | 49 ++++++++++++++++++++++++++--
> >  7 files changed, 234 insertions(+), 7 deletions(-)
> > 
> > diff --git a/cxl/json.c b/cxl/json.c
> > index dcd3cc28393faf7e8adf299a857531ecdeaac50a..915b2716a524fa8929ed34b01a7cb6590b61d4b7 100644
> > --- a/cxl/json.c
> > +++ b/cxl/json.c
> > @@ -754,10 +754,12 @@ err_free:
> >  	return jpoison;
> >  }
> >  
> > +#define DC_SIZE_NAME_LEN 64
> >  struct json_object *util_cxl_memdev_to_json(struct cxl_memdev *memdev,
> >  		unsigned long flags)
> >  {
> >  	const char *devname = cxl_memdev_get_devname(memdev);
> > +	char size_name[DC_SIZE_NAME_LEN];
> >  	struct json_object *jdev, *jobj;
> >  	unsigned long long serial, size;
> >  	const char *fw_version;
> > @@ -800,6 +802,17 @@ struct json_object *util_cxl_memdev_to_json(struct cxl_memdev *memdev,
> >  		}
> >  	}
> >  
> > +	for (int index = 0; index < MAX_NUM_DC_REGIONS; index++) {
> > +		size = cxl_memdev_get_dc_size(memdev, index);
> > +		if (size) {
> > +			jobj = util_json_object_size(size, flags);
> > +			if (jobj) {
> > +				sprintf(size_name, "dc%d_size", index);
> > +				json_object_object_add(jdev,
> > +						       size_name, jobj);
> > +			}
> > +		}
> > +	}
> 
> how about reducing above indentation -
> 
> 		if (!size)
> 			continue;
> 		jobj = util_json_object_size(size, flags);
> 		if (!jobj)
> 			continue;
> 		sprintf(size_name, "dc%d_size", index);
> 		json_object_object_add(jdev, size_name, jobj);
> 

ok yea that works.


> 
> 
> 
> >  	if (flags & UTIL_JSON_HEALTH) {
> >  		jobj = util_cxl_memdev_health_to_json(memdev, flags);
> >  		if (jobj)
> > @@ -948,11 +961,13 @@ struct json_object *util_cxl_bus_to_json(struct cxl_bus *bus,
> >  	return jbus;
> >  }
> >  
> > +#define DC_CAPABILITY_NAME_LEN 16
> >  struct json_object *util_cxl_decoder_to_json(struct cxl_decoder *decoder,
> >  					     unsigned long flags)
> >  {
> >  	const char *devname = cxl_decoder_get_devname(decoder);
> >  	struct cxl_port *port = cxl_decoder_get_port(decoder);
> > +	char dc_capable_name[DC_CAPABILITY_NAME_LEN];
> >  	struct json_object *jdecoder, *jobj;
> >  	struct cxl_region *region;
> >  	u64 val, size;
> > @@ -1059,6 +1074,17 @@ struct json_object *util_cxl_decoder_to_json(struct cxl_decoder *decoder,
> >  				json_object_object_add(
> >  					jdecoder, "volatile_capable", jobj);
> >  		}
> > +		for (int index = 0; index < MAX_NUM_DC_REGIONS; index++) {
> > +			if (cxl_decoder_is_dc_capable(decoder, index)) {
> > +				jobj = json_object_new_boolean(true);
> > +				if (jobj) {
> > +					sprintf(dc_capable_name, "dc%d_capable", index);
> > +					json_object_object_add(jdecoder,
> > +							       dc_capable_name,
> > +							       jobj);
> > +				}
> > +			}
> 
> and similar above.

done.

Thanks,
Ira

> 
> 
> snip
> 
> 



  reply	other threads:[~2024-11-07 21:28 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-05  2:10 [ndctl PATCH v2 0/6] ndctl: DCD additions Ira Weiny
2024-11-05  2:10 ` [ndctl PATCH v2 1/6] ndctl/cxl-events: Don't fail test until event counts are reported Ira Weiny
2024-11-05 15:44   ` Dave Jiang
2025-02-09  1:25   ` Alison Schofield
2024-11-05  2:10 ` [ndctl PATCH v2 2/6] ndctl/cxl/region: Report max size for region creation Ira Weiny
2024-11-05 15:45   ` Dave Jiang
2024-11-05 21:46   ` Fan Ni
2025-02-09  1:26   ` Alison Schofield
2024-11-05  2:10 ` [ndctl PATCH v2 3/6] ndctl: Separate region mode from decoder mode Ira Weiny
2024-11-05 15:56   ` Dave Jiang
2024-11-05 21:49   ` Fan Ni
2024-11-05  2:10 ` [ndctl PATCH v2 4/6] cxl/region: Add creation of Dynamic capacity regions ira.weiny
2024-11-05 16:38   ` Dave Jiang
2024-11-05 20:38     ` Ira Weiny
2024-11-06  3:16   ` Alison Schofield
2024-11-07 18:00   ` Alison Schofield
2024-11-07 21:28     ` Ira Weiny [this message]
2024-11-07 18:27   ` Alison Schofield
2024-11-07 18:52   ` Alison Schofield
2024-11-08 20:17     ` Ira Weiny
2024-11-05  2:10 ` [ndctl PATCH v2 5/6] ndctl/cxl: Add extent output to region query Ira Weiny
2024-11-05 17:04   ` Dave Jiang
2024-11-05 20:53     ` Ira Weiny
2024-11-07 18:13   ` Alison Schofield
2024-11-08 20:16     ` Ira Weiny
2024-11-05  2:10 ` [ndctl PATCH v2 6/6] ndctl/cxl/test: Add Dynamic Capacity tests Ira Weiny
2024-11-05 17:11   ` Dave Jiang
2024-11-05 19:53     ` Ira Weiny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=672d30ed15788_1b17eb29449@iweiny-mobl.notmuch \
    --to=ira.weiny@intel.com \
    --cc=alison.schofield@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=fan.ni@samsung.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=navneet.singh@intel.com \
    --cc=nvdimm@lists.linux.dev \
    --cc=sushant1.kumar@intel.com \
    --cc=vishal.l.verma@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox