On Tue, Nov 26, 2024 at 12:19:01PM -0500, Frank Li wrote: [...] > > > > > + /* Only support one EPF for doorbell */ > > > > > + epf = list_first_entry_or_null(&epc->pci_epf, struct pci_epf, list); > > > > > > > > Why don't you impose this restriction in pci_epf_alloc_doorbell() itself? > > > > > > This is callback from platform_device_msi_init_and_alloc_irqs(). So it is > > > actually restriction at pci_epf_alloc_doorbell(). > > > > > > > I don't know how to parse this last sentence. But my question was why don't you > > impose this one EPF restriction in pci_epf_alloc_doorbell() before allocating > > the MSI domain using platform_device_msi_init_and_alloc_irqs()? This way if > > someone calls pci_epf_alloc_doorbell() multi EPF, it will fail. > > Yes, it is limitation for current platfrom msi framework. It is totally > equal. > > call stack is > pci_epf_alloc_doorbell() > platform_device_msi_init_and_alloc_irqs() > ... > pci_epc_write_msi_msg() > > > > It is totally equal return at pci_epc_write_msi_msg() or return before > platform_device_msi_init_and_alloc_irqs(). > No, these two are not the same. pci_epc_write_msi_msg() will only be called when enabling the MSI, which is too late IMO. Why are you insisting in calling platform_device_msi_init_and_alloc_irqs() for multi EPF? I don't quite understand. If the platform cannot support it, then it should not be called in first place. > why check epf in pci_epc_write_msi_msg() is because it use epf in here. > pci_epf_alloc_doorbell() never use epf variable. If check unused variable > in pci_epf_alloc_doorbell(), user don't know why and what's exactly > restrict it. > This is not a good argument and doesn't make sense, sorry. You should not call platform_device_msi_init_and_alloc_irqs() for multi EPF. - Mani -- மணிவண்ணன் சதாசிவம்