]> err.no Git - linux-2.6/commitdiff
[PATCH] intel_cacheinfo: remove MAX_CACHE_LEAVES limit
authorSiddha, Suresh B <suresh.b.siddha@intel.com>
Sun, 30 Oct 2005 22:59:30 +0000 (14:59 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 31 Oct 2005 01:37:11 +0000 (17:37 -0800)
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: Suresh Siddha <suresh.b.siddha@intel.com>
Cc: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/i386/kernel/cpu/intel_cacheinfo.c

index 9e0d5f83cb9f63879b59b06683449d97923e4ce9..c802206274c20b1f4f08756335ad16bb1f133db6 100644 (file)
@@ -117,7 +117,6 @@ struct _cpuid4_info {
        cpumask_t shared_cpu_map;
 };
 
-#define MAX_CACHE_LEAVES               4
 static unsigned short                  num_cache_leaves;
 
 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)
 {
        unsigned int            eax, ebx, ecx, edx;
        union _cpuid4_leaf_eax  cache_eax;
-       int                     i;
-       int                     retval;
+       int                     i = -1;
 
-       retval = MAX_CACHE_LEAVES;
-       /* Do cpuid(4) loop to find out num_cache_leaves */
-       for (i = 0; i < MAX_CACHE_LEAVES; i++) {
+       do {
+               ++i;
+               /* Do cpuid(4) loop to find out num_cache_leaves */
                cpuid_count(4, i, &eax, &ebx, &ecx, &edx);
                cache_eax.full = eax;
-               if (cache_eax.split.type == CACHE_TYPE_NULL) {
-                       retval = i;
-                       break;
-               }
-       }
-       return retval;
+       } while (cache_eax.split.type != CACHE_TYPE_NULL);
+       return i;
 }
 
 unsigned int __devinit init_intel_cacheinfo(struct cpuinfo_x86 *c)