Print this page
11787 Kernel needs to be built with retpolines
11788 Kernel needs to generally use RSB stuffing
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: John Levon <john.levon@joyent.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/intel/sys/x86_archext.h
          +++ new/usr/src/uts/intel/sys/x86_archext.h
↓ open down ↓ 539 lines elided ↑ open up ↑
 540  540  #define IA32_PKG_THERM_INTERRUPT_HIGH_IE        0x00000001
 541  541  #define IA32_PKG_THERM_INTERRUPT_LOW_IE         0x00000002
 542  542  #define IA32_PKG_THERM_INTERRUPT_PROCHOT_IE     0x00000004
 543  543  #define IA32_PKG_THERM_INTERRUPT_OVERHEAT_IE    0x00000010
 544  544  #define IA32_PKG_THERM_INTERRUPT_TR1_VAL(x)     (((x) >> 8) & 0x7f)
 545  545  #define IA32_PKG_THERM_INTTERUPT_TR1_IE         0x00008000
 546  546  #define IA32_PKG_THERM_INTTERUPT_TR2_VAL(x)     (((x) >> 16) & 0x7f)
 547  547  #define IA32_PKG_THERM_INTERRUPT_TR2_IE         0x00800000
 548  548  #define IA32_PKG_THERM_INTERRUPT_PL_NE          0x01000000
 549  549  
      550 +/*
      551 + * This MSR exists on families, 10h, 12h+ for AMD. This controls instruction
      552 + * decoding. Most notably, for the AMD variant of retpolines, we must improve
      553 + * the serializability of lfence for the lfence based method to work.
      554 + */
      555 +#define MSR_AMD_DECODE_CONFIG                   0xc0011029
      556 +#define AMD_DECODE_CONFIG_LFENCE_DISPATCH       0x02
      557 +
 550  558  #define MCI_CTL_VALUE           0xffffffff
 551  559  
 552  560  #define MTRR_TYPE_UC            0
 553  561  #define MTRR_TYPE_WC            1
 554  562  #define MTRR_TYPE_WT            4
 555  563  #define MTRR_TYPE_WP            5
 556  564  #define MTRR_TYPE_WB            6
 557  565  #define MTRR_TYPE_UC_           7
 558  566  
 559  567  /*
↓ open down ↓ 411 lines elided ↑ open up ↑
 971  979  #define INTC_MODEL_HASWELL              0x3c
 972  980  #define INTC_MODEL_HASWELL_ULT          0x45
 973  981  #define INTC_MODEL_HASWELL_GT3E         0x46
 974  982  #define INTC_MODEL_HASWELL_XEON         0x3f
 975  983  
 976  984  #define INTC_MODEL_BROADWELL            0x3d
 977  985  #define INTC_MODEL_BROADELL_2           0x47
 978  986  #define INTC_MODEL_BROADWELL_XEON       0x4f
 979  987  #define INTC_MODEL_BROADWELL_XEON_D     0x56
 980  988  
 981      -#define INCC_MODEL_SKYLAKE_MOBILE       0x4e
      989 +#define INTC_MODEL_SKYLAKE_MOBILE       0x4e
 982  990  #define INTC_MODEL_SKYLAKE_XEON         0x55
 983  991  #define INTC_MODEL_SKYLAKE_DESKTOP      0x5e
 984  992  
 985  993  #define INTC_MODEL_KABYLAKE_MOBILE      0x8e
 986  994  #define INTC_MODEL_KABYLAKE_DESKTOP     0x9e
 987  995  
 988  996  /*
 989  997   * Atom Processors
 990  998   */
 991  999  #define INTC_MODEL_SILVERTHORNE         0x1c
↓ open down ↓ 56 lines elided ↑ open up ↑
1048 1056  
1049 1057  
1050 1058  extern uint_t x86_type;
1051 1059  extern uint_t x86_vendor;
1052 1060  extern uint_t x86_clflush_size;
1053 1061  
1054 1062  extern uint_t pentiumpro_bug4046376;
1055 1063  
1056 1064  extern const char CyrixInstead[];
1057 1065  
     1066 +/*
     1067 + * These functions are all used to perform various side-channel mitigations.
     1068 + * Please see uts/i86pc/os/cpuid.c for more information.
     1069 + */
1058 1070  extern void (*spec_uarch_flush)(void);
     1071 +extern void x86_rsb_stuff(void);
     1072 +extern void x86_md_clear(void);
1059 1073  
1060 1074  #endif
1061 1075  
1062 1076  #if defined(_KERNEL)
1063 1077  
1064 1078  /*
1065      - * x86_md_clear is the main entry point that should be called to deal with
1066      - * clearing u-arch buffers. Implementations are below because they're
1067      - * implemented in ASM. They shouldn't be used.
1068      - */
1069      -extern void (*x86_md_clear)(void);
1070      -extern void x86_md_clear_noop(void);
1071      -extern void x86_md_clear_verw(void);
1072      -
1073      -/*
1074 1079   * This structure is used to pass arguments and get return values back
1075 1080   * from the CPUID instruction in __cpuid_insn() routine.
1076 1081   */
1077 1082  struct cpuid_regs {
1078 1083          uint32_t        cp_eax;
1079 1084          uint32_t        cp_ebx;
1080 1085          uint32_t        cp_ecx;
1081 1086          uint32_t        cp_edx;
1082 1087  };
1083 1088  
↓ open down ↓ 199 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX