qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Anton Johansson <anjo@rev.ng>, qemu-devel@nongnu.org
Cc: ale@rev.ng, philmd@linaro.org
Subject: Re: [RFC PATCH 30/34] accel/tcg: Make tcg-all.c target indpendent
Date: Wed, 24 Jan 2024 13:13:55 +1000	[thread overview]
Message-ID: <d82b3fee-6fd6-469b-93de-84ae5cff238e@linaro.org> (raw)
In-Reply-To: <20240119144024.14289-31-anjo@rev.ng>

On 1/20/24 00:40, Anton Johansson wrote:
> Uses target_supports_mttcg() and target_long_bits() to turn ifdefs into
> runtime branches.
> 
> Signed-off-by: Anton Johansson <anjo@rev.ng>
> ---
>   accel/tcg/tcg-all.c | 25 +++++++++----------------
>   1 file changed, 9 insertions(+), 16 deletions(-)
> 
> diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c
> index a40e0aee37..b8e920e3a8 100644
> --- a/accel/tcg/tcg-all.c
> +++ b/accel/tcg/tcg-all.c
> @@ -28,7 +28,6 @@
>   #include "exec/replay-core.h"
>   #include "sysemu/cpu-timers.h"
>   #include "tcg/tcg.h"
> -#include "tcg/oversized-guest.h"
>   #include "qapi/error.h"
>   #include "qemu/error-report.h"
>   #include "qemu/accel.h"
> @@ -67,20 +66,13 @@ DECLARE_INSTANCE_CHECKER(TCGState, TCG_STATE,
>    * there is one remaining limitation to check:
>    *   - The guest can't be oversized (e.g. 64 bit guest on 32 bit host)
>    */
> -
>   static bool default_mttcg_enabled(void)
>   {
> -    if (icount_enabled() || TCG_OVERSIZED_GUEST) {
> +    const bool oversized_guest = target_long_bits() > TCG_TARGET_REG_BITS;
> +    if (icount_enabled() || oversized_guest) {
>           return false;
>       }
> -#ifdef TARGET_SUPPORTS_MTTCG
> -# ifndef TCG_GUEST_DEFAULT_MO
> -#  error "TARGET_SUPPORTS_MTTCG without TCG_GUEST_DEFAULT_MO"
> -# endif
> -    return true;
> -#else
> -    return false;
> -#endif
> +    return target_supports_mttcg();
>   }
>   
>   static void tcg_accel_instance_init(Object *obj)
> @@ -137,17 +129,18 @@ static char *tcg_get_thread(Object *obj, Error **errp)
>   static void tcg_set_thread(Object *obj, const char *value, Error **errp)
>   {
>       TCGState *s = TCG_STATE(obj);
> +    const bool oversized_guest = target_long_bits() > TCG_TARGET_REG_BITS;
>   
>       if (strcmp(value, "multi") == 0) {
> -        if (TCG_OVERSIZED_GUEST) {
> +        if (oversized_guest) {
>               error_setg(errp, "No MTTCG when guest word size > hosts");
>           } else if (icount_enabled()) {
>               error_setg(errp, "No MTTCG when icount is enabled");
>           } else {
> -#ifndef TARGET_SUPPORTS_MTTCG
> -            warn_report("Guest not yet converted to MTTCG - "
> -                        "you may get unexpected results");
> -#endif
> +            if (target_supports_mttcg()) {
> +                warn_report("Guest not yet converted to MTTCG - "
> +                            "you may get unexpected results");
> +            }
>               s->mttcg_enabled = true;
>           }
>       } else if (strcmp(value, "single") == 0) {


All of this happens at startup.  Are you sure you're going to have determined these values 
early enough for heterogeneous mode?  I guess for the moment you don't care, because 
they're all constants supplied by functions.

Acked-by: Richard Henderson <richard.henderson@linaro.org>


r~


  parent reply	other threads:[~2024-01-24  3:14 UTC|newest]

Thread overview: 86+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-19 14:39 [RFC PATCH 00/34] Compile accel/tcg once (partially) Anton Johansson via
2024-01-19 14:39 ` [RFC PATCH 01/34] target: [PAGE_VARY] Use PAGE_VARY for all softmmu targets Anton Johansson via
2024-01-19 16:05   ` Philippe Mathieu-Daudé
2024-01-23 12:09     ` Anton Johansson via
2024-01-19 14:39 ` [RFC PATCH 02/34] target: [PAGE_VARY] Move TARGET_PAGE_BITS_MIN to TargetPageBits Anton Johansson via
2024-01-23 16:33   ` Richard Henderson
2024-01-19 14:39 ` [RFC PATCH 03/34] exec: [PAGE_VARY] Move TARGET_PAGE_BITS_VARY to common header Anton Johansson via
2024-01-23 22:20   ` Richard Henderson
2024-01-19 14:39 ` [RFC PATCH 04/34] exec: [PAGE_VARY] Unpoison TARGET_PAGE_* macros for system mode Anton Johansson via
2024-01-23 22:20   ` Richard Henderson
2024-01-19 14:39 ` [RFC PATCH 05/34] target/tricore: [VADDR] Use target_ulong for EA Anton Johansson via
2024-01-23 22:29   ` Richard Henderson
2024-01-27  8:26   ` Richard Henderson
2024-01-19 14:39 ` [RFC PATCH 06/34] exec: [VADDR] Move vaddr defines to separate file Anton Johansson via
2024-01-23 22:33   ` Richard Henderson
2024-01-27  8:36   ` Richard Henderson
2024-01-27  8:45     ` Richard Henderson
2024-01-19 14:39 ` [RFC PATCH 07/34] hw/core: [VADDR] Include vaddr.h from cpu.h Anton Johansson via
2024-01-23 22:57   ` Richard Henderson
2024-01-27  8:48   ` Richard Henderson
2024-01-19 14:39 ` [RFC PATCH 08/34] target: [VADDR] Use vaddr in gen_intermediate_code Anton Johansson via
2024-01-23 23:13   ` Richard Henderson
2024-01-27  9:05   ` Richard Henderson
2024-01-19 14:39 ` [RFC PATCH 09/34] exec: [VADDR] Use vaddr in DisasContextBase for virtual addresses Anton Johansson via
2024-01-23 23:22   ` Richard Henderson
2024-01-27  9:33   ` Richard Henderson
2024-01-19 14:40 ` [RFC PATCH 10/34] exec: [VADDR] typedef abi_ptr to vaddr Anton Johansson via
2024-01-23 23:29   ` Richard Henderson
2024-01-27  9:42   ` Richard Henderson
2024-01-19 14:40 ` [RFC PATCH 11/34] [IGNORE] Squash of header code shuffling Anton Johansson via
2024-01-19 14:40 ` [RFC PATCH 12/34] target: Uninline cpu_mmu_index() Anton Johansson via
2024-01-23 23:40   ` Richard Henderson
2024-01-27 10:10   ` Richard Henderson
2024-01-19 14:40 ` [RFC PATCH 13/34] target: Uninline cpu_get_tb_cpu_state() Anton Johansson via
2024-01-23 23:53   ` Richard Henderson
2024-01-27 11:21   ` Richard Henderson
2024-01-19 14:40 ` [RFC PATCH 14/34] exec: [CPUTLB] Move PAGE_* macros to common header Anton Johansson via
2024-01-23 23:54   ` Richard Henderson
2024-01-27  7:53     ` Richard Henderson
2024-01-19 14:40 ` [RFC PATCH 15/34] exec: [CPUTLB] Move TLB_*/tlb_*() " Anton Johansson via
2024-01-24  0:09   ` Richard Henderson
2024-01-19 14:40 ` [RFC PATCH 16/34] exec: [CPUTLB] Move cpu_*()/cpu_env() " Anton Johansson via
2024-01-24  0:15   ` Richard Henderson
2024-01-27 22:14   ` Richard Henderson
2024-01-28  0:15     ` Richard Henderson
2024-01-19 14:40 ` [RFC PATCH 17/34] hw/core: [CPUTLB] Move target specifics to end of TCGCPUOps Anton Johansson via
2024-01-24  0:43   ` Richard Henderson
2024-01-28  0:37     ` Richard Henderson
2024-01-19 14:40 ` [RFC PATCH 18/34] accel/stubs: [CPUTLB] Move xen.h stubs to xen-stub.c Anton Johansson via
2024-01-24  1:04   ` Richard Henderson
2024-01-19 14:40 ` [RFC PATCH 19/34] accel/tcg: [CPUTLB] Use TCGContext.addr_type instead of TARGET_LONG_BITS Anton Johansson via
2024-01-24  1:18   ` Richard Henderson
2024-01-19 14:40 ` [RFC PATCH 20/34] accel/tcg: [CPUTLB] Use TCGContext.guest_mo for memory ordering Anton Johansson via
2024-01-24  1:21   ` Richard Henderson
2024-01-19 14:40 ` [RFC PATCH 21/34] accel/tcg: [CPUTLB] Use tcg_ctx->tlb_dyn_max_bits Anton Johansson via
2024-01-24  1:23   ` Richard Henderson
2024-01-19 14:40 ` [RFC PATCH 22/34] accel/tcg: [CPUTLB] Move CPU_TLB_DYN_[DEFAULT|MIN]* to cputlb.c Anton Johansson via
2024-01-24  1:24   ` Richard Henderson
2024-01-19 14:40 ` [RFC PATCH 23/34] tcg: [CPUTLB] Add `mo_te` field to TCGContext Anton Johansson via
2024-01-24  1:50   ` Richard Henderson
2024-01-19 14:40 ` [RFC PATCH 24/34] accel/tcg: [CPUTLB] Set mo_te in TCGContext Anton Johansson via
2024-01-19 14:40 ` [RFC PATCH 25/34] accel/tcg: [CPUTLB] Use tcg_ctx->mo_te instead of MO_TE Anton Johansson via
2024-01-19 14:40 ` [RFC PATCH 26/34] Wrap target macros in functions Anton Johansson via
2024-01-23 11:50   ` Philippe Mathieu-Daudé
2024-01-23 12:12     ` Anton Johansson via
2024-01-24  2:50       ` Richard Henderson
2024-01-19 14:40 ` [RFC PATCH 27/34] accel/tcg: Make translate-all.c target independent Anton Johansson via
2024-01-24  2:53   ` Richard Henderson
2024-06-13  9:50     ` Anton Johansson via
2024-06-18 15:21       ` Richard Henderson
2024-06-20 18:51         ` Anton Johansson via
2024-01-19 14:40 ` [RFC PATCH 28/34] accel/tcg: Make plugin-gen.c " Anton Johansson via
2024-01-24  3:02   ` Richard Henderson
2024-01-19 14:40 ` [RFC PATCH 29/34] accel/tcg: Make tb-maint.c target indpendent Anton Johansson via
2024-01-24  3:10   ` Richard Henderson
2024-01-19 14:40 ` [RFC PATCH 30/34] accel/tcg: Make tcg-all.c " Anton Johansson via
2024-01-23 11:45   ` Philippe Mathieu-Daudé
2024-01-23 12:03     ` Anton Johansson via
2024-01-24  3:13   ` Richard Henderson [this message]
2024-01-19 14:40 ` [RFC PATCH 31/34] accel/tcg: Make tcg-runtime-gvec.c target independent Anton Johansson via
2024-01-24  3:15   ` Richard Henderson
2024-01-19 14:40 ` [RFC PATCH 32/34] accel/tcg: Make tcg-runtime.c " Anton Johansson via
2024-01-24  3:16   ` Richard Henderson
2024-01-19 14:40 ` [RFC PATCH 33/34] accel/tcg: Make translator.c (partially) " Anton Johansson via
2024-01-24  3:30   ` Richard Henderson
2024-01-19 14:40 ` [RFC PATCH 34/34] accel/tcg: Compile (a few files) once for system-mode Anton Johansson via

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=d82b3fee-6fd6-469b-93de-84ae5cff238e@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=ale@rev.ng \
    --cc=anjo@rev.ng \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@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).