From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58475) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XyNxR-0001Iw-On for qemu-devel@nongnu.org; Tue, 09 Dec 2014 11:48:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XyNxL-0004kQ-Jx for qemu-devel@nongnu.org; Tue, 09 Dec 2014 11:48:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60573) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XyNxL-0004kI-CO for qemu-devel@nongnu.org; Tue, 09 Dec 2014 11:48:11 -0500 Date: Tue, 9 Dec 2014 17:48:04 +0100 From: Kashyap Chamarthy Message-ID: <20141209164804.GD13012@tesla.redhat.com> References: <20141209105031.GA13012@tesla.redhat.com> <20141209112702.GA15695@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20141209112702.GA15695@redhat.com> Subject: Re: [Qemu-devel] Cubietruck: cannot create KVM guests: "kvm_init_vcpu failed: Invalid argument" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Richard W.M. Jones" Cc: Peter Maydell , QEMU Developers On Tue, Dec 09, 2014 at 11:27:02AM +0000, Richard W.M. Jones wrote: > On Tue, Dec 09, 2014 at 10:53:41AM +0000, Peter Maydell wrote: > > On 9 December 2014 at 10:50, Kashyap Chamarthy wrote: > > > Booting a minimal KVM guest throws the below error on Cubietruck: > > > > > > "kvm_init_vcpu failed: Invalid argument" [. . .] > > > So that's the answer really, it's a qemu bug. Actually it looks as > > > if qemu contains some code to try to get the host CPU type, but it > > > doesn't work, or maybe we need to pass a -cpu option ..." > > > > Yes, you need to pass a -cpu option. For KVM on ARM, you > > always need to either: > > * pass a -cpu option matching the host CPU > > * pass "-cpu host" > > > > The CubieTruck is a Cortex-A7, which we don't have specific > > support for in QEMU, so you will need "-cpu host". > > Kashyap ^^ can you try this? Should be a trivial one-liner change > in src/launch-direct.c. Yes it works with it :-) With the below diff in `libguestfs`: $ git diff src/launch.c diff --git a/src/launch.c b/src/launch.c index 9fadce8..ce71a8e 100644 --- a/src/launch.c +++ b/src/launch.c @@ -400,7 +400,7 @@ const char * guestfs___get_cpu_model (int kvm) { #if defined(__arm__) /* 32 bit ARM. */ - return NULL; + return "host"; #elif defined(__aarch64__) /* With -M virt, the default -cpu is cortex-a15. Stupid. */ I can boot a KVM guest successfully on Cubietruck, invoked via libguestfs appliance: . . . [01433ms] /bin/qemu-system-arm \ -global virtio-blk-device.scsi=off \ -nodefconfig \ -enable-fips \ -nodefaults \ -display none \ -M vexpress-a15 \ -cpu host \ -machine accel=kvm:tcg \ -m 500 \ -no-reboot \ -rtc driftfix=slew \ -global kvm-pit.lost_tick_policy=discard \ -kernel /home/kashyapc/src/libguestfs/tmp/.guestfs-1000/appliance.d/kernel \ -dtb /home/kashyapc/src/libguestfs/tmp/.guestfs-1000/appliance.d/dtb \ -initrd /home/kashyapc/src/libguestfs/tmp/.guestfs-1000/appliance.d/initrd \ -device virtio-scsi-device,id=scsi \ -drive file=/home/kashyapc/src/libguestfs/tmp/libguestfsRMfHzO/scratch.1,cache=unsafe,format=raw,id=hd0,if=none \ -device scsi-hd,drive=hd0 \ -drive file=/home/kashyapc/src/libguestfs/tmp/.guestfs-1000/appliance.d/root,snapshot=on,id=appliance,cache=unsafe,if=none \ -device scsi-hd,drive=appliance \ -device virtio-serial-device \ -serial stdio \ -chardev socket,path=/home/kashyapc/src/libguestfs/tmp/libguestfsRMfHzO/guestfsd.sock,id=channel0 \ -device virtserialport,chardev=channel0,name=org.libguestfs.channel.0 \ -append 'panic=1 mem=500M console=ttyAMA0 udevtimeout=6000 udev.event-timeout=6000 no_timer_check acpi=off printk.time=1 cgroup_disable=memory root=/dev/sdb selinux=0 guestfs_verbose=1 TERM=vt102' . . . Thanks, Rich & Peter. -- /kashyap