Skip to content

Commit 37cfc3f

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next: sparc32: remove unused file: include/asm/pgtsun4.h sparc32: fix PAGE_SIZE definition sparc32: enable different preemptions models sparc32: support atomic64_t apbuart: fix section mismatch warning sparc32: drop useless preprocessor conditional in atomic_32.h sparc32: drop unused atomic24 support
2 parents 38e5781 + 6e4d177 commit 37cfc3f

8 files changed

Lines changed: 8 additions & 347 deletions

File tree

‎arch/sparc/Kconfig‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ config SPARC
3131

3232
config SPARC32
3333
def_bool !64BIT
34+
select GENERIC_ATOMIC64
3435

3536
config SPARC64
3637
def_bool 64BIT
@@ -383,9 +384,7 @@ config SCHED_MC
383384
making when dealing with multi-core CPU chips at a cost of slightly
384385
increased overhead in some places. If unsure say N here.
385386

386-
if SPARC64
387387
source "kernel/Kconfig.preempt"
388-
endif
389388

390389
config CMDLINE_BOOL
391390
bool "Default bootloader kernel arguments"

‎arch/sparc/include/asm/atomic_32.h‎

Lines changed: 1 addition & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
#include <linux/types.h>
1515

16-
#ifdef __KERNEL__
16+
#include <asm-generic/atomic64.h>
1717

1818
#include <asm/system.h>
1919

@@ -52,112 +52,10 @@ extern void atomic_set(atomic_t *, int);
5252
#define atomic_dec_and_test(v) (atomic_dec_return(v) == 0)
5353
#define atomic_sub_and_test(i, v) (atomic_sub_return(i, v) == 0)
5454

55-
56-
/* This is the old 24-bit implementation. It's still used internally
57-
* by some sparc-specific code, notably the semaphore implementation.
58-
*/
59-
typedef struct { volatile int counter; } atomic24_t;
60-
61-
#ifndef CONFIG_SMP
62-
63-
#define ATOMIC24_INIT(i) { (i) }
64-
#define atomic24_read(v) ((v)->counter)
65-
#define atomic24_set(v, i) (((v)->counter) = i)
66-
67-
#else
68-
/* We do the bulk of the actual work out of line in two common
69-
* routines in assembler, see arch/sparc/lib/atomic.S for the
70-
* "fun" details.
71-
*
72-
* For SMP the trick is you embed the spin lock byte within
73-
* the word, use the low byte so signedness is easily retained
74-
* via a quick arithmetic shift. It looks like this:
75-
*
76-
* ----------------------------------------
77-
* | signed 24-bit counter value | lock | atomic_t
78-
* ----------------------------------------
79-
* 31 8 7 0
80-
*/
81-
82-
#define ATOMIC24_INIT(i) { ((i) << 8) }
83-
84-
static inline int atomic24_read(const atomic24_t *v)
85-
{
86-
int ret = v->counter;
87-
88-
while(ret & 0xff)
89-
ret = v->counter;
90-
91-
return ret >> 8;
92-
}
93-
94-
#define atomic24_set(v, i) (((v)->counter) = ((i) << 8))
95-
#endif
96-
97-
static inline int __atomic24_add(int i, atomic24_t *v)
98-
{
99-
register volatile int *ptr asm("g1");
100-
register int increment asm("g2");
101-
register int tmp1 asm("g3");
102-
register int tmp2 asm("g4");
103-
register int tmp3 asm("g7");
104-
105-
ptr = &v->counter;
106-
increment = i;
107-
108-
__asm__ __volatile__(
109-
"mov %%o7, %%g4\n\t"
110-
"call ___atomic24_add\n\t"
111-
" add %%o7, 8, %%o7\n"
112-
: "=&r" (increment), "=r" (tmp1), "=r" (tmp2), "=r" (tmp3)
113-
: "0" (increment), "r" (ptr)
114-
: "memory", "cc");
115-
116-
return increment;
117-
}
118-
119-
static inline int __atomic24_sub(int i, atomic24_t *v)
120-
{
121-
register volatile int *ptr asm("g1");
122-
register int increment asm("g2");
123-
register int tmp1 asm("g3");
124-
register int tmp2 asm("g4");
125-
register int tmp3 asm("g7");
126-
127-
ptr = &v->counter;
128-
increment = i;
129-
130-
__asm__ __volatile__(
131-
"mov %%o7, %%g4\n\t"
132-
"call ___atomic24_sub\n\t"
133-
" add %%o7, 8, %%o7\n"
134-
: "=&r" (increment), "=r" (tmp1), "=r" (tmp2), "=r" (tmp3)
135-
: "0" (increment), "r" (ptr)
136-
: "memory", "cc");
137-
138-
return increment;
139-
}
140-
141-
#define atomic24_add(i, v) ((void)__atomic24_add((i), (v)))
142-
#define atomic24_sub(i, v) ((void)__atomic24_sub((i), (v)))
143-
144-
#define atomic24_dec_return(v) __atomic24_sub(1, (v))
145-
#define atomic24_inc_return(v) __atomic24_add(1, (v))
146-
147-
#define atomic24_sub_and_test(i, v) (__atomic24_sub((i), (v)) == 0)
148-
#define atomic24_dec_and_test(v) (__atomic24_sub(1, (v)) == 0)
149-
150-
#define atomic24_inc(v) ((void)__atomic24_add(1, (v)))
151-
#define atomic24_dec(v) ((void)__atomic24_sub(1, (v)))
152-
153-
#define atomic24_add_negative(i, v) (__atomic24_add((i), (v)) < 0)
154-
15555
/* Atomic operations are already serializing */
15656
#define smp_mb__before_atomic_dec() barrier()
15757
#define smp_mb__after_atomic_dec() barrier()
15858
#define smp_mb__before_atomic_inc() barrier()
15959
#define smp_mb__after_atomic_inc() barrier()
16060

161-
#endif /* !(__KERNEL__) */
162-
16361
#endif /* !(__ARCH_SPARC_ATOMIC__) */

‎arch/sparc/include/asm/page_32.h‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,10 @@
88
#ifndef _SPARC_PAGE_H
99
#define _SPARC_PAGE_H
1010

11-
#define PAGE_SHIFT 12
11+
#include <linux/const.h>
1212

13-
#ifndef __ASSEMBLY__
14-
/* I have my suspicions... -DaveM */
15-
#define PAGE_SIZE (1UL << PAGE_SHIFT)
16-
#else
17-
#define PAGE_SIZE (1 << PAGE_SHIFT)
18-
#endif
13+
#define PAGE_SHIFT 12
14+
#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
1915
#define PAGE_MASK (~(PAGE_SIZE-1))
2016

2117
#include <asm/btfixup.h>

‎arch/sparc/include/asm/pgtsun4.h‎

Lines changed: 0 additions & 171 deletions
This file was deleted.

‎arch/sparc/include/asm/thread_info_32.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ BTFIXUPDEF_CALL(void, free_thread_info, struct thread_info *)
9595
* Observe the order of get_free_pages() in alloc_thread_info_node().
9696
* The sun4 has 8K stack too, because it's short on memory, and 16K is a waste.
9797
*/
98-
#define THREAD_SIZE 8192
98+
#define THREAD_SIZE (2 * PAGE_SIZE)
9999

100100
/*
101101
* Offsets in thread_info structure, used in assembly code

‎arch/sparc/lib/atomic_32.S‎

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -40,60 +40,5 @@ ___xchg32_sun4md:
4040
mov %g4, %o7
4141
#endif
4242

43-
/* Read asm-sparc/atomic.h carefully to understand how this works for SMP.
44-
* Really, some things here for SMP are overly clever, go read the header.
45-
*/
46-
.globl ___atomic24_add
47-
___atomic24_add:
48-
rd %psr, %g3 ! Keep the code small, old way was stupid
49-
nop; nop; nop; ! Let the bits set
50-
or %g3, PSR_PIL, %g7 ! Disable interrupts
51-
wr %g7, 0x0, %psr ! Set %psr
52-
nop; nop; nop; ! Let the bits set
53-
#ifdef CONFIG_SMP
54-
1: ldstub [%g1 + 3], %g7 ! Spin on the byte lock for SMP.
55-
orcc %g7, 0x0, %g0 ! Did we get it?
56-
bne 1b ! Nope...
57-
ld [%g1], %g7 ! Load locked atomic24_t
58-
sra %g7, 8, %g7 ! Get signed 24-bit integer
59-
add %g7, %g2, %g2 ! Add in argument
60-
sll %g2, 8, %g7 ! Transpose back to atomic24_t
61-
st %g7, [%g1] ! Clever: This releases the lock as well.
62-
#else
63-
ld [%g1], %g7 ! Load locked atomic24_t
64-
add %g7, %g2, %g2 ! Add in argument
65-
st %g2, [%g1] ! Store it back
66-
#endif
67-
wr %g3, 0x0, %psr ! Restore original PSR_PIL
68-
nop; nop; nop; ! Let the bits set
69-
jmpl %o7, %g0 ! NOTE: not + 8, see callers in atomic.h
70-
mov %g4, %o7 ! Restore %o7
71-
72-
.globl ___atomic24_sub
73-
___atomic24_sub:
74-
rd %psr, %g3 ! Keep the code small, old way was stupid
75-
nop; nop; nop; ! Let the bits set
76-
or %g3, PSR_PIL, %g7 ! Disable interrupts
77-
wr %g7, 0x0, %psr ! Set %psr
78-
nop; nop; nop; ! Let the bits set
79-
#ifdef CONFIG_SMP
80-
1: ldstub [%g1 + 3], %g7 ! Spin on the byte lock for SMP.
81-
orcc %g7, 0x0, %g0 ! Did we get it?
82-
bne 1b ! Nope...
83-
ld [%g1], %g7 ! Load locked atomic24_t
84-
sra %g7, 8, %g7 ! Get signed 24-bit integer
85-
sub %g7, %g2, %g2 ! Subtract argument
86-
sll %g2, 8, %g7 ! Transpose back to atomic24_t
87-
st %g7, [%g1] ! Clever: This releases the lock as well
88-
#else
89-
ld [%g1], %g7 ! Load locked atomic24_t
90-
sub %g7, %g2, %g2 ! Subtract argument
91-
st %g2, [%g1] ! Store it back
92-
#endif
93-
wr %g3, 0x0, %psr ! Restore original PSR_PIL
94-
nop; nop; nop; ! Let the bits set
95-
jmpl %o7, %g0 ! NOTE: not + 8, see callers in atomic.h
96-
mov %g4, %o7 ! Restore %o7
97-
9843
.globl __atomic_end
9944
__atomic_end:

0 commit comments

Comments
 (0)