> From: Jason Gunthorpe <jgg@xxxxxxxx> > Sent: Monday, May 10, 2021 11:55 PM > > On Mon, May 10, 2021 at 08:54:02AM +0200, Christoph Hellwig wrote: > > The iommu_device field in struct mdev_device has never been used > > since it was added more than 2 years ago. > > > > Signed-off-by: Christoph Hellwig <hch@xxxxxx> > > --- > > drivers/vfio/vfio_iommu_type1.c | 132 ++++++-------------------------- > > include/linux/mdev.h | 20 ----- > > 2 files changed, 25 insertions(+), 127 deletions(-) > > I asked Intel folks to deal with this a month ago: > > https://lore.kernel.org/kvm/20210406200030.GA425310@xxxxxxxxxx/ > > So lets just remove it, it is clearly a bad idea > > Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx> > Want to get a clearer picture on what needs to be redesigned after this removal. Are you specially concerned about this iommu_device hack which directly connects mdev_device to iommu layer or the entire removed logic including the aux domain concept? For the former we are now following up the referred thread to find a clean way. But for the latter we feel it's still necessary regardless of how iommu interface is redesigned to support device connection from the upper level driver. The reason is that with mdev or subdevice one physical device could be attached to multiple domains now. there could be a primary domain with DOMAIN_ DMA type for DMA_API use by parent driver itself, and multiple auxiliary domains with DOMAIN_UNMANAGED types for subdevices assigned to different VMs. In this case It's a different model from existing policy which allows only one domain per device. In removed code we followed Joerg's suggestion to keep existing iommu_attach_device for connecting device to the primary domain and then add new iommu_aux_attach_ device for connecting device to auxiliary domains. Lots of removed iommu code deal with the management of auxiliary domains in the iommu core layer and intel-iommu drivers, which imho is largely generic and could be leveraged w/o intrusive refactoring to support redesigned iommu interface. Does it sound a reasonable position? Thanks Kevin