On Thu, Jan 12, 2023, Chang S. Bae wrote: > On 1/12/2023 10:21 AM, Mingwei Zhang wrote: > > > > Hmm. Given that XFEATURE_XTILE_DATA is a dynamic feature, that means > > XFEATURE_XTILE_CFG could be set without XFEATURE_XTILE_DATA. > > No, XCR0 is different from the IA32_XFD MSR. Check this in the SDM -- Vol.1 > 13.3 "Enabling the XSAVE Feature Set and XSAVE-Enabled Features": > > "In addition, executing the XSETBV instruction causes a general- > protection fault (#GP) if ECX = 0 and EAX[17] ≠ EAX[18] (TILECFG and > TILEDATA must be enabled together). This implies that the value of > XCR0[18:17] is always either 00b or 11b." > > Thanks, > Chang Hmm. Make sense. The proper execution of XSETBV was the key point of the patch. But the permitted_xcr0 and supported_xcr0 seems never used directly as the parameter of XSETBV, but only for size calculation. One more question: I am very confused by the implementation of xstate_get_guest_group_perm(). It seems fetching the xfeatures from the host process (¤t->group_leader->thread.fpu). Is this intentional? Does that mean in order to enable AMX in the guest we have to enable it on the host process first?