Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: SGI-IP27: use cpu physid already present while scanning for CPUs

By using cpu physid already present when scanning for CPUs
get_cpu_slice() is unsued and can be removed together with two
other then used functions.

Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
Signed-off-by: Paul Burton <paulburton@kernel.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: James Hogan <jhogan@kernel.org>
Cc: linux-mips@vger.kernel.org
Cc: linux-kernel@vger.kernel.org

authored by

Thomas Bogendoerfer and committed by
Paul Burton
d6972bb4 2d11e6a4

+8 -74
-1
arch/mips/include/asm/sn/arch.h
··· 26 26 #define INVALID_PARTID (partid_t)-1 27 27 28 28 extern nasid_t get_nasid(void); 29 - extern int get_cpu_slice(cpuid_t); 30 29 31 30 #endif /* _ASM_SN_ARCH_H */
-4
arch/mips/include/asm/sn/klconfig.h
··· 889 889 extern lboard_t *find_lboard(lboard_t *start, unsigned char type); 890 890 extern klinfo_t *find_component(lboard_t *brd, klinfo_t *kli, unsigned char type); 891 891 extern klinfo_t *find_first_component(lboard_t *brd, unsigned char type); 892 - extern klcpu_t *nasid_slice_to_cpuinfo(nasid_t, int); 893 892 extern lboard_t *find_lboard_class(lboard_t *start, unsigned char brd_class); 894 - 895 - 896 - extern klcpu_t *sn_get_cpuinfo(cpuid_t cpu); 897 893 898 894 #endif /* _ASM_SN_KLCONFIG_H */
-51
arch/mips/sgi-ip27/ip27-klconfig.c
··· 72 72 /* Didn't find it. */ 73 73 return (lboard_t *)NULL; 74 74 } 75 - 76 - klcpu_t *nasid_slice_to_cpuinfo(nasid_t nasid, int slice) 77 - { 78 - lboard_t *brd; 79 - klcpu_t *acpu; 80 - 81 - if (!(brd = find_lboard((lboard_t *)KL_CONFIG_INFO(nasid), KLTYPE_IP27))) 82 - return (klcpu_t *)NULL; 83 - 84 - if (!(acpu = (klcpu_t *)find_first_component(brd, KLSTRUCT_CPU))) 85 - return (klcpu_t *)NULL; 86 - 87 - do { 88 - if ((acpu->cpu_info.physid) == slice) 89 - return acpu; 90 - } while ((acpu = (klcpu_t *)find_component(brd, (klinfo_t *)acpu, 91 - KLSTRUCT_CPU))); 92 - return (klcpu_t *)NULL; 93 - } 94 - 95 - klcpu_t *sn_get_cpuinfo(cpuid_t cpu) 96 - { 97 - nasid_t nasid; 98 - int slice; 99 - klcpu_t *acpu; 100 - 101 - if (!(cpu < MAXCPUS)) { 102 - printk("sn_get_cpuinfo: illegal cpuid 0x%lx\n", cpu); 103 - return NULL; 104 - } 105 - 106 - nasid = cputonasid(cpu); 107 - if (nasid == INVALID_NASID) 108 - return NULL; 109 - 110 - for (slice = 0; slice < CPUS_PER_NODE; slice++) { 111 - acpu = nasid_slice_to_cpuinfo(nasid, slice); 112 - if (acpu && acpu->cpu_info.virtid == cpu) 113 - return acpu; 114 - } 115 - return NULL; 116 - } 117 - 118 - int get_cpu_slice(cpuid_t cpu) 119 - { 120 - klcpu_t *acpu; 121 - 122 - if ((acpu = sn_get_cpuinfo(cpu)) == NULL) 123 - return -1; 124 - return acpu->cpu_info.physid; 125 - }
+8 -18
arch/mips/sgi-ip27/ip27-smp.c
··· 29 29 30 30 #include "ip27-common.h" 31 31 32 - /* 33 - * Takes as first input the PROM assigned cpu id, and the kernel 34 - * assigned cpu id as the second. 35 - */ 36 - static void alloc_cpupda(nasid_t nasid, cpuid_t cpu, int cpunum) 32 + static int node_scan_cpus(nasid_t nasid, int highest) 37 33 { 38 - cputonasid(cpunum) = nasid; 39 - cputoslice(cpunum) = get_cpu_slice(cpu); 40 - } 41 - 42 - static int do_cpumask(nasid_t nasid, int highest) 43 - { 44 - static int tot_cpus_found = 0; 34 + static int cpus_found; 45 35 lboard_t *brd; 46 36 klcpu_t *acpu; 47 - int cpus_found = 0; 48 37 cpuid_t cpuid; 49 38 50 39 brd = find_lboard((lboard_t *)KL_CONFIG_INFO(nasid), KLTYPE_IP27); ··· 44 55 cpuid = acpu->cpu_info.virtid; 45 56 /* Only let it join in if it's marked enabled */ 46 57 if ((acpu->cpu_info.flags & KLINFO_ENABLE) && 47 - (tot_cpus_found != NR_CPUS)) { 58 + (cpus_found != NR_CPUS)) { 48 59 if (cpuid > highest) 49 60 highest = cpuid; 50 61 set_cpu_possible(cpuid, true); 51 - alloc_cpupda(nasid, cpuid, tot_cpus_found); 62 + cputonasid(cpus_found) = nasid; 63 + cputoslice(cpus_found) = acpu->cpu_info.physid; 52 64 cpus_found++; 53 - tot_cpus_found++; 54 65 } 55 66 acpu = (klcpu_t *)find_component(brd, (klinfo_t *)acpu, 56 67 KLSTRUCT_CPU); ··· 76 87 if (nasid == INVALID_NASID) 77 88 break; 78 89 node_set_online(nasid); 79 - highest = do_cpumask(nasid, highest); 90 + highest = node_scan_cpus(nasid, highest); 80 91 } 81 92 82 93 printk("Discovered %d cpus on %d nodes\n", highest + 1, num_online_nodes()); ··· 169 180 /* 170 181 * PROM sets up system, that boot cpu is always first CPU on nasid 0 171 182 */ 172 - alloc_cpupda(0, 0, 0); 183 + cputonasid(0) = 0; 184 + cputoslice(0) = LOCAL_HUB_L(PI_CPU_NUM); 173 185 } 174 186 175 187 static void __init ip27_prepare_cpus(unsigned int max_cpus)