From nobody Thu Mar 28 21:40:58 2024 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=1560262241; cv=none; d=zoho.com; s=zohoarc; b=Uq36GTrq3sHf1NDagKjl0gd2P8jKunFIBAIP4VC8j8hzsn1pNbjgTBiXPFFoB6x3cKE4Jh/EIsBIqPLK1Hdg0/c6D7t7jFrEaRuGHOhBQe5xYfFJb3vI5/nVlklDSes09/Mre5c+fmSVJTjydC/epsZlDiLYiwvSjG2uSslGzLk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560262241; 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=dezKvHzp4SLd+SsHBUc3uAXkbOIuviTNi30WErGoHVU=; b=AIsGhLQBCx9G1vytJfez1+iaiCHGCw4slWTmV0kc1LK78r7mKUHK1Z5s4zm7cPaPqpbGWgVfo/UUPGhlIp/+sUdxKeSOWAG1dQw2y/1g4fMpCVwkGdhtN8I2L4U36LK3YhshRJszN8HWtTlT1SaTfenrDBSnwKSez02agW7tUCc= 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 (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1560262241147436.67173484512557; Tue, 11 Jun 2019 07:10:41 -0700 (PDT) Received: from localhost ([::1]:59330 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hahU0-0005LA-74 for importer@patchew.org; Tue, 11 Jun 2019 10:10:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56709) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hah3H-0007Nt-6U for qemu-devel@nongnu.org; Tue, 11 Jun 2019 09:43:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hah3G-00020q-21 for qemu-devel@nongnu.org; Tue, 11 Jun 2019 09:43:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52046) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hah3F-0001dF-Sj for qemu-devel@nongnu.org; Tue, 11 Jun 2019 09:43:01 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BCCD2223883; Tue, 11 Jun 2019 13:42:30 +0000 (UTC) Received: from localhost (ovpn-116-9.gru2.redhat.com [10.97.116.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id A094019C59; Tue, 11 Jun 2019 13:42:28 +0000 (UTC) From: Eduardo Habkost To: Peter Maydell , qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 10:42:22 -0300 Message-Id: <20190611134224.6683-2-ehabkost@redhat.com> In-Reply-To: <20190611134224.6683-1-ehabkost@redhat.com> References: <20190611134224.6683-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 11 Jun 2019 13:42:33 +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 1/3] i386: x86_cpu_list_feature_names() function 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: Paolo Bonzini , Eduardo Habkost , Richard Henderson 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" Extract feature name listing code from x86_cpu_class_check_missing_features(). It will be reused to return information about CPU filtered features at runtime. Message-Id: <20190422234742.15780-2-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost --- target/i386/cpu.c | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index b21ecaac17..36589adb1f 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -3671,6 +3671,27 @@ static void x86_cpu_parse_featurestr(const char *typ= ename, char *features, static void x86_cpu_expand_features(X86CPU *cpu, Error **errp); static int x86_cpu_filter_features(X86CPU *cpu); =20 +/* Build a list with the name of all features on a feature word array */ +static void x86_cpu_list_feature_names(FeatureWordArray features, + strList **feat_names) +{ + FeatureWord w; + strList **next =3D feat_names; + + for (w =3D 0; w < FEATURE_WORDS; w++) { + uint32_t filtered =3D features[w]; + int i; + for (i =3D 0; i < 32; i++) { + if (filtered & (1UL << i)) { + strList *new =3D g_new0(strList, 1); + new->value =3D g_strdup(x86_cpu_feature_name(w, i)); + *next =3D new; + next =3D &new->next; + } + } + } +} + /* Check for missing features that may prevent the CPU class from * running using the current machine and accelerator. */ @@ -3678,7 +3699,6 @@ static void x86_cpu_class_check_missing_features(X86C= PUClass *xcc, strList **missing_feats) { X86CPU *xc; - FeatureWord w; Error *err =3D NULL; strList **next =3D missing_feats; =20 @@ -3705,18 +3725,7 @@ static void x86_cpu_class_check_missing_features(X86= CPUClass *xcc, =20 x86_cpu_filter_features(xc); =20 - for (w =3D 0; w < FEATURE_WORDS; w++) { - uint32_t filtered =3D xc->filtered_features[w]; - int i; - for (i =3D 0; i < 32; i++) { - if (filtered & (1UL << i)) { - strList *new =3D g_new0(strList, 1); - new->value =3D g_strdup(x86_cpu_feature_name(w, i)); - *next =3D new; - next =3D &new->next; - } - } - } + x86_cpu_list_feature_names(xc->filtered_features, next); =20 object_unref(OBJECT(xc)); } --=20 2.18.0.rc1.1.g3f1ff2140 From nobody Thu Mar 28 21:40:58 2024 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=1560262429; cv=none; d=zoho.com; s=zohoarc; b=HSWRHHUgaPhf0c4etwK+bYiwBvEuuc5I5GBXAMmTHzaTuPFNVxXmrW6Nzo3M7GIXtdGzgO/ERdq/rK/fSQXSU5IvWCzHsCwJgTV94C8TqF8UG60JZGk3EzyxWFLgAVWMbPQwdm602ZTIJESgBWcOkKJQoSlu4gfuvohRFW/c9c0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560262429; 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=S3//5jT4M7DdYB8PPKq3c0Dly+/hDXqQeWOweYqPbvI=; b=IYrhWTwcb8tRxWpWamM1FSJhvuiWGoAu3UEKEHGvODBZkhi4WVXeJJje1LKpnq86HwxdJ1KJlX83LgKJznbYWaFgndKUSQYoz3Ko3/CGSnH6ao46XpiQYAtjrcTfyz7s9ntkuHwv4IYQbMBy0OOtyp0tLe9OZJsM2DXVPlrM8C4= 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 (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1560262429660875.1614174992625; Tue, 11 Jun 2019 07:13:49 -0700 (PDT) Received: from localhost ([::1]:59370 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hahX2-0007O8-OP for importer@patchew.org; Tue, 11 Jun 2019 10:13:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56751) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hah3L-0007Vk-Lp for qemu-devel@nongnu.org; Tue, 11 Jun 2019 09:43:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hah3K-00022m-FB for qemu-devel@nongnu.org; Tue, 11 Jun 2019 09:43:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:30932) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hah3K-0001rv-9B for qemu-devel@nongnu.org; Tue, 11 Jun 2019 09:43:06 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A0B7C36887; Tue, 11 Jun 2019 13:42:33 +0000 (UTC) Received: from localhost (ovpn-116-9.gru2.redhat.com [10.97.116.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 39D325C5BB; Tue, 11 Jun 2019 13:42:32 +0000 (UTC) From: Eduardo Habkost To: Peter Maydell , qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 10:42:23 -0300 Message-Id: <20190611134224.6683-3-ehabkost@redhat.com> In-Reply-To: <20190611134224.6683-1-ehabkost@redhat.com> References: <20190611134224.6683-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 11 Jun 2019 13:42:38 +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 2/3] i386: "unavailable-features" QOM property 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: Paolo Bonzini , Eduardo Habkost , Richard Henderson 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 "unavailable-features" QOM property to X86CPU objects that have the same semantics of "unavailable-features" on query-cpu-definitions. The new property has the same goal of "filtered-features", but is generic enough to let any kind of CPU feature to be listed there without relying on low level details like CPUID leaves or MSR numbers. Message-Id: <20190422234742.15780-3-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost --- target/i386/cpu.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 36589adb1f..7e5b545005 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -3692,6 +3692,17 @@ static void x86_cpu_list_feature_names(FeatureWordAr= ray features, } } =20 +static void x86_cpu_get_unavailable_features(Object *obj, Visitor *v, + const char *name, void *opaqu= e, + Error **errp) +{ + X86CPU *xc =3D X86_CPU(obj); + strList *result =3D NULL; + + x86_cpu_list_feature_names(xc->filtered_features, &result); + visit_type_strList(v, "unavailable-features", &result, errp); +} + /* Check for missing features that may prevent the CPU class from * running using the current machine and accelerator. */ @@ -5632,6 +5643,15 @@ static void x86_cpu_initfn(Object *obj) object_property_add(obj, "filtered-features", "X86CPUFeatureWordInfo", x86_cpu_get_feature_words, NULL, NULL, (void *)cpu->filtered_features, NULL); + /* + * The "unavailable-features" property has the same semantics as + * CpuDefinitionInfo.unavailable-features on the "query-cpu-definition= s" + * QMP command: they list the features that would have prevented the + * CPU from running if the "enforce" flag was set. + */ + object_property_add(obj, "unavailable-features", "strList", + x86_cpu_get_unavailable_features, + NULL, NULL, NULL, &error_abort); =20 object_property_add(obj, "crash-information", "GuestPanicInformation", x86_cpu_get_crash_info_qom, NULL, NULL, NULL, NULL= ); --=20 2.18.0.rc1.1.g3f1ff2140 From nobody Thu Mar 28 21:40:58 2024 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=1560261677; cv=none; d=zoho.com; s=zohoarc; b=VwcGrkG4Zu1IOXR7V39hMAgd/gqJx1zS5Wn89JWvxJpQv4zAEXEKUhjXU5jHF7LSCMFgfM3OeDDmsRvYGFfGGwKRK5L3g/3dt3GfHKpqO077Hca1YRc0bFHXtaHidBguAGmHHemfL/C/mxPmB7FdEcI/sPAK0IwwtkyrJmgAtDY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560261677; 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=3Np9TI3NimrZcpeY845IqjKg4eXBuT0ivvhESEeVoxg=; b=mdllxfqHhO1jL0CUMgshBHBhPzkZC31BBL1sn9BVfiXVw/y8Zns0MVKqNNDUhCV/Qvtbtz8iRQhLrNw8u6BR8x9BeRs/Bt21mHIb2JA1r3ETZ9NZTUCtlT+AjcBUPqatQTighSA4foLNcqISA84zLnqg1jAaV5oSg/PfJDWBs08= 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 (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1560261677362839.6932187702774; Tue, 11 Jun 2019 07:01:17 -0700 (PDT) Received: from localhost ([::1]:59268 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hahKu-000635-15 for importer@patchew.org; Tue, 11 Jun 2019 10:01:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56707) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hah3H-0007No-3z for qemu-devel@nongnu.org; Tue, 11 Jun 2019 09:43:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hah3G-00020k-1S for qemu-devel@nongnu.org; Tue, 11 Jun 2019 09:43:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46396) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hah3F-0001eh-S7 for qemu-devel@nongnu.org; Tue, 11 Jun 2019 09:43:01 -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 A33DD75725; Tue, 11 Jun 2019 13:42:35 +0000 (UTC) Received: from localhost (ovpn-116-9.gru2.redhat.com [10.97.116.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 33431600CD; Tue, 11 Jun 2019 13:42:35 +0000 (UTC) From: Eduardo Habkost To: Peter Maydell , qemu-devel@nongnu.org Date: Tue, 11 Jun 2019 10:42:24 -0300 Message-Id: <20190611134224.6683-4-ehabkost@redhat.com> In-Reply-To: <20190611134224.6683-1-ehabkost@redhat.com> References: <20190611134224.6683-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.25]); Tue, 11 Jun 2019 13:42:35 +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 3/3] i386: Save EFER for 32-bit targets 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: Paolo Bonzini , Pavel Dovgalyuk , Eduardo Habkost , Richard Henderson 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" From: Pavel Dovgalyuk i386 (32 bit) emulation uses EFER in wrmsr and in MMU fault processing. But it does not included in VMState, because "efer" field is disabled with This patch adds a section for 32-bit targets which saves EFER when it's value is non-zero. Signed-off-by: Pavel Dovgalyuk Message-Id: <155913371654.8429.1659082639780315242.stgit@pasha-Precision-36= 30-Tower> Reviewed-by: Peter Xu [ehabkost: indentation fix] Signed-off-by: Eduardo Habkost --- target/i386/machine.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/target/i386/machine.c b/target/i386/machine.c index 225b5d433b..2c96cfc9a2 100644 --- a/target/i386/machine.c +++ b/target/i386/machine.c @@ -964,6 +964,27 @@ static const VMStateDescription vmstate_svm_npt =3D { } }; =20 +#ifndef TARGET_X86_64 +static bool intel_efer32_needed(void *opaque) +{ + X86CPU *cpu =3D opaque; + CPUX86State *env =3D &cpu->env; + + return env->efer !=3D 0; +} + +static const VMStateDescription vmstate_efer32 =3D { + .name =3D "cpu/efer32", + .version_id =3D 1, + .minimum_version_id =3D 1, + .needed =3D intel_efer32_needed, + .fields =3D (VMStateField[]) { + VMSTATE_UINT64(env.efer, X86CPU), + VMSTATE_END_OF_LIST() + } +}; +#endif + VMStateDescription vmstate_x86_cpu =3D { .name =3D "cpu", .version_id =3D 12, @@ -1089,6 +1110,9 @@ VMStateDescription vmstate_x86_cpu =3D { &vmstate_msr_intel_pt, &vmstate_msr_virt_ssbd, &vmstate_svm_npt, +#ifndef TARGET_X86_64 + &vmstate_efer32, +#endif NULL } }; --=20 2.18.0.rc1.1.g3f1ff2140