Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
d3e65dbb
Commit
d3e65dbb
authored
Aug 02, 2002
by
Anton Blanchard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ppc64: rwsem updates from ppc32 and synchronize_irq fix from x86
parent
4e5adcc1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
11 deletions
+45
-11
arch/ppc64/kernel/i8259.c
arch/ppc64/kernel/i8259.c
+2
-1
arch/ppc64/kernel/irq.c
arch/ppc64/kernel/irq.c
+4
-9
include/asm-ppc64/rwsem.h
include/asm-ppc64/rwsem.h
+39
-1
No files found.
arch/ppc64/kernel/i8259.c
View file @
d3e65dbb
...
@@ -123,7 +123,8 @@ static void i8259_unmask_irq(unsigned int irq_nr)
...
@@ -123,7 +123,8 @@ static void i8259_unmask_irq(unsigned int irq_nr)
static
void
i8259_end_irq
(
unsigned
int
irq
)
static
void
i8259_end_irq
(
unsigned
int
irq
)
{
{
if
(
!
(
irq_desc
[
irq
].
status
&
(
IRQ_DISABLED
|
IRQ_INPROGRESS
)))
if
(
!
(
irq_desc
[
irq
].
status
&
(
IRQ_DISABLED
|
IRQ_INPROGRESS
))
&&
irq_desc
[
irq
].
action
)
i8259_unmask_irq
(
irq
);
i8259_unmask_irq
(
irq
);
}
}
...
...
arch/ppc64/kernel/irq.c
View file @
d3e65dbb
...
@@ -169,10 +169,6 @@ setup_irq(unsigned int irq, struct irqaction * new)
...
@@ -169,10 +169,6 @@ setup_irq(unsigned int irq, struct irqaction * new)
inline
void
synchronize_irq
(
unsigned
int
irq
)
inline
void
synchronize_irq
(
unsigned
int
irq
)
{
{
/* is there anything to synchronize with? */
if
(
!
irq_desc
[
irq
].
action
)
return
;
while
(
irq_desc
[
irq
].
status
&
IRQ_INPROGRESS
)
while
(
irq_desc
[
irq
].
status
&
IRQ_INPROGRESS
)
cpu_relax
();
cpu_relax
();
}
}
...
@@ -502,7 +498,7 @@ void ppc_irq_dispatch_handler(struct pt_regs *regs, int irq)
...
@@ -502,7 +498,7 @@ void ppc_irq_dispatch_handler(struct pt_regs *regs, int irq)
* use the action we have.
* use the action we have.
*/
*/
action
=
NULL
;
action
=
NULL
;
if
(
!
(
status
&
(
IRQ_DISABLED
|
IRQ_INPROGRESS
)))
{
if
(
likely
(
!
(
status
&
(
IRQ_DISABLED
|
IRQ_INPROGRESS
)
)))
{
action
=
desc
->
action
;
action
=
desc
->
action
;
if
(
!
action
||
!
action
->
handler
)
{
if
(
!
action
||
!
action
->
handler
)
{
ppc_spurious_interrupts
++
;
ppc_spurious_interrupts
++
;
...
@@ -529,10 +525,9 @@ void ppc_irq_dispatch_handler(struct pt_regs *regs, int irq)
...
@@ -529,10 +525,9 @@ void ppc_irq_dispatch_handler(struct pt_regs *regs, int irq)
a different instance of this same irq, the other processor
a different instance of this same irq, the other processor
will take care of it.
will take care of it.
*/
*/
if
(
!
action
)
if
(
unlikely
(
!
action
)
)
goto
out
;
goto
out
;
/*
/*
* Edge triggered interrupts need to remember
* Edge triggered interrupts need to remember
* pending events.
* pending events.
...
@@ -548,12 +543,12 @@ void ppc_irq_dispatch_handler(struct pt_regs *regs, int irq)
...
@@ -548,12 +543,12 @@ void ppc_irq_dispatch_handler(struct pt_regs *regs, int irq)
handle_irq_event
(
irq
,
regs
,
action
);
handle_irq_event
(
irq
,
regs
,
action
);
spin_lock
(
&
desc
->
lock
);
spin_lock
(
&
desc
->
lock
);
if
(
!
(
desc
->
status
&
IRQ_PENDING
))
if
(
likely
(
!
(
desc
->
status
&
IRQ_PENDING
)
))
break
;
break
;
desc
->
status
&=
~
IRQ_PENDING
;
desc
->
status
&=
~
IRQ_PENDING
;
}
}
desc
->
status
&=
~
IRQ_INPROGRESS
;
out:
out:
desc
->
status
&=
~
IRQ_INPROGRESS
;
/*
/*
* The ->end() handler has to deal with interrupts which got
* The ->end() handler has to deal with interrupts which got
* disabled while the handler was running.
* disabled while the handler was running.
...
...
include/asm-ppc64/rwsem.h
View file @
d3e65dbb
...
@@ -57,6 +57,7 @@ struct rw_semaphore {
...
@@ -57,6 +57,7 @@ struct rw_semaphore {
extern
struct
rw_semaphore
*
rwsem_down_read_failed
(
struct
rw_semaphore
*
sem
);
extern
struct
rw_semaphore
*
rwsem_down_read_failed
(
struct
rw_semaphore
*
sem
);
extern
struct
rw_semaphore
*
rwsem_down_write_failed
(
struct
rw_semaphore
*
sem
);
extern
struct
rw_semaphore
*
rwsem_down_write_failed
(
struct
rw_semaphore
*
sem
);
extern
struct
rw_semaphore
*
rwsem_wake
(
struct
rw_semaphore
*
sem
);
extern
struct
rw_semaphore
*
rwsem_wake
(
struct
rw_semaphore
*
sem
);
extern
struct
rw_semaphore
*
rwsem_downgrade_wake
(
struct
rw_semaphore
*
sem
);
static
inline
void
init_rwsem
(
struct
rw_semaphore
*
sem
)
static
inline
void
init_rwsem
(
struct
rw_semaphore
*
sem
)
{
{
...
@@ -73,12 +74,26 @@ static inline void init_rwsem(struct rw_semaphore *sem)
...
@@ -73,12 +74,26 @@ static inline void init_rwsem(struct rw_semaphore *sem)
*/
*/
static
inline
void
__down_read
(
struct
rw_semaphore
*
sem
)
static
inline
void
__down_read
(
struct
rw_semaphore
*
sem
)
{
{
if
(
atomic_inc_return
((
atomic_t
*
)(
&
sem
->
count
))
>
=
0
)
if
(
atomic_inc_return
((
atomic_t
*
)(
&
sem
->
count
))
>
0
)
smp_wmb
();
smp_wmb
();
else
else
rwsem_down_read_failed
(
sem
);
rwsem_down_read_failed
(
sem
);
}
}
static
inline
int
__down_read_trylock
(
struct
rw_semaphore
*
sem
)
{
int
tmp
;
while
((
tmp
=
sem
->
count
)
>=
0
)
{
if
(
tmp
==
cmpxchg
(
&
sem
->
count
,
tmp
,
tmp
+
RWSEM_ACTIVE_READ_BIAS
))
{
smp_wmb
();
return
1
;
}
}
return
0
;
}
/*
/*
* lock for writing
* lock for writing
*/
*/
...
@@ -94,6 +109,16 @@ static inline void __down_write(struct rw_semaphore *sem)
...
@@ -94,6 +109,16 @@ static inline void __down_write(struct rw_semaphore *sem)
rwsem_down_write_failed
(
sem
);
rwsem_down_write_failed
(
sem
);
}
}
static
inline
int
__down_write_trylock
(
struct
rw_semaphore
*
sem
)
{
int
tmp
;
tmp
=
cmpxchg
(
&
sem
->
count
,
RWSEM_UNLOCKED_VALUE
,
RWSEM_ACTIVE_WRITE_BIAS
);
smp_wmb
();
return
tmp
==
RWSEM_UNLOCKED_VALUE
;
}
/*
/*
* unlock after reading
* unlock after reading
*/
*/
...
@@ -126,6 +151,19 @@ static inline void rwsem_atomic_add(int delta, struct rw_semaphore *sem)
...
@@ -126,6 +151,19 @@ static inline void rwsem_atomic_add(int delta, struct rw_semaphore *sem)
atomic_add
(
delta
,
(
atomic_t
*
)(
&
sem
->
count
));
atomic_add
(
delta
,
(
atomic_t
*
)(
&
sem
->
count
));
}
}
/*
* downgrade write lock to read lock
*/
static
inline
void
__downgrade_write
(
struct
rw_semaphore
*
sem
)
{
int
tmp
;
smp_wmb
();
tmp
=
atomic_add_return
(
-
RWSEM_WAITING_BIAS
,
(
atomic_t
*
)(
&
sem
->
count
));
if
(
tmp
<
0
)
rwsem_downgrade_wake
(
sem
);
}
/*
/*
* implement exchange and add functionality
* implement exchange and add functionality
*/
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment