summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Roedel <jroedel@suse.de>2015-09-23 19:16:01 +0200
committerJoerg Roedel <jroedel@suse.de>2015-10-05 17:39:21 +0200
commitb1ce5b79aec8d8cd8bcd076d8cce8bc3cd690051 (patch)
treec99b6079b7ee1b209b6f4ba96e20b5d87346866e
parentd66ce54b4664a0d66429a4de996741581d71cf90 (diff)
downloadlinux-stable-b1ce5b79aec8d8cd8bcd076d8cce8bc3cd690051.tar.gz
linux-stable-b1ce5b79aec8d8cd8bcd076d8cce8bc3cd690051.tar.bz2
linux-stable-b1ce5b79aec8d8cd8bcd076d8cce8bc3cd690051.zip
iommu/vt-d: Create RMRR mappings in newly allocated domains
Currently the RMRR entries are created only at boot time. This means they will vanish when the domain allocated at boot time is destroyed. This patch makes sure that also newly allocated domains will get RMRR mappings. Signed-off-by: Joerg Roedel <jroedel@suse.de>
-rw-r--r--drivers/iommu/intel-iommu.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 24d31090b140..6ac6e741c46e 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -3241,7 +3241,10 @@ static struct iova *intel_alloc_iova(struct device *dev,
static struct dmar_domain *__get_valid_domain_for_dev(struct device *dev)
{
+ struct dmar_rmrr_unit *rmrr;
struct dmar_domain *domain;
+ struct device *i_dev;
+ int i, ret;
domain = get_domain_for_dev(dev, DEFAULT_DOMAIN_ADDRESS_WIDTH);
if (!domain) {
@@ -3250,6 +3253,23 @@ static struct dmar_domain *__get_valid_domain_for_dev(struct device *dev)
return NULL;
}
+ /* We have a new domain - setup possible RMRRs for the device */
+ rcu_read_lock();
+ for_each_rmrr_units(rmrr) {
+ for_each_active_dev_scope(rmrr->devices, rmrr->devices_cnt,
+ i, i_dev) {
+ if (i_dev != dev)
+ continue;
+
+ ret = domain_prepare_identity_map(dev, domain,
+ rmrr->base_address,
+ rmrr->end_address);
+ if (ret)
+ dev_err(dev, "Mapping reserved region failed\n");
+ }
+ }
+ rcu_read_unlock();
+
return domain;
}