x86 queue, 2019-06-11

* "unavailable-features" QOM property (Eduardo Habkost)
 * Save EFER for 32-bit targets (Pavel Dovgalyuk)
 -----BEGIN PGP SIGNATURE-----
 
 iQIcBAABCAAGBQJc/6+ZAAoJECgHk2+YTcWmPbIQAJ+g3DoW9Y9jY6Y9lshjPFtD
 sibUbz/7qM/+8YlfTucrNJFkPBEwoTqD5q+mvZ+i+Gy24mTWe501T9EZak9jhCOc
 SnnC+SdmfTi6dv563Mc/K5mWk0qOu7auI/erxmZD2vb7xv3+0lol+qDYeVTmdX2z
 2Psg+pAl+T1VRW98kvUgwWoEx57JHCitoB8RoER1rq7dSBEfuCPv/4EnoKyrJ8k7
 wbX98y2vL9Vjirpw+wf2aZfa29lbHvLRu44U+DMpO0ozE/S5/Fq72HYVHQWZzom1
 As25fn9UjGzuYsQCm4iwvuIdy4StJ9/csE5CPMXWLCwLQscs2yZJhwaC+msWS0BK
 gYwXwj1GfnIImalW+7bLKnxXiSaEaRlEKnVEla/mKS4IvEE+WyDsmxWKhGNlquCL
 rdO9TCzShI33DOowcnOFk3hG/u47ovSySNLmPbK6cT4Aw5C2sqJNKlTHXsiF7aS5
 2extow+QameQoUgvqbZE4JDUkITl1ViWR3VT3rbmOmA6xRVKbICJVGWO8S8T8jIJ
 tcvcbRfNEtsTsbmgaiQHEpEnNd2paGx1L+vxQvsbz7YiAbJCYilql7LSqrLJ0RFb
 p9bmRnmxCrk+4VTA37XXNcrbP867yku5Arb0sG/es3XMoAdMSIVMvRpbJeg5rl3m
 PTEeywTYm0EuXUuYOTOV
 =gHsT
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/ehabkost/tags/x86-next-pull-request' into staging

x86 queue, 2019-06-11

* "unavailable-features" QOM property (Eduardo Habkost)
* Save EFER for 32-bit targets (Pavel Dovgalyuk)

# gpg: Signature made Tue 11 Jun 2019 14:41:45 BST
# gpg:                using RSA key 2807936F984DC5A6
# gpg: Good signature from "Eduardo Habkost <ehabkost@redhat.com>" [full]
# Primary key fingerprint: 5A32 2FD5 ABC4 D3DB ACCF  D1AA 2807 936F 984D C5A6

* remotes/ehabkost/tags/x86-next-pull-request:
  i386: Save EFER for 32-bit targets
  i386: "unavailable-features" QOM property
  i386: x86_cpu_list_feature_names() function

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2019-06-11 16:02:07 +01:00
commit 219dca61eb
2 changed files with 66 additions and 13 deletions

View File

@ -3671,6 +3671,38 @@ static void x86_cpu_parse_featurestr(const char *typename, char *features,
static void x86_cpu_expand_features(X86CPU *cpu, Error **errp);
static int x86_cpu_filter_features(X86CPU *cpu);
/* 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 = feat_names;
for (w = 0; w < FEATURE_WORDS; w++) {
uint32_t filtered = features[w];
int i;
for (i = 0; i < 32; i++) {
if (filtered & (1UL << i)) {
strList *new = g_new0(strList, 1);
new->value = g_strdup(x86_cpu_feature_name(w, i));
*next = new;
next = &new->next;
}
}
}
}
static void x86_cpu_get_unavailable_features(Object *obj, Visitor *v,
const char *name, void *opaque,
Error **errp)
{
X86CPU *xc = X86_CPU(obj);
strList *result = 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.
*/
@ -3678,7 +3710,6 @@ static void x86_cpu_class_check_missing_features(X86CPUClass *xcc,
strList **missing_feats)
{
X86CPU *xc;
FeatureWord w;
Error *err = NULL;
strList **next = missing_feats;
@ -3705,18 +3736,7 @@ static void x86_cpu_class_check_missing_features(X86CPUClass *xcc,
x86_cpu_filter_features(xc);
for (w = 0; w < FEATURE_WORDS; w++) {
uint32_t filtered = xc->filtered_features[w];
int i;
for (i = 0; i < 32; i++) {
if (filtered & (1UL << i)) {
strList *new = g_new0(strList, 1);
new->value = g_strdup(x86_cpu_feature_name(w, i));
*next = new;
next = &new->next;
}
}
}
x86_cpu_list_feature_names(xc->filtered_features, next);
object_unref(OBJECT(xc));
}
@ -5623,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-definitions"
* 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);
object_property_add(obj, "crash-information", "GuestPanicInformation",
x86_cpu_get_crash_info_qom, NULL, NULL, NULL, NULL);

View File

@ -964,6 +964,27 @@ static const VMStateDescription vmstate_svm_npt = {
}
};
#ifndef TARGET_X86_64
static bool intel_efer32_needed(void *opaque)
{
X86CPU *cpu = opaque;
CPUX86State *env = &cpu->env;
return env->efer != 0;
}
static const VMStateDescription vmstate_efer32 = {
.name = "cpu/efer32",
.version_id = 1,
.minimum_version_id = 1,
.needed = intel_efer32_needed,
.fields = (VMStateField[]) {
VMSTATE_UINT64(env.efer, X86CPU),
VMSTATE_END_OF_LIST()
}
};
#endif
VMStateDescription vmstate_x86_cpu = {
.name = "cpu",
.version_id = 12,
@ -1089,6 +1110,9 @@ VMStateDescription vmstate_x86_cpu = {
&vmstate_msr_intel_pt,
&vmstate_msr_virt_ssbd,
&vmstate_svm_npt,
#ifndef TARGET_X86_64
&vmstate_efer32,
#endif
NULL
}
};