Skip to content

Commit 6bf08a8

Browse files
ostrH. Peter Anvin
authored andcommitted
x86, AMD: Clean up init_amd()
Clean up multiple declarations of variable used for rd/wrmsr. Signed-off-by: Boris Ostrovsky <boris.ostrovsky@amd.com> Link: http://lkml.kernel.org/r/1359495136-23244-1-git-send-email-ostr@amd64.org Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
1 parent 349eab6 commit 6bf08a8

1 file changed

Lines changed: 12 additions & 17 deletions

File tree

‎arch/x86/kernel/cpu/amd.c‎

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -518,10 +518,9 @@ static void __cpuinit early_init_amd(struct cpuinfo_x86 *c)
518518
static void __cpuinit init_amd(struct cpuinfo_x86 *c)
519519
{
520520
u32 dummy;
521-
522-
#ifdef CONFIG_SMP
523521
unsigned long long value;
524522

523+
#ifdef CONFIG_SMP
525524
/*
526525
* Disable TLB flush filter by setting HWCR.FFDIS on K8
527526
* bit 6 of msr C001_0015
@@ -559,12 +558,10 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
559558
* (AMD Erratum #110, docId: 25759).
560559
*/
561560
if (c->x86_model < 0x14 && cpu_has(c, X86_FEATURE_LAHF_LM)) {
562-
u64 val;
563-
564561
clear_cpu_cap(c, X86_FEATURE_LAHF_LM);
565-
if (!rdmsrl_amd_safe(0xc001100d, &val)) {
566-
val &= ~(1ULL << 32);
567-
wrmsrl_amd_safe(0xc001100d, val);
562+
if (!rdmsrl_amd_safe(0xc001100d, &value)) {
563+
value &= ~(1ULL << 32);
564+
wrmsrl_amd_safe(0xc001100d, value);
568565
}
569566
}
570567

@@ -617,13 +614,12 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
617614
if ((c->x86 == 0x15) &&
618615
(c->x86_model >= 0x10) && (c->x86_model <= 0x1f) &&
619616
!cpu_has(c, X86_FEATURE_TOPOEXT)) {
620-
u64 val;
621617

622-
if (!rdmsrl_safe(0xc0011005, &val)) {
623-
val |= 1ULL << 54;
624-
wrmsrl_safe(0xc0011005, val);
625-
rdmsrl(0xc0011005, val);
626-
if (val & (1ULL << 54)) {
618+
if (!rdmsrl_safe(0xc0011005, &value)) {
619+
value |= 1ULL << 54;
620+
wrmsrl_safe(0xc0011005, value);
621+
rdmsrl(0xc0011005, value);
622+
if (value & (1ULL << 54)) {
627623
set_cpu_cap(c, X86_FEATURE_TOPOEXT);
628624
printk(KERN_INFO FW_INFO "CPU: Re-enabling "
629625
"disabled Topology Extensions Support\n");
@@ -637,11 +633,10 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
637633
*/
638634
if ((c->x86 == 0x15) &&
639635
(c->x86_model >= 0x02) && (c->x86_model < 0x20)) {
640-
u64 val;
641636

642-
if (!rdmsrl_safe(0xc0011021, &val) && !(val & 0x1E)) {
643-
val |= 0x1E;
644-
wrmsrl_safe(0xc0011021, val);
637+
if (!rdmsrl_safe(0xc0011021, &value) && !(value & 0x1E)) {
638+
value |= 0x1E;
639+
wrmsrl_safe(0xc0011021, value);
645640
}
646641
}
647642

0 commit comments

Comments
 (0)