qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC v12 31/65] target/arm: move exception code out of tcg/helper.c


From: Richard Henderson
Subject: Re: [RFC v12 31/65] target/arm: move exception code out of tcg/helper.c
Date: Thu, 8 Apr 2021 08:05:24 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1

On 4/8/21 3:56 AM, Claudio Fontana wrote:
It is a struggle to balance making TCG-only symbols "invisible" to kvm-builds, 
so one developing for KVM only can forget about them,
and keeping TCG things contained,

and on the other side opening up the ability to use tcg_enabled(), which 
requires those prototypes to be visible.

Where do you see that balance?

The short answer is I'd keep the prototypes available, always.

The longer answer is that I'd make more use of QEMU_ERROR().

I think I described this off-hand before, but let me develop this thought more completely. Let's put some defines in a handy common header file:

#ifdef CONFIG_TCG
#define REQUIRE_TCG
#else
#define REQUIRE_TCG  QEMU_ERROR("tcg function is reachable")
#endif

and so on for all of the other accelerators, as well as

#ifdef CONFIG_USER_ONLY
#define REQUIRE_USER_ONLY
#define REQUIRE_SYSEMU QEMU_ERROR("sysemu function is reachable")
#else
#define REQUIRE_USER_ONLY \
  QEMU_ERROR("user-only function is reachable")
#define REQUIRE_SYSEMU
#endif

Then, in target/foo/bar.h, instead of

#ifdef CONFIG_TCG
void some_function(...);
#endif

we write

void some_function(...) REQUIRE_TCG;

which is self-documentary, and also generates a compile error when the function call has not been eliminated by a guard such as tcg_enabled (as opposed to waiting until link time for the missing symbol).


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]