summaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/amd_iommu.c
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2009-09-02 15:38:40 +0200
committerJoerg Roedel <joerg.roedel@amd.com>2009-09-03 16:03:46 +0200
commit50020fb6324465e478d6c8cdbf3c695f0a60358d (patch)
tree42f46535b247d54bb2282fa1a61b1cba4d8a6ac0 /arch/x86/kernel/amd_iommu.c
parent04bfdd8406099fca2e6b8844748c4d6c5eba8c8d (diff)
downloadkernel-crypto-50020fb6324465e478d6c8cdbf3c695f0a60358d.tar.gz
kernel-crypto-50020fb6324465e478d6c8cdbf3c695f0a60358d.tar.xz
kernel-crypto-50020fb6324465e478d6c8cdbf3c695f0a60358d.zip
x86/amd-iommu: Introduce increase_address_space function
This function will be used to increase the address space size of a protection domain. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Diffstat (limited to 'arch/x86/kernel/amd_iommu.c')
-rw-r--r--arch/x86/kernel/amd_iommu.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
index 5eab6a84b9c..fc97b51f028 100644
--- a/arch/x86/kernel/amd_iommu.c
+++ b/arch/x86/kernel/amd_iommu.c
@@ -1325,6 +1325,33 @@ static void update_domain(struct protection_domain *domain)
}
/*
+ * This function is used to add another level to an IO page table. Adding
+ * another level increases the size of the address space by 9 bits to a size up
+ * to 64 bits.
+ */
+static bool increase_address_space(struct protection_domain *domain,
+ gfp_t gfp)
+{
+ u64 *pte;
+
+ if (domain->mode == PAGE_MODE_6_LEVEL)
+ /* address space already 64 bit large */
+ return false;
+
+ pte = (void *)get_zeroed_page(gfp);
+ if (!pte)
+ return false;
+
+ *pte = PM_LEVEL_PDE(domain->mode,
+ virt_to_phys(domain->pt_root));
+ domain->pt_root = pte;
+ domain->mode += 1;
+ domain->updated = true;
+
+ return true;
+}
+
+/*
* If the pte_page is not yet allocated this function is called
*/
static u64* alloc_pte(struct protection_domain *dom,