qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kashyap Chamarthy <kchamart@redhat.com>
To: "Richard W.M. Jones" <rjones@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] Cubietruck: cannot create KVM guests: "kvm_init_vcpu failed: Invalid argument"
Date: Tue, 9 Dec 2014 17:48:04 +0100	[thread overview]
Message-ID: <20141209164804.GD13012@tesla.redhat.com> (raw)
In-Reply-To: <20141209112702.GA15695@redhat.com>

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@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'
. . .


Thanks, Rich & Peter.

-- 
/kashyap

  parent reply	other threads:[~2014-12-09 16:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-09 10:50 [Qemu-devel] Cubietruck: cannot create KVM guests: "kvm_init_vcpu failed: Invalid argument" Kashyap Chamarthy
2014-12-09 10:53 ` Peter Maydell
2014-12-09 11:27   ` Richard W.M. Jones
2014-12-09 12:15     ` Kashyap Chamarthy
2014-12-09 16:48     ` Kashyap Chamarthy [this message]
2014-12-09 11:25 ` Richard W.M. Jones
2014-12-09 11:42   ` Peter Maydell
2014-12-09 12:33     ` Dr. David Alan Gilbert
2014-12-09 13:48       ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141209164804.GD13012@tesla.redhat.com \
    --to=kchamart@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rjones@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).