Skip to content

Commit fca1037

Browse files
committed
Merge tag 'x86-urgent-2020-02-22' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 fixes from Thomas Gleixner: "Two fixes for x86: - Remove the __force_oder definiton from the kaslr boot code as it is already defined in the page table code which makes GCC 10 builds fail because it changed the default to -fno-common. - Address the AMD erratum 1054 concerning the IRPERF capability and enable the Instructions Retired fixed counter on machines which are not affected by the erratum" * tag 'x86-urgent-2020-02-22' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/cpu/amd: Enable the fixed Instructions Retired counter IRPERF x86/boot/compressed: Don't declare __force_order in kaslr_64.c
2 parents 0a115e5 + 21b5ee5 commit fca1037

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

arch/x86/boot/compressed/kaslr_64.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@
2929
#define __PAGE_OFFSET __PAGE_OFFSET_BASE
3030
#include "../../mm/ident_map.c"
3131

32-
/* Used by pgtable.h asm code to force instruction serialization. */
33-
unsigned long __force_order;
34-
3532
/* Used to track our page table allocation area. */
3633
struct alloc_pgt_data {
3734
unsigned char *pgt_buf;

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,8 @@
512512
#define MSR_K7_HWCR 0xc0010015
513513
#define MSR_K7_HWCR_SMMLOCK_BIT 0
514514
#define MSR_K7_HWCR_SMMLOCK BIT_ULL(MSR_K7_HWCR_SMMLOCK_BIT)
515+
#define MSR_K7_HWCR_IRPERF_EN_BIT 30
516+
#define MSR_K7_HWCR_IRPERF_EN BIT_ULL(MSR_K7_HWCR_IRPERF_EN_BIT)
515517
#define MSR_K7_FID_VID_CTL 0xc0010041
516518
#define MSR_K7_FID_VID_STATUS 0xc0010042
517519

arch/x86/kernel/cpu/amd.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
static const int amd_erratum_383[];
3030
static const int amd_erratum_400[];
31+
static const int amd_erratum_1054[];
3132
static bool cpu_has_amd_erratum(struct cpuinfo_x86 *cpu, const int *erratum);
3233

3334
/*
@@ -972,6 +973,15 @@ static void init_amd(struct cpuinfo_x86 *c)
972973
/* AMD CPUs don't reset SS attributes on SYSRET, Xen does. */
973974
if (!cpu_has(c, X86_FEATURE_XENPV))
974975
set_cpu_bug(c, X86_BUG_SYSRET_SS_ATTRS);
976+
977+
/*
978+
* Turn on the Instructions Retired free counter on machines not
979+
* susceptible to erratum #1054 "Instructions Retired Performance
980+
* Counter May Be Inaccurate".
981+
*/
982+
if (cpu_has(c, X86_FEATURE_IRPERF) &&
983+
!cpu_has_amd_erratum(c, amd_erratum_1054))
984+
msr_set_bit(MSR_K7_HWCR, MSR_K7_HWCR_IRPERF_EN_BIT);
975985
}
976986

977987
#ifdef CONFIG_X86_32
@@ -1099,6 +1109,10 @@ static const int amd_erratum_400[] =
10991109
static const int amd_erratum_383[] =
11001110
AMD_OSVW_ERRATUM(3, AMD_MODEL_RANGE(0x10, 0, 0, 0xff, 0xf));
11011111

1112+
/* #1054: Instructions Retired Performance Counter May Be Inaccurate */
1113+
static const int amd_erratum_1054[] =
1114+
AMD_OSVW_ERRATUM(0, AMD_MODEL_RANGE(0x17, 0, 0, 0x2f, 0xf));
1115+
11021116

11031117
static bool cpu_has_amd_erratum(struct cpuinfo_x86 *cpu, const int *erratum)
11041118
{

0 commit comments

Comments
 (0)