From patchwork Fri Aug 20 07:25:37 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zachary Amsden X-Patchwork-Id: 120482 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o7K7PsQB026030 for ; Fri, 20 Aug 2010 07:25:54 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751739Ab0HTHZl (ORCPT ); Fri, 20 Aug 2010 03:25:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43543 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751210Ab0HTHZk (ORCPT ); Fri, 20 Aug 2010 03:25:40 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o7K7PeSS029696 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 20 Aug 2010 03:25:40 -0400 Received: from [10.11.9.158] (vpn-9-158.rdu.redhat.com [10.11.9.158]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o7K7Pcmb014674; Fri, 20 Aug 2010 03:25:39 -0400 Message-ID: <4C6E2DF1.5080301@redhat.com> Date: Thu, 19 Aug 2010 21:25:37 -1000 From: Zachary Amsden User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.10) Gecko/20100621 Fedora/3.0.5-1.fc13 Thunderbird/3.0.5 MIME-Version: 1.0 To: Jan Kiszka , kvm Subject: [PATCH] Work around xstate_size export for kvm-kmod X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Fri, 20 Aug 2010 07:25:54 +0000 (UTC) diff --git a/sync b/sync index c124fc7..b644f4d 100755 --- a/sync +++ b/sync @@ -45,6 +45,7 @@ def hack_content(data): 'set_desc_base set_desc_limit pvclock_vcpu_time_info tboot_enabled ' 'i387_fxsave_struct native_write_msr_safe xsave_struct ' 'fpu_alloc fpu_free fpu_restore_checking fpu_save_init fpu_finit ' + 'xstate_size ' ) kvm_init = kvm_exit = False mce = False diff --git a/x86/external-module-compat.h b/x86/external-module-compat.h index ead5b5a..464d6a8 100644 --- a/x86/external-module-compat.h +++ b/x86/external-module-compat.h @@ -883,6 +883,18 @@ union kvm_thread_xstate { struct kvm_xsave_struct xsave; }; +static inline unsigned int kvm_xstate_size_cache(void) +{ + static unsigned int xstate_size = 0; + if (!xstate_size) { + unsigned int eax, ebx, ecx, edx; + cpuid_count(0xd, 0, &eax, &ebx, &ecx, &edx); + xstate_size = ebx; + } + return xstate_size; +} +#define kvm_xstate_size kvm_xstate_size_cache() + #else /* >= 2.6.35 */ #define kvm_i387_fxsave_struct i387_fxsave_struct @@ -956,6 +968,8 @@ static inline void kvm_fpu_save_init(struct kvm_compat_fpu *fpu) #define kvm_fpu_save_init fpu_save_init #define kvm_fpu_finit fpu_finit +#define kvm_xstate_size xstate_size + #endif /* >= 2.6.36 */ #ifndef XSTATE_FP