Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'x86_cpu_for_v6.8' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 cpu feature updates from Borislav Petkov:

- Add synthetic X86_FEATURE flags for the different AMD Zen generations
and use them everywhere instead of ad-hoc family/model checks. Drop
an ancient AMD errata checking facility as a result

- Fix a fragile initcall ordering in intel_epb

- Do not issue the MFENCE+LFENCE barrier for the TSC deadline and
X2APIC MSRs on AMD as it is not needed there

* tag 'x86_cpu_for_v6.8' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86/CPU/AMD: Add X86_FEATURE_ZEN1
x86/CPU/AMD: Drop now unused CPU erratum checking function
x86/CPU/AMD: Get rid of amd_erratum_1485[]
x86/CPU/AMD: Get rid of amd_erratum_400[]
x86/CPU/AMD: Get rid of amd_erratum_383[]
x86/CPU/AMD: Get rid of amd_erratum_1054[]
x86/CPU/AMD: Move the DIV0 bug detection to the Zen1 init function
x86/CPU/AMD: Move Zenbleed check to the Zen2 init function
x86/CPU/AMD: Rename init_amd_zn() to init_amd_zen_common()
x86/CPU/AMD: Call the spectral chicken in the Zen2 init function
x86/CPU/AMD: Move erratum 1076 fix into the Zen1 init function
x86/CPU/AMD: Move the Zen3 BTC_NO detection to the Zen3 init function
x86/CPU/AMD: Carve out the erratum 1386 fix
x86/CPU/AMD: Add ZenX generations flags
x86/cpu/intel_epb: Don't rely on link order
x86/barrier: Do not serialize MSR accesses on AMD

