diff mbox series

tcg: Avoid setting tcg_initialize if !CONFIG_TCG

Message ID 20171026135814.20773-1-richard.henderson@linaro.org
State Accepted
Commit 74d7fc7f6385158b8a5c524c61baaef1b66f3dac
Headers show
Series tcg: Avoid setting tcg_initialize if !CONFIG_TCG | expand

Commit Message

Richard Henderson Oct. 26, 2017, 1:58 p.m. UTC
Fix the build for --disable-tcg.

Fixes: 55c3ceef61fcf06fc98ddc752b7cce788ce7680b
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

---
 target/arm/cpu.c            | 2 ++
 target/i386/cpu.c           | 2 ++
 target/mips/cpu.c           | 2 ++
 target/ppc/translate_init.c | 2 ++
 target/s390x/cpu.c          | 2 ++
 5 files changed, 10 insertions(+)

-- 
2.13.6

Comments

Eduardo Habkost Oct. 26, 2017, 2:05 p.m. UTC | #1
On Thu, Oct 26, 2017 at 03:58:14PM +0200, Richard Henderson wrote:
> Fix the build for --disable-tcg.

> 

> Fixes: 55c3ceef61fcf06fc98ddc752b7cce788ce7680b

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

> ---

>  target/arm/cpu.c            | 2 ++

>  target/i386/cpu.c           | 2 ++

>  target/mips/cpu.c           | 2 ++

>  target/ppc/translate_init.c | 2 ++

>  target/s390x/cpu.c          | 2 ++

>  5 files changed, 10 insertions(+)

> 

> diff --git a/target/arm/cpu.c b/target/arm/cpu.c

> index 056284985d..a7f03eabe8 100644

> --- a/target/arm/cpu.c

> +++ b/target/arm/cpu.c

> @@ -1760,7 +1760,9 @@ static void arm_cpu_class_init(ObjectClass *oc, void *data)

>  #endif

>  

>      cc->disas_set_info = arm_disas_set_info;

> +#ifdef CONFIG_TCG

>      cc->tcg_initialize = arm_translate_init;

> +#endif


I'd prefer to have *_translate_init() stubs instead of the
#ifdefs, but I guess it's better to fix the build as soon as
possible, and worry about eliminating #ifdefs later.

Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>


>  }

>  

>  static void cpu_register(const ARMCPUInfo *info)

> diff --git a/target/i386/cpu.c b/target/i386/cpu.c

> index 53ec94ac9b..2f556c0ea3 100644

> --- a/target/i386/cpu.c

> +++ b/target/i386/cpu.c

> @@ -4212,7 +4212,9 @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data)

>  #endif

>      cc->cpu_exec_enter = x86_cpu_exec_enter;

>      cc->cpu_exec_exit = x86_cpu_exec_exit;

> +#ifdef CONFIG_TCG

>      cc->tcg_initialize = tcg_x86_init;

> +#endif

>  

>      dc->user_creatable = true;

>  }

> diff --git a/target/mips/cpu.c b/target/mips/cpu.c

> index 0ae70288dd..80812f3e08 100644

> --- a/target/mips/cpu.c

> +++ b/target/mips/cpu.c

> @@ -198,7 +198,9 @@ static void mips_cpu_class_init(ObjectClass *c, void *data)

>      cc->vmsd = &vmstate_mips_cpu;

>  #endif

>      cc->disas_set_info = mips_cpu_disas_set_info;

> +#ifdef CONFIG_TCG

>      cc->tcg_initialize = mips_tcg_init;

> +#endif

>  

>      cc->gdb_num_core_regs = 73;

>      cc->gdb_stop_before_watchpoint = true;

> diff --git a/target/ppc/translate_init.c b/target/ppc/translate_init.c

> index 13436e4760..61a9552c1c 100644

> --- a/target/ppc/translate_init.c

> +++ b/target/ppc/translate_init.c

> @@ -10578,7 +10578,9 @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data)

>  #ifndef CONFIG_USER_ONLY

>      cc->virtio_is_big_endian = ppc_cpu_is_big_endian;

>  #endif

> +#ifdef CONFIG_TCG

