Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 33749
b: refs/heads/master
c: 5a4e6dc
h: refs/heads/master
i:
  33747: bfddd54
v: v3
  • Loading branch information
Roland Dreier committed Sep 1, 2006
1 parent c0f443f commit a24db95
Show file tree
Hide file tree
Showing 14 changed files with 169 additions and 241 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: 0668b47205e42c04e9c1b594573be5a822ac7f09
refs/heads/master: 5a4e6dccbc0cd1b726820b782daebf887dcb95e9
33 changes: 16 additions & 17 deletions trunk/arch/s390/lib/uaccess.S
Original file line number Diff line number Diff line change
Expand Up @@ -88,31 +88,30 @@ __copy_to_user_asm:
.globl __copy_in_user_asm
# %r2 = from, %r3 = n, %r4 = to
__copy_in_user_asm:
ahi %r3,-1
jo 6f
sacf 256
bras %r1,4f
0: ahi %r3,257
1: mvc 0(1,%r4),0(%r2)
bras 1,1f
mvc 0(1,%r4),0(%r2)
0: mvc 0(256,%r4),0(%r2)
la %r2,256(%r2)
la %r4,256(%r4)
1: ahi %r3,-256
jnm 0b
2: ex %r3,0(%r1)
sacf 0
slr %r2,%r2
br 14
3: mvc 0(1,%r4),0(%r2)
la %r2,1(%r2)
la %r4,1(%r4)
ahi %r3,-1
jnz 1b
2: lr %r2,%r3
br %r14
3: mvc 0(256,%r4),0(%r2)
la %r2,256(%r2)
la %r4,256(%r4)
4: ahi %r3,-256
jnm 3b
5: ex %r3,4(%r1)
4: lr %r2,%r3
sacf 0
6: slr %r2,%r2
br %r14
.section __ex_table,"a"
.long 1b,2b
.long 3b,0b
.long 5b,0b
.long 0b,3b
.long 2b,3b
.long 3b,4b
.previous

.align 4
Expand Down
35 changes: 17 additions & 18 deletions trunk/arch/s390/lib/uaccess64.S
Original file line number Diff line number Diff line change
Expand Up @@ -88,31 +88,30 @@ __copy_to_user_asm:
.globl __copy_in_user_asm
# %r2 = from, %r3 = n, %r4 = to
__copy_in_user_asm:
aghi %r3,-1
jo 6f
sacf 256
bras %r1,4f
0: aghi %r3,257
1: mvc 0(1,%r4),0(%r2)
bras 1,1f
mvc 0(1,%r4),0(%r2)
0: mvc 0(256,%r4),0(%r2)
la %r2,256(%r2)
la %r4,256(%r4)
1: aghi %r3,-256
jnm 0b
2: ex %r3,0(%r1)
sacf 0
slgr %r2,%r2
br 14
3: mvc 0(1,%r4),0(%r2)
la %r2,1(%r2)
la %r4,1(%r4)
aghi %r3,-1
jnz 1b
2: lgr %r2,%r3
br %r14
3: mvc 0(256,%r4),0(%r2)
la %r2,256(%r2)
la %r4,256(%r4)
4: aghi %r3,-256
jnm 3b
5: ex %r3,4(%r1)
4: lgr %r2,%r3
sacf 0
6: slgr %r2,%r2
br 14
br %r14
.section __ex_table,"a"
.quad 1b,2b
.quad 3b,0b
.quad 5b,0b
.quad 0b,3b
.quad 2b,3b
.quad 3b,4b
.previous

.align 4
Expand Down
15 changes: 11 additions & 4 deletions trunk/drivers/infiniband/hw/mthca/mthca_allocator.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@
/* Trivial bitmap-based allocator */
u32 mthca_alloc(struct mthca_alloc *alloc)
{
unsigned long flags;
u32 obj;

spin_lock(&alloc->lock);
spin_lock_irqsave(&alloc->lock, flags);

obj = find_next_zero_bit(alloc->table, alloc->max, alloc->last);
if (obj >= alloc->max) {
alloc->top = (alloc->top + alloc->max) & alloc->mask;
Expand All @@ -56,19 +58,24 @@ u32 mthca_alloc(struct mthca_alloc *alloc)
} else
obj = -1;

spin_unlock(&alloc->lock);
spin_unlock_irqrestore(&alloc->lock, flags);

return obj;
}

void mthca_free(struct mthca_alloc *alloc, u32 obj)
{
unsigned long flags;

obj &= alloc->max - 1;
spin_lock(&alloc->lock);

spin_lock_irqsave(&alloc->lock, flags);

clear_bit(obj, alloc->table);
alloc->last = min(alloc->last, obj);
alloc->top = (alloc->top + alloc->max) & alloc->mask;
spin_unlock(&alloc->lock);

spin_unlock_irqrestore(&alloc->lock, flags);
}

int mthca_alloc_init(struct mthca_alloc *alloc, u32 num, u32 mask,
Expand Down
Loading

0 comments on commit a24db95

Please sign in to comment.