diff options
author | Lu Baolu <baolu.lu@linux.intel.com> | 2019-06-11 20:28:48 -0400 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2019-06-12 04:36:59 -0400 |
commit | 5679582c2fad11733ba65c12d127f9d703390e55 (patch) | |
tree | d304fa033071f5bf2a191432dac1b8f1ece9c5ee /drivers/iommu/intel-iommu.c | |
parent | 6a8c6748b94b0968a2f72d4bd2231eae703c0b13 (diff) |
iommu/vt-d: Allow DMA domain attaching to rmrr locked device
We don't allow a device to be assigned to user level when it is locked
by any RMRR's. Hence, intel_iommu_attach_device() will return error if
a domain of type IOMMU_DOMAIN_UNMANAGED is about to attach to a device
locked by rmrr. But this doesn't apply to a domain of type other than
IOMMU_DOMAIN_UNMANAGED. This adds a check to fix this.
Fixes: fa954e6831789 ("iommu/vt-d: Delegate the dma domain to upper layer")
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Reported-and-tested-by: Qian Cai <cai@lca.pw>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu/intel-iommu.c')
-rw-r--r-- | drivers/iommu/intel-iommu.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 03946dc4941f..c31fbe5790c7 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
@@ -5167,7 +5167,8 @@ static int intel_iommu_attach_device(struct iommu_domain *domain, | |||
5167 | { | 5167 | { |
5168 | int ret; | 5168 | int ret; |
5169 | 5169 | ||
5170 | if (device_is_rmrr_locked(dev)) { | 5170 | if (domain->type == IOMMU_DOMAIN_UNMANAGED && |
5171 | device_is_rmrr_locked(dev)) { | ||
5171 | dev_warn(dev, "Device is ineligible for IOMMU domain attach due to platform RMRR requirement. Contact your platform vendor.\n"); | 5172 | dev_warn(dev, "Device is ineligible for IOMMU domain attach due to platform RMRR requirement. Contact your platform vendor.\n"); |
5172 | return -EPERM; | 5173 | return -EPERM; |
5173 | } | 5174 | } |