From nobody Tue Apr 30 19:15:15 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.zoho.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 1493757873372569.1028343887383; Tue, 2 May 2017 13:44:33 -0700 (PDT) Received: from localhost ([::1]:33595 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d5eet-0001mg-JY for importer@patchew.org; Tue, 02 May 2017 16:44:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52473) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d5edp-0001Fz-Mq for qemu-devel@nongnu.org; Tue, 02 May 2017 16:43:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d5edm-0001Jk-Jm for qemu-devel@nongnu.org; Tue, 02 May 2017 16:43:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48476) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d5edm-0001JM-DL for qemu-devel@nongnu.org; Tue, 02 May 2017 16:43:22 -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 007DE7EF4D; Tue, 2 May 2017 20:43:21 +0000 (UTC) Received: from localhost (ovpn-116-8.gru2.redhat.com [10.97.116.8]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8423977DF6; Tue, 2 May 2017 20:43:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 007DE7EF4D Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=ehabkost@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 007DE7EF4D Date: Tue, 2 May 2017 17:43:18 -0300 From: Eduardo Habkost To: qemu-devel@nongnu.org Message-ID: <20170502204318.GF3482@thinpad.lan.raisama.net> References: <20170502203115.22233-1-ehabkost@redhat.com> <20170502203115.22233-5-ehabkost@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20170502203115.22233-5-ehabkost@redhat.com> X-Fnord: you can see the fnord User-Agent: Mutt/1.8.0 (2017-02-23) 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.25]); Tue, 02 May 2017 20:43:21 +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] fixup! tests: Add [+-]feature and feature=on|off test cases 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: Michael Roth , Alexander Graf , Markus Armbruster , Igor Mammedov , Paolo Bonzini , 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 Content-Type: text/plain; charset="utf-8" On Tue, May 02, 2017 at 05:31:15PM -0300, Eduardo Habkost wrote: > Introduce a new CPUFeatureSetting QAPI data type, and use it to support > feature=3Dforce on -cpu. >=20 > Signed-off-by: Eduardo Habkost I will include this in v2 to fix the coding style issues. Signed-off-by: Eduardo Habkost --- tests/test-x86-cpuid-compat.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/tests/test-x86-cpuid-compat.c b/tests/test-x86-cpuid-compat.c index 9940f4de1c..02f56ad0e8 100644 --- a/tests/test-x86-cpuid-compat.c +++ b/tests/test-x86-cpuid-compat.c @@ -103,16 +103,24 @@ typedef struct FeatureTestArgs { } FeatureTestArgs; =20 /* Get the value for a feature word in a X86CPUFeatureWordInfo list */ -static uint32_t get_feature_word(QList *features, uint32_t eax, uint32_t e= cx, const char *reg) +static uint32_t get_feature_word(QList *features, uint32_t eax, uint32_t e= cx, + const char *reg) { const QListEntry *e; =20 for (e =3D qlist_first(features); e; e =3D qlist_next(e)) { QDict *w =3D qobject_to_qdict(qlist_entry_obj(e)); - if (eax =3D=3D qint_get_int(qobject_to_qint(qdict_get(w, "cpuid-in= put-eax"))) - && (!qdict_haskey(w, "cpuid-input-ecx") - || ecx =3D=3D qint_get_int(qobject_to_qint(qdict_get(w, "c= puid-input-ecx")))) - && !strcmp(qstring_get_str(qobject_to_qstring(qdict_get(w, "cp= uid-register"))), reg)) { + const char *rreg =3D + qstring_get_str(qobject_to_qstring(qdict_get(w, "cpuid-registe= r"))); + uint32_t reax =3D + qint_get_int(qobject_to_qint(qdict_get(w, "cpuid-input-eax"))); + bool has_ecx =3D qdict_haskey(w, "cpuid-input-ecx"); + uint32_t recx =3D 0; + + if (has_ecx) { + recx =3D qint_get_int(qobject_to_qint(qdict_get(w, "cpuid-inpu= t-ecx"))); + } + if (eax =3D=3D reax && (!has_ecx || ecx =3D=3D recx) && !strcmp(rr= eg, reg)) { return qint_get_int(qobject_to_qint(qdict_get(w, "features"))); } } --=20 2.11.0.259.g40922b1 --=20 Eduardo