Linux CXL
 help / color / mirror / Atom feed
From: Alison Schofield <alison.schofield@intel.com>
To: Dave Jiang <dave.jiang@intel.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>,
	Jonathan Cameron <jonathan.cameron@huawei.com>,
	Vishal Verma <vishal.l.verma@intel.com>,
	"Ira Weiny" <ira.weiny@intel.com>,
	Dan Williams <dan.j.williams@intel.com>,
	<linux-cxl@vger.kernel.org>
Subject: Re: [PATCH v2 1/3] cxl/region: Refactor address translation funcs for testing
Date: Tue, 9 Sep 2025 10:31:51 -0700	[thread overview]
Message-ID: <aMBkhxzQTZSEkSlM@aschofie-mobl2.lan> (raw)
In-Reply-To: <6deca3ef-2284-433f-ae91-ce1ff9f7a8b7@intel.com>

On Thu, Sep 04, 2025 at 03:05:00PM -0700, Dave Jiang wrote:
> 

snip

> > +	bits_lower = hpa_offset & GENMASK_ULL(eig + 7, 0);
> > +	if (eiw < 8) {
> > +		temp = hpa_offset &= ~((u64)GENMASK(eig + eiw + 8 - 1, 0));
> 
> Should this use GENMASK_ULL() instead of casting to u64?

Yes. Will do in next rev.

> > +
snip

> > +	for (int i = 0; i < p->nr_targets; i++) {
> > +		cxled = p->targets[i];
> > +		if (cxlmd == cxled_to_memdev(cxled))
> > +			break;
> > +	}
> > +	if (!cxled || cxlmd != cxled_to_memdev(cxled))
> > +		return ULLONG_MAX;
> 
> Maybe:
> 
> 	for (int i = 0; i < p->nr_targets; i++) {
> 		if (cxlmd == cxled_to_memdev(p->targets[i])) {
> 			cxled = p->targets[i];
> 			break;
> 		}
> 	}
> 
> 	if (!cxled)
> 		return ULLONG_MAX;

Nice - avoids avoids the redundant check by only assigning cxled when a match
is found.  Will use in next rev.

Thanks for the review!

> 
> DJ

  reply	other threads:[~2025-09-09 17:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-29  7:21 [PATCH v2 0/3] CXL: Add a loadable module for address translation Alison Schofield
2025-08-29  7:21 ` [PATCH v2 1/3] cxl/region: Refactor address translation funcs for testing Alison Schofield
2025-09-04 22:05   ` Dave Jiang
2025-09-09 17:31     ` Alison Schofield [this message]
2025-09-09 16:10   ` Jonathan Cameron
2025-09-09 17:45     ` Alison Schofield
2025-09-10 12:32       ` Jonathan Cameron
2025-08-29  7:21 ` [PATCH v2 2/3] cxl/acpi: Make the XOR calculations available " Alison Schofield
2025-09-04 23:21   ` Dave Jiang
2025-09-09 17:33     ` Alison Schofield
2025-08-29  7:21 ` [PATCH v2 3/3] cxl/test: Add cxl_translate module for address translation testing Alison Schofield
2025-09-04 23:24   ` Dave Jiang

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=aMBkhxzQTZSEkSlM@aschofie-mobl2.lan \
    --to=alison.schofield@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=dave@stgolabs.net \
    --cc=ira.weiny@intel.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=vishal.l.verma@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox