diff options
author | David Woodhouse <David.Woodhouse@intel.com> | 2009-06-27 11:40:08 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2009-06-29 07:38:32 -0400 |
commit | 77dfa56c94d2855a25ff552b74980a5538e129f8 (patch) | |
tree | be0d357d3b62e7b72ad40dcb66512bc6f29221a7 /drivers | |
parent | dd4e831960e4f0214480fa96a53ca9bb7dd04927 (diff) |
intel-iommu: Change address_level_offset() to pfn_level_offset()
We're shifting the inputs for now, but that'll change...
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/pci/intel-iommu.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index 852f40a913d4..529c1c13048f 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c | |||
@@ -671,9 +671,9 @@ static inline unsigned int level_to_offset_bits(int level) | |||
671 | return (12 + (level - 1) * LEVEL_STRIDE); | 671 | return (12 + (level - 1) * LEVEL_STRIDE); |
672 | } | 672 | } |
673 | 673 | ||
674 | static inline int address_level_offset(u64 addr, int level) | 674 | static inline int pfn_level_offset(unsigned long pfn, int level) |
675 | { | 675 | { |
676 | return ((addr >> level_to_offset_bits(level)) & LEVEL_MASK); | 676 | return (pfn >> (level_to_offset_bits(level) - 12)) & LEVEL_MASK; |
677 | } | 677 | } |
678 | 678 | ||
679 | static inline u64 level_mask(int level) | 679 | static inline u64 level_mask(int level) |
@@ -708,7 +708,7 @@ static struct dma_pte * addr_to_dma_pte(struct dmar_domain *domain, u64 addr) | |||
708 | while (level > 0) { | 708 | while (level > 0) { |
709 | void *tmp_page; | 709 | void *tmp_page; |
710 | 710 | ||
711 | offset = address_level_offset(addr, level); | 711 | offset = pfn_level_offset(addr >> VTD_PAGE_SHIFT, level); |
712 | pte = &parent[offset]; | 712 | pte = &parent[offset]; |
713 | if (level == 1) | 713 | if (level == 1) |
714 | break; | 714 | break; |
@@ -749,7 +749,7 @@ static struct dma_pte *dma_addr_level_pte(struct dmar_domain *domain, u64 addr, | |||
749 | 749 | ||
750 | parent = domain->pgd; | 750 | parent = domain->pgd; |
751 | while (level <= total) { | 751 | while (level <= total) { |
752 | offset = address_level_offset(addr, total); | 752 | offset = pfn_level_offset(addr >> VTD_PAGE_SHIFT, total); |
753 | pte = &parent[offset]; | 753 | pte = &parent[offset]; |
754 | if (level == total) | 754 | if (level == total) |
755 | return pte; | 755 | return pte; |