* [Qemu-devel] [PATCH] tcg: fix --disable-tcg build breakage
@ 2018-06-22 17:45 Emilio G. Cota
2018-06-22 17:53 ` Richard Henderson
2018-06-23 20:04 ` Peter Maydell
0 siblings, 2 replies; 5+ messages in thread
From: Emilio G. Cota @ 2018-06-22 17:45 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Maydell, Richard Henderson
Fix the --disable-tcg breakage introduced by tb_lock's removal by
relying on the fact that tcg_enabled() is set to 0 at
compile-time under --disable-tcg.
While at it, add further asserts to fix builds that enable both
--disable-tcg and --enable-debug, which were broken even before
tb_lock's removal.
Tested to build x86_64-softmmu and i386-softmmu targets.
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Emilio G. Cota <cota@braap.org>
---
accel/stubs/tcg-stub.c | 4 ----
cpus.c | 4 ++++
exec.c | 3 +++
3 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/accel/stubs/tcg-stub.c b/accel/stubs/tcg-stub.c
index ee575a8..76ae461 100644
--- a/accel/stubs/tcg-stub.c
+++ b/accel/stubs/tcg-stub.c
@@ -21,10 +21,6 @@ void tb_flush(CPUState *cpu)
{
}
-void tb_unlock(void)
-{
-}
-
void tlb_set_dirty(CPUState *cpu, target_ulong vaddr)
{
}
diff --git a/cpus.c b/cpus.c
index d1f1629..8cd552e 100644
--- a/cpus.c
+++ b/cpus.c
@@ -1355,6 +1355,7 @@ static int tcg_cpu_exec(CPUState *cpu)
int64_t ti;
#endif
+ assert(tcg_enabled());
#ifdef CONFIG_PROFILER
ti = profile_getclock();
#endif
@@ -1397,6 +1398,7 @@ static void *qemu_tcg_rr_cpu_thread_fn(void *arg)
{
CPUState *cpu = arg;
+ assert(tcg_enabled());
rcu_register_thread();
tcg_register_thread();
@@ -1631,6 +1633,7 @@ static void *qemu_tcg_cpu_thread_fn(void *arg)
{
CPUState *cpu = arg;
+ assert(tcg_enabled());
g_assert(!use_icount);
rcu_register_thread();
@@ -1854,6 +1857,7 @@ static void qemu_tcg_init_vcpu(CPUState *cpu)
static QemuThread *single_tcg_cpu_thread;
static int tcg_region_inited;
+ assert(tcg_enabled());
/*
* Initialize TCG regions--once. Now is a good time, because:
* (1) TCG's init context, prologue and target globals have been set up.
diff --git a/exec.c b/exec.c
index 28f9bdc..88edb59 100644
--- a/exec.c
+++ b/exec.c
@@ -1323,6 +1323,7 @@ static void tlb_reset_dirty_range_all(ram_addr_t start, ram_addr_t length)
RAMBlock *block;
ram_addr_t end;
+ assert(tcg_enabled());
end = TARGET_PAGE_ALIGN(start + length);
start &= TARGET_PAGE_MASK;
@@ -2655,6 +2656,7 @@ void memory_notdirty_write_prepare(NotDirtyInfo *ndi,
void memory_notdirty_write_complete(NotDirtyInfo *ndi)
{
if (ndi->pages) {
+ assert(tcg_enabled());
page_collection_unlock(ndi->pages);
ndi->pages = NULL;
}
@@ -3046,6 +3048,7 @@ static void tcg_commit(MemoryListener *listener)
CPUAddressSpace *cpuas;
AddressSpaceDispatch *d;
+ assert(tcg_enabled());
/* since each CPU stores ram addresses in its TLB cache, we must
reset the modified entries */
cpuas = container_of(listener, CPUAddressSpace, tcg_as_listener);
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] tcg: fix --disable-tcg build breakage
2018-06-22 17:45 [Qemu-devel] [PATCH] tcg: fix " Emilio G. Cota
@ 2018-06-22 17:53 ` Richard Henderson
2018-06-23 20:04 ` Peter Maydell
1 sibling, 0 replies; 5+ messages in thread
From: Richard Henderson @ 2018-06-22 17:53 UTC (permalink / raw)
To: Emilio G. Cota, qemu-devel; +Cc: Peter Maydell
On 06/22/2018 10:45 AM, Emilio G. Cota wrote:
> Fix the --disable-tcg breakage introduced by tb_lock's removal by
> relying on the fact that tcg_enabled() is set to 0 at
> compile-time under --disable-tcg.
>
> While at it, add further asserts to fix builds that enable both
> --disable-tcg and --enable-debug, which were broken even before
> tb_lock's removal.
>
> Tested to build x86_64-softmmu and i386-softmmu targets.
>
> Reported-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Emilio G. Cota <cota@braap.org>
> ---
> accel/stubs/tcg-stub.c | 4 ----
> cpus.c | 4 ++++
> exec.c | 3 +++
> 3 files changed, 7 insertions(+), 4 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Peter, I'm assuming you'll take this directly to master as a build fix.
r~
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] tcg: fix --disable-tcg build breakage
2018-06-22 17:45 [Qemu-devel] [PATCH] tcg: fix " Emilio G. Cota
2018-06-22 17:53 ` Richard Henderson
@ 2018-06-23 20:04 ` Peter Maydell
1 sibling, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2018-06-23 20:04 UTC (permalink / raw)
To: Emilio G. Cota; +Cc: QEMU Developers, Richard Henderson
On 22 June 2018 at 18:45, Emilio G. Cota <cota@braap.org> wrote:
> Fix the --disable-tcg breakage introduced by tb_lock's removal by
> relying on the fact that tcg_enabled() is set to 0 at
> compile-time under --disable-tcg.
>
> While at it, add further asserts to fix builds that enable both
> --disable-tcg and --enable-debug, which were broken even before
> tb_lock's removal.
>
> Tested to build x86_64-softmmu and i386-softmmu targets.
>
> Reported-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Emilio G. Cota <cota@braap.org>
Applied to master as a fix for the travis builds; thanks.
-- PMM
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Qemu-devel] [PATCH] tcg: Fix --disable-tcg build breakage
@ 2018-06-29 20:07 Philippe Mathieu-Daudé
2018-07-02 12:42 ` Peter Maydell
0 siblings, 1 reply; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-06-29 20:07 UTC (permalink / raw)
To: Paolo Bonzini, Peter Maydell, Richard Henderson
Cc: Philippe Mathieu-Daudé, qemu-devel, Emilio G . Cota,
Peter Crosthwaite, Richard Henderson
Fix the --disable-tcg breakage introduced by 8bca9a03ec60d:
$ configure --disable-tcg
[...]
$ make -C i386-softmmu exec.o
make: Entering directory 'i386-softmmu'
CC exec.o
In file included from source/qemu/exec.c:62:0:
source/qemu/include/exec/ram_addr.h:96:6: error: conflicting types for ‘tb_invalidate_phys_range’
void tb_invalidate_phys_range(ram_addr_t start, ram_addr_t end);
^~~~~~~~~~~~~~~~~~~~~~~~
In file included from source/qemu/exec.c:24:0:
source/qemu/include/exec/exec-all.h:309:6: note: previous declaration of ‘tb_invalidate_phys_range’ was here
void tb_invalidate_phys_range(target_ulong start, target_ulong end);
^~~~~~~~~~~~~~~~~~~~~~~~
source/qemu/exec.c:1043:6: error: conflicting types for ‘tb_invalidate_phys_addr’
void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr, MemTxAttrs attrs)
^~~~~~~~~~~~~~~~~~~~~~~
In file included from source/qemu/exec.c:24:0:
source/qemu/include/exec/exec-all.h:308:6: note: previous declaration of ‘tb_invalidate_phys_addr’ was here
void tb_invalidate_phys_addr(target_ulong addr);
^~~~~~~~~~~~~~~~~~~~~~~
make: *** [source/qemu/rules.mak:69: exec.o] Error 1
make: Leaving directory 'i386-softmmu'
Tested to build x86_64-softmmu and i386-softmmu targets.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
include/exec/exec-all.h | 13 +++++++++----
accel/stubs/tcg-stub.c | 6 ++++++
exec.c | 2 +-
3 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
index 6a7e7a866e..cb497dee0b 100644
--- a/include/exec/exec-all.h
+++ b/include/exec/exec-all.h
@@ -255,7 +255,6 @@ void tlb_set_page_with_attrs(CPUState *cpu, target_ulong vaddr,
void tlb_set_page(CPUState *cpu, target_ulong vaddr,
hwaddr paddr, int prot,
int mmu_idx, target_ulong size);
-void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr, MemTxAttrs attrs);
void probe_write(CPUArchState *env, target_ulong addr, int size, int mmu_idx,
uintptr_t retaddr);
#else
@@ -304,9 +303,6 @@ static inline void tlb_flush_by_mmuidx_all_cpus_synced(CPUState *cpu,
uint16_t idxmap)
{
}
-
-void tb_invalidate_phys_addr(target_ulong addr);
-void tb_invalidate_phys_range(target_ulong start, target_ulong end);
#endif
#define CODE_GEN_ALIGN 16 /* must be >= of the size of a icache line */
@@ -415,6 +411,15 @@ static inline uint32_t curr_cflags(void)
| (use_icount ? CF_USE_ICOUNT : 0);
}
+/* TranslationBlock invalidate API */
+#if !defined(CONFIG_USER_ONLY) && defined(CONFIG_TCG)
+void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr, MemTxAttrs attrs);
+#else
+void tb_invalidate_phys_addr(target_ulong addr);
+#endif
+#if defined(CONFIG_USER_ONLY)
+void tb_invalidate_phys_range(target_ulong start, target_ulong end);
+#endif
void tb_flush(CPUState *cpu);
void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr);
TranslationBlock *tb_htable_lookup(CPUState *cpu, target_ulong pc,
diff --git a/accel/stubs/tcg-stub.c b/accel/stubs/tcg-stub.c
index 76ae461749..8ee85ed665 100644
--- a/accel/stubs/tcg-stub.c
+++ b/accel/stubs/tcg-stub.c
@@ -16,6 +16,7 @@
#include "tcg/tcg.h"
#include "exec/cpu-common.h"
#include "exec/exec-all.h"
+#include "translate-all.h"
void tb_flush(CPUState *cpu)
{
@@ -24,3 +25,8 @@ void tb_flush(CPUState *cpu)
void tlb_set_dirty(CPUState *cpu, target_ulong vaddr)
{
}
+
+void tb_invalidate_phys_page_range(tb_page_addr_t start, tb_page_addr_t end,
+ int is_cpu_write_access)
+{
+}
diff --git a/exec.c b/exec.c
index cdcf769daa..ee726888a5 100644
--- a/exec.c
+++ b/exec.c
@@ -1027,7 +1027,7 @@ const char *parse_cpu_model(const char *cpu_model)
return cpu_type;
}
-#if defined(CONFIG_USER_ONLY)
+#if defined(CONFIG_USER_ONLY) || !defined(CONFIG_TCG)
void tb_invalidate_phys_addr(target_ulong addr)
{
mmap_lock();
--
2.18.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] tcg: Fix --disable-tcg build breakage
2018-06-29 20:07 [Qemu-devel] [PATCH] tcg: Fix --disable-tcg build breakage Philippe Mathieu-Daudé
@ 2018-07-02 12:42 ` Peter Maydell
0 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2018-07-02 12:42 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: Paolo Bonzini, Richard Henderson, QEMU Developers,
Emilio G . Cota, Peter Crosthwaite, Richard Henderson
On 29 June 2018 at 21:07, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
> Fix the --disable-tcg breakage introduced by 8bca9a03ec60d:
>
> $ configure --disable-tcg
> [...]
> $ make -C i386-softmmu exec.o
> make: Entering directory 'i386-softmmu'
> CC exec.o
> In file included from source/qemu/exec.c:62:0:
> source/qemu/include/exec/ram_addr.h:96:6: error: conflicting types for ‘tb_invalidate_phys_range’
> void tb_invalidate_phys_range(ram_addr_t start, ram_addr_t end);
> ^~~~~~~~~~~~~~~~~~~~~~~~
> In file included from source/qemu/exec.c:24:0:
> source/qemu/include/exec/exec-all.h:309:6: note: previous declaration of ‘tb_invalidate_phys_range’ was here
> void tb_invalidate_phys_range(target_ulong start, target_ulong end);
> ^~~~~~~~~~~~~~~~~~~~~~~~
> source/qemu/exec.c:1043:6: error: conflicting types for ‘tb_invalidate_phys_addr’
> void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr, MemTxAttrs attrs)
> ^~~~~~~~~~~~~~~~~~~~~~~
> In file included from source/qemu/exec.c:24:0:
> source/qemu/include/exec/exec-all.h:308:6: note: previous declaration of ‘tb_invalidate_phys_addr’ was here
> void tb_invalidate_phys_addr(target_ulong addr);
> ^~~~~~~~~~~~~~~~~~~~~~~
> make: *** [source/qemu/rules.mak:69: exec.o] Error 1
> make: Leaving directory 'i386-softmmu'
>
> Tested to build x86_64-softmmu and i386-softmmu targets.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Thanks; applied to master as a build fix.
(I've also added a notcg config to my test set for merge builds.)
-- PMM
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-07-02 12:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-29 20:07 [Qemu-devel] [PATCH] tcg: Fix --disable-tcg build breakage Philippe Mathieu-Daudé
2018-07-02 12:42 ` Peter Maydell
-- strict thread matches above, loose matches on Subject: below --
2018-06-22 17:45 [Qemu-devel] [PATCH] tcg: fix " Emilio G. Cota
2018-06-22 17:53 ` Richard Henderson
2018-06-23 20:04 ` Peter Maydell
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).