aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/intel-iommu.c
diff options
context:
space:
mode:
authorMark McLoughlin <markmc@redhat.com>2008-11-20 10:49:44 -0500
committerJoerg Roedel <joerg.roedel@amd.com>2009-01-03 05:57:35 -0500
commit46b08e1a76b758193b0e7b889c6486a16eb1e9e2 (patch)
tree0a71af4a4bef41e512adabdd0d343c1aa1c8e103 /drivers/pci/intel-iommu.c
parentf27be03b271851fd54529f292c0f25b4c1f1a553 (diff)
intel-iommu: move root entry defs from dma_remapping.h
We keep the struct root_entry forward declaration for the pointer in struct intel_iommu. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/pci/intel-iommu.c')
-rw-r--r--drivers/pci/intel-iommu.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index 6fadbb9bc180..29bf2d8176e2 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -57,6 +57,39 @@
57#define DMA_32BIT_PFN IOVA_PFN(DMA_32BIT_MASK) 57#define DMA_32BIT_PFN IOVA_PFN(DMA_32BIT_MASK)
58#define DMA_64BIT_PFN IOVA_PFN(DMA_64BIT_MASK) 58#define DMA_64BIT_PFN IOVA_PFN(DMA_64BIT_MASK)
59 59
60/*
61 * 0: Present
62 * 1-11: Reserved
63 * 12-63: Context Ptr (12 - (haw-1))
64 * 64-127: Reserved
65 */
66struct root_entry {
67 u64 val;
68 u64 rsvd1;
69};
70#define ROOT_ENTRY_NR (VTD_PAGE_SIZE/sizeof(struct root_entry))
71static inline bool root_present(struct root_entry *root)
72{
73 return (root->val & 1);
74}
75static inline void set_root_present(struct root_entry *root)
76{
77 root->val |= 1;
78}
79static inline void set_root_value(struct root_entry *root, unsigned long value)
80{
81 root->val |= value & VTD_PAGE_MASK;
82}
83
84static inline struct context_entry *
85get_context_addr_from_root(struct root_entry *root)
86{
87 return (struct context_entry *)
88 (root_present(root)?phys_to_virt(
89 root->val & VTD_PAGE_MASK) :
90 NULL);
91}
92
60static void flush_unmaps_timeout(unsigned long data); 93static void flush_unmaps_timeout(unsigned long data);
61 94
62DEFINE_TIMER(unmap_timer, flush_unmaps_timeout, 0, 0); 95DEFINE_TIMER(unmap_timer, flush_unmaps_timeout, 0, 0);