Linux CXL
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: Alison Schofield <alison.schofield@intel.com>,
	Dan Williams <dan.j.williams@intel.com>
Cc: <linux-cxl@vger.kernel.org>, <stable@vger.kernel.org>
Subject: Re: [PATCH 2/5] cxl/hdm: Use 4-byte reads to retrieve HDM decoder base+limit
Date: Fri, 14 Apr 2023 13:44:11 -0700	[thread overview]
Message-ID: <6439bb1b57819_417e2949b@dwillia2-xfh.jf.intel.com.notmuch> (raw)
In-Reply-To: <ZDm4TqspwS3AAQSr@aschofie-mobl2>

Alison Schofield wrote:
> On Fri, Apr 14, 2023 at 11:54:00AM -0700, Dan Williams wrote:
> > The CXL specification mandates that 4-byte registers must be accessed
> > with 4-byte access cycles. CXL 3.0 8.2.3 "Component Register Layout and
> > Definition" states that the behavior is undefined if (2) 32-bit
> > registers are accessed as an 8-byte quantity. It turns out that at least
> > one hardware implementation is sensitive to this in practice. The @size
> > variable results in zero with:
> > 
> >     size = readq(hdm + CXL_HDM_DECODER0_SIZE_LOW_OFFSET(which));
> > 
> > ...and the correct size with:
> > 
> >     lo = readl(hdm + CXL_HDM_DECODER0_SIZE_LOW_OFFSET(which));
> >     hi = readl(hdm + CXL_HDM_DECODER0_SIZE_HIGH_OFFSET(which));
> >     size = (hi << 32) + lo;
> > 
> > Fixes: d17d0540a0db ("cxl/core/hdm: Add CXL standard decoder enumeration to the core")
> > Cc: <stable@vger.kernel.org>
> > Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> 
> I see you got rid of ioread64_hi_lo(), so this can't be
> happening anywhere else. Are all the other readl, writel
> usages known to be OK, or do you need review help against
> the spec?

Good question. That's what I looked to answer in patch3. As far as I can
see all the other readq() usage in the driver is for registers defined
as 64-bit, so that patch ended up only being a deletion of unneeded
includes.

  reply	other threads:[~2023-04-14 20:44 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-14 18:53 [PATCH 0/5] cxl/hdm: Decoder enumeration fixes Dan Williams
2023-04-14 18:53 ` [PATCH 1/5] cxl/hdm: Fail upon detecting 0-sized decoders Dan Williams
2023-04-14 20:11   ` Alison Schofield
2023-04-14 21:19   ` Dave Jiang
2023-05-15 10:38   ` Jonathan Cameron
2023-04-14 18:54 ` [PATCH 2/5] cxl/hdm: Use 4-byte reads to retrieve HDM decoder base+limit Dan Williams
2023-04-14 20:32   ` Alison Schofield
2023-04-14 20:44     ` Dan Williams [this message]
2023-04-14 21:22   ` Dave Jiang
2023-05-15 10:46   ` Jonathan Cameron
2023-04-14 18:54 ` [PATCH 3/5] cxl/core: Drop unused io-64-nonatomic-lo-hi.h Dan Williams
2023-04-14 20:33   ` Alison Schofield
2023-04-14 21:22   ` Dave Jiang
2023-05-15 10:48   ` Jonathan Cameron
2023-04-14 18:54 ` [PATCH 4/5] cxl/port: Scan single-target ports for decoders Dan Williams
2023-04-14 20:55   ` Alison Schofield
2023-04-14 21:24   ` Dave Jiang
2023-04-17 16:48   ` Jonathan Cameron
2023-04-14 18:54 ` [PATCH 5/5] cxl/hdm: Add more HDM decoder debug messages at startup Dan Williams
2023-04-14 21:06   ` Alison Schofield
2023-04-14 21:25   ` Dave Jiang
2023-05-15 10:52   ` Jonathan Cameron

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=6439bb1b57819_417e2949b@dwillia2-xfh.jf.intel.com.notmuch \
    --to=dan.j.williams@intel.com \
    --cc=alison.schofield@intel.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=stable@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox