Skip to content

Commit ede1898

Browse files
yghannambp3tk0v
authored andcommitted
x86/mce/inject: Only write MCA_MISC when a value has been supplied
The MCA_MISC register is used to control the MCA thresholding feature on AMD systems. Therefore, it is not generally part of the error state that a user would adjust when testing non-thresholding cases. However, MCA_MISC is unconditionally written even if a user does not supply a value. The default value of '0' will be used and clobber the register. Write the MCA_MISC register only if the user has given a value for it. Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://lore.kernel.org/r/20240523155641.2805411-2-yazen.ghannam@amd.com
1 parent 1613e60 commit ede1898

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

arch/x86/kernel/cpu/mce/inject.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,12 +487,16 @@ static void prepare_msrs(void *info)
487487
wrmsrl(MSR_AMD64_SMCA_MCx_ADDR(b), m.addr);
488488
}
489489

490-
wrmsrl(MSR_AMD64_SMCA_MCx_MISC(b), m.misc);
491490
wrmsrl(MSR_AMD64_SMCA_MCx_SYND(b), m.synd);
491+
492+
if (m.misc)
493+
wrmsrl(MSR_AMD64_SMCA_MCx_MISC(b), m.misc);
492494
} else {
493495
wrmsrl(MSR_IA32_MCx_STATUS(b), m.status);
494496
wrmsrl(MSR_IA32_MCx_ADDR(b), m.addr);
495-
wrmsrl(MSR_IA32_MCx_MISC(b), m.misc);
497+
498+
if (m.misc)
499+
wrmsrl(MSR_IA32_MCx_MISC(b), m.misc);
496500
}
497501
}
498502

0 commit comments

Comments
 (0)