From nobody Sat Feb 7 08:44:59 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1561681870; cv=none; d=zoho.com; s=zohoarc; b=L/W0msWDkke3YxN4iJ3JoF+1j0TrCfenE9jHWO2OsmpP+IPi0Gb75VH4PgQvPNx9KPazJQ7hZgbnxCQaYtRPwrT6VxMBo81qm3hNSUqcwtsO/TShDPYsn2Pqnag0TQeCzb0tnHqfuwv+UyINsUJT1ufbYziY88KXKXExN6Ea06s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561681870; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=4/gC8inLoSlhVIMvkzV1yUPwhnRzfJsVFnZ2N5xTVuw=; b=JJsMdcB8aqcazSc//zaxVMIiNxGVjIGcFmlaIAMCOrxn7uhxDDq3P1u6cUBvCWOxjc/u6cgU/VnMHxvm6Qd5X8XH50x2aZDQm2EvvoBkPQoqkwhuSdra1CY62+IkpAZPSJVq44YDOcaP7Y6x3C1mkO1+Z5R/44PRRCGo5kxtrWM= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1561681870345788.0258610896815; Thu, 27 Jun 2019 17:31:10 -0700 (PDT) Received: from localhost ([::1]:55400 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hgen4-00025b-Fu for importer@patchew.org; Thu, 27 Jun 2019 20:30:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36213) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hgel3-0008Nb-Dn for qemu-devel@nongnu.org; Thu, 27 Jun 2019 20:28:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hgel2-0006kx-DI for qemu-devel@nongnu.org; Thu, 27 Jun 2019 20:28:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40440) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hgel2-0006kQ-7t for qemu-devel@nongnu.org; Thu, 27 Jun 2019 20:28:52 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 90F0F3DE0D for ; Fri, 28 Jun 2019 00:28:51 +0000 (UTC) Received: from localhost (ovpn-116-7.gru2.redhat.com [10.97.116.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id 07EAD600CC; Fri, 28 Jun 2019 00:28:50 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Thu, 27 Jun 2019 21:28:37 -0300 Message-Id: <20190628002844.24894-3-ehabkost@redhat.com> In-Reply-To: <20190628002844.24894-1-ehabkost@redhat.com> References: <20190628002844.24894-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 28 Jun 2019 00:28:51 +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] [PATCH v2 2/9] i386: Add x-force-features option for testing X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Igor Mammedov , Jiri Denemark , "Daniel P. Berrange" , "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add a new option that can be used to disable feature flag filtering. This will allow CPU model compatibility test cases to work without host hardware dependencies. Signed-off-by: Eduardo Habkost Reviewed-by: Daniel P. Berrang=C3=A9 --- Changes v1 -> v2: * (none) --- target/i386/cpu.h | 6 ++++++ target/i386/cpu.c | 8 ++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 0a96c78669..4727226a6a 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -1417,6 +1417,12 @@ struct X86CPU { =20 bool check_cpuid; bool enforce_cpuid; + /* + * Force features to be enabled even if the host doesn't support them. + * This is dangerous and should be done only for testing CPUID + * compatibility. + */ + bool force_features; bool expose_kvm; bool expose_tcg; bool migratable; diff --git a/target/i386/cpu.c b/target/i386/cpu.c index ea52db0600..1bdb906e9f 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -5179,8 +5179,11 @@ static int x86_cpu_filter_features(X86CPU *cpu) uint32_t host_feat =3D x86_cpu_get_supported_feature_word(w, false); uint32_t requested_features =3D env->features[w]; - env->features[w] &=3D host_feat; - cpu->filtered_features[w] =3D requested_features & ~env->features[= w]; + uint32_t available_features =3D requested_features & host_feat; + if (!cpu->force_features) { + env->features[w] =3D available_features; + } + cpu->filtered_features[w] =3D requested_features & ~available_feat= ures; if (cpu->filtered_features[w]) { rv =3D 1; } @@ -5909,6 +5912,7 @@ static Property x86_cpu_properties[] =3D { =20 DEFINE_PROP_BOOL("check", X86CPU, check_cpuid, true), DEFINE_PROP_BOOL("enforce", X86CPU, enforce_cpuid, false), + DEFINE_PROP_BOOL("x-force-features", X86CPU, force_features, false), DEFINE_PROP_BOOL("kvm", X86CPU, expose_kvm, true), DEFINE_PROP_UINT32("phys-bits", X86CPU, phys_bits, 0), DEFINE_PROP_BOOL("host-phys-bits", X86CPU, host_phys_bits, false), --=20 2.18.0.rc1.1.g3f1ff2140