[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220609092738.00007553@Huawei.com>
Date: Thu, 9 Jun 2022 09:27:38 +0100
From: Jonathan Cameron <Jonathan.Cameron@...wei.com>
To: Ira Weiny <ira.weiny@...el.com>
CC: Ben Widawsky <bwidawsk@...nel.org>,
Dan Williams <dan.j.williams@...el.com>,
Bjorn Helgaas <bhelgaas@...gle.com>,
"Alison Schofield" <alison.schofield@...el.com>,
Vishal Verma <vishal.l.verma@...el.com>,
Dave Jiang <dave.jiang@...el.com>,
<linux-kernel@...r.kernel.org>, <linux-cxl@...r.kernel.org>,
<linux-pci@...r.kernel.org>
Subject: Re: [PATCH V10 6/9] cxl/port: Read CDAT table
On Wed, 8 Jun 2022 14:27:14 -0700
Ira Weiny <ira.weiny@...el.com> wrote:
> On Mon, Jun 06, 2022 at 11:15:41AM -0700, Ben Widawsky wrote:
> > On 22-06-04 17:50:46, ira.weiny@...el.com wrote:
> > > From: Jonathan Cameron <Jonathan.Cameron@...wei.com>
> > >
>
[snip]
> >
> > > +
> > > + entry = cdat_response_pl + 1;
> > > + entry_dw = task.rv / sizeof(u32);
> > > + /* Skip Header */
> > > + entry_dw -= 1;
> > > + entry_dw = min(length / 4, entry_dw);
> > > + memcpy(data, entry, entry_dw * sizeof(u32));
> > > + length -= entry_dw * sizeof(u32);
> > > + data += entry_dw;
> > > + entry_handle = FIELD_GET(CXL_DOE_TABLE_ACCESS_ENTRY_HANDLE, cdat_response_pl[0]);
> >
> > [0] looks suspicious...
>
> Actually I have to claim ignorance on this one. I've carried this from
> Jonathan's original patches. I'm not as worried about the [0] as that is just
> the first dword. But I'm confused as to this entry handle now.
>
> Jonathan? Help?
Looks right to me. The entryhandle is a field in the upper 16 bits of the
first dword defined in Read Entry Response table in the CXL spec and also
used in the request of the next entry (which is more or less a CDAT structure)
Two magic values.
0 - CDAT header (request only - can't be returned)
0xFFFF - No more entries.
As we are reading the whole table, we write 0 to first request and from there
on use the value returned in the response for the next request until we see
0xFFFF and stop.
Note IIRC the meaning of entry handle was clarified in a CXL 2.0 errata as
was a bit ambiguous in the original spec (we had two QEMU implementations
briefly and they did different things :)
Jonathan
>
> >
> > > +
> > > + } while (entry_handle != 0xFFFF);
> > > +
> > > + return rc;
> > > +}
> > > +
Powered by blists - more mailing lists