qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] X86 cpuid reported feature


From: Xin Tong
Subject: [Qemu-devel] X86 cpuid reported feature
Date: Fri, 6 Feb 2015 10:54:49 -0800

I am wondering why QEMU requires host CPU to support a feature for a
emulated CPU to support the same feature. say i want to support intel
transactional memory. I put the CPUID_7_0_EBX_RTM flag in the haswell
cpu feature list. However, why do i need to put the same flag into
TCG_7_0_EBX_FEATURES in order to make sure its not filtered out. I do
not think we need RTM on the host to support RTM on the guest.

Thanks,
Xin

/*
 * Filters CPU feature words based on host availability of each feature.
 *
 * Returns: 0 if all flags are supported by the host, non-zero otherwise.
 */
static int x86_cpu_filter_features(X86CPU *cpu)
{
    CPUX86State *env = &cpu->env;
    FeatureWord w;
    int rv = 0;

    for (w = 0; w < FEATURE_WORDS; w++) {
        uint32_t host_feat =
            x86_cpu_get_supported_feature_word(w, cpu->migratable);
        uint32_t requested_features = env->features[w];
        env->features[w] &= host_feat;
        cpu->filtered_features[w] = requested_features & ~env->features[w];
        if (cpu->filtered_features[w]) {
            if (cpu->check_cpuid || cpu->enforce_cpuid) {
                report_unavailable_features(w, cpu->filtered_features[w]);
            }
            rv = 1;
        }
    }

    return rv;
}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]