Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci
Commits
8ad200d7
Commit
8ad200d7
authored
Nov 04, 2005
by
Paul Mackerras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
powerpc: Merge smp-tbsync.c (the generic timebase sync routine)
Signed-off-by:
Paul Mackerras
<
paulus@samba.org
>
parent
d3ab57eb
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
65 additions
and
65 deletions
+65
-65
arch/powerpc/Kconfig
arch/powerpc/Kconfig
+7
-0
arch/powerpc/kernel/Makefile
arch/powerpc/kernel/Makefile
+1
-0
arch/powerpc/kernel/smp-tbsync.c
arch/powerpc/kernel/smp-tbsync.c
+52
-60
arch/ppc64/Kconfig
arch/ppc64/Kconfig
+5
-0
arch/ppc64/kernel/Makefile
arch/ppc64/kernel/Makefile
+0
-5
No files found.
arch/powerpc/Kconfig
View file @
8ad200d7
...
@@ -300,6 +300,7 @@ config PPC_PMAC64
...
@@ -300,6 +300,7 @@ config PPC_PMAC64
bool
bool
depends on PPC_PMAC && POWER4
depends on PPC_PMAC && POWER4
select U3_DART
select U3_DART
select GENERIC_TBSYNC
default y
default y
config PPC_PREP
config PPC_PREP
...
@@ -314,6 +315,7 @@ config PPC_MAPLE
...
@@ -314,6 +315,7 @@ config PPC_MAPLE
bool " Maple 970FX Evaluation Board"
bool " Maple 970FX Evaluation Board"
select U3_DART
select U3_DART
select MPIC_BROKEN_U3
select MPIC_BROKEN_U3
select GENERIC_TBSYNC
default n
default n
help
help
This option enables support for the Maple 970FX Evaluation Board.
This option enables support for the Maple 970FX Evaluation Board.
...
@@ -386,6 +388,11 @@ config PPC_MPC106
...
@@ -386,6 +388,11 @@ config PPC_MPC106
bool
bool
default n
default n
config GENERIC_TBSYNC
bool
default y if CONFIG_PPC32 && CONFIG_SMP
default n
source "drivers/cpufreq/Kconfig"
source "drivers/cpufreq/Kconfig"
config CPU_FREQ_PMAC
config CPU_FREQ_PMAC
...
...
arch/powerpc/kernel/Makefile
View file @
8ad200d7
...
@@ -21,6 +21,7 @@ obj-$(CONFIG_PPC_RTAS) += rtas.o
...
@@ -21,6 +21,7 @@ obj-$(CONFIG_PPC_RTAS) += rtas.o
obj-$(CONFIG_RTAS_FLASH)
+=
rtas_flash.o
obj-$(CONFIG_RTAS_FLASH)
+=
rtas_flash.o
obj-$(CONFIG_RTAS_PROC)
+=
rtas-proc.o
obj-$(CONFIG_RTAS_PROC)
+=
rtas-proc.o
obj-$(CONFIG_IBMVIO)
+=
vio.o
obj-$(CONFIG_IBMVIO)
+=
vio.o
obj-$(CONFIG_GENERIC_TBSYNC)
+=
smp-tbsync.o
ifeq
($(CONFIG_PPC_MERGE),y)
ifeq
($(CONFIG_PPC_MERGE),y)
...
...
arch/p
pc64
/kernel/smp-tbsync.c
→
arch/p
owerpc
/kernel/smp-tbsync.c
View file @
8ad200d7
...
@@ -22,11 +22,11 @@ enum {
...
@@ -22,11 +22,11 @@ enum {
};
};
static
struct
{
static
struct
{
volatile
long
tb
;
volatile
u64
tb
;
volatile
long
mark
;
volatile
u64
mark
;
volatile
int
cmd
;
volatile
int
cmd
;
volatile
int
handshake
;
volatile
int
handshake
;
int
filler
[
3
];
int
filler
[
2
];
volatile
int
ack
;
volatile
int
ack
;
int
filler2
[
7
];
int
filler2
[
7
];
...
@@ -36,89 +36,80 @@ static struct {
...
@@ -36,89 +36,80 @@ static struct {
static
volatile
int
running
;
static
volatile
int
running
;
static
void
__devinit
static
void
__devinit
enter_contest
(
u64
mark
,
long
add
)
enter_contest
(
long
mark
,
long
add
)
{
{
while
(
(
long
)(
mftb
()
-
mark
)
<
0
)
while
(
get_tb
()
<
mark
)
tbsync
->
race_result
=
add
;
tbsync
->
race_result
=
add
;
}
}
void
__devinit
void
__devinit
smp_generic_take_timebase
(
void
)
smp_generic_take_timebase
(
void
)
{
{
int
cmd
;
int
cmd
;
long
tb
;
u64
tb
;
local_irq_disable
();
local_irq_disable
();
while
(
!
running
)
while
(
!
running
)
;
barrier
()
;
rmb
();
rmb
();
for
(
;;
)
{
for
(;;
)
{
tbsync
->
ack
=
1
;
tbsync
->
ack
=
1
;
while
(
!
tbsync
->
handshake
)
while
(
!
tbsync
->
handshake
)
;
barrier
()
;
rmb
();
rmb
();
cmd
=
tbsync
->
cmd
;
cmd
=
tbsync
->
cmd
;
tb
=
tbsync
->
tb
;
tb
=
tbsync
->
tb
;
mb
();
tbsync
->
ack
=
0
;
tbsync
->
ack
=
0
;
if
(
cmd
==
kExit
)
if
(
cmd
==
kExit
)
return
;
break
;
if
(
cmd
==
kSetAndTest
)
{
while
(
tbsync
->
handshake
)
while
(
tbsync
->
handshake
)
barrier
();
;
if
(
cmd
==
kSetAndTest
)
asm
volatile
(
"mttbl %0"
::
"r"
(
tb
&
0xfffffffful
)
);
set_tb
(
tb
>>
32
,
tb
&
0xfffffffful
);
asm
volatile
(
"mttbu %0"
::
"r"
(
tb
>>
32
)
);
enter_contest
(
tbsync
->
mark
,
-
1
);
}
else
{
while
(
tbsync
->
handshake
)
;
}
enter_contest
(
tbsync
->
mark
,
-
1
);
}
}
local_irq_enable
();
local_irq_enable
();
}
}
static
int
__devinit
static
int
__devinit
start_contest
(
int
cmd
,
long
offset
,
int
num
)
start_contest
(
int
cmd
,
long
offset
,
long
num
)
{
{
int
i
,
score
=
0
;
int
i
,
score
=
0
;
long
tb
,
mark
;
u64
tb
;
long
mark
;
tbsync
->
cmd
=
cmd
;
tbsync
->
cmd
=
cmd
;
local_irq_disable
();
local_irq_disable
();
for
(
i
=-
3
;
i
<
num
;
)
{
for
(
i
=
-
3
;
i
<
num
;
)
{
tb
=
(
long
)
mf
tb
()
+
400
;
tb
=
get_
tb
()
+
400
;
tbsync
->
tb
=
tb
+
offset
;
tbsync
->
tb
=
tb
+
offset
;
tbsync
->
mark
=
mark
=
tb
+
400
;
tbsync
->
mark
=
mark
=
tb
+
400
;
wmb
();
wmb
();
tbsync
->
handshake
=
1
;
tbsync
->
handshake
=
1
;
while
(
tbsync
->
ack
)
while
(
tbsync
->
ack
)
;
barrier
()
;
while
(
(
long
)(
mftb
()
-
tb
)
<=
0
)
while
(
get_tb
()
<=
tb
)
;
barrier
()
;
tbsync
->
handshake
=
0
;
tbsync
->
handshake
=
0
;
enter_contest
(
mark
,
1
);
enter_contest
(
mark
,
1
);
while
(
!
tbsync
->
ack
)
while
(
!
tbsync
->
ack
)
;
barrier
()
;
if
((
tbsync
->
tb
^
(
long
)
mftb
())
&
0x8000000000000000ul
)
if
(
i
++
>
0
)
continue
;
if
(
i
++
>
0
)
score
+=
tbsync
->
race_result
;
score
+=
tbsync
->
race_result
;
}
}
local_irq_enable
();
local_irq_enable
();
return
score
;
return
score
;
}
}
void
__devinit
void
__devinit
smp_generic_give_timebase
(
void
)
smp_generic_give_timebase
(
void
)
{
{
int
i
,
score
,
score2
,
old
,
min
=
0
,
max
=
5000
,
offset
=
1000
;
int
i
,
score
,
score2
,
old
,
min
=
0
,
max
=
5000
,
offset
=
1000
;
...
@@ -130,14 +121,14 @@ smp_generic_give_timebase( void )
...
@@ -130,14 +121,14 @@ smp_generic_give_timebase( void )
mb
();
mb
();
running
=
1
;
running
=
1
;
while
(
!
tbsync
->
ack
)
while
(
!
tbsync
->
ack
)
;
barrier
()
;
printk
(
"Got ack
\n
"
);
printk
(
"Got ack
\n
"
);
/* binary search */
/* binary search */
for
(
old
=-
1
;
old
!=
offset
;
offset
=
(
min
+
max
)
/
2
)
{
for
(
old
=
-
1
;
old
!=
offset
;
offset
=
(
min
+
max
)
/
2
)
{
score
=
start_contest
(
kSetAndTest
,
offset
,
NUM_ITER
);
score
=
start_contest
(
kSetAndTest
,
offset
,
NUM_ITER
);
printk
(
"score %d, offset %d
\n
"
,
score
,
offset
);
printk
(
"score %d, offset %d
\n
"
,
score
,
offset
);
...
@@ -147,21 +138,22 @@ smp_generic_give_timebase( void )
...
@@ -147,21 +138,22 @@ smp_generic_give_timebase( void )
min
=
offset
;
min
=
offset
;
old
=
offset
;
old
=
offset
;
}
}
score
=
start_contest
(
kSetAndTest
,
min
,
NUM_ITER
);
score
=
start_contest
(
kSetAndTest
,
min
,
NUM_ITER
);
score2
=
start_contest
(
kSetAndTest
,
max
,
NUM_ITER
);
score2
=
start_contest
(
kSetAndTest
,
max
,
NUM_ITER
);
printk
(
"Min %d (score %d), Max %d (score %d)
\n
"
,
min
,
score
,
max
,
score2
);
printk
(
"Min %d (score %d), Max %d (score %d)
\n
"
,
score
=
abs
(
score
);
min
,
score
,
max
,
score2
);
score2
=
abs
(
score2
);
score
=
abs
(
score
);
score2
=
abs
(
score2
);
offset
=
(
score
<
score2
)
?
min
:
max
;
offset
=
(
score
<
score2
)
?
min
:
max
;
/* guard against inaccurate mttb */
/* guard against inaccurate mttb */
for
(
i
=
0
;
i
<
10
;
i
++
)
{
for
(
i
=
0
;
i
<
10
;
i
++
)
{
start_contest
(
kSetAndTest
,
offset
,
NUM_ITER
/
10
);
start_contest
(
kSetAndTest
,
offset
,
NUM_ITER
/
10
);
if
(
(
score2
=
start_contest
(
kTest
,
offset
,
NUM_ITER
))
<
0
)
if
((
score2
=
start_contest
(
kTest
,
offset
,
NUM_ITER
))
<
0
)
score2
=
-
score2
;
score2
=
-
score2
;
if
(
score2
<=
score
||
score2
<
20
)
if
(
score2
<=
score
||
score2
<
20
)
break
;
break
;
}
}
printk
(
"Final offset: %d (%d/%d)
\n
"
,
offset
,
score2
,
NUM_ITER
);
printk
(
"Final offset: %d (%d/%d)
\n
"
,
offset
,
score2
,
NUM_ITER
);
...
@@ -170,10 +162,10 @@ smp_generic_give_timebase( void )
...
@@ -170,10 +162,10 @@ smp_generic_give_timebase( void )
tbsync
->
cmd
=
kExit
;
tbsync
->
cmd
=
kExit
;
wmb
();
wmb
();
tbsync
->
handshake
=
1
;
tbsync
->
handshake
=
1
;
while
(
tbsync
->
ack
)
while
(
tbsync
->
ack
)
;
barrier
()
;
tbsync
->
handshake
=
0
;
tbsync
->
handshake
=
0
;
kfree
(
tbsync
);
kfree
(
tbsync
);
tbsync
=
NULL
;
tbsync
=
NULL
;
running
=
0
;
running
=
0
;
}
}
arch/ppc64/Kconfig
View file @
8ad200d7
...
@@ -89,12 +89,14 @@ config PPC_PMAC
...
@@ -89,12 +89,14 @@ config PPC_PMAC
bool " Apple G5 based machines"
bool " Apple G5 based machines"
default y
default y
select U3_DART
select U3_DART
select GENERIC_TBSYNC
config PPC_MAPLE
config PPC_MAPLE
depends on PPC_MULTIPLATFORM
depends on PPC_MULTIPLATFORM
bool " Maple 970FX Evaluation Board"
bool " Maple 970FX Evaluation Board"
select U3_DART
select U3_DART
select MPIC_BROKEN_U3
select MPIC_BROKEN_U3
select GENERIC_TBSYNC
default n
default n
help
help
This option enables support for the Maple 970FX Evaluation Board.
This option enables support for the Maple 970FX Evaluation Board.
...
@@ -182,6 +184,9 @@ config MPIC_BROKEN_U3
...
@@ -182,6 +184,9 @@ config MPIC_BROKEN_U3
depends on PPC_MAPLE
depends on PPC_MAPLE
default y
default y
config GENERIC_TBSYNC
def_bool n
config PPC_PMAC64
config PPC_PMAC64
bool
bool
depends on PPC_PMAC
depends on PPC_PMAC
...
...
arch/ppc64/kernel/Makefile
View file @
8ad200d7
...
@@ -51,11 +51,6 @@ obj-$(CONFIG_PPC_PMAC) += udbg_scc.o
...
@@ -51,11 +51,6 @@ obj-$(CONFIG_PPC_PMAC) += udbg_scc.o
obj-$(CONFIG_PPC_MAPLE)
+=
udbg_16550.o
obj-$(CONFIG_PPC_MAPLE)
+=
udbg_16550.o
ifdef
CONFIG_SMP
obj-$(CONFIG_PPC_PMAC)
+=
smp-tbsync.o
obj-$(CONFIG_PPC_MAPLE)
+=
smp-tbsync.o
endif
obj-$(CONFIG_KPROBES)
+=
kprobes.o
obj-$(CONFIG_KPROBES)
+=
kprobes.o
CFLAGS_ioctl32.o
+=
-Ifs
/
CFLAGS_ioctl32.o
+=
-Ifs
/
...
...
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