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
5052f525
Commit
5052f525
authored
Apr 08, 2009
by
David S. Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sparc64: Refactor MDESC cpu scanning code using an iterator.
Signed-off-by:
David S. Miller
<
davem@davemloft.net
>
parent
9bab5414
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
90 additions
and
57 deletions
+90
-57
arch/sparc/include/asm/mdesc.h
arch/sparc/include/asm/mdesc.h
+1
-0
arch/sparc/kernel/mdesc.c
arch/sparc/kernel/mdesc.c
+89
-57
No files found.
arch/sparc/include/asm/mdesc.h
View file @
5052f525
...
...
@@ -72,6 +72,7 @@ struct mdesc_notifier_client {
extern
void
mdesc_register_notifier
(
struct
mdesc_notifier_client
*
client
);
extern
void
mdesc_fill_in_cpu_data
(
cpumask_t
mask
);
extern
void
mdesc_populate_present_mask
(
cpumask_t
*
mask
);
extern
void
sun4v_mdesc_init
(
void
);
...
...
arch/sparc/kernel/mdesc.c
View file @
5052f525
...
...
@@ -574,7 +574,7 @@ static void __init report_platform_properties(void)
mdesc_release
(
hp
);
}
static
void
__
dev
init
fill_in_one_cache
(
cpuinfo_sparc
*
c
,
static
void
__
cpu
init
fill_in_one_cache
(
cpuinfo_sparc
*
c
,
struct
mdesc_handle
*
hp
,
u64
mp
)
{
...
...
@@ -619,8 +619,7 @@ static void __devinit fill_in_one_cache(cpuinfo_sparc *c,
}
}
static
void
__devinit
mark_core_ids
(
struct
mdesc_handle
*
hp
,
u64
mp
,
int
core_id
)
static
void
__cpuinit
mark_core_ids
(
struct
mdesc_handle
*
hp
,
u64
mp
,
int
core_id
)
{
u64
a
;
...
...
@@ -653,7 +652,7 @@ static void __devinit mark_core_ids(struct mdesc_handle *hp, u64 mp,
}
}
static
void
__
dev
init
set_core_ids
(
struct
mdesc_handle
*
hp
)
static
void
__
cpu
init
set_core_ids
(
struct
mdesc_handle
*
hp
)
{
int
idx
;
u64
mp
;
...
...
@@ -678,8 +677,7 @@ static void __devinit set_core_ids(struct mdesc_handle *hp)
}
}
static
void
__devinit
mark_proc_ids
(
struct
mdesc_handle
*
hp
,
u64
mp
,
int
proc_id
)
static
void
__cpuinit
mark_proc_ids
(
struct
mdesc_handle
*
hp
,
u64
mp
,
int
proc_id
)
{
u64
a
;
...
...
@@ -698,8 +696,7 @@ static void __devinit mark_proc_ids(struct mdesc_handle *hp, u64 mp,
}
}
static
void
__devinit
__set_proc_ids
(
struct
mdesc_handle
*
hp
,
const
char
*
exec_unit_name
)
static
void
__cpuinit
__set_proc_ids
(
struct
mdesc_handle
*
hp
,
const
char
*
exec_unit_name
)
{
int
idx
;
u64
mp
;
...
...
@@ -720,13 +717,13 @@ static void __devinit __set_proc_ids(struct mdesc_handle *hp,
}
}
static
void
__
dev
init
set_proc_ids
(
struct
mdesc_handle
*
hp
)
static
void
__
cpu
init
set_proc_ids
(
struct
mdesc_handle
*
hp
)
{
__set_proc_ids
(
hp
,
"exec_unit"
);
__set_proc_ids
(
hp
,
"exec-unit"
);
}
static
void
__
dev
init
get_one_mondo_bits
(
const
u64
*
p
,
unsigned
int
*
mask
,
static
void
__
cpu
init
get_one_mondo_bits
(
const
u64
*
p
,
unsigned
int
*
mask
,
unsigned
char
def
)
{
u64
val
;
...
...
@@ -745,7 +742,7 @@ static void __devinit get_one_mondo_bits(const u64 *p, unsigned int *mask,
*
mask
=
((
1U
<<
def
)
*
64U
)
-
1U
;
}
static
void
__
dev
init
get_mondo_data
(
struct
mdesc_handle
*
hp
,
u64
mp
,
static
void
__
cpu
init
get_mondo_data
(
struct
mdesc_handle
*
hp
,
u64
mp
,
struct
trap_per_cpu
*
tb
)
{
const
u64
*
val
;
...
...
@@ -763,23 +760,15 @@ static void __devinit get_mondo_data(struct mdesc_handle *hp, u64 mp,
get_one_mondo_bits
(
val
,
&
tb
->
nonresum_qmask
,
2
);
}
void
__cpuinit
mdesc_fill_in_cpu_data
(
cpumask_t
mask
)
static
void
*
__cpuinit
mdesc_iterate_over_cpus
(
void
*
(
*
func
)(
struct
mdesc_handle
*
,
u64
,
int
,
void
*
),
void
*
arg
,
cpumask_t
*
mask
)
{
struct
mdesc_handle
*
hp
=
mdesc_grab
();
void
*
ret
=
NULL
;
u64
mp
;
ncpus_probed
=
0
;
mdesc_for_each_node_by_name
(
hp
,
mp
,
"cpu"
)
{
const
u64
*
id
=
mdesc_get_property
(
hp
,
mp
,
"id"
,
NULL
);
const
u64
*
cfreq
=
mdesc_get_property
(
hp
,
mp
,
"clock-frequency"
,
NULL
);
struct
trap_per_cpu
*
tb
;
cpuinfo_sparc
*
c
;
int
cpuid
;
u64
a
;
ncpus_probed
++
;
cpuid
=
*
id
;
int
cpuid
=
*
id
;
#ifdef CONFIG_SMP
if
(
cpuid
>=
NR_CPUS
)
{
...
...
@@ -788,62 +777,105 @@ void __cpuinit mdesc_fill_in_cpu_data(cpumask_t mask)
cpuid
,
NR_CPUS
);
continue
;
}
if
(
!
cpu_isset
(
cpuid
,
mask
))
continue
;
#else
/* On uniprocessor we only want the values for the
* real physical cpu the kernel booted onto, however
* cpu_data() only has one entry at index 0.
*/
if
(
cpuid
!=
real_hard_smp_processor_id
())
if
(
!
cpu_isset
(
cpuid
,
*
mask
))
continue
;
cpuid
=
0
;
#endif
c
=
&
cpu_data
(
cpuid
);
c
->
clock_tick
=
*
cfreq
;
ret
=
func
(
hp
,
mp
,
cpuid
,
arg
);
if
(
ret
)
goto
out
;
}
out:
mdesc_release
(
hp
);
return
ret
;
}
tb
=
&
trap_block
[
cpuid
];
get_mondo_data
(
hp
,
mp
,
tb
);
static
void
*
__cpuinit
record_one_cpu
(
struct
mdesc_handle
*
hp
,
u64
mp
,
int
cpuid
,
void
*
arg
)
{
ncpus_probed
++
;
#ifdef CONFIG_SMP
set_cpu_present
(
cpuid
,
true
);
#endif
return
NULL
;
}
mdesc_for_each_arc
(
a
,
hp
,
mp
,
MDESC_ARC_TYPE_FWD
)
{
u64
j
,
t
=
mdesc_arc_target
(
hp
,
a
);
const
char
*
t_name
;
void
__cpuinit
mdesc_populate_present_mask
(
cpumask_t
*
mask
)
{
if
(
tlb_type
!=
hypervisor
)
return
;
t_name
=
mdesc_node_name
(
hp
,
t
);
if
(
!
strcmp
(
t_name
,
"cache"
))
{
fill_in_one_cache
(
c
,
hp
,
t
);
continue
;
}
ncpus_probed
=
0
;
mdesc_iterate_over_cpus
(
record_one_cpu
,
NULL
,
mask
);
}
mdesc_for_each_arc
(
j
,
hp
,
t
,
MDESC_ARC_TYPE_FWD
)
{
u64
n
=
mdesc_arc_target
(
hp
,
j
);
const
char
*
n_name
;
static
void
*
__cpuinit
fill_in_one_cpu
(
struct
mdesc_handle
*
hp
,
u64
mp
,
int
cpuid
,
void
*
arg
)
{
const
u64
*
cfreq
=
mdesc_get_property
(
hp
,
mp
,
"clock-frequency"
,
NULL
);
struct
trap_per_cpu
*
tb
;
cpuinfo_sparc
*
c
;
u64
a
;
n_name
=
mdesc_node_name
(
hp
,
n
);
if
(
!
strcmp
(
n_name
,
"cache"
))
fill_in_one_cache
(
c
,
hp
,
n
);
}
#ifndef CONFIG_SMP
/* On uniprocessor we only want the values for the
* real physical cpu the kernel booted onto, however
* cpu_data() only has one entry at index 0.
*/
if
(
cpuid
!=
real_hard_smp_processor_id
())
return
NULL
;
cpuid
=
0
;
#endif
c
=
&
cpu_data
(
cpuid
);
c
->
clock_tick
=
*
cfreq
;
tb
=
&
trap_block
[
cpuid
];
get_mondo_data
(
hp
,
mp
,
tb
);
mdesc_for_each_arc
(
a
,
hp
,
mp
,
MDESC_ARC_TYPE_FWD
)
{
u64
j
,
t
=
mdesc_arc_target
(
hp
,
a
);
const
char
*
t_name
;
t_name
=
mdesc_node_name
(
hp
,
t
);
if
(
!
strcmp
(
t_name
,
"cache"
))
{
fill_in_one_cache
(
c
,
hp
,
t
);
continue
;
}
#ifdef CONFIG_SMP
cpu_set
(
cpuid
,
cpu_present_map
);
#endif
mdesc_for_each_arc
(
j
,
hp
,
t
,
MDESC_ARC_TYPE_FWD
)
{
u64
n
=
mdesc_arc_target
(
hp
,
j
);
const
char
*
n_name
;
c
->
core_id
=
0
;
c
->
proc_id
=
-
1
;
n_name
=
mdesc_node_name
(
hp
,
n
);
if
(
!
strcmp
(
n_name
,
"cache"
))
fill_in_one_cache
(
c
,
hp
,
n
);
}
}
c
->
core_id
=
0
;
c
->
proc_id
=
-
1
;
return
NULL
;
}
void
__cpuinit
mdesc_fill_in_cpu_data
(
cpumask_t
mask
)
{
struct
mdesc_handle
*
hp
;
mdesc_populate_present_mask
(
&
mask
);
mdesc_iterate_over_cpus
(
fill_in_one_cpu
,
NULL
,
&
mask
);
#ifdef CONFIG_SMP
sparc64_multi_core
=
1
;
#endif
hp
=
mdesc_grab
();
set_core_ids
(
hp
);
set_proc_ids
(
hp
);
smp_fill_in_sib_core_maps
();
mdesc_release
(
hp
);
smp_fill_in_sib_core_maps
();
}
static
ssize_t
mdesc_read
(
struct
file
*
file
,
char
__user
*
buf
,
...
...
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