Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 24283
b: refs/heads/master
c: b06be91
h: refs/heads/master
i:
  24281: 05b52a7
  24279: b4c9e2e
v: v3
  • Loading branch information
Shaohua Li authored and Linus Torvalds committed Mar 27, 2006
1 parent c3cc1d1 commit 9d6b606
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 29 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0806903316d516a3b3851c51cea5c71724d9051d
refs/heads/master: b06be912a3ad68c69dba0ed6e92723140020e392
69 changes: 41 additions & 28 deletions trunk/arch/i386/kernel/cpu/intel_cacheinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,19 @@ unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c)
}
}
}
if (c->cpuid_level > 1) {
/*
* Don't use cpuid2 if cpuid4 is supported. For P4, we use cpuid2 for
* trace cache
*/
if ((num_cache_leaves == 0 || c->x86 == 15) && c->cpuid_level > 1) {
/* supports eax=2 call */
int i, j, n;
int regs[4];
unsigned char *dp = (unsigned char *)regs;
int only_trace = 0;

if (num_cache_leaves != 0 && c->x86 == 15)
only_trace = 1;

/* Number of times to iterate */
n = cpuid_eax(2) & 0xFF;
Expand All @@ -251,6 +259,8 @@ unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c)
while (cache_table[k].descriptor != 0)
{
if (cache_table[k].descriptor == des) {
if (only_trace && cache_table[k].cache_type != LVL_TRACE)
break;
switch (cache_table[k].cache_type) {
case LVL_1_INST:
l1i += cache_table[k].size;
Expand All @@ -276,43 +286,46 @@ unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c)
}
}
}
}

if (new_l1d)
l1d = new_l1d;
if (new_l1d)
l1d = new_l1d;

if (new_l1i)
l1i = new_l1i;
if (new_l1i)
l1i = new_l1i;

if (new_l2) {
l2 = new_l2;
if (new_l2) {
l2 = new_l2;
#ifdef CONFIG_SMP
cpu_llc_id[cpu] = l2_id;
cpu_llc_id[cpu] = l2_id;
#endif
}
}

if (new_l3) {
l3 = new_l3;
if (new_l3) {
l3 = new_l3;
#ifdef CONFIG_SMP
cpu_llc_id[cpu] = l3_id;
cpu_llc_id[cpu] = l3_id;
#endif
}

if ( trace )
printk (KERN_INFO "CPU: Trace cache: %dK uops", trace);
else if ( l1i )
printk (KERN_INFO "CPU: L1 I cache: %dK", l1i);
if ( l1d )
printk(", L1 D cache: %dK\n", l1d);
else
printk("\n");
if ( l2 )
printk(KERN_INFO "CPU: L2 cache: %dK\n", l2);
if ( l3 )
printk(KERN_INFO "CPU: L3 cache: %dK\n", l3);

c->x86_cache_size = l3 ? l3 : (l2 ? l2 : (l1i+l1d));
}

if (trace)
printk (KERN_INFO "CPU: Trace cache: %dK uops", trace);
else if ( l1i )
printk (KERN_INFO "CPU: L1 I cache: %dK", l1i);

if (l1d)
printk(", L1 D cache: %dK\n", l1d);
else
printk("\n");

if (l2)
printk(KERN_INFO "CPU: L2 cache: %dK\n", l2);

if (l3)
printk(KERN_INFO "CPU: L3 cache: %dK\n", l3);

c->x86_cache_size = l3 ? l3 : (l2 ? l2 : (l1i+l1d));

return l2;
}

Expand Down

0 comments on commit 9d6b606

Please sign in to comment.