From patchwork Fri Mar 23 08:23:58 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raghavendra K T X-Patchwork-Id: 148397 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 CB220B6EEC for ; Fri, 23 Mar 2012 19:25:04 +1100 (EST) Received: from localhost ([::1]:47594 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SAzny-0007Ul-KX for incoming@patchwork.ozlabs.org; Fri, 23 Mar 2012 04:25:02 -0400 Received: from eggs.gnu.org ([208.118.235.92]:35046) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SAznn-0007Ts-Ql for qemu-devel@nongnu.org; Fri, 23 Mar 2012 04:24:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SAznj-0006Wg-Gh for qemu-devel@nongnu.org; Fri, 23 Mar 2012 04:24:51 -0400 Received: from e28smtp06.in.ibm.com ([122.248.162.6]:35941) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SAzni-0006WD-Tq for qemu-devel@nongnu.org; Fri, 23 Mar 2012 04:24:47 -0400 Received: from /spool/local by e28smtp06.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 23 Mar 2012 13:54:37 +0530 Received: from d28relay05.in.ibm.com (9.184.220.62) by e28smtp06.in.ibm.com (192.168.1.136) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 23 Mar 2012 13:54:35 +0530 Received: from d28av05.in.ibm.com (d28av05.in.ibm.com [9.184.220.67]) by d28relay05.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q2N8OYuR3346476 for ; Fri, 23 Mar 2012 13:54:34 +0530 Received: from d28av05.in.ibm.com (loopback [127.0.0.1]) by d28av05.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q2NDt323012658 for ; Sat, 24 Mar 2012 00:55:03 +1100 Received: from [192.168.1.3] ([9.79.220.238]) by d28av05.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q2NDskNK012133; Sat, 24 Mar 2012 00:55:02 +1100 From: Raghavendra K T To: Avi Kivity , Jan Kiszka Date: Fri, 23 Mar 2012 13:53:58 +0530 Message-Id: <20120323082353.17193.46145.sendpatchset@codeblue> In-Reply-To: <20120323082242.17193.16289.sendpatchset@codeblue> References: <20120323082242.17193.16289.sendpatchset@codeblue> x-cbid: 12032308-9574-0000-0000-000001F2088E X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 122.248.162.6 Cc: Anthony Liguori , KVM , Qemu-devel , Marcelo Tosatti , Srivatsa Vaddagiri , Alexander Graf Subject: [Qemu-devel] [PATCH 2/2] QEMU kvm: Add support to get/set vcpu unhalt msr to aid migration 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 From: Raghavendra K T MSR_KVM_PV_UNHALT tells whether vcpu is unhalted, which needs to be used during migration. Signed-off-by: Raghavendra K T diff --git a/target-i386/cpu.h b/target-i386/cpu.h index a1ed3e7..10286a5 100644 --- a/target-i386/cpu.h +++ b/target-i386/cpu.h @@ -697,6 +697,7 @@ typedef struct CPUX86State { uint64_t system_time_msr; uint64_t wall_clock_msr; uint64_t async_pf_en_msr; + uint64_t pv_unhalt_msr; uint64_t tsc; uint64_t tsc_deadline; diff --git a/target-i386/kvm.c b/target-i386/kvm.c index dbebd3a..98b9088 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -62,6 +62,7 @@ static bool has_msr_star; static bool has_msr_hsave_pa; static bool has_msr_tsc_deadline; static bool has_msr_async_pf_en; +static bool has_msr_pv_unhalt; static bool has_msr_misc_enable; static int lm_capable_kernel; @@ -444,7 +445,7 @@ int kvm_arch_init_vcpu(CPUX86State *env) } has_msr_async_pf_en = c->eax & (1 << KVM_FEATURE_ASYNC_PF); - + has_msr_pv_unhalt = c->eax & (1 << KVM_FEATURE_PV_UNHALT); cpu_x86_cpuid(env, 0, 0, &limit, &unused, &unused, &unused); for (i = 0; i <= limit; i++) { @@ -1012,6 +1013,10 @@ static int kvm_put_msrs(CPUX86State *env, int level) if (hyperv_vapic_recommended()) { kvm_msr_entry_set(&msrs[n++], HV_X64_MSR_APIC_ASSIST_PAGE, 0); } + if (has_msr_pv_unhalt) { + kvm_msr_entry_set(&msrs[n++], MSR_KVM_PV_UNHALT, + env->pv_unhalt_msr); + } } if (env->mcg_cap) { int i; @@ -1247,6 +1252,9 @@ static int kvm_get_msrs(CPUX86State *env) if (has_msr_async_pf_en) { msrs[n++].index = MSR_KVM_ASYNC_PF_EN; } + if (has_msr_pv_unhalt) { + msrs[n++].index = MSR_KVM_PV_UNHALT; + } if (env->mcg_cap) { msrs[n++].index = MSR_MCG_STATUS; @@ -1326,6 +1334,9 @@ static int kvm_get_msrs(CPUX86State *env) case MSR_KVM_ASYNC_PF_EN: env->async_pf_en_msr = msrs[i].data; break; + case MSR_KVM_PV_UNHALT: + env->pv_unhalt_msr = msrs[i].data; + break; } }