Skip to content

Commit

Permalink
Merge tag 'iommu-fixes-v3.5-rc5' of git://git.kernel.org/pub/scm/linu…
Browse files Browse the repository at this point in the history
…x/kernel/git/joro/iommu

Pull IOMMU fixes from Joerg Roedel:
 "The patches fix several issues in the AMD IOMMU driver, the NVidia
  SMMU driver, and the DMA debug code.

  The most important fix for the AMD IOMMU solves a problem with SR-IOV
  devices where virtual functions did not work with IOMMU enabled.  The
  NVidia SMMU patch fixes a possible sleep while spin-lock situation
  (queued the small fix for v3.5, a better but more intrusive fix is
  coming for v3.6).  The DMA debug patches fix a possible data
  corruption issue due to bool vs u32 usage."

* tag 'iommu-fixes-v3.5-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
  iommu/amd: fix type bug in flush code
  dma-debug: debugfs_create_bool() takes a u32 pointer
  iommu/tegra: smmu: Fix unsleepable memory allocation
  iommu/amd: Initialize dma_ops for hotplug and sriov devices
  iommu/amd: Fix missing iommu_shutdown initialization in passthrough mode
  • Loading branch information
torvalds committed Jul 9, 2012
2 parents 8c84bf4 + 3775d48 commit 17fae1c
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 9 deletions.
11 changes: 10 additions & 1 deletion drivers/iommu/amd_iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ static struct iommu_ops amd_iommu_ops;
static ATOMIC_NOTIFIER_HEAD(ppr_notifier);
int amd_iommu_max_glx_val = -1;

static struct dma_map_ops amd_iommu_dma_ops;

/*
* general struct to manage commands send to an IOMMU
*/
Expand Down Expand Up @@ -402,7 +404,7 @@ static void amd_iommu_stats_init(void)
return;

de_fflush = debugfs_create_bool("fullflush", 0444, stats_dir,
(u32 *)&amd_iommu_unmap_flush);
&amd_iommu_unmap_flush);

amd_iommu_stats_add(&compl_wait);
amd_iommu_stats_add(&cnt_map_single);
Expand Down Expand Up @@ -2267,6 +2269,13 @@ static int device_change_notifier(struct notifier_block *nb,
list_add_tail(&dma_domain->list, &iommu_pd_list);
spin_unlock_irqrestore(&iommu_pd_list_lock, flags);

dev_data = get_dev_data(dev);

if (!dev_data->passthrough)
dev->archdata.dma_ops = &amd_iommu_dma_ops;
else
dev->archdata.dma_ops = &nommu_dma_ops;

break;
case BUS_NOTIFY_DEL_DEVICE:

Expand Down
6 changes: 3 additions & 3 deletions drivers/iommu/amd_iommu_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ u16 amd_iommu_last_bdf; /* largest PCI device id we have
to handle */
LIST_HEAD(amd_iommu_unity_map); /* a list of required unity mappings
we find in ACPI */
bool amd_iommu_unmap_flush; /* if true, flush on every unmap */
u32 amd_iommu_unmap_flush; /* if true, flush on every unmap */

LIST_HEAD(amd_iommu_list); /* list of all AMD IOMMUs in the
system */
Expand Down Expand Up @@ -1641,6 +1641,8 @@ static int __init amd_iommu_init(void)

amd_iommu_init_api();

x86_platform.iommu_shutdown = disable_iommus;

if (iommu_pass_through)
goto out;

Expand All @@ -1649,8 +1651,6 @@ static int __init amd_iommu_init(void)
else
printk(KERN_INFO "AMD-Vi: Lazy IO/TLB flushing enabled\n");

x86_platform.iommu_shutdown = disable_iommus;

out:
return ret;

Expand Down
2 changes: 1 addition & 1 deletion drivers/iommu/amd_iommu_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ extern unsigned long *amd_iommu_pd_alloc_bitmap;
* If true, the addresses will be flushed on unmap time, not when
* they are reused
*/
extern bool amd_iommu_unmap_flush;
extern u32 amd_iommu_unmap_flush;

/* Smallest number of PASIDs supported by any IOMMU in the system */
extern u32 amd_iommu_max_pasids;
Expand Down
4 changes: 2 additions & 2 deletions drivers/iommu/tegra-smmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -550,13 +550,13 @@ static int alloc_pdir(struct smmu_as *as)
return 0;

as->pte_count = devm_kzalloc(smmu->dev,
sizeof(as->pte_count[0]) * SMMU_PDIR_COUNT, GFP_KERNEL);
sizeof(as->pte_count[0]) * SMMU_PDIR_COUNT, GFP_ATOMIC);
if (!as->pte_count) {
dev_err(smmu->dev,
"failed to allocate smmu_device PTE cunters\n");
return -ENOMEM;
}
as->pdir_page = alloc_page(GFP_KERNEL | __GFP_DMA);
as->pdir_page = alloc_page(GFP_ATOMIC | __GFP_DMA);
if (!as->pdir_page) {
dev_err(smmu->dev,
"failed to allocate smmu_device page directory\n");
Expand Down
4 changes: 2 additions & 2 deletions lib/dma-debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ static LIST_HEAD(free_entries);
static DEFINE_SPINLOCK(free_entries_lock);

/* Global disable flag - will be set in case of an error */
static bool global_disable __read_mostly;
static u32 global_disable __read_mostly;

/* Global error count */
static u32 error_count;
Expand Down Expand Up @@ -657,7 +657,7 @@ static int dma_debug_fs_init(void)

global_disable_dent = debugfs_create_bool("disabled", 0444,
dma_debug_dent,
(u32 *)&global_disable);
&global_disable);
if (!global_disable_dent)
goto out_err;

Expand Down

0 comments on commit 17fae1c

Please sign in to comment.