qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>, qemu-devel@nongnu.org
Cc: "Alex Bennée" <alex.bennee@linaro.org>,
	"Pierrick Bouvier" <pierrick.bouvier@linaro.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>,
	qemu-ppc@nongnu.org
Subject: Re: [PATCH-for-9.1 09/12] accel/tcg/internal: Check for USER_ONLY definition instead of SOFTMMU
Date: Fri, 15 Mar 2024 11:25:39 -1000	[thread overview]
Message-ID: <76faab59-3dac-46c6-a548-7ec2d7f2e4d4@linaro.org> (raw)
In-Reply-To: <20240313213339.82071-10-philmd@linaro.org>

On 3/13/24 11:33, Philippe Mathieu-Daudé wrote:
> Since we *might* have user emulation with softmmu,
> replace the system emulation check by !user emulation one.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   accel/tcg/internal-target.h | 6 +++---
>   accel/tcg/tb-hash.h         | 4 ++--
>   accel/tcg/tcg-all.c         | 2 +-
>   3 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/accel/tcg/internal-target.h b/accel/tcg/internal-target.h
> index 4e36cf858e..b22b29c461 100644
> --- a/accel/tcg/internal-target.h
> +++ b/accel/tcg/internal-target.h
> @@ -24,7 +24,7 @@
>   #define assert_memory_lock()
>   #endif
>   
> -#if defined(CONFIG_SOFTMMU) && defined(CONFIG_DEBUG_TCG)
> +#if !defined(CONFIG_USER_ONLY) && defined(CONFIG_DEBUG_TCG)
>   void assert_no_pages_locked(void);
>   #else
>   static inline void assert_no_pages_locked(void) { }
> @@ -62,12 +62,12 @@ void tb_unlock_page1(tb_page_addr_t, tb_page_addr_t);
>   void tb_unlock_pages(TranslationBlock *);
>   #endif
>   
> -#ifdef CONFIG_SOFTMMU
> +#ifndef CONFIG_USER_ONLY
>   void tb_invalidate_phys_range_fast(ram_addr_t ram_addr,
>                                      unsigned size,
>                                      uintptr_t retaddr);
>   G_NORETURN void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr);
> -#endif /* CONFIG_SOFTMMU */
> +#endif /* !CONFIG_USER_ONLY */
>   
>   TranslationBlock *tb_gen_code(CPUState *cpu, vaddr pc,
>                                 uint64_t cs_base, uint32_t flags,

Ok.


> diff --git a/accel/tcg/tb-hash.h b/accel/tcg/tb-hash.h
> index a0c61f25cd..45a484ce82 100644
> --- a/accel/tcg/tb-hash.h
> +++ b/accel/tcg/tb-hash.h
> @@ -25,7 +25,7 @@
>   #include "qemu/xxhash.h"
>   #include "tb-jmp-cache.h"
>   
> -#ifdef CONFIG_SOFTMMU
> +#ifndef CONFIG_USER_ONLY
>   
>   /* Only the bottom TB_JMP_PAGE_BITS of the jump cache hash bits vary for
>      addresses on the same page.  The top bits are the same.  This allows
> @@ -58,7 +58,7 @@ static inline unsigned int tb_jmp_cache_hash_func(vaddr pc)
>       return (pc ^ (pc >> TB_JMP_CACHE_BITS)) & (TB_JMP_CACHE_SIZE - 1);
>   }
>   
> -#endif /* CONFIG_SOFTMMU */
> +#endif /* CONFIG_USER_ONLY */
>   
>   static inline
>   uint32_t tb_hash_func(tb_page_addr_t phys_pc, vaddr pc,

Not ok, this is really softmmu related.  If we have user-only softmmu, then we'll need to 
take multiple mappings into account, just like this.

Perhaps add a comment so it's easy to see this (and whichever else) have already been audited?


> diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c
> index c6619f5b98..929af1f64c 100644
> --- a/accel/tcg/tcg-all.c
> +++ b/accel/tcg/tcg-all.c
> @@ -116,7 +116,7 @@ static int tcg_init_machine(MachineState *ms)
>       tb_htable_init();
>       tcg_init(s->tb_size * MiB, s->splitwx_enabled, max_cpus);
>   
> -#if defined(CONFIG_SOFTMMU)
> +#if !defined(CONFIG_USER_ONLY)
>       /*
>        * There's no guest base to take into account, so go ahead and
>        * initialize the prologue now.

With system, we *know* softmmu must be used.
With user-only, we will want to wait until after command-line processing.

Ok with comment change to "never a guest base".


r~



  reply	other threads:[~2024-03-15 21:26 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-13 21:33 [PATCH-for-9.1 00/12] accel/tcg: Finish replacing SOFTMMU -> SYSTEM Philippe Mathieu-Daudé
2024-03-13 21:33 ` [PATCH-for-9.0? 01/12] accel/tcg/plugin: Remove CONFIG_SOFTMMU_GATE definition Philippe Mathieu-Daudé
2024-03-14  7:16   ` Thomas Huth
2024-03-15  6:42   ` Richard Henderson
2024-03-13 21:33 ` [PATCH-for-9.0? 02/12] travis-ci: Rename SOFTMMU -> SYSTEM Philippe Mathieu-Daudé
2024-03-14  7:18   ` Thomas Huth
2024-03-15  6:42   ` Richard Henderson
2024-03-13 21:33 ` [PATCH-for-9.0? 03/12] gdbstub: Correct invalid mentions of 'softmmu' by 'system' Philippe Mathieu-Daudé
2024-03-15 21:13   ` Richard Henderson
2024-03-13 21:33 ` [PATCH-for-9.0? 04/12] gdbstub/system: Rename 'user_ctx' argument as 'ctx' Philippe Mathieu-Daudé
2024-03-15 21:14   ` Richard Henderson
2024-03-13 21:33 ` [PATCH-for-9.0? 05/12] target/ppc: Rename init_excp_4xx_softmmu() -> init_excp_4xx() Philippe Mathieu-Daudé
2024-03-14  4:24   ` Nicholas Piggin
2024-03-13 21:33 ` [PATCH-for-9.1 06/12] tcg/sparc64: Check for USER_ONLY definition instead of SOFTMMU one Philippe Mathieu-Daudé
2024-03-15 21:17   ` Richard Henderson
2024-03-15 21:31   ` Richard Henderson
2024-03-13 21:33 ` [PATCH-for-9.1 07/12] plugins/api: " Philippe Mathieu-Daudé
2024-03-15 21:19   ` Richard Henderson
2024-03-13 21:33 ` [PATCH-for-9.0? 08/12] accel/tcg/tb-maint: Add comments around system emulation Philippe Mathieu-Daudé
2024-03-13 21:33 ` [PATCH-for-9.1 09/12] accel/tcg/internal: Check for USER_ONLY definition instead of SOFTMMU Philippe Mathieu-Daudé
2024-03-15 21:25   ` Richard Henderson [this message]
2024-03-13 21:33 ` [PATCH-for-9.1 10/12] exec/cpu-defs: Restrict SOFTMMU specific definitions to accel/tcg/ Philippe Mathieu-Daudé
2024-03-15 21:29   ` Richard Henderson
2024-03-13 21:33 ` [PATCH-for-9.1 11/12] tcg: Remove unused CONFIG_SOFTMMU definition from libtcg_system.fa Philippe Mathieu-Daudé
2024-03-15 21:31   ` Richard Henderson
2024-03-13 21:33 ` [PATCH-for-9.1 12/12] exec/poison: Poison CONFIG_SOFTMMU again Philippe Mathieu-Daudé
2024-03-15 21:32   ` Richard Henderson

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=76faab59-3dac-46c6-a548-7ec2d7f2e4d4@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=alex.bennee@linaro.org \
    --cc=pbonzini@redhat.com \
    --cc=philmd@linaro.org \
    --cc=pierrick.bouvier@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=thuth@redhat.com \
    /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).