From nobody Mon Feb 9 09:29:41 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1601484653; cv=none; d=zohomail.com; s=zohoarc; b=Fh/R1m+U8ZCO7b12t3vOIAhPmhsDG+rfsepAPTnT0ahHa+h2wkcul6EvfcBYkHSNpxuolySlVVIZITFWWIDrsdMTMzBosplorxNGEh1InnG9v8bQxihXqu91FHTJR8eP0IH6T8QpYn1nNgtxNXi3iGGNQUEeytiYoH3Z999kf9s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601484653; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=FD/Sn/zEqk9dQKIbQoXOYve2d137UlETatSPRZNX5Dk=; b=GsfQ4uzfnhomrsWgXMtSFEB7fBK9/V32wTJVG8qeH0xGQnviq/V4xK22LCZZYtDtwEAgpccUe4jnOaYRiEn1r/VOJJOozspq33MGwa6g3h9ACRIkbLMhQd1lB5Jwm6MPCzXHmi0ClD3w/89g1R5np2hFIyfi0R30OEoH6mayba4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1601484652996614.5752879401342; Wed, 30 Sep 2020 09:50:52 -0700 (PDT) Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-520-41Bq5SezMTGJ8jTMplxQ9w-1; Wed, 30 Sep 2020 12:50:48 -0400 Received: by mail-wr1-f72.google.com with SMTP id j7so828842wro.14 for ; Wed, 30 Sep 2020 09:50:47 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (74.red-83-53-161.dynamicip.rima-tde.net. [83.53.161.74]) by smtp.gmail.com with ESMTPSA id o16sm3781269wrp.52.2020.09.30.09.50.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Sep 2020 09:50:45 -0700 (PDT) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601484651; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FD/Sn/zEqk9dQKIbQoXOYve2d137UlETatSPRZNX5Dk=; b=Ke7CGG2vYGwFU++kOcUQFupNS04LiXxSNToHXdgKrap/M2BkrwiJ9gYuz4lNhmFmkpUwa9 lb7fg7YN+DbaFXffapCftSS2BNabbAHXDnu5J2xFV53XpBUyQL9vtk287MbwdqDst+wHZv qqScLfCfOOa7hYduWZNAGTbn2jqnoZw= X-MC-Unique: 41Bq5SezMTGJ8jTMplxQ9w-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FD/Sn/zEqk9dQKIbQoXOYve2d137UlETatSPRZNX5Dk=; b=VQq0C6Xc2lFGN1T33V5w98hJtRMSqbvjvbkS2UGQoH5ni2KWYCT7uPSLXfGSWbC2uN XpUjjSB0ysufi7SZQgSDCMMSoe9IZ7/0yK/+oWMC5BNHIsZ+ZHp4LD1M5D2d0SzRu9E0 SqatEg6D1kMfYZq0kaUubEwLSV1Aa2LCHNtn9uHvsTlpKDyhsb+WdlRukMGM1nKqNGvW 0dXxpCsJ0K2YIC7JOCBy/KMk/WWN75TlcyXu83WHykTYgYSKZldZ094vKBMYZ1AmHSLK LiatjJt4y0nhSPAB3bfc6CFhvWEQgpoAeLq+n5D5chzpvJ+zGS5USsdg0xsGmbHGdGsM 43Hg== X-Gm-Message-State: AOAM532RrQ4NpVpTY2O0U/KeWR1AijmRES2ISOseUy7rQO0nZnSbJDKv FJNvfPr2m3j4Uu3fN1xziQS3iLtD4hvphgrmculTTVUJDmFocyNtKLeagK/A3HeZ3SlE+0EAAwo SSIhvos4xBrZ4OA== X-Received: by 2002:adf:f0c7:: with SMTP id x7mr4010749wro.315.1601484646500; Wed, 30 Sep 2020 09:50:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzHoKmzKfrCAZuzq+wwimEabmMc7cpUzoabhj+YUeLa5g0x+0zXj3Wn0hpiCmUIECSRiZA1DA== X-Received: by 2002:adf:f0c7:: with SMTP id x7mr4010725wro.315.1601484646259; Wed, 30 Sep 2020 09:50:46 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Laurent Vivier Cc: Ronnie Sahlberg , Eric Blake , Kevin Wolf , Marcel Apfelbaum , Richard Henderson , Michael Roth , Eduardo Habkost , Peter Lieven , Markus Armbruster , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , qemu-block@nongnu.org, Paolo Bonzini , Max Reitz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PATCH v3 10/11] target/i386: Restrict X86CPUFeatureWord to X86 targets Date: Wed, 30 Sep 2020 18:49:48 +0200 Message-Id: <20200930164949.1425294-11-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200930164949.1425294-1-philmd@redhat.com> References: <20200930164949.1425294-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) 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. Add a stub to satisfy linking in user-mode: /usr/bin/ld: libqemu-i386-linux-user.fa.p/target_i386_cpu.c.o: in functio= n `x86_cpu_get_feature_words': target/i386/cpu.c:4643: undefined reference to `visit_type_X86CPUFeatureW= ordInfoList' collect2: error: ld returned 1 exit status make: *** [Makefile.ninja:1125: qemu-i386] Error 1 Acked-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- v3: Reworded + Meson rebase --- qapi/machine-target.json | 45 ++++++++++++++++++++++++++++++++++++++ qapi/machine.json | 42 ----------------------------------- target/i386/cpu.c | 2 +- target/i386/feature-stub.c | 23 +++++++++++++++++++ target/i386/meson.build | 1 + 5 files changed, 70 insertions(+), 43 deletions(-) create mode 100644 target/i386/feature-stub.c 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. =20 +## +# @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 72f014bb5b..cb878acdac 100644 --- a/qapi/machine.json +++ b/qapi/machine.json @@ -544,48 +544,6 @@ 'dst': 'uint16', 'val': 'uint8' }} =20 -## -# @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 3ffd877dd5..d45fa217cc 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" diff --git a/target/i386/feature-stub.c b/target/i386/feature-stub.c new file mode 100644 index 0000000000..787c3c7fa1 --- /dev/null +++ b/target/i386/feature-stub.c @@ -0,0 +1,23 @@ +/* + * QAPI x86 CPU features stub + * + * Copyright (c) 2020 Red Hat, Inc. + * + * Author: + * Philippe Mathieu-Daud=C3=A9 + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "qapi/qapi-visit-machine-target.h" + +bool visit_type_X86CPUFeatureWordInfoList(Visitor *v, const char *name, + X86CPUFeatureWordInfoList **obj, + Error **errp) +{ + g_assert_not_reached(); +} diff --git a/target/i386/meson.build b/target/i386/meson.build index e0b71ade56..0c5d9e6caf 100644 --- a/target/i386/meson.build +++ b/target/i386/meson.build @@ -5,6 +5,7 @@ i386_ss.add(files( 'helper.c', 'xsave_helper.c', )) +i386_ss.add(when: 'CONFIG_SOFTMMU', if_false: files('feature-stub.c')) i386_ss.add(when: 'CONFIG_TCG', if_true: files( 'bpt_helper.c', 'cc_helper.c', --=20 2.26.2