On Tue, May 02, 2017 at 05:31:15PM -0300, Eduardo Habkost wrote: Hi,
Yet to try this series, a small question in-line. > Introduce a new CPUFeatureSetting QAPI data type, and use it to support > feature=force on -cpu. > > Signed-off-by: Eduardo Habkost <ehabk...@redhat.com> > --- > qapi-schema.json | 32 +++++++++++++++++++++++++ > target/i386/cpu.h | 2 ++ > target/i386/cpu.c | 55 > +++++++++++++++++++++++++++++++++---------- > tests/test-x86-cpuid-compat.c | 14 ++++++++++- > 4 files changed, 90 insertions(+), 13 deletions(-) [...] > --- a/tests/test-x86-cpuid-compat.c > +++ b/tests/test-x86-cpuid-compat.c > @@ -98,6 +98,8 @@ typedef struct FeatureTestArgs { > int bitnr; > /* The expected value for the bit in (X86CPUFeatureWordInfo.features) */ > bool expected_value; > + /* Don't look at filtered-features when checking feature value */ > + bool ignore_filtered_features; > } FeatureTestArgs; > > /* Get the value for a feature word in a X86CPUFeatureWordInfo list */ > @@ -129,7 +131,9 @@ static void test_feature_flag(const void *data) > present = qobject_to_qlist(qom_get(path, "feature-words")); > filtered = qobject_to_qlist(qom_get(path, "filtered-features")); > value = get_feature_word(present, args->input_eax, args->input_ecx, > args->reg); > - value |= get_feature_word(filtered, args->input_eax, args->input_ecx, > args->reg); > + if (!args->ignore_filtered_features) { > + value |= get_feature_word(filtered, args->input_eax, > args->input_ecx, args->reg); > + } > qtest_end(); > > g_assert(!!(value & (1U << args->bitnr)) == args->expected_value); > @@ -336,5 +340,13 @@ int main(int argc, char **argv) > "-machine accel=kvm:tcg -cpu max,mmx=off", > 1, 0, "EDX", 23, false); > > + { > + FeatureTestArgs *a; > + a = add_feature_test("x86/cpuid/features/monitor-force", > + "-machine accel=kvm:tcg -cpu 486,monitor=force", Following your above test example, should the 'force' boolean also work (understood: only for testing / debugging) as below, for a recognized CPUID flag, taking the example of 'INVPCID'? $ qemu-system-x86_64 [...] -cpu Haswell-noTSX,invpcid=force [...] > + 1, 0, "ECX", 3, true); > + a->ignore_filtered_features = true; > + } > + > return g_test_run(); > } > -- > 2.11.0.259.g40922b1 > > -- /kashyap