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: Mon, 19 Apr 2021 15:17:29 +1000	[thread overview]
Message-ID: <YH0SaTPzkNXg5uPf@yekko.fritz.box> (raw)
In-Reply-To: <RO1PR80MB56100E30B8B94BB4F733FB07CE4E9@RO1PR80MB5610.lamprd80.prod.outlook.com>

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

On Wed, Apr 14, 2021 at 06:28:26PM +0000, Lucas Mateus Martins Araujo e Castro wrote:
> Hi, I have been working on billionai's patch to enable the --disable-tcg option on PowerPC and one of the problems is that 5 files in hw/ppc use functions implemented in mmu-hash64.c which is not compiled with --disable-tcg, I'd like to know how to correct the spapr function call, should I
> 
>   *   change the calls to generic functions that should call the correct function based on if kvm is being used or not,
>   *   should I just implement said functions independently of mmu-hash64.c and always call them,
>   *   should I just implement said functions independently of mmu-hash64.c and only call it with --disable-tcg option turned on,
>   *   find a way to not have said calls when compiling without TCG as they're not necessary,
>   *   just create a stub
> 
> Here's when each function is called by each .c:
> spapr.c:
>     function do_lpcr_sync call ppc_store_lpcr

I think ppc_store_lpcr() needs to be moved so that it's compiled with
KVM as well, but #ifdef out the hreg_compute_hflags() line in that case.

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

> spapr_rtas.c:
>     function rtas_start_cpu call ppc_store_lpcr
>     function rtas_stop_self call ppc_store_lpcr

As above.

> spapr_spapr_cpu_core.c
>     function spapr_reset_vcpu call ppc_store_lpcr
>     function spapr_cpu_set_entry_state call ppc_store_lpcr

As above.

> spapr_caps.c:
>     function cap_large_decr_cpu_apply call ppc_store_lpcr

As above.

>     function cap_hpt_maxpagesize_cpu_apply call ppc_hash64_filter_pagesizes

Ok, you definitely need the filter_pagesizes logic, even with KVM, so
that will also have to be moved out of the TCG only file.

-- 
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-19  5:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-14 18:28 target/ppc: sPAPR invalid function calls when compiling without TCG Lucas Mateus Martins Araujo e Castro
2021-04-19  5:17 ` David Gibson [this message]
2021-04-19 19:04 Lucas Mateus Martins Araujo e Castro
2021-04-20  0:09 ` David Gibson
2021-04-20 18:27 Lucas Mateus Martins Araujo e Castro
2021-04-21  4:06 ` 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=YH0SaTPzkNXg5uPf@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).