Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
7a4983bb
cloud-kernel
项目概览
openanolis
/
cloud-kernel
接近 2 年 前同步成功
通知
170
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
7a4983bb
编写于
7月 21, 2008
作者:
I
Ingo Molnar
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
x86: L3 cache index disable for 2.6.26, cleanups
No change in functionality. Signed-off-by:
N
Ingo Molnar
<
mingo@elte.hu
>
上级
8cb22bcb
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
61 addition
and
54 deletion
+61
-54
arch/x86/kernel/cpu/intel_cacheinfo.c
arch/x86/kernel/cpu/intel_cacheinfo.c
+61
-54
未找到文件。
arch/x86/kernel/cpu/intel_cacheinfo.c
浏览文件 @
7a4983bb
...
@@ -253,14 +253,16 @@ static void __cpuinit amd_cpuid4(int leaf, union _cpuid4_leaf_eax *eax,
...
@@ -253,14 +253,16 @@ static void __cpuinit amd_cpuid4(int leaf, union _cpuid4_leaf_eax *eax,
(
ebx
->
split
.
ways_of_associativity
+
1
)
-
1
;
(
ebx
->
split
.
ways_of_associativity
+
1
)
-
1
;
}
}
static
void
__cpuinit
amd_check_l3_disable
(
int
index
,
struct
_cpuid4_info
*
this_leaf
)
static
void
__cpuinit
amd_check_l3_disable
(
int
index
,
struct
_cpuid4_info
*
this_leaf
)
{
{
if
(
index
<
3
)
if
(
index
<
3
)
return
;
return
;
this_leaf
->
can_disable
=
1
;
this_leaf
->
can_disable
=
1
;
}
}
static
int
__cpuinit
cpuid4_cache_lookup
(
int
index
,
struct
_cpuid4_info
*
this_leaf
)
static
int
__cpuinit
cpuid4_cache_lookup
(
int
index
,
struct
_cpuid4_info
*
this_leaf
)
{
{
union
_cpuid4_leaf_eax
eax
;
union
_cpuid4_leaf_eax
eax
;
union
_cpuid4_leaf_ebx
ebx
;
union
_cpuid4_leaf_ebx
ebx
;
...
@@ -271,19 +273,20 @@ static int __cpuinit cpuid4_cache_lookup(int index, struct _cpuid4_info *this_le
...
@@ -271,19 +273,20 @@ static int __cpuinit cpuid4_cache_lookup(int index, struct _cpuid4_info *this_le
amd_cpuid4
(
index
,
&
eax
,
&
ebx
,
&
ecx
);
amd_cpuid4
(
index
,
&
eax
,
&
ebx
,
&
ecx
);
if
(
boot_cpu_data
.
x86
>=
0x10
)
if
(
boot_cpu_data
.
x86
>=
0x10
)
amd_check_l3_disable
(
index
,
this_leaf
);
amd_check_l3_disable
(
index
,
this_leaf
);
}
else
{
}
else
cpuid_count
(
4
,
index
,
&
eax
.
full
,
&
ebx
.
full
,
&
ecx
.
full
,
&
edx
);
cpuid_count
(
4
,
index
,
&
eax
.
full
,
&
ebx
.
full
,
&
ecx
.
full
,
&
edx
);
}
if
(
eax
.
split
.
type
==
CACHE_TYPE_NULL
)
if
(
eax
.
split
.
type
==
CACHE_TYPE_NULL
)
return
-
EIO
;
/* better error ? */
return
-
EIO
;
/* better error ? */
this_leaf
->
eax
=
eax
;
this_leaf
->
eax
=
eax
;
this_leaf
->
ebx
=
ebx
;
this_leaf
->
ebx
=
ebx
;
this_leaf
->
ecx
=
ecx
;
this_leaf
->
ecx
=
ecx
;
this_leaf
->
size
=
(
ecx
.
split
.
number_of_sets
+
1
)
*
this_leaf
->
size
=
(
ecx
.
split
.
number_of_sets
+
1
)
*
(
ebx
.
split
.
coherency_line_size
+
1
)
*
(
ebx
.
split
.
coherency_line_size
+
1
)
*
(
ebx
.
split
.
physical_line_partition
+
1
)
*
(
ebx
.
split
.
physical_line_partition
+
1
)
*
(
ebx
.
split
.
ways_of_associativity
+
1
);
(
ebx
.
split
.
ways_of_associativity
+
1
);
return
0
;
return
0
;
}
}
...
@@ -649,59 +652,63 @@ static ssize_t show_type(struct _cpuid4_info *this_leaf, char *buf) {
...
@@ -649,59 +652,63 @@ static ssize_t show_type(struct _cpuid4_info *this_leaf, char *buf) {
}
}
}
}
#define to_object(k)
container_of(k, struct _index_kobject, kobj)
#define to_object(k)
container_of(k, struct _index_kobject, kobj)
#define to_attr(a)
container_of(a, struct _cache_attr, attr)
#define to_attr(a)
container_of(a, struct _cache_attr, attr)
static
ssize_t
show_cache_disable
(
struct
_cpuid4_info
*
this_leaf
,
char
*
buf
)
static
ssize_t
show_cache_disable
(
struct
_cpuid4_info
*
this_leaf
,
char
*
buf
)
{
{
struct
pci_dev
*
dev
;
int
node
=
cpu_to_node
(
first_cpu
(
this_leaf
->
shared_cpu_map
));
if
(
this_leaf
->
can_disable
)
{
struct
pci_dev
*
dev
=
k8_northbridges
[
node
];
int
i
;
ssize_t
ret
=
0
;
ssize_t
ret
=
0
;
int
i
;
int
node
=
cpu_to_node
(
first_cpu
(
this_leaf
->
shared_cpu_map
));
dev
=
k8_northbridges
[
node
];
for
(
i
=
0
;
i
<
2
;
i
++
)
{
unsigned
int
reg
;
pci_read_config_dword
(
dev
,
0x1BC
+
i
*
4
,
&
reg
);
ret
+=
sprintf
(
buf
,
"%sEntry: %d
\n
"
,
buf
,
i
);
ret
+=
sprintf
(
buf
,
"%sReads: %s
\t
New Entries: %s
\n
"
,
buf
,
reg
&
0x80000000
?
"Disabled"
:
"Allowed"
,
reg
&
0x40000000
?
"Disabled"
:
"Allowed"
);
ret
+=
sprintf
(
buf
,
"%sSubCache: %x
\t
Index: %x
\n
"
,
buf
,
(
reg
&
0x30000
)
>>
16
,
reg
&
0xfff
);
}
if
(
!
this_leaf
->
can_disable
)
return
ret
;
return
sprintf
(
buf
,
"Feature not enabled
\n
"
);
for
(
i
=
0
;
i
<
2
;
i
++
)
{
unsigned
int
reg
;
pci_read_config_dword
(
dev
,
0x1BC
+
i
*
4
,
&
reg
);
ret
+=
sprintf
(
buf
,
"%sEntry: %d
\n
"
,
buf
,
i
);
ret
+=
sprintf
(
buf
,
"%sReads: %s
\t
New Entries: %s
\n
"
,
buf
,
reg
&
0x80000000
?
"Disabled"
:
"Allowed"
,
reg
&
0x40000000
?
"Disabled"
:
"Allowed"
);
ret
+=
sprintf
(
buf
,
"%sSubCache: %x
\t
Index: %x
\n
"
,
buf
,
(
reg
&
0x30000
)
>>
16
,
reg
&
0xfff
);
}
}
return
sprintf
(
buf
,
"Feature not enabled
\n
"
)
;
return
ret
;
}
}
static
ssize_t
store_cache_disable
(
struct
_cpuid4_info
*
this_leaf
,
const
char
*
buf
,
size_t
count
)
static
ssize_t
store_cache_disable
(
struct
_cpuid4_info
*
this_leaf
,
const
char
*
buf
,
size_t
count
)
{
{
struct
pci_dev
*
dev
;
int
node
=
cpu_to_node
(
first_cpu
(
this_leaf
->
shared_cpu_map
));
if
(
this_leaf
->
can_disable
)
{
struct
pci_dev
*
dev
=
k8_northbridges
[
node
];
/* write the MSR value */
unsigned
int
ret
,
index
,
val
;
unsigned
int
ret
;
unsigned
int
index
,
val
;
if
(
!
this_leaf
->
can_disable
)
int
node
=
cpu_to_node
(
first_cpu
(
this_leaf
->
shared_cpu_map
));
return
0
;
dev
=
k8_northbridges
[
node
];
/* write the MSR value */
if
(
strlen
(
buf
)
>
15
)
return
-
EINVAL
;
if
(
strlen
(
buf
)
>
15
)
ret
=
sscanf
(
buf
,
"%x %x"
,
&
index
,
&
val
);
return
-
EINVAL
;
if
(
ret
!=
2
)
return
-
EINVAL
;
ret
=
sscanf
(
buf
,
"%x %x"
,
&
index
,
&
val
);
if
(
index
>
1
)
if
(
ret
!=
2
)
return
-
EINVAL
;
return
-
EINVAL
;
val
|=
0xc0000000
;
if
(
index
>
1
)
pci_write_config_dword
(
dev
,
0x1BC
+
index
*
4
,
val
&
~
0x40000000
);
return
-
EINVAL
;
wbinvd
();
pci_write_config_dword
(
dev
,
0x1BC
+
index
*
4
,
val
);
val
|=
0xc0000000
;
return
1
;
pci_write_config_dword
(
dev
,
0x1BC
+
index
*
4
,
val
&
~
0x40000000
);
}
wbinvd
();
return
0
;
pci_write_config_dword
(
dev
,
0x1BC
+
index
*
4
,
val
);
return
1
;
}
}
struct
_cache_attr
{
struct
_cache_attr
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录