Message ID | 20201001144152.1555659-4-philmd@redhat.com |
---|---|
State | New |
Headers | show |
Series | target/i386: Restrict 'feature-words' property to x86 machines | expand |
On Thu, Oct 01, 2020 at 04:41:52PM +0200, Philippe Mathieu-Daudé wrote: > Only qemu-system-FOO and qemu-storage-daemon provide QMP > monitors, therefore such declarations and definitions are > irrelevant for user-mode emulation. > > Restricting the x86-specific commands to machine-target.json > pulls less QAPI-generated code into user-mode. Is this still true without "qapi: Restrict code generated for user-mode"? Markus, Eric: what's the difference between machine.json and machine-target.json? commit 7f7b4e7abef4 ("qapi: Split machine-target.json off target.json and misc.json") explains what but not why. > > Acked-by: Richard Henderson <richard.henderson@linaro.org> > Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Why the visit_type_X86CPUFeatureWordInfoList() stub was required in v3, but not in this version? > --- > qapi/machine-target.json | 45 ++++++++++++++++++++++++++++++++++++++++ > qapi/machine.json | 42 ------------------------------------- > target/i386/cpu.c | 2 +- > 3 files changed, 46 insertions(+), 43 deletions(-) > > diff --git a/qapi/machine-target.json b/qapi/machine-target.json > index 698850cc78..b4d769a53b 100644 > --- a/qapi/machine-target.json > +++ b/qapi/machine-target.json > @@ -4,6 +4,51 @@ > # This work is licensed under the terms of the GNU GPL, version 2 or later. > # See the COPYING file in the top-level directory. > > +## > +# @X86CPURegister32: > +# > +# A X86 32-bit register > +# > +# Since: 1.5 > +## > +{ 'enum': 'X86CPURegister32', > + 'data': [ 'EAX', 'EBX', 'ECX', 'EDX', 'ESP', 'EBP', 'ESI', 'EDI' ], > + 'if': 'defined(TARGET_I386)' } > + > +## > +# @X86CPUFeatureWordInfo: > +# > +# Information about a X86 CPU feature word > +# > +# @cpuid-input-eax: Input EAX value for CPUID instruction for that feature word > +# > +# @cpuid-input-ecx: Input ECX value for CPUID instruction for that > +# feature word > +# > +# @cpuid-register: Output register containing the feature bits > +# > +# @features: value of output register, containing the feature bits > +# > +# Since: 1.5 > +## > +{ 'struct': 'X86CPUFeatureWordInfo', > + 'data': { 'cpuid-input-eax': 'int', > + '*cpuid-input-ecx': 'int', > + 'cpuid-register': 'X86CPURegister32', > + 'features': 'int' }, > + 'if': 'defined(TARGET_I386)' } > + > +## > +# @DummyForceArrays: > +# > +# Not used by QMP; hack to let us use X86CPUFeatureWordInfoList internally > +# > +# Since: 2.5 > +## > +{ 'struct': 'DummyForceArrays', > + 'data': { 'unused': ['X86CPUFeatureWordInfo'] }, > + 'if': 'defined(TARGET_I386)' } > + > ## > # @CpuModelInfo: > # > diff --git a/qapi/machine.json b/qapi/machine.json > index 756dacb06f..995e972858 100644 > --- a/qapi/machine.json > +++ b/qapi/machine.json > @@ -574,48 +574,6 @@ > 'dst': 'uint16', > 'val': 'uint8' }} > > -## > -# @X86CPURegister32: > -# > -# A X86 32-bit register > -# > -# Since: 1.5 > -## > -{ 'enum': 'X86CPURegister32', > - 'data': [ 'EAX', 'EBX', 'ECX', 'EDX', 'ESP', 'EBP', 'ESI', 'EDI' ] } > - > -## > -# @X86CPUFeatureWordInfo: > -# > -# Information about a X86 CPU feature word > -# > -# @cpuid-input-eax: Input EAX value for CPUID instruction for that feature word > -# > -# @cpuid-input-ecx: Input ECX value for CPUID instruction for that > -# feature word > -# > -# @cpuid-register: Output register containing the feature bits > -# > -# @features: value of output register, containing the feature bits > -# > -# Since: 1.5 > -## > -{ 'struct': 'X86CPUFeatureWordInfo', > - 'data': { 'cpuid-input-eax': 'int', > - '*cpuid-input-ecx': 'int', > - 'cpuid-register': 'X86CPURegister32', > - 'features': 'int' } } > - > -## > -# @DummyForceArrays: > -# > -# Not used by QMP; hack to let us use X86CPUFeatureWordInfoList internally > -# > -# Since: 2.5 > -## > -{ 'struct': 'DummyForceArrays', > - 'data': { 'unused': ['X86CPUFeatureWordInfo'] } } > - > ## > # @NumaCpuOptions: > # > diff --git a/target/i386/cpu.c b/target/i386/cpu.c > index 9f72342506..848a65ded2 100644 > --- a/target/i386/cpu.c > +++ b/target/i386/cpu.c > @@ -38,7 +38,7 @@ > #include "qemu/option.h" > #include "qemu/config-file.h" > #include "qapi/error.h" > -#include "qapi/qapi-visit-machine.h" > +#include "qapi/qapi-visit-machine-target.h" > #include "qapi/qapi-visit-run-state.h" > #include "qapi/qmp/qdict.h" > #include "qapi/qmp/qerror.h" > -- > 2.26.2 > -- Eduardo
diff --git a/qapi/machine-target.json b/qapi/machine-target.json index 698850cc78..b4d769a53b 100644 --- a/qapi/machine-target.json +++ b/qapi/machine-target.json @@ -4,6 +4,51 @@ # This work is licensed under the terms of the GNU GPL, version 2 or later. # See the COPYING file in the top-level directory. +## +# @X86CPURegister32: +# +# A X86 32-bit register +# +# Since: 1.5 +## +{ 'enum': 'X86CPURegister32', + 'data': [ 'EAX', 'EBX', 'ECX', 'EDX', 'ESP', 'EBP', 'ESI', 'EDI' ], + 'if': 'defined(TARGET_I386)' } + +## +# @X86CPUFeatureWordInfo: +# +# Information about a X86 CPU feature word +# +# @cpuid-input-eax: Input EAX value for CPUID instruction for that feature word +# +# @cpuid-input-ecx: Input ECX value for CPUID instruction for that +# feature word +# +# @cpuid-register: Output register containing the feature bits +# +# @features: value of output register, containing the feature bits +# +# Since: 1.5 +## +{ 'struct': 'X86CPUFeatureWordInfo', + 'data': { 'cpuid-input-eax': 'int', + '*cpuid-input-ecx': 'int', + 'cpuid-register': 'X86CPURegister32', + 'features': 'int' }, + 'if': 'defined(TARGET_I386)' } + +## +# @DummyForceArrays: +# +# Not used by QMP; hack to let us use X86CPUFeatureWordInfoList internally +# +# Since: 2.5 +## +{ 'struct': 'DummyForceArrays', + 'data': { 'unused': ['X86CPUFeatureWordInfo'] }, + 'if': 'defined(TARGET_I386)' } + ## # @CpuModelInfo: # diff --git a/qapi/machine.json b/qapi/machine.json index 756dacb06f..995e972858 100644 --- a/qapi/machine.json +++ b/qapi/machine.json @@ -574,48 +574,6 @@ 'dst': 'uint16', 'val': 'uint8' }} -## -# @X86CPURegister32: -# -# A X86 32-bit register -# -# Since: 1.5 -## -{ 'enum': 'X86CPURegister32', - 'data': [ 'EAX', 'EBX', 'ECX', 'EDX', 'ESP', 'EBP', 'ESI', 'EDI' ] } - -## -# @X86CPUFeatureWordInfo: -# -# Information about a X86 CPU feature word -# -# @cpuid-input-eax: Input EAX value for CPUID instruction for that feature word -# -# @cpuid-input-ecx: Input ECX value for CPUID instruction for that -# feature word -# -# @cpuid-register: Output register containing the feature bits -# -# @features: value of output register, containing the feature bits -# -# Since: 1.5 -## -{ 'struct': 'X86CPUFeatureWordInfo', - 'data': { 'cpuid-input-eax': 'int', - '*cpuid-input-ecx': 'int', - 'cpuid-register': 'X86CPURegister32', - 'features': 'int' } } - -## -# @DummyForceArrays: -# -# Not used by QMP; hack to let us use X86CPUFeatureWordInfoList internally -# -# Since: 2.5 -## -{ 'struct': 'DummyForceArrays', - 'data': { 'unused': ['X86CPUFeatureWordInfo'] } } - ## # @NumaCpuOptions: # diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 9f72342506..848a65ded2 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -38,7 +38,7 @@ #include "qemu/option.h" #include "qemu/config-file.h" #include "qapi/error.h" -#include "qapi/qapi-visit-machine.h" +#include "qapi/qapi-visit-machine-target.h" #include "qapi/qapi-visit-run-state.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qerror.h"