Re: [PATCH v2] driver core: platform: Setup device MSI domain just before driver probe
Anup Patel <[email protected]> Mon, 27 Jul 2026 19:23:50 +0530
| Newsgroups | dev.linux.lists.acpica-devel,dev.linux.lists.driver-core,dev.linux.lists.iommu,org.infradead.lists.linux-riscv,org.kernel.vger.linux-acpi,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <CAAhSdy2cDHO2w8VX34WV1kBxHQ6N0H0Ra_r6aDKK86250nWFSA@mail.gmail.com> |
On Mon, Jul 27, 2026 at 5:46=E2=80=AFPM Robin Murphy <[email protected]>= wrote: > > On 27/07/2026 9:40 am, Anup Patel wrote: > > On RISC-V, the MSI controller (aka RISC-V IMSIC) is probed as a regular > > platform device and MSI client drivers are always probed after the MSI > > controller driver using fw_devlink. Unfortunately, this is not sufficie= nt > > to ensure device MSI domain is set for MSI client devices before driver > > probe because OF framework sets device MSI domain at the time of platfo= rm > > device creation whereas ACPI framework expects arch specific code to se= t > > the device MSI domain at the time of platform device creation. > > > > Currently, to address the problem of device MSI domain being not set > > correctly, various RISC-V MSI client drivers explicitly set device > > MSI domain in the driver probe function using below code pattern: > > > > /* > > * The device MSI domain for platform devices on RISC-V architect= ure > > * is only available after the MSI controller driver is probed so= , > > * explicitly configure here. > > */ > > if (!dev_get_msi_domain(dev)) { > > /* > > * The device MSI domain for OF devices is only set at th= e > > * time of populating/creating OF device. If the device M= SI > > * domain is discovered later after the OF device is crea= ted > > * then we need to set it explicitly before using any pla= tform > > * MSI functions. > > */ > > if (is_of_node(fwnode)) { > > of_msi_configure(dev, dev_of_node(dev)); > > } else if (is_acpi_device_node(fwnode)) { > > struct irq_domain *msi_domain; > > msi_domain =3D irq_find_matching_fwnode(imsic_acp= i_get_fwnode(dev), > > DOMAIN_BUS_= PLATFORM_MSI); > > dev_set_msi_domain(dev, msi_domain); > > } > > > > if (!dev_get_msi_domain(dev)) > > return -EPROBE_DEFER; > > I stand by my previous comment that relying on ACPI initcall order and > assuming fw_devlink is enabled doesn't really seem robust enough to > justify dropping proper handling of this case, especially if pretending > it's a generic interface. I think you still fail to understand the root-cause of the msi_domain not being set correctly in the struct device. There is no issue with the probe order (or probe deferral) rather the issue is msi_domain being set very early by OF / ACPI framework at the time of device creation when there is no MSI domain registered. Let's take the case of OF based platform devices with RISC-V: 1) The OF framework set the msi_domain at the time of platform device creation but unfortunately the RISC-V MSI controller driver is also a platform device (aka RISC-V IMSIC driver) which is probed much latter hence the msi_domain for all OF platform devices is set to NULL. (Refer call path, of_platform_device_create_pdata() -> of_msi_configure() -> dev_set_msi_domain() 2) The fw_devlink based probe ordering in the Linux DD framework ensures that RISC-V MSI controller driver is probed before the MSI client drivers (such as RISC-V APLIC MSI driver, RISC-V system MSI driver, etc) but still when these MSI client drivers are probed the msi_domain remains NULL for the platform device of MSI client. 3) Due to #1 and #2 above, the MSI client driver have to explicitlly call of_msi_configure() on RISC-V because no one updates the msi_domain of all platform devices after RISC-V MSI controller registers a MSI irqdomain. This patch eliminates the #3 above by calling of_msi_configure() right before probing the OF platform device. Regards, Anup