On Wed, Nov 08, 2023 at 01:25:34PM +0000, Duan, Zhenzhong wrote: > >I was expecting that hwpt manipulation would be done exclusively > >inside the device-specific vIOMMU userspace driver. Generic code paths > >that don't have that knowledge should use the IOAS for everything > > Yes, this way we don't need to distinguish between mdev and real device, > just attach to IOAS. But lose the benefit that same hwpt could be passed > into vIOMMU to be used as S2 hwpt in nesting.
If you have a nesting capable vIOMMU driver then it should be creating the HWPTs and managing them in its layer. Maybe the core code provides some helpers. Obviously you can't link a mdev to a nesting vIOMMU driver in the first place. Mdev should be connected to a different IOMMU driver that doesn't use HWPT at all. I think it will make alot of trouble to put the hwpt in the wrong layer as there shouldn't really be much generic code touching it. Jason