Skip to content

Commit f8b64d0

Browse files
Borislav PetkovKAGA-KOKO
authored andcommitted
x86/CPU/AMD: Have smp_num_siblings and cpu_llc_id always be present
Move smp_num_siblings and cpu_llc_id to cpu/common.c so that they're always present as symbols and not only in the CONFIG_SMP case. Then, other code using them doesn't need ugly ifdeffery anymore. Get rid of some ifdeffery. Signed-off-by: Borislav Petkov <[email protected]> Signed-off-by: Suravee Suthikulpanit <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: http://lkml.kernel.org/r/[email protected]
1 parent 60882cc commit f8b64d0

File tree

4 files changed

+8
-17
lines changed

4 files changed

+8
-17
lines changed

arch/x86/include/asm/smp.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ static inline int wbinvd_on_all_cpus(void)
171171
wbinvd();
172172
return 0;
173173
}
174-
#define smp_num_siblings 1
175174
#endif /* CONFIG_SMP */
176175

177176
extern unsigned disabled_cpus;

arch/x86/kernel/cpu/amd.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,6 @@ static int nearby_node(int apicid)
297297
}
298298
#endif
299299

300-
#ifdef CONFIG_SMP
301300
/*
302301
* Fix up cpu_core_id for pre-F17h systems to be in the
303302
* [0 .. cores_per_node - 1] range. Not really needed but
@@ -375,15 +374,13 @@ static void amd_get_topology(struct cpuinfo_x86 *c)
375374
legacy_fixup_core_id(c);
376375
}
377376
}
378-
#endif
379377

380378
/*
381379
* On a AMD dual core setup the lower bits of the APIC id distinguish the cores.
382380
* Assumes number of cores is a power of two.
383381
*/
384382
static void amd_detect_cmp(struct cpuinfo_x86 *c)
385383
{
386-
#ifdef CONFIG_SMP
387384
unsigned bits;
388385
int cpu = smp_processor_id();
389386

@@ -395,16 +392,11 @@ static void amd_detect_cmp(struct cpuinfo_x86 *c)
395392
/* use socket ID also for last level cache */
396393
per_cpu(cpu_llc_id, cpu) = c->phys_proc_id;
397394
amd_get_topology(c);
398-
#endif
399395
}
400396

401397
u16 amd_get_nb_id(int cpu)
402398
{
403-
u16 id = 0;
404-
#ifdef CONFIG_SMP
405-
id = per_cpu(cpu_llc_id, cpu);
406-
#endif
407-
return id;
399+
return per_cpu(cpu_llc_id, cpu);
408400
}
409401
EXPORT_SYMBOL_GPL(amd_get_nb_id);
410402

arch/x86/kernel/cpu/common.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,13 @@ cpumask_var_t cpu_callin_mask;
6666
/* representing cpus for which sibling maps can be computed */
6767
cpumask_var_t cpu_sibling_setup_mask;
6868

69+
/* Number of siblings per CPU package */
70+
int smp_num_siblings = 1;
71+
EXPORT_SYMBOL(smp_num_siblings);
72+
73+
/* Last level cache ID of each logical CPU */
74+
DEFINE_PER_CPU_READ_MOSTLY(u16, cpu_llc_id) = BAD_APICID;
75+
6976
/* correctly size the local cpu masks */
7077
void __init setup_cpu_local_masks(void)
7178
{

arch/x86/kernel/smpboot.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,6 @@
7878
#include <asm/misc.h>
7979
#include <asm/qspinlock.h>
8080

81-
/* Number of siblings per CPU package */
82-
int smp_num_siblings = 1;
83-
EXPORT_SYMBOL(smp_num_siblings);
84-
85-
/* Last level cache ID of each logical CPU */
86-
DEFINE_PER_CPU_READ_MOSTLY(u16, cpu_llc_id) = BAD_APICID;
87-
8881
/* representing HT siblings of each logical CPU */
8982
DEFINE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_sibling_map);
9083
EXPORT_PER_CPU_SYMBOL(cpu_sibling_map);

0 commit comments

Comments
 (0)