diff options
author | Joerg Roedel <joerg.roedel@amd.com> | 2008-12-02 11:46:25 -0500 |
---|---|---|
committer | Joerg Roedel <joerg.roedel@amd.com> | 2009-01-03 08:11:54 -0500 |
commit | 9fdb19d64c0247f23343b51fc85f438f8e7a2f3c (patch) | |
tree | 4950b0193aa74489da7150cf5cacccb1c5125823 | |
parent | 43f4960983a309568a6c4375f081e63fb2ff24a3 (diff) |
AMD IOMMU: add protection domain flags
Imapct: add a new struct member to 'struct protection_domain'
When using protection domains for dma_ops and KVM its better to know for
which subsystem it was allocated. Add a flags member to struct
protection domain for that purpose.
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
-rw-r--r-- | arch/x86/include/asm/amd_iommu_types.h | 14 | ||||
-rw-r--r-- | arch/x86/kernel/amd_iommu.c | 1 |
2 files changed, 10 insertions, 5 deletions
diff --git a/arch/x86/include/asm/amd_iommu_types.h b/arch/x86/include/asm/amd_iommu_types.h index ac302a2fa339..4862a5be899c 100644 --- a/arch/x86/include/asm/amd_iommu_types.h +++ b/arch/x86/include/asm/amd_iommu_types.h | |||
@@ -190,16 +190,20 @@ | |||
190 | /* FIXME: move this macro to <linux/pci.h> */ | 190 | /* FIXME: move this macro to <linux/pci.h> */ |
191 | #define PCI_BUS(x) (((x) >> 8) & 0xff) | 191 | #define PCI_BUS(x) (((x) >> 8) & 0xff) |
192 | 192 | ||
193 | /* Protection domain flags */ | ||
194 | #define PD_DMA_OPS_MASK (1UL << 0) /* domain used for dma_ops */ | ||
195 | |||
193 | /* | 196 | /* |
194 | * This structure contains generic data for IOMMU protection domains | 197 | * This structure contains generic data for IOMMU protection domains |
195 | * independent of their use. | 198 | * independent of their use. |
196 | */ | 199 | */ |
197 | struct protection_domain { | 200 | struct protection_domain { |
198 | spinlock_t lock; /* mostly used to lock the page table*/ | 201 | spinlock_t lock; /* mostly used to lock the page table*/ |
199 | u16 id; /* the domain id written to the device table */ | 202 | u16 id; /* the domain id written to the device table */ |
200 | int mode; /* paging mode (0-6 levels) */ | 203 | int mode; /* paging mode (0-6 levels) */ |
201 | u64 *pt_root; /* page table root pointer */ | 204 | u64 *pt_root; /* page table root pointer */ |
202 | void *priv; /* private data */ | 205 | unsigned long flags; /* flags to find out type of domain */ |
206 | void *priv; /* private data */ | ||
203 | }; | 207 | }; |
204 | 208 | ||
205 | /* | 209 | /* |
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c index 2b6b8e050bd8..bb28e2cda711 100644 --- a/arch/x86/kernel/amd_iommu.c +++ b/arch/x86/kernel/amd_iommu.c | |||
@@ -729,6 +729,7 @@ static struct dma_ops_domain *dma_ops_domain_alloc(struct amd_iommu *iommu, | |||
729 | goto free_dma_dom; | 729 | goto free_dma_dom; |
730 | dma_dom->domain.mode = PAGE_MODE_3_LEVEL; | 730 | dma_dom->domain.mode = PAGE_MODE_3_LEVEL; |
731 | dma_dom->domain.pt_root = (void *)get_zeroed_page(GFP_KERNEL); | 731 | dma_dom->domain.pt_root = (void *)get_zeroed_page(GFP_KERNEL); |
732 | dma_dom->domain.flags = PD_DMA_OPS_MASK; | ||
732 | dma_dom->domain.priv = dma_dom; | 733 | dma_dom->domain.priv = dma_dom; |
733 | if (!dma_dom->domain.pt_root) | 734 | if (!dma_dom->domain.pt_root) |
734 | goto free_dma_dom; | 735 | goto free_dma_dom; |