diff options
author | Weidong Han <weidong.han@intel.com> | 2008-12-08 03:35:39 -0500 |
---|---|---|
committer | Joerg Roedel <joerg.roedel@amd.com> | 2009-01-03 08:02:18 -0500 |
commit | 1ce28feb22833645a0f3843cd873a0b56ed19ef0 (patch) | |
tree | d5196526bdcff639a40262b29f45f06019f02b45 | |
parent | 8e604097ddc483eb1e6e99564953e4e937fe439a (diff) |
Add domain flag DOMAIN_FLAG_VIRTUAL_MACHINE
Add this flag for VT-d used in virtual machine, like KVM.
Signed-off-by: Weidong Han <weidong.han@intel.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
-rw-r--r-- | drivers/pci/intel-iommu.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index 104e99df2ade..ffbe4c573729 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c | |||
@@ -206,6 +206,11 @@ static inline bool dma_pte_present(struct dma_pte *pte) | |||
206 | /* devices under the same p2p bridge are owned in one domain */ | 206 | /* devices under the same p2p bridge are owned in one domain */ |
207 | #define DOMAIN_FLAG_P2P_MULTIPLE_DEVICES (1 < 0) | 207 | #define DOMAIN_FLAG_P2P_MULTIPLE_DEVICES (1 < 0) |
208 | 208 | ||
209 | /* domain represents a virtual machine, more than one devices | ||
210 | * across iommus may be owned in one domain, e.g. kvm guest. | ||
211 | */ | ||
212 | #define DOMAIN_FLAG_VIRTUAL_MACHINE (1 << 1) | ||
213 | |||
209 | struct dmar_domain { | 214 | struct dmar_domain { |
210 | int id; /* domain id */ | 215 | int id; /* domain id */ |
211 | unsigned long iommu_bmp; /* bitmap of iommus this domain uses*/ | 216 | unsigned long iommu_bmp; /* bitmap of iommus this domain uses*/ |
@@ -391,6 +396,8 @@ static struct intel_iommu *domain_get_iommu(struct dmar_domain *domain) | |||
391 | { | 396 | { |
392 | int iommu_id; | 397 | int iommu_id; |
393 | 398 | ||
399 | BUG_ON(domain->flags & DOMAIN_FLAG_VIRTUAL_MACHINE); | ||
400 | |||
394 | iommu_id = find_first_bit(&domain->iommu_bmp, g_num_of_iommus); | 401 | iommu_id = find_first_bit(&domain->iommu_bmp, g_num_of_iommus); |
395 | if (iommu_id < 0 || iommu_id >= g_num_of_iommus) | 402 | if (iommu_id < 0 || iommu_id >= g_num_of_iommus) |
396 | return NULL; | 403 | return NULL; |