Re: [PATCH v2 1/2] x86/fpu: Extend kernel_fpu_begin_mask() to initialize AMX state

From: Chang S. Bae
Date: Thu May 09 2024 - 14:42:22 EST


On 5/9/2024 10:36 AM, Dave Hansen wrote:

I'd probably just do this:

+ kernel_fpu_begin();
+ // AMX *MUST* be in the init state for the wrmsr() to work.
+ // But, the more in the init state, the less state the test
+ // has to save and restore. Just zap everything.
+ restore_fpregs_from_fpstate(&init_fpstate,
+ fpu_user_cfg.max_features);
+

I assume that this snippet goes to the IFS driver side. Then, we need to introduce and export a new wrapper for this. restore_fpregs_from_fpstate() and its arguments are not accessible as of now.

Also, I think we should encapsulate them. If we follow this style, we could have invoked tilerelease() directly from the idle driver, right?

wrmsrl(MSR_ACTIVATE_SCAN, params->activate->data);
rdmsrl(MSR_SCAN_STATUS, status.data);

+ kernel_fpu_end();