All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron via qemu development <qemu-devel@nongnu.org>
To: "Zhijian Li (Fujitsu)" <lizhijian@fujitsu.com>, <linuxarm@huawei.com>
Cc: Alireza Sanaee <alireza.sanaee@huawei.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"jonathan.cameron@huawei.com" <jonathan.cameron@huawei.com>,
	"nifan.cxl@gmail.com" <nifan.cxl@gmail.com>,
	"anisa.su887@gmail.com" <anisa.su887@gmail.com>,
	"mst@redhat.com" <mst@redhat.com>,
	"armbru@redhat.com" <armbru@redhat.com>,
	"ppbonzini@redhat.com" <ppbonzini@redhat.com>,
	"peterx@redhat.com" <peterx@redhat.com>,
	"philmd@linaro.org" <philmd@linaro.org>,
	"david@kernel.org" <david@kernel.org>,
	"imammedo@redhat.com" <imammedo@redhat.com>,
	"xiaoguangrong.eric@gmail.com" <xiaoguangrong.eric@gmail.com>,
	"venkataravis@micron.com" <venkataravis@micron.com>,
	"gourry@gourry.net" <gourry@gourry.net>
Subject: Re: [PATCH v2 1/2] hw/cxl: Use HPA in cxl_cfmws_find_device() rather than offset in window.
Date: Fri, 6 Feb 2026 12:51:31 +0000	[thread overview]
Message-ID: <20260206125131.00003c9d@huawei.com> (raw)
In-Reply-To: <0829feee-2bae-4557-8c0f-9ec329a17b2d@fujitsu.com>

On Fri, 6 Feb 2026 09:57:15 +0000
"Zhijian Li (Fujitsu)" <lizhijian@fujitsu.com> wrote:

> On 04/02/2026 23:00, Alireza Sanaee wrote:
> > This function will shortly be used to help find if there is a route to a
> > device, serving an HPA, under a particular fixed memory window. Rather
> > than having that new use case subtract the base address in the caller,
> > only to add it again in cxl_cfmws_find_device(), push the responsibility
> > for calculating the HPA to the caller.
> > 
> > This also reduces the inconsistency in the meaning of the hwaddr
> > addr parameter between this function and the calls made within it
> > that access the HDM decoders that operating on HPA.
> > 
> > Signed-off-by: Alireza Sanaee <alireza.sanaee@huawei.com>
> > ---
> >   hw/cxl/cxl-host.c | 6 ++----
> >   1 file changed, 2 insertions(+), 4 deletions(-)
> > 
> > diff --git a/hw/cxl/cxl-host.c b/hw/cxl/cxl-host.c
> > index f3479b1991..9633b01abf 100644
> > --- a/hw/cxl/cxl-host.c
> > +++ b/hw/cxl/cxl-host.c
> > @@ -168,8 +168,6 @@ static PCIDevice *cxl_cfmws_find_device(CXLFixedWindow *fw, hwaddr addr)
> >       bool target_found;
> >       PCIDevice *rp, *d;
> >   
> > -    /* Address is relative to memory region. Convert to HPA */
> > -    addr += fw->base;
> >   
> >       rb_index = (addr / cxl_decode_ig(fw->enc_int_gran)) % fw->num_targets;
> >       hb = PCI_HOST_BRIDGE(fw->target_hbs[rb_index]->cxl_host_bridge);
> > @@ -254,7 +252,7 @@ static MemTxResult cxl_read_cfmws(void *opaque, hwaddr addr, uint64_t *data,
> >       CXLFixedWindow *fw = opaque;
> >       PCIDevice *d;
> >   
> > -    d = cxl_cfmws_find_device(fw, addr);
> > +    d = cxl_cfmws_find_device(fw, addr + fw->base, true);  
> 
> 
> It seems you've added an extra parameter to the calls to cxl_cfmws_find_device(), but its function signature wasn't updated.

Good spot. The extra parameter should be in the next patch.

Jonathan

> 
> 
> 
> Thanks
> Zhijian
> 
> 
> 
> >       if (d == NULL) {
> >           *data = 0;
> >           /* Reads to invalid address return poison */
> > @@ -271,7 +269,7 @@ static MemTxResult cxl_write_cfmws(void *opaque, hwaddr addr,
> >       CXLFixedWindow *fw = opaque;
> >       PCIDevice *d;
> >   
> > -    d = cxl_cfmws_find_device(fw, addr);
> > +    d = cxl_cfmws_find_device(fw, addr + fw->base, true);
> >       if (d == NULL) {
> >           /* Writes to invalid address are silent */
> >           return MEMTX_OK;  



  reply	other threads:[~2026-02-06 12:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-04 14:59 [PATCH v2 0/2] Performant CXL type 3 non-interleaved regions Alireza Sanaee via qemu development
2026-02-04 15:00 ` [PATCH v2 1/2] hw/cxl: Use HPA in cxl_cfmws_find_device() rather than offset in window Alireza Sanaee via qemu development
2026-02-06  9:57   ` Zhijian Li (Fujitsu)
2026-02-06 12:51     ` Jonathan Cameron via qemu development [this message]
2026-02-04 15:00 ` [PATCH v2 2/2] hw/cxl: Add a performant (and correct) path for the non interleaved cases Alireza Sanaee via qemu development
2026-02-09  3:06   ` Zhijian Li (Fujitsu)
2026-02-09 13:47     ` Alireza Sanaee via qemu development
2026-02-12 14:25     ` Alireza Sanaee via qemu development
2026-02-05 18:07 ` [PATCH v2 0/2] Performant CXL type 3 non-interleaved regions Gregory Price
2026-02-06  9:27   ` Alireza Sanaee via qemu development
2026-02-09  3:17 ` Gregory Price
2026-02-09 12:39   ` Jonathan Cameron via qemu development

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=20260206125131.00003c9d@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.