函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:arch\x86\kernel\cpu\bugs.c Create Date:2022-07-27 08:56:35
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:spectre_v2_select_mitigation

函数原型:static void __init spectre_v2_select_mitigation(void)

返回类型:void

参数:

761  cmd等于spectre_v2_parse_cmdline()
762  mode等于SPECTRE_V2_NONE
768  如果非boot_cpu_has_bug(CPU is affected by Spectre variant 2 attack with indirect branches )且cmd恒等于SPECTRE_V2_CMD_NONEcmd恒等于SPECTRE_V2_CMD_AUTO的值则返回
773  :cmd恒等于SPECTRE_V2_CMD_NONE
774  返回
776  :cmd恒等于SPECTRE_V2_CMD_FORCE
777  :cmd恒等于SPECTRE_V2_CMD_AUTO
778  如果boot_cpu_has(Enhanced IBRS )则
783  转到:specv2_set_mode
785  如果IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y' or 'm',* 0 otherwise.(CONFIG_RETPOLINE)则转到:retpoline_auto
787  退出
788  :cmd恒等于SPECTRE_V2_CMD_RETPOLINE_AMD
789  如果IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y' or 'm',* 0 otherwise.(CONFIG_RETPOLINE)则转到:retpoline_amd
791  退出
792  :cmd恒等于SPECTRE_V2_CMD_RETPOLINE_GENERIC
793  如果IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y' or 'm',* 0 otherwise.(CONFIG_RETPOLINE)则转到:retpoline_generic
795  退出
796  :cmd恒等于SPECTRE_V2_CMD_RETPOLINE
797  如果IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y' or 'm',* 0 otherwise.(CONFIG_RETPOLINE)则转到:retpoline_auto
799  退出
801  打印错误信息("Spectre mitigation: kernel not compiled with retpoline; no mitigation available!")
802  返回
804  retpoline_auto :
805  如果CPU vendor 恒等于X86_VENDOR_AMDCPU vendor 恒等于X86_VENDOR_HYGON
807  retpoline_amd :
809  打印错误信息("Spectre mitigation: LFENCE not serializing, switching to generic retpoline\n")
810  转到:retpoline_generic
812  mode等于SPECTRE_V2_RETPOLINE_AMD
813  setup_force_cpu_cap("" AMD Retpoline mitigation for Spectre variant 2 )
814  setup_force_cpu_cap("" Generic Retpoline mitigation for Spectre variant 2 )
815  否则
816  retpoline_generic :
817  mode等于SPECTRE_V2_RETPOLINE_GENERIC
818  setup_force_cpu_cap("" Generic Retpoline mitigation for Spectre variant 2 )
821  specv2_set_mode :
822  spectre_v2_enabled等于mode
823  打印信息("%s\n", spectre_v2_strings[mode])
833  setup_force_cpu_cap("" Fill RSB on context switches )
834  打印信息("Spectre v2 / SpectreRSB mitigation: Filling RSB on context switch\n")
847  如果boot_cpu_has(Indirect Branch Restricted Speculation )且mode不等于SPECTRE_V2_IBRS_ENHANCED
848  setup_force_cpu_cap("" Use IBRS during runtime firmware calls )
849  打印信息("Enabling Restricted Speculation for firmware calls\n")
853  spectre_v2_user_select_mitigation(cmd)
调用者
名称描述
check_bugs检查CPU配置是否非法使用不具备的功能