[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 08/10] Add RAM -> physical addr mapping in MCE simul
From: |
Marcelo Tosatti |
Subject: |
[Qemu-devel] [PATCH 08/10] Add RAM -> physical addr mapping in MCE simulation |
Date: |
Tue, 19 Oct 2010 08:40:34 -0200 |
From: Huang Ying <address@hidden>
In QEMU-KVM, physical address != RAM address. While MCE simulation
needs physical address instead of RAM address. So
kvm_physical_memory_addr_from_ram() is implemented to do the
conversion, and it is invoked before being filled in the IA32_MCi_ADDR
MSR.
Reported-by: Dean Nelson <address@hidden>
Signed-off-by: Huang Ying <address@hidden>
Signed-off-by: Marcelo Tosatti <address@hidden>
Signed-off-by: Avi Kivity <address@hidden>
---
kvm-all.c | 18 ++++++++++++++++++
kvm.h | 3 +++
2 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/kvm-all.c b/kvm-all.c
index 1cc696f..37b99c7 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -137,6 +137,24 @@ static KVMSlot *kvm_lookup_overlapping_slot(KVMState *s,
return found;
}
+int kvm_physical_memory_addr_from_ram(KVMState *s, ram_addr_t ram_addr,
+ target_phys_addr_t *phys_addr)
+{
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(s->slots); i++) {
+ KVMSlot *mem = &s->slots[i];
+
+ if (ram_addr >= mem->phys_offset &&
+ ram_addr < mem->phys_offset + mem->memory_size) {
+ *phys_addr = mem->start_addr + (ram_addr - mem->phys_offset);
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
static int kvm_set_user_memory_region(KVMState *s, KVMSlot *slot)
{
struct kvm_userspace_memory_region mem;
diff --git a/kvm.h b/kvm.h
index 50b6c01..8f5a754 100644
--- a/kvm.h
+++ b/kvm.h
@@ -174,6 +174,9 @@ static inline void cpu_synchronize_post_init(CPUState *env)
}
}
+int kvm_physical_memory_addr_from_ram(KVMState *s, ram_addr_t ram_addr,
+ target_phys_addr_t *phys_addr);
+
#endif
int kvm_set_ioeventfd_mmio_long(int fd, uint32_t adr, uint32_t val, bool
assign);
--
1.7.2.1
- [Qemu-devel] [PATCH 00/10] [PULL] qemu-kvm.git uq/master queue, Marcelo Tosatti, 2010/10/19
- [Qemu-devel] [PATCH 06/10] kvm: x86: add mce support, Marcelo Tosatti, 2010/10/19
- [Qemu-devel] [PATCH 10/10] Add savevm/loadvm support for MCE, Marcelo Tosatti, 2010/10/19
- [Qemu-devel] [PATCH 09/10] MCE: Relay UCR MCE to guest, Marcelo Tosatti, 2010/10/19
- [Qemu-devel] [PATCH 07/10] Export qemu_ram_addr_from_host, Marcelo Tosatti, 2010/10/19
- [Qemu-devel] [PATCH 05/10] Expose thread_id in info cpus, Marcelo Tosatti, 2010/10/19
- [Qemu-devel] [PATCH 02/10] Add svm cpuid features, Marcelo Tosatti, 2010/10/19
- [Qemu-devel] [PATCH 03/10] signalfd compatibility, Marcelo Tosatti, 2010/10/19
- [Qemu-devel] [PATCH 08/10] Add RAM -> physical addr mapping in MCE simulation,
Marcelo Tosatti <=
- [Qemu-devel] [PATCH 04/10] iothread: use signalfd, Marcelo Tosatti, 2010/10/19
- [Qemu-devel] [PATCH 01/10] Set cpuid definition to 0 before initializing it, Marcelo Tosatti, 2010/10/19
- Re: [Qemu-devel] [PATCH 00/10] [PULL] qemu-kvm.git uq/master queue, Anthony Liguori, 2010/10/19
- [Qemu-devel] [PATCH 00/10] [PULL] qemu-kvm.git uq/master queue, Marcelo Tosatti, 2010/10/20
- [Qemu-devel] [PATCH 06/10] Export qemu_ram_addr_from_host, Marcelo Tosatti, 2010/10/20
- [Qemu-devel] [PATCH 10/10] Fix memory leak in register save load due to xsave support, Marcelo Tosatti, 2010/10/20
- [Qemu-devel] [PATCH 01/10] Set cpuid definition to 0 before initializing it, Marcelo Tosatti, 2010/10/20
- [Qemu-devel] [PATCH 04/10] iothread: use signalfd, Marcelo Tosatti, 2010/10/20
- [Qemu-devel] [PATCH 03/10] signalfd compatibility, Marcelo Tosatti, 2010/10/20
- [Qemu-devel] [PATCH 07/10] Add RAM -> physical addr mapping in MCE simulation, Marcelo Tosatti, 2010/10/20