> >We have a dependency system for CPUID features. If you are going to do > this (as opposed to "fixing" this in Qemu or just saying "don't do that, > it isn't a valid hardware configuration." > One more thing: for obvious reasons, this doesn't fix user space if user > space calls CPUID directly as opposed to reading /proc/cpuinfo or looking > in sysfs. Unfortunately this is the rule rather than the exception, > although for some features like AVX user space is also supposed to check > XCR0, in which case it will work properly anyway. The x86 crypto modules use boot_cpu_has() to check features before using them. If that (or some other function that we change them to use) returned false if the necessary XSAVE bits were not set, then they could drop the cpu_has_xfeatures() calls. arch/x86/kernel/fpu/xstate.c, which provides cpu_has_xfeatures(), and also has an xsave_cpu_features table listing the features needed be each xfeature. Perhaps that should provide a cpu_feature_usable() function that calls boot_cpu_has() and confirms the associated xfeatures are present. That way the logic would be in one place rather than replicated in 20+ crypto modules.