lkml.org 
[lkml]   [2022]   [Jun]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH V10 5/9] cxl/port: Find a DOE mailbox which supports CDAT
On Wed, Jun 08, 2022 at 12:39:49PM -0700, Ira wrote:
> On Mon, Jun 06, 2022 at 10:48:19AM -0700, Ben Widawsky wrote:
> > On 22-06-04 17:50:45, ira.weiny@intel.com wrote:
> > > From: Ira Weiny <ira.weiny@intel.com>
> > >

[snip]

> > > +
> > > +/**
> > > + * cxl_cache_cdat_mb() -- cache the DOE mailbox which suports the CDAT protocol
> > > + *
> > > + * @port: Port to containing DOE Mailboxes
> > > + *
> > > + * Cache a pointer to the doe mailbox which supports CDAT.
> > > + */
> > > +void cxl_cache_cdat_mb(struct cxl_port *port)
> > > +{
> > > + struct device *dev = port->uport;
> > > + struct cxl_memdev *cxlmd;
> > > + struct cxl_dev_state *cxlds;
> > > + int i;
> > > +
> > > + if (!is_cxl_memdev(dev))
> > > + return;
> > > +
> > > + cxlmd = to_cxl_memdev(dev);
> > > + cxlds = cxlmd->cxlds;
> > > +
> > > + for (i = 0; i < cxlds->num_mbs; i++) {
> > > + struct pci_doe_mb *cur = cxlds->doe_mbs[i];
> > > +
> > > + if (pci_doe_supports_prot(cur, PCI_DVSEC_VENDOR_ID_CXL,
> > > + CXL_DOE_PROTOCOL_TABLE_ACCESS)) {
> > > + port->cdat_mb = cur;
> >
> > What happens if cxl_pci is unloaded after this? Would it be better to copy out
> > the CDAT info? Otherwise, I think you need to hold a ref on the PCI device
> > (though I only took a quick look).
>
> <sigh> I thought that could not happen but I see I was wrong.
>
> A reference will need to be taken for at least the duration of the query.
> Originally I had this set up to try and make it easier to query later. But I
> think that is a waste ATM.
>
> I'm going to rework this ownership.

BTW this means this patch is going away. I think just searching for the
mailbox with CDAT support on each query is the way to go at this time.

Ira

>
> Thanks for the review,
> Ira
>

\
 
 \ /
  Last update: 2022-06-08 23:39    [W:0.225 / U:0.324 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site