All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
	Richard Henderson <richard.henderson@linaro.org>,
	Eduardo Habkost <eduardo@habkost.net>
Cc: qemu-devel@nongnu.org
Subject: Running x86 hypervisors inside QEMU x86 TCG outer guest?
Date: Tue, 12 Mar 2024 13:34:48 +0100	[thread overview]
Message-ID: <ZfBL6KEfgIXANulr@toto> (raw)

Hi!

I'm trying to figure out if QEMU supports running x86 hypervisors (KVM and Xen) inside emulated (TCG) x86_64 guests.
I.e, using TCG emulated x86 hardware virtualization (Intel VMX/EPT or AMD SVM/NPT).

So far, I've been able to run nested x86 KVM when the host is on KVM but no luck with TCG.
With intel TCG cores kvm-ok in the guest says there's no KVM support.
With AMD TCG cores, kvm-ok looks fine but as soon as I try to run a guest, it doesn't run anything.

Am I doing something wrong or is this expected?

Some of the command-lines I've tried:
This is the command-line I use for AMD like outer TCG guest:
${QEMU} -M q35,accel=tcg -m 6G \
        -cpu "EPYC-Rome-v2" \
        -smp 1 \
        -display none \
        -serial mon:stdio \
        -kernel ubuntu-23.10-server-cloudimg-amd64-vmlinuz-generic \
        -append "root=/dev/sda1 console=ttyS0 intel_iommu=on" \
        -initrd ubuntu-23.10-server-cloudimg-amd64-initrd-generic \
        -device intel-iommu,intremap=on,device-iotlb=on \
        -device virtio-net-pci,netdev=net0,romfile="" \
        -netdev type=user,id=net0,hostfwd=tcp::2228-:22 \
        -drive file=ubuntu-23.10-server-cloudimg-amd64.img \
        -drive file=cloudimg-user-data.img,format=raw,snapshot=yes \
        -drive file=hd.qcow2 \
        $*

This is the one for Intel TCG guests:
${QEMU} -M q35,accel=tcg -m 6G \
        -cpu "Haswell,vmx=on" \
        -smp 1 \
        -display none \
        -serial mon:stdio \
        -kernel ubuntu-23.10-server-cloudimg-amd64-vmlinuz-generic \
        -append "root=/dev/sda1 console=ttyS0 intel_iommu=on" \
        -initrd ubuntu-23.10-server-cloudimg-amd64-initrd-generic \
        -device intel-iommu,intremap=on,device-iotlb=on \
        -device virtio-net-pci,netdev=net0,romfile="" \
        -netdev type=user,id=net0,hostfwd=tcp::2228-:22 \
        -drive file=ubuntu-23.10-server-cloudimg-amd64.img \
        -drive file=cloudimg-user-data.img,format=raw,snapshot=yes \
        -drive file=hd.qcow2 \
        $*

This is the one that works (nested KVM):
${QEMU} -M q35,accel=kvm,kernel-irqchip=split -m 6G \
        -cpu host \
        -smp 1 \
        -display none \
        -serial mon:stdio \
        -kernel ubuntu-23.10-server-cloudimg-amd64-vmlinuz-generic \
        -append "root=/dev/sda1 console=ttyS0 intel_iommu=on" \
        -initrd ubuntu-23.10-server-cloudimg-amd64-initrd-generic \
        -device intel-iommu,intremap=on,device-iotlb=on \
        -device virtio-net-pci,netdev=net0,romfile="" \
        -netdev type=user,id=net0,hostfwd=tcp::2228-:22 \
        -drive file=ubuntu-23.10-server-cloudimg-amd64.img \
        -drive file=cloudimg-user-data.img,format=raw,snapshot=yes \
        -drive file=hd.qcow2 \
        $*

Best regards,
Edgar


                 reply	other threads:[~2024-03-12 12:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=ZfBL6KEfgIXANulr@toto \
    --to=edgar.iglesias@gmail.com \
    --cc=eduardo@habkost.net \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.