On Thu, Oct 01, 2020 at 05:37:26PM +0200, Philippe Mathieu-Daudé wrote: > On 10/1/20 5:29 PM, Eduardo Habkost wrote: > > 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"? > > The correct description so far is: > > "Restricting the x86-specific commands to machine-target.json > pulls less QAPI-generated code into non-x86 targets.", as of > this commit the X86CPURegister32 definitions are not built in > the other ARM/S390/PPC/... targets.
This seems to have other side effects in addition to remove the code from non-x86 targets and I don't understand why. > > I still have some hope "qapi: Restrict code generated for user-mode" > get merged some day. > > > > > 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. [1] > > > >> > >> Acked-by: Richard Henderson <richard.hender...@linaro.org> > >> Signed-off-by: Philippe Mathieu-Daudé <phi...@redhat.com> > > > > Why the visit_type_X86CPUFeatureWordInfoList() stub was required > > in v3, but not in this version? > > Because it is ifdef'ed out in the previous (new) patch: > "target/i386/cpu: Restrict some of feature-words uses to system-mode". Sorry for the confusion, I thought this patch was _before_ "Restrict some of feature-words ..". Now, what I don't understand is: why moving the code from machine.json to machine-target.json makes patch 2/3 necessary? I assume the answer to the question above[1] would clarify this. > > > > > > >> --- > >> 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