qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* Re: target/ppc: sPAPR invalid function calls when compiling without TCG
@ 2021-04-20 18:27 Lucas Mateus Martins Araujo e Castro
  2021-04-21  4:06 ` David Gibson
  0 siblings, 1 reply; 6+ messages in thread
From: Lucas Mateus Martins Araujo e Castro @ 2021-04-20 18:27 UTC (permalink / raw)
  To: David Gibson; +Cc: Bruno Piazera Larsen, qemu-ppc, qemu-devel

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




________________________________

>> 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? If the latter is there an interval of opcodes that'll be intercepted?

[-- Attachment #2: Type: text/html, Size: 2358 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread
* Re: target/ppc: sPAPR invalid function calls when compiling without TCG
@ 2021-04-19 19:04 Lucas Mateus Martins Araujo e Castro
  2021-04-20  0:09 ` David Gibson
  0 siblings, 1 reply; 6+ messages in thread
From: Lucas Mateus Martins Araujo e Castro @ 2021-04-19 19:04 UTC (permalink / raw)
  To: David Gibson; +Cc: Bruno Piazera Larsen, qemu-ppc, qemu-devel

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



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

These functions are static, so I thought about turning them into non-static functions and creating the prototype in
internal.h and changing hw/ppc/meson.build to add the correct .c file but hw/ppc/ doesn't have an internal.h

What is the best way to handle this static functions?


[-- Attachment #2: Type: text/html, Size: 2258 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread
* target/ppc: sPAPR invalid function calls when compiling without TCG
@ 2021-04-14 18:28 Lucas Mateus Martins Araujo e Castro
  2021-04-19  5:17 ` David Gibson
  0 siblings, 1 reply; 6+ messages in thread
From: Lucas Mateus Martins Araujo e Castro @ 2021-04-14 18:28 UTC (permalink / raw)
  To: qemu-ppc, qemu-devel; +Cc: Bruno Piazera Larsen, David Gibson

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

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

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

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

spapr_spapr_cpu_core.c
    function spapr_reset_vcpu call ppc_store_lpcr
    function spapr_cpu_set_entry_state call ppc_store_lpcr

spapr_caps.c:
    function cap_large_decr_cpu_apply call ppc_store_lpcr
    function cap_hpt_maxpagesize_cpu_apply call ppc_hash64_filter_pagesizes



[-- Attachment #2: Type: text/html, Size: 4787 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-04-21  4:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
  -- 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

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