On Tue, Jul 09, 2024 at 07:22:16PM +0200, Eric Auger wrote: > On 7/9/24 19:11, Nicolin Chen wrote: > > On Tue, Jul 09, 2024 at 11:20:16AM +0200, Eric Auger wrote: > >> On 6/26/24 02:28, Nicolin Chen wrote: > >>> Nested SMMUv3 feature requires the support/presence of host-level SMMUv3 > >>> instance(s). Add a helper to read the sysfs for the number of instances. > >>> Log them in a vms list using a new struct VirtNestedSmmu. > >>> > >>> This will be used by a following patch to assign a passthrough device to > >>> corresponding nested SMMUv3 instance. > >> Laterly the HostIOMMUDevice has been introduced to allow, among other > >> things, to pass information related to the physical IOMMU to the virtual > >> IOMMU. > >> I guess it would be well fitted to associate the viommu with its > >> underlying piommu. > > Wow, I missed that part -- backends/host_iommu_device. I will > > see how I can fit these well with that. > > > >> I don't think we have such kind of host introspection in machine type. > >> Generally in can happen in the very device or in libvirt. > > I think the biggest reason for having such an introspection in > > the virt code is because of hotplug, (though it's not properly > > implemented yet), as we don't know what new devices requiring > > for nested translation would be joining later. So somebody has > > to hold a full list. > > > > Would you mind elaborating how the "device" or "libvirt" can > > handle that? > If you know that on Grace you have 5 SMMU instances, can't you pre-build > a PCIe topology with 5 PXB and root ports at libvirt level. > Then when you hotplug your device you specify the corresponding slot > just as we do normally. But maybe I misunderstood the hotplug problematics.
I guess I got your point: basically, the introspection and sysfs node matching for device assigning should happen in libvirt. Thanks Nicolin