On Fri, Dec 09 2022 at 13:38, Jason Gunthorpe wrote: > On Fri, Dec 09, 2022 at 04:44:06PM +0000, Robin Murphy wrote: > >> Isn't the problem with this that it's super-early, and a device's MSI domain >> may not actually be resolved until someone starts requesting MSIs for it? >> Maybe Thomas' ongoing per-device stuff changes that, but I'm not >> sure :/ > > Yes, this looks correct, OK, so I will do Kevin's thought The device MSI domain has to be valid before a device can be probed, at least that's the case for PCI/MSI devices. The pointer is established during PCI discovery. The per device MSI domains do not change that requirement. The only difference is that device->msi.domain now points to the MSI parent domain. In the "global" PCI/MSI domain case the hierarchy walk will (on x86) start at the PCI/MSI domain and end up either at the remapping unit, which has the protection property, or at the vector (root) domain, which does not. For the per device domain case the walk will start at the parent domain, which is (on x86) either the remapping unit or the vector (root) domain. The same is true for ARM(64) and other hierarchy users, just the naming conventions and possible scenarios are different. So for both scenarios (global and per-device) searching for that protection property down the hierarchy starting from device->msi.domain is correct. Obvioulsy unless it's done somewhere early in the PCI discovery, i.e. before the discovery associated the domain pointer. Thanks, tglx