qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Lucas Mateus Martins Araujo e Castro <lucas.araujo@eldorado.org.br>
Cc: Bruno Piazera Larsen <bruno.larsen@eldorado.org.br>,
	"qemu-ppc@nongnu.org" <qemu-ppc@nongnu.org>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: target/ppc: sPAPR invalid function calls when compiling without TCG
Date: Wed, 21 Apr 2021 14:06:03 +1000	[thread overview]
Message-ID: <YH+kq8F0gOSWtgbN@yekko.fritz.box> (raw)
In-Reply-To: <RO1PR80MB561024219A35A26C418CF51BCE489@RO1PR80MB5610.lamprd80.prod.outlook.com>

[-- Attachment #1: Type: text/plain, Size: 2548 bytes --]

On Tue, Apr 20, 2021 at 06:27:38PM +0000, Lucas Mateus Martins Araujo e Castro wrote:
> 
> 
> 
> ________________________________
> 
> >> spapr_hcall.c:
> >>     function h_enter call ppc_hash64_hpte_page_shift_noslb, ppc_hash64_map_hptes and ppc_hash64_unmap_hptes
> >>     function remove_hpte call ppc_hash64_map_hptes, ppc_hash64_unmap_hptes and ppc_hash64_tlb_flush_hpte
> >>     function h_protect call ppc_hash64_map_hptes, ppc_hash64_unmap_hptes and ppc_hash64_tlb_flush_hpte
> >>     function h_read call ppc_hash64_map_hptes and ppc_hash64_unmap_hptes
> >>     function rehash_hpte call ppc_hash64_hpte_page_shift_noslb
> >>     function rehash_hpt call ppc_hash64_map_hptes and ppc_hash64_unmap_hptes
> >
> >h_enter, remove_hpte, h_protect, h_read and rehash_hpte should never
> >be called for a KVM guest (KVM will intercept the relevant hcalls
> >before they reach qemu).  I think it would make sense to split of a
> >TCG only portion of spapr_hcall.c into a new file.  You'll then
> >probably need !TCG stubs for those hypercalls, which should trip a
> >fatal error (if KVM hasn't handled the calls, there's nothing we can
> >do that will salvage the situation).
> 
> Besides the aforementioned functions, will all spapr hypercalls
> beginning with H_* be intercepted (and therefore, should trip a
> fatal error in the KVM-only file) or only a subset of these
> functions will be intercepted?

No, only a few hcalls will be KVM intercepted.  There are basically
two categories:
  1) hcalls which *must* be implemented in KVM, because qemu doesn't
     have access to the KVM data structures to implement them.  I
     think this is pretty much just the MMU related hypercalls.
  2) performance critical hcalls where we have a KVM accelerated
     implementation, but *could* be implemented in qemu (and in a few
     cases the kernel fast path will fall back to the qemu slow path
     sometimes)

> If the latter is there an interval of
> opcodes that'll be intercepted?

No.  The opcode numbers aren't defined by KVM or qemu, they're from
from PAPR/PowerVM and have no bearing on how concerns are divided in
the KVM/qemu world.  I'd start by only separating hypercall
implementations which are actively causing you problems (calling into
TCG code is a strong hint that its in category (1)).

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2021-04-21  4:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-20 18:27 target/ppc: sPAPR invalid function calls when compiling without TCG Lucas Mateus Martins Araujo e Castro
2021-04-21  4:06 ` David Gibson [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-04-19 19:04 Lucas Mateus Martins Araujo e Castro
2021-04-20  0:09 ` David Gibson
2021-04-14 18:28 Lucas Mateus Martins Araujo e Castro
2021-04-19  5:17 ` David Gibson

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=YH+kq8F0gOSWtgbN@yekko.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=bruno.larsen@eldorado.org.br \
    --cc=lucas.araujo@eldorado.org.br \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.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 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).