Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 104319
b: refs/heads/master
c: 136f78a
h: refs/heads/master
i:
  104317: 3713013
  104315: 80e3c04
  104311: 04642b0
  104303: b5f4327
  104287: 35bf520
  104255: 540f138
  104191: 48eb185
v: v3
  • Loading branch information
Joerg Roedel authored and Ingo Molnar committed Jul 11, 2008
1 parent 5875e75 commit 3e92157
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 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: 9a836de0c9944c42d006ec241712c72e74737c73
refs/heads/master: 136f78a19cf94d469f31a4009c7c0ac2301fbbf0
10 changes: 9 additions & 1 deletion trunk/arch/x86/kernel/amd_iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
#define to_pages(addr, size) \
(round_up(((addr) & ~PAGE_MASK) + (size), PAGE_SIZE) >> PAGE_SHIFT)

#define EXIT_LOOP_COUNT 10000000

static DEFINE_RWLOCK(amd_iommu_devtable_lock);

/*
Expand Down Expand Up @@ -106,6 +108,7 @@ static int iommu_completion_wait(struct amd_iommu *iommu)
struct command cmd;
volatile u64 ready = 0;
unsigned long ready_phys = virt_to_phys(&ready);
unsigned long i = 0;

memset(&cmd, 0, sizeof(cmd));
cmd.data[0] = LOW_U32(ready_phys) | CMD_COMPL_WAIT_STORE_MASK;
Expand All @@ -120,8 +123,13 @@ static int iommu_completion_wait(struct amd_iommu *iommu)
if (ret)
return ret;

while (!ready)
while (!ready && (i < EXIT_LOOP_COUNT)) {
++i;
cpu_relax();
}

if (unlikely((i == EXIT_LOOP_COUNT) && printk_ratelimit()))
printk(KERN_WARNING "AMD IOMMU: Completion wait loop failed\n");

return 0;
}
Expand Down

0 comments on commit 3e92157

Please sign in to comment.