+176 -162
-18
arch/x86/include/asm/barrier.h
··· 81 81 82 82 #include <asm-generic/barrier.h> 83 83 84 - /* 85 - * Make previous memory operations globally visible before 86 - * a WRMSR. 87 - * 88 - * MFENCE makes writes visible, but only affects load/store 89 - * instructions. WRMSR is unfortunately not a load/store 90 - * instruction and is unaffected by MFENCE. The LFENCE ensures 91 - * that the WRMSR is not reordered. 92 - * 93 - * Most WRMSRs are full serializing instructions themselves and 94 - * do not require this barrier. This is only required for the 95 - * IA32_TSC_DEADLINE and X2APIC MSRs. 96 - */ 97 - static inline void weak_wrmsr_fence(void) 98 - { 99 - asm volatile("mfence; lfence" : : : "memory"); 100 - } 101 - 102 84 #endif /* _ASM_X86_BARRIER_H */
+6 -2
arch/x86/include/asm/cpufeatures.h
··· 218 218 #define X86_FEATURE_IBRS ( 7*32+25) /* Indirect Branch Restricted Speculation */ 219 219 #define X86_FEATURE_IBPB ( 7*32+26) /* Indirect Branch Prediction Barrier */ 220 220 #define X86_FEATURE_STIBP ( 7*32+27) /* Single Thread Indirect Branch Predictors */ 221 - #define X86_FEATURE_ZEN (7*32+28) /* "" CPU based on Zen microarchitecture */ 221 + #define X86_FEATURE_ZEN ( 7*32+28) /* "" Generic flag for all Zen and newer */ 222 222 #define X86_FEATURE_L1TF_PTEINV ( 7*32+29) /* "" L1TF workaround PTE inversion */ 223 223 #define X86_FEATURE_IBRS_ENHANCED ( 7*32+30) /* Enhanced IBRS */ 224 224 #define X86_FEATURE_MSR_IA32_FEAT_CTL ( 7*32+31) /* "" MSR IA32_FEAT_CTL configured */ ··· 308 308 #define X86_FEATURE_SMBA (11*32+21) /* "" Slow Memory Bandwidth Allocation */ 309 309 #define X86_FEATURE_BMEC (11*32+22) /* "" Bandwidth Monitoring Event Configuration */ 310 310 #define X86_FEATURE_USER_SHSTK (11*32+23) /* Shadow stack support for user mode applications */ 311 - 312 311 #define X86_FEATURE_SRSO (11*32+24) /* "" AMD BTB untrain RETs */ 313 312 #define X86_FEATURE_SRSO_ALIAS (11*32+25) /* "" AMD BTB untrain RETs through aliasing */ 314 313 #define X86_FEATURE_IBPB_ON_VMEXIT (11*32+26) /* "" Issue an IBPB only on VMEXIT */ 314 + #define X86_FEATURE_APIC_MSRS_FENCE (11*32+27) /* "" IA32_TSC_DEADLINE and X2APIC MSRs need fencing */ 315 + #define X86_FEATURE_ZEN2 (11*32+28) /* "" CPU based on Zen2 microarchitecture */ 316 + #define X86_FEATURE_ZEN3 (11*32+29) /* "" CPU based on Zen3 microarchitecture */ 317 + #define X86_FEATURE_ZEN4 (11*32+30) /* "" CPU based on Zen4 microarchitecture */ 318 + #define X86_FEATURE_ZEN1 (11*32+31) /* "" CPU based on Zen1 microarchitecture */ 315 319 316 320 /* Intel-defined CPU features, CPUID level 0x00000007:1 (EAX), word 12 */ 317 321 #define X86_FEATURE_AVX_VNNI (12*32+ 4) /* AVX VNNI instructions */
+18
arch/x86/include/asm/processor.h
··· 749 749 750 750 extern bool gds_ucode_mitigated(void); 751 751 752 + /* 753 + * Make previous memory operations globally visible before 754 + * a WRMSR. 755 + * 756 + * MFENCE makes writes visible, but only affects load/store 757 + * instructions. WRMSR is unfortunately not a load/store 758 + * instruction and is unaffected by MFENCE. The LFENCE ensures 759 + * that the WRMSR is not reordered. 760 + * 761 + * Most WRMSRs are full serializing instructions themselves and 762 + * do not require this barrier. This is only required for the 763 + * IA32_TSC_DEADLINE and X2APIC MSRs. 764 + */ 765 + static inline void weak_wrmsr_fence(void) 766 + { 767 + alternative("mfence; lfence", "", ALT_NOT(X86_FEATURE_APIC_MSRS_FENCE)); 768 + } 769 + 752 770 #endif /* _ASM_X86_PROCESSOR_H */
+140 -140
arch/x86/kernel/cpu/amd.c
··· 34 34 */ 35 35 static u32 nodes_per_socket = 1; 36 36 37 - /* 38 - * AMD errata checking 39 - * 40 - * Errata are defined as arrays of ints using the AMD_LEGACY_ERRATUM() or 41 - * AMD_OSVW_ERRATUM() macros. The latter is intended for newer errata that 42 - * have an OSVW id assigned, which it takes as first argument. Both take a 43 - * variable number of family-specific model-stepping ranges created by 44 - * AMD_MODEL_RANGE(). 45 - * 46 - * Example: 47 - * 48 - * const int amd_erratum_319[] = 49 - * AMD_LEGACY_ERRATUM(AMD_MODEL_RANGE(0x10, 0x2, 0x1, 0x4, 0x2), 50 - * AMD_MODEL_RANGE(0x10, 0x8, 0x0, 0x8, 0x0), 51 - * AMD_MODEL_RANGE(0x10, 0x9, 0x0, 0x9, 0x0)); 52 - */ 53 - 54 - #define AMD_LEGACY_ERRATUM(...) { -1, __VA_ARGS__, 0 } 55 - #define AMD_OSVW_ERRATUM(osvw_id, ...) { osvw_id, __VA_ARGS__, 0 } 56 - #define AMD_MODEL_RANGE(f, m_start, s_start, m_end, s_end) \ 57 - ((f << 24) | (m_start << 16) | (s_start << 12) | (m_end << 4) | (s_end)) 58 - #define AMD_MODEL_RANGE_FAMILY(range) (((range) >> 24) & 0xff) 59 - #define AMD_MODEL_RANGE_START(range) (((range) >> 12) & 0xfff) 60 - #define AMD_MODEL_RANGE_END(range) ((range) & 0xfff) 61 - 62 - static const int amd_erratum_400[] = 63 - AMD_OSVW_ERRATUM(1, AMD_MODEL_RANGE(0xf, 0x41, 0x2, 0xff, 0xf), 64 - AMD_MODEL_RANGE(0x10, 0x2, 0x1, 0xff, 0xf)); 65 - 66 - static const int amd_erratum_383[] = 67 - AMD_OSVW_ERRATUM(3, AMD_MODEL_RANGE(0x10, 0, 0, 0xff, 0xf)); 68 - 69 - /* #1054: Instructions Retired Performance Counter May Be Inaccurate */ 70 - static const int amd_erratum_1054[] = 71 - AMD_LEGACY_ERRATUM(AMD_MODEL_RANGE(0x17, 0, 0, 0x2f, 0xf)); 72 - 73 - static const int amd_zenbleed[] = 74 - AMD_LEGACY_ERRATUM(AMD_MODEL_RANGE(0x17, 0x30, 0x0, 0x4f, 0xf), 75 - AMD_MODEL_RANGE(0x17, 0x60, 0x0, 0x7f, 0xf), 76 - AMD_MODEL_RANGE(0x17, 0x90, 0x0, 0x91, 0xf), 77 - AMD_MODEL_RANGE(0x17, 0xa0, 0x0, 0xaf, 0xf)); 78 - 79 - static const int amd_div0[] = 80 - AMD_LEGACY_ERRATUM(AMD_MODEL_RANGE(0x17, 0x00, 0x0, 0x2f, 0xf), 81 - AMD_MODEL_RANGE(0x17, 0x50, 0x0, 0x5f, 0xf)); 82 - 83 - static const int amd_erratum_1485[] = 84 - AMD_LEGACY_ERRATUM(AMD_MODEL_RANGE(0x19, 0x10, 0x0, 0x1f, 0xf), 85 - AMD_MODEL_RANGE(0x19, 0x60, 0x0, 0xaf, 0xf)); 86 - 87 - static bool cpu_has_amd_erratum(struct cpuinfo_x86 *cpu, const int *erratum) 88 - { 89 - int osvw_id = *erratum++; 90 - u32 range; 91 - u32 ms; 92 - 93 - if (osvw_id >= 0 && osvw_id < 65536 && 94 - cpu_has(cpu, X86_FEATURE_OSVW)) { 95 - u64 osvw_len; 96 - 97 - rdmsrl(MSR_AMD64_OSVW_ID_LENGTH, osvw_len); 98 - if (osvw_id < osvw_len) { 99 - u64 osvw_bits; 100 - 101 - rdmsrl(MSR_AMD64_OSVW_STATUS + (osvw_id >> 6), 102 - osvw_bits); 103 - return osvw_bits & (1ULL << (osvw_id & 0x3f)); 104 - } 105 - } 106 - 107 - /* OSVW unavailable or ID unknown, match family-model-stepping range */ 108 - ms = (cpu->x86_model << 4) | cpu->x86_stepping; 109 - while ((range = *erratum++)) 110 - if ((cpu->x86 == AMD_MODEL_RANGE_FAMILY(range)) && 111 - (ms >= AMD_MODEL_RANGE_START(range)) && 112 - (ms <= AMD_MODEL_RANGE_END(range))) 113 - return true; 114 - 115 - return false; 116 - } 117 - 118 37 static inline int rdmsrl_amd_safe(unsigned msr, unsigned long long *p) 119 38 { 120 39 u32 gprs[8] = { 0 }; ··· 535 616 } 536 617 537 618 resctrl_cpu_detect(c); 619 + 620 + /* Figure out Zen generations: */ 621 + switch (c->x86) { 622 + case 0x17: { 623 + switch (c->x86_model) { 624 + case 0x00 ... 0x2f: 625 + case 0x50 ... 0x5f: 626 + setup_force_cpu_cap(X86_FEATURE_ZEN1); 627 + break; 628 + case 0x30 ... 0x4f: 629 + case 0x60 ... 0x7f: 630 + case 0x90 ... 0x91: 631 + case 0xa0 ... 0xaf: 632 + setup_force_cpu_cap(X86_FEATURE_ZEN2); 633 + break; 634 + default: 635 + goto warn; 636 + } 637 + break; 638 + } 639 + case 0x19: { 640 + switch (c->x86_model) { 641 + case 0x00 ... 0x0f: 642 + case 0x20 ... 0x5f: 643 + setup_force_cpu_cap(X86_FEATURE_ZEN3); 644 + break; 645 + case 0x10 ... 0x1f: 646 + case 0x60 ... 0xaf: 647 + setup_force_cpu_cap(X86_FEATURE_ZEN4); 648 + break; 649 + default: 650 + goto warn; 651 + } 652 + break; 653 + } 654 + default: 655 + break; 656 + } 657 + 658 + return; 659 + 660 + warn: 661 + WARN_ONCE(1, "Family 0x%x, model: 0x%x??\n", c->x86, c->x86_model); 538 662 } 539 663 540 664 static void early_detect_mem_encrypt(struct cpuinfo_x86 *c) ··· 701 739 if (c->x86 == 0x16 && c->x86_model <= 0xf) 702 740 msr_set_bit(MSR_AMD64_LS_CFG, 15); 703 741 704 - /* 705 - * Check whether the machine is affected by erratum 400. This is 706 - * used to select the proper idle routine and to enable the check 707 - * whether the machine is affected in arch_post_acpi_init(), which 708 - * sets the X86_BUG_AMD_APIC_C1E bug depending on the MSR check. 709 - */ 710 - if (cpu_has_amd_erratum(c, amd_erratum_400)) 711 - set_cpu_bug(c, X86_BUG_AMD_E400); 712 - 713 742 early_detect_mem_encrypt(c); 714 743 715 744 /* Re-enable TopologyExtensions if switched off by BIOS */ ··· 767 814 msr_set_bit(MSR_K7_HWCR, 6); 768 815 #endif 769 816 set_cpu_bug(c, X86_BUG_SWAPGS_FENCE); 817 + 818 + /* 819 + * Check models and steppings affected by erratum 400. This is 820 + * used to select the proper idle routine and to enable the 821 + * check whether the machine is affected in arch_post_acpi_subsys_init() 822 + * which sets the X86_BUG_AMD_APIC_C1E bug depending on the MSR check. 823 + */ 824 + if (c->x86_model > 0x41 || 825 + (c->x86_model == 0x41 && c->x86_stepping >= 0x2)) 826 + setup_force_cpu_bug(X86_BUG_AMD_E400); 770 827 } 771 828 772 829 static void init_amd_gh(struct cpuinfo_x86 *c) ··· 810 847 */ 811 848 msr_clear_bit(MSR_AMD64_BU_CFG2, 24); 812 849 813 - if (cpu_has_amd_erratum(c, amd_erratum_383)) 814 - set_cpu_bug(c, X86_BUG_AMD_TLB_MMATCH); 850 + set_cpu_bug(c, X86_BUG_AMD_TLB_MMATCH); 851 + 852 + /* 853 + * Check models and steppings affected by erratum 400. This is 854 + * used to select the proper idle routine and to enable the 855 + * check whether the machine is affected in arch_post_acpi_subsys_init() 856 + * which sets the X86_BUG_AMD_APIC_C1E bug depending on the MSR check. 857 + */ 858 + if (c->x86_model > 0x2 || 859 + (c->x86_model == 0x2 && c->x86_stepping >= 0x1)) 860 + setup_force_cpu_bug(X86_BUG_AMD_E400); 815 861 } 816 862 817 863 static void init_amd_ln(struct cpuinfo_x86 *c) ··· 913 941 clear_rdrand_cpuid_bit(c); 914 942 } 915 943 916 - void init_spectral_chicken(struct cpuinfo_x86 *c) 944 + static void fix_erratum_1386(struct cpuinfo_x86 *c) 917 945 { 918 - #ifdef CONFIG_CPU_UNRET_ENTRY 919 - u64 value; 920 - 921 - /* 922 - * On Zen2 we offer this chicken (bit) on the altar of Speculation. 923 - * 924 - * This suppresses speculation from the middle of a basic block, i.e. it 925 - * suppresses non-branch predictions. 926 - * 927 - * We use STIBP as a heuristic to filter out Zen2 from the rest of F17H 928 - */ 929 - if (!cpu_has(c, X86_FEATURE_HYPERVISOR) && cpu_has(c, X86_FEATURE_AMD_STIBP)) { 930 - if (!rdmsrl_safe(MSR_ZEN2_SPECTRAL_CHICKEN, &value)) { 931 - value |= MSR_ZEN2_SPECTRAL_CHICKEN_BIT; 932 - wrmsrl_safe(MSR_ZEN2_SPECTRAL_CHICKEN, value); 933 - } 934 - } 935 - #endif 936 946 /* 937 947 * Work around Erratum 1386. The XSAVES instruction malfunctions in 938 948 * certain circumstances on Zen1/2 uarch, and not all parts have had ··· 926 972 clear_cpu_cap(c, X86_FEATURE_XSAVES); 927 973 } 928 974 929 - static void init_amd_zn(struct cpuinfo_x86 *c) 975 + void init_spectral_chicken(struct cpuinfo_x86 *c) 930 976 { 931 - set_cpu_cap(c, X86_FEATURE_ZEN); 977 + #ifdef CONFIG_CPU_UNRET_ENTRY 978 + u64 value; 932 979 980 + /* 981 + * On Zen2 we offer this chicken (bit) on the altar of Speculation. 982 + * 983 + * This suppresses speculation from the middle of a basic block, i.e. it 984 + * suppresses non-branch predictions. 985 + */ 986 + if (!cpu_has(c, X86_FEATURE_HYPERVISOR)) { 987 + if (!rdmsrl_safe(MSR_ZEN2_SPECTRAL_CHICKEN, &value)) { 988 + value |= MSR_ZEN2_SPECTRAL_CHICKEN_BIT; 989 + wrmsrl_safe(MSR_ZEN2_SPECTRAL_CHICKEN, value); 990 + } 991 + } 992 + #endif 993 + } 994 + 995 + static void init_amd_zen_common(void) 996 + { 997 + setup_force_cpu_cap(X86_FEATURE_ZEN); 933 998 #ifdef CONFIG_NUMA 934 999 node_reclaim_distance = 32; 935 1000 #endif 1001 + } 1002 + 1003 + static void init_amd_zen1(struct cpuinfo_x86 *c) 1004 + { 1005 + init_amd_zen_common(); 1006 + fix_erratum_1386(c); 936 1007 937 1008 /* Fix up CPUID bits, but only if not virtualised. */ 938 1009 if (!cpu_has(c, X86_FEATURE_HYPERVISOR)) { ··· 965 986 /* Erratum 1076: CPB feature bit not being set in CPUID. */ 966 987 if (!cpu_has(c, X86_FEATURE_CPB)) 967 988 set_cpu_cap(c, X86_FEATURE_CPB); 968 - 969 - /* 970 - * Zen3 (Fam19 model < 0x10) parts are not susceptible to 971 - * Branch Type Confusion, but predate the allocation of the 972 - * BTC_NO bit. 973 - */ 974 - if (c->x86 == 0x19 && !cpu_has(c, X86_FEATURE_BTC_NO)) 975 - set_cpu_cap(c, X86_FEATURE_BTC_NO); 976 989 } 990 + 991 + pr_notice_once("AMD Zen1 DIV0 bug detected. Disable SMT for full protection.\n"); 992 + setup_force_cpu_bug(X86_BUG_DIV0); 977 993 } 978 994 979 995 static bool cpu_has_zenbleed_microcode(void) ··· 992 1018 return true; 993 1019 } 994 1020 995 - static void zenbleed_check(struct cpuinfo_x86 *c) 1021 + static void zen2_zenbleed_check(struct cpuinfo_x86 *c) 996 1022 { 997 - if (!cpu_has_amd_erratum(c, amd_zenbleed)) 998 - return; 999 - 1000 1023 if (cpu_has(c, X86_FEATURE_HYPERVISOR)) 1001 1024 return; 1002 1025 ··· 1006 1035 } else { 1007 1036 msr_clear_bit(MSR_AMD64_DE_CFG, MSR_AMD64_DE_CFG_ZEN2_FP_BACKUP_FIX_BIT); 1008 1037 } 1038 + } 1039 + 1040 + static void init_amd_zen2(struct cpuinfo_x86 *c) 1041 + { 1042 + init_amd_zen_common(); 1043 + init_spectral_chicken(c); 1044 + fix_erratum_1386(c); 1045 + zen2_zenbleed_check(c); 1046 + } 1047 + 1048 + static void init_amd_zen3(struct cpuinfo_x86 *c) 1049 + { 1050 + init_amd_zen_common(); 1051 + 1052 + if (!cpu_has(c, X86_FEATURE_HYPERVISOR)) { 1053 + /* 1054 + * Zen3 (Fam19 model < 0x10) parts are not susceptible to 1055 + * Branch Type Confusion, but predate the allocation of the 1056 + * BTC_NO bit. 1057 + */ 1058 + if (!cpu_has(c, X86_FEATURE_BTC_NO)) 1059 + set_cpu_cap(c, X86_FEATURE_BTC_NO); 1060 + } 1061 + } 1062 + 1063 + static void init_amd_zen4(struct cpuinfo_x86 *c) 1064 + { 1065 + init_amd_zen_common(); 1066 + 1067 + if (!cpu_has(c, X86_FEATURE_HYPERVISOR)) 1068 + msr_set_bit(MSR_ZEN4_BP_CFG, MSR_ZEN4_BP_CFG_SHARED_BTB_FIX_BIT); 1009 1069 } 1010 1070 1011 1071 static void init_amd(struct cpuinfo_x86 *c) ··· 1074 1072 case 0x12: init_amd_ln(c); break; 1075 1073 case 0x15: init_amd_bd(c); break; 1076 1074 case 0x16: init_amd_jg(c); break; 1077 - case 0x17: init_spectral_chicken(c); 1078 - fallthrough; 1079 - case 0x19: init_amd_zn(c); break; 1080 1075 } 1076 + 1077 + if (boot_cpu_has(X86_FEATURE_ZEN1)) 1078 + init_amd_zen1(c); 1079 + else if (boot_cpu_has(X86_FEATURE_ZEN2)) 1080 + init_amd_zen2(c); 1081 + else if (boot_cpu_has(X86_FEATURE_ZEN3)) 1082 + init_amd_zen3(c); 1083 + else if (boot_cpu_has(X86_FEATURE_ZEN4)) 1084 + init_amd_zen4(c); 1081 1085 1082 1086 /* 1083 1087 * Enable workaround for FXSAVE leak on CPUs ··· 1144 1136 * Counter May Be Inaccurate". 1145 1137 */ 1146 1138 if (cpu_has(c, X86_FEATURE_IRPERF) && 1147 - !cpu_has_amd_erratum(c, amd_erratum_1054)) 1139 + (boot_cpu_has(X86_FEATURE_ZEN1) && c->x86_model > 0x2f)) 1148 1140 msr_set_bit(MSR_K7_HWCR, MSR_K7_HWCR_IRPERF_EN_BIT); 1149 1141 1150 1142 check_null_seg_clears_base(c); ··· 1160 1152 cpu_has(c, X86_FEATURE_AUTOIBRS)) 1161 1153 WARN_ON_ONCE(msr_set_bit(MSR_EFER, _EFER_AUTOIBRS)); 1162 1154 1163 - zenbleed_check(c); 1164 - 1165 - if (cpu_has_amd_erratum(c, amd_div0)) { 1166 - pr_notice_once("AMD Zen1 DIV0 bug detected. Disable SMT for full protection.\n"); 1167 - setup_force_cpu_bug(X86_BUG_DIV0); 1168 - } 1169 - 1170 - if (!cpu_has(c, X86_FEATURE_HYPERVISOR) && 1171 - cpu_has_amd_erratum(c, amd_erratum_1485)) 1172 - msr_set_bit(MSR_ZEN4_BP_CFG, MSR_ZEN4_BP_CFG_SHARED_BTB_FIX_BIT); 1155 + /* AMD CPUs don't need fencing after x2APIC/TSC_DEADLINE MSR writes. */ 1156 + clear_cpu_cap(c, X86_FEATURE_APIC_MSRS_FENCE); 1173 1157 } 1174 1158 1175 1159 #ifdef CONFIG_X86_32 ··· 1315 1315 { 1316 1316 struct cpuinfo_x86 *c = &cpu_data(smp_processor_id()); 1317 1317 1318 - zenbleed_check(c); 1318 + zen2_zenbleed_check(c); 1319 1319 } 1320 1320 1321 1321 void amd_check_microcode(void)
+7
arch/x86/kernel/cpu/common.c
··· 1856 1856 c->topo.apicid = apic->phys_pkg_id(c->topo.initial_apicid, 0); 1857 1857 #endif 1858 1858 1859 + 1860 + /* 1861 + * Set default APIC and TSC_DEADLINE MSR fencing flag. AMD and 1862 + * Hygon will clear it in ->c_init() below. 1863 + */ 1864 + set_cpu_cap(c, X86_FEATURE_APIC_MSRS_FENCE); 1865 + 1859 1866 /* 1860 1867 * Vendor-specific initialization. In this section we 1861 1868 * canonicalize the feature flags, meaning if there are
+3
arch/x86/kernel/cpu/hygon.c
··· 354 354 set_cpu_bug(c, X86_BUG_SYSRET_SS_ATTRS); 355 355 356 356 check_null_seg_clears_base(c); 357 + 358 + /* Hygon CPUs don't need fencing after x2APIC/TSC_DEADLINE MSR writes. */ 359 + clear_cpu_cap(c, X86_FEATURE_APIC_MSRS_FENCE); 357 360 } 358 361 359 362 static void cpu_detect_tlb_hygon(struct cpuinfo_x86 *c)
+1 -1
arch/x86/kernel/cpu/intel_epb.c
··· 237 237 cpuhp_remove_state(CPUHP_AP_X86_INTEL_EPB_ONLINE); 238 238 return ret; 239 239 } 240 - subsys_initcall(intel_epb_init); 240 + late_initcall(intel_epb_init);
+1 -1
tools/arch/x86/include/asm/cpufeatures.h
··· 218 218 #define X86_FEATURE_IBRS ( 7*32+25) /* Indirect Branch Restricted Speculation */ 219 219 #define X86_FEATURE_IBPB ( 7*32+26) /* Indirect Branch Prediction Barrier */ 220 220 #define X86_FEATURE_STIBP ( 7*32+27) /* Single Thread Indirect Branch Predictors */ 221 - #define X86_FEATURE_ZEN (7*32+28) /* "" CPU based on Zen microarchitecture */ 221 + #define X86_FEATURE_ZEN ( 7*32+28) /* "" Generic flag for all Zen and newer */ 222 222 #define X86_FEATURE_L1TF_PTEINV ( 7*32+29) /* "" L1TF workaround PTE inversion */ 223 223 #define X86_FEATURE_IBRS_ENHANCED ( 7*32+30) /* Enhanced IBRS */ 224 224 #define X86_FEATURE_MSR_IA32_FEAT_CTL ( 7*32+31) /* "" MSR IA32_FEAT_CTL configured */