iommu: Do iommu_group_create_direct_mappings() before attach
authorJason Gunthorpe <jgg@nvidia.com>
Thu, 11 May 2023 04:42:08 +0000 (01:42 -0300)
committerJoerg Roedel <jroedel@suse.de>
Tue, 23 May 2023 06:15:55 +0000 (08:15 +0200)
commit152431e4fe7f1aac8aa6cc57bfe58d2d2596be4d
tree36784fc8cda55c172b732e95405b58efeecb0cf5
parente7f85dfbbc9cf8660174c45c213571aaa518df85
iommu: Do iommu_group_create_direct_mappings() before attach

The iommu_probe_device() path calls iommu_create_device_direct_mappings()
after attaching the device.

IOMMU_RESV_DIRECT maps need to be continually in place, so if a hotplugged
device has new ranges the should have been mapped into the default domain
before it is attached.

Move the iommu_create_device_direct_mappings() call up.

Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/10-v5-1b99ae392328+44574-iommu_err_unwind_jgg@nvidia.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/iommu.c