Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:arch\x86\kernel\cpu\bugs.c Create Date:2022-07-28 07:56:12
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:spectre_v2_user_select_mitigation

Proto:static void __init spectre_v2_user_select_mitigation(enum spectre_v2_mitigation_cmd v2_cmd)

Type:void

Parameter:

TypeParameterName
enum spectre_v2_mitigation_cmdv2_cmd
605  mode = SPECTRE_V2_USER_NONE
606  smt_possible = IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y' or 'm',* 0 otherwise.(CONFIG_SMP)
609  If Not boot_cpu_has(Indirect Branch Prediction Barrier ) && Not boot_cpu_has(Single Thread Indirect Branch Predictors ) Then Return
612  If cpu_smt_control == CPU_SMT_FORCE_DISABLED || cpu_smt_control == CPU_SMT_NOT_SUPPORTED Then smt_possible = false
616  cmd = spectre_v2_parse_user_cmdline(v2_cmd)
618  Case cmd == SPECTRE_V2_USER_CMD_NONE
619  Go to set_mode
620  Case cmd == SPECTRE_V2_USER_CMD_FORCE
621  mode = SPECTRE_V2_USER_STRICT
622  Break
623  Case cmd == SPECTRE_V2_USER_CMD_PRCTL
624  Case cmd == SPECTRE_V2_USER_CMD_PRCTL_IBPB
625  mode = SPECTRE_V2_USER_PRCTL
626  Break
627  Case cmd == SPECTRE_V2_USER_CMD_AUTO
628  Case cmd == SPECTRE_V2_USER_CMD_SECCOMP
629  Case cmd == SPECTRE_V2_USER_CMD_SECCOMP_IBPB
630  If IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y' or 'm',* 0 otherwise.(CONFIG_SECCOMP) Then mode = SPECTRE_V2_USER_SECCOMP
632  Else mode = SPECTRE_V2_USER_PRCTL
634  Break
642  If mode != SPECTRE_V2_USER_STRICT && boot_cpu_has("" Single Thread Indirect Branch Predictors always-on preferred ) Then mode = SPECTRE_V2_USER_STRICT_PREFERRED
647  If boot_cpu_has(Indirect Branch Prediction Barrier ) Then
648  setup_force_cpu_cap("" Indirect Branch Prediction Barrier enabled )
651  Case cmd == SPECTRE_V2_USER_CMD_FORCE
652  Case cmd == SPECTRE_V2_USER_CMD_PRCTL_IBPB
655  Break
656  Case cmd == SPECTRE_V2_USER_CMD_PRCTL
657  Case cmd == SPECTRE_V2_USER_CMD_AUTO
660  Break
661  Default
662  Break
665  pr_info("mitigation: Enabling %s Indirect Branch Prediction Barrier\n", static_key_enabled( & Control unconditional IBPB in switch_mm() ) ? "always-on" : "conditional")
671  If spectre_v2_enabled == SPECTRE_V2_IBRS_ENHANCED Then Return
678  If Not smt_possible || Not boot_cpu_has(Single Thread Indirect Branch Predictors ) Then mode = SPECTRE_V2_USER_NONE
680  set_mode :
681  spectre_v2_user = mode
683  If smt_possible Then pr_info("%s\n", spectre_v2_user_strings[mode])
Caller
NameDescribe
spectre_v2_select_mitigation