[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [patch 6/8] Add RAM -> physical addr mapping in MCE simulat
From: |
Marcelo Tosatti |
Subject: |
[Qemu-devel] [patch 6/8] Add RAM -> physical addr mapping in MCE simulation |
Date: |
Mon, 11 Oct 2010 15:31:20 -0300 |
User-agent: |
quilt/0.47-1 |
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>
Index: qemu/kvm-all.c
===================================================================
--- qemu.orig/kvm-all.c
+++ qemu/kvm-all.c
@@ -137,6 +137,24 @@ static KVMSlot *kvm_lookup_overlapping_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;
Index: qemu/kvm.h
===================================================================
--- qemu.orig/kvm.h
+++ qemu/kvm.h
@@ -174,6 +174,9 @@ static inline void cpu_synchronize_post_
}
}
+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);
- [Qemu-devel] [patch uq/master 4/8] kvm: x86: add mce support, (continued)
- [Qemu-devel] [patch uq/master 4/8] kvm: x86: add mce support, Marcelo Tosatti, 2010/10/06
- [Qemu-devel] [patch uq/master 1/8] signalfd compatibility, Marcelo Tosatti, 2010/10/06
- [Qemu-devel] [patch uq/master 2/8] iothread: use signalfd, Marcelo Tosatti, 2010/10/06
- [Qemu-devel] [patch uq/master 5/8] Export qemu_ram_addr_from_host, Marcelo Tosatti, 2010/10/06
- [Qemu-devel] [patch uq/master 7/8] MCE: Relay UCR MCE to guest, Marcelo Tosatti, 2010/10/06
- [Qemu-devel] [patch 0/8] port qemu-kvm's MCE support (v3), Marcelo Tosatti, 2010/10/11
- [Qemu-devel] [patch 3/8] Expose thread_id in info cpus, Marcelo Tosatti, 2010/10/11
- [Qemu-devel] [patch 4/8] kvm: x86: add mce support, Marcelo Tosatti, 2010/10/11
- [Qemu-devel] [patch 2/8] iothread: use signalfd, Marcelo Tosatti, 2010/10/11
- [Qemu-devel] [patch 6/8] Add RAM -> physical addr mapping in MCE simulation,
Marcelo Tosatti <=
- [Qemu-devel] [patch 1/8] signalfd compatibility, Marcelo Tosatti, 2010/10/11
- [Qemu-devel] [patch 8/8] Add savevm/loadvm support for MCE, Marcelo Tosatti, 2010/10/11
- [Qemu-devel] [patch 5/8] Export qemu_ram_addr_from_host, Marcelo Tosatti, 2010/10/11
- [Qemu-devel] [patch 7/8] MCE: Relay UCR MCE to guest, Marcelo Tosatti, 2010/10/11
- [Qemu-devel] Re: [patch 0/8] port qemu-kvm's MCE support (v3), Avi Kivity, 2010/10/14
- [Qemu-devel] Re: [patch 0/8] port qemu-kvm's MCE support (v3), Marcelo Tosatti, 2010/10/14
- [Qemu-devel] Re: [patch 0/8] port qemu-kvm's MCE support (v3 resend), Avi Kivity, 2010/10/17