>      cc->tcg_initialize = ppc_translate_init;

> +#endif

>  

>      dc->fw_name = "PowerPC,UNKNOWN";

>  }

> diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c

> index 824dfd6b65..ae3cee91a2 100644

> --- a/target/s390x/cpu.c

> +++ b/target/s390x/cpu.c

> @@ -497,7 +497,9 @@ static void s390_cpu_class_init(ObjectClass *oc, void *data)

>  #endif

>  #endif

>      cc->disas_set_info = s390_cpu_disas_set_info;

> +#ifdef CONFIG_TCG

>      cc->tcg_initialize = s390x_translate_init;

> +#endif

>  

>      cc->gdb_num_core_regs = S390_NUM_CORE_REGS;

>      cc->gdb_core_xml_file = "s390x-core64.xml";

> -- 

> 2.13.6

> 


-- 
Eduardo
Emilio Cota Oct. 26, 2017, 5:37 p.m. UTC | #2
On Thu, Oct 26, 2017 at 15:58:14 +0200, Richard Henderson wrote:
> Fix the build for --disable-tcg.

> 

> Fixes: 55c3ceef61fcf06fc98ddc752b7cce788ce7680b

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

> ---

>  target/arm/cpu.c            | 2 ++

>  target/i386/cpu.c           | 2 ++

>  target/mips/cpu.c           | 2 ++

>  target/ppc/translate_init.c | 2 ++

>  target/s390x/cpu.c          | 2 ++

>  5 files changed, 10 insertions(+)


AFAIK the only target that is so far supposed to work with
--disable-tcg is i386. The configure script however lets you try to
build without TCG if the host has an alternative accelerator (e.g. KVM),
but that build is likely to fail. [ just confirmed this with aarch64 ]

That said, I like that this patch takes care of other targets too.

Reviewed-by: Emilio G. Cota <cota@braap.org>


Thanks,

		Emilio
Philippe Mathieu-Daudé Oct. 26, 2017, 6:57 p.m. UTC | #3
On 10/26/2017 02:37 PM, Emilio G. Cota wrote:
> AFAIK the only target that is so far supposed to work with

> --disable-tcg is i386. The configure script however lets you try to

> build without TCG if the host has an alternative accelerator (e.g. KVM),

> but that build is likely to fail. [ just confirmed this with aarch64 ]


What about s390x?

  LINK    s390x-softmmu/qemu-system-s390x
exec.o: In function `tlb_reset_dirty_range_all':
exec.c:1118: undefined reference to `tlb_reset_dirty'
exec.o: In function `tcg_commit':
exec.c:2765: undefined reference to `cpu_reloading_memory_map'
cpus.o: In function `tcg_cpu_exec':
cpus.c:1270: undefined reference to `cpu_exec'
cpus.o: In function `qemu_tcg_rr_cpu_thread_fn':
cpus.c:1310: undefined reference to `tcg_register_thread'
cpus.c:1375: undefined reference to `cpu_exec_step_atomic'
cpus.o: In function `qemu_tcg_cpu_thread_fn':
cpus.c:1458: undefined reference to `tcg_register_thread'
cpus.c:1492: undefined reference to `cpu_exec_step_atomic'
cpus.o: In function `qemu_tcg_init_vcpu':
cpus.c:1679: undefined reference to `tcg_region_init'
cpus.c:1689: undefined reference to `parallel_cpus'
target/s390x/cpu.o: In function `s390_cpu_class_init':
target/s390x/cpu.c:500: undefined reference to `s390x_translate_init'
collect2: error: ld returned 1 exit status
Philippe Mathieu-Daudé Oct. 26, 2017, 7:03 p.m. UTC | #4
Oops sent a bit too fast.

On 10/26/2017 03:57 PM, Philippe Mathieu-Daudé wrote:
> On 10/26/2017 02:37 PM, Emilio G. Cota wrote:

>> AFAIK the only target that is so far supposed to work with

>> --disable-tcg is i386. The configure script however lets you try to

>> build without TCG if the host has an alternative accelerator (e.g. KVM),

>> but that build is likely to fail. [ just confirmed this with aarch64 ]

> 

> What about s390x?

> 

>   LINK    s390x-softmmu/qemu-system-s390x

> exec.o: In function `tlb_reset_dirty_range_all':

