diff options
author | Joerg Roedel <joerg.roedel@amd.com> | 2010-05-11 17:40:57 +0200 |
---|---|---|
committer | Joerg Roedel <joerg.roedel@amd.com> | 2010-05-11 17:40:57 +0200 |
commit | 795e74f7a69f9c08afa4fa7c86cc4f18a62bd630 (patch) | |
tree | 8448ece35101d8db945c49df50d0d5889687de9f /arch/x86/include/asm | |
parent | a52357259680fe5368c2fabf5949209e231f2aa2 (diff) | |
parent | 12c7389abe5786349d3ea6da1961cf78d0c1c7cd (diff) | |
download | blackbird-op-linux-795e74f7a69f9c08afa4fa7c86cc4f18a62bd630.tar.gz blackbird-op-linux-795e74f7a69f9c08afa4fa7c86cc4f18a62bd630.zip |
Merge branch 'iommu/largepages' into amd-iommu/2.6.35
Conflicts:
arch/x86/kernel/amd_iommu.c
Diffstat (limited to 'arch/x86/include/asm')
-rw-r--r-- | arch/x86/include/asm/amd_iommu_types.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/arch/x86/include/asm/amd_iommu_types.h b/arch/x86/include/asm/amd_iommu_types.h index 86a0ff0aeac7..7014e88bc779 100644 --- a/arch/x86/include/asm/amd_iommu_types.h +++ b/arch/x86/include/asm/amd_iommu_types.h @@ -174,6 +174,40 @@ (~((1ULL << (12 + ((lvl) * 9))) - 1))) #define PM_ALIGNED(lvl, addr) ((PM_MAP_MASK(lvl) & (addr)) == (addr)) +/* + * Returns the page table level to use for a given page size + * Pagesize is expected to be a power-of-two + */ +#define PAGE_SIZE_LEVEL(pagesize) \ + ((__ffs(pagesize) - 12) / 9) +/* + * Returns the number of ptes to use for a given page size + * Pagesize is expected to be a power-of-two + */ +#define PAGE_SIZE_PTE_COUNT(pagesize) \ + (1ULL << ((__ffs(pagesize) - 12) % 9)) + +/* + * Aligns a given io-virtual address to a given page size + * Pagesize is expected to be a power-of-two + */ +#define PAGE_SIZE_ALIGN(address, pagesize) \ + ((address) & ~((pagesize) - 1)) +/* + * Creates an IOMMU PTE for an address an a given pagesize + * The PTE has no permission bits set + * Pagesize is expected to be a power-of-two larger than 4096 + */ +#define PAGE_SIZE_PTE(address, pagesize) \ + (((address) | ((pagesize) - 1)) & \ + (~(pagesize >> 1)) & PM_ADDR_MASK) + +/* + * Takes a PTE value with mode=0x07 and returns the page size it maps + */ +#define PTE_PAGE_SIZE(pte) \ + (1ULL << (1 + ffz(((pte) | 0xfffULL)))) + #define IOMMU_PTE_P (1ULL << 0) #define IOMMU_PTE_TV (1ULL << 1) #define IOMMU_PTE_U (1ULL << 59) |