iommu/vt-d: Add custom allocator for IOASID
authorJacob Pan <jacob.jun.pan@linux.intel.com>
Sat, 16 May 2020 06:20:51 +0000 (14:20 +0800)
committerJoerg Roedel <jroedel@suse.de>
Mon, 18 May 2020 13:37:25 +0000 (15:37 +0200)
commit3375303e82877552f3b2b42309e8233fe715fd9f
tree73ae1b229a5e05e01b2754c8464504add1912cfc
parent24f27d32ab6b71dedcbbeeab8f9bdc143b539ac0
iommu/vt-d: Add custom allocator for IOASID

When VT-d driver runs in the guest, PASID allocation must be
performed via virtual command interface. This patch registers a
custom IOASID allocator which takes precedence over the default
XArray based allocator. The resulting IOASID allocation will always
come from the host. This ensures that PASID namespace is system-
wide.

Virtual command registers are used in the guest only, to prevent
vmexit cost, we cache the capability and store it during initialization.

Signed-off-by: Liu, Yi L <yi.l.liu@intel.com>
Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Link: https://lore.kernel.org/r/20200516062101.29541-9-baolu.lu@linux.intel.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/dmar.c
drivers/iommu/intel-iommu.c
include/linux/intel-iommu.h