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>
This commit is contained in:
parent
8e604097dd
commit
1ce28feb22
@ -206,6 +206,11 @@ static inline bool dma_pte_present(struct dma_pte *pte)
|
|||||||
/* devices under the same p2p bridge are owned in one domain */
|
/* devices under the same p2p bridge are owned in one domain */
|
||||||
#define DOMAIN_FLAG_P2P_MULTIPLE_DEVICES (1 < 0)
|
#define DOMAIN_FLAG_P2P_MULTIPLE_DEVICES (1 < 0)
|
||||||
|
|
||||||
|
/* domain represents a virtual machine, more than one devices
|
||||||
|
* across iommus may be owned in one domain, e.g. kvm guest.
|
||||||
|
*/
|
||||||
|
#define DOMAIN_FLAG_VIRTUAL_MACHINE (1 << 1)
|
||||||
|
|
||||||
struct dmar_domain {
|
struct dmar_domain {
|
||||||
int id; /* domain id */
|
int id; /* domain id */
|
||||||
unsigned long iommu_bmp; /* bitmap of iommus this domain uses*/
|
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)
|
|||||||
{
|
{
|
||||||
int iommu_id;
|
int iommu_id;
|
||||||
|
|
||||||
|
BUG_ON(domain->flags & DOMAIN_FLAG_VIRTUAL_MACHINE);
|
||||||
|
|
||||||
iommu_id = find_first_bit(&domain->iommu_bmp, g_num_of_iommus);
|
iommu_id = find_first_bit(&domain->iommu_bmp, g_num_of_iommus);
|
||||||
if (iommu_id < 0 || iommu_id >= g_num_of_iommus)
|
if (iommu_id < 0 || iommu_id >= g_num_of_iommus)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user