lkml.org 
[lkml]   [2008]   [Dec]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 14/21] AMD IOMMU: add domain init function for IOMMU API
    Date
    Impact: add a generic function for allocation protection domains

    Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
    ---
    arch/x86/kernel/amd_iommu.c | 28 ++++++++++++++++++++++++++++
    1 files changed, 28 insertions(+), 0 deletions(-)

    diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
    index 26b929b..cb7db66 100644
    --- a/arch/x86/kernel/amd_iommu.c
    +++ b/arch/x86/kernel/amd_iommu.c
    @@ -22,6 +22,7 @@
    #include <linux/bitops.h>
    #include <linux/scatterlist.h>
    #include <linux/iommu-helper.h>
    +#include <linux/iommu.h>
    #include <asm/proto.h>
    #include <asm/iommu.h>
    #include <asm/amd_iommu_types.h>
    @@ -1524,3 +1525,30 @@ static void cleanup_domain(struct protection_domain *domain)

    write_unlock_irqrestore(&amd_iommu_devtable_lock, flags);
    }
    +
    +static int amd_iommu_domain_init(struct iommu_domain *dom)
    +{
    + struct protection_domain *domain;
    +
    + domain = kzalloc(sizeof(*domain), GFP_KERNEL);
    + if (!domain)
    + return -ENOMEM;
    +
    + spin_lock_init(&domain->lock);
    + domain->mode = PAGE_MODE_3_LEVEL;
    + domain->id = domain_id_alloc();
    + if (!domain->id)
    + goto out_free;
    + domain->pt_root = (void *)get_zeroed_page(GFP_KERNEL);
    + if (!domain->pt_root)
    + goto out_free;
    +
    + dom->priv = domain;
    +
    + return 0;
    +
    +out_free:
    + kfree(domain);
    +
    + return -ENOMEM;
    +}
    --
    1.5.6.4



    \
     
     \ /
      Last update: 2008-12-09 15:31    [W:0.036 / U:0.008 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site