qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fabiano Rosas <farosas@linux.ibm.com>
To: Bruno Piazera Larsen <bruno.larsen@eldorado.org.br>,
	David Gibson <david@gibson.dropbear.id.au>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	Lucas Mateus Martins Araujo e Castro
	Fernando Eckhardt Valle <fernando.valle@eldorado.org.br>,
	"qemu-ppc@nongnu.org" <qemu-ppc@nongnu.org>,
	Andre Fernando da Silva <andre.silva@eldorado.org.br>,
	Matheus Kowalczuk Ferst <matheus.ferst@eldorado.org.br>,
	Luis Fernando Fujita Pires <luis.pires@eldorado.org.br>
Subject: RE: Discussion: Patch series that adds disable-tcg option for ppc targets
Date: Tue, 06 Apr 2021 17:48:03 -0300	[thread overview]
Message-ID: <874kgjta0s.fsf@linux.ibm.com> (raw)
In-Reply-To: <CP2PR80MB4499C5000C0178C1594A5424C7769@CP2PR80MB4499.lamprd80.prod.outlook.com>

Bruno Piazera Larsen <bruno.larsen@eldorado.org.br> writes:

>> You'll probably also need changes in hw/ppc/spapr_hcall.c and maybe
>> some other parts of the spapr code: there are a number of hypercalls
>> that we implement in qemu for TCG, but which are (and must be)
>> implemented in KVM when KVM is in use.  So, I expect you'll need to
>> suppress compilation of h_enter, h_remove, h_protect, h_read and
>> h_bulk_remove at least in the !TCG case.
> Yeah. there are 6 files dealing with spapr that are having linking
> problems, though some might be because of the cpu_list problem... But
> I'm a bit confused on how to interface with KVM, do I use an ioctl
> explicitly, or can it handle it implicitly? wenever I google or ask on
> IRC for KVM stuff the answer is usually "KVM handles it" so I never
> know if/when to call it

Maybe a general overview would help:

KVM runs in an actual ppc machine that can execute the Power instruction
set and provide the hardware facilities the guest expects from a ppc
hypervisor. So when using KVM, QEMU only needs to provide things that
are out of the scope of KVM or that for whatever reason KVM cannot

When running a ppc guest on top of a machine that's from another
architecture or that has KVM disabled, QEMU will need to do all the
heavy-lifting and translate the guest code to the target architecture
(TCG), emulate all of the hardware facilties and so on.

The point with disabling TCG is to make sure we identify which parts of
the code are needed when running natively (KVM) and have a way to build
only those, without the parts that are only needed when running on
another arch (TCG).

So the interfacing with KVM is something that is already in place. If
you grep for ioctl in accel/kvm/kvm-all.c and target/ppc/kvm.c you'll
see how QEMU interacts with KVM to get a guest to run and behave

About hypercalls (a kind of system call that the guest uses to talk to
its hypervisor) you'll see that spapr_hcall.c contains some hypercall

 - The ones used when running TCG (i.e. QEMU pretending we're in an
actual ppc machine), such as h_enter, h_remove, etc;

 - The ones used when running KVM (i.e. KVM says it cannot handle this
hcall and then QEMU has to do it).

If you cross-reference the hcalls from spapr_hcall.c with the
implementations in the kernel at arch/powerpc/kvm/ you'll start to see
which hypercalls are handled by QEMU because we're replacing KVM and
which are handled by QEMU because we're helping KVM.

Note that there are nuances to what I have said, so if you encounter
something that differs we can discuss further.

Hope it helps. =)

  reply	other threads:[~2021-04-06 21:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-06 18:38 Bruno Piazera Larsen
2021-04-06 20:48 ` Fabiano Rosas [this message]
2021-04-07  3:01 ` David Gibson
  -- strict thread matches above, loose matches on Subject: below --
2021-04-05 13:32 Bruno Piazera Larsen
2021-04-06  6:11 ` David Gibson
2021-04-10  5:43   ` Thomas Huth

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:

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

  git send-email \
    --in-reply-to=874kgjta0s.fsf@linux.ibm.com \
    --to=farosas@linux.ibm.com \
    --cc=andre.silva@eldorado.org.br \
    --cc=bruno.larsen@eldorado.org.br \
    --cc=david@gibson.dropbear.id.au \
    --cc=fernando.valle@eldorado.org.br \
    --cc=lucas.araujo@eldorado.org.br \
    --cc=luis.pires@eldorado.org.br \
    --cc=matheus.ferst@eldorado.org.br \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --subject='RE: Discussion: Patch series that adds disable-tcg option for ppc targets' \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).