> exec.c:1118: undefined reference to `tlb_reset_dirty'

> exec.o: In function `tcg_commit':

> exec.c:2765: undefined reference to `cpu_reloading_memory_map'

> cpus.o: In function `tcg_cpu_exec':

> cpus.c:1270: undefined reference to `cpu_exec'

> cpus.o: In function `qemu_tcg_rr_cpu_thread_fn':

> cpus.c:1310: undefined reference to `tcg_register_thread'

> cpus.c:1375: undefined reference to `cpu_exec_step_atomic'

> cpus.o: In function `qemu_tcg_cpu_thread_fn':

> cpus.c:1458: undefined reference to `tcg_register_thread'

> cpus.c:1492: undefined reference to `cpu_exec_step_atomic'

> cpus.o: In function `qemu_tcg_init_vcpu':

> cpus.c:1679: undefined reference to `tcg_region_init'

> cpus.c:1689: undefined reference to `parallel_cpus'

> target/s390x/cpu.o: In function `s390_cpu_class_init':

> target/s390x/cpu.c:500: undefined reference to `s390x_translate_init'

> collect2: error: ld returned 1 exit status


bisected to:

b11ec7f2e44b285a3967d629b55d1a6970b06787 is the first bad commit
commit b11ec7f2e44b285a3967d629b55d1a6970b06787
Author: Yang Zhong <yang.zhong@intel.com>
Date:   Mon Jul 3 18:12:21 2017 +0800

    tcg: add CONFIG_TCG guards in headers

    Add CONFIG_TCG around TLB-related functions and structure declarations.
    Some of these functions are defined in ./accel/tcg/cputlb.c, which will
    not be linked in if TCG is disabled, and have no stubs; therefore, their
    callers will also be compiled out for --disable-tcg.

    Signed-off-by: Yang Zhong <yang.zhong@intel.com>

    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Peter Maydell Oct. 27, 2017, 7:03 a.m. UTC | #5
On 26 October 2017 at 14:58, Richard Henderson
<richard.henderson@linaro.org> wrote:
> Fix the build for --disable-tcg.

>

> Fixes: 55c3ceef61fcf06fc98ddc752b7cce788ce7680b

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

> ---

>  target/arm/cpu.c            | 2 ++

>  target/i386/cpu.c           | 2 ++

>  target/mips/cpu.c           | 2 ++

>  target/ppc/translate_init.c | 2 ++

>  target/s390x/cpu.c          | 2 ++

>  5 files changed, 10 insertions(+)

>


Applied to master as a buildfix, thanks.

-- PMM
Paolo Bonzini Oct. 27, 2017, 10:54 p.m. UTC | #6
On 26/10/2017 21:03, Philippe Mathieu-Daudé wrote:
>> AFAIK the only target that is so far supposed to work with

>> --disable-tcg is i386. The configure script however lets you try to

>> build without TCG if the host has an alternative accelerator (e.g. KVM),

>> but that build is likely to fail. [ just confirmed this with aarch64 ]

> What about s390x?


s390x and ppc64 supposedly support --disable-tcg?

Paolo
Thomas Huth Oct. 28, 2017, 7:48 a.m. UTC | #7
On 28.10.2017 00:54, Paolo Bonzini wrote:
> On 26/10/2017 21:03, Philippe Mathieu-Daudé wrote:

>>> AFAIK the only target that is so far supposed to work with

>>> --disable-tcg is i386. The configure script however lets you try to

>>> build without TCG if the host has an alternative accelerator (e.g. KVM),

>>> but that build is likely to fail. [ just confirmed this with aarch64 ]

>> What about s390x?

> 

> s390x and ppc64 supposedly support --disable-tcg?


s390x supports --disable-tcg, but ppc64 does not support it yet.

 Thomas
Philippe Mathieu-Daudé Oct. 30, 2017, 3:25 a.m. UTC | #8
Hi Peter,

On 10/27/2017 04:03 AM, Peter Maydell wrote:
> On 26 October 2017 at 14:58, Richard Henderson

