Skip to contentSkip to conversation

target/i386: Fix CPU feature dependency check

PATCH New Zhenzhong Duan 1 participant 1 message Jul 8, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target/i386: Fix CPU feature dependency check

While in other call site "x-force-features" takes effect to keep the CPU feature even though not supported for any reason.

This isn't consistent while expanding features, Fixed to keep user explicitly enabled features if "x-force-features" is specified.

Fixes 99e24dbdaa682 ("target/i386: introduce generic feature dependency mechanism")
---
 target/i386/cpu.c | 3 +++
 1 file changed, 3 insertions(+)
target/i386/cpu.c +3 -0
index 6a57ef13af86..b64c0b37f0cb 100644
@@ -6206,6 +6206,9 @@ void x86_cpu_expand_features(X86CPU *cpu, Error **errp)
                                       unavailable_features & env->user_features[d->to.index],
                                       "This feature depends on other features that were not requested");
 
+            if (cpu->force_features) {
+                unavailable_features &= ~env->user_features[d->to.index];
+            }
             env->features[d->to.index] &= ~unavailable_features;
         }
     }
Signature · 1 line
2.25.1