All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: qemu-devel@nongnu.org, "Fan Ni" <fan.ni@samsung.com>,
	"Ben Widawsky" <bwidawsk@kernel.org>,
	linux-cxl@vger.kernel.org, linuxarm@huawei.com,
	"Ira Weiny" <ira.weiny@intel.com>,
	"Gregory Price" <gourry.memverge@gmail.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Mike Maslenkin" <mike.maslenkin@gmail.com>,
	"Dave Jiang" <dave.jiang@intel.com>
Subject: Re: [PATCH v4 2/2] hw/cxl: Multi-Region CXL Type-3 Devices (Volatile and Persistent)
Date: Mon, 13 Mar 2023 16:04:41 +0000	[thread overview]
Message-ID: <20230313160441.00000dc1@huawei.com> (raw)
In-Reply-To: <20230307194914-mutt-send-email-mst@kernel.org>


...

> > +    if (vmr) {
> > +        if (*dpa_offset < int128_get64(vmr->size)) {
> > +            *as = &ct3d->hostvmem_as;
> > +        } else {
> > +            *as = &ct3d->hostpmem_as;
> > +            *dpa_offset -= vmr->size;  
> 
> You can't do math on vmr->size, it's Int128.
> And generally please do not poke at mr->size use APIs.
> 
> Which one will depend ...

Good spot. In this case they are all sub 64 bit so
simple memory_region_size() is appropriate I think.

I'll add a precursor patch converting existing 
int128_get64(mr->size) users in this file over to that.

Thanks,

Jonathan

WARNING: multiple messages have this Message-ID (diff)
From: Jonathan Cameron via <qemu-devel@nongnu.org>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: qemu-devel@nongnu.org, "Fan Ni" <fan.ni@samsung.com>,
	"Ben Widawsky" <bwidawsk@kernel.org>,
	linux-cxl@vger.kernel.org, linuxarm@huawei.com,
	"Ira Weiny" <ira.weiny@intel.com>,
	"Gregory Price" <gourry.memverge@gmail.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Mike Maslenkin" <mike.maslenkin@gmail.com>,
	"Dave Jiang" <dave.jiang@intel.com>
Subject: Re: [PATCH v4 2/2] hw/cxl: Multi-Region CXL Type-3 Devices (Volatile and Persistent)
Date: Mon, 13 Mar 2023 16:04:41 +0000	[thread overview]
Message-ID: <20230313160441.00000dc1@huawei.com> (raw)
In-Reply-To: <20230307194914-mutt-send-email-mst@kernel.org>


...

> > +    if (vmr) {
> > +        if (*dpa_offset < int128_get64(vmr->size)) {
> > +            *as = &ct3d->hostvmem_as;
> > +        } else {
> > +            *as = &ct3d->hostpmem_as;
> > +            *dpa_offset -= vmr->size;  
> 
> You can't do math on vmr->size, it's Int128.
> And generally please do not poke at mr->size use APIs.
> 
> Which one will depend ...

Good spot. In this case they are all sub 64 bit so
simple memory_region_size() is appropriate I think.

I'll add a precursor patch converting existing 
int128_get64(mr->size) users in this file over to that.

Thanks,

Jonathan


  reply	other threads:[~2023-03-13 16:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-27 16:31 [PATCH v4 0/2] hw/mem: CXL Type-3 Volatile Memory Support Jonathan Cameron
2023-02-27 16:31 ` Jonathan Cameron via
2023-02-27 16:31 ` [PATCH v4 1/2] tests/qtest/cxl-test: whitespace, line ending cleanup Jonathan Cameron
2023-02-27 16:31   ` Jonathan Cameron via
2023-03-14 10:21   ` Philippe Mathieu-Daudé
2023-02-27 16:31 ` [PATCH v4 2/2] hw/cxl: Multi-Region CXL Type-3 Devices (Volatile and Persistent) Jonathan Cameron
2023-02-27 16:31   ` Jonathan Cameron via
2023-03-08  0:50   ` Michael S. Tsirkin
2023-03-13 16:04     ` Jonathan Cameron [this message]
2023-03-13 16:04       ` Jonathan Cameron via

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=20230313160441.00000dc1@huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=bwidawsk@kernel.org \
    --cc=dave.jiang@intel.com \
    --cc=fan.ni@samsung.com \
    --cc=gourry.memverge@gmail.com \
    --cc=ira.weiny@intel.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=mike.maslenkin@gmail.com \
    --cc=mst@redhat.com \
    --cc=philmd@linaro.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.