> <richard.henderson@linaro.org> wrote:

>> Fix the build for --disable-tcg.

>>

>> Fixes: 55c3ceef61fcf06fc98ddc752b7cce788ce7680b

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

>> ---

> 

> Applied to master as a buildfix, thanks.


I couldn't see this buildfix merged in /master so I provided another
version using stubs and details about offending commits there:

http://lists.nongnu.org/archive/html/qemu-devel/2017-10/msg06530.html

In case you didn't pushed to /master you might consider this series instead.

I didn't include ARM/MIPS/PPC since they don't support building without
TCG (yet).

Regards,

Phil.
Philippe Mathieu-Daudé Oct. 30, 2017, 4:06 a.m. UTC | #9
>>> Fix the build for --disable-tcg.

>>>

>>> Fixes: 55c3ceef61fcf06fc98ddc752b7cce788ce7680b

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

>>> ---

>>

>> Applied to master as a buildfix, thanks.

> 

> I couldn't see this buildfix merged in /master so I provided another

> version using stubs and details about offending commits there:

> 

> http://lists.nongnu.org/archive/html/qemu-devel/2017-10/msg06530.html

> 

> In case you didn't pushed to /master you might consider this series instead.


Oops sorry I missed it in commit 74d7fc7f6385  and the conflicting merge
6e6430a821a1.
diff mbox series

Patch

diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index 056284985d..a7f03eabe8 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -1760,7 +1760,9 @@  static void arm_cpu_class_init(ObjectClass *oc, void *data)
 #endif
 
     cc->disas_set_info = arm_disas_set_info;
+#ifdef CONFIG_TCG
     cc->tcg_initialize = arm_translate_init;
+#endif
 }
 
 static void cpu_register(const ARMCPUInfo *info)
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 53ec94ac9b..2f556c0ea3 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -4212,7 +4212,9 @@  static void x86_cpu_common_class_init(ObjectClass *oc, void *data)
 #endif
     cc->cpu_exec_enter = x86_cpu_exec_enter;
     cc->cpu_exec_exit = x86_cpu_exec_exit;
+#ifdef CONFIG_TCG
     cc->tcg_initialize = tcg_x86_init;
+#endif
 
     dc->user_creatable = true;
 }
diff --git a/target/mips/cpu.c b/target/mips/cpu.c
index 0ae70288dd..80812f3e08 100644
--- a/target/mips/cpu.c
+++ b/target/mips/cpu.c
@@ -198,7 +198,9 @@  static void mips_cpu_class_init(ObjectClass *c, void *data)
     cc->vmsd = &vmstate_mips_cpu;
 #endif
     cc->disas_set_info = mips_cpu_disas_set_info;
+#ifdef CONFIG_TCG
     cc->tcg_initialize = mips_tcg_init;
+#endif
 
     cc->gdb_num_core_regs = 73;
     cc->gdb_stop_before_watchpoint = true;
diff --git a/target/ppc/translate_init.c b/target/ppc/translate_init.c
index 13436e4760..61a9552c1c 100644
--- a/target/ppc/translate_init.c
+++ b/target/ppc/translate_init.c
@@ -10578,7 +10578,9 @@  static void ppc_cpu_class_init(ObjectClass *oc, void *data)
 #ifndef CONFIG_USER_ONLY
     cc->virtio_is_big_endian = ppc_cpu_is_big_endian;
 #endif
+#ifdef CONFIG_TCG
     cc->tcg_initialize = ppc_translate_init;
+#endif
 
     dc->fw_name = "PowerPC,UNKNOWN";
 }
diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
index 824dfd6b65..ae3cee91a2 100644
--- a/target/s390x/cpu.c
+++ b/target/s390x/cpu.c
@@ -497,7 +497,9 @@  static void s390_cpu_class_init(ObjectClass *oc, void *data)
 #endif
 #endif
     cc->disas_set_info = s390_cpu_disas_set_info;
+#ifdef CONFIG_TCG
     cc->tcg_initialize = s390x_translate_init;
+#endif
 
     cc->gdb_num_core_regs = S390_NUM_CORE_REGS;
     cc->gdb_core_xml_file = "s390x-core64.xml";