All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jonathan.cameron@huawei.com>
To: Davidlohr Bueso <dave@stgolabs.net>
Cc: <qemu-devel@nongnu.org>, <linux-cxl@vger.kernel.org>
Subject: Re: [PATCH 2/2] hw/cxl: Exclude Discovery from Media Operation Discovery output
Date: Thu, 19 Mar 2026 14:54:17 +0000	[thread overview]
Message-ID: <20260319145417.00005bc1@huawei.com> (raw)
In-Reply-To: <20260318185508.3683044-3-dave@stgolabs.net>

On Wed, 18 Mar 2026 11:55:08 -0700
Davidlohr Bueso <dave@stgolabs.net> wrote:

> Per CXL 4.0 Table 8-331, the Discovery operation "returns a list of
> all Media Operations that the device supports, with the exception of
> the Discovery operation (Class=0, Subclass=0)."
> 
> Filter out Discovery entries when building the output list and adjust
> total_supported_operations accordingly.
> 
> Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
Both could do with a fixes tag.

> ---
>  hw/cxl/cxl-mailbox-utils.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c
> index 71a012121c87..6932db963788 100644
> --- a/hw/cxl/cxl-mailbox-utils.c
> +++ b/hw/cxl/cxl-mailbox-utils.c
> @@ -2593,7 +2593,7 @@ static CXLRetCode media_operations_discovery(uint8_t *payload_in,
>      } QEMU_PACKED *media_op_in_disc_pl = (void *)payload_in;
>      struct media_op_discovery_out_pl *media_out_pl =
>          (struct media_op_discovery_out_pl *)payload_out;
> -    int total = ARRAY_SIZE(media_op_matrix);
> +    int total = ARRAY_SIZE(media_op_matrix) - 1; /* exclude Discovery */
>      int num_ops, start_index, i;
>      int count = 0;
>  
> @@ -2619,10 +2619,12 @@ static CXLRetCode media_operations_discovery(uint8_t *payload_in,
>  
>      num_ops = MIN(num_ops, total - start_index);
>      for (i = 0; i < num_ops; i++) {
> +        int idx = start_index + i + 1; /* skip Discovery (first entry) */
> +
>          media_out_pl->entry[count].media_op_class =
> -                media_op_matrix[start_index + i].media_op_class;
> +                media_op_matrix[idx].media_op_class;
>          media_out_pl->entry[count].media_op_subclass =
> -                    media_op_matrix[start_index + i].media_op_subclass;
> +                    media_op_matrix[idx].media_op_subclass;
Indent comment follows through.

Otherwise LGTM.

I'll queue it up locally but if you want to send a new version and with mst@redhat.com
in the to, given it's fixes and where we are in the cycle they may get picked up sooner.

If you do that, 
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com> 
for both patches

Whilst I don't think anything else I have queued touches this code, make sure
you base on upstream qemu.

Thanks,

Jonathan



>          count++;
>      }
>  


WARNING: multiple messages have this Message-ID (diff)
From: Jonathan Cameron via qemu development <qemu-devel@nongnu.org>
To: Davidlohr Bueso <dave@stgolabs.net>
Cc: <qemu-devel@nongnu.org>, <linux-cxl@vger.kernel.org>
Subject: Re: [PATCH 2/2] hw/cxl: Exclude Discovery from Media Operation Discovery output
Date: Thu, 19 Mar 2026 14:54:17 +0000	[thread overview]
Message-ID: <20260319145417.00005bc1@huawei.com> (raw)
In-Reply-To: <20260318185508.3683044-3-dave@stgolabs.net>

On Wed, 18 Mar 2026 11:55:08 -0700
Davidlohr Bueso <dave@stgolabs.net> wrote:

> Per CXL 4.0 Table 8-331, the Discovery operation "returns a list of
> all Media Operations that the device supports, with the exception of
> the Discovery operation (Class=0, Subclass=0)."
> 
> Filter out Discovery entries when building the output list and adjust
> total_supported_operations accordingly.
> 
> Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
Both could do with a fixes tag.

> ---
>  hw/cxl/cxl-mailbox-utils.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c
> index 71a012121c87..6932db963788 100644
> --- a/hw/cxl/cxl-mailbox-utils.c
> +++ b/hw/cxl/cxl-mailbox-utils.c
> @@ -2593,7 +2593,7 @@ static CXLRetCode media_operations_discovery(uint8_t *payload_in,
>      } QEMU_PACKED *media_op_in_disc_pl = (void *)payload_in;
>      struct media_op_discovery_out_pl *media_out_pl =
>          (struct media_op_discovery_out_pl *)payload_out;
> -    int total = ARRAY_SIZE(media_op_matrix);
> +    int total = ARRAY_SIZE(media_op_matrix) - 1; /* exclude Discovery */
>      int num_ops, start_index, i;
>      int count = 0;
>  
> @@ -2619,10 +2619,12 @@ static CXLRetCode media_operations_discovery(uint8_t *payload_in,
>  
>      num_ops = MIN(num_ops, total - start_index);
>      for (i = 0; i < num_ops; i++) {
> +        int idx = start_index + i + 1; /* skip Discovery (first entry) */
> +
>          media_out_pl->entry[count].media_op_class =
> -                media_op_matrix[start_index + i].media_op_class;
> +                media_op_matrix[idx].media_op_class;
>          media_out_pl->entry[count].media_op_subclass =
> -                    media_op_matrix[start_index + i].media_op_subclass;
> +                    media_op_matrix[idx].media_op_subclass;
Indent comment follows through.

Otherwise LGTM.

I'll queue it up locally but if you want to send a new version and with mst@redhat.com
in the to, given it's fixes and where we are in the cycle they may get picked up sooner.

If you do that, 
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com> 
for both patches

Whilst I don't think anything else I have queued touches this code, make sure
you base on upstream qemu.

Thanks,

Jonathan



>          count++;
>      }
>  



  reply	other threads:[~2026-03-19 14:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-18 18:55 [PATCH v2 -qemu 0/2] hw/cxl: Media Operation Discovery fixlets Davidlohr Bueso
2026-03-18 18:55 ` [PATCH 1/2] hw/cxl: Respect Media Operation max ops discovery semantics Davidlohr Bueso
2026-03-19 14:50   ` Jonathan Cameron
2026-03-19 14:50     ` Jonathan Cameron via qemu development
2026-03-18 18:55 ` [PATCH 2/2] hw/cxl: Exclude Discovery from Media Operation Discovery output Davidlohr Bueso
2026-03-19 14:54   ` Jonathan Cameron [this message]
2026-03-19 14:54     ` Jonathan Cameron via qemu development
  -- strict thread matches above, loose matches on Subject: below --
2026-03-19 18:42 [PATCH v3 -qemu 0/2] hw/cxl: Media Operation Discovery fixlets Davidlohr Bueso
2026-03-19 18:42 ` [PATCH 2/2] hw/cxl: Exclude Discovery from Media Operation Discovery output Davidlohr Bueso
2026-03-18 18:42 [PATCH -qemu 0/2] hw/cxl: Media Operation Discovery fixles Davidlohr Bueso
2026-03-18 18:42 ` [PATCH 2/2] hw/cxl: Exclude Discovery from Media Operation Discovery output Davidlohr Bueso

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=20260319145417.00005bc1@huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=dave@stgolabs.net \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.