When clearing a cpu cap, clear all dependent features.  This avoids having a
featureset with intermediate features disabled, but leaf features enabled.

Signed-off-by: Andrew Cooper <andrew.coop...@citrix.com>
---
CC: Jan Beulich <jbeul...@suse.com>
---
 xen/arch/x86/cpu/common.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index b48ce58..ba42ac0 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -49,8 +49,24 @@ static unsigned int __cpuinitdata cleared_caps[NCAPINTS];
 
 void __init setup_clear_cpu_cap(unsigned int cap)
 {
+       const struct tagged_featureset *dfs;
+       unsigned int i;
+
+       if ( test_bit(cap, cleared_caps) )
+               return;
+
        __clear_bit(cap, boot_cpu_data.x86_capability);
        __set_bit(cap, cleared_caps);
+
+       dfs = lookup_deep_deps(cap);
+
+       if ( !dfs )
+               return;
+
+       for ( i = 0; i < ARRAY_SIZE(dfs->fs); ++i ) {
+               cleared_caps[i] |= dfs->fs[i];
+               boot_cpu_data.x86_capability[i] &= ~dfs->fs[i];
+       }
 }
 
 static void default_init(struct cpuinfo_x86 * c)
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

Reply via email to