On Tue, Dec 09, 2014 at 05:48:04PM +0100, Kashyap Chamarthy wrote:
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 <kchamart(a)redhat.com>
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'
. . .
Kashyap, how about the following patch as discussed on IRC ...
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top