From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
To: Hongjian Fan <hongjian.fan@seagate.com>
Cc: <qemu-devel@nongnu.org>, <linux-cxl@vger.kernel.org>,
<fan.ni@samsung.com>
Subject: Re: [PATCH v2] hw/mem: support zero memory size CXL device
Date: Tue, 21 Jan 2025 16:24:10 +0000 [thread overview]
Message-ID: <20250121162410.000009fa@huawei.com> (raw)
In-Reply-To: <20241204022618.1572959-1-hongjian.fan@seagate.com>
On Tue, 3 Dec 2024 20:26:19 -0600
Hongjian Fan <hongjian.fan@seagate.com> wrote:
> This patch allows a CXL type3 device to be initialized with zero memory
> size, when there is no memory device property provided.
>
> Signed-off-by: Hongjian Fan <hongjian.fan@seagate.com>
Hi Hongjian
Some remaining questions on the v1 thread.
We need to understand a little more on why this is useful to support.
It's adding another thing we need to test so whilst simple it's not
zero maintenance cost.
Thanks,
Jonathan
> ---
> hw/mem/cxl_type3.c | 14 +++++++++++---
> 1 file changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c
> index 5cf754b38f..4c9d6b8f17 100644
> --- a/hw/mem/cxl_type3.c
> +++ b/hw/mem/cxl_type3.c
> @@ -159,7 +159,12 @@ static int ct3_build_cdat_table(CDATSubHeader ***cdat_table, void *priv)
> int len = 0;
>
> if (!ct3d->hostpmem && !ct3d->hostvmem && !ct3d->dc.num_regions) {
> - return 0;
> + /* zero memory size device. Build one entry with size 0 */
> + table = g_malloc0(CT3_CDAT_NUM_ENTRIES * sizeof(*table));
> + ct3_build_cdat_entries_for_mr(&(table[0]), dsmad_handle++,
> + 0, false, false, 0);
> + *cdat_table = g_steal_pointer(&table);
> + return CT3_CDAT_NUM_ENTRIES;
> }
>
> if (ct3d->hostvmem) {
> @@ -712,8 +717,11 @@ static bool cxl_setup_memory(CXLType3Dev *ct3d, Error **errp)
>
> if (!ct3d->hostmem && !ct3d->hostvmem && !ct3d->hostpmem
> && !ct3d->dc.num_regions) {
> - error_setg(errp, "at least one memdev property must be set");
> - return false;
> + /* no memdev property provided. Default to zero memory size device */
> + ct3d->cxl_dstate.pmem_size = 0;
> + ct3d->cxl_dstate.vmem_size = 0;
> + ct3d->cxl_dstate.static_mem_size = 0;
> + return true;
> } else if (ct3d->hostmem && ct3d->hostpmem) {
> error_setg(errp, "[memdev] cannot be used with new "
> "[persistent-memdev] property");
prev parent reply other threads:[~2025-01-21 16:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-02 23:03 [PATCH] hw/mem: support zero memory size CXL device Hongjian Fan
2024-12-03 17:23 ` Jonathan Cameron
2024-12-03 21:15 ` Hongjian Fan
2024-12-10 19:13 ` Gregory Price
2024-12-24 15:13 ` Jonathan Cameron
2025-01-23 15:23 ` Gregory Price
2024-12-04 2:26 ` [PATCH v2] " Hongjian Fan
2025-01-21 16:24 ` Jonathan Cameron [this message]
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=20250121162410.000009fa@huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=fan.ni@samsung.com \
--cc=hongjian.fan@seagate.com \
--cc=linux-cxl@vger.kernel.org \
--cc=qemu-devel@nongnu.org \
/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