From patchwork Mon Oct 17 17:51:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 9380087 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D8BDC607D4 for ; Mon, 17 Oct 2016 18:00:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D608127F9C for ; Mon, 17 Oct 2016 18:00:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C685729281; Mon, 17 Oct 2016 18:00:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9CFAB27F9C for ; Mon, 17 Oct 2016 18:00:53 +0000 (UTC) Received: from localhost ([::1]:34827 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwCDT-0008NO-Rk for patchwork-qemu-devel@patchwork.kernel.org; Mon, 17 Oct 2016 14:00:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54856) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bwC4u-0000no-Gl for qemu-devel@nongnu.org; Mon, 17 Oct 2016 13:52:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bwC4t-0002kC-Hq for qemu-devel@nongnu.org; Mon, 17 Oct 2016 13:52:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57044) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bwC4t-0002ju-A2 for qemu-devel@nongnu.org; Mon, 17 Oct 2016 13:51:59 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7D00480087; Mon, 17 Oct 2016 17:51:58 +0000 (UTC) Received: from localhost (ovpn-116-159.phx2.redhat.com [10.3.116.159]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u9HHpvTK007258; Mon, 17 Oct 2016 13:51:58 -0400 From: Eduardo Habkost To: Peter Maydell Date: Mon, 17 Oct 2016 15:51:24 -0200 Message-Id: <1476726698-14661-8-git-send-email-ehabkost@redhat.com> In-Reply-To: <1476726698-14661-1-git-send-email-ehabkost@redhat.com> References: <1476726698-14661-1-git-send-email-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 17 Oct 2016 17:51:58 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 07/21] target-i386: Register properties for feature aliases manually 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 , qemu-devel@nongnu.org, Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Instead of keeping the aliases inside the feature name arrays and require parsing the strings, just register alias properties manually. This simplifies the code for property registration and lookup. Signed-off-by: Eduardo Habkost --- target-i386/cpu.c | 43 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 483490d..b9ef34e 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -278,12 +278,12 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = { }, [FEAT_1_ECX] = { .feat_names = { - "pni|sse3" /* Intel,AMD sse3 */, "pclmulqdq|pclmuldq", "dtes64", "monitor", + "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-1", - "sse4.2|sse4-2", "x2apic", "movbe", "popcnt", + NULL, "pcid", "dca", "sse4.1", + "sse4.2", "x2apic", "movbe", "popcnt", "tsc-deadline", "aes", "xsave", "osxsave", "avx", "f16c", "rdrand", "hypervisor", }, @@ -302,9 +302,9 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS] = { NULL /* cx8 */, NULL /* apic */, NULL, "syscall", NULL /* mtrr */, NULL /* pge */, NULL /* mca */, NULL /* cmov */, NULL /* pat */, NULL /* pse36 */, NULL, NULL /* Linux mp */, - "nx|xd", NULL, "mmxext", NULL /* mmx */, - NULL /* fxsr */, "fxsr-opt|ffxsr", "pdpe1gb", "rdtscp", - NULL, "lm|i64", "3dnowext", "3dnow", + "nx", NULL, "mmxext", NULL /* mmx */, + NULL /* fxsr */, "fxsr-opt", "pdpe1gb", "rdtscp", + NULL, "lm", "3dnowext", "3dnow", }, .cpuid_eax = 0x80000001, .cpuid_reg = R_EDX, .tcg_features = TCG_EXT2_FEATURES, @@ -3321,31 +3321,22 @@ static void x86_cpu_register_feature_bit_props(X86CPU *cpu, FeatureWord w, int bitnr) { - Object *obj = OBJECT(cpu); - int i; - char **names; FeatureWordInfo *fi = &feature_word_info[w]; + const char *name = fi->feat_names[bitnr]; - if (!fi->feat_names[bitnr]) { + if (!name) { return; } - names = g_strsplit(fi->feat_names[bitnr], "|", 0); - /* Property names should use "-" instead of "_". * Old names containing underscores are registered as aliases * using object_property_add_alias() */ - assert(!strchr(names[0], '_')); - x86_cpu_register_bit_prop(cpu, names[0], &cpu->env.features[w], bitnr); - - for (i = 1; names[i]; i++) { - assert(!strchr(names[i], '_')); - object_property_add_alias(obj, names[i], obj, names[0], - &error_abort); - } - - g_strfreev(names); + assert(!strchr(name, '_')); + /* aliases don't use "|" delimiters anymore, they are registered + * manually using object_property_add_alias() */ + assert(!strchr(name, '|')); + x86_cpu_register_bit_prop(cpu, name, &cpu->env.features[w], bitnr); } static void x86_cpu_initfn(Object *obj) @@ -3393,6 +3384,14 @@ static void x86_cpu_initfn(Object *obj) } } + object_property_add_alias(obj, "sse3", obj, "pni", &error_abort); + object_property_add_alias(obj, "pclmuldq", obj, "pclmulqdq", &error_abort); + object_property_add_alias(obj, "sse4-1", obj, "sse4.1", &error_abort); + object_property_add_alias(obj, "sse4-2", obj, "sse4.2", &error_abort); + object_property_add_alias(obj, "xd", obj, "nx", &error_abort); + object_property_add_alias(obj, "ffxsr", obj, "fxsr-opt", &error_abort); + object_property_add_alias(obj, "i64", obj, "lm", &error_abort); + object_property_add_alias(obj, "ds_cpl", obj, "ds-cpl", &error_abort); object_property_add_alias(obj, "tsc_adjust", obj, "tsc-adjust", &error_abort); object_property_add_alias(obj, "fxsr_opt", obj, "fxsr-opt", &error_abort);