Skip to content

Commit

Permalink
Merge branch 'amd-iommu/2.6.35' of git://git.kernel.org/pub/scm/linux…
Browse files Browse the repository at this point in the history
…/kernel/git/joro/linux-2.6-iommu into x86/urgent
  • Loading branch information
Ingo Molnar committed Jun 1, 2010
2 parents e565813 + d7f0776 commit c8fcb14
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
16 changes: 9 additions & 7 deletions arch/x86/kernel/amd_iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1487,6 +1487,7 @@ static int __attach_device(struct device *dev,
struct protection_domain *domain)
{
struct iommu_dev_data *dev_data, *alias_data;
int ret;

dev_data = get_dev_data(dev);
alias_data = get_dev_data(dev_data->alias);
Expand All @@ -1498,13 +1499,14 @@ static int __attach_device(struct device *dev,
spin_lock(&domain->lock);

/* Some sanity checks */
ret = -EBUSY;
if (alias_data->domain != NULL &&
alias_data->domain != domain)
return -EBUSY;
goto out_unlock;

if (dev_data->domain != NULL &&
dev_data->domain != domain)
return -EBUSY;
goto out_unlock;

/* Do real assignment */
if (dev_data->alias != dev) {
Expand All @@ -1520,10 +1522,14 @@ static int __attach_device(struct device *dev,

atomic_inc(&dev_data->bind);

ret = 0;

out_unlock:

/* ready */
spin_unlock(&domain->lock);

return 0;
return ret;
}

/*
Expand Down Expand Up @@ -2324,10 +2330,6 @@ int __init amd_iommu_init_dma_ops(void)

iommu_detected = 1;
swiotlb = 0;
#ifdef CONFIG_GART_IOMMU
gart_iommu_aperture_disabled = 1;
gart_iommu_aperture = 0;
#endif

/* Make the driver finally visible to the drivers */
dma_ops = &amd_iommu_dma_ops;
Expand Down
20 changes: 17 additions & 3 deletions arch/x86/kernel/amd_iommu_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,12 @@ static u8 * __init iommu_map_mmio_space(u64 address)
{
u8 *ret;

if (!request_mem_region(address, MMIO_REGION_LENGTH, "amd_iommu"))
if (!request_mem_region(address, MMIO_REGION_LENGTH, "amd_iommu")) {
pr_err("AMD-Vi: Can not reserve memory region %llx for mmio\n",
address);
pr_err("AMD-Vi: This is a BIOS bug. Please contact your hardware vendor\n");
return NULL;
}

ret = ioremap_nocache(address, MMIO_REGION_LENGTH);
if (ret != NULL)
Expand Down Expand Up @@ -1314,7 +1318,7 @@ static int __init amd_iommu_init(void)
ret = amd_iommu_init_dma_ops();

if (ret)
goto free;
goto free_disable;

amd_iommu_init_api();

Expand All @@ -1332,9 +1336,10 @@ static int __init amd_iommu_init(void)
out:
return ret;

free:
free_disable:
disable_iommus();

free:
amd_iommu_uninit_devices();

free_pages((unsigned long)amd_iommu_pd_alloc_bitmap,
Expand All @@ -1353,6 +1358,15 @@ static int __init amd_iommu_init(void)

free_unity_maps();

#ifdef CONFIG_GART_IOMMU
/*
* We failed to initialize the AMD IOMMU - try fallback to GART
* if possible.
*/
gart_iommu_init();

#endif

goto out;
}

Expand Down

0 comments on commit c8fcb14

Please sign in to comment.