From patchwork Mon Apr 22 19:00:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 238657 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E05852C014B for ; Tue, 23 Apr 2013 05:34:28 +1000 (EST) Received: from localhost ([::1]:34610 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUM11-0000Al-TV for incoming@patchwork.ozlabs.org; Mon, 22 Apr 2013 15:03:03 -0400 Received: from eggs.gnu.org ([208.118.235.92]:47416) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UULyr-0005ay-PL for qemu-devel@nongnu.org; Mon, 22 Apr 2013 15:00:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UULyq-0002Na-Kn for qemu-devel@nongnu.org; Mon, 22 Apr 2013 15:00:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41224) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UULyq-0002NO-A3 for qemu-devel@nongnu.org; Mon, 22 Apr 2013 15:00:48 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r3MJ0lq0023861 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 22 Apr 2013 15:00:47 -0400 Received: from localhost (vpn1-7-190.gru2.redhat.com [10.97.7.190]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r3MJ0koI017747; Mon, 22 Apr 2013 15:00:47 -0400 From: Eduardo Habkost To: qemu-devel@nongnu.org, =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Mon, 22 Apr 2013 16:00:19 -0300 Message-Id: <1366657220-776-9-git-send-email-ehabkost@redhat.com> In-Reply-To: <1366657220-776-1-git-send-email-ehabkost@redhat.com> References: <1366657220-776-1-git-send-email-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: libvir-list@redhat.com, Igor Mammedov , Jiri Denemark Subject: [Qemu-devel] [PATCH qom-cpu 8/9] target-i386: Introduce X86CPU.filtered_features field X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This field will contain the feature bits that were filtered out because of missing host support. Signed-off-by: Eduardo Habkost Reviewed-by: Eric Blake --- target-i386/cpu-qom.h | 3 +++ target-i386/cpu.c | 9 ++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/target-i386/cpu-qom.h b/target-i386/cpu-qom.h index 08f9eb6..159378f 100644 --- a/target-i386/cpu-qom.h +++ b/target-i386/cpu-qom.h @@ -65,6 +65,9 @@ typedef struct X86CPU { /*< public >*/ CPUX86State env; + + /* Features that were filtered out because of missing host capabilities */ + uint32_t filtered_features[FEATURE_WORDS]; } X86CPU; static inline X86CPU *x86_env_get_cpu(CPUX86State *env) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index bdb94a7..1178c5f 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1642,9 +1642,12 @@ static void filter_features_for_kvm(X86CPU *cpu) for (w = 0; w < FEATURE_WORDS; w++) { FeatureWordInfo *wi = &feature_word_info[w]; - env->features[w] &= kvm_arch_get_supported_cpuid(s, wi->cpuid_eax, - wi->cpuid_ecx, - wi->cpuid_reg); + uint32_t host_feat = kvm_arch_get_supported_cpuid(s, wi->cpuid_eax, + wi->cpuid_ecx, + wi->cpuid_reg); + uint32_t requested_features = env->features[w]; + env->features[w] &= host_feat; + cpu->filtered_features[w] = requested_features & ~env->features[w]; } } #endif