[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v1 09/15] core: Convert tcg_enabled() uses to any/al
From: |
Peter Crosthwaite |
Subject: |
[Qemu-devel] [PATCH v1 09/15] core: Convert tcg_enabled() uses to any/all variants |
Date: |
Thu, 10 Sep 2015 22:39:39 -0700 |
Convert core code usages of tcg_enabled() which don't have a specific
CPU associated with, to either tcg_any_enabled() or tcg_all_enabled().
This is to prepare support for multiple tcg engines, where queries must
query a specific CPU or use global any/all logic.
Signed-off-by: Peter Crosthwaite <address@hidden>
---
Changed since RFCv3:
Tweak commit subject (too long)
cpus.c | 2 +-
exec.c | 4 ++--
include/exec/ram_addr.h | 5 +++--
memory.c | 8 ++++----
4 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/cpus.c b/cpus.c
index 9365e03..da4026e 100644
--- a/cpus.c
+++ b/cpus.c
@@ -1165,7 +1165,7 @@ void qemu_mutex_lock_iothread(void)
/* In the simple case there is no need to bump the VCPU thread out of
* TCG code execution.
*/
- if (!tcg_enabled() || qemu_in_vcpu_thread() ||
+ if (!tcg_any_enabled() || qemu_in_vcpu_thread() ||
!first_cpu || !first_cpu->thread) {
qemu_mutex_lock(&qemu_global_mutex);
atomic_dec(&iothread_requesting_mutex);
diff --git a/exec.c b/exec.c
index 54cd70a..c120730 100644
--- a/exec.c
+++ b/exec.c
@@ -926,7 +926,7 @@ bool cpu_physical_memory_test_and_clear_dirty(ram_addr_t
start,
dirty = bitmap_test_and_clear_atomic(ram_list.dirty_memory[client],
page, end - page);
- if (dirty && tcg_enabled()) {
+ if (dirty && tcg_any_enabled()) {
tlb_reset_dirty_range_all(start, length);
}
@@ -2592,7 +2592,7 @@ void cpu_flush_icache_range(hwaddr start, int len)
* so there is no need to flush anything. For KVM / Xen we need to flush
* the host's instruction cache at least.
*/
- if (tcg_enabled()) {
+ if (!tcg_all_enabled()) {
return;
}
diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h
index c113f21..2e8fdd1 100644
--- a/include/exec/ram_addr.h
+++ b/include/exec/ram_addr.h
@@ -164,14 +164,15 @@ static inline void
cpu_physical_memory_set_dirty_lebitmap(unsigned long *bitmap,
atomic_or(&d[DIRTY_MEMORY_MIGRATION][page + k], temp);
atomic_or(&d[DIRTY_MEMORY_VGA][page + k], temp);
- if (tcg_enabled()) {
+ if (tcg_any_enabled()) {
atomic_or(&d[DIRTY_MEMORY_CODE][page + k], temp);
}
}
}
xen_modified_memory(start, pages << TARGET_PAGE_BITS);
} else {
- uint8_t clients = tcg_enabled() ? DIRTY_CLIENTS_ALL :
DIRTY_CLIENTS_NOCODE;
+ uint8_t clients = tcg_any_enabled() ? DIRTY_CLIENTS_ALL
+ : DIRTY_CLIENTS_NOCODE;
/*
* bitmap-traveling is faster than memory-traveling (for addr...)
* especially when most of the memory is not dirty.
diff --git a/memory.c b/memory.c
index 0d8b2d9..59c65f1 100644
--- a/memory.c
+++ b/memory.c
@@ -1198,7 +1198,7 @@ void memory_region_init_ram(MemoryRegion *mr,
mr->terminates = true;
mr->destructor = memory_region_destructor_ram;
mr->ram_addr = qemu_ram_alloc(size, mr, errp);
- mr->dirty_log_mask = tcg_enabled() ? (1 << DIRTY_MEMORY_CODE) : 0;
+ mr->dirty_log_mask = tcg_any_enabled() ? (1 << DIRTY_MEMORY_CODE) : 0;
}
void memory_region_init_resizeable_ram(MemoryRegion *mr,
@@ -1216,7 +1216,7 @@ void memory_region_init_resizeable_ram(MemoryRegion *mr,
mr->terminates = true;
mr->destructor = memory_region_destructor_ram;
mr->ram_addr = qemu_ram_alloc_resizeable(size, max_size, resized, mr,
errp);
- mr->dirty_log_mask = tcg_enabled() ? (1 << DIRTY_MEMORY_CODE) : 0;
+ mr->dirty_log_mask = tcg_any_enabled() ? (1 << DIRTY_MEMORY_CODE) : 0;
}
#ifdef __linux__
@@ -1233,7 +1233,7 @@ void memory_region_init_ram_from_file(MemoryRegion *mr,
mr->terminates = true;
mr->destructor = memory_region_destructor_ram;
mr->ram_addr = qemu_ram_alloc_from_file(size, mr, share, path, errp);
- mr->dirty_log_mask = tcg_enabled() ? (1 << DIRTY_MEMORY_CODE) : 0;
+ mr->dirty_log_mask = tcg_any_enabled() ? (1 << DIRTY_MEMORY_CODE) : 0;
}
#endif
@@ -1247,7 +1247,7 @@ void memory_region_init_ram_ptr(MemoryRegion *mr,
mr->ram = true;
mr->terminates = true;
mr->destructor = memory_region_destructor_ram_from_ptr;
- mr->dirty_log_mask = tcg_enabled() ? (1 << DIRTY_MEMORY_CODE) : 0;
+ mr->dirty_log_mask = tcg_any_enabled() ? (1 << DIRTY_MEMORY_CODE) : 0;
/* qemu_ram_alloc_from_ptr cannot fail with ptr != NULL. */
assert(ptr != NULL);
--
1.9.1
- Re: [Qemu-devel] [PATCH v1 03/15] translate-all: Move tcg_handle_interrupt() to -common, (continued)
- [Qemu-devel] [PATCH v1 04/15] tcg: split tcg_op_defs to -common, Peter Crosthwaite, 2015/09/11
- [Qemu-devel] [PATCH v1 06/15] translate: move real_host_page setting to -common, Peter Crosthwaite, 2015/09/11
- [Qemu-devel] [PATCH v1 05/15] tcg: Move tcg_tb_ptr to -common, Peter Crosthwaite, 2015/09/11
- [Qemu-devel] [PATCH v1 07/15] cpus: Listify cpu_list() function, Peter Crosthwaite, 2015/09/11
- [Qemu-devel] [PATCH v1 08/15] translate-common: Listify tcg_enabled(), Peter Crosthwaite, 2015/09/11
- [Qemu-devel] [PATCH v1 10/15] exec-all: Move cpu_can_do_io() to qom/cpu.h, Peter Crosthwaite, 2015/09/11
- [Qemu-devel] [PATCH v1 11/15] cputlb: move CPU_LOOP() for tlb_reset() to exec.c, Peter Crosthwaite, 2015/09/11
- [Qemu-devel] [PATCH v1 12/15] cputlb: Change tlb_set_dirty() arg to cpu, Peter Crosthwaite, 2015/09/11
- [Qemu-devel] [PATCH v1 09/15] core: Convert tcg_enabled() uses to any/all variants,
Peter Crosthwaite <=
- [Qemu-devel] [PATCH v1 13/15] include/exec: Move cputlb exec.c defs out, Peter Crosthwaite, 2015/09/11
- [Qemu-devel] [PATCH v1 14/15] cpu-common: Define tb_page_addr_t for everyone, Peter Crosthwaite, 2015/09/11
- [Qemu-devel] [PATCH v1 15/15] monitor: uninclude cpu_ldst, Peter Crosthwaite, 2015/09/11
- Re: [Qemu-devel] [PATCH v1 00/15] Multi-Arch Phase 1, Paolo Bonzini, 2015/09/11