diff options
-rw-r--r-- | arch/x86/include/asm/amd_iommu_types.h | 1 | ||||
-rw-r--r-- | arch/x86/kernel/amd_iommu.c | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/arch/x86/include/asm/amd_iommu_types.h b/arch/x86/include/asm/amd_iommu_types.h index 4862a5be899c..1c769f4e6cdf 100644 --- a/arch/x86/include/asm/amd_iommu_types.h +++ b/arch/x86/include/asm/amd_iommu_types.h | |||
@@ -203,6 +203,7 @@ struct protection_domain { | |||
203 | int mode; /* paging mode (0-6 levels) */ | 203 | int mode; /* paging mode (0-6 levels) */ |
204 | u64 *pt_root; /* page table root pointer */ | 204 | u64 *pt_root; /* page table root pointer */ |
205 | unsigned long flags; /* flags to find out type of domain */ | 205 | unsigned long flags; /* flags to find out type of domain */ |
206 | unsigned dev_cnt; /* devices assigned to this domain */ | ||
206 | void *priv; /* private data */ | 207 | void *priv; /* private data */ |
207 | }; | 208 | }; |
208 | 209 | ||
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c index 5c465c91150e..8b45bc49d1c5 100644 --- a/arch/x86/kernel/amd_iommu.c +++ b/arch/x86/kernel/amd_iommu.c | |||
@@ -825,9 +825,10 @@ static void set_device_domain(struct amd_iommu *iommu, | |||
825 | u16 devid) | 825 | u16 devid) |
826 | { | 826 | { |
827 | unsigned long flags; | 827 | unsigned long flags; |
828 | |||
829 | u64 pte_root = virt_to_phys(domain->pt_root); | 828 | u64 pte_root = virt_to_phys(domain->pt_root); |
830 | 829 | ||
830 | domain->dev_cnt += 1; | ||
831 | |||
831 | pte_root |= (domain->mode & DEV_ENTRY_MODE_MASK) | 832 | pte_root |= (domain->mode & DEV_ENTRY_MODE_MASK) |
832 | << DEV_ENTRY_MODE_SHIFT; | 833 | << DEV_ENTRY_MODE_SHIFT; |
833 | pte_root |= IOMMU_PTE_IR | IOMMU_PTE_IW | IOMMU_PTE_P | IOMMU_PTE_TV; | 834 | pte_root |= IOMMU_PTE_IR | IOMMU_PTE_IW | IOMMU_PTE_P | IOMMU_PTE_TV; |