Re: [PATCH v8 2/6] PCI: endpoint: Add RC-to-EP doorbell support using platform MSI controller
From: Niklas Cassel
Date: Sun Nov 24 2024 - 04:56:47 EST
On 24 November 2024 08:11:00 CET, Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxx> wrote:
>On Sat, Nov 16, 2024 at 09:40:42AM -0500, Frank Li wrote:
>> +static int pci_epc_alloc_doorbell(struct pci_epc *epc, struct pci_epf *epf)
>> +{
>> + struct device *dev = epc->dev.parent;
>> + u16 num_db = epf->num_db;
>> + int i = 0;
>> + int ret;
>> +
>> + guard(mutex)(&epc->lock);
>> +
>> + ret = platform_device_msi_init_and_alloc_irqs(dev, num_db, pci_epc_write_msi_msg);
>> + if (ret) {
>> + dev_err(dev, "Failed to allocate MSI, may miss 'msi-parent' at your DTS\n");
>
>No need to mention 'msi-parent'. Just 'Failed to allocate MSI' is enough.
If you look at the existing pcie_ep device tree nodes for all SoCs, you will see that it is very rare to see an EP node which specifies msi-parent.
I guess that makes sense, since before this series, AFAICT, msi-parent was completely unused, so there was no need for an EP node to specify it.
I'm okay to change the error print as you suggested, but in that case I really think that we should add a comment above the check, something suggestive like:
/*
* The pcie_ep DT node has to specify
* 'msi-parent' for EP doorbell support to work.
* Right now only GIC ITS is supported.
* If you have GIC ITS and reached this print,
* perhaps you are missing 'msi-parent' in DT?
*/
if (ret) {
dev_err(dev, "Failed to allocate MSI\n");
return -ENODEV;
}
Kind regards,
Niklas