[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YrszP+S3XLpmZL3n@iweiny-desk3>
Date: Tue, 28 Jun 2022 09:58:39 -0700
From: Ira Weiny <ira.weiny@...el.com>
To: Jonathan Cameron <Jonathan.Cameron@...wei.com>
CC: Dan Williams <dan.j.williams@...el.com>,
Bjorn Helgaas <bhelgaas@...gle.com>,
"Li, Ming" <ming4.li@...el.com>,
Bjorn Helgaas <helgaas@...nel.org>,
Lukas Wunner <lukas@...ner.de>,
Alison Schofield <alison.schofield@...el.com>,
Vishal Verma <vishal.l.verma@...el.com>,
"Dave Jiang" <dave.jiang@...el.com>,
Ben Widawsky <bwidawsk@...nel.org>,
<linux-kernel@...r.kernel.org>, <linux-cxl@...r.kernel.org>,
<linux-pci@...r.kernel.org>
Subject: Re: [PATCH V12 3/9] PCI: Create PCIe library functions in support of
DOE mailboxes.
On Tue, Jun 28, 2022 at 03:38:48PM +0100, Jonathan Cameron wrote:
> On Mon, 27 Jun 2022 21:15:21 -0700
> ira.weiny@...el.com wrote:
>
> > From: Jonathan Cameron <Jonathan.Cameron@...wei.com>
> >
> > Introduced in a PCIe r6.0, sec 6.30, DOE provides a config space based
> > mailbox with standard protocol discovery. Each mailbox is accessed
> > through a DOE Extended Capability.
> >
> > Each DOE mailbox must support the DOE discovery protocol in addition to
> > any number of additional protocols.
> >
> > Define core PCIe functionality to manage a single PCIe DOE mailbox at a
> > defined config space offset. Functionality includes iterating,
> > creating, query of supported protocol, and task submission. Destruction
> > of the mailboxes is device managed.
> >
> > If interrupts are desired, the interrupt number can be queried and
> > passed to the create function. Passing a negative value disables
> > interrupts for that mailbox. It is the caller's responsibility to ensure
> > enough interrupt vectors are allocated.
> >
> > Cc: "Li, Ming" <ming4.li@...el.com>
> > Cc: Bjorn Helgaas <helgaas@...nel.org>
> > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@...wei.com>
> > Co-developed-by: Ira Weiny <ira.weiny@...el.com>
> > Signed-off-by: Ira Weiny <ira.weiny@...el.com>
>
> +static void *pci_doe_xa_entry(u16 vid, u8 prot)
> +{
> + return (void *)(((unsigned long)vid << 16) | prot);
> +}
> ...
>
> > +static int pci_doe_cache_protocols(struct pci_doe_mb *doe_mb)
> > +{
> > + u8 index = 0;
> > + u8 xa_idx = 0;
> > +
> > + do {
> > + int rc;
> > + u16 vid;
> > + u8 prot;
> > +
> > + rc = pci_doe_discovery(doe_mb, &index, &vid, &prot);
> > + if (rc)
> > + return rc;
> > +
> > + pci_dbg(doe_mb->pdev,
> > + "[%x] Found protocol %d vid: %x prot: %x\n",
> > + doe_mb->cap_offset, xa_idx, vid, prot);
> > +
> > + rc = xa_insert(&doe_mb->prots, xa_idx++,
> > + pci_doe_xa_entry(vid, prot), GFP_KERNEL);
>
> I'm not that familiar with xarray, but the docs suggest that you have
> to use xa_mk_value() to store an integer directly into it.
Indeed I missed that. Thanks.
Ira
>
> > + if (rc)
> > + return -ENOMEM;
> > + } while (index);
> > +
> > + return 0;
> > +}
> > +
Powered by blists - more mailing lists