• Xiaoyao Li's avatar
    x86/split_lock: Rework the initialization flow of split lock detection · dbaba470
    Xiaoyao Li authored
    Current initialization flow of split lock detection has following issues:
    
    1. It assumes the initial value of MSR_TEST_CTRL.SPLIT_LOCK_DETECT to be
       zero. However, it's possible that BIOS/firmware has set it.
    
    2. X86_FEATURE_SPLIT_LOCK_DETECT flag is unconditionally set even if
       there is a virtualization flaw that FMS indicates the existence while
       it's actually not supported.
    
    Rework the initialization flow to solve above issues. In detail, explicitly
    clear and set split_lock_detect bit to verify MSR_TEST_CTRL can be
    accessed, and rdmsr after wrmsr to ensure bit is cleared/set successfully.
    
    X86_FEATURE_SPLIT_LOCK_DETECT flag is set only when the feature does exist
    and the feature is not disabled with kernel param "split_lock_detect=off"
    
    On each processor, explicitly updating the SPLIT_LOCK_DETECT bit based on
    sld_sate in split_lock_init() since BIOS/firmware may touch it.
    Originally-by: default avatarThomas Gleixner <tglx@linutronix.de>
    Signed-off-by: default avatarXiaoyao Li <xiaoyao.li@intel.com>
    Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
    Link: https://lkml.kernel.org/r/20200325030924.132881-2-xiaoyao.li@intel.com
    dbaba470
intel.c 32 KB