qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron via <qemu-devel@nongnu.org>
To: <anisa.su887@gmail.com>
Cc: <qemu-devel@nongnu.org>, <dave@stgolabs.net>,
	<linux-cxl@vger.kernel.org>,  Anisa Su <anisa.su@samsung.com>
Subject: Re: [QEMU PATCH 1/1] hw/cxl/cxl-mailbox-utils: Enable FMAPI Initiate Add for MHSLD
Date: Tue, 28 Oct 2025 16:21:00 +0000	[thread overview]
Message-ID: <20251028162100.00006fa8@huawei.com> (raw)
In-Reply-To: <20250927002125.860668-2-anisa.su887@gmail.com>

On Sat, 27 Sep 2025 00:18:07 +0000
anisa.su887@gmail.com wrote:

> From: Anisa Su <anisa.su@samsung.com>
> 
> Call mhd_reserve_extents in FMAPI Init Add (5604h)to enable sending
> FMAPI Add command to MHSLD.
> 
> Signed-off-by: Anisa Su <anisa.su@samsung.com>
Hi Anisa,

I've not been quick on this one partly because it sits on top of the MHSLD
work that I think needs a proper revisit to establish what is an up streamable
path, but I haven't had time to do that :(

Anyhow in meantime I'll take a look.  I suppose nothing stops me carrying
this on top.

Just one minor comment inline.
> ---
>  hw/cxl/cxl-mailbox-utils.c | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
> 
> diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c
> index c5177dfd92..9ac60db4e1 100644
> --- a/hw/cxl/cxl-mailbox-utils.c
> +++ b/hw/cxl/cxl-mailbox-utils.c
> @@ -24,6 +24,7 @@
>  #include "system/hostmem.h"
>  #include "qemu/range.h"
>  #include "qapi/qapi-types-cxl.h"
> +#include "hw/cxl/mhsld/mhsld.h"
>  
>  #define CXL_CAPACITY_MULTIPLIER   (256 * MiB)
>  #define CXL_DC_EVENT_LOG_SIZE 8
> @@ -4163,6 +4164,8 @@ static CXLRetCode cmd_fm_initiate_dc_add(const struct cxl_cmd *cmd,
>          CXLDCExtentRaw extents[];
>      } QEMU_PACKED *in = (void *)payload_in;
>      CXLType3Dev *ct3d = CXL_TYPE3(cci->d);
> +    CXLType3Class *cvc = CXL_TYPE3_GET_CLASS(ct3d);
> +    CXLDCRegion *region = &ct3d->dc.regions[in->reg_num];
>      int i, rc;
>  
>      switch (in->selection_policy) {
> @@ -4201,6 +4204,28 @@ static CXLRetCode cmd_fm_initiate_dc_add(const struct cxl_cmd *cmd,
>                  return rc;
>              }
>  
> +            /* If this is an MHD, attempt to reserve the extents */
> +            if (cvc->mhd_reserve_extents) {
> +                g_autofree CxlDynamicCapacityExtentList *records =
> +                    g_malloc0(in->ext_count * sizeof(*records));

I think it makes sense to use g_malloc0_n for these

I changed this whilst applying it locally so it'll be there next time
I push out a tree.

Thanks,

Jonathan


> +                g_autofree CxlDynamicCapacityExtent *dc_exts =
> +                    g_malloc0(in->ext_count * sizeof(*dc_exts));
> +
> +                for (i = 0; i < in->ext_count; i++) {
> +                    CxlDynamicCapacityExtent *value = &dc_exts[i];
> +                    value->offset =
> +                        in->extents[i].start_dpa - region->base;
> +                    value->len = in->extents[i].len;
> +
> +                    records[i].value = value;
> +                    records[i].next = &records[i + 1];
> +                }
> +                records[in->ext_count - 1].next = NULL;
> +                if (!cvc->mhd_reserve_extents(&ct3d->parent_obj, records, in->reg_num)) {
> +                    return CXL_MBOX_INVALID_INPUT;
> +                }
> +            }
> +
>              CXLDCExtentGroup *group = NULL;
>              for (i = 0; i < in->ext_count; i++) {
>                  CXLDCExtentRaw *ext = &in->extents[i];



  reply	other threads:[~2025-10-28 16:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-27  0:18 [QEMU PATCH 0/1] CXL: Enable FMAPI Add for MHSLDs anisa.su887
2025-09-27  0:18 ` [QEMU PATCH 1/1] hw/cxl/cxl-mailbox-utils: Enable FMAPI Initiate Add for MHSLD anisa.su887
2025-10-28 16:21   ` Jonathan Cameron via [this message]
2025-10-28 16:56     ` Anisa Su

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=20251028162100.00006fa8@huawei.com \
    --to=qemu-devel@nongnu.org \
    --cc=anisa.su887@gmail.com \
    --cc=anisa.su@samsung.com \
    --cc=dave@stgolabs.net \
    --cc=jonathan.cameron@huawei.com \
    --cc=linux-cxl@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).