>>> On 14.05.19 at 18:13, <paul.durr...@citrix.com> wrote: >> -----Original Message----- >> From: Jan Beulich [mailto:jbeul...@suse.com] >> Sent: 13 May 2019 08:36 >> To: Paul Durrant <paul.durr...@citrix.com> >> Cc: Brian Woods <brian.wo...@amd.com>; Suravee Suthikulpanit > <suravee.suthikulpa...@amd.com>; Andrew >> Cooper <andrew.coop...@citrix.com>; Roger Pau Monne <roger....@citrix.com>; >> Wei > Liu >> <wei.l...@citrix.com>; Kevin Tian <kevin.t...@intel.com>; xen-devel > <xen-devel@lists.xenproject.org> >> Subject: Re: [PATCH 2/5] iommu / x86: move call to scan_pci_devices() out of > vendor code >> >> >>> On 08.05.19 at 15:24, <paul.durr...@citrix.com> wrote: >> > It's not vendor specific so it shouldn't really be there. >> >> Perhaps, but this needs better justification: >> >> > --- a/xen/drivers/passthrough/vtd/iommu.c >> > +++ b/xen/drivers/passthrough/vtd/iommu.c >> > @@ -2372,10 +2372,6 @@ static int __init vtd_setup(void) >> > P(iommu_hap_pt_share, "Shared EPT tables"); >> > #undef P >> > >> > - ret = scan_pci_devices(); >> > - if ( ret ) >> > - goto error; >> > - >> > ret = init_vtd_hw(); >> >> Even after some looking around, it's not obvious to me that the latter >> call doesn't depend on PCI devices being known, more specifically >> segment 0's bus2bridge[] having been filled. Nor can I tell whether >> there would be some noticeable misbehavior (prior to any guests >> starting) if there was a dependency and it got broken by the re- >> ordering. > > I don't see any dependency but the code is somewhat tangled. Perhaps it > would be better to build the PCI topology *before* IOMMU init and then > iterate over the the devices after init to do the group assignment. I > certainly can't see anything in the scan as it stands that would need the > IOMMU to have been initialized.
Ah, yes, that's likely a better model. As to the dependency aspect: pci_add_device() calls iommu_add_device(). But oddly enough _scan_pci_devices() calls alloc_pdev(), not pci_add_device(). So indeed there doesn't look to be any dependency at present. Jan _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel