Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:Enable and initialize the xsave feature.* Called once per system bootup.

Proto:void __init fpu__init_system_xstate(void)

Type:void

Parameter:Nothing

719  on_boot_cpu((__section__(".init.data"))) = 1
723  WARN_ON_FPU(!on_boot_cpu)
724  on_boot_cpu = 0
726  If Not boot_cpu_has(Onboard FPU ) Then
727  pr_info("x86/fpu: No FPU detected\n")
728  Return
731  If Not boot_cpu_has(XSAVE/XRSTOR/XSETBV/XGETBV instructions ) Then
732  pr_info("x86/fpu: x87 FPU will use %s\n", boot_cpu_has(FXSAVE/FXRSTOR, CR4.OSFXSR ) ? "FXSAVE" : "FSAVE")
734  Return
737  If Maximum supported CPUID level, -1=no CPUID: < XSTATE_CPUID Then
738  WARN_ON_FPU(1)
739  Return
742  cpuid_count(XSTATE_CPUID, 0, & eax, & ebx, & ecx, & edx)
743  Mask of xstate features supported by the CPU and the kernel: = eax + (edx << 32)
745  If (Mask of xstate features supported by the CPU and the kernel: & XFEATURE_MASK_FPSSE) != XFEATURE_MASK_FPSSE Then
751  pr_err("x86/fpu: FP/SSE not present amongst the CPU's xstate features: 0x%llx.\n", Mask of xstate features supported by the CPU and the kernel:)
752  Go to out_disable
758  When i < ARRAY_SIZE - get the number of elements in array @arr*@arr: array to be sized(xsave_cpuid_features) cycle
759  If Not boot_cpu_has(xsave_cpuid_features[i]) Then Mask of xstate features supported by the CPU and the kernel: &= ~BIT(i)
763  Mask of xstate features supported by the CPU and the kernel: &= Find supported xfeatures based on cpu features and command-line input.* This must be called after fpu__init_parse_early_param() is called and* xfeatures_mask is enumerated.
766  Enable the extended processor state save/restore feature.* Called once per CPU onlining.
767  err = init_xstate_size()
768  If err Then Go to out_disable
775  update_regset_xstate_info(The XSAVE area of kernel can be in standard or compacted format;* it is always in standard format for user mode. This is the user* mode standard format size used for signal and ptrace frames., Mask of xstate features supported by the CPU and the kernel: & ~Supervisor features )
777  Prepare the SW reserved portion of the fxsave memory layout, indicating* the presence of the extended state information in the memory layout* pointed by the fpstate pointer in the sigcontext
778  setup the xstate image representing the init state
779  This function sets up offsets and sizes of all extended states in* xsave area. This supports both standard format and compacted format* of the xsave aread.
780  Print out xstate component offsets and sizes
782  pr_info("x86/fpu: Enabled xstate features 0x%llx, context size is %d bytes, using '%s' format.\n", Mask of xstate features supported by the CPU and the kernel:, Size of the FPU context state. All tasks in the system use the* same context size, regardless of what portion they use.* This is inherent to the XSAVE architecture which puts all state* components into a single, continuous memory block:, boot_cpu_has(XSAVES/XRSTORS instructions ) ? "compacted" : "standard")
786  Return
788  out_disable :
790  We enabled the XSAVE hardware, but something went wrong and* we can not use it. Disable it.
Caller
NameDescribe
fpu__init_systemCalled on the boot CPU once per system bootup, to set up the initial* FPU state that is later cloned into all processes: