From bac05aa9a77af1ca7972c8dc07560f4daa7c2dfc Mon Sep 17 00:00:00 2001 From: Andrey Smetanin Date: Fri, 3 Jul 2015 15:01:44 +0300 Subject: cpu: Add crash_occurred flag into CPUState MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CPUState::crash_occurred field inside CPUState marks that guest crash occurred. This value is added into cpu common migration subsection. Signed-off-by: Andrey Smetanin Signed-off-by: Denis V. Lunev CC: Paolo Bonzini CC: Andreas Färber Message-Id: <1435924905-8926-12-git-send-email-den@openvz.org> [Document the new field. - Paolo] Signed-off-by: Paolo Bonzini --- exec.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'exec.c') diff --git a/exec.c b/exec.c index b61126cb76..07dfeae4d8 100644 --- a/exec.c +++ b/exec.c @@ -478,6 +478,24 @@ static const VMStateDescription vmstate_cpu_common_exception_index = { } }; +static bool cpu_common_crash_occurred_needed(void *opaque) +{ + CPUState *cpu = opaque; + + return cpu->crash_occurred; +} + +static const VMStateDescription vmstate_cpu_common_crash_occurred = { + .name = "cpu_common/crash_occurred", + .version_id = 1, + .minimum_version_id = 1, + .needed = cpu_common_crash_occurred_needed, + .fields = (VMStateField[]) { + VMSTATE_BOOL(crash_occurred, CPUState), + VMSTATE_END_OF_LIST() + } +}; + const VMStateDescription vmstate_cpu_common = { .name = "cpu_common", .version_id = 1, @@ -491,6 +509,7 @@ const VMStateDescription vmstate_cpu_common = { }, .subsections = (const VMStateDescription*[]) { &vmstate_cpu_common_exception_index, + &vmstate_cpu_common_crash_occurred, NULL } }; -- cgit v1.2.3 From 9a13565d52bfd321934fb44ee004bbaf5f5913a8 Mon Sep 17 00:00:00 2001 From: Peter Crosthwaite Date: Thu, 10 Sep 2015 22:39:41 -0700 Subject: cputlb: move CPU_LOOP() for tlb_reset() to exec.c To prepare for multi-arch, cputlb.c should only have awareness of one single architecture. This means it should not have access to the full CPU lists which may be heterogeneous. Instead, push the CPU_LOOP() up to the one and only caller in exec.c. Signed-off-by: Peter Crosthwaite Message-Id: Signed-off-by: Paolo Bonzini --- exec.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'exec.c') diff --git a/exec.c b/exec.c index 07dfeae4d8..1fa27f5c08 100644 --- a/exec.c +++ b/exec.c @@ -913,6 +913,7 @@ found: static void tlb_reset_dirty_range_all(ram_addr_t start, ram_addr_t length) { + CPUState *cpu; ram_addr_t start1; RAMBlock *block; ram_addr_t end; @@ -924,7 +925,9 @@ static void tlb_reset_dirty_range_all(ram_addr_t start, ram_addr_t length) block = qemu_get_ram_block(start); assert(block == qemu_get_ram_block(end - 1)); start1 = (uintptr_t)ramblock_ptr(block, start - block->offset); - cpu_tlb_reset_dirty_all(start1, length); + CPU_FOREACH(cpu) { + tlb_reset_dirty(cpu, start1, length); + } rcu_read_unlock(); } -- cgit v1.2.3 From bcae01e468d961ad9afaf4148329147e4be209ab Mon Sep 17 00:00:00 2001 From: Peter Crosthwaite Date: Thu, 10 Sep 2015 22:39:42 -0700 Subject: cputlb: Change tlb_set_dirty() arg to cpu Change tlb_set_dirty() to accept a CPU instead of an env pointer. This allows for removal of another CPUArchState usage from prototypes that need to be QOMified. Signed-off-by: Peter Crosthwaite Message-Id: Signed-off-by: Paolo Bonzini --- exec.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'exec.c') diff --git a/exec.c b/exec.c index 1fa27f5c08..f760f44911 100644 --- a/exec.c +++ b/exec.c @@ -1922,8 +1922,7 @@ static void notdirty_mem_write(void *opaque, hwaddr ram_addr, /* we remove the notdirty callback only if the code has been flushed */ if (!cpu_physical_memory_is_clean(ram_addr)) { - CPUArchState *env = current_cpu->env_ptr; - tlb_set_dirty(env, current_cpu->mem_io_vaddr); + tlb_set_dirty(current_cpu, current_cpu->mem_io_vaddr); } } -- cgit v1.2.3 From dfccc7602374c9fd3b083208b552d62daa244811 Mon Sep 17 00:00:00 2001 From: Peter Crosthwaite Date: Thu, 10 Sep 2015 22:39:43 -0700 Subject: include/exec: Move cputlb exec.c defs out Move the architecture agnostic function prototypes for exec.c out of cputlb.h to exec-all.h. This allows hiding of the arch specific cputlb.h from exec.c which should be getting close to having no architecture specifics. Prepares support for multi-arch, which will have a minimal cpu.h that services exec.c but not cputlb.h. Reviewed-by: Richard Henderson Signed-off-by: Peter Crosthwaite Message-Id: Signed-off-by: Paolo Bonzini --- exec.c | 1 - 1 file changed, 1 deletion(-) (limited to 'exec.c') diff --git a/exec.c b/exec.c index f760f44911..47ada31040 100644 --- a/exec.c +++ b/exec.c @@ -49,7 +49,6 @@ #include "exec/cpu-all.h" #include "qemu/rcu_queue.h" #include "qemu/main-loop.h" -#include "exec/cputlb.h" #include "translate-all.h" #include "exec/memory-internal.h" -- cgit v1.2.3