From patchwork Thu Mar 4 09:00:00 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 83560 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o2491bra011431 for ; Thu, 4 Mar 2010 09:01:37 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754793Ab0CDJBg (ORCPT ); Thu, 4 Mar 2010 04:01:36 -0500 Received: from fmmailgate03.web.de ([217.72.192.234]:34520 "EHLO fmmailgate03.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754780Ab0CDJBf (ORCPT ); Thu, 4 Mar 2010 04:01:35 -0500 Received: from smtp05.web.de (fmsmtp05.dlan.cinetic.de [172.20.4.166]) by fmmailgate03.web.de (Postfix) with ESMTP id 52DC8141E6B37; Thu, 4 Mar 2010 10:00:05 +0100 (CET) Received: from [92.75.137.199] (helo=[192.168.1.10]) by smtp05.web.de with asmtp (TLSv1:AES256-SHA:256) (WEB.DE 4.110 #314) id 1Nn6ub-0006jV-00; Thu, 04 Mar 2010 10:00:05 +0100 Message-ID: <4B8F7690.4040600@web.de> Date: Thu, 04 Mar 2010 10:00:00 +0100 From: Jan Kiszka User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 MIME-Version: 1.0 To: Avi Kivity , Marcelo Tosatti CC: kvm , "David S. Ahern" Subject: [PATCH] qemu-kvm: Fix boot CPU setup for the case it is unsupported X-Enigmail-Version: 0.95.7 X-Sender: jan.kiszka@web.de X-Provags-ID: V01U2FsdGVkX1/XnEkC0oZzD3DbTGcZUq/Q6pbwUDUzF2NZEsrP acH7QINQfyeVJcktsj1S9BVSxCtwLNPoe3dfBRG1EqtZu0Xdj+ 3NUvvkADc= 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]); Thu, 04 Mar 2010 09:01:37 +0000 (UTC) diff --git a/qemu-kvm-x86.c b/qemu-kvm-x86.c index 7a5925a..7d42fdc 100644 --- a/qemu-kvm-x86.c +++ b/qemu-kvm-x86.c @@ -672,7 +672,7 @@ static const VMStateDescription vmstate_kvmclock= { int kvm_arch_qemu_create_context(void) { - int i; + int i, r; struct utsname utsname; uname(&utsname); @@ -696,7 +696,12 @@ int kvm_arch_qemu_create_context(void) vmstate_register(0, &vmstate_kvmclock, &kvmclock_data); #endif - return kvm_set_boot_cpu_id(0); + r = kvm_set_boot_cpu_id(0); + if (r < 0 && r != -ENOSYS) { + return r; + } + + return 0; } static void set_msr_entry(struct kvm_msr_entry *entry, uint32_t index, diff --git a/qemu-kvm.c b/qemu-kvm.c index 222ca97..e417f21 100644 --- a/qemu-kvm.c +++ b/qemu-kvm.c @@ -2091,8 +2091,10 @@ static int kvm_create_context(void) return -1; } r = kvm_arch_qemu_create_context(); - if (r < 0) + if (r < 0) { kvm_finalize(kvm_state); + return -1; + } if (kvm_pit && !kvm_pit_reinject) { if (kvm_reinject_control(kvm_context, 0)) { fprintf(stderr, "failure to disable in-kernel PIT reinjection\n");