Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 158079
b: refs/heads/master
c: 2650815
h: refs/heads/master
i:
  158077: aaa9338
  158075: fc0e0e8
  158071: fc5f9a1
  158063: e615db8
  158047: 5291ca3
  158015: 3fdb908
  157951: d733e1b
v: v3
  • Loading branch information
Joerg Roedel committed Sep 3, 2009
1 parent 8dff954 commit b07a464
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ac0101d396fee24994632f71b55b9f7f9ee16eff
refs/heads/master: 2650815fb03fe2bf1e6701584087ba669dcf92cd
36 changes: 32 additions & 4 deletions trunk/arch/x86/kernel/amd_iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1988,19 +1988,47 @@ 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)
static void protection_domain_free(struct protection_domain *domain)
{
if (!domain)
return;

if (domain->id)
domain_id_free(domain->id);

kfree(domain);
}

static struct protection_domain *protection_domain_alloc(void)
{
struct protection_domain *domain;

domain = kzalloc(sizeof(*domain), GFP_KERNEL);
if (!domain)
return -ENOMEM;
return NULL;

spin_lock_init(&domain->lock);
domain->mode = PAGE_MODE_3_LEVEL;
domain->id = domain_id_alloc();
if (!domain->id)
goto out_err;

return domain;

out_err:
kfree(domain);

return NULL;
}

static int amd_iommu_domain_init(struct iommu_domain *dom)
{
struct protection_domain *domain;

domain = protection_domain_alloc();
if (!domain)
goto out_free;

domain->mode = PAGE_MODE_3_LEVEL;
domain->pt_root = (void *)get_zeroed_page(GFP_KERNEL);
if (!domain->pt_root)
goto out_free;
Expand All @@ -2010,7 +2038,7 @@ static int amd_iommu_domain_init(struct iommu_domain *dom)
return 0;

out_free:
kfree(domain);
protection_domain_free(domain);

return -ENOMEM;
}
Expand Down

0 comments on commit b07a464

Please sign in to comment.