Commit d16aafff authored by Siddha, Suresh B's avatar Siddha, Suresh B Committed by Linus Torvalds

[PATCH] intel_cacheinfo: remove MAX_CACHE_LEAVES limit

Initial internal version of Venki's cpuid(4) deterministic cache parameter
identification patch used static arrays of size MAX_CACHE_LEAVES.  Final patch
which made to the base used dynamic array allocation, with this
MAX_CACHE_LEAVES limit hunk still in place.

cpuid(4) already has a mechanism to find out the number of cache levels
implemented and there is no need for this hardcoded MAX_CACHE_LEAVES limit.

So remove the MAX_CACHE_LEAVES limit from the routine which calculates the
number of cache levels using cpuid(4)
Signed-off-by: default avatarSuresh Siddha <suresh.b.siddha@intel.com>
Cc: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent d5cd4aad
...@@ -117,7 +117,6 @@ struct _cpuid4_info { ...@@ -117,7 +117,6 @@ struct _cpuid4_info {
cpumask_t shared_cpu_map; cpumask_t shared_cpu_map;
}; };
#define MAX_CACHE_LEAVES 4
static unsigned short num_cache_leaves; static unsigned short num_cache_leaves;
static int __devinit cpuid4_cache_lookup(int index, struct _cpuid4_info *this_leaf) static int __devinit cpuid4_cache_lookup(int index, struct _cpuid4_info *this_leaf)
...@@ -144,20 +143,15 @@ static int __init find_num_cache_leaves(void) ...@@ -144,20 +143,15 @@ static int __init find_num_cache_leaves(void)
{ {
unsigned int eax, ebx, ecx, edx; unsigned int eax, ebx, ecx, edx;
union _cpuid4_leaf_eax cache_eax; union _cpuid4_leaf_eax cache_eax;
int i; int i = -1;
int retval;
retval = MAX_CACHE_LEAVES; do {
/* Do cpuid(4) loop to find out num_cache_leaves */ ++i;
for (i = 0; i < MAX_CACHE_LEAVES; i++) { /* Do cpuid(4) loop to find out num_cache_leaves */
cpuid_count(4, i, &eax, &ebx, &ecx, &edx); cpuid_count(4, i, &eax, &ebx, &ecx, &edx);
cache_eax.full = eax; cache_eax.full = eax;
if (cache_eax.split.type == CACHE_TYPE_NULL) { } while (cache_eax.split.type != CACHE_TYPE_NULL);
retval = i; return i;
break;
}
}
return retval;
} }
unsigned int __devinit init_intel_cacheinfo(struct cpuinfo_x86 *c) unsigned int __devinit init_intel_cacheinfo(struct cpuinfo_x86 *c)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment