Skip to content

Commit f0322bd

Browse files
ostrH. Peter Anvin
authored andcommitted
x86, AMD: Enable WC+ memory type on family 10 processors
In some cases BIOS may not enable WC+ memory type on family 10 processors, instead converting what would be WC+ memory to CD type. On guests using nested pages this could result in performance degradation. This patch enables WC+. Signed-off-by: Boris Ostrovsky <boris.ostrovsky@amd.com> Link: http://lkml.kernel.org/r/1359495169-23278-1-git-send-email-ostr@amd64.org Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
1 parent 6bf08a8 commit f0322bd

2 files changed

Lines changed: 17 additions & 5 deletions

File tree

‎arch/x86/include/uapi/asm/msr-index.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@
173173
#define MSR_AMD64_OSVW_ID_LENGTH 0xc0010140
174174
#define MSR_AMD64_OSVW_STATUS 0xc0010141
175175
#define MSR_AMD64_DC_CFG 0xc0011022
176+
#define MSR_AMD64_BU_CFG2 0xc001102a
176177
#define MSR_AMD64_IBSFETCHCTL 0xc0011030
177178
#define MSR_AMD64_IBSFETCHLINAD 0xc0011031
178179
#define MSR_AMD64_IBSFETCHPHYSAD 0xc0011032

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

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -698,13 +698,11 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
698698
if (c->x86 > 0x11)
699699
set_cpu_cap(c, X86_FEATURE_ARAT);
700700

701-
/*
702-
* Disable GART TLB Walk Errors on Fam10h. We do this here
703-
* because this is always needed when GART is enabled, even in a
704-
* kernel which has no MCE support built in.
705-
*/
706701
if (c->x86 == 0x10) {
707702
/*
703+
* Disable GART TLB Walk Errors on Fam10h. We do this here
704+
* because this is always needed when GART is enabled, even in a
705+
* kernel which has no MCE support built in.
708706
* BIOS should disable GartTlbWlk Errors themself. If
709707
* it doesn't do it here as suggested by the BKDG.
710708
*
@@ -718,6 +716,19 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
718716
mask |= (1 << 10);
719717
wrmsrl_safe(MSR_AMD64_MCx_MASK(4), mask);
720718
}
719+
720+
/*
721+
* On family 10h BIOS may not have properly enabled WC+ support,
722+
* causing it to be converted to CD memtype. This may result in
723+
* performance degradation for certain nested-paging guests.
724+
* Prevent this conversion by clearing bit 24 in
725+
* MSR_AMD64_BU_CFG2.
726+
*/
727+
if (c->x86 == 0x10) {
728+
rdmsrl(MSR_AMD64_BU_CFG2, value);
729+
value &= ~(1ULL << 24);
730+
wrmsrl(MSR_AMD64_BU_CFG2, value);
731+
}
721732
}
722733

723734
rdmsr_safe(MSR_AMD64_PATCH_LEVEL, &c->microcode, &dummy);

0 commit comments

Comments
 (0)