On Fri, 6 Oct 2017, Andi Kleen wrote: > From: Andi Kleen <a...@linux.intel.com> > > Some CPUID features depend on other features. Currently it's > possible to to clear dependent features, but not clear the base features, > which can cause various interesting problems. > > This patch implements a generic table to describe dependencies > between CPUID features, to be used by all code that clears > CPUID. > > Some subsystems (like XSAVE) had an own implementation of this, > but it's better to do it all in a single place for everyone. > > Then clear_cpu_cap and setup_clear_cpu_cap always look up > this table and clear all dependencies too. > > This is intended to be a practical table: only for features > that make sense to clear. If someone for example clears FPU, > or other features that are essentially part of the required > base feature set, not much is going to work. Handling > that is right now out of scope. We're only handling > features which can be usefully cleared. > > v2: Add EXPORT_SYMBOL for clear_cpu_cap for lguest > v3: > Fix handling of depending issues > Fix dups in the table (Jonathan McDowell) > v4: > Remove EXPORT_SYMBOL again as lguest is gone > Restructure dependencies as feature, dependency (Thomas Gleixner) > Move some code from header file to C file and turn macros into inlines (dito) > Simplify if conditions (dito) > Add missing dependency for AVX512F->AVX > v5: > Remove redundant dependency for AVX512F->XSAVE (Thomas Gleixner) > Add missing dependency for XMM->FXSR (Thomas Gleixner) > v6: > Add SHA_NI->XMM and FXSR_OPT->FXSAVE dependencies > Cc: Jonathan McDowell <nood...@earth.li> > Signed-off-by: Andi Kleen <a...@linux.intel.com>
Reviewed-by: Thomas Gleixner <t...@linutronix.de>