From nobody Sat Apr 27 17:19:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1504551456825888.5664618836563; Mon, 4 Sep 2017 11:57:36 -0700 (PDT) Received: from localhost ([::1]:55260 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dowYx-0005TI-9Z for importer@patchew.org; Mon, 04 Sep 2017 14:57:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33079) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dowY0-00058k-Tb for qemu-devel@nongnu.org; Mon, 04 Sep 2017 14:56:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dowXq-0001vA-14 for qemu-devel@nongnu.org; Mon, 04 Sep 2017 14:56:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39116) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dowXp-0001uU-Nh for qemu-devel@nongnu.org; Mon, 04 Sep 2017 14:56:25 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5BDAACD160; Mon, 4 Sep 2017 18:56:24 +0000 (UTC) Received: from localhost (ovpn-116-66.gru2.redhat.com [10.97.116.66]) by smtp.corp.redhat.com (Postfix) with ESMTP id B401381521; Mon, 4 Sep 2017 18:56:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 5BDAACD160 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=ehabkost@redhat.com From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Mon, 4 Sep 2017 15:56:22 -0300 Message-Id: <20170904185622.24520-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 04 Sep 2017 18:56:24 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] i386: Use designated initializers on feat_names arrays X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Igor Mammedov , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Using designated initializers for feat_names allows us to omit NULL entries, and makes mistakes easier to spot (especially when cherry-picking or merging commits). Arrays that have very few entries were changed to have a designator for every element. Arrays that have almost every item present were changed to have one designator every 4 entries. Arrays that had only NULL entries had the initializers completely removed. Signed-off-by: Eduardo Habkost --- target/i386/cpu.c | 215 ++++++++++++++++++--------------------------------= ---- 1 file changed, 73 insertions(+), 142 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 69676e13e1..9da5915dde 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -268,28 +268,28 @@ typedef struct FeatureWordInfo { static FeatureWordInfo feature_word_info[FEATURE_WORDS] =3D { [FEAT_1_EDX] =3D { .feat_names =3D { - "fpu", "vme", "de", "pse", - "tsc", "msr", "pae", "mce", - "cx8", "apic", NULL, "sep", - "mtrr", "pge", "mca", "cmov", - "pat", "pse36", "pn" /* Intel psn */, "clflush" /* Intel clfsh= */, - NULL, "ds" /* Intel dts */, "acpi", "mmx", - "fxsr", "sse", "sse2", "ss", - "ht" /* Intel htt */, "tm", "ia64", "pbe", + [0] =3D "fpu", "vme", "de", "pse", + [4] =3D "tsc", "msr", "pae", "mce", + [8] =3D "cx8", "apic", NULL, "sep", + [12] =3D "mtrr", "pge", "mca", "cmov", + [16] =3D "pat", "pse36", "pn", "clflush", + [20] =3D NULL, "ds" /* Intel dts */, "acpi", "mmx", + [24] =3D "fxsr", "sse", "sse2", "ss", + [28] =3D "ht", "tm", "ia64", "pbe", }, .cpuid_eax =3D 1, .cpuid_reg =3D R_EDX, .tcg_features =3D TCG_FEATURES, }, [FEAT_1_ECX] =3D { .feat_names =3D { - "pni" /* Intel,AMD sse3 */, "pclmulqdq", "dtes64", "monitor", - "ds-cpl", "vmx", "smx", "est", - "tm2", "ssse3", "cid", NULL, - "fma", "cx16", "xtpr", "pdcm", - NULL, "pcid", "dca", "sse4.1", - "sse4.2", "x2apic", "movbe", "popcnt", - "tsc-deadline", "aes", "xsave", "osxsave", - "avx", "f16c", "rdrand", "hypervisor", + [0] =3D "pni" /* Intel,AMD sse3 */, "pclmulqdq", "dtes64", "mo= nitor", + [4] =3D "ds-cpl", "vmx", "smx", "est", + [8] =3D "tm2", "ssse3", "cid", NULL, + [12] =3D "fma", "cx16", "xtpr", "pdcm", + [16] =3D NULL, "pcid", "dca", "sse4.1", + [20] =3D "sse4.2", "x2apic", "movbe", "popcnt", + [24] =3D "tsc-deadline", "aes", "xsave", "osxsave", + [28] =3D "avx", "f16c", "rdrand", "hypervisor", }, .cpuid_eax =3D 1, .cpuid_reg =3D R_ECX, .tcg_features =3D TCG_EXT_FEATURES, @@ -301,131 +301,87 @@ static FeatureWordInfo feature_word_info[FEATURE_WOR= DS] =3D { */ [FEAT_8000_0001_EDX] =3D { .feat_names =3D { - NULL /* fpu */, NULL /* vme */, NULL /* de */, NULL /* pse */, - NULL /* tsc */, NULL /* msr */, NULL /* pae */, NULL /* mce */, - NULL /* cx8 */, NULL /* apic */, NULL, "syscall", - NULL /* mtrr */, NULL /* pge */, NULL /* mca */, NULL /* cmov = */, - NULL /* pat */, NULL /* pse36 */, NULL, NULL /* Linux mp */, - "nx", NULL, "mmxext", NULL /* mmx */, - NULL /* fxsr */, "fxsr-opt", "pdpe1gb", "rdtscp", - NULL, "lm", "3dnowext", "3dnow", + [11] =3D "syscall", + [20] =3D "nx", + [22] =3D "mmxext", + [25] =3D "fxsr-opt", + [26] =3D "pdpe1gb", + [27] =3D "rdtscp", + [29] =3D "lm", + [30] =3D "3dnowext", + [31] =3D "3dnow", }, .cpuid_eax =3D 0x80000001, .cpuid_reg =3D R_EDX, .tcg_features =3D TCG_EXT2_FEATURES, }, [FEAT_8000_0001_ECX] =3D { .feat_names =3D { - "lahf-lm", "cmp-legacy", "svm", "extapic", - "cr8legacy", "abm", "sse4a", "misalignsse", - "3dnowprefetch", "osvw", "ibs", "xop", - "skinit", "wdt", NULL, "lwp", - "fma4", "tce", NULL, "nodeid-msr", - NULL, "tbm", "topoext", "perfctr-core", - "perfctr-nb", NULL, NULL, NULL, - NULL, NULL, NULL, NULL, + [0] =3D "lahf-lm", "cmp-legacy", "svm", "extapic", + [4] =3D "cr8legacy", "abm", "sse4a", "misalignsse", + [8] =3D "3dnowprefetch", "osvw", "ibs", "xop", + [12] =3D "skinit", "wdt", NULL, "lwp", + [16] =3D "fma4", "tce", NULL, "nodeid-msr", + [20] =3D NULL, "tbm", "topoext", "perfctr-core", + [24] =3D "perfctr-nb", NULL, NULL, NULL, }, .cpuid_eax =3D 0x80000001, .cpuid_reg =3D R_ECX, .tcg_features =3D TCG_EXT3_FEATURES, }, [FEAT_C000_0001_EDX] =3D { .feat_names =3D { - NULL, NULL, "xstore", "xstore-en", - NULL, NULL, "xcrypt", "xcrypt-en", - "ace2", "ace2-en", "phe", "phe-en", - "pmm", "pmm-en", NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, + [0] =3D NULL, NULL, "xstore", "xstore-en", + [4] =3D NULL, NULL, "xcrypt", "xcrypt-en", + [8] =3D "ace2", "ace2-en", "phe", "phe-en", + [12] =3D "pmm", "pmm-en", NULL, NULL, }, .cpuid_eax =3D 0xC0000001, .cpuid_reg =3D R_EDX, .tcg_features =3D TCG_EXT4_FEATURES, }, [FEAT_KVM] =3D { .feat_names =3D { - "kvmclock", "kvm-nopiodelay", "kvm-mmu", "kvmclock", - "kvm-asyncpf", "kvm-steal-time", "kvm-pv-eoi", "kvm-pv-unhalt", - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - "kvmclock-stable-bit", NULL, NULL, NULL, - NULL, NULL, NULL, NULL, + [KVM_FEATURE_CLOCKSOURCE] =3D "kvmclock", + [KVM_FEATURE_NOP_IO_DELAY] =3D "kvm-nopiodelay", + [KVM_FEATURE_MMU_OP] =3D "kvm-mmu", + [KVM_FEATURE_CLOCKSOURCE2] =3D "kvmclock", + [KVM_FEATURE_ASYNC_PF] =3D "kvm-asyncpf", + [KVM_FEATURE_STEAL_TIME] =3D "kvm-steal-time", + [KVM_FEATURE_PV_EOI] =3D "kvm-pv-eoi", + [KVM_FEATURE_PV_UNHALT] =3D "kvm-pv-unhalt", + [KVM_FEATURE_CLOCKSOURCE_STABLE_BIT] =3D "kvmclock-stable-bit", }, .cpuid_eax =3D KVM_CPUID_FEATURES, .cpuid_reg =3D R_EAX, .tcg_features =3D TCG_KVM_FEATURES, }, [FEAT_HYPERV_EAX] =3D { - .feat_names =3D { - NULL /* hv_msr_vp_runtime_access */, NULL /* hv_msr_time_refco= unt_access */, - NULL /* hv_msr_synic_access */, NULL /* hv_msr_stimer_access *= /, - NULL /* hv_msr_apic_access */, NULL /* hv_msr_hypercall_access= */, - NULL /* hv_vpindex_access */, NULL /* hv_msr_reset_access */, - NULL /* hv_msr_stats_access */, NULL /* hv_reftsc_access */, - NULL /* hv_msr_idle_access */, NULL /* hv_msr_frequency_access= */, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - }, .cpuid_eax =3D 0x40000003, .cpuid_reg =3D R_EAX, }, [FEAT_HYPERV_EBX] =3D { - .feat_names =3D { - NULL /* hv_create_partitions */, NULL /* hv_access_partition_i= d */, - NULL /* hv_access_memory_pool */, NULL /* hv_adjust_message_bu= ffers */, - NULL /* hv_post_messages */, NULL /* hv_signal_events */, - NULL /* hv_create_port */, NULL /* hv_connect_port */, - NULL /* hv_access_stats */, NULL, NULL, NULL /* hv_debugging *= /, - NULL /* hv_cpu_power_management */, NULL /* hv_configure_profi= ler */, - NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - }, .cpuid_eax =3D 0x40000003, .cpuid_reg =3D R_EBX, }, [FEAT_HYPERV_EDX] =3D { - .feat_names =3D { - NULL /* hv_mwait */, NULL /* hv_guest_debugging */, - NULL /* hv_perf_monitor */, NULL /* hv_cpu_dynamic_part */, - NULL /* hv_hypercall_params_xmm */, NULL /* hv_guest_idle_stat= e */, - NULL, NULL, - NULL, NULL, NULL /* hv_guest_crash_msr */, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - }, .cpuid_eax =3D 0x40000003, .cpuid_reg =3D R_EDX, }, [FEAT_SVM] =3D { .feat_names =3D { - "npt", "lbrv", "svm-lock", "nrip-save", - "tsc-scale", "vmcb-clean", "flushbyasid", "decodeassists", - NULL, NULL, "pause-filter", NULL, - "pfthreshold", NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, + [0] =3D "npt", "lbrv", "svm-lock", "nrip-save", + [4] =3D "tsc-scale", "vmcb-clean", "flushbyasid", "decodeassi= sts", + [8] =3D NULL, NULL, "pause-filter", NULL, + [12] =3D "pfthreshold", NULL, NULL, NULL, + }, .cpuid_eax =3D 0x8000000A, .cpuid_reg =3D R_EDX, .tcg_features =3D TCG_SVM_FEATURES, }, [FEAT_7_0_EBX] =3D { .feat_names =3D { - "fsgsbase", "tsc-adjust", NULL, "bmi1", - "hle", "avx2", NULL, "smep", - "bmi2", "erms", "invpcid", "rtm", - NULL, NULL, "mpx", NULL, - "avx512f", "avx512dq", "rdseed", "adx", - "smap", "avx512ifma", "pcommit", "clflushopt", - "clwb", NULL, "avx512pf", "avx512er", - "avx512cd", "sha-ni", "avx512bw", "avx512vl", + [0] =3D "fsgsbase", "tsc-adjust", NULL, "bmi1", + [4] =3D "hle", "avx2", NULL, "smep", + [8] =3D "bmi2", "erms", "invpcid", "rtm", + [12] =3D NULL, NULL, "mpx", NULL, + [16] =3D "avx512f", "avx512dq", "rdseed", "adx", + [20] =3D "smap", "avx512ifma", "pcommit", "clflushopt", + [24] =3D "clwb", NULL, "avx512pf", "avx512er", + [28] =3D "avx512cd", "sha-ni", "avx512bw", "avx512vl", }, .cpuid_eax =3D 7, .cpuid_needs_ecx =3D true, .cpuid_ecx =3D 0, @@ -434,14 +390,13 @@ static FeatureWordInfo feature_word_info[FEATURE_WORD= S] =3D { }, [FEAT_7_0_ECX] =3D { .feat_names =3D { - NULL, "avx512vbmi", "umip", "pku", - "ospke", NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, "avx512-vpopcntdq", NULL, - "la57", NULL, NULL, NULL, - NULL, NULL, "rdpid", NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, + [1] =3D "avx512vbmi", + [2] =3D "umip", + [3] =3D "pku", + [4] =3D "ospke", + [14] =3D "avx512-vpopcntdq", + [16] =3D "la57", + [22] =3D "rdpid", }, .cpuid_eax =3D 7, .cpuid_needs_ecx =3D true, .cpuid_ecx =3D 0, @@ -450,14 +405,8 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS= ] =3D { }, [FEAT_7_0_EDX] =3D { .feat_names =3D { - NULL, NULL, "avx512-4vnniw", "avx512-4fmaps", - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, + [2] =3D "avx512-4vnniw", + [3] =3D "avx512-4fmaps", }, .cpuid_eax =3D 7, .cpuid_needs_ecx =3D true, .cpuid_ecx =3D 0, @@ -466,14 +415,7 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS= ] =3D { }, [FEAT_8000_0007_EDX] =3D { .feat_names =3D { - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - "invtsc", NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, + [8] =3D "invtsc", }, .cpuid_eax =3D 0x80000007, .cpuid_reg =3D R_EDX, @@ -482,14 +424,10 @@ static FeatureWordInfo feature_word_info[FEATURE_WORD= S] =3D { }, [FEAT_XSAVE] =3D { .feat_names =3D { - "xsaveopt", "xsavec", "xgetbv1", "xsaves", - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, + [0] =3D "xsaveopt", + [1] =3D "xsavec", + [2] =3D "xgetbv1", + [3] =3D "xsaves", }, .cpuid_eax =3D 0xd, .cpuid_needs_ecx =3D true, .cpuid_ecx =3D 1, @@ -498,14 +436,7 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS= ] =3D { }, [FEAT_6_EAX] =3D { .feat_names =3D { - NULL, NULL, "arat", NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, + [2] =3D "arat", }, .cpuid_eax =3D 6, .cpuid_reg =3D R_EAX, .tcg_features =3D TCG_6_EAX_FEATURES, --=20 2.13.5