Re: [PATCH V11 3/8] PCI: Create PCI library functions in support of DOE mailboxes.

From: Ira Weiny
Date: Wed Jun 22 2022 - 12:47:59 EST


On Sat, Jun 18, 2022 at 11:39:27AM -0500, Bjorn Helgaas wrote:
> On Fri, Jun 17, 2022 at 05:40:19PM -0500, Bjorn Helgaas wrote:
> > On Fri, Jun 10, 2022 at 01:22:54PM -0700, ira.weiny@xxxxxxxxx wrote:
> > > From: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
> > >
> > > Introduced in a PCI 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.
>
> > > + * pci_doe_get_irq_num() - Return the irq number for the mailbox at offset
> > > + *
> > > + * @pdev: The PCI device
> > > + * @offset: Offset of the DOE mailbox
> > > + *
> > > + * Returns: irq number on success
> > > + * -errno if irqs are not supported on this mailbox
> > > + */
> > > +int pci_doe_get_irq_num(struct pci_dev *pdev, int offset)
> > > +{
> > > + u32 val;
> > > +
> > > + pci_read_config_dword(pdev, offset + PCI_DOE_CAP, &val);
> > > + if (!FIELD_GET(PCI_DOE_CAP_INT, val))
> > > + return -EOPNOTSUPP;
> > > +
> > > + return FIELD_GET(PCI_DOE_CAP_IRQ, val);
> > > +}
> > > +EXPORT_SYMBOL_GPL(pci_doe_get_irq_num);
> >
> > Confusing function name (and comment) since PCI_DOE_CAP_IRQ is an
> > Interrupt Message Number that has nothing to do with Linux IRQ
> > numbers.
> >
> > I see we already have PCI_EXP_FLAGS_IRQ, PCI_ERR_ROOT_AER_IRQ,
> > PCI_EXP_DPC_IRQ, so I guess you're in good company.
>
> Should have been more clear about this: I think we should rename the
> new one to be PCI_DOE_CAP_INT_MSG_NUM or similar, and rename the
> function as well. It's too confusing to use "irq" for both Linux IRQs
> and what the spec calls "Interupt Message Numbers".

Oh... ok I was thinking of using int_msg_num in the function and variable
names. I was just not sure about 'int'. But if you like it then I do too!
:-D

I'll update the code as well as that macro.

Thanks again!
Ira