On 21/03/25, Philippe Mathieu-Daudé wrote:
> In order to use TCG with multiple targets, replace the
> compile time use of TCG_GUEST_DEFAULT_MO by a runtime
> access to tcg_ctx->guest_mo.
> 
> Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org>
> ---
>  accel/tcg/internal-target.h | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/accel/tcg/internal-target.h b/accel/tcg/internal-target.h
> index 1cb35dba99e..014ee756f9d 100644
> --- a/accel/tcg/internal-target.h
> +++ b/accel/tcg/internal-target.h
> @@ -49,11 +49,9 @@ G_NORETURN void cpu_io_recompile(CPUState *cpu, uintptr_t 
> retaddr);
>   * Filter @type to the barrier that is required for the guest
>   * memory ordering vs the host memory ordering.  A non-zero
>   * result indicates that some barrier is required.
> - *
> - * This is a macro so that it's constant even without optimization.
>   */
>  #define tcg_req_mo(type) \
> -    ((type) & TCG_GUEST_DEFAULT_MO & ~TCG_TARGET_DEFAULT_MO)
> +    ((type) & tcg_ctx->guest_mo & ~TCG_TARGET_DEFAULT_MO)
>  
>  /**
>   * cpu_req_mo:
> -- 
> 2.47.1
> 

I'll parrot some older feedback by Richard

  https://lore.kernel.org/all/92cc9335-10bf-4a74-9eb4-249de5545...@linaro.org/

but tcg_ctx->guest_mo can be undefined or bogus here. Could we not
take cpu and access cpu->cc->tcg_ops->guest_default_memory_order
directly instead?

Reply via email to