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
Kirill Smelkov
linux
Commits
9dcb3bd6
Commit
9dcb3bd6
authored
Jan 05, 2004
by
Dave Jones
Committed by
Dave Jones
Jan 05, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CPUFREQ] on P4s no TSC adjustment is necessary
From Dominik Brodowski
parent
c33ccf2d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
8 deletions
+27
-8
arch/i386/kernel/timers/timer_tsc.c
arch/i386/kernel/timers/timer_tsc.c
+27
-8
No files found.
arch/i386/kernel/timers/timer_tsc.c
View file @
9dcb3bd6
...
@@ -306,9 +306,17 @@ static void mark_offset_tsc_hpet(void)
...
@@ -306,9 +306,17 @@ static void mark_offset_tsc_hpet(void)
}
}
#endif
#endif
#ifdef CONFIG_CPU_FREQ
#ifdef CONFIG_CPU_FREQ
/* If the CPU frequency is scaled, TSC-based delays will need a different
* loops_per_jiffy value to function properly. An exception to this
* are modern Intel Pentium 4 processors, where the TSC runs at a constant
* speed independent of frequency scaling.
*/
static
unsigned
int
ref_freq
=
0
;
static
unsigned
int
ref_freq
=
0
;
static
unsigned
long
loops_per_jiffy_ref
=
0
;
static
unsigned
long
loops_per_jiffy_ref
=
0
;
static
unsigned
int
variable_tsc
=
1
;
#ifndef CONFIG_SMP
#ifndef CONFIG_SMP
static
unsigned
long
fast_gettimeoffset_ref
=
0
;
static
unsigned
long
fast_gettimeoffset_ref
=
0
;
...
@@ -333,12 +341,15 @@ time_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
...
@@ -333,12 +341,15 @@ time_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
if
((
val
==
CPUFREQ_PRECHANGE
&&
freq
->
old
<
freq
->
new
)
||
if
((
val
==
CPUFREQ_PRECHANGE
&&
freq
->
old
<
freq
->
new
)
||
(
val
==
CPUFREQ_POSTCHANGE
&&
freq
->
old
>
freq
->
new
))
{
(
val
==
CPUFREQ_POSTCHANGE
&&
freq
->
old
>
freq
->
new
))
{
cpu_data
[
freq
->
cpu
].
loops_per_jiffy
=
cpufreq_scale
(
loops_per_jiffy_ref
,
ref_freq
,
freq
->
new
);
if
(
variable_tsc
)
cpu_data
[
freq
->
cpu
].
loops_per_jiffy
=
cpufreq_scale
(
loops_per_jiffy_ref
,
ref_freq
,
freq
->
new
);
#ifndef CONFIG_SMP
#ifndef CONFIG_SMP
if
(
use_tsc
)
{
if
(
use_tsc
)
{
fast_gettimeoffset_quotient
=
cpufreq_scale
(
fast_gettimeoffset_ref
,
freq
->
new
,
ref_freq
);
cpu_khz
=
cpufreq_scale
(
cpu_khz_ref
,
ref_freq
,
freq
->
new
);
cpu_khz
=
cpufreq_scale
(
cpu_khz_ref
,
ref_freq
,
freq
->
new
);
set_cyc2ns_scale
(
cpu_khz
/
1000
);
if
(
variable_tsc
)
{
fast_gettimeoffset_quotient
=
cpufreq_scale
(
fast_gettimeoffset_ref
,
freq
->
new
,
ref_freq
);
set_cyc2ns_scale
(
cpu_khz
/
1000
);
}
}
}
#endif
#endif
}
}
...
@@ -350,7 +361,19 @@ time_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
...
@@ -350,7 +361,19 @@ time_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
static
struct
notifier_block
time_cpufreq_notifier_block
=
{
static
struct
notifier_block
time_cpufreq_notifier_block
=
{
.
notifier_call
=
time_cpufreq_notifier
.
notifier_call
=
time_cpufreq_notifier
};
};
#endif
static
int
__init
cpufreq_tsc
(
void
)
{
/* P4 and above CPU TSC freq doesn't change when CPU frequency changes*/
if
((
boot_cpu_data
.
x86
>=
15
)
&&
(
boot_cpu_data
.
x86_vendor
==
X86_VENDOR_INTEL
))
variable_tsc
=
0
;
return
cpufreq_register_notifier
(
&
time_cpufreq_notifier_block
,
CPUFREQ_TRANSITION_NOTIFIER
);
}
core_initcall
(
cpufreq_tsc
);
#endif
static
int
__init
init_tsc
(
char
*
override
)
static
int
__init
init_tsc
(
char
*
override
)
...
@@ -392,10 +415,6 @@ static int __init init_tsc(char* override)
...
@@ -392,10 +415,6 @@ static int __init init_tsc(char* override)
* some CPU's have a TSC. Thats never worked and nobody has
* some CPU's have a TSC. Thats never worked and nobody has
* moaned if you have the only one in the world - you fix it!
* moaned if you have the only one in the world - you fix it!
*/
*/
#ifdef CONFIG_CPU_FREQ
cpufreq_register_notifier
(
&
time_cpufreq_notifier_block
,
CPUFREQ_TRANSITION_NOTIFIER
);
#endif
count2
=
LATCH
;
/* initialize counter for mark_offset_tsc() */
count2
=
LATCH
;
/* initialize counter for mark_offset_tsc() */
...
...
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