Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 330384
b: refs/heads/master
c: d900bd7
h: refs/heads/master
v: v3
  • Loading branch information
Anton Blanchard authored and Benjamin Herrenschmidt committed Oct 4, 2012
1 parent 1847ada commit e4d8b47
Show file tree
Hide file tree
Showing 3 changed files with 17 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: c8adfeccee01ce3de6a7d14fcd4e3be02e27f03c
refs/heads/master: d900bd7366463fd96a907b2c212242e2b68b27d8
5 changes: 4 additions & 1 deletion trunk/arch/powerpc/kernel/iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ static unsigned long iommu_range_alloc(struct device *dev,
spin_lock_irqsave(&(pool->lock), flags);

again:
if ((pass == 0) && handle && *handle)
if ((pass == 0) && handle && *handle &&
(*handle >= pool->start) && (*handle < pool->end))
start = *handle;
else
start = pool->hint;
Expand All @@ -236,7 +237,9 @@ static unsigned long iommu_range_alloc(struct device *dev,
* but on second pass, start at 0 in pool 0.
*/
if ((start & mask) >= limit || pass > 0) {
spin_unlock(&(pool->lock));
pool = &(tbl->pools[0]);
spin_lock(&(pool->lock));
start = pool->start;
} else {
start &= mask;
Expand Down
12 changes: 12 additions & 0 deletions trunk/arch/powerpc/sysdev/dart_iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,16 @@ static int dart_is_u4;

#define DBG(...)

static DEFINE_SPINLOCK(invalidate_lock);

static inline void dart_tlb_invalidate_all(void)
{
unsigned long l = 0;
unsigned int reg, inv_bit;
unsigned long limit;
unsigned long flags;

spin_lock_irqsave(&invalidate_lock, flags);

DBG("dart: flush\n");

Expand Down Expand Up @@ -110,12 +115,17 @@ static inline void dart_tlb_invalidate_all(void)
panic("DART: TLB did not flush after waiting a long "
"time. Buggy U3 ?");
}

spin_unlock_irqrestore(&invalidate_lock, flags);
}

static inline void dart_tlb_invalidate_one(unsigned long bus_rpn)
{
unsigned int reg;
unsigned int l, limit;
unsigned long flags;

spin_lock_irqsave(&invalidate_lock, flags);

reg = DART_CNTL_U4_ENABLE | DART_CNTL_U4_IONE |
(bus_rpn & DART_CNTL_U4_IONE_MASK);
Expand All @@ -137,6 +147,8 @@ static inline void dart_tlb_invalidate_one(unsigned long bus_rpn)
panic("DART: TLB did not flush after waiting a long "
"time. Buggy U4 ?");
}

spin_unlock_irqrestore(&invalidate_lock, flags);
}

static void dart_flush(struct iommu_table *tbl)
Expand Down

0 comments on commit e4d8b47

Please sign in to comment.