qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron via <qemu-devel@nongnu.org>
To: Fan Ni <fan.ni@samsung.com>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"linux-cxl@vger.kernel.org" <linux-cxl@vger.kernel.org>,
	"gregory.price@memverge.com" <gregory.price@memverge.com>,
	"hchkuo@avery-design.com.tw" <hchkuo@avery-design.com.tw>,
	"cbrowy@avery-design.com" <cbrowy@avery-design.com>,
	"ira.weiny@intel.com" <ira.weiny@intel.com>,
	"dan.j.williams@intel.com" <dan.j.williams@intel.com>,
	 Adam Manzanares <a.manzanares@samsung.com>,
	"dave@stgolabs.net" <dave@stgolabs.net>,
	"nmtadam.samsung@gmail.com" <nmtadam.samsung@gmail.com>,
	 "nifan@outlook.com" <nifan@outlook.com>
Subject: Re: [RFC 3/7] hw/mem/cxl_type3: Add a parameter to pass number of DC regions the device supports in qemu command line
Date: Mon, 15 May 2023 15:03:30 +0100	[thread overview]
Message-ID: <20230515150330.000033d8@Huawei.com> (raw)
In-Reply-To: <20230511175609.2091136-4-fan.ni@samsung.com>

On Thu, 11 May 2023 17:56:40 +0000
Fan Ni <fan.ni@samsung.com> wrote:

> From: Fan Ni <nifan@outlook.com>
> 
> Add a property 'num-dc-regions' to ct3_props to allow users to create DC
> regions.
> With the change, users can control the number of DC regions the device
> supports.
> To make it easier, other parameters of the region like region base, length,
> and block size are hard coded. If desired, these parameters
> can be added easily.
> 
> Signed-off-by: Fan Ni <fan.ni@samsung.com>

Ok. This is fine for initial testing, but we need to figure out how to actually
handle DCD regions and how to back them with memory.
Probably a 3rd memory backend to cover all the DCD regions?
Default perhaps to an even spread of a few regions (no real point in doing
more than 2 for initial support, fall back to 1 region if size is too small).
We will want to be able to mess with regions from the FM-API but lots more to
do there before that matters and we can still have default config for any
regions we define now.

Jonathan

