All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron via qemu development <qemu-devel@nongnu.org>
To: Gregory Price <gourry@gourry.net>
Cc: Alireza Sanaee <alireza.sanaee@huawei.com>,
	<qemu-devel@nongnu.org>, <lizhijian@fujitsu.com>,
	<anisa.su887@gmail.com>, <armbru@redhat.com>, <david@kernel.org>,
	<imammedo@redhat.com>, <linuxarm@huawei.com>, <mst@redhat.com>,
	<nifan.cxl@gmail.com>, <peterx@redhat.com>, <philmd@linaro.org>,
	<ppbonzini@redhat.com>, <venkataravis@micron.com>,
	<xiaoguangrong.eric@gmail.com>
Subject: Re: [PATCH v6 3/3] hw/cxl: Add a performant (and correct) path for the non interleaved cases
Date: Fri, 6 Mar 2026 10:26:27 +0000	[thread overview]
Message-ID: <20260306102627.00004d5f@huawei.com> (raw)
In-Reply-To: <aanx9AVMvca5n2yY@gourry-fedora-PF4VCD3F>

On Thu, 5 Mar 2026 16:13:24 -0500
Gregory Price <gourry@gourry.net> wrote:

> On Thu, Feb 26, 2026 at 03:20:34PM +0000, Alireza Sanaee wrote:
> > +        /*
> > +         * Optimization: Looking for a fully committed path; if the type 3 HDM
> > +         * decoder is not commmitted, it cannot lie on such a path.  
>                                ^^^ committed
> 
> ... snip ...
> > +                object_child_foreach_recursive(object_get_root(),
> > +                                               cxl_fmws_direct_passthrough,
> > +                                               &state);
> > +            }
> > +        }
> > +        dpa_base += decoder_size / cxl_interleave_ways_dec(iw, &error_fatal);
> > +    }
> > +  
> 
> Div-by-0 here for invalid values?
> 
> int cxl_interleave_ways_dec(uint8_t iw_enc, Error **errp)
> {
>     switch (iw_enc) {
>     ... snip ...
>     default:
>         error_setg(errp, "Encoded interleave ways: %d not supported", iw_enc);
>         return 0;

It will abort because error_fatal is passed in. I believe we've always sanity
checked the value at write so 
That's not particularly elegant so I think we should do a check on it being
zero and just return 0 if it happens to be so. 
We have similar checks in the other uses of cxl_interleave_ways_dec()

On the todo list for a long time has been adding more sanity checking
to the HDM commit flows.  As we are getting closer to this stuff actually
being usable for virtualization as well as emulation / testing, that will
need cleaning up.

>     }
> }
> 
> Or does this abort before return?
> 
> > +    return false;
> > +}  
> 
> You're returning false as an 'int'
Good spot. That should be return 0.

> 
> ~Gregory



      reply	other threads:[~2026-03-06 10:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-26 15:20 [PATCH v6 0/3] hw/cxl: Add a performant (and correct) path for the non interleaved cases Alireza Sanaee via qemu development
2026-02-26 15:20 ` [PATCH v6 1/3] hw/cxl: Use HPA in cxl_cfmws_find_device() rather than offset in window Alireza Sanaee via qemu development
2026-02-27  7:44   ` Zhijian Li (Fujitsu)
2026-02-26 15:20 ` [PATCH v6 2/3] hw/cxl: Allow cxl_cfmws_find_device() to filter on whether interleaved paths are accepted Alireza Sanaee via qemu development
2026-02-27  7:45   ` Zhijian Li (Fujitsu)
2026-02-26 15:20 ` [PATCH v6 3/3] hw/cxl: Add a performant (and correct) path for the non interleaved cases Alireza Sanaee via qemu development
2026-02-27  9:50   ` Zhijian Li (Fujitsu)
2026-03-05 21:13   ` Gregory Price
2026-03-06 10:26     ` Jonathan Cameron via qemu development [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=20260306102627.00004d5f@huawei.com \
    --to=qemu-devel@nongnu.org \
    --cc=alireza.sanaee@huawei.com \
    --cc=anisa.su887@gmail.com \
    --cc=armbru@redhat.com \
    --cc=david@kernel.org \
    --cc=gourry@gourry.net \
    --cc=imammedo@redhat.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=linuxarm@huawei.com \
    --cc=lizhijian@fujitsu.com \
    --cc=mst@redhat.com \
    --cc=nifan.cxl@gmail.com \
    --cc=peterx@redhat.com \
    --cc=philmd@linaro.org \
    --cc=ppbonzini@redhat.com \
    --cc=venkataravis@micron.com \
    --cc=xiaoguangrong.eric@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 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.