return (12 + (level - 1) * LEVEL_STRIDE);
}
-static inline int address_level_offset(u64 addr, int level)
+static inline int pfn_level_offset(unsigned long pfn, int level)
{
- return ((addr >> level_to_offset_bits(level)) & LEVEL_MASK);
+ return (pfn >> (level_to_offset_bits(level) - 12)) & LEVEL_MASK;
}
static inline u64 level_mask(int level)
while (level > 0) {
void *tmp_page;
- offset = address_level_offset(addr, level);
+ offset = pfn_level_offset(addr >> VTD_PAGE_SHIFT, level);
pte = &parent[offset];
if (level == 1)
break;
parent = domain->pgd;
while (level <= total) {
- offset = address_level_offset(addr, total);
+ offset = pfn_level_offset(addr >> VTD_PAGE_SHIFT, total);
pte = &parent[offset];
if (level == total)
return pte;