> ---
>  hw/mem/cxl_type3.c | 32 ++++++++++++++++++++++++++++++++
>  1 file changed, 32 insertions(+)
> 
> diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c
> index 2b483d3d8e..b9c375d9b4 100644
> --- a/hw/mem/cxl_type3.c
> +++ b/hw/mem/cxl_type3.c
> @@ -684,6 +684,34 @@ static void ct3d_reg_write(void *opaque, hwaddr offset, uint64_t value,
>      }
>  }
>  
> +/*
> + * Create a dc region to test "Get Dynamic Capacity Configuration" command.
> + */
> +static int cxl_create_toy_regions(CXLType3Dev *ct3d)
> +{
> +	int i;
> +	uint64_t region_base = ct3d->hostvmem?ct3d->hostvmem->size
> +		+ ct3d->hostpmem->size:ct3d->hostpmem->size;
> +	uint64_t region_len = 1024*1024*1024;
> +	uint64_t decode_len = 4; /* 4*256MB */
> +	uint64_t blk_size = 2*1024*1024;
> +	struct CXLDCD_Region *region;
> +
> +	for (i = 0; i < ct3d->dc.num_regions; i++) {
> +		region = &ct3d->dc.regions[i];
> +		region->base = region_base;
> +		region->decode_len = decode_len;
> +		region->len = region_len;
> +		region->block_size = blk_size;
> +		/* dsmad_handle is set when creating cdat table entries */
> +		region->flags = 0;
> +
> +		region_base += region->len;
> +	}
> +
> +	return 0;
> +}
> +
>  static bool cxl_setup_memory(CXLType3Dev *ct3d, Error **errp)
>  {
>      DeviceState *ds = DEVICE(ct3d);
> @@ -752,6 +780,9 @@ static bool cxl_setup_memory(CXLType3Dev *ct3d, Error **errp)
>          g_free(p_name);
>      }
>  
> +	if (cxl_create_toy_regions(ct3d))
> +		return false;
> +
>      return true;
>  }
>  
> @@ -1036,6 +1067,7 @@ static Property ct3_props[] = {
>      DEFINE_PROP_UINT64("sn", CXLType3Dev, sn, UI64_NULL),
>      DEFINE_PROP_STRING("cdat", CXLType3Dev, cxl_cstate.cdat.filename),
>      DEFINE_PROP_UINT16("spdm", CXLType3Dev, spdm_port, 0),
> +	DEFINE_PROP_UINT8("num-dc-regions", CXLType3Dev, dc.num_regions, 0),
>      DEFINE_PROP_END_OF_LIST(),
>  };
>  



  reply	other threads:[~2023-05-15 14:04 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20230511175641uscas1p2b1877f9179709b69e293acdd7e57104c@uscas1p2.samsung.com>
2023-05-11 17:56 ` [Qemu RFC 0/7] Early enabling of DCD emulation in Qemu Fan Ni
     [not found]   ` <CGME20230511175641uscas1p165a19a1416facf6603bf1a417121f0dc@uscas1p1.samsung.com>
2023-05-11 17:56     ` [RFC 2/7] hw/cxl/cxl-mailbox-utils: Add dynamic capacity region representative and mailbox command support Fan Ni
2023-05-11 21:53       ` Nathan Fontenot
2023-05-15 13:58         ` Jonathan Cameron via
2023-06-27 21:13           ` nifan
2023-05-15 13:54       ` Jonathan Cameron via
     [not found]   ` <CGME20230511175642uscas1p1a998a2d4a20c370f0172db93d537ed39@uscas1p1.samsung.com>
2023-05-11 17:56     ` [RFC 5/7] hw/cxl/cxl-mailbox-utils: Add mailbox commands to support add/release dynamic capacity response Fan Ni
2023-05-15 14:37       ` Jonathan Cameron via
2023-06-30 19:34         ` nifan
     [not found]   ` <CGME20230511175641uscas1p13ee26532e3a1de36f6081f970190eeed@uscas1p1.samsung.com>
2023-05-11 17:56     ` [RFC 3/7] hw/mem/cxl_type3: Add a parameter to pass number of DC regions the device supports in qemu command line Fan Ni
2023-05-15 14:03       ` Jonathan Cameron via [this message]
     [not found]   ` <CGME20230511175641uscas1p2b70d27b1f20dc2dd54a0530170117530@uscas1p2.samsung.com>
2023-05-11 17:56     ` [RFC 4/7] hw/mem/cxl_type3: Add DC extent representative to cxl type3 device Fan Ni
2023-05-12 18:09       ` Nathan Fontenot
2023-05-15 14:09       ` Jonathan Cameron via
     [not found]   ` <CGME20230511175642uscas1p2c037608a1dd26b19cf970f97ce434c6d@uscas1p2.samsung.com>
2023-05-11 17:56     ` [RFC 7/7] hw/mem/cxl_type3: add read/write support to dynamic capacity Fan Ni
2023-05-15 15:22       ` Jonathan Cameron via
2023-06-28 17:09         ` nifan
2023-07-03  1:33           ` Jonathan Cameron via
     [not found]   ` <CGME20230511175642uscas1p27cf2915c8184225bfd581fb6f6dfb2d9@uscas1p2.samsung.com>
2023-05-11 17:56     ` [RFC 6/7] Add qmp interfaces to add/release dynamic capacity extents Fan Ni
2023-05-15 14:53       ` Jonathan Cameron via
     [not found]   ` <CGME20230511175641uscas1p2e2dd6a5b681f73870e33869af0247c06@uscas1p2.samsung.com>
2023-05-11 17:56     ` [RFC 1/7] hw/cxl/cxl-mailbox-utils: Add dc_event_log_size field to output payload of identify memory device command Fan Ni
2023-05-15 13:02       ` Jonathan Cameron via
2023-05-15 13:00   ` [Qemu RFC 0/7] Early enabling of DCD emulation in Qemu Jonathan Cameron via
2023-05-16 14:39     ` Singh, Navneet
2023-06-27 20:52     ` nifan
2023-06-05 17:35   ` Ira Weiny
2023-06-05 17:51     ` Fan Ni
2023-06-07 18:13       ` Shesha Bhushan Sreenivasamurthy
2023-06-07 18:31         ` Fan Ni
     [not found]           ` <DM6PR18MB284486E36310719093C8A6D6AF53A@DM6PR18MB2844.namprd18.prod.outlook.com>
2023-06-08  9:43             ` Jonathan Cameron via
2023-06-08 15:20               ` [EXT] " Shesha Bhushan Sreenivasamurthy
2023-06-08 16:55                 ` Shesha Bhushan Sreenivasamurthy
2023-06-08 15:43         ` Ira Weiny
2023-06-08 18:10           ` nifan
2023-06-09 21:06             ` Ira Weiny
2023-06-10  0:28               ` [EXT] " Shesha Bhushan Sreenivasamurthy
2023-07-24 17:19   ` Fan Ni
2023-07-25 15:18     ` Ira Weiny
2023-07-25 16:46       ` Fan Ni

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=20230515150330.000033d8@Huawei.com \
    --to=qemu-devel@nongnu.org \
    --cc=Jonathan.Cameron@Huawei.com \
    --cc=a.manzanares@samsung.com \
    --cc=cbrowy@avery-design.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave@stgolabs.net \
    --cc=fan.ni@samsung.com \
    --cc=gregory.price@memverge.com \
    --cc=hchkuo@avery-design.com.tw \
    --cc=ira.weiny@intel.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=nifan@outlook.com \
    --cc=nmtadam.samsung@gmail.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;
as well as URLs for NNTP newsgroup(s).