aboutsummaryrefslogtreecommitdiff
path: root/exec.c
diff options
context:
space:
mode:
authorHuang Ying <ying.huang@intel.com>2009-09-21 10:43:25 +0800
committerAvi Kivity <avi@redhat.com>2009-09-21 12:21:31 +0300
commit4b62fff1101a7ad77553147717a8bd3bf79df7ef (patch)
tree069a2dd276c67e15ee02816a847001e868fcf67d /exec.c
parentvga: move back dirty_log functions to vga.c (diff)
downloadqemu-kvm-4b62fff1101a7ad77553147717a8bd3bf79df7ef.tar.gz
qemu-kvm-4b62fff1101a7ad77553147717a8bd3bf79df7ef.tar.bz2
qemu-kvm-4b62fff1101a7ad77553147717a8bd3bf79df7ef.zip
MCE: Relay UCR MCE to guest
UCR (uncorrected recovery) MCE is supported in recent Intel CPUs, where some hardware error such as some memory error can be reported without PCC (processor context corrupted). To recover from such MCE, the corresponding memory will be unmapped, and all processes accessing the memory will be killed via SIGBUS. For KVM, if QEMU/KVM is killed, all guest processes will be killed too. So we relay SIGBUS from host OS to guest system via a UCR MCE injection. Then guest OS can isolate corresponding memory and kill necessary guest processes only. SIGBUS sent to main thread (not VCPU threads) will be broadcast to all VCPU threads as UCR MCE. Signed-off-by: Huang Ying <ying.huang@intel.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/exec.c b/exec.c
index aff9ec8c5..5c9edf71f 100644
--- a/exec.c
+++ b/exec.c
@@ -2600,9 +2600,7 @@ void *qemu_get_ram_ptr(ram_addr_t addr)
return block->host + (addr - block->offset);
}
-/* Some of the softmmu routines need to translate from a host pointer
- (typically a TLB entry) back to a ram offset. */
-ram_addr_t qemu_ram_addr_from_host(void *ptr)
+int do_qemu_ram_addr_from_host(void *ptr, ram_addr_t *ram_addr)
{
RAMBlock *prev;
RAMBlock **prevp;
@@ -2619,11 +2617,23 @@ ram_addr_t qemu_ram_addr_from_host(void *ptr)
prev = block;
block = block->next;
}
- if (!block) {
+ if (!block)
+ return -1;
+ *ram_addr = block->offset + (host - block->host);
+ return 0;
+}
+
+/* Some of the softmmu routines need to translate from a host pointer
+ (typically a TLB entry) back to a ram offset. */
+ram_addr_t qemu_ram_addr_from_host(void *ptr)
+{
+ ram_addr_t ram_addr;
+
+ if (do_qemu_ram_addr_from_host(ptr, &ram_addr)) {
fprintf(stderr, "Bad ram pointer %p\n", ptr);
abort();
}
- return block->offset + (host - block->host);
+ return ram_addr;
}
static uint32_t unassigned_mem_readb(void *opaque, target_phys_addr_t addr)