lkml.org 
[lkml]   [2022]   [Jun]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH V10 6/9] cxl/port: Read CDAT table
On Wed, 8 Jun 2022 14:27:14 -0700
Ira Weiny <ira.weiny@intel.com> wrote:

> On Mon, Jun 06, 2022 at 11:15:41AM -0700, Ben Widawsky wrote:
> > On 22-06-04 17:50:46, ira.weiny@intel.com wrote:
> > > From: Jonathan Cameron <Jonathan.Cameron@huawei.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;
> > > +}
> > > +


\
 
 \ /
  Last update: 2022-06-09 10:29    [W:0.059 / U:0